repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
next_channel_from_routes
def next_channel_from_routes( available_routes: List[RouteState], channelidentifiers_to_channels: ChannelMap, transfer_amount: PaymentAmount, ) -> Optional[NettingChannelState]: """ Returns the first channel that can be used to start the transfer. The routing service can race with local ...
python
def next_channel_from_routes( available_routes: List[RouteState], channelidentifiers_to_channels: ChannelMap, transfer_amount: PaymentAmount, ) -> Optional[NettingChannelState]: """ Returns the first channel that can be used to start the transfer. The routing service can race with local ...
[ "def", "next_channel_from_routes", "(", "available_routes", ":", "List", "[", "RouteState", "]", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "transfer_amount", ":", "PaymentAmount", ",", ")", "->", "Optional", "[", "NettingChannelState", "]", ":", ...
Returns the first channel that can be used to start the transfer. The routing service can race with local changes, so the recommended routes must be validated.
[ "Returns", "the", "first", "channel", "that", "can", "be", "used", "to", "start", "the", "transfer", ".", "The", "routing", "service", "can", "race", "with", "local", "changes", "so", "the", "recommended", "routes", "must", "be", "validated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L178-L211
train
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
send_lockedtransfer
def send_lockedtransfer( transfer_description: TransferDescriptionWithSecretState, channel_state: NettingChannelState, message_identifier: MessageID, block_number: BlockNumber, ) -> SendLockedTransfer: """ Create a mediated transfer using channel. """ assert channel_state.token_n...
python
def send_lockedtransfer( transfer_description: TransferDescriptionWithSecretState, channel_state: NettingChannelState, message_identifier: MessageID, block_number: BlockNumber, ) -> SendLockedTransfer: """ Create a mediated transfer using channel. """ assert channel_state.token_n...
[ "def", "send_lockedtransfer", "(", "transfer_description", ":", "TransferDescriptionWithSecretState", ",", "channel_state", ":", "NettingChannelState", ",", "message_identifier", ":", "MessageID", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "SendLockedTransfer"...
Create a mediated transfer using channel.
[ "Create", "a", "mediated", "transfer", "using", "channel", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L267-L298
train
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
handle_offchain_secretreveal
def handle_offchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ Once the next hop proves it knows the secret, t...
python
def handle_offchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ Once the next hop proves it knows the secret, t...
[ "def", "handle_offchain_secretreveal", "(", "initiator_state", ":", "InitiatorTransferState", ",", "state_change", ":", "ReceiveSecretReveal", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", "->", ...
Once the next hop proves it knows the secret, the initiator can unlock the mediated transfer. This will validate the secret, and if valid a new balance proof is sent to the next hop with the current lock removed from the merkle tree and the transferred amount updated.
[ "Once", "the", "next", "hop", "proves", "it", "knows", "the", "secret", "the", "initiator", "can", "unlock", "the", "mediated", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L371-L406
train
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
handle_onchain_secretreveal
def handle_onchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ContractReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ When a secret is revealed on-chain all n...
python
def handle_onchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ContractReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ When a secret is revealed on-chain all n...
[ "def", "handle_onchain_secretreveal", "(", "initiator_state", ":", "InitiatorTransferState", ",", "state_change", ":", "ContractReceiveSecretReveal", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", ...
When a secret is revealed on-chain all nodes learn the secret. This check the on-chain secret corresponds to the one used by the initiator, and if valid a new balance proof is sent to the next hop with the current lock removed from the merkle tree and the transferred amount updated.
[ "When", "a", "secret", "is", "revealed", "on", "-", "chain", "all", "nodes", "learn", "the", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L409-L459
train
raiden-network/raiden
raiden/transfer/channel.py
is_lock_pending
def is_lock_pending( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` corresponds to a lock that is pending to be claimed and didn't expire. """ return ( secrethash in end_state.secrethashes_to_lockedlocks or secrethash in ...
python
def is_lock_pending( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` corresponds to a lock that is pending to be claimed and didn't expire. """ return ( secrethash in end_state.secrethashes_to_lockedlocks or secrethash in ...
[ "def", "is_lock_pending", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "bool", ":", "return", "(", "secrethash", "in", "end_state", ".", "secrethashes_to_lockedlocks", "or", "secrethash", "in", "end_state", ...
True if the `secrethash` corresponds to a lock that is pending to be claimed and didn't expire.
[ "True", "if", "the", "secrethash", "corresponds", "to", "a", "lock", "that", "is", "pending", "to", "be", "claimed", "and", "didn", "t", "expire", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L156-L167
train
raiden-network/raiden
raiden/transfer/channel.py
is_deposit_confirmed
def is_deposit_confirmed( channel_state: NettingChannelState, block_number: BlockNumber, ) -> bool: """True if the block which mined the deposit transaction has been confirmed. """ if not channel_state.deposit_transaction_queue: return False return is_transaction_confirmed( ...
python
def is_deposit_confirmed( channel_state: NettingChannelState, block_number: BlockNumber, ) -> bool: """True if the block which mined the deposit transaction has been confirmed. """ if not channel_state.deposit_transaction_queue: return False return is_transaction_confirmed( ...
[ "def", "is_deposit_confirmed", "(", "channel_state", ":", "NettingChannelState", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "bool", ":", "if", "not", "channel_state", ".", "deposit_transaction_queue", ":", "return", "False", "return", "is_transaction_con...
True if the block which mined the deposit transaction has been confirmed.
[ "True", "if", "the", "block", "which", "mined", "the", "deposit", "transaction", "has", "been", "confirmed", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L170-L183
train
raiden-network/raiden
raiden/transfer/channel.py
is_lock_expired
def is_lock_expired( end_state: NettingChannelEndState, lock: LockType, block_number: BlockNumber, lock_expiration_threshold: BlockNumber, ) -> SuccessOrError: """ Determine whether a lock has expired. The lock has expired if both: - The secret was not registered on-cha...
python
def is_lock_expired( end_state: NettingChannelEndState, lock: LockType, block_number: BlockNumber, lock_expiration_threshold: BlockNumber, ) -> SuccessOrError: """ Determine whether a lock has expired. The lock has expired if both: - The secret was not registered on-cha...
[ "def", "is_lock_expired", "(", "end_state", ":", "NettingChannelEndState", ",", "lock", ":", "LockType", ",", "block_number", ":", "BlockNumber", ",", "lock_expiration_threshold", ":", "BlockNumber", ",", ")", "->", "SuccessOrError", ":", "secret_registered_on_chain", ...
Determine whether a lock has expired. The lock has expired if both: - The secret was not registered on-chain in time. - The current block exceeds lock's expiration + confirmation blocks.
[ "Determine", "whether", "a", "lock", "has", "expired", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L194-L219
train
raiden-network/raiden
raiden/transfer/channel.py
is_secret_known
def is_secret_known( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` is for a lock with a known secret.""" return ( secrethash in end_state.secrethashes_to_unlockedlocks or secrethash in end_state.secrethashes_to_onchain_unlockedl...
python
def is_secret_known( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` is for a lock with a known secret.""" return ( secrethash in end_state.secrethashes_to_unlockedlocks or secrethash in end_state.secrethashes_to_onchain_unlockedl...
[ "def", "is_secret_known", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "bool", ":", "return", "(", "secrethash", "in", "end_state", ".", "secrethashes_to_unlockedlocks", "or", "secrethash", "in", "end_state",...
True if the `secrethash` is for a lock with a known secret.
[ "True", "if", "the", "secrethash", "is", "for", "a", "lock", "with", "a", "known", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L237-L245
train
raiden-network/raiden
raiden/transfer/channel.py
get_secret
def get_secret( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[Secret]: """Returns `secret` if the `secrethash` is for a lock with a known secret.""" partial_unlock_proof = end_state.secrethashes_to_unlockedlocks.get(secrethash) if partial_unlock_proof is None: ...
python
def get_secret( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[Secret]: """Returns `secret` if the `secrethash` is for a lock with a known secret.""" partial_unlock_proof = end_state.secrethashes_to_unlockedlocks.get(secrethash) if partial_unlock_proof is None: ...
[ "def", "get_secret", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "Optional", "[", "Secret", "]", ":", "partial_unlock_proof", "=", "end_state", ".", "secrethashes_to_unlockedlocks", ".", "get", "(", "secre...
Returns `secret` if the `secrethash` is for a lock with a known secret.
[ "Returns", "secret", "if", "the", "secrethash", "is", "for", "a", "lock", "with", "a", "known", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L264-L277
train
raiden-network/raiden
raiden/transfer/channel.py
is_balance_proof_safe_for_onchain_operations
def is_balance_proof_safe_for_onchain_operations( balance_proof: BalanceProofSignedState, ) -> bool: """ Check if the balance proof would overflow onchain. """ total_amount = balance_proof.transferred_amount + balance_proof.locked_amount return total_amount <= UINT256_MAX
python
def is_balance_proof_safe_for_onchain_operations( balance_proof: BalanceProofSignedState, ) -> bool: """ Check if the balance proof would overflow onchain. """ total_amount = balance_proof.transferred_amount + balance_proof.locked_amount return total_amount <= UINT256_MAX
[ "def", "is_balance_proof_safe_for_onchain_operations", "(", "balance_proof", ":", "BalanceProofSignedState", ",", ")", "->", "bool", ":", "total_amount", "=", "balance_proof", ".", "transferred_amount", "+", "balance_proof", ".", "locked_amount", "return", "total_amount", ...
Check if the balance proof would overflow onchain.
[ "Check", "if", "the", "balance", "proof", "would", "overflow", "onchain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L288-L293
train
raiden-network/raiden
raiden/transfer/channel.py
is_balance_proof_usable_onchain
def is_balance_proof_usable_onchain( received_balance_proof: BalanceProofSignedState, channel_state: NettingChannelState, sender_state: NettingChannelEndState, ) -> SuccessOrError: """ Checks the balance proof can be used on-chain. For a balance proof to be valid it must be newer than t...
python
def is_balance_proof_usable_onchain( received_balance_proof: BalanceProofSignedState, channel_state: NettingChannelState, sender_state: NettingChannelEndState, ) -> SuccessOrError: """ Checks the balance proof can be used on-chain. For a balance proof to be valid it must be newer than t...
[ "def", "is_balance_proof_usable_onchain", "(", "received_balance_proof", ":", "BalanceProofSignedState", ",", "channel_state", ":", "NettingChannelState", ",", "sender_state", ":", "NettingChannelEndState", ",", ")", "->", "SuccessOrError", ":", "expected_nonce", "=", "get_...
Checks the balance proof can be used on-chain. For a balance proof to be valid it must be newer than the previous one, i.e. the nonce must increase, the signature must tie the balance proof to the correct channel, and the values must not result in an under/overflow onchain. Important: This predica...
[ "Checks", "the", "balance", "proof", "can", "be", "used", "on", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L368-L462
train
raiden-network/raiden
raiden/transfer/channel.py
get_distributable
def get_distributable( sender: NettingChannelEndState, receiver: NettingChannelEndState, ) -> TokenAmount: """Return the amount of tokens that can be used by the `sender`. The returned value is limited to a UINT256, since that is the representation used in the smart contracts and we cannot ...
python
def get_distributable( sender: NettingChannelEndState, receiver: NettingChannelEndState, ) -> TokenAmount: """Return the amount of tokens that can be used by the `sender`. The returned value is limited to a UINT256, since that is the representation used in the smart contracts and we cannot ...
[ "def", "get_distributable", "(", "sender", ":", "NettingChannelEndState", ",", "receiver", ":", "NettingChannelEndState", ",", ")", "->", "TokenAmount", ":", "_", ",", "_", ",", "transferred_amount", ",", "locked_amount", "=", "get_current_balanceproof", "(", "sende...
Return the amount of tokens that can be used by the `sender`. The returned value is limited to a UINT256, since that is the representation used in the smart contracts and we cannot use a larger value. The limit is enforced on transferred_amount + locked_amount to avoid overflows. This is an additional ...
[ "Return", "the", "amount", "of", "tokens", "that", "can", "be", "used", "by", "the", "sender", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L950-L970
train
raiden-network/raiden
raiden/transfer/channel.py
get_batch_unlock
def get_batch_unlock( end_state: NettingChannelEndState, ) -> Optional[MerkleTreeLeaves]: """ Unlock proof for an entire merkle tree of pending locks The unlock proof contains all the merkle tree data, tightly packed, needed by the token network contract to verify the secret expiry and calculate th...
python
def get_batch_unlock( end_state: NettingChannelEndState, ) -> Optional[MerkleTreeLeaves]: """ Unlock proof for an entire merkle tree of pending locks The unlock proof contains all the merkle tree data, tightly packed, needed by the token network contract to verify the secret expiry and calculate th...
[ "def", "get_batch_unlock", "(", "end_state", ":", "NettingChannelEndState", ",", ")", "->", "Optional", "[", "MerkleTreeLeaves", "]", ":", "if", "len", "(", "end_state", ".", "merkletree", ".", "layers", "[", "LEAVES", "]", ")", "==", "0", ":", "# pylint: di...
Unlock proof for an entire merkle tree of pending locks The unlock proof contains all the merkle tree data, tightly packed, needed by the token network contract to verify the secret expiry and calculate the token amounts to transfer.
[ "Unlock", "proof", "for", "an", "entire", "merkle", "tree", "of", "pending", "locks" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L973-L1007
train
raiden-network/raiden
raiden/transfer/channel.py
get_lock
def get_lock( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[HashTimeLockState]: """Return the lock correspoding to `secrethash` or None if the lock is unknown. """ lock = end_state.secrethashes_to_lockedlocks.get(secrethash) if not lock: partial_un...
python
def get_lock( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[HashTimeLockState]: """Return the lock correspoding to `secrethash` or None if the lock is unknown. """ lock = end_state.secrethashes_to_lockedlocks.get(secrethash) if not lock: partial_un...
[ "def", "get_lock", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "Optional", "[", "HashTimeLockState", "]", ":", "lock", "=", "end_state", ".", "secrethashes_to_lockedlocks", ".", "get", "(", "secrethash", ...
Return the lock correspoding to `secrethash` or None if the lock is unknown.
[ "Return", "the", "lock", "correspoding", "to", "secrethash", "or", "None", "if", "the", "lock", "is", "unknown", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1010-L1029
train
raiden-network/raiden
raiden/transfer/channel.py
lock_exists_in_either_channel_side
def lock_exists_in_either_channel_side( channel_state: NettingChannelState, secrethash: SecretHash, ) -> bool: """Check if the lock with `secrethash` exists in either our state or the partner's state""" lock = get_lock(channel_state.our_state, secrethash) if not lock: lock = get_lock...
python
def lock_exists_in_either_channel_side( channel_state: NettingChannelState, secrethash: SecretHash, ) -> bool: """Check if the lock with `secrethash` exists in either our state or the partner's state""" lock = get_lock(channel_state.our_state, secrethash) if not lock: lock = get_lock...
[ "def", "lock_exists_in_either_channel_side", "(", "channel_state", ":", "NettingChannelState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "bool", ":", "lock", "=", "get_lock", "(", "channel_state", ".", "our_state", ",", "secrethash", ")", "if", "not", ...
Check if the lock with `secrethash` exists in either our state or the partner's state
[ "Check", "if", "the", "lock", "with", "secrethash", "exists", "in", "either", "our", "state", "or", "the", "partner", "s", "state" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1032-L1040
train
raiden-network/raiden
raiden/transfer/channel.py
_del_lock
def _del_lock(end_state: NettingChannelEndState, secrethash: SecretHash) -> None: """Removes the lock from the indexing structures. Note: This won't change the merkletree! """ assert is_lock_pending(end_state, secrethash) _del_unclaimed_lock(end_state, secrethash) if secrethash in end...
python
def _del_lock(end_state: NettingChannelEndState, secrethash: SecretHash) -> None: """Removes the lock from the indexing structures. Note: This won't change the merkletree! """ assert is_lock_pending(end_state, secrethash) _del_unclaimed_lock(end_state, secrethash) if secrethash in end...
[ "def", "_del_lock", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ")", "->", "None", ":", "assert", "is_lock_pending", "(", "end_state", ",", "secrethash", ")", "_del_unclaimed_lock", "(", "end_state", ",", "secrethash", ")...
Removes the lock from the indexing structures. Note: This won't change the merkletree!
[ "Removes", "the", "lock", "from", "the", "indexing", "structures", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1103-L1114
train
raiden-network/raiden
raiden/transfer/channel.py
compute_merkletree_with
def compute_merkletree_with( merkletree: MerkleTreeState, lockhash: LockHash, ) -> Optional[MerkleTreeState]: """Register the given lockhash with the existing merkle tree.""" # Use None to inform the caller the lockshash is already known result = None leaves = merkletree.layers[LEAVES] ...
python
def compute_merkletree_with( merkletree: MerkleTreeState, lockhash: LockHash, ) -> Optional[MerkleTreeState]: """Register the given lockhash with the existing merkle tree.""" # Use None to inform the caller the lockshash is already known result = None leaves = merkletree.layers[LEAVES] ...
[ "def", "compute_merkletree_with", "(", "merkletree", ":", "MerkleTreeState", ",", "lockhash", ":", "LockHash", ",", ")", "->", "Optional", "[", "MerkleTreeState", "]", ":", "# Use None to inform the caller the lockshash is already known", "result", "=", "None", "leaves", ...
Register the given lockhash with the existing merkle tree.
[ "Register", "the", "given", "lockhash", "with", "the", "existing", "merkle", "tree", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1172-L1186
train
raiden-network/raiden
raiden/transfer/channel.py
register_offchain_secret
def register_offchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, ) -> None: """This will register the secret and set the lock to the unlocked stated. Even though the lock is unlock it is *not* claimed. The capacity will increase once the next...
python
def register_offchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, ) -> None: """This will register the secret and set the lock to the unlocked stated. Even though the lock is unlock it is *not* claimed. The capacity will increase once the next...
[ "def", "register_offchain_secret", "(", "channel_state", ":", "NettingChannelState", ",", "secret", ":", "Secret", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "None", ":", "our_state", "=", "channel_state", ".", "our_state", "partner_state", "=", "channe...
This will register the secret and set the lock to the unlocked stated. Even though the lock is unlock it is *not* claimed. The capacity will increase once the next balance proof is received.
[ "This", "will", "register", "the", "secret", "and", "set", "the", "lock", "to", "the", "unlocked", "stated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1590-L1604
train
raiden-network/raiden
raiden/transfer/channel.py
register_onchain_secret
def register_onchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, secret_reveal_block_number: BlockNumber, delete_lock: bool = True, ) -> None: """This will register the onchain secret and set the lock to the unlocked stated. Even t...
python
def register_onchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, secret_reveal_block_number: BlockNumber, delete_lock: bool = True, ) -> None: """This will register the onchain secret and set the lock to the unlocked stated. Even t...
[ "def", "register_onchain_secret", "(", "channel_state", ":", "NettingChannelState", ",", "secret", ":", "Secret", ",", "secrethash", ":", "SecretHash", ",", "secret_reveal_block_number", ":", "BlockNumber", ",", "delete_lock", ":", "bool", "=", "True", ",", ")", "...
This will register the onchain secret and set the lock to the unlocked stated. Even though the lock is unlocked it is *not* claimed. The capacity will increase once the next balance proof is received.
[ "This", "will", "register", "the", "onchain", "secret", "and", "set", "the", "lock", "to", "the", "unlocked", "stated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1607-L1635
train
raiden-network/raiden
raiden/transfer/channel.py
handle_receive_lockedtransfer
def handle_receive_lockedtransfer( channel_state: NettingChannelState, mediated_transfer: LockedTransferSignedState, ) -> EventsOrError: """Register the latest known transfer. The receiver needs to use this method to update the container with a _valid_ transfer, otherwise the locksroot will...
python
def handle_receive_lockedtransfer( channel_state: NettingChannelState, mediated_transfer: LockedTransferSignedState, ) -> EventsOrError: """Register the latest known transfer. The receiver needs to use this method to update the container with a _valid_ transfer, otherwise the locksroot will...
[ "def", "handle_receive_lockedtransfer", "(", "channel_state", ":", "NettingChannelState", ",", "mediated_transfer", ":", "LockedTransferSignedState", ",", ")", "->", "EventsOrError", ":", "events", ":", "List", "[", "Event", "]", "is_valid", ",", "msg", ",", "merkle...
Register the latest known transfer. The receiver needs to use this method to update the container with a _valid_ transfer, otherwise the locksroot will not contain the pending transfer. The receiver needs to ensure that the merkle root has the secrethash included, otherwise it won't be able to claim it...
[ "Register", "the", "latest", "known", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1742-L1783
train
raiden-network/raiden
raiden/utils/notifying_queue.py
NotifyingQueue.get
def get(self, block=True, timeout=None): """ Removes and returns an item from the queue. """ value = self._queue.get(block, timeout) if self._queue.empty(): self.clear() return value
python
def get(self, block=True, timeout=None): """ Removes and returns an item from the queue. """ value = self._queue.get(block, timeout) if self._queue.empty(): self.clear() return value
[ "def", "get", "(", "self", ",", "block", "=", "True", ",", "timeout", "=", "None", ")", ":", "value", "=", "self", ".", "_queue", ".", "get", "(", "block", ",", "timeout", ")", "if", "self", ".", "_queue", ".", "empty", "(", ")", ":", "self", "...
Removes and returns an item from the queue.
[ "Removes", "and", "returns", "an", "item", "from", "the", "queue", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/notifying_queue.py#L18-L23
train
raiden-network/raiden
raiden/utils/notifying_queue.py
NotifyingQueue.copy
def copy(self): """ Copies the current queue items. """ copy = self._queue.copy() result = list() while not copy.empty(): result.append(copy.get_nowait()) return result
python
def copy(self): """ Copies the current queue items. """ copy = self._queue.copy() result = list() while not copy.empty(): result.append(copy.get_nowait()) return result
[ "def", "copy", "(", "self", ")", ":", "copy", "=", "self", ".", "_queue", ".", "copy", "(", ")", "result", "=", "list", "(", ")", "while", "not", "copy", ".", "empty", "(", ")", ":", "result", ".", "append", "(", "copy", ".", "get_nowait", "(", ...
Copies the current queue items.
[ "Copies", "the", "current", "queue", "items", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/notifying_queue.py#L31-L38
train
raiden-network/raiden
raiden/routing.py
get_best_routes_internal
def get_best_routes_internal( chain_state: ChainState, token_network_id: TokenNetworkID, from_address: InitiatorAddress, to_address: TargetAddress, amount: int, previous_address: Optional[Address], ) -> List[RouteState]: """ Returns a list of channels that can be used...
python
def get_best_routes_internal( chain_state: ChainState, token_network_id: TokenNetworkID, from_address: InitiatorAddress, to_address: TargetAddress, amount: int, previous_address: Optional[Address], ) -> List[RouteState]: """ Returns a list of channels that can be used...
[ "def", "get_best_routes_internal", "(", "chain_state", ":", "ChainState", ",", "token_network_id", ":", "TokenNetworkID", ",", "from_address", ":", "InitiatorAddress", ",", "to_address", ":", "TargetAddress", ",", "amount", ":", "int", ",", "previous_address", ":", ...
Returns a list of channels that can be used to make a transfer. This will filter out channels that are not open and don't have enough capacity.
[ "Returns", "a", "list", "of", "channels", "that", "can", "be", "used", "to", "make", "a", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/routing.py#L80-L174
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
Room.get_joined_members
def get_joined_members(self, force_resync=False) -> List[User]: """ Return a list of members of this room. """ if force_resync: response = self.client.api.get_room_members(self.room_id) for event in response['chunk']: if event['content']['membership'] == 'join': ...
python
def get_joined_members(self, force_resync=False) -> List[User]: """ Return a list of members of this room. """ if force_resync: response = self.client.api.get_room_members(self.room_id) for event in response['chunk']: if event['content']['membership'] == 'join': ...
[ "def", "get_joined_members", "(", "self", ",", "force_resync", "=", "False", ")", "->", "List", "[", "User", "]", ":", "if", "force_resync", ":", "response", "=", "self", ".", "client", ".", "api", ".", "get_room_members", "(", "self", ".", "room_id", ")...
Return a list of members of this room.
[ "Return", "a", "list", "of", "members", "of", "this", "room", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L31-L46
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
Room.update_aliases
def update_aliases(self): """ Get aliases information from room state Returns: boolean: True if the aliases changed, False if not """ changed = False try: response = self.client.api.get_room_state(self.room_id) except MatrixRequestError: ...
python
def update_aliases(self): """ Get aliases information from room state Returns: boolean: True if the aliases changed, False if not """ changed = False try: response = self.client.api.get_room_state(self.room_id) except MatrixRequestError: ...
[ "def", "update_aliases", "(", "self", ")", ":", "changed", "=", "False", "try", ":", "response", "=", "self", ".", "client", ".", "api", ".", "get_room_state", "(", "self", ".", "room_id", ")", "except", "MatrixRequestError", ":", "return", "False", "for",...
Get aliases information from room state Returns: boolean: True if the aliases changed, False if not
[ "Get", "aliases", "information", "from", "room", "state" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L60-L86
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient.stop_listener_thread
def stop_listener_thread(self): """ Kills sync_thread greenlet before joining it """ # when stopping, `kill` will cause the `self.api.sync` call in _sync # to raise a connection error. This flag will ensure it exits gracefully then self.should_listen = False if self.sync_thread: ...
python
def stop_listener_thread(self): """ Kills sync_thread greenlet before joining it """ # when stopping, `kill` will cause the `self.api.sync` call in _sync # to raise a connection error. This flag will ensure it exits gracefully then self.should_listen = False if self.sync_thread: ...
[ "def", "stop_listener_thread", "(", "self", ")", ":", "# when stopping, `kill` will cause the `self.api.sync` call in _sync", "# to raise a connection error. This flag will ensure it exits gracefully then", "self", ".", "should_listen", "=", "False", "if", "self", ".", "sync_thread",...
Kills sync_thread greenlet before joining it
[ "Kills", "sync_thread", "greenlet", "before", "joining", "it" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L267-L278
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient.typing
def typing(self, room: Room, timeout: int = 5000): """ Send typing event directly to api Args: room: room to send typing event to timeout: timeout for the event, in ms """ path = f'/rooms/{quote(room.room_id)}/typing/{quote(self.user_id)}' return ...
python
def typing(self, room: Room, timeout: int = 5000): """ Send typing event directly to api Args: room: room to send typing event to timeout: timeout for the event, in ms """ path = f'/rooms/{quote(room.room_id)}/typing/{quote(self.user_id)}' return ...
[ "def", "typing", "(", "self", ",", "room", ":", "Room", ",", "timeout", ":", "int", "=", "5000", ")", ":", "path", "=", "f'/rooms/{quote(room.room_id)}/typing/{quote(self.user_id)}'", "return", "self", ".", "api", ".", "_send", "(", "'PUT'", ",", "path", ","...
Send typing event directly to api Args: room: room to send typing event to timeout: timeout for the event, in ms
[ "Send", "typing", "event", "directly", "to", "api" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L362-L371
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient._mkroom
def _mkroom(self, room_id: str) -> Room: """ Uses a geventified Room subclass """ if room_id not in self.rooms: self.rooms[room_id] = Room(self, room_id) room = self.rooms[room_id] if not room.canonical_alias: room.update_aliases() return room
python
def _mkroom(self, room_id: str) -> Room: """ Uses a geventified Room subclass """ if room_id not in self.rooms: self.rooms[room_id] = Room(self, room_id) room = self.rooms[room_id] if not room.canonical_alias: room.update_aliases() return room
[ "def", "_mkroom", "(", "self", ",", "room_id", ":", "str", ")", "->", "Room", ":", "if", "room_id", "not", "in", "self", ".", "rooms", ":", "self", ".", "rooms", "[", "room_id", "]", "=", "Room", "(", "self", ",", "room_id", ")", "room", "=", "se...
Uses a geventified Room subclass
[ "Uses", "a", "geventified", "Room", "subclass" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L373-L380
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient.set_sync_limit
def set_sync_limit(self, limit: int) -> Optional[int]: """ Sets the events limit per room for sync and return previous limit """ try: prev_limit = json.loads(self.sync_filter)['room']['timeline']['limit'] except (json.JSONDecodeError, KeyError): prev_limit = None ...
python
def set_sync_limit(self, limit: int) -> Optional[int]: """ Sets the events limit per room for sync and return previous limit """ try: prev_limit = json.loads(self.sync_filter)['room']['timeline']['limit'] except (json.JSONDecodeError, KeyError): prev_limit = None ...
[ "def", "set_sync_limit", "(", "self", ",", "limit", ":", "int", ")", "->", "Optional", "[", "int", "]", ":", "try", ":", "prev_limit", "=", "json", ".", "loads", "(", "self", ".", "sync_filter", ")", "[", "'room'", "]", "[", "'timeline'", "]", "[", ...
Sets the events limit per room for sync and return previous limit
[ "Sets", "the", "events", "limit", "per", "room", "for", "sync", "and", "return", "previous", "limit" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L491-L498
train
raiden-network/raiden
raiden/api/rest.py
handle_request_parsing_error
def handle_request_parsing_error( err, _req, _schema, _err_status_code, _err_headers, ): """ This handles request parsing errors generated for example by schema field validation failing.""" abort(HTTPStatus.BAD_REQUEST, errors=err.messages)
python
def handle_request_parsing_error( err, _req, _schema, _err_status_code, _err_headers, ): """ This handles request parsing errors generated for example by schema field validation failing.""" abort(HTTPStatus.BAD_REQUEST, errors=err.messages)
[ "def", "handle_request_parsing_error", "(", "err", ",", "_req", ",", "_schema", ",", "_err_status_code", ",", "_err_headers", ",", ")", ":", "abort", "(", "HTTPStatus", ".", "BAD_REQUEST", ",", "errors", "=", "err", ".", "messages", ")" ]
This handles request parsing errors generated for example by schema field validation failing.
[ "This", "handles", "request", "parsing", "errors", "generated", "for", "example", "by", "schema", "field", "validation", "failing", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L230-L239
train
raiden-network/raiden
raiden/api/rest.py
hexbytes_to_str
def hexbytes_to_str(map_: Dict): """ Converts values that are of type `HexBytes` to strings. """ for k, v in map_.items(): if isinstance(v, HexBytes): map_[k] = encode_hex(v)
python
def hexbytes_to_str(map_: Dict): """ Converts values that are of type `HexBytes` to strings. """ for k, v in map_.items(): if isinstance(v, HexBytes): map_[k] = encode_hex(v)
[ "def", "hexbytes_to_str", "(", "map_", ":", "Dict", ")", ":", "for", "k", ",", "v", "in", "map_", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "HexBytes", ")", ":", "map_", "[", "k", "]", "=", "encode_hex", "(", "v", ")" ]
Converts values that are of type `HexBytes` to strings.
[ "Converts", "values", "that", "are", "of", "type", "HexBytes", "to", "strings", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L249-L253
train
raiden-network/raiden
raiden/api/rest.py
encode_byte_values
def encode_byte_values(map_: Dict): """ Converts values that are of type `bytes` to strings. """ for k, v in map_.items(): if isinstance(v, bytes): map_[k] = encode_hex(v)
python
def encode_byte_values(map_: Dict): """ Converts values that are of type `bytes` to strings. """ for k, v in map_.items(): if isinstance(v, bytes): map_[k] = encode_hex(v)
[ "def", "encode_byte_values", "(", "map_", ":", "Dict", ")", ":", "for", "k", ",", "v", "in", "map_", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "bytes", ")", ":", "map_", "[", "k", "]", "=", "encode_hex", "(", "v", ")" ]
Converts values that are of type `bytes` to strings.
[ "Converts", "values", "that", "are", "of", "type", "bytes", "to", "strings", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L256-L260
train
raiden-network/raiden
raiden/api/rest.py
normalize_events_list
def normalize_events_list(old_list): """Internally the `event_type` key is prefixed with underscore but the API returns an object without that prefix""" new_list = [] for _event in old_list: new_event = dict(_event) if new_event.get('args'): new_event['args'] = dict(new_event...
python
def normalize_events_list(old_list): """Internally the `event_type` key is prefixed with underscore but the API returns an object without that prefix""" new_list = [] for _event in old_list: new_event = dict(_event) if new_event.get('args'): new_event['args'] = dict(new_event...
[ "def", "normalize_events_list", "(", "old_list", ")", ":", "new_list", "=", "[", "]", "for", "_event", "in", "old_list", ":", "new_event", "=", "dict", "(", "_event", ")", "if", "new_event", ".", "get", "(", "'args'", ")", ":", "new_event", "[", "'args'"...
Internally the `event_type` key is prefixed with underscore but the API returns an object without that prefix
[ "Internally", "the", "event_type", "key", "is", "prefixed", "with", "underscore", "but", "the", "API", "returns", "an", "object", "without", "that", "prefix" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L271-L296
train
raiden-network/raiden
raiden/api/rest.py
APIServer.unhandled_exception
def unhandled_exception(self, exception: Exception): """ Flask.errorhandler when an exception wasn't correctly handled """ log.critical( 'Unhandled exception when processing endpoint request', exc_info=True, node=pex(self.rest_api.raiden_api.address), ) ...
python
def unhandled_exception(self, exception: Exception): """ Flask.errorhandler when an exception wasn't correctly handled """ log.critical( 'Unhandled exception when processing endpoint request', exc_info=True, node=pex(self.rest_api.raiden_api.address), ) ...
[ "def", "unhandled_exception", "(", "self", ",", "exception", ":", "Exception", ")", ":", "log", ".", "critical", "(", "'Unhandled exception when processing endpoint request'", ",", "exc_info", "=", "True", ",", "node", "=", "pex", "(", "self", ".", "rest_api", "...
Flask.errorhandler when an exception wasn't correctly handled
[ "Flask", ".", "errorhandler", "when", "an", "exception", "wasn", "t", "correctly", "handled" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L540-L548
train
raiden-network/raiden
raiden/api/rest.py
RestAPI.get_connection_managers_info
def get_connection_managers_info(self, registry_address: typing.PaymentNetworkID): """Get a dict whose keys are token addresses and whose values are open channels, funds of last request, sum of deposits and number of channels""" log.debug( 'Getting connection managers info', ...
python
def get_connection_managers_info(self, registry_address: typing.PaymentNetworkID): """Get a dict whose keys are token addresses and whose values are open channels, funds of last request, sum of deposits and number of channels""" log.debug( 'Getting connection managers info', ...
[ "def", "get_connection_managers_info", "(", "self", ",", "registry_address", ":", "typing", ".", "PaymentNetworkID", ")", ":", "log", ".", "debug", "(", "'Getting connection managers info'", ",", "node", "=", "pex", "(", "self", ".", "raiden_api", ".", "address", ...
Get a dict whose keys are token addresses and whose values are open channels, funds of last request, sum of deposits and number of channels
[ "Get", "a", "dict", "whose", "keys", "are", "token", "addresses", "and", "whose", "values", "are", "open", "channels", "funds", "of", "last", "request", "sum", "of", "deposits", "and", "number", "of", "channels" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L788-L828
train
raiden-network/raiden
raiden/ui/startup.py
setup_network_id_or_exit
def setup_network_id_or_exit( config: Dict[str, Any], given_network_id: int, web3: Web3, ) -> Tuple[int, bool]: """ Takes the given network id and checks it against the connected network If they don't match, exits the program with an error. If they do adds it to the configuratio...
python
def setup_network_id_or_exit( config: Dict[str, Any], given_network_id: int, web3: Web3, ) -> Tuple[int, bool]: """ Takes the given network id and checks it against the connected network If they don't match, exits the program with an error. If they do adds it to the configuratio...
[ "def", "setup_network_id_or_exit", "(", "config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "given_network_id", ":", "int", ",", "web3", ":", "Web3", ",", ")", "->", "Tuple", "[", "int", ",", "bool", "]", ":", "node_network_id", "=", "int", "(", ...
Takes the given network id and checks it against the connected network If they don't match, exits the program with an error. If they do adds it to the configuration and then returns it and whether it is a known network
[ "Takes", "the", "given", "network", "id", "and", "checks", "it", "against", "the", "connected", "network" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/startup.py#L46-L79
train
raiden-network/raiden
raiden/ui/startup.py
setup_environment
def setup_environment(config: Dict[str, Any], environment_type: Environment) -> None: """Sets the config depending on the environment type""" # interpret the provided string argument if environment_type == Environment.PRODUCTION: # Safe configuration: restrictions for mainnet apply and matrix rooms ...
python
def setup_environment(config: Dict[str, Any], environment_type: Environment) -> None: """Sets the config depending on the environment type""" # interpret the provided string argument if environment_type == Environment.PRODUCTION: # Safe configuration: restrictions for mainnet apply and matrix rooms ...
[ "def", "setup_environment", "(", "config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "environment_type", ":", "Environment", ")", "->", "None", ":", "# interpret the provided string argument", "if", "environment_type", "==", "Environment", ".", "PRODUCTION", ...
Sets the config depending on the environment type
[ "Sets", "the", "config", "depending", "on", "the", "environment", "type" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/startup.py#L82-L91
train
raiden-network/raiden
raiden/ui/startup.py
setup_contracts_or_exit
def setup_contracts_or_exit( config: Dict[str, Any], network_id: int, ) -> Dict[str, Any]: """Sets the contract deployment data depending on the network id and environment type If an invalid combination of network id and environment type is provided, exits the program with an error """ ...
python
def setup_contracts_or_exit( config: Dict[str, Any], network_id: int, ) -> Dict[str, Any]: """Sets the contract deployment data depending on the network id and environment type If an invalid combination of network id and environment type is provided, exits the program with an error """ ...
[ "def", "setup_contracts_or_exit", "(", "config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "network_id", ":", "int", ",", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "environment_type", "=", "config", "[", "'environment_type'", "]", "not_al...
Sets the contract deployment data depending on the network id and environment type If an invalid combination of network id and environment type is provided, exits the program with an error
[ "Sets", "the", "contract", "deployment", "data", "depending", "on", "the", "network", "id", "and", "environment", "type" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/startup.py#L94-L135
train
raiden-network/raiden
raiden/transfer/architecture.py
StateManager.dispatch
def dispatch(self, state_change: StateChange) -> List[Event]: """ Apply the `state_change` in the current machine and return the resulting events. Args: state_change: An object representation of a state change. Return: A list of events produced by th...
python
def dispatch(self, state_change: StateChange) -> List[Event]: """ Apply the `state_change` in the current machine and return the resulting events. Args: state_change: An object representation of a state change. Return: A list of events produced by th...
[ "def", "dispatch", "(", "self", ",", "state_change", ":", "StateChange", ")", "->", "List", "[", "Event", "]", ":", "assert", "isinstance", "(", "state_change", ",", "StateChange", ")", "# the state objects must be treated as immutable, so make a copy of the", "# curren...
Apply the `state_change` in the current machine and return the resulting events. Args: state_change: An object representation of a state change. Return: A list of events produced by the state transition. It's the upper layer's responsibility to d...
[ "Apply", "the", "state_change", "in", "the", "current", "machine", "and", "return", "the", "resulting", "events", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/architecture.py#L275-L308
train
raiden-network/raiden
raiden/waiting.py
wait_for_newchannel
def wait_for_newchannel( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, retry_timeout: float, ) -> None: """Wait until the channel with partner_address is registered. Note: This does not time ...
python
def wait_for_newchannel( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, retry_timeout: float, ) -> None: """Wait until the channel with partner_address is registered. Note: This does not time ...
[ "def", "wait_for_newchannel", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "retry_timeout", ":", "float", ",", ")", "->", "None", ...
Wait until the channel with partner_address is registered. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "the", "channel", "with", "partner_address", "is", "registered", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L41-L67
train
raiden-network/raiden
raiden/waiting.py
wait_for_participant_newbalance
def wait_for_participant_newbalance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a gi...
python
def wait_for_participant_newbalance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a gi...
[ "def", "wait_for_participant_newbalance", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "target_address", ":", "Address", ",", "target_ba...
Wait until a given channels balance exceeds the target balance. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "a", "given", "channels", "balance", "exceeds", "the", "target", "balance", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L70-L105
train
raiden-network/raiden
raiden/waiting.py
wait_for_payment_balance
def wait_for_payment_balance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a given cha...
python
def wait_for_payment_balance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a given cha...
[ "def", "wait_for_payment_balance", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "target_address", ":", "Address", ",", "target_balance",...
Wait until a given channel's balance exceeds the target balance. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "a", "given", "channel", "s", "balance", "exceeds", "the", "target", "balance", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L108-L150
train
raiden-network/raiden
raiden/waiting.py
wait_for_channel_in_states
def wait_for_channel_in_states( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, target_states: Sequence[str], ) -> None: """Wait until all channels are in `target_states`. ...
python
def wait_for_channel_in_states( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, target_states: Sequence[str], ) -> None: """Wait until all channels are in `target_states`. ...
[ "def", "wait_for_channel_in_states", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "channel_ids", ":", "List", "[", "ChannelID", "]", ",", "retry_timeout", ":", "float", ","...
Wait until all channels are in `target_states`. Raises: ValueError: If the token_address is not registered in the payment_network. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "all", "channels", "are", "in", "target_states", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L153-L210
train
raiden-network/raiden
raiden/waiting.py
wait_for_close
def wait_for_close( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, ) -> None: """Wait until all channels are closed. Note: This does not time out, use gevent.Timeout....
python
def wait_for_close( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, ) -> None: """Wait until all channels are closed. Note: This does not time out, use gevent.Timeout....
[ "def", "wait_for_close", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "channel_ids", ":", "List", "[", "ChannelID", "]", ",", "retry_timeout", ":", "float", ",", ")", "...
Wait until all channels are closed. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "all", "channels", "are", "closed", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L213-L232
train
raiden-network/raiden
raiden/waiting.py
wait_for_healthy
def wait_for_healthy( raiden: 'RaidenService', node_address: Address, retry_timeout: float, ) -> None: """Wait until `node_address` becomes healthy. Note: This does not time out, use gevent.Timeout. """ network_statuses = views.get_networkstatuses( views.state_fr...
python
def wait_for_healthy( raiden: 'RaidenService', node_address: Address, retry_timeout: float, ) -> None: """Wait until `node_address` becomes healthy. Note: This does not time out, use gevent.Timeout. """ network_statuses = views.get_networkstatuses( views.state_fr...
[ "def", "wait_for_healthy", "(", "raiden", ":", "'RaidenService'", ",", "node_address", ":", "Address", ",", "retry_timeout", ":", "float", ",", ")", "->", "None", ":", "network_statuses", "=", "views", ".", "get_networkstatuses", "(", "views", ".", "state_from_r...
Wait until `node_address` becomes healthy. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "node_address", "becomes", "healthy", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L306-L324
train
raiden-network/raiden
raiden/waiting.py
wait_for_transfer_success
def wait_for_transfer_success( raiden: 'RaidenService', payment_identifier: PaymentID, amount: PaymentAmount, retry_timeout: float, ) -> None: """Wait until a transfer with a specific identifier and amount is seen in the WAL. Note: This does not time out, use gevent....
python
def wait_for_transfer_success( raiden: 'RaidenService', payment_identifier: PaymentID, amount: PaymentAmount, retry_timeout: float, ) -> None: """Wait until a transfer with a specific identifier and amount is seen in the WAL. Note: This does not time out, use gevent....
[ "def", "wait_for_transfer_success", "(", "raiden", ":", "'RaidenService'", ",", "payment_identifier", ":", "PaymentID", ",", "amount", ":", "PaymentAmount", ",", "retry_timeout", ":", "float", ",", ")", "->", "None", ":", "found", "=", "False", "while", "not", ...
Wait until a transfer with a specific identifier and amount is seen in the WAL. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "a", "transfer", "with", "a", "specific", "identifier", "and", "amount", "is", "seen", "in", "the", "WAL", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L327-L351
train
raiden-network/raiden
raiden/utils/echo_node.py
EchoNode.poll_all_received_events
def poll_all_received_events(self): """ This will be triggered once for each `echo_node_alarm_callback`. It polls all channels for `EventPaymentReceivedSuccess` events, adds all new events to the `self.received_transfers` queue and respawns `self.echo_node_worker`, if it died. """ ...
python
def poll_all_received_events(self): """ This will be triggered once for each `echo_node_alarm_callback`. It polls all channels for `EventPaymentReceivedSuccess` events, adds all new events to the `self.received_transfers` queue and respawns `self.echo_node_worker`, if it died. """ ...
[ "def", "poll_all_received_events", "(", "self", ")", ":", "locked", "=", "False", "try", ":", "with", "Timeout", "(", "10", ")", ":", "locked", "=", "self", ".", "lock", ".", "acquire", "(", "blocking", "=", "False", ")", "if", "not", "locked", ":", ...
This will be triggered once for each `echo_node_alarm_callback`. It polls all channels for `EventPaymentReceivedSuccess` events, adds all new events to the `self.received_transfers` queue and respawns `self.echo_node_worker`, if it died.
[ "This", "will", "be", "triggered", "once", "for", "each", "echo_node_alarm_callback", ".", "It", "polls", "all", "channels", "for", "EventPaymentReceivedSuccess", "events", "adds", "all", "new", "events", "to", "the", "self", ".", "received_transfers", "queue", "a...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/echo_node.py#L87-L132
train
raiden-network/raiden
raiden/utils/echo_node.py
EchoNode.echo_worker
def echo_worker(self): """ The `echo_worker` works through the `self.received_transfers` queue and spawns `self.on_transfer` greenlets for all not-yet-seen transfers. """ log.debug('echo worker', qsize=self.received_transfers.qsize()) while self.stop_signal is None: if self.r...
python
def echo_worker(self): """ The `echo_worker` works through the `self.received_transfers` queue and spawns `self.on_transfer` greenlets for all not-yet-seen transfers. """ log.debug('echo worker', qsize=self.received_transfers.qsize()) while self.stop_signal is None: if self.r...
[ "def", "echo_worker", "(", "self", ")", ":", "log", ".", "debug", "(", "'echo worker'", ",", "qsize", "=", "self", ".", "received_transfers", ".", "qsize", "(", ")", ")", "while", "self", ".", "stop_signal", "is", "None", ":", "if", "self", ".", "recei...
The `echo_worker` works through the `self.received_transfers` queue and spawns `self.on_transfer` greenlets for all not-yet-seen transfers.
[ "The", "echo_worker", "works", "through", "the", "self", ".", "received_transfers", "queue", "and", "spawns", "self", ".", "on_transfer", "greenlets", "for", "all", "not", "-", "yet", "-", "seen", "transfers", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/echo_node.py#L134-L152
train
raiden-network/raiden
raiden/utils/runnable.py
Runnable.start
def start(self): """ Synchronously start task Reimplements in children an call super().start() at end to start _run() Start-time exceptions may be raised """ if self.greenlet: raise RuntimeError(f'Greenlet {self.greenlet!r} already started') pristine = ( ...
python
def start(self): """ Synchronously start task Reimplements in children an call super().start() at end to start _run() Start-time exceptions may be raised """ if self.greenlet: raise RuntimeError(f'Greenlet {self.greenlet!r} already started') pristine = ( ...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "greenlet", ":", "raise", "RuntimeError", "(", "f'Greenlet {self.greenlet!r} already started'", ")", "pristine", "=", "(", "not", "self", ".", "greenlet", ".", "dead", "and", "tuple", "(", "self", "."...
Synchronously start task Reimplements in children an call super().start() at end to start _run() Start-time exceptions may be raised
[ "Synchronously", "start", "task" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/runnable.py#L26-L42
train
raiden-network/raiden
raiden/utils/runnable.py
Runnable.on_error
def on_error(self, subtask: Greenlet): """ Default callback for substasks link_exception Default callback re-raises the exception inside _run() """ log.error( 'Runnable subtask died!', this=self, running=bool(self), subtask=subtask, ex...
python
def on_error(self, subtask: Greenlet): """ Default callback for substasks link_exception Default callback re-raises the exception inside _run() """ log.error( 'Runnable subtask died!', this=self, running=bool(self), subtask=subtask, ex...
[ "def", "on_error", "(", "self", ",", "subtask", ":", "Greenlet", ")", ":", "log", ".", "error", "(", "'Runnable subtask died!'", ",", "this", "=", "self", ",", "running", "=", "bool", "(", "self", ")", ",", "subtask", "=", "subtask", ",", "exc", "=", ...
Default callback for substasks link_exception Default callback re-raises the exception inside _run()
[ "Default", "callback", "for", "substasks", "link_exception" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/runnable.py#L59-L72
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
join_global_room
def join_global_room(client: GMatrixClient, name: str, servers: Sequence[str] = ()) -> Room: """Join or create a global public room with given name First, try to join room on own server (client-configured one) If can't, try to join on each one of servers, and if able, alias it in our server If still ca...
python
def join_global_room(client: GMatrixClient, name: str, servers: Sequence[str] = ()) -> Room: """Join or create a global public room with given name First, try to join room on own server (client-configured one) If can't, try to join on each one of servers, and if able, alias it in our server If still ca...
[ "def", "join_global_room", "(", "client", ":", "GMatrixClient", ",", "name", ":", "str", ",", "servers", ":", "Sequence", "[", "str", "]", "=", "(", ")", ")", "->", "Room", ":", "our_server_name", "=", "urlparse", "(", "client", ".", "api", ".", "base_...
Join or create a global public room with given name First, try to join room on own server (client-configured one) If can't, try to join on each one of servers, and if able, alias it in our server If still can't, create a public room with name in our server Params: client: matrix-python-sdk cli...
[ "Join", "or", "create", "a", "global", "public", "room", "with", "given", "name" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L254-L319
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
login_or_register
def login_or_register( client: GMatrixClient, signer: Signer, prev_user_id: str = None, prev_access_token: str = None, ) -> User: """Login to a Raiden matrix server with password and displayname proof-of-keys - Username is in the format: 0x<eth_address>(.<suffix>)?, where the su...
python
def login_or_register( client: GMatrixClient, signer: Signer, prev_user_id: str = None, prev_access_token: str = None, ) -> User: """Login to a Raiden matrix server with password and displayname proof-of-keys - Username is in the format: 0x<eth_address>(.<suffix>)?, where the su...
[ "def", "login_or_register", "(", "client", ":", "GMatrixClient", ",", "signer", ":", "Signer", ",", "prev_user_id", ":", "str", "=", "None", ",", "prev_access_token", ":", "str", "=", "None", ",", ")", "->", "User", ":", "server_url", "=", "client", ".", ...
Login to a Raiden matrix server with password and displayname proof-of-keys - Username is in the format: 0x<eth_address>(.<suffix>)?, where the suffix is not required, but a deterministic (per-account) random 8-hex string to prevent DoS by other users registering our address - Password is the signature...
[ "Login", "to", "a", "Raiden", "matrix", "server", "with", "password", "and", "displayname", "proof", "-", "of", "-", "keys" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L322-L434
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
validate_userid_signature
def validate_userid_signature(user: User) -> Optional[Address]: """ Validate a userId format and signature on displayName, and return its address""" # display_name should be an address in the USERID_RE format match = USERID_RE.match(user.user_id) if not match: return None encoded_address = ...
python
def validate_userid_signature(user: User) -> Optional[Address]: """ Validate a userId format and signature on displayName, and return its address""" # display_name should be an address in the USERID_RE format match = USERID_RE.match(user.user_id) if not match: return None encoded_address = ...
[ "def", "validate_userid_signature", "(", "user", ":", "User", ")", "->", "Optional", "[", "Address", "]", ":", "# display_name should be an address in the USERID_RE format", "match", "=", "USERID_RE", ".", "match", "(", "user", ".", "user_id", ")", "if", "not", "m...
Validate a userId format and signature on displayName, and return its address
[ "Validate", "a", "userId", "format", "and", "signature", "on", "displayName", "and", "return", "its", "address" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L438-L464
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
sort_servers_closest
def sort_servers_closest(servers: Sequence[str]) -> Sequence[Tuple[str, float]]: """Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty...
python
def sort_servers_closest(servers: Sequence[str]) -> Sequence[Tuple[str, float]]: """Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty...
[ "def", "sort_servers_closest", "(", "servers", ":", "Sequence", "[", "str", "]", ")", "->", "Sequence", "[", "Tuple", "[", "str", ",", "float", "]", "]", ":", "if", "not", "{", "urlparse", "(", "url", ")", ".", "scheme", "for", "url", "in", "servers"...
Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty)
[ "Sorts", "a", "list", "of", "servers", "by", "http", "round", "-", "trip", "time" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L467-L491
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
make_client
def make_client(servers: Sequence[str], *args, **kwargs) -> GMatrixClient: """Given a list of possible servers, chooses the closest available and create a GMatrixClient Params: servers: list of servers urls, with scheme (http or https) Rest of args and kwargs are forwarded to GMatrixClient cons...
python
def make_client(servers: Sequence[str], *args, **kwargs) -> GMatrixClient: """Given a list of possible servers, chooses the closest available and create a GMatrixClient Params: servers: list of servers urls, with scheme (http or https) Rest of args and kwargs are forwarded to GMatrixClient cons...
[ "def", "make_client", "(", "servers", ":", "Sequence", "[", "str", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "GMatrixClient", ":", "if", "len", "(", "servers", ")", ">", "1", ":", "sorted_servers", "=", "[", "server_url", "for", "(",...
Given a list of possible servers, chooses the closest available and create a GMatrixClient Params: servers: list of servers urls, with scheme (http or https) Rest of args and kwargs are forwarded to GMatrixClient constructor Returns: GMatrixClient instance for one of the available serve...
[ "Given", "a", "list", "of", "possible", "servers", "chooses", "the", "closest", "available", "and", "create", "a", "GMatrixClient" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L494-L532
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.add_userid_for_address
def add_userid_for_address(self, address: Address, user_id: str): """ Add a ``user_id`` for the given ``address``. Implicitly adds the address if it was unknown before. """ self._address_to_userids[address].add(user_id)
python
def add_userid_for_address(self, address: Address, user_id: str): """ Add a ``user_id`` for the given ``address``. Implicitly adds the address if it was unknown before. """ self._address_to_userids[address].add(user_id)
[ "def", "add_userid_for_address", "(", "self", ",", "address", ":", "Address", ",", "user_id", ":", "str", ")", ":", "self", ".", "_address_to_userids", "[", "address", "]", ".", "add", "(", "user_id", ")" ]
Add a ``user_id`` for the given ``address``. Implicitly adds the address if it was unknown before.
[ "Add", "a", "user_id", "for", "the", "given", "address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L122-L127
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.add_userids_for_address
def add_userids_for_address(self, address: Address, user_ids: Iterable[str]): """ Add multiple ``user_ids`` for the given ``address``. Implicitly adds any addresses if they were unknown before. """ self._address_to_userids[address].update(user_ids)
python
def add_userids_for_address(self, address: Address, user_ids: Iterable[str]): """ Add multiple ``user_ids`` for the given ``address``. Implicitly adds any addresses if they were unknown before. """ self._address_to_userids[address].update(user_ids)
[ "def", "add_userids_for_address", "(", "self", ",", "address", ":", "Address", ",", "user_ids", ":", "Iterable", "[", "str", "]", ")", ":", "self", ".", "_address_to_userids", "[", "address", "]", ".", "update", "(", "user_ids", ")" ]
Add multiple ``user_ids`` for the given ``address``. Implicitly adds any addresses if they were unknown before.
[ "Add", "multiple", "user_ids", "for", "the", "given", "address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L129-L134
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.get_userids_for_address
def get_userids_for_address(self, address: Address) -> Set[str]: """ Return all known user ids for the given ``address``. """ if not self.is_address_known(address): return set() return self._address_to_userids[address]
python
def get_userids_for_address(self, address: Address) -> Set[str]: """ Return all known user ids for the given ``address``. """ if not self.is_address_known(address): return set() return self._address_to_userids[address]
[ "def", "get_userids_for_address", "(", "self", ",", "address", ":", "Address", ")", "->", "Set", "[", "str", "]", ":", "if", "not", "self", ".", "is_address_known", "(", "address", ")", ":", "return", "set", "(", ")", "return", "self", ".", "_address_to_...
Return all known user ids for the given ``address``.
[ "Return", "all", "known", "user", "ids", "for", "the", "given", "address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L136-L140
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.get_userid_presence
def get_userid_presence(self, user_id: str) -> UserPresence: """ Return the current presence state of ``user_id``. """ return self._userid_to_presence.get(user_id, UserPresence.UNKNOWN)
python
def get_userid_presence(self, user_id: str) -> UserPresence: """ Return the current presence state of ``user_id``. """ return self._userid_to_presence.get(user_id, UserPresence.UNKNOWN)
[ "def", "get_userid_presence", "(", "self", ",", "user_id", ":", "str", ")", "->", "UserPresence", ":", "return", "self", ".", "_userid_to_presence", ".", "get", "(", "user_id", ",", "UserPresence", ".", "UNKNOWN", ")" ]
Return the current presence state of ``user_id``.
[ "Return", "the", "current", "presence", "state", "of", "user_id", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L142-L144
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.get_address_reachability
def get_address_reachability(self, address: Address) -> AddressReachability: """ Return the current reachability state for ``address``. """ return self._address_to_reachability.get(address, AddressReachability.UNKNOWN)
python
def get_address_reachability(self, address: Address) -> AddressReachability: """ Return the current reachability state for ``address``. """ return self._address_to_reachability.get(address, AddressReachability.UNKNOWN)
[ "def", "get_address_reachability", "(", "self", ",", "address", ":", "Address", ")", "->", "AddressReachability", ":", "return", "self", ".", "_address_to_reachability", ".", "get", "(", "address", ",", "AddressReachability", ".", "UNKNOWN", ")" ]
Return the current reachability state for ``address``.
[ "Return", "the", "current", "reachability", "state", "for", "address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L146-L148
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.force_user_presence
def force_user_presence(self, user: User, presence: UserPresence): """ Forcibly set the ``user`` presence to ``presence``. This method is only provided to cover an edge case in our use of the Matrix protocol and should **not** generally be used. """ self._userid_to_presence[user...
python
def force_user_presence(self, user: User, presence: UserPresence): """ Forcibly set the ``user`` presence to ``presence``. This method is only provided to cover an edge case in our use of the Matrix protocol and should **not** generally be used. """ self._userid_to_presence[user...
[ "def", "force_user_presence", "(", "self", ",", "user", ":", "User", ",", "presence", ":", "UserPresence", ")", ":", "self", ".", "_userid_to_presence", "[", "user", ".", "user_id", "]", "=", "presence" ]
Forcibly set the ``user`` presence to ``presence``. This method is only provided to cover an edge case in our use of the Matrix protocol and should **not** generally be used.
[ "Forcibly", "set", "the", "user", "presence", "to", "presence", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L150-L156
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager.refresh_address_presence
def refresh_address_presence(self, address): """ Update synthesized address presence state from cached user presence states. Triggers callback (if any) in case the state has changed. This method is only provided to cover an edge case in our use of the Matrix protocol and should...
python
def refresh_address_presence(self, address): """ Update synthesized address presence state from cached user presence states. Triggers callback (if any) in case the state has changed. This method is only provided to cover an edge case in our use of the Matrix protocol and should...
[ "def", "refresh_address_presence", "(", "self", ",", "address", ")", ":", "composite_presence", "=", "{", "self", ".", "_fetch_user_presence", "(", "uid", ")", "for", "uid", "in", "self", ".", "_address_to_userids", "[", "address", "]", "}", "# Iterate over User...
Update synthesized address presence state from cached user presence states. Triggers callback (if any) in case the state has changed. This method is only provided to cover an edge case in our use of the Matrix protocol and should **not** generally be used.
[ "Update", "synthesized", "address", "presence", "state", "from", "cached", "user", "presence", "states", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L158-L194
train
raiden-network/raiden
raiden/network/transport/matrix/utils.py
UserAddressManager._presence_listener
def _presence_listener(self, event: Dict[str, Any]): """ Update cached user presence state from Matrix presence events. Due to the possibility of nodes using accounts on multiple homeservers a composite address state is synthesised from the cached individual user presence states. ...
python
def _presence_listener(self, event: Dict[str, Any]): """ Update cached user presence state from Matrix presence events. Due to the possibility of nodes using accounts on multiple homeservers a composite address state is synthesised from the cached individual user presence states. ...
[ "def", "_presence_listener", "(", "self", ",", "event", ":", "Dict", "[", "str", ",", "Any", "]", ")", ":", "if", "self", ".", "_stop_event", ".", "ready", "(", ")", ":", "return", "user_id", "=", "event", "[", "'sender'", "]", "if", "event", "[", ...
Update cached user presence state from Matrix presence events. Due to the possibility of nodes using accounts on multiple homeservers a composite address state is synthesised from the cached individual user presence states.
[ "Update", "cached", "user", "presence", "state", "from", "Matrix", "presence", "events", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L196-L230
train
raiden-network/raiden
raiden/tasks.py
check_version
def check_version(current_version: str): """ Check periodically for a new release """ app_version = parse_version(current_version) while True: try: _do_check_version(app_version) except requests.exceptions.HTTPError as herr: click.secho('Error while checking for versi...
python
def check_version(current_version: str): """ Check periodically for a new release """ app_version = parse_version(current_version) while True: try: _do_check_version(app_version) except requests.exceptions.HTTPError as herr: click.secho('Error while checking for versi...
[ "def", "check_version", "(", "current_version", ":", "str", ")", ":", "app_version", "=", "parse_version", "(", "current_version", ")", "while", "True", ":", "try", ":", "_do_check_version", "(", "app_version", ")", "except", "requests", ".", "exceptions", ".", ...
Check periodically for a new release
[ "Check", "periodically", "for", "a", "new", "release" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L59-L73
train
raiden-network/raiden
raiden/tasks.py
check_gas_reserve
def check_gas_reserve(raiden): """ Check periodically for gas reserve in the account """ while True: has_enough_balance, estimated_required_balance = gas_reserve.has_enough_gas_reserve( raiden, channels_to_open=1, ) estimated_required_balance_eth = Web3.fromWei(es...
python
def check_gas_reserve(raiden): """ Check periodically for gas reserve in the account """ while True: has_enough_balance, estimated_required_balance = gas_reserve.has_enough_gas_reserve( raiden, channels_to_open=1, ) estimated_required_balance_eth = Web3.fromWei(es...
[ "def", "check_gas_reserve", "(", "raiden", ")", ":", "while", "True", ":", "has_enough_balance", ",", "estimated_required_balance", "=", "gas_reserve", ".", "has_enough_gas_reserve", "(", "raiden", ",", "channels_to_open", "=", "1", ",", ")", "estimated_required_balan...
Check periodically for gas reserve in the account
[ "Check", "periodically", "for", "gas", "reserve", "in", "the", "account" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L76-L98
train
raiden-network/raiden
raiden/tasks.py
check_rdn_deposits
def check_rdn_deposits(raiden, user_deposit_proxy: UserDeposit): """ Check periodically for RDN deposits in the user-deposits contract """ while True: rei_balance = user_deposit_proxy.effective_balance(raiden.address, "latest") rdn_balance = to_rdn(rei_balance) if rei_balance < MIN_REI_T...
python
def check_rdn_deposits(raiden, user_deposit_proxy: UserDeposit): """ Check periodically for RDN deposits in the user-deposits contract """ while True: rei_balance = user_deposit_proxy.effective_balance(raiden.address, "latest") rdn_balance = to_rdn(rei_balance) if rei_balance < MIN_REI_T...
[ "def", "check_rdn_deposits", "(", "raiden", ",", "user_deposit_proxy", ":", "UserDeposit", ")", ":", "while", "True", ":", "rei_balance", "=", "user_deposit_proxy", ".", "effective_balance", "(", "raiden", ".", "address", ",", "\"latest\"", ")", "rdn_balance", "="...
Check periodically for RDN deposits in the user-deposits contract
[ "Check", "periodically", "for", "RDN", "deposits", "in", "the", "user", "-", "deposits", "contract" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L101-L119
train
raiden-network/raiden
raiden/tasks.py
check_network_id
def check_network_id(network_id, web3: Web3): """ Check periodically if the underlying ethereum client's network id has changed""" while True: current_id = int(web3.version.network) if network_id != current_id: raise RuntimeError( f'Raiden was running on network with ...
python
def check_network_id(network_id, web3: Web3): """ Check periodically if the underlying ethereum client's network id has changed""" while True: current_id = int(web3.version.network) if network_id != current_id: raise RuntimeError( f'Raiden was running on network with ...
[ "def", "check_network_id", "(", "network_id", ",", "web3", ":", "Web3", ")", ":", "while", "True", ":", "current_id", "=", "int", "(", "web3", ".", "version", ".", "network", ")", "if", "network_id", "!=", "current_id", ":", "raise", "RuntimeError", "(", ...
Check periodically if the underlying ethereum client's network id has changed
[ "Check", "periodically", "if", "the", "underlying", "ethereum", "client", "s", "network", "id", "has", "changed" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L122-L133
train
raiden-network/raiden
raiden/tasks.py
AlarmTask.register_callback
def register_callback(self, callback): """ Register a new callback. Note: The callback will be executed in the AlarmTask context and for this reason it should not block, otherwise we can miss block changes. """ if not callable(callback): r...
python
def register_callback(self, callback): """ Register a new callback. Note: The callback will be executed in the AlarmTask context and for this reason it should not block, otherwise we can miss block changes. """ if not callable(callback): r...
[ "def", "register_callback", "(", "self", ",", "callback", ")", ":", "if", "not", "callable", "(", "callback", ")", ":", "raise", "ValueError", "(", "'callback is not a callable'", ")", "self", ".", "callbacks", ".", "append", "(", "callback", ")" ]
Register a new callback. Note: The callback will be executed in the AlarmTask context and for this reason it should not block, otherwise we can miss block changes.
[ "Register", "a", "new", "callback", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L171-L182
train
raiden-network/raiden
raiden/tasks.py
AlarmTask.remove_callback
def remove_callback(self, callback): """Remove callback from the list of callbacks if it exists""" if callback in self.callbacks: self.callbacks.remove(callback)
python
def remove_callback(self, callback): """Remove callback from the list of callbacks if it exists""" if callback in self.callbacks: self.callbacks.remove(callback)
[ "def", "remove_callback", "(", "self", ",", "callback", ")", ":", "if", "callback", "in", "self", ".", "callbacks", ":", "self", ".", "callbacks", ".", "remove", "(", "callback", ")" ]
Remove callback from the list of callbacks if it exists
[ "Remove", "callback", "from", "the", "list", "of", "callbacks", "if", "it", "exists" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L184-L187
train
raiden-network/raiden
raiden/tasks.py
AlarmTask.first_run
def first_run(self, known_block_number): """ Blocking call to update the local state, if necessary. """ assert self.callbacks, 'callbacks not set' latest_block = self.chain.get_block(block_identifier='latest') log.debug( 'Alarm task first run', known_block_number...
python
def first_run(self, known_block_number): """ Blocking call to update the local state, if necessary. """ assert self.callbacks, 'callbacks not set' latest_block = self.chain.get_block(block_identifier='latest') log.debug( 'Alarm task first run', known_block_number...
[ "def", "first_run", "(", "self", ",", "known_block_number", ")", ":", "assert", "self", ".", "callbacks", ",", "'callbacks not set'", "latest_block", "=", "self", ".", "chain", ".", "get_block", "(", "block_identifier", "=", "'latest'", ")", "log", ".", "debug...
Blocking call to update the local state, if necessary.
[ "Blocking", "call", "to", "update", "the", "local", "state", "if", "necessary", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L207-L222
train
raiden-network/raiden
raiden/tasks.py
AlarmTask._maybe_run_callbacks
def _maybe_run_callbacks(self, latest_block): """ Run the callbacks if there is at least one new block. The callbacks are executed only if there is a new block, otherwise the filters may try to poll for an inexisting block number and the Ethereum client can return an JSON-RPC error. ...
python
def _maybe_run_callbacks(self, latest_block): """ Run the callbacks if there is at least one new block. The callbacks are executed only if there is a new block, otherwise the filters may try to poll for an inexisting block number and the Ethereum client can return an JSON-RPC error. ...
[ "def", "_maybe_run_callbacks", "(", "self", ",", "latest_block", ")", ":", "assert", "self", ".", "known_block_number", "is", "not", "None", ",", "'known_block_number not set'", "latest_block_number", "=", "latest_block", "[", "'number'", "]", "missed_blocks", "=", ...
Run the callbacks if there is at least one new block. The callbacks are executed only if there is a new block, otherwise the filters may try to poll for an inexisting block number and the Ethereum client can return an JSON-RPC error.
[ "Run", "the", "callbacks", "if", "there", "is", "at", "least", "one", "new", "block", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/tasks.py#L224-L269
train
raiden-network/raiden
raiden/storage/restore.py
channel_state_until_state_change
def channel_state_until_state_change( raiden, canonical_identifier: CanonicalIdentifier, state_change_identifier: int, ) -> typing.Optional[NettingChannelState]: """ Go through WAL state changes until a certain balance hash is found. """ wal = restore_to_state_change( transition_...
python
def channel_state_until_state_change( raiden, canonical_identifier: CanonicalIdentifier, state_change_identifier: int, ) -> typing.Optional[NettingChannelState]: """ Go through WAL state changes until a certain balance hash is found. """ wal = restore_to_state_change( transition_...
[ "def", "channel_state_until_state_change", "(", "raiden", ",", "canonical_identifier", ":", "CanonicalIdentifier", ",", "state_change_identifier", ":", "int", ",", ")", "->", "typing", ".", "Optional", "[", "NettingChannelState", "]", ":", "wal", "=", "restore_to_stat...
Go through WAL state changes until a certain balance hash is found.
[ "Go", "through", "WAL", "state", "changes", "until", "a", "certain", "balance", "hash", "is", "found", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/restore.py#L10-L36
train
raiden-network/raiden
raiden/utils/signing.py
pack_data
def pack_data(abi_types, values) -> bytes: """Normalize data and pack them into a byte array""" if len(abi_types) != len(values): raise ValueError( "Length mismatch between provided abi types and values. Got " "{0} types and {1} values.".format(len(abi_types), len(values)), ...
python
def pack_data(abi_types, values) -> bytes: """Normalize data and pack them into a byte array""" if len(abi_types) != len(values): raise ValueError( "Length mismatch between provided abi types and values. Got " "{0} types and {1} values.".format(len(abi_types), len(values)), ...
[ "def", "pack_data", "(", "abi_types", ",", "values", ")", "->", "bytes", ":", "if", "len", "(", "abi_types", ")", "!=", "len", "(", "values", ")", ":", "raise", "ValueError", "(", "\"Length mismatch between provided abi types and values. Got \"", "\"{0} types and {...
Normalize data and pack them into a byte array
[ "Normalize", "data", "and", "pack", "them", "into", "a", "byte", "array" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/signing.py#L9-L23
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
_RetryQueue._expiration_generator
def _expiration_generator( timeout_generator: Iterable[float], now: Callable[[], float] = time.time, ) -> Iterator[bool]: """Stateful generator that yields True if more than timeout has passed since previous True, False otherwise. Helper method to tell when a message...
python
def _expiration_generator( timeout_generator: Iterable[float], now: Callable[[], float] = time.time, ) -> Iterator[bool]: """Stateful generator that yields True if more than timeout has passed since previous True, False otherwise. Helper method to tell when a message...
[ "def", "_expiration_generator", "(", "timeout_generator", ":", "Iterable", "[", "float", "]", ",", "now", ":", "Callable", "[", "[", "]", ",", "float", "]", "=", "time", ".", "time", ",", ")", "->", "Iterator", "[", "bool", "]", ":", "for", "timeout", ...
Stateful generator that yields True if more than timeout has passed since previous True, False otherwise. Helper method to tell when a message needs to be retried (more than timeout seconds passed since last time it was sent). timeout is iteratively fetched from timeout_generator ...
[ "Stateful", "generator", "that", "yields", "True", "if", "more", "than", "timeout", "has", "passed", "since", "previous", "True", "False", "otherwise", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L117-L133
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
_RetryQueue.enqueue
def enqueue(self, queue_identifier: QueueIdentifier, message: Message): """ Enqueue a message to be sent, and notify main loop """ assert queue_identifier.recipient == self.receiver with self._lock: already_queued = any( queue_identifier == data.queue_identifier and m...
python
def enqueue(self, queue_identifier: QueueIdentifier, message: Message): """ Enqueue a message to be sent, and notify main loop """ assert queue_identifier.recipient == self.receiver with self._lock: already_queued = any( queue_identifier == data.queue_identifier and m...
[ "def", "enqueue", "(", "self", ",", "queue_identifier", ":", "QueueIdentifier", ",", "message", ":", "Message", ")", ":", "assert", "queue_identifier", ".", "recipient", "==", "self", ".", "receiver", "with", "self", ".", "_lock", ":", "already_queued", "=", ...
Enqueue a message to be sent, and notify main loop
[ "Enqueue", "a", "message", "to", "be", "sent", "and", "notify", "main", "loop" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L135-L163
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport.stop
def stop(self): """ Try to gracefully stop the greenlet synchronously Stop isn't expected to re-raise greenlet _run exception (use self.greenlet.get() for that), but it should raise any stop-time exception """ if self._stop_event.ready(): return self._stop_ev...
python
def stop(self): """ Try to gracefully stop the greenlet synchronously Stop isn't expected to re-raise greenlet _run exception (use self.greenlet.get() for that), but it should raise any stop-time exception """ if self._stop_event.ready(): return self._stop_ev...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_stop_event", ".", "ready", "(", ")", ":", "return", "self", ".", "_stop_event", ".", "set", "(", ")", "self", ".", "_global_send_event", ".", "set", "(", ")", "for", "retrier", "in", "self", ...
Try to gracefully stop the greenlet synchronously Stop isn't expected to re-raise greenlet _run exception (use self.greenlet.get() for that), but it should raise any stop-time exception
[ "Try", "to", "gracefully", "stop", "the", "greenlet", "synchronously" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L434-L459
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport.whitelist
def whitelist(self, address: Address): """Whitelist peer address to receive communications from This may be called before transport is started, to ensure events generated during start are handled properly. """ self.log.debug('Whitelist', address=to_normalized_address(address)) ...
python
def whitelist(self, address: Address): """Whitelist peer address to receive communications from This may be called before transport is started, to ensure events generated during start are handled properly. """ self.log.debug('Whitelist', address=to_normalized_address(address)) ...
[ "def", "whitelist", "(", "self", ",", "address", ":", "Address", ")", ":", "self", ".", "log", ".", "debug", "(", "'Whitelist'", ",", "address", "=", "to_normalized_address", "(", "address", ")", ")", "self", ".", "_address_mgr", ".", "add_address", "(", ...
Whitelist peer address to receive communications from This may be called before transport is started, to ensure events generated during start are handled properly.
[ "Whitelist", "peer", "address", "to", "receive", "communications", "from" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L476-L483
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport.send_async
def send_async( self, queue_identifier: QueueIdentifier, message: Message, ): """Queue the message for sending to recipient in the queue_identifier It may be called before transport is started, to initialize message queues The actual sending is started on...
python
def send_async( self, queue_identifier: QueueIdentifier, message: Message, ): """Queue the message for sending to recipient in the queue_identifier It may be called before transport is started, to initialize message queues The actual sending is started on...
[ "def", "send_async", "(", "self", ",", "queue_identifier", ":", "QueueIdentifier", ",", "message", ":", "Message", ",", ")", ":", "# even if transport is not started, can run to enqueue messages to send when it starts", "receiver_address", "=", "queue_identifier", ".", "recip...
Queue the message for sending to recipient in the queue_identifier It may be called before transport is started, to initialize message queues The actual sending is started only when the transport is started
[ "Queue", "the", "message", "for", "sending", "to", "recipient", "in", "the", "queue_identifier" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L516-L545
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport.send_global
def send_global(self, room: str, message: Message) -> None: """Sends a message to one of the global rooms These rooms aren't being listened on and therefore no reply could be heard, so these messages are sent in a send-and-forget async way. The actual room name is composed from the suff...
python
def send_global(self, room: str, message: Message) -> None: """Sends a message to one of the global rooms These rooms aren't being listened on and therefore no reply could be heard, so these messages are sent in a send-and-forget async way. The actual room name is composed from the suff...
[ "def", "send_global", "(", "self", ",", "room", ":", "str", ",", "message", ":", "Message", ")", "->", "None", ":", "self", ".", "_global_send_queue", ".", "put", "(", "(", "room", ",", "message", ")", ")", "self", ".", "_global_send_event", ".", "set"...
Sends a message to one of the global rooms These rooms aren't being listened on and therefore no reply could be heard, so these messages are sent in a send-and-forget async way. The actual room name is composed from the suffix given as parameter and chain name or id e.g.: raiden_ropsten...
[ "Sends", "a", "message", "to", "one", "of", "the", "global", "rooms" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L547-L559
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._handle_invite
def _handle_invite(self, room_id: _RoomID, state: dict): """ Join rooms invited by whitelisted partners """ if self._stop_event.ready(): return self.log.debug('Got invite', room_id=room_id) invite_events = [ event for event in state['events'] ...
python
def _handle_invite(self, room_id: _RoomID, state: dict): """ Join rooms invited by whitelisted partners """ if self._stop_event.ready(): return self.log.debug('Got invite', room_id=room_id) invite_events = [ event for event in state['events'] ...
[ "def", "_handle_invite", "(", "self", ",", "room_id", ":", "_RoomID", ",", "state", ":", "dict", ")", ":", "if", "self", ".", "_stop_event", ".", "ready", "(", ")", ":", "return", "self", ".", "log", ".", "debug", "(", "'Got invite'", ",", "room_id", ...
Join rooms invited by whitelisted partners
[ "Join", "rooms", "invited", "by", "whitelisted", "partners" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L644-L739
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._get_retrier
def _get_retrier(self, receiver: Address) -> _RetryQueue: """ Construct and return a _RetryQueue for receiver """ if receiver not in self._address_to_retrier: retrier = _RetryQueue(transport=self, receiver=receiver) self._address_to_retrier[receiver] = retrier # Alway...
python
def _get_retrier(self, receiver: Address) -> _RetryQueue: """ Construct and return a _RetryQueue for receiver """ if receiver not in self._address_to_retrier: retrier = _RetryQueue(transport=self, receiver=receiver) self._address_to_retrier[receiver] = retrier # Alway...
[ "def", "_get_retrier", "(", "self", ",", "receiver", ":", "Address", ")", "->", "_RetryQueue", ":", "if", "receiver", "not", "in", "self", ".", "_address_to_retrier", ":", "retrier", "=", "_RetryQueue", "(", "transport", "=", "self", ",", "receiver", "=", ...
Construct and return a _RetryQueue for receiver
[ "Construct", "and", "return", "a", "_RetryQueue", "for", "receiver" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L951-L961
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._get_private_room
def _get_private_room(self, invitees: List[User]): """ Create an anonymous, private room and invite peers """ return self._client.create_room( None, invitees=[user.user_id for user in invitees], is_public=False, )
python
def _get_private_room(self, invitees: List[User]): """ Create an anonymous, private room and invite peers """ return self._client.create_room( None, invitees=[user.user_id for user in invitees], is_public=False, )
[ "def", "_get_private_room", "(", "self", ",", "invitees", ":", "List", "[", "User", "]", ")", ":", "return", "self", ".", "_client", ".", "create_room", "(", "None", ",", "invitees", "=", "[", "user", ".", "user_id", "for", "user", "in", "invitees", "]...
Create an anonymous, private room and invite peers
[ "Create", "an", "anonymous", "private", "room", "and", "invite", "peers" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L1078-L1084
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._sign
def _sign(self, data: bytes) -> bytes: """ Use eth_sign compatible hasher to sign matrix data """ assert self._raiden_service is not None return self._raiden_service.signer.sign(data=data)
python
def _sign(self, data: bytes) -> bytes: """ Use eth_sign compatible hasher to sign matrix data """ assert self._raiden_service is not None return self._raiden_service.signer.sign(data=data)
[ "def", "_sign", "(", "self", ",", "data", ":", "bytes", ")", "->", "bytes", ":", "assert", "self", ".", "_raiden_service", "is", "not", "None", "return", "self", ".", "_raiden_service", ".", "signer", ".", "sign", "(", "data", "=", "data", ")" ]
Use eth_sign compatible hasher to sign matrix data
[ "Use", "eth_sign", "compatible", "hasher", "to", "sign", "matrix", "data" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L1207-L1210
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._get_user
def _get_user(self, user: Union[User, str]) -> User: """Creates an User from an user_id, if none, or fetch a cached User As all users are supposed to be in discovery room, its members dict is used for caching""" user_id: str = getattr(user, 'user_id', user) discovery_room = self._global...
python
def _get_user(self, user: Union[User, str]) -> User: """Creates an User from an user_id, if none, or fetch a cached User As all users are supposed to be in discovery room, its members dict is used for caching""" user_id: str = getattr(user, 'user_id', user) discovery_room = self._global...
[ "def", "_get_user", "(", "self", ",", "user", ":", "Union", "[", "User", ",", "str", "]", ")", "->", "User", ":", "user_id", ":", "str", "=", "getattr", "(", "user", ",", "'user_id'", ",", "user", ")", "discovery_room", "=", "self", ".", "_global_roo...
Creates an User from an user_id, if none, or fetch a cached User As all users are supposed to be in discovery room, its members dict is used for caching
[ "Creates", "an", "User", "from", "an", "user_id", "if", "none", "or", "fetch", "a", "cached", "User" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L1212-L1229
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._set_room_id_for_address
def _set_room_id_for_address(self, address: Address, room_id: Optional[_RoomID] = None): """ Uses GMatrixClient.set_account_data to keep updated mapping of addresses->rooms If room_id is falsy, clean list of rooms. Else, push room_id to front of the list """ assert not room_id or room_id in se...
python
def _set_room_id_for_address(self, address: Address, room_id: Optional[_RoomID] = None): """ Uses GMatrixClient.set_account_data to keep updated mapping of addresses->rooms If room_id is falsy, clean list of rooms. Else, push room_id to front of the list """ assert not room_id or room_id in se...
[ "def", "_set_room_id_for_address", "(", "self", ",", "address", ":", "Address", ",", "room_id", ":", "Optional", "[", "_RoomID", "]", "=", "None", ")", ":", "assert", "not", "room_id", "or", "room_id", "in", "self", ".", "_client", ".", "rooms", ",", "'I...
Uses GMatrixClient.set_account_data to keep updated mapping of addresses->rooms If room_id is falsy, clean list of rooms. Else, push room_id to front of the list
[ "Uses", "GMatrixClient", ".", "set_account_data", "to", "keep", "updated", "mapping", "of", "addresses", "-", ">", "rooms" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L1231-L1262
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._get_room_ids_for_address
def _get_room_ids_for_address( self, address: Address, filter_private: bool = None, ) -> List[_RoomID]: """ Uses GMatrixClient.get_account_data to get updated mapping of address->rooms It'll filter only existing rooms. If filter_private=True, also filter ...
python
def _get_room_ids_for_address( self, address: Address, filter_private: bool = None, ) -> List[_RoomID]: """ Uses GMatrixClient.get_account_data to get updated mapping of address->rooms It'll filter only existing rooms. If filter_private=True, also filter ...
[ "def", "_get_room_ids_for_address", "(", "self", ",", "address", ":", "Address", ",", "filter_private", ":", "bool", "=", "None", ",", ")", "->", "List", "[", "_RoomID", "]", ":", "address_hex", ":", "AddressHex", "=", "to_checksum_address", "(", "address", ...
Uses GMatrixClient.get_account_data to get updated mapping of address->rooms It'll filter only existing rooms. If filter_private=True, also filter out public rooms. If filter_private=None, filter according to self._private_rooms
[ "Uses", "GMatrixClient", ".", "get_account_data", "to", "get", "updated", "mapping", "of", "address", "-", ">", "rooms" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L1264-L1304
train
raiden-network/raiden
raiden/network/transport/matrix/transport.py
MatrixTransport._leave_unused_rooms
def _leave_unused_rooms(self, _address_to_room_ids: Dict[AddressHex, List[_RoomID]]): """ Checks for rooms we've joined and which partner isn't health-checked and leave. **MUST** be called from a context that holds the `_account_data_lock`. """ _msg = '_leave_unused_rooms called...
python
def _leave_unused_rooms(self, _address_to_room_ids: Dict[AddressHex, List[_RoomID]]): """ Checks for rooms we've joined and which partner isn't health-checked and leave. **MUST** be called from a context that holds the `_account_data_lock`. """ _msg = '_leave_unused_rooms called...
[ "def", "_leave_unused_rooms", "(", "self", ",", "_address_to_room_ids", ":", "Dict", "[", "AddressHex", ",", "List", "[", "_RoomID", "]", "]", ")", ":", "_msg", "=", "'_leave_unused_rooms called without account data lock'", "assert", "self", ".", "_account_data_lock",...
Checks for rooms we've joined and which partner isn't health-checked and leave. **MUST** be called from a context that holds the `_account_data_lock`.
[ "Checks", "for", "rooms", "we", "ve", "joined", "and", "which", "partner", "isn", "t", "health", "-", "checked", "and", "leave", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/transport.py#L1306-L1386
train
raiden-network/raiden
tools/scenario-player/scenario_player/scenario.py
NodesConfig.nodes
def nodes(self) -> List[str]: """Return the list of nodes configured in the scenario's yaml. Should the scenario use version 1, we check if there is a 'setting'. If so, we derive the list of nodes from this dictionary, using its 'first', 'last' and 'template' keys. Should any of these k...
python
def nodes(self) -> List[str]: """Return the list of nodes configured in the scenario's yaml. Should the scenario use version 1, we check if there is a 'setting'. If so, we derive the list of nodes from this dictionary, using its 'first', 'last' and 'template' keys. Should any of these k...
[ "def", "nodes", "(", "self", ")", "->", "List", "[", "str", "]", ":", "if", "self", ".", "_scenario_version", "==", "1", "and", "'range'", "in", "self", ".", "_config", ":", "range_config", "=", "self", ".", "_config", "[", "'range'", "]", "try", ":"...
Return the list of nodes configured in the scenario's yaml. Should the scenario use version 1, we check if there is a 'setting'. If so, we derive the list of nodes from this dictionary, using its 'first', 'last' and 'template' keys. Should any of these keys be missing, we throw an appro...
[ "Return", "the", "list", "of", "nodes", "configured", "in", "the", "scenario", "s", "yaml", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/scenario.py#L82-L121
train
raiden-network/raiden
tools/scenario-player/scenario_player/scenario.py
Scenario.version
def version(self) -> int: """Return the scenario's version. If this is not present, we default to version 1. :raises InvalidScenarioVersion: if the supplied version is not present in :var:`SUPPORTED_SCENARIO_VERSIONS`. """ version = self._config.get('version', 1) ...
python
def version(self) -> int: """Return the scenario's version. If this is not present, we default to version 1. :raises InvalidScenarioVersion: if the supplied version is not present in :var:`SUPPORTED_SCENARIO_VERSIONS`. """ version = self._config.get('version', 1) ...
[ "def", "version", "(", "self", ")", "->", "int", ":", "version", "=", "self", ".", "_config", ".", "get", "(", "'version'", ",", "1", ")", "if", "version", "not", "in", "SUPPORTED_SCENARIO_VERSIONS", ":", "raise", "InvalidScenarioVersion", "(", "f'Unexpected...
Return the scenario's version. If this is not present, we default to version 1. :raises InvalidScenarioVersion: if the supplied version is not present in :var:`SUPPORTED_SCENARIO_VERSIONS`.
[ "Return", "the", "scenario", "s", "version", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/scenario.py#L155-L167
train
raiden-network/raiden
tools/scenario-player/scenario_player/scenario.py
Scenario.protocol
def protocol(self) -> str: """Return the designated protocol of the scenario. If the node's mode is :attr:`NodeMode.MANAGED`, we always choose `http` and display a warning if there was a 'protocol' set explicitly in the scenario's yaml. Otherwise we simply access the 'protocol'...
python
def protocol(self) -> str: """Return the designated protocol of the scenario. If the node's mode is :attr:`NodeMode.MANAGED`, we always choose `http` and display a warning if there was a 'protocol' set explicitly in the scenario's yaml. Otherwise we simply access the 'protocol'...
[ "def", "protocol", "(", "self", ")", "->", "str", ":", "if", "self", ".", "nodes", ".", "mode", "is", "NodeMode", ".", "MANAGED", ":", "if", "'protocol'", "in", "self", ".", "_config", ":", "log", ".", "warning", "(", "'The \"protocol\" setting is not supp...
Return the designated protocol of the scenario. If the node's mode is :attr:`NodeMode.MANAGED`, we always choose `http` and display a warning if there was a 'protocol' set explicitly in the scenario's yaml. Otherwise we simply access the 'protocol' key of the yaml, defaulting to ...
[ "Return", "the", "designated", "protocol", "of", "the", "scenario", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/scenario.py#L180-L194
train
raiden-network/raiden
tools/scenario-player/scenario_player/scenario.py
Scenario.task
def task(self) -> Tuple[str, Any]: """Return the scenario's task configuration as a tuple. :raises MultipleTaskDefinitions: if there is more than one task config under the 'scenario' key. """ try: items, = self.configuration.items() except ValueError: ...
python
def task(self) -> Tuple[str, Any]: """Return the scenario's task configuration as a tuple. :raises MultipleTaskDefinitions: if there is more than one task config under the 'scenario' key. """ try: items, = self.configuration.items() except ValueError: ...
[ "def", "task", "(", "self", ")", "->", "Tuple", "[", "str", ",", "Any", "]", ":", "try", ":", "items", ",", "=", "self", ".", "configuration", ".", "items", "(", ")", "except", "ValueError", ":", "raise", "MultipleTaskDefinitions", "(", "'Multiple tasks ...
Return the scenario's task configuration as a tuple. :raises MultipleTaskDefinitions: if there is more than one task config under the 'scenario' key.
[ "Return", "the", "scenario", "s", "task", "configuration", "as", "a", "tuple", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/scenario.py#L250-L262
train
raiden-network/raiden
tools/scenario-player/scenario_player/scenario.py
Scenario.task_class
def task_class(self): """Return the Task class type configured for the scenario.""" from scenario_player.tasks.base import get_task_class_for_type root_task_type, _ = self.task task_class = get_task_class_for_type(root_task_type) return task_class
python
def task_class(self): """Return the Task class type configured for the scenario.""" from scenario_player.tasks.base import get_task_class_for_type root_task_type, _ = self.task task_class = get_task_class_for_type(root_task_type) return task_class
[ "def", "task_class", "(", "self", ")", ":", "from", "scenario_player", ".", "tasks", ".", "base", "import", "get_task_class_for_type", "root_task_type", ",", "_", "=", "self", ".", "task", "task_class", "=", "get_task_class_for_type", "(", "root_task_type", ")", ...
Return the Task class type configured for the scenario.
[ "Return", "the", "Task", "class", "type", "configured", "for", "the", "scenario", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/scenario.py#L271-L278
train
raiden-network/raiden
tools/check_circleci_config.py
_check_workflows_align
def _check_workflows_align(config): """ Ensure that the common shared jobs in the `raiden-default` and `nightly` workflows are identical. """ jobs_default = config['workflows']['raiden-default']['jobs'] jobs_nightly = config['workflows']['nightly']['jobs'] if jobs_default == jobs_nightly[:...
python
def _check_workflows_align(config): """ Ensure that the common shared jobs in the `raiden-default` and `nightly` workflows are identical. """ jobs_default = config['workflows']['raiden-default']['jobs'] jobs_nightly = config['workflows']['nightly']['jobs'] if jobs_default == jobs_nightly[:...
[ "def", "_check_workflows_align", "(", "config", ")", ":", "jobs_default", "=", "config", "[", "'workflows'", "]", "[", "'raiden-default'", "]", "[", "'jobs'", "]", "jobs_nightly", "=", "config", "[", "'workflows'", "]", "[", "'nightly'", "]", "[", "'jobs'", ...
Ensure that the common shared jobs in the `raiden-default` and `nightly` workflows are identical.
[ "Ensure", "that", "the", "common", "shared", "jobs", "in", "the", "raiden", "-", "default", "and", "nightly", "workflows", "are", "identical", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/check_circleci_config.py#L26-L58
train
raiden-network/raiden
raiden/network/rpc/smartcontract_proxy.py
ContractProxy.get_transaction_data
def get_transaction_data( abi: Dict, function_name: str, args: Any = None, kwargs: Any = None, ): """Get encoded transaction data""" args = args or list() fn_abi = find_matching_fn_abi( abi, function_name, ar...
python
def get_transaction_data( abi: Dict, function_name: str, args: Any = None, kwargs: Any = None, ): """Get encoded transaction data""" args = args or list() fn_abi = find_matching_fn_abi( abi, function_name, ar...
[ "def", "get_transaction_data", "(", "abi", ":", "Dict", ",", "function_name", ":", "str", ",", "args", ":", "Any", "=", "None", ",", "kwargs", ":", "Any", "=", "None", ",", ")", ":", "args", "=", "args", "or", "list", "(", ")", "fn_abi", "=", "find...
Get encoded transaction data
[ "Get", "encoded", "transaction", "data" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/smartcontract_proxy.py#L140-L161
train
raiden-network/raiden
raiden/network/rpc/smartcontract_proxy.py
ContractProxy.decode_transaction_input
def decode_transaction_input(self, transaction_hash: bytes) -> Dict: """Return inputs of a method call""" transaction = self.contract.web3.eth.getTransaction( transaction_hash, ) return self.contract.decode_function_input( transaction['input'], )
python
def decode_transaction_input(self, transaction_hash: bytes) -> Dict: """Return inputs of a method call""" transaction = self.contract.web3.eth.getTransaction( transaction_hash, ) return self.contract.decode_function_input( transaction['input'], )
[ "def", "decode_transaction_input", "(", "self", ",", "transaction_hash", ":", "bytes", ")", "->", "Dict", ":", "transaction", "=", "self", ".", "contract", ".", "web3", ".", "eth", ".", "getTransaction", "(", "transaction_hash", ",", ")", "return", "self", "...
Return inputs of a method call
[ "Return", "inputs", "of", "a", "method", "call" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/smartcontract_proxy.py#L163-L171
train
raiden-network/raiden
raiden/network/rpc/smartcontract_proxy.py
ContractProxy.estimate_gas
def estimate_gas( self, block_identifier, function: str, *args, **kwargs, ) -> typing.Optional[int]: """Returns a gas estimate for the function with the given arguments or None if the function call will fail due to Insufficient funds or ...
python
def estimate_gas( self, block_identifier, function: str, *args, **kwargs, ) -> typing.Optional[int]: """Returns a gas estimate for the function with the given arguments or None if the function call will fail due to Insufficient funds or ...
[ "def", "estimate_gas", "(", "self", ",", "block_identifier", ",", "function", ":", "str", ",", "*", "args", ",", "*", "*", "kwargs", ",", ")", "->", "typing", ".", "Optional", "[", "int", "]", ":", "fn", "=", "getattr", "(", "self", ".", "contract", ...
Returns a gas estimate for the function with the given arguments or None if the function call will fail due to Insufficient funds or the logic in the called function.
[ "Returns", "a", "gas", "estimate", "for", "the", "function", "with", "the", "given", "arguments", "or", "None", "if", "the", "function", "call", "will", "fail", "due", "to", "Insufficient", "funds", "or", "the", "logic", "in", "the", "called", "function", ...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/smartcontract_proxy.py#L179-L218
train
raiden-network/raiden
raiden/messages.py
SignedMessage.sign
def sign(self, signer: Signer): """ Sign message using signer. """ message_data = self._data_to_sign() self.signature = signer.sign(data=message_data)
python
def sign(self, signer: Signer): """ Sign message using signer. """ message_data = self._data_to_sign() self.signature = signer.sign(data=message_data)
[ "def", "sign", "(", "self", ",", "signer", ":", "Signer", ")", ":", "message_data", "=", "self", ".", "_data_to_sign", "(", ")", "self", ".", "signature", "=", "signer", ".", "sign", "(", "data", "=", "message_data", ")" ]
Sign message using signer.
[ "Sign", "message", "using", "signer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/messages.py#L282-L285
train
raiden-network/raiden
raiden/messages.py
SignedBlindedBalanceProof._sign
def _sign(self, signer: Signer) -> Signature: """Internal function for the overall `sign` function of `RequestMonitoring`. """ # Important: we don't write the signature to `.signature` data = self._data_to_sign() return signer.sign(data)
python
def _sign(self, signer: Signer) -> Signature: """Internal function for the overall `sign` function of `RequestMonitoring`. """ # Important: we don't write the signature to `.signature` data = self._data_to_sign() return signer.sign(data)
[ "def", "_sign", "(", "self", ",", "signer", ":", "Signer", ")", "->", "Signature", ":", "# Important: we don't write the signature to `.signature`", "data", "=", "self", ".", "_data_to_sign", "(", ")", "return", "signer", ".", "sign", "(", "data", ")" ]
Internal function for the overall `sign` function of `RequestMonitoring`.
[ "Internal", "function", "for", "the", "overall", "sign", "function", "of", "RequestMonitoring", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/messages.py#L1590-L1595
train
raiden-network/raiden
raiden/messages.py
RequestMonitoring.verify_request_monitoring
def verify_request_monitoring( self, partner_address: Address, requesting_address: Address, ) -> bool: """ One should only use this method to verify integrity and signatures of a RequestMonitoring message. """ if not self.non_closing_signature: ...
python
def verify_request_monitoring( self, partner_address: Address, requesting_address: Address, ) -> bool: """ One should only use this method to verify integrity and signatures of a RequestMonitoring message. """ if not self.non_closing_signature: ...
[ "def", "verify_request_monitoring", "(", "self", ",", "partner_address", ":", "Address", ",", "requesting_address", ":", "Address", ",", ")", "->", "bool", ":", "if", "not", "self", ".", "non_closing_signature", ":", "return", "False", "balance_proof_data", "=", ...
One should only use this method to verify integrity and signatures of a RequestMonitoring message.
[ "One", "should", "only", "use", "this", "method", "to", "verify", "integrity", "and", "signatures", "of", "a", "RequestMonitoring", "message", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/messages.py#L1780-L1824
train
raiden-network/raiden
raiden/utils/filters.py
get_filter_args_for_specific_event_from_channel
def get_filter_args_for_specific_event_from_channel( token_network_address: TokenNetworkAddress, channel_identifier: ChannelID, event_name: str, contract_manager: ContractManager, from_block: BlockSpecification = GENESIS_BLOCK_NUMBER, to_block: BlockSpecification = 'lates...
python
def get_filter_args_for_specific_event_from_channel( token_network_address: TokenNetworkAddress, channel_identifier: ChannelID, event_name: str, contract_manager: ContractManager, from_block: BlockSpecification = GENESIS_BLOCK_NUMBER, to_block: BlockSpecification = 'lates...
[ "def", "get_filter_args_for_specific_event_from_channel", "(", "token_network_address", ":", "TokenNetworkAddress", ",", "channel_identifier", ":", "ChannelID", ",", "event_name", ":", "str", ",", "contract_manager", ":", "ContractManager", ",", "from_block", ":", "BlockSpe...
Return the filter params for a specific event of a given channel.
[ "Return", "the", "filter", "params", "for", "a", "specific", "event", "of", "a", "given", "channel", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/filters.py#L32-L59
train