Merge pull request #439 from tuxxy/kprasch-mypy

#420 but rebased over kokonusswasser
pull/455/head
Tux 2018-09-18 18:13:41 +02:00 committed by GitHub
commit 9f7cdbd78c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 60 additions and 48 deletions

View File

@ -166,12 +166,16 @@ jobs:
- checkout - checkout
- attach_workspace: - attach_workspace:
at: ~/.local/share/virtualenvs/ at: ~/.local/share/virtualenvs/
- run:
name: Install lxml
command: |
pipenv run pip install lxml
- run: - run:
name: Run Mypy Static Type Checks name: Run Mypy Static Type Checks
command: | command: |
mkdir ./mypy_reports ./mypy_results mkdir ./mypy_reports ./mypy_results
export MYPYPATH=./nucypher export MYPYPATH=./nucypher
pipenv run mypy ./nucypher --config-file=mypy.ini --xslt-html-report ./mypy_reports/html/ --linecount-report ./mypy_reports/linecount --junit-xml ./mypy_results/results.xml || true pipenv run mypy ./nucypher --config-file=mypy.ini --xslt-html-report ./mypy_reports/html/ --linecount-report ./mypy_reports/linecount --junit-xml ./mypy_results/results.xml
- store_artifacts: - store_artifacts:
path: ./mypy_reports path: ./mypy_reports
- store_test_results: - store_test_results:

View File

@ -1,7 +1,7 @@
[mypy] [mypy]
python_version=3.6 python_version=3.6
verbosity=0 verbosity=0
[mypy-nucypher.*]
disallow_untyped_defs=False disallow_untyped_defs=False
check_untyped_defs=False check_untyped_defs=False
disallow_untyped_calls=False disallow_untyped_calls=False

View File

@ -8,7 +8,7 @@ class Economics:
initial_inflation=1.0, initial_inflation=1.0,
T_half=2.0, T_half=2.0,
T_sat=1.0, T_sat=1.0,
small_staker_multiplier=0.5): small_staker_multiplier=0.5) -> None:
""" """
Calculate parameters to use in token issuer from high-level Calculate parameters to use in token issuer from high-level
human-understandable parameters human-understandable parameters

View File

@ -80,7 +80,7 @@ class Miner(NucypherTokenActor):
def __init__(self, def __init__(self,
is_me=True, is_me=True,
miner_agent: MinerAgent = None, miner_agent: MinerAgent = None,
*args, **kwargs): *args, **kwargs) -> None:
miner_agent = miner_agent if miner_agent is not None else MinerAgent() miner_agent = miner_agent if miner_agent is not None else MinerAgent()
super().__init__(token_agent=miner_agent.token_agent, *args, **kwargs) super().__init__(token_agent=miner_agent.token_agent, *args, **kwargs)
@ -261,7 +261,7 @@ class Miner(NucypherTokenActor):
class PolicyAuthor(NucypherTokenActor): class PolicyAuthor(NucypherTokenActor):
"""Alice base class for blockchain operations, mocking up new policies!""" """Alice base class for blockchain operations, mocking up new policies!"""
def __init__(self, checksum_address: str, policy_agent: PolicyAgent = None): def __init__(self, checksum_address: str, policy_agent: PolicyAgent = None) -> None:
""" """
:param policy_agent: A policy agent with the blockchain attached; If not passed, A default policy :param policy_agent: A policy agent with the blockchain attached; If not passed, A default policy
agent and blockchain connection will be created from default values. agent and blockchain connection will be created from default values.

View File

