mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Clean unused imports and more cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from binascii import hexlify, unhexlify
|
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
|
from binascii import hexlify, unhexlify
|
||||||
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
||||||
|
|
||||||
from apps.cli import SUPPORTED_HASH_FUNCTIONS, SUPPORTED_CIPHERS
|
from apps.cli import SUPPORTED_HASH_FUNCTIONS, SUPPORTED_CIPHERS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from getopt import getopt, GetoptError
|
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import unhexlify
|
||||||
|
from getopt import getopt, GetoptError
|
||||||
from requests import ConnectTimeout, ConnectionError
|
from requests import ConnectTimeout, ConnectionError
|
||||||
from apps.cli import DEFAULT_PISA_API_SERVER, DEFAULT_PISA_API_PORT, CLIENT_LOG_FILE
|
|
||||||
from apps.cli.blob import Blob
|
from apps.cli.blob import Blob
|
||||||
from apps.cli.help import help_add_appointment, help_get_appointment
|
from apps.cli.help import help_add_appointment, help_get_appointment
|
||||||
|
from apps.cli import DEFAULT_PISA_API_SERVER, DEFAULT_PISA_API_PORT, CLIENT_LOG_FILE
|
||||||
|
|
||||||
|
|
||||||
def show_message(message, debug, logging):
|
def show_message(message, debug, logging):
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import requests
|
|
||||||
import time
|
import time
|
||||||
|
import requests
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import unhexlify
|
||||||
from apps.cli.blob import Blob
|
|
||||||
from pisa import HOST, PORT
|
from pisa import HOST, PORT
|
||||||
|
from apps.cli.blob import Blob
|
||||||
from pisa.utils.auth_proxy import AuthServiceProxy
|
from pisa.utils.auth_proxy import AuthServiceProxy
|
||||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,12 @@
|
|||||||
import logging
|
import pisa.conf as conf
|
||||||
from pisa.inspector import Inspector
|
from pisa.inspector import Inspector
|
||||||
from pisa.appointment import Appointment
|
from pisa.appointment import Appointment
|
||||||
from pisa import errors
|
from pisa import errors, logging, bitcoin_cli
|
||||||
from pisa.utils.authproxy import AuthServiceProxy, JSONRPCException
|
from pisa.utils.auth_proxy import JSONRPCException
|
||||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT, SUPPORTED_HASH_FUNCTIONS, \
|
|
||||||
SUPPORTED_CIPHERS, TEST_LOG_FILE
|
|
||||||
|
|
||||||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO, handlers=[
|
|
||||||
logging.FileHandler(TEST_LOG_FILE)
|
|
||||||
])
|
|
||||||
|
|
||||||
appointment = {"locator": None, "start_time": None, "end_time": None, "dispute_delta": None,
|
appointment = {"locator": None, "start_time": None, "end_time": None, "dispute_delta": None,
|
||||||
"encrypted_blob": None, "cipher": None, "hash_function": None}
|
"encrypted_blob": None, "cipher": None, "hash_function": None}
|
||||||
|
|
||||||
bitcoin_cli = AuthServiceProxy("http://%s:%s@%s:%d" % (BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST,
|
|
||||||
BTC_RPC_PORT))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
block_height = bitcoin_cli.getblockcount()
|
block_height = bitcoin_cli.getblockcount()
|
||||||
|
|
||||||
@@ -54,7 +45,7 @@ cipher_rets = [errors.APPOINTMENT_EMPTY_FIELD, errors.APPOINTMENT_WRONG_FIELD_TY
|
|||||||
hash_function_rets = [errors.APPOINTMENT_EMPTY_FIELD, errors.APPOINTMENT_WRONG_FIELD_TYPE,
|
hash_function_rets = [errors.APPOINTMENT_EMPTY_FIELD, errors.APPOINTMENT_WRONG_FIELD_TYPE,
|
||||||
errors.APPOINTMENT_HASH_FUNCTION_NOT_SUPPORTED, errors.APPOINTMENT_HASH_FUNCTION_NOT_SUPPORTED]
|
errors.APPOINTMENT_HASH_FUNCTION_NOT_SUPPORTED, errors.APPOINTMENT_HASH_FUNCTION_NOT_SUPPORTED]
|
||||||
|
|
||||||
inspector = Inspector(debug=True, logging=logging)
|
inspector = Inspector()
|
||||||
|
|
||||||
print("Locator tests\n")
|
print("Locator tests\n")
|
||||||
for locator, ret in zip(locators, locators_rets):
|
for locator, ret in zip(locators, locators_rets):
|
||||||
@@ -119,7 +110,7 @@ for cipher, ret in zip(ciphers, cipher_rets):
|
|||||||
print(r)
|
print(r)
|
||||||
|
|
||||||
# Setting the cipher to the only supported one for now
|
# Setting the cipher to the only supported one for now
|
||||||
appointment['cipher'] = SUPPORTED_CIPHERS[0]
|
appointment['cipher'] = conf.SUPPORTED_CIPHERS[0]
|
||||||
|
|
||||||
print("\nHash function tests\n")
|
print("\nHash function tests\n")
|
||||||
for hash_function, ret in zip(hash_functions, hash_function_rets):
|
for hash_function, ret in zip(hash_functions, hash_function_rets):
|
||||||
@@ -130,7 +121,7 @@ for hash_function, ret in zip(hash_functions, hash_function_rets):
|
|||||||
print(r)
|
print(r)
|
||||||
|
|
||||||
# Setting the cipher to the only supported one for now
|
# Setting the cipher to the only supported one for now
|
||||||
appointment['hash_function'] = SUPPORTED_HASH_FUNCTIONS[0]
|
appointment['hash_function'] = conf.SUPPORTED_HASH_FUNCTIONS[0]
|
||||||
|
|
||||||
r = inspector.inspect(appointment)
|
r = inspector.inspect(appointment)
|
||||||
assert type(r) == Appointment
|
assert type(r) == Appointment
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import binascii
|
from pisa.utils.auth_proxy import AuthServiceProxy, JSONRPCException
|
||||||
from pisa.utils.authproxy import AuthServiceProxy, JSONRPCException
|
|
||||||
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
from pisa.conf import BTC_RPC_USER, BTC_RPC_PASSWD, BTC_RPC_HOST, BTC_RPC_PORT
|
||||||
from pisa.tools import check_txid_format
|
from pisa.tools import check_txid_format
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import random
|
import random
|
||||||
from os import urandom
|
from os import urandom
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from binascii import hexlify
|
|
||||||
|
|
||||||
from pisa import logging
|
from pisa import logging
|
||||||
from pisa.responder import Job
|
from pisa.responder import Job
|
||||||
|
|||||||
Reference in New Issue
Block a user