text
stringlengths
81
112k
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...
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 ...
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_...
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",...
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",...
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...
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 """ ...
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: :pa...
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 hasat...
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...
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...
**** THIS FUNCTION WILL BE DEPRECATED USE pack_message INSTEAD **** Encrypt 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 Sender'...
**** 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...
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 ...
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 ...
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...
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...
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/vcxco...
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...
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)...
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...
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...
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 h...
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_po...
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 configurati...
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 ...
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...
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(...
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', ...
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...
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: """ Retri...
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...
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: ...
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') ...
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, b...
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":""}' :...
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...
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...
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...
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...
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: wall...
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 regis...
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 sca...
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...
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 regi...
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 register...
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 '...
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 dec...
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...
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. ...
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...
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: hashabl...
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 ...
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...
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): ...
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 ...
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 s...
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...
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 ---------- labe...
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 ...
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(''...
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...
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: re...
Draw lines in the current context figure. Signature: `plot(x, y, **kwargs)` or `plot(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 or 2d (optional) The x-co...
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...
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) ...
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'...
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[...
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...
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 '...
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...
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...
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...
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...
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['sc...
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 behavi...
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...
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 p...
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...
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() ...
#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_t...
#docs or #ref query: Like #search but shows the query. async def handler(event): """#docs or #ref query: Like #search but shows the query.""" q1 = event.pattern_match.group(1) q2 = urllib.parse.quote(q1) await asyncio.wait([ event.delete(), event.respond(DOCS.format(q1, q2), reply_to=ev...
#rtd: Tells the user to please read the docs. async def handler(event): """#rtd: Tells the user to please read the docs.""" rtd = RTFD if event.pattern_match.group(1) else RTD await asyncio.wait([ event.delete(), event.respond(rtd, reply_to=event.reply_to_msg_id) ])
#client or #msg query: Looks for the given attribute in RTD. async def handler(event): """#client or #msg query: Looks for the given attribute in RTD.""" await event.delete() await event.respond( get_docs_message(kind=event.pattern_match.group(1), query=event.pattern_match...
#ot, #offtopic: Tells the user to move to @TelethonOffTopic. async def handler(event): """#ot, #offtopic: Tells the user to move to @TelethonOffTopic.""" await asyncio.wait([ event.delete(), event.respond(OFFTOPIC[event.chat_id], reply_to=event.reply_to_msg_id) ])
#learn or #python: Tells the user to learn some Python first. async def handler(event): """#learn or #python: Tells the user to learn some Python first.""" await asyncio.wait([ event.delete(), event.respond( LEARN_PYTHON, reply_to=event.reply_to_msg_id, link_preview=False) ])
Builds a :tl`ReplyInlineMarkup` or :tl:`ReplyKeyboardMarkup` for the given buttons, or does nothing if either no buttons are provided or the provided argument is already a reply markup. This will add any event handlers defined in the buttons and delete old ones not to call them twice, ...
Pretty formats the given object as a string which is returned. If indent is None, a single line will be returned. def pretty_format(obj, indent=None): """ Pretty formats the given object as a string which is returned. If indent is None, a single line will be returned. """ ...
Write bytes by using Telegram guidelines def serialize_bytes(data): """Write bytes by using Telegram guidelines""" if not isinstance(data, bytes): if isinstance(data, str): data = data.encode('utf-8') else: raise TypeError( 'by...
Represent the current `TLObject` as JSON. If ``fp`` is given, the JSON will be dumped to said file pointer, otherwise a JSON string will be returned. Note that bytes and datetimes cannot be represented in JSON, so if those are found, they will be base64 encoded and ISO-formatte...
Helper method to replace ``entities[i]`` to mention ``user``, or do nothing if it can't be found. async def _replace_with_mention(self, entities, i, user): """ Helper method to replace ``entities[i]`` to mention ``user``, or do nothing if it can't be found. """ try: ...
Returns a (parsed message, entities) tuple depending on ``parse_mode``. async def _parse_message_text(self, message, parse_mode): """ Returns a (parsed message, entities) tuple depending on ``parse_mode``. """ if parse_mode is (): parse_mode = self._parse_mode else: ...
Extracts the response message known a request and Update result. The request may also be the ID of the message to match. If ``request is None`` this method returns ``{id: message}``. If ``request.random_id`` is a list, this method returns a list too. def _get_response_message(self, request, r...
Returns `sender`, but will make an API call to find the sender unless it's already cached. async def get_sender(self): """ Returns `sender`, but will make an API call to find the sender unless it's already cached. """ # ``sender.min`` is present both in :tl:`User` and :t...
This :tl:`InputPeer` is the input version of the user/channel who sent the message. Similarly to `input_chat`, this doesn't have things like username or similar, but still useful in some cases. Note that this might not be available if the library can't find the input chat, or if the mes...
Returns `input_sender`, but will make an API call to find the input sender unless it's already cached. async def get_input_sender(self): """ Returns `input_sender`, but will make an API call to find the input sender unless it's already cached. """ if self.input_sender is...
Decorator method to *register* event handlers. This is the client-less `add_event_handler <telethon.client.updates.UpdateMethods.add_event_handler>` variant. Note that this method only registers callbacks as handlers, and does not attach them to any client. This is useful for external modules that ...