@ -103,7 +103,7 @@ class MinerAgent(EthereumContractAgent):
class NotEnoughMiners(Exception): class NotEnoughMiners(Exception):
pass pass
def __init__(self, token_agent: NucypherTokenAgent=None, registry_filepath=None, *args, **kwargs): def __init__(self, token_agent: NucypherTokenAgent=None, registry_filepath=None, *args, **kwargs) -> None:
token_agent = token_agent if token_agent is not None else NucypherTokenAgent(registry_filepath=registry_filepath) token_agent = token_agent if token_agent is not None else NucypherTokenAgent(registry_filepath=registry_filepath)
super().__init__(blockchain=token_agent.blockchain, registry_filepath=registry_filepath, *args, **kwargs) super().__init__(blockchain=token_agent.blockchain, registry_filepath=registry_filepath, *args, **kwargs)
self.token_agent = token_agent self.token_agent = token_agent
@ -239,7 +239,7 @@ class PolicyAgent(EthereumContractAgent):
def __init__(self, def __init__(self,
miner_agent: MinerAgent = None, miner_agent: MinerAgent = None,
registry_filepath=None, registry_filepath=None,
*args, **kwargs): *args, **kwargs) -> None:
miner_agent = miner_agent if miner_agent is not None else MinerAgent(registry_filepath=registry_filepath) miner_agent = miner_agent if miner_agent is not None else MinerAgent(registry_filepath=registry_filepath)
super().__init__(blockchain=miner_agent.blockchain, registry_filepath=registry_filepath, *args, **kwargs) super().__init__(blockchain=miner_agent.blockchain, registry_filepath=registry_filepath, *args, **kwargs)
self.miner_agent = miner_agent self.miner_agent = miner_agent

View File

@ -20,7 +20,7 @@ class Blockchain:
class ConnectionNotEstablished(RuntimeError): class ConnectionNotEstablished(RuntimeError):
pass pass
def __init__(self, interface: Union[BlockchainInterface, BlockchainDeployerInterface]=None): def __init__(self, interface: Union[BlockchainInterface, BlockchainDeployerInterface]=None) -> None:
if interface is None: if interface is None:
interface = self.__default_interface_class() interface = self.__default_interface_class()
@ -108,7 +108,7 @@ class TesterBlockchain(Blockchain):
__default_num_test_accounts = 10 __default_num_test_accounts = 10
_default_network = 'tester' _default_network = 'tester'
def __init__(self, test_accounts=None, poa=True, airdrop=False, *args, **kwargs): def __init__(self, test_accounts=None, poa=True, airdrop=False, *args, **kwargs) -> None:
# Depends on circumflex # Depends on circumflex
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@ -18,7 +18,7 @@ class ContractDeployer:
class ContractDeploymentError(Exception): class ContractDeploymentError(Exception):
pass pass
def __init__(self, blockchain: Blockchain, deployer_address: str): def __init__(self, blockchain: Blockchain, deployer_address: str) -> None:
self.__armed = False self.__armed = False
self._contract = None self._contract = None
self.deployment_receipt = None self.deployment_receipt = None
@ -158,7 +158,7 @@ class NucypherTokenDeployer(ContractDeployer):
agency = NucypherTokenAgent agency = NucypherTokenAgent
_contract_name = agency.principal_contract_name # TODO _contract_name = agency.principal_contract_name # TODO
def __init__(self, blockchain, deployer_address): def __init__(self, blockchain, deployer_address) -> None:
if not type(blockchain.interface) is self._interface_class: if not type(blockchain.interface) is self._interface_class:
raise ValueError("{} must be used to create a {}".format(self._interface_class.__name__, raise ValueError("{} must be used to create a {}".format(self._interface_class.__name__,
self.__class__.__name__)) self.__class__.__name__))
@ -377,7 +377,7 @@ class UserEscrowDeployer(ContractDeployer):
agency = UserEscrowAgent agency = UserEscrowAgent
_contract_name = agency.principal_contract_name _contract_name = agency.principal_contract_name
def __init__(self, miner_escrow_deployer, policy_deployer, *args, **kwargs): def __init__(self, miner_escrow_deployer, policy_deployer, *args, **kwargs) -> None:
self.miner_deployer = miner_escrow_deployer self.miner_deployer = miner_escrow_deployer
self.policy_deployer = policy_deployer self.policy_deployer = policy_deployer
self.token_deployer = miner_escrow_deployer.token_deployer self.token_deployer = miner_escrow_deployer.token_deployer

View File

@ -329,7 +329,7 @@ class BlockchainInterface:
class BlockchainDeployerInterface(BlockchainInterface): class BlockchainDeployerInterface(BlockchainInterface):
def __init__(self, deployer_address: str=None, *args, **kwargs): def __init__(self, deployer_address: str=None, *args, **kwargs) -> None:
# Depends on web3 instance # Depends on web3 instance
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@ -27,7 +27,7 @@ class BlockchainArrangement(Arrangement):
value: int, value: int,
lock_periods: int, lock_periods: int,
expiration: maya.MayaDT, expiration: maya.MayaDT,
*args, **kwargs): *args, **kwargs) -> None:
super().__init__(alice=author, ursula=miner, *args, **kwargs) super().__init__(alice=author, ursula=miner, *args, **kwargs)
delta = expiration - maya.now() delta = expiration - maya.now()
@ -91,7 +91,7 @@ class BlockchainPolicy(Policy):
class NotEnoughBlockchainUrsulas(Exception): class NotEnoughBlockchainUrsulas(Exception):
pass pass
def __init__(self, author: PolicyAuthor, *args, **kwargs): def __init__(self, author: PolicyAuthor, *args, **kwargs) -> None:
self.author = author self.author = author
super().__init__(alice=author, *args, **kwargs) super().__init__(alice=author, *args, **kwargs)

