INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Sends the proof to the Connection
Example:
msg_id = '1'
phone_number = '8019119191'
connection = await Connection.create(source_id)
await connection.connect(phone_number)
disclosed_proof = await DisclosedProof.create_with_msgid(source_id, connection, msg_id)
await... | async def send_proof(self, connection: Connection):
"""
Sends the proof to the Connection
Example:
msg_id = '1'
phone_number = '8019119191'
connection = await Connection.create(source_id)
await connection.connect(phone_number)
disclosed_proof = await Discl... |
Generates the proof
Example:
msg_id = '1'
phone_number = '8019119191'
connection = await Connection.create(source_id)
await connection.connect(phone_number)
disclosed_proof = await DisclosedProof.create_with_msgid(source_id, connection, msg_id)
await disclosed_pro... | async def generate_proof(self, selected_creds: dict, self_attested_attrs: dict):
"""
Generates the proof
Example:
msg_id = '1'
phone_number = '8019119191'
connection = await Connection.create(source_id)
await connection.connect(phone_number)
disclosed_proo... |
Create the payment address for specified payment method
This method generates private part of payment address
and stores it in a secure place. Ideally it should be
secret in libindy wallet (see crypto module).
Note that payment method should be able to resolve this
secret by fully resolvable... | async def create_payment_address(wallet_handle: int,
payment_method: str,
config: str) -> str:
"""
Create the payment address for specified payment method
This method generates private part of payment address
and stores it in a secur... |
Builds Indy request for getting sources list for payment address
according to this payment method.
:param wallet_handle: wallet handle (created by open_wallet).
:param submitter_did : (Option) DID of request sender
:param payment_address: target payment address
:return: get_sources_txn_json: Indy r... | async def build_get_payment_sources_request(wallet_handle: int,
submitter_did: str,
payment_address: str) -> (str, str):
"""
Builds Indy request for getting sources list for payment address
according to this payment meth... |
Builds Indy request for doing payment
according to this payment method.
This method consumes set of inputs and outputs.
Format of inputs is specific for payment method. Usually it should reference payment transaction
with at least one output that corresponds to payment address that user owns.
... | async def build_payment_req(wallet_handle: int,
submitter_did: str,
inputs_json: str,
outputs_json: str,
extra: Optional[str]) -> (str, str):
"""
Builds Indy request for doing payment
according to... |
Builds Indy request for setting fees for transactions in the ledger
:param wallet_handle: wallet handle (created by open_wallet).
:param submitter_did : (Option) DID of request sender
:param payment_method: Payment method to use (for example, 'sov').
:param fees_json: {
txnType1: amount1,
... | async def build_set_txn_fees_req(wallet_handle: int,
submitter_did: str,
payment_method: str,
fees_json: str) -> str:
"""
Builds Indy request for setting fees for transactions in the ledger
:param wallet_hand... |
Builds Indy request for getting fees for transactions in the ledger
:param wallet_handle: wallet handle (created by open_wallet).
:param submitter_did : (Option) DID of request sender
:param payment_method: Payment method to use (for example, 'sov').
:return: set_txn_fees_json: Indy request for setting... | async def build_get_txn_fees_req(wallet_handle: int,
submitter_did: str,
payment_method: str) -> str:
"""
Builds Indy request for getting fees for transactions in the ledger
:param wallet_handle: wallet handle (created by open_wallet).
:... |
Parses response for Indy request for getting fees
:param payment_method: Payment method to use (for example, 'sov').
:param resp_json: response for Indy request for getting fees
:return: fees_json: {
txnType1: amount1,
txnType2: amount2,
.................
txnTypeN: amountN,
... | async def parse_get_txn_fees_response(payment_method: str,
resp_json: str) -> str:
"""
Parses response for Indy request for getting fees
:param payment_method: Payment method to use (for example, 'sov').
:param resp_json: response for Indy request for getting fees
... |
Builds Indy request for information to verify the payment receipt
:param wallet_handle: wallet handle (created by open_wallet).
:param submitter_did : (Option) DID of request sender
:param receipt: payment receipt to verify
:return: verify_txn_json: Indy request for verification receipt for transactio... | async def build_verify_payment_req(wallet_handle: int,
submitter_did: str,
receipt: str) -> (str, str):
"""
Builds Indy request for information to verify the payment receipt
:param wallet_handle: wallet handle (created by open_wallet).
... |
Creates a new schema object that is written to the ledger
:param source_id: Institution's unique ID for the schema
:param name: Name of schema
:param version: Version of the schema
:param attrs: Atttributes of the schema
:param payment_handle: NYI - payment of ledger fee is take... | async def create(source_id: str, name: str, version: str, attrs: list, payment_handle: int):
"""
Creates a new schema object that is written to the ledger
:param source_id: Institution's unique ID for the schema
:param name: Name of schema
:param version: Version of the schema
... |
Create the object from a previously serialized object.
:param data: The output of the "serialize" call
Example:
source_id = 'foobar123'
name = 'Address Schema'
version = '1.0'
attrs = ['address', 'city', 'state']
payment_handle = 0
schema1 = await Schema.... | async def deserialize(data: dict):
"""
Create the object from a previously serialized object.
:param data: The output of the "serialize" call
Example:
source_id = 'foobar123'
name = 'Address Schema'
version = '1.0'
attrs = ['address', 'city', 'state']
... |
Create a new schema object from an existing ledger schema
:param source_id: Institution's personal identification for the schema
:param schema_id: Ledger schema ID for lookup
Example:
source_id = 'foobar123'
name = 'Address Schema'
version = '1.0'
attrs = ['addre... | async def lookup(source_id: str, schema_id: str):
"""
Create a new schema object from an existing ledger schema
:param source_id: Institution's personal identification for the schema
:param schema_id: Ledger schema ID for lookup
Example:
source_id = 'foobar123'
n... |
Get the ledger ID of the object
Example:
source_id = 'foobar123'
name = 'Address Schema'
version = '1.0'
attrs = ['address', 'city', 'state']
payment_handle = 0
schema1 = await Schema.create(source_id, name, version, attrs, payment_handle)
id1 = await sch... | async def get_schema_id(self):
"""
Get the ledger ID of the object
Example:
source_id = 'foobar123'
name = 'Address Schema'
version = '1.0'
attrs = ['address', 'city', 'state']
payment_handle = 0
schema1 = await Schema.create(source_id, name, vers... |
Check if pairwise is exists.
:param wallet_handle: wallet handler (created by open_wallet).
:param their_did: encoded Did.
:return: true - if pairwise is exists, false - otherwise | async def is_pairwise_exists(wallet_handle: int,
their_did: str) -> bool:
"""
Check if pairwise is exists.
:param wallet_handle: wallet handler (created by open_wallet).
:param their_did: encoded Did.
:return: true - if pairwise is exists, false - otherwise
"""
... |
Get list of saved pairwise.
:param wallet_handle: wallet handler (created by open_wallet).
:return: pairwise_list: list of saved pairwise | async def list_pairwise(wallet_handle: int) -> str:
"""
Get list of saved pairwise.
:param wallet_handle: wallet handler (created by open_wallet).
:return: pairwise_list: list of saved pairwise
"""
logger = logging.getLogger(__name__)
logger.debug("list_pairwise: >>> wallet_handle: %r", wa... |
Gets pairwise information for specific their_did.
:param wallet_handle: wallet handler (created by open_wallet).
:param their_did: encoded Did
:return: pairwise_info_json: did info associated with their did | async def get_pairwise(wallet_handle: int,
their_did: str) -> None:
"""
Gets pairwise information for specific their_did.
:param wallet_handle: wallet handler (created by open_wallet).
:param their_did: encoded Did
:return: pairwise_info_json: did info associated with their d... |
Save some data in the Wallet for pairwise associated with Did.
:param wallet_handle: wallet handler (created by open_wallet).
:param their_did: encoded DID
:param metadata: some extra information for pairwise
:return: Error code | async def set_pairwise_metadata(wallet_handle: int,
their_did: str,
metadata: Optional[str]) -> None:
"""
Save some data in the Wallet for pairwise associated with Did.
:param wallet_handle: wallet handler (created by open_wallet).
:param ... |
set the colors for text. | def print_log(value_color="", value_noncolor=""):
"""set the colors for text."""
HEADER = '\033[92m'
ENDC = '\033[0m'
print(HEADER + value_color + ENDC + str(value_noncolor)) |
Set libindy runtime configuration. Can be optionally called to change current params.
:param config: {
"crypto_thread_pool_size": Optional<int> - size of thread pool for the most expensive crypto operations. (4 by default)
"collect_backtrace": Optional<bool> - whether errors backtrace should be collec... | def set_runtime_config(config: str):
"""
Set libindy runtime configuration. Can be optionally called to change current params.
:param config: {
"crypto_thread_pool_size": Optional<int> - size of thread pool for the most expensive crypto operations. (4 by default)
"collect_backtrace": Optional... |
Builds a generic proof object
:param source_id: Tag associated by user of sdk
:param name: Name of the Proof
:param requested_attrs: Attributes associated with the Proof
:param revocation_interval: interval applied to all requested attributes indicating when the claim must be valid (NOT ... | async def create(source_id: str, name: str, requested_attrs: list, revocation_interval: dict, requested_predicates: list = []):
"""
Builds a generic proof object
:param source_id: Tag associated by user of sdk
:param name: Name of the Proof
:param requested_attrs: Attributes ass... |
Builds a Proof object with defined attributes.
Attributes are provided by a previous call to the serialize function.
:param data:
Example:
name = "proof name"
requested_attrs = [{"name": "age", "restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schema_name:0.0.11", "schema_... | async def deserialize(data: dict):
"""
Builds a Proof object with defined attributes.
Attributes are provided by a previous call to the serialize function.
:param data:
Example:
name = "proof name"
requested_attrs = [{"name": "age", "restrictions": [{"schema_id": ... |
Example:
connection = await Connection.create(source_id)
await connection.connect(phone_number)
name = "proof name"
requested_attrs = [{"name": "age", "restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schema_name:0.0.11", "schema_name":"Faber Student Info", "schema_version":"1.0",... | async def request_proof(self, connection: Connection):
"""
Example:
connection = await Connection.create(source_id)
await connection.connect(phone_number)
name = "proof name"
requested_attrs = [{"name": "age", "restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schem... |
Example:
connection = await Connection.create(source_id)
await connection.connect(phone_number)
name = "proof name"
requested_attrs = [{"name": "age", "restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schema_name:0.0.11", "schema_name":"Faber Student Info", "schema_version":"1.0",... | async def get_proof(self, connection: Connection) -> list:
"""
Example:
connection = await Connection.create(source_id)
await connection.connect(phone_number)
name = "proof name"
requested_attrs = [{"name": "age", "restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:s... |
Provision an agent in the agency, populate configuration and wallet for this agent.
Example:
import json
enterprise_config = {
'agency_url': 'http://localhost:8080',
'agency_did': 'VsKV7grR1BUE29mG2Fm2kX',
'agency_verkey': "Hezce2UWMZ3wUhVkh2LfKSs8nDzWwzs2Win7EzNN3YaR",
'wall... | async def vcx_agent_provision(config: str) -> None:
"""
Provision an agent in the agency, populate configuration and wallet for this agent.
Example:
import json
enterprise_config = {
'agency_url': 'http://localhost:8080',
'agency_did': 'VsKV7grR1BUE29mG2Fm2kX',
'agency_verkey... |
Get ledger fees from the sovrin network
Example:
fees = await vcx_ledger_get_fees()
:return: JSON representing fees | async def vcx_ledger_get_fees() -> str:
"""
Get ledger fees from the sovrin network
Example:
fees = await vcx_ledger_get_fees()
:return: JSON representing fees
"""
logger = logging.getLogger(__name__)
if not hasattr(vcx_ledger_get_fees, "cb"):
logger.debug("vcx_ledger_get_fees: ... |
Retrieve messages from the specified connection
:param status:
:param uids:
:param pw_dids:
:return: | async def vcx_messages_download(status: str = None, uids: str = None, pw_dids: str = None) -> str:
"""
Retrieve messages from the specified connection
:param status:
:param uids:
:param pw_dids:
:return:
"""
logger = logging.getLogger(__name__)
if not hasattr(vcx_messages_download, ... |
Update the status of messages from the specified connection
:param msg_json:
:return: | async def vcx_messages_update_status(msg_json: str):
"""
Update the status of messages from the specified connection
:param msg_json:
:return:
"""
logger = logging.getLogger(__name__)
if not hasattr(vcx_messages_update_status, "cb"):
logger.debug("vcx_messages_update_status: Creatin... |
Signs a message with a key.
Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) for specific DID.
:param wallet_handle: wallet handler (created by open_wallet).
:param signer_vk: id (verkey) of my key. The key must be created by calling create_key or create_and_st... | async def crypto_sign(wallet_handle: int,
signer_vk: str,
msg: bytes) -> bytes:
"""
Signs a message with a key.
Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) for specific DID.
:param wallet_handle: wallet handle... |
Verify a signature with a verkey.
Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) for specific DID.
:param signer_vk: verkey of signer of the message
:param msg: message that has been signed
:param signature: a signature to be verified
:return: valid: t... | async def crypto_verify(signer_vk: str,
msg: bytes,
signature: bytes) -> bool:
"""
Verify a signature with a verkey.
Note to use DID keys with this function you can call indy_key_for_did to get key id (verkey) for specific DID.
:param signer_vk: verkey o... |
**** THIS FUNCTION WILL BE DEPRECATED USE unpack_message INSTEAD ****
Decrypt a message by authenticated-encryption scheme.
Sender can encrypt a confidential message specifically for Recipient, using Sender's public key.
Using Recipient's public key, Sender can compute a shared secret key.
Using Sende... | async def auth_decrypt(wallet_handle: int,
recipient_vk: str,
encrypted_msg: bytes) -> (str, bytes):
"""
**** THIS FUNCTION WILL BE DEPRECATED USE unpack_message INSTEAD ****
Decrypt a message by authenticated-encryption scheme.
Sender can encrypt a confid... |
Encrypts a message by anonymous-encryption scheme.
Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
Only the Recipient can decrypt these messages, using its private key.
While the Recipient can verify the integrity of the message, it cannot verify the identity of ... | async def anon_crypt(recipient_vk: str,
msg: bytes) -> bytes:
"""
Encrypts a message by anonymous-encryption scheme.
Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
Only the Recipient can decrypt these messages, using its private key.
... |
Decrypts a message by anonymous-encryption scheme.
Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
Only the Recipient can decrypt these messages, using its private key.
While the Recipient can verify the integrity of the message, it cannot verify the identity of ... | async def anon_decrypt(wallet_handle: int,
recipient_vk: str,
encrypted_msg: bytes) -> bytes:
"""
Decrypts a message by anonymous-encryption scheme.
Sealed boxes are designed to anonymously send messages to a Recipient given its public key.
Only the Recipie... |
Packs a message by encrypting the message and serializes it in a JWE-like format (Experimental)
Note to use DID keys with this function you can call did.key_for_did to get key id (verkey)
for specific DID.
#Params
command_handle: command handle to map callback to user context.
wallet_handle: walle... | async def pack_message(wallet_handle: int,
message: str,
recipient_verkeys: list,
sender_verkey: Optional[str]) -> bytes:
"""
Packs a message by encrypting the message and serializes it in a JWE-like format (Experimental)
Note to use DID ... |
Unpacks a JWE-like formatted message outputted by pack_message (Experimental)
#Params
command_handle: command handle to map callback to user context.
wallet_handle: wallet handler (created by open_wallet)
message: the output of a pack message
#Returns -> See HIPE 0028 for details
(Authcrypt mo... | async def unpack_message(wallet_handle: int,
jwe: bytes) -> bytes:
"""
Unpacks a JWE-like formatted message outputted by pack_message (Experimental)
#Params
command_handle: command handle to map callback to user context.
wallet_handle: wallet handler (created by open_wallet... |
Initializes VCX with config file.
:param config_path: String
Example:
await vcx_init('/home/username/vcxconfig.json')
:return: | async def vcx_init(config_path: str) -> None:
"""
Initializes VCX with config file.
:param config_path: String
Example:
await vcx_init('/home/username/vcxconfig.json')
:return:
"""
logger = logging.getLogger(__name__)
if not hasattr(vcx_init, "cb"):
logger.debug("vcx_init: C... |
Creates a new CredentialDef object that is written to the ledger
:param source_id: Institution's unique ID for the credential definition
:param name: Name of credential definition
:param schema_id: The schema ID given during the creation of the schema
:param payment_handle: NYI - paymen... | async def create(source_id: str, name: str, schema_id: str, payment_handle: int):
"""
Creates a new CredentialDef object that is written to the ledger
:param source_id: Institution's unique ID for the credential definition
:param name: Name of credential definition
:param schema... |
Create the object from a previously serialized object.
:param data: The output of the "serialize" call
Example:
source_id = 'foobar123'
schema_name = 'Schema Name'
payment_handle = 0
credential_def1 = await CredentialDef.create(source_id, name, schema_id, payment_handle)... | async def deserialize(data: dict):
"""
Create the object from a previously serialized object.
:param data: The output of the "serialize" call
Example:
source_id = 'foobar123'
schema_name = 'Schema Name'
payment_handle = 0
credential_def1 = await Credentia... |
Get the ledger ID of the object
Example:
source_id = 'foobar123'
schema_name = 'Schema Name'
payment_handle = 0
credential_def1 = await CredentialDef.create(source_id, name, schema_id, payment_handle)
assert await credential_def.get_cred_def_id() == '2hoqvcwupRTUNkXn6ArY... | async def get_cred_def_id(self):
"""
Get the ledger ID of the object
Example:
source_id = 'foobar123'
schema_name = 'Schema Name'
payment_handle = 0
credential_def1 = await CredentialDef.create(source_id, name, schema_id, payment_handle)
assert await cred... |
Creates a new local pool ledger configuration that can be used later to connect pool nodes.
:param config_name: Name of the pool ledger configuration.
:param config: (optional) Pool configuration json. if NULL, then default config will be used. Example:
{
"genesis_txn": string (optional), A... | async def create_pool_ledger_config(config_name: str,
config: Optional[str]) -> None:
"""
Creates a new local pool ledger configuration that can be used later to connect pool nodes.
:param config_name: Name of the pool ledger configuration.
:param config: (optional) ... |
Refreshes a local copy of a pool ledger and updates pool nodes connections.
:param handle: pool handle returned by indy_open_pool_ledger
:return: Error code | async def refresh_pool_ledger(handle: int) -> None:
"""
Refreshes a local copy of a pool ledger and updates pool nodes connections.
:param handle: pool handle returned by indy_open_pool_ledger
:return: Error code
"""
logger = logging.getLogger(__name__)
logger.debug("refresh_pool_ledger: >... |
Lists names of created pool ledgers
:return: Error code | async def list_pools() -> None:
"""
Lists names of created pool ledgers
:return: Error code
"""
logger = logging.getLogger(__name__)
logger.debug("list_pools: >>> ")
if not hasattr(list_pools, "cb"):
logger.debug("list_pools: Creating callback")
list_pools.cb = create_cb(CF... |
Deletes created pool ledger configuration.
:param config_name: Name of the pool ledger configuration to delete.
:return: Error code | async def delete_pool_ledger_config(config_name: str) -> None:
"""
Deletes created pool ledger configuration.
:param config_name: Name of the pool ledger configuration to delete.
:return: Error code
"""
logger = logging.getLogger(__name__)
logger.debug("delete_pool_ledger_config: >>> confi... |
Set PROTOCOL_VERSION to specific version.
There is a global property PROTOCOL_VERSION that used in every request to the pool and
specified version of Indy Node which Libindy works.
By default PROTOCOL_VERSION=1.
:param protocol_version: Protocol version will be used:
1 - for Indy Node 1.3
... | async def set_protocol_version(protocol_version: int) -> None:
"""
Set PROTOCOL_VERSION to specific version.
There is a global property PROTOCOL_VERSION that used in every request to the pool and
specified version of Indy Node which Libindy works.
By default PROTOCOL_VERSION=1.
:param protocol... |
Opens a search handle within the storage wallet.
:param type_: String
:param query: dictionary
:param options: dictionary
Example:
query_json = {"tagName1": "str1"}
type_ = 'TestType'
search_handle = await Wallet.open_search(type_, query_json, None)
:retu... | async def open_search(type_: str, query: dict, options: dict):
"""
Opens a search handle within the storage wallet.
:param type_: String
:param query: dictionary
:param options: dictionary
Example:
query_json = {"tagName1": "str1"}
type_ = 'TestType'
... |
Searches for next n record from an open search handle
:param handle: int
:param count: int
Example:
query_json = {"tagName1": "str1"}
type_ = 'TestType'
search_handle = await Wallet.open_search(type_, query_json, None)
results = await Wallet.search_next_records(... | async def search_next_records(handle: int, count: int):
"""
Searches for next n record from an open search handle
:param handle: int
:param count: int
Example:
query_json = {"tagName1": "str1"}
type_ = 'TestType'
search_handle = await Wallet.open_search(... |
Retrieves a record from the wallet storage.
:param type_: String
:param id: String
:param options: String
Example:
import json
await Wallet.add_record({
'id': 'RecordId',
'tags': json.dumps({
'tag1': 'unencrypted value1',
... | async def get_record(type_: str, id: str, options: str):
"""
Retrieves a record from the wallet storage.
:param type_: String
:param id: String
:param options: String
Example:
import json
await Wallet.add_record({
'id': 'RecordId',
... |
Delete a record from the storage wallet.
:param type_:
:param id:
Example:
await Wallet.add_record({
'id': 'RecordId',
'tags': json.dumps({
'tag1': 'unencrypted value1',
'~encryptedTag', 'this value is encrypted,
'i... | async def delete_record(type_: str, id: str):
"""
Delete a record from the storage wallet.
:param type_:
:param id:
Example:
await Wallet.add_record({
'id': 'RecordId',
'tags': json.dumps({
'tag1': 'unencrypted value1',
... |
Retrieves from the ledger token info associated with the wallet.
:param handle:
Example:
payment_handle = 0 // payment handle is always 0, for now.
info = await Wallet.get_token_info(payment_handle)
:return: | async def get_token_info(handle: int) -> str:
"""
Retrieves from the ledger token info associated with the wallet.
:param handle:
Example:
payment_handle = 0 // payment handle is always 0, for now.
info = await Wallet.get_token_info(payment_handle)
:return:
... |
Creates a payment address inside the wallet.
:param seed: String
Example:
address = await Wallet.create_payment_address('00000000000000000000000001234567')
:return: String | async def create_payment_address(seed: str = None) -> str:
"""
Creates a payment address inside the wallet.
:param seed: String
Example:
address = await Wallet.create_payment_address('00000000000000000000000001234567')
:return: String
"""
logger = logging.... |
Determines whether a payment address is valid or not
:param address: String
Example:
address = await Wallet.create_payment_address('00000000000000000000000001234567')
b = await Wallet.validate_payment_address(address)
:return: Boolean | async def validate_payment_address(address: str) -> None:
"""
Determines whether a payment address is valid or not
:param address: String
Example:
address = await Wallet.create_payment_address('00000000000000000000000001234567')
b = await Wallet.validate_payment_address(a... |
Sends tokens to an address
payment_handle is always 0
:param payment_handle: Integer
:param tokens: Integer
:param address: String
Example:
payment_handle = 0
amount = 1000
address = await Wallet.create_payment_address('00000000000000000000000001234567')
... | async def send_tokens(payment_handle: int, tokens: int, address: str) -> str:
"""
Sends tokens to an address
payment_handle is always 0
:param payment_handle: Integer
:param tokens: Integer
:param address: String
Example:
payment_handle = 0
amount ... |
Exports opened wallet
:param path: Path to export wallet to User's File System.
:param backupKey: String representing the User's Key for securing (encrypting) the exported Wallet.
:return:
Error code - success indicates that the wallet was successfully exported. | async def export(path, backup_key):
"""
Exports opened wallet
:param path: Path to export wallet to User's File System.
:param backupKey: String representing the User's Key for securing (encrypting) the exported Wallet.
:return:
Error code - success indicates that the wal... |
Imports wallet from file with given key.
Cannot be used if wallet is already opened (Especially if vcx_init has already been used).
:param config: Can be same config that is passed to vcx_init.
Must include: '{"wallet_name":"","wallet_key":"","exported_wallet_path":"","backup_key":""}'
:... | async def import_wallet(config):
"""
Imports wallet from file with given key.
Cannot be used if wallet is already opened (Especially if vcx_init has already been used).
:param config: Can be same config that is passed to vcx_init.
Must include: '{"wallet_name":"","wallet_key":"",... |
Update a non-secret wallet record value
:param wallet_handle: wallet handler (created by open_wallet).
:param type_: allows to separate different record types collections
:param id_: the id of record
:param value: the value of record
:return: None | async def update_wallet_record_value(wallet_handle: int,
type_: str,
id_: str,
value: str) -> None:
"""
Update a non-secret wallet record value
:param wallet_handle: wallet handler (created by ope... |
Get an wallet record by id
:param wallet_handle: wallet handler (created by open_wallet).
:param type_: allows to separate different record types collections
:param id: the id of record
:param options_json: //TODO: FIXME: Think about replacing by bitmask
{
retrieveType: (optional, false b... | async def get_wallet_record(wallet_handle: int,
type_: str,
id: str,
options_json: str) -> str:
"""
Get an wallet record by id
:param wallet_handle: wallet handler (created by open_wallet).
:param type_: allows to separ... |
Search for wallet records
:param wallet_handle: wallet handler (created by open_wallet).
:param type_: allows to separate different record types collections
:param query_json: MongoDB style query to wallet record tags:
{
"tagName": "tagValue",
$or: {
"tagName2": { $regex: 'p... | async def open_wallet_search(wallet_handle: int,
type_: str,
query_json: str,
options_json: str) -> int:
"""
Search for wallet records
:param wallet_handle: wallet handler (created by open_wallet).
:param type_: allo... |
Fetch next records for wallet search.
:param wallet_handle: wallet handler (created by open_wallet).
:param wallet_search_handle: wallet wallet handle (created by open_wallet_search)
:param count: Count of records to fetch
:return: wallet records json:
{
totalCount: <str>, // present only i... | async def fetch_wallet_search_next_records(wallet_handle: int,
wallet_search_handle: int,
count: int) -> str:
"""
Fetch next records for wallet search.
:param wallet_handle: wallet handler (created by open_wallet).
:p... |
Close wallet search (make search handle invalid)
:param wallet_search_handle: wallet wallet handle (created by open_wallet_search)
:return: None | async def close_wallet_search(wallet_search_handle: int) -> None:
"""
Close wallet search (make search handle invalid)
:param wallet_search_handle: wallet wallet handle (created by open_wallet_search)
:return: None
"""
logger = logging.getLogger(__name__)
logger.debug("close_wallet_search:... |
Returns a decorator registering a mark class in the mark type registry.
If no key is provided, the class name is used as a key. A key is provided
for each core bqplot mark so that the frontend can use
this key regardless of the kernel language. | def register_mark(key=None):
"""Returns a decorator registering a mark class in the mark type registry.
If no key is provided, the class name is used as a key. A key is provided
for each core bqplot mark so that the frontend can use
this key regardless of the kernel language.
"""
def wrap(mark)... |
Return the list of scales corresponding to a given dimension.
The preserve_domain optional argument specifies whether one should
filter out the scales for which preserve_domain is set to True. | def _get_dimension_scales(self, dimension, preserve_domain=False):
"""
Return the list of scales corresponding to a given dimension.
The preserve_domain optional argument specifies whether one should
filter out the scales for which preserve_domain is set to True.
"""
if ... |
Validates the `scales` based on the mark's scaled attributes metadata.
First checks for missing scale and then for 'rtype' compatibility. | def _validate_scales(self, proposal):
"""
Validates the `scales` based on the mark's scaled attributes metadata.
First checks for missing scale and then for 'rtype' compatibility.
"""
# Validate scales' 'rtype' versus data attribute 'rtype' decoration
# At this stage it ... |
Returns a decorator registering an axis class in the axis type registry.
If no key is provided, the class name is used as a key. A key is provided
for each core bqplot axis so that the frontend can use this key regardless
of the kernel language. | def register_axis(key=None):
"""Returns a decorator registering an axis class in the axis type registry.
If no key is provided, the class name is used as a key. A key is provided
for each core bqplot axis so that the frontend can use this key regardless
of the kernel language.
"""
def wrap(axis... |
Decorator registering an interaction class in the registry.
If no key is provided, the class name is used as a key. A key is provided
for each core bqplot interaction type so that the frontend can use this
key regardless of the kernal language. | def register_interaction(key=None):
"""Decorator registering an interaction class in the registry.
If no key is provided, the class name is used as a key. A key is provided
for each core bqplot interaction type so that the frontend can use this
key regardless of the kernal language.
"""
def wra... |
Helper function for panning and zooming over a set of marks.
Creates and returns a panzoom interaction with the 'x' and 'y' dimension
scales of the specified marks. | def panzoom(marks):
"""Helper function for panning and zooming over a set of marks.
Creates and returns a panzoom interaction with the 'x' and 'y' dimension
scales of the specified marks.
"""
return PanZoom(scales={
'x': sum([mark._get_dimension_scales('x', preserve_domain=True) for mar... |
Returns a decorator to register a scale type in the scale type
registry.
If no key is provided, the class name is used as a key. A key is
provided for each core bqplot scale type so that the frontend can use
this key regardless of the kernal language. | def register_scale(key=None):
"""Returns a decorator to register a scale type in the scale type
registry.
If no key is provided, the class name is used as a key. A key is
provided for each core bqplot scale type so that the frontend can use
this key regardless of the kernal language.
"""
de... |
Install the bqplot nbextension.
Parameters
----------
user: bool
Install for current user instead of system-wide.
symlink: bool
Symlink instead of copy (for development).
overwrite: bool
Overwrite previously-installed files for this extension
**kwargs: keyword argum... | def install(user=False, symlink=False, overwrite=False, **kwargs):
"""Install the bqplot nbextension.
Parameters
----------
user: bool
Install for current user instead of system-wide.
symlink: bool
Symlink instead of copy (for development).
overwrite: bool
Overwrite... |
Determine whether `v` can be hashed. | def hashable(data, v):
"""Determine whether `v` can be hashed."""
try:
data[v]
except (TypeError, KeyError, IndexError):
return False
return True |
Shows the current context figure in the output area.
Parameters
----------
key : hashable, optional
Any variable that can be used as a key for a dictionary.
display_toolbar: bool (default: True)
If True, a toolbar for different mouse interaction is displayed with
the figure.
... | def show(key=None, display_toolbar=True):
"""Shows the current context figure in the output area.
Parameters
----------
key : hashable, optional
Any variable that can be used as a key for a dictionary.
display_toolbar: bool (default: True)
If True, a toolbar for different mouse int... |
Creates figures and switches between figures.
If a ``bqplot.Figure`` object is provided via the fig optional argument,
this figure becomes the current context figure.
Otherwise:
- If no key is provided, a new empty context figure is created.
- If a key is provided for which a context already exis... | def figure(key=None, fig=None, **kwargs):
"""Creates figures and switches between figures.
If a ``bqplot.Figure`` object is provided via the fig optional argument,
this figure becomes the current context figure.
Otherwise:
- If no key is provided, a new empty context figure is created.
- If a... |
Closes and unregister the context figure corresponding to the key.
Parameters
----------
key: hashable
Any variable that can be used as a key for a dictionary | def close(key):
"""Closes and unregister the context figure corresponding to the key.
Parameters
----------
key: hashable
Any variable that can be used as a key for a dictionary
"""
figure_registry = _context['figure_registry']
if key not in figure_registry:
return
if ... |
Helper function to handle data keyword argument | def _process_data(*kwarg_names):
"""Helper function to handle data keyword argument
"""
def _data_decorator(func):
@functools.wraps(func)
def _mark_with_data(*args, **kwargs):
data = kwargs.pop('data', None)
if data is None:
return func(*args, **kwargs... |
Creates and switches between context scales.
If no key is provided, a new blank context is created.
If a key is provided for which a context already exists, the existing
context is set as the current context.
If a key is provided and no corresponding context exists, a new context is
created for t... | def scales(key=None, scales={}):
"""Creates and switches between context scales.
If no key is provided, a new blank context is created.
If a key is provided for which a context already exists, the existing
context is set as the current context.
If a key is provided and no corresponding context ex... |
Set the domain bounds of the scale associated with the provided key.
Parameters
----------
name: hashable
Any variable that can be used as a key for a dictionary
Raises
------
KeyError
When no context figure is associated with the provided key. | def set_lim(min, max, name):
"""Set the domain bounds of the scale associated with the provided key.
Parameters
----------
name: hashable
Any variable that can be used as a key for a dictionary
Raises
------
KeyError
When no context figure is associated with the provided ke... |
Draws axes corresponding to the scales of a given mark.
It also returns a dictionary of drawn axes. If the mark is not provided,
the last drawn mark is used.
Parameters
----------
mark: Mark or None (default: None)
The mark to inspect to create axes. If None, the last mark drawn is
... | def axes(mark=None, options={}, **kwargs):
"""Draws axes corresponding to the scales of a given mark.
It also returns a dictionary of drawn axes. If the mark is not provided,
the last drawn mark is used.
Parameters
----------
mark: Mark or None (default: None)
The mark to inspect to cr... |
Helper function to set labels for an axis | def _set_label(label, mark, dim, **kwargs):
"""Helper function to set labels for an axis
"""
if mark is None:
mark = _context['last_mark']
if mark is None:
return {}
fig = kwargs.get('figure', current_figure())
scales = mark.scales
scale_metadata = mark.scales_metadata.get(di... |
Sets the value of the grid_lines for the axis to the passed value.
The default value is `solid`.
Parameters
----------
fig: Figure or None(default: None)
The figure for which the axes should be edited. If the value is None,
the current figure is used.
value: {'none', 'solid', 'dashe... | def grids(fig=None, value='solid'):
"""Sets the value of the grid_lines for the axis to the passed value.
The default value is `solid`.
Parameters
----------
fig: Figure or None(default: None)
The figure for which the axes should be edited. If the value is None,
the current figure i... |
Sets the title for the current figure.
Parameters
----------
label : str
The new title for the current figure.
style: dict
The CSS style to be applied to the figure title | def title(label, style=None):
"""Sets the title for the current figure.
Parameters
----------
label : str
The new title for the current figure.
style: dict
The CSS style to be applied to the figure title
"""
fig = current_figure()
fig.title = label
if style is not No... |
Draws a horizontal line at the given level.
Parameters
----------
level: float
The level at which to draw the horizontal line.
preserve_domain: boolean (default: False)
If true, the line does not affect the domain of the 'y' scale. | def hline(level, **kwargs):
"""Draws a horizontal line at the given level.
Parameters
----------
level: float
The level at which to draw the horizontal line.
preserve_domain: boolean (default: False)
If true, the line does not affect the domain of the 'y' scale.
"""
kwargs.s... |
Returns a kwarg dict suitable for a ColorScale | def _process_cmap(cmap):
'''
Returns a kwarg dict suitable for a ColorScale
'''
option = {}
if isinstance(cmap, str):
option['scheme'] = cmap
elif isinstance(cmap, list):
option['colors'] = cmap
else:
raise ValueError('''`cmap` must be a string (name of a color scheme... |
Set the color map of the current 'color' scale. | def set_cmap(cmap):
'''
Set the color map of the current 'color' scale.
'''
scale = _context['scales']['color']
for k, v in _process_cmap(cmap).items():
setattr(scale, k, v)
return scale |
Draw the mark of specified mark type.
Parameters
----------
mark_type: type
The type of mark to be drawn
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'x' is
required for that mark, options['x'] contains optional keyword
arguments f... | def _draw_mark(mark_type, options={}, axes_options={}, **kwargs):
"""Draw the mark of specified mark type.
Parameters
----------
mark_type: type
The type of mark to be drawn
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'x' is
required ... |
Infers the x for a line if no x is provided. | def _infer_x_for_line(y):
"""
Infers the x for a line if no x is provided.
"""
array_shape = shape(y)
if len(array_shape) == 0:
return []
if len(array_shape) == 1:
return arange(array_shape[0])
if len(array_shape) > 1:
return arange(array_shape[1]) |
Draw an image in the current context figure.
Parameters
----------
image: image data
Image data, depending on the passed format, can be one of:
- an instance of an ipywidgets Image
- a file name
- a raw byte string
format: {'widget', 'filename', ...}
T... | def imshow(image, format, **kwargs):
"""Draw an image in the current context figure.
Parameters
----------
image: image data
Image data, depending on the passed format, can be one of:
- an instance of an ipywidgets Image
- a file name
- a raw byte string
f... |
Draw OHLC bars or candle bars in the current context figure.
Signature: `ohlc(x, y, **kwargs)` or `ohlc(y, **kwargs)`, depending of the
length of the list of positional arguments. In the case where the `x` array
is not provided
Parameters
----------
x: numpy.ndarray or list, 1d (optional)
... | def ohlc(*args, **kwargs):
"""Draw OHLC bars or candle bars in the current context figure.
Signature: `ohlc(x, y, **kwargs)` or `ohlc(y, **kwargs)`, depending of the
length of the list of positional arguments. In the case where the `x` array
is not provided
Parameters
----------
x: numpy.n... |
Draw a scatter in the current context figure.
Parameters
----------
x: numpy.ndarray, 1d
The x-coordinates of the data points.
y: numpy.ndarray, 1d
The y-coordinates of the data points.
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'x'... | def scatter(x, y, **kwargs):
"""Draw a scatter in the current context figure.
Parameters
----------
x: numpy.ndarray, 1d
The x-coordinates of the data points.
y: numpy.ndarray, 1d
The y-coordinates of the data points.
options: dict (default: {})
Options for the scales t... |
Draw a histogram in the current context figure.
Parameters
----------
sample: numpy.ndarray, 1d
The sample for which the histogram must be generated.
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'counts'
is required for that mark, options[... | def hist(sample, options={}, **kwargs):
"""Draw a histogram in the current context figure.
Parameters
----------
sample: numpy.ndarray, 1d
The sample for which the histogram must be generated.
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'coun... |
Draw a histogram in the current context figure.
Parameters
----------
sample: numpy.ndarray, 1d
The sample for which the histogram must be generated.
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'x'
is required for that mark, options['x'] c... | def bin(sample, options={}, **kwargs):
"""Draw a histogram in the current context figure.
Parameters
----------
sample: numpy.ndarray, 1d
The sample for which the histogram must be generated.
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'x'
... |
Draws a bar chart in the current context figure.
Parameters
----------
x: numpy.ndarray, 1d
The x-coordinates of the data points.
y: numpy.ndarray, 1d
The y-coordinates of the data pints.
options: dict (default: {})
Options for the scales to be created. If a scale labeled '... | def bar(x, y, **kwargs):
"""Draws a bar chart in the current context figure.
Parameters
----------
x: numpy.ndarray, 1d
The x-coordinates of the data points.
y: numpy.ndarray, 1d
The y-coordinates of the data pints.
options: dict (default: {})
Options for the scales to ... |
Draws a boxplot in the current context figure.
Parameters
----------
x: numpy.ndarray, 1d
The x-coordinates of the data points.
y: numpy.ndarray, 2d
The data from which the boxes are to be created. Each row of the data
corresponds to one box drawn in the plot.
options: dict... | def boxplot(x, y, **kwargs):
"""Draws a boxplot in the current context figure.
Parameters
----------
x: numpy.ndarray, 1d
The x-coordinates of the data points.
y: numpy.ndarray, 2d
The data from which the boxes are to be created. Each row of the data
corresponds to one box ... |
Draw a map in the current context figure.
Parameters
----------
map_data: string or bqplot.map (default: WorldMap)
Name of the map or json file required for the map data.
options: dict (default: {})
Options for the scales to be created. If a scale labeled 'x' is
required for tha... | def geo(map_data, **kwargs):
"""Draw a map in the current context figure.
Parameters
----------
map_data: string or bqplot.map (default: WorldMap)
Name of the map or json file required for the map data.
options: dict (default: {})
Options for the scales to be created. If a scale lab... |
Add the interaction for the specified type.
If a figure is passed using the key-word argument `figure` it is used. Else
the context figure is used.
If a list of marks are passed using the key-word argument `marks` it
is used. Else the latest mark that is passed is used as the only mark
associated w... | def _add_interaction(int_type, **kwargs):
"""Add the interaction for the specified type.
If a figure is passed using the key-word argument `figure` it is used. Else
the context figure is used.
If a list of marks are passed using the key-word argument `marks` it
is used. Else the latest mark that is... |
Create a selector of the specified type.
Also attaches the function `func` as an `on_trait_change` listener
for the trait `trait` of the selector.
This is an internal function which should not be called by the user.
Parameters
----------
int_type: type
The type of selector to be adde... | def _create_selector(int_type, func, trait, **kwargs):
"""Create a selector of the specified type.
Also attaches the function `func` as an `on_trait_change` listener
for the trait `trait` of the selector.
This is an internal function which should not be called by the user.
Parameters
--------... |
Clears the current context figure of all marks axes and grid lines. | def clear():
"""Clears the current context figure of all marks axes and grid lines."""
fig = _context['figure']
if fig is not None:
fig.marks = []
fig.axes = []
setattr(fig, 'axis_registry', {})
_context['scales'] = {}
key = _context['current_key']
if key is n... |
Sets the current global context dictionary. All the attributes to be set
should be set. Otherwise, it will result in unpredictable behavior. | def set_context(context):
"""Sets the current global context dictionary. All the attributes to be set
should be set. Otherwise, it will result in unpredictable behavior."""
global _context
_context = {k: v for k, v in context.items()} |
Returns the dimension for the name of the trait for the specified mark.
If `mark_type` is `None`, then the `trait_name` is returned
as is.
Returns `None` if the `trait_name` is not valid for `mark_type`. | def _get_attribute_dimension(trait_name, mark_type=None):
"""Returns the dimension for the name of the trait for the specified mark.
If `mark_type` is `None`, then the `trait_name` is returned
as is.
Returns `None` if the `trait_name` is not valid for `mark_type`.
"""
if(mark_type is None):
... |
Applies the specified properties to the widget.
`properties` is a dictionary with key value pairs corresponding
to the properties to be applied to the widget. | def _apply_properties(widget, properties={}):
"""Applies the specified properties to the widget.
`properties` is a dictionary with key value pairs corresponding
to the properties to be applied to the widget.
"""
with widget.hold_sync():
for key, value in properties.items():
seta... |
Return line style, color and marker type from specified marker string.
For example, if ``marker_str`` is 'g-o' then the method returns
``('solid', 'green', 'circle')``. | def _get_line_styles(marker_str):
"""Return line style, color and marker type from specified marker string.
For example, if ``marker_str`` is 'g-o' then the method returns
``('solid', 'green', 'circle')``.
"""
def _extract_marker_value(marker_str, code_dict):
"""Extracts the marker value fr... |
Create a `self` iterator and collect it into a `TotalList`
(a normal list with a `.total` attribute). | async def collect(self):
"""
Create a `self` iterator and collect it into a `TotalList`
(a normal list with a `.total` attribute).
"""
result = helpers.TotalList()
async for message in self:
result.append(message)
result.total = self.total
ret... |
#full: Advises to read "Accessing the full API" in the docs. | async def handler(event):
"""#full: Advises to read "Accessing the full API" in the docs."""
await asyncio.wait([
event.delete(),
event.respond(READ_FULL, reply_to=event.reply_to_msg_id)
]) |
#search query: Searches for "query" in the method reference. | async def handler(event):
"""#search query: Searches for "query" in the method reference."""
query = urllib.parse.quote(event.pattern_match.group(1))
await asyncio.wait([
event.delete(),
event.respond(SEARCH.format(query), reply_to=event.reply_to_msg_id)
]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.