View File

@ -28,7 +28,7 @@ class EthereumContractRegistry:
class IllegalRegistrar(RegistryError): class IllegalRegistrar(RegistryError):
"""Raised when invalid data is encountered in the registry""" """Raised when invalid data is encountered in the registry"""
def __init__(self, registry_filepath: str=None): def __init__(self, registry_filepath: str=None) -> None:
self.__registry_filepath = registry_filepath or self.__default_registry_path self.__registry_filepath = registry_filepath or self.__default_registry_path
@classmethod @classmethod
@ -120,7 +120,7 @@ class EthereumContractRegistry:
class TemporaryEthereumContractRegistry(EthereumContractRegistry): class TemporaryEthereumContractRegistry(EthereumContractRegistry):
def __init__(self): def __init__(self) -> None:
_, self.temp_filepath = tempfile.mkstemp() _, self.temp_filepath = tempfile.mkstemp()
super().__init__(registry_filepath=self.temp_filepath) super().__init__(registry_filepath=self.temp_filepath)

View File

@ -20,7 +20,7 @@ class SolidityCompiler:
__default_chain_name = 'tester' __default_chain_name = 'tester'
def __init__(self, solc_binary_path=None, configuration_path=None, def __init__(self, solc_binary_path=None, configuration_path=None,
chain_name=None, contract_dir=None, test_contract_dir=None): chain_name=None, contract_dir=None, test_contract_dir=None) -> None:
# Compiler binary and root solidity source code directory # Compiler binary and root solidity source code directory
self.__sol_binary_path = solc_binary_path if solc_binary_path is not None else self.__default_sol_binary_path self.__sol_binary_path = solc_binary_path if solc_binary_path is not None else self.__default_sol_binary_path

View File

@ -680,7 +680,7 @@ class Character:
class Alice(Character, PolicyAuthor): class Alice(Character, PolicyAuthor):
_default_crypto_powerups = [SigningPower, EncryptingPower, DelegatingPower] _default_crypto_powerups = [SigningPower, EncryptingPower, DelegatingPower]
def __init__(self, is_me=True, federated_only=False, network_middleware=None, *args, **kwargs): def __init__(self, is_me=True, federated_only=False, network_middleware=None, *args, **kwargs) -> None:
policy_agent = kwargs.pop("policy_agent", None) policy_agent = kwargs.pop("policy_agent", None)
checksum_address = kwargs.pop("checksum_address", None) checksum_address = kwargs.pop("checksum_address", None)
@ -787,7 +787,7 @@ class Alice(Character, PolicyAuthor):
class Bob(Character): class Bob(Character):
_default_crypto_powerups = [SigningPower, EncryptingPower] _default_crypto_powerups = [SigningPower, EncryptingPower]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
from nucypher.policy.models import WorkOrderHistory # Need a bigger strategy to avoid circulars. from nucypher.policy.models import WorkOrderHistory # Need a bigger strategy to avoid circulars.

View File

@ -232,7 +232,7 @@ class NucypherKeyring:
pub_root_key_path: str=None, pub_root_key_path: str=None,
signing_key_path: str=None, signing_key_path: str=None,
pub_signing_key_path: str=None, pub_signing_key_path: str=None,
transacting_key_path: str=None): transacting_key_path: str=None) -> None:
""" """
Generates a NuCypherKeyring instance with the provided key paths, Generates a NuCypherKeyring instance with the provided key paths,
falling back to default keyring paths. falling back to default keyring paths.

View File

@ -22,7 +22,7 @@ class CryptoKit:
class MessageKit(CryptoKit): class MessageKit(CryptoKit):
def __init__(self, capsule, sender_pubkey_sig=None, ciphertext=None, signature=constants.NOT_SIGNED): def __init__(self, capsule, sender_pubkey_sig=None, ciphertext=None, signature=constants.NOT_SIGNED) -> None:
self.ciphertext = ciphertext self.ciphertext = ciphertext
self.capsule = capsule self.capsule = capsule
self.sender_pubkey_sig = sender_pubkey_sig self.sender_pubkey_sig = sender_pubkey_sig
@ -52,7 +52,7 @@ class UmbralMessageKit(MessageKit):
return_remainder_when_splitting = True return_remainder_when_splitting = True
splitter = capsule_splitter + key_splitter splitter = capsule_splitter + key_splitter
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.policy_pubkey = None self.policy_pubkey = None

View File

@ -27,7 +27,7 @@ class NoBlockchainPower(PowerUpError):
class CryptoPower(object): class CryptoPower(object):
def __init__(self, power_ups=None): def __init__(self, power_ups=None) -> None:
self._power_ups = {} self._power_ups = {}
# TODO: The keys here will actually be IDs for looking up in a KeyStore. # TODO: The keys here will actually be IDs for looking up in a KeyStore.
self.public_keys = {} self.public_keys = {}
@ -74,7 +74,7 @@ class BlockchainPower(CryptoPowerUp):
""" """
not_found_error = NoBlockchainPower not_found_error = NoBlockchainPower
def __init__(self, blockchain: 'Blockchain', account: str): def __init__(self, blockchain: 'Blockchain', account: str) -> None:
""" """
Instantiates a BlockchainPower for the given account id. Instantiates a BlockchainPower for the given account id.
""" """
@ -196,7 +196,7 @@ class EncryptingPower(KeyPairBasedPower):
class DelegatingPower(DerivedKeyBasedPower): class DelegatingPower(DerivedKeyBasedPower):
def __init__(self): def __init__(self) -> None:
self.umbral_keying_material = UmbralKeyingMaterial() self.umbral_keying_material = UmbralKeyingMaterial()
def generate_kfrags(self, bob_pubkey_enc, signer, label, m, n) -> Union[UmbralPublicKey, List]: def generate_kfrags(self, bob_pubkey_enc, signer, label, m, n) -> Union[UmbralPublicKey, List]:

View File

@ -12,7 +12,7 @@ class SignatureStamp(object):
key as bytes. key as bytes.
""" """
def __init__(self, verifying_key, signer: Signer = None): def __init__(self, verifying_key, signer: Signer = None) -> None:
self.__signer = signer self.__signer = signer
self._as_bytes = bytes(verifying_key) self._as_bytes = bytes(verifying_key)
self._as_umbral_pubkey = verifying_key self._as_umbral_pubkey = verifying_key

View File

@ -8,7 +8,7 @@ from nucypher.keystore.keypairs import SigningKeypair
class DataSource: class DataSource:
def __init__(self, policy_pubkey_enc, signing_keypair=NO_SIGNING_POWER, label=None): def __init__(self, policy_pubkey_enc, signing_keypair=NO_SIGNING_POWER, label=None) -> None:
self.policy_pubkey = policy_pubkey_enc self.policy_pubkey = policy_pubkey_enc
if signing_keypair is NO_SIGNING_POWER: if signing_keypair is NO_SIGNING_POWER:
signing_keypair = SigningKeypair() # TODO: Generate signing key properly. #241 signing_keypair = SigningKeypair() # TODO: Generate signing key properly. #241

View File

@ -18,7 +18,7 @@ class Key(Base):
is_signing = Column(Boolean, unique=False) is_signing = Column(Boolean, unique=False)
created_at = Column(DateTime, default=datetime.utcnow) created_at = Column(DateTime, default=datetime.utcnow)
def __init__(self, fingerprint, key_data, is_signing): def __init__(self, fingerprint, key_data, is_signing) -> None:
self.fingerprint = fingerprint self.fingerprint = fingerprint
self.key_data = key_data self.key_data = key_data
self.is_signing = is_signing self.is_signing = is_signing
@ -47,7 +47,7 @@ class PolicyArrangement(Base):
def __init__(self, expiration, id, def __init__(self, expiration, id,
k_frag=None, alice_pubkey_sig=None, k_frag=None, alice_pubkey_sig=None,
# alice_pubkey_enc_id, bob_pubkey_sig_id, # alice_pubkey_enc_id, bob_pubkey_sig_id,
alice_signature=None): alice_signature=None) -> None:
self.expiration = expiration self.expiration = expiration
self.id = id self.id = id
self.k_frag = k_frag self.k_frag = k_frag
@ -66,7 +66,7 @@ class Workorder(Base):
arrangement_id = Column(LargeBinary, unique=False) arrangement_id = Column(LargeBinary, unique=False)
created_at = Column(DateTime, default=datetime.utcnow) created_at = Column(DateTime, default=datetime.utcnow)
def __init__(self, bob_pubkey_sig_id, bob_signature, arrangement_id): def __init__(self, bob_pubkey_sig_id, bob_signature, arrangement_id) -> None:
self.bob_pubkey_sig_id = bob_pubkey_sig_id self.bob_pubkey_sig_id = bob_pubkey_sig_id
self.bob_signature = bob_signature self.bob_signature = bob_signature
self.arrangement_id = arrangement_id self.arrangement_id = arrangement_id

View File

@ -29,7 +29,7 @@ class Keypair(object):
def __init__(self, def __init__(self,
private_key=None, private_key=None,
public_key=None, public_key=None,
generate_keys_if_needed=True): generate_keys_if_needed=True) -> None:
""" """
Initalizes a Keypair object with an Umbral key object. Initalizes a Keypair object with an Umbral key object.
:param generate_keys_if_needed: Generate keys or not? :param generate_keys_if_needed: Generate keys or not?
@ -75,7 +75,7 @@ class EncryptingKeypair(Keypair):
A keypair for Umbral A keypair for Umbral
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def decrypt(self, message_kit: MessageKit, verifying_key: UmbralPublicKey = None) -> bytes: def decrypt(self, message_kit: MessageKit, verifying_key: UmbralPublicKey = None) -> bytes:
@ -97,7 +97,7 @@ class SigningKeypair(Keypair):
A SigningKeypair that uses ECDSA. A SigningKeypair that uses ECDSA.
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def sign(self, message: bytes) -> bytes: def sign(self, message: bytes) -> bytes:
@ -135,8 +135,8 @@ class HostingKeypair(Keypair):
certificate=None, certificate=None,
curve=None, curve=None,
generate_keys_if_needed=True, generate_keys_if_needed=True,
save_cert_to_disk=False, save_cert_to_disk=False
): ) -> None:
self.curve = curve or self._DEFAULT_CURVE self.curve = curve or self._DEFAULT_CURVE

View File

@ -24,7 +24,7 @@ class KeyStore(object):
""" """
kfrag_splitter = BytestringSplitter(Signature, (KFrag, KFrag.expected_bytes_length())) kfrag_splitter = BytestringSplitter(Signature, (KFrag, KFrag.expected_bytes_length()))
def __init__(self, sqlalchemy_engine=None): def __init__(self, sqlalchemy_engine=None) -> None:
""" """
Initalizes a KeyStore object. Initalizes a KeyStore object.

View File

@ -3,7 +3,7 @@ from sqlalchemy.orm import sessionmaker, scoped_session
class ThreadedSession: class ThreadedSession:
def __init__(self, sqlalchemy_engine): def __init__(self, sqlalchemy_engine) -> None:
self.engine = sqlalchemy_engine self.engine = sqlalchemy_engine
def __enter__(self): def __enter__(self):

View File

@ -15,7 +15,7 @@ class SuspiciousActivity(RuntimeError):
class NucypherHashProtocol(KademliaProtocol): class NucypherHashProtocol(KademliaProtocol):
def __init__(self, sourceNode, storage, ksize, *args, **kwargs): def __init__(self, sourceNode, storage, ksize, *args, **kwargs) -> None:
super().__init__(sourceNode, storage, ksize, *args, **kwargs) super().__init__(sourceNode, storage, ksize, *args, **kwargs)
self.router = NucypherRoutingTable(self, ksize, sourceNode) self.router = NucypherRoutingTable(self, ksize, sourceNode)
@ -119,7 +119,7 @@ class NucypherHashProtocol(KademliaProtocol):
class NucypherSeedOnlyProtocol(NucypherHashProtocol): class NucypherSeedOnlyProtocol(NucypherHashProtocol):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def rpc_store(self, sender, nodeid, key, value): def rpc_store(self, sender, nodeid, key, value):
@ -134,7 +134,7 @@ class NucypherSeedOnlyProtocol(NucypherHashProtocol):
class InterfaceInfo: class InterfaceInfo:
expected_bytes_length = lambda: VariableLengthBytestring expected_bytes_length = lambda: VariableLengthBytestring
def __init__(self, host, port): def __init__(self, host, port) -> None:
self.host = host self.host = host
self.port = int(port) self.port = int(port)

View File

@ -28,7 +28,7 @@ class NucypherDHTServer(Server):
capabilities = () capabilities = ()
digests_set = 0 digests_set = 0
def __init__(self, node_storage, treasure_map_storage, federated_only=False, id=None, *args, **kwargs): def __init__(self, node_storage, treasure_map_storage, federated_only=False, id=None, *args, **kwargs) -> None:
super().__init__(ksize=20, alpha=3, id=None, storage=None) super().__init__(ksize=20, alpha=3, id=None, storage=None)
self.node = kademlia.node.Node(id=id or digest( self.node = kademlia.node.Node(id=id or digest(
random.getrandbits(255))) # TODO: Assume that this can be attacked to get closer to desired kFrags. random.getrandbits(255))) # TODO: Assume that this can be attacked to get closer to desired kFrags.
@ -92,6 +92,14 @@ class NucypherDHTServer(Server):
return await self.set_digest(key, value) return await self.set_digest(key, value)
class NucypherSeedOnlyDHTServer(NucypherDHTServer):
protocol_class = NucypherSeedOnlyProtocol
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.storage = SeedOnlyStorage()
class ProxyRESTServer: class ProxyRESTServer:
log = getLogger("characters") log = getLogger("characters")

View File

@ -33,7 +33,7 @@ class Arrangement:
(bytes, 27)) (bytes, 27))
def __init__(self, alice, expiration, ursula=None, id=None, def __init__(self, alice, expiration, ursula=None, id=None,
kfrag=constants.UNKNOWN_KFRAG, value=None, alices_signature=None): kfrag=constants.UNKNOWN_KFRAG, value=None, alices_signature=None) -> None:
""" """
:param deposit: Funds which will pay for the timeframe of this Arrangement (not the actual re-encryptions); :param deposit: Funds which will pay for the timeframe of this Arrangement (not the actual re-encryptions);
a portion will be locked for each Ursula that accepts. a portion will be locked for each Ursula that accepts.
@ -105,7 +105,7 @@ class Policy:
""" """
def __init__(self, alice, label, bob=None, kfrags=(constants.UNKNOWN_KFRAG,), def __init__(self, alice, label, bob=None, kfrags=(constants.UNKNOWN_KFRAG,),
public_key=None, m=None, alices_signature=constants.NOT_SIGNED): public_key=None, m=None, alices_signature=constants.NOT_SIGNED) -> None:
""" """
:param kfrags: A list of KFrags to distribute per this Policy. :param kfrags: A list of KFrags to distribute per this Policy.
@ -274,7 +274,7 @@ class Policy:
class FederatedPolicy(Policy): class FederatedPolicy(Policy):
_arrangement_class = Arrangement _arrangement_class = Arrangement
def __init__(self, ursulas: Set[Ursula], *args, **kwargs): def __init__(self, ursulas: Set[Ursula], *args, **kwargs) -> None:
self.ursulas = ursulas self.ursulas = ursulas
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -321,7 +321,7 @@ class TreasureMap:
destinations=None, destinations=None,
message_kit=None, message_kit=None,
public_signature=None, public_signature=None,
hrac=None): hrac=None) -> None:
if m is not None: if m is not None:
if m > 255: if m > 255:
@ -447,7 +447,7 @@ class TreasureMap:
class WorkOrder(object): class WorkOrder(object):
def __init__(self, bob, arrangement_id, capsules, receipt_bytes, def __init__(self, bob, arrangement_id, capsules, receipt_bytes,
receipt_signature, ursula=None): receipt_signature, ursula=None) -> None:
self.bob = bob self.bob = bob
self.arrangement_id = arrangement_id self.arrangement_id = arrangement_id
self.capsules = capsules self.capsules = capsules
@ -501,7 +501,7 @@ class WorkOrder(object):
class WorkOrderHistory: class WorkOrderHistory:
def __init__(self): def __init__(self) -> None:
self.by_ursula = {} self.by_ursula = {}
def __contains__(self, item): def __contains__(self, item):