partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | delete_pool_ledger_config | Deletes created pool ledger configuration.
:param config_name: Name of the pool ledger configuration to delete.
:return: Error code | wrappers/python/indy/pool.py | 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... | 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... | [
"Deletes",
"created",
"pool",
"ledger",
"configuration",
"."
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/pool.py#L158-L181 | [
"async",
"def",
"delete_pool_ledger_config",
"(",
"config_name",
":",
"str",
")",
"->",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"debug",
"(",
"\"delete_pool_ledger_config: >>> config_name: %r\"",
",",
"config_nam... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | set_protocol_version | 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
... | wrappers/python/indy/pool.py | 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... | 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... | [
"Set",
"PROTOCOL_VERSION",
"to",
"specific",
"version",
"."
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/pool.py#L184-L211 | [
"async",
"def",
"set_protocol_version",
"(",
"protocol_version",
":",
"int",
")",
"->",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"debug",
"(",
"\"set_protocol_version: >>> protocol_version: %r\"",
",",
"protocol_v... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.open_search | 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... | vcx/wrappers/python3/vcx/api/wallet.py | 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'
... | 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'
... | [
"Opens",
"a",
"search",
"handle",
"within",
"the",
"storage",
"wallet",
"."
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L28-L58 | [
"async",
"def",
"open_search",
"(",
"type_",
":",
"str",
",",
"query",
":",
"dict",
",",
"options",
":",
"dict",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"open_search",
",",... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.search_next_records | 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(... | vcx/wrappers/python3/vcx/api/wallet.py | 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(... | 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(... | [
"Searches",
"for",
"next",
"n",
"record",
"from",
"an",
"open",
"search",
"handle"
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L61-L88 | [
"async",
"def",
"search_next_records",
"(",
"handle",
":",
"int",
",",
"count",
":",
"int",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"search_next_records",
",",
"\"cb\"",
")",
... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.get_record | 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',
... | vcx/wrappers/python3/vcx/api/wallet.py | 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',
... | 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',
... | [
"Retrieves",
"a",
"record",
"from",
"the",
"wallet",
"storage",
".",
":",
"param",
"type_",
":",
"String",
":",
"param",
"id",
":",
"String",
":",
"param",
"options",
":",
"String",
"Example",
":",
"import",
"json",
"await",
"Wallet",
".",
"add_record",
... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L91-L130 | [
"async",
"def",
"get_record",
"(",
"type_",
":",
"str",
",",
"id",
":",
"str",
",",
"options",
":",
"str",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"get_record",
",",
"\"c... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.delete_record | 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... | vcx/wrappers/python3/vcx/api/wallet.py | 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',
... | 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',
... | [
"Delete",
"a",
"record",
"from",
"the",
"storage",
"wallet",
"."
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L133-L167 | [
"async",
"def",
"delete_record",
"(",
"type_",
":",
"str",
",",
"id",
":",
"str",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"delete_record",
",",
"\"cb\"",
")",
":",
"logger"... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.get_token_info | 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: | vcx/wrappers/python3/vcx/api/wallet.py | 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:
... | 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:
... | [
"Retrieves",
"from",
"the",
"ledger",
"token",
"info",
"associated",
"with",
"the",
"wallet",
".",
":",
"param",
"handle",
":",
"Example",
":",
"payment_handle",
"=",
"0",
"//",
"payment",
"handle",
"is",
"always",
"0",
"for",
"now",
".",
"info",
"=",
"a... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L357-L379 | [
"async",
"def",
"get_token_info",
"(",
"handle",
":",
"int",
")",
"->",
"str",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"get_token_info",
",",
"\"cb\"",
")",
":",
"logger",
".",
... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.create_payment_address | Creates a payment address inside the wallet.
:param seed: String
Example:
address = await Wallet.create_payment_address('00000000000000000000000001234567')
:return: String | vcx/wrappers/python3/vcx/api/wallet.py | 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.... | 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.... | [
"Creates",
"a",
"payment",
"address",
"inside",
"the",
"wallet",
".",
":",
"param",
"seed",
":",
"String",
"Example",
":",
"address",
"=",
"await",
"Wallet",
".",
"create_payment_address",
"(",
"00000000000000000000000001234567",
")",
":",
"return",
":",
"String... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L382-L406 | [
"async",
"def",
"create_payment_address",
"(",
"seed",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"create_payment_address",
",",
"\"cb\"",
")... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.validate_payment_address | 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 | vcx/wrappers/python3/vcx/api/wallet.py | 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... | 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... | [
"Determines",
"whether",
"a",
"payment",
"address",
"is",
"valid",
"or",
"not",
":",
"param",
"address",
":",
"String",
"Example",
":",
"address",
"=",
"await",
"Wallet",
".",
"create_payment_address",
"(",
"00000000000000000000000001234567",
")",
"b",
"=",
"awa... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L409-L431 | [
"async",
"def",
"validate_payment_address",
"(",
"address",
":",
"str",
")",
"->",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"validate_payment_address",
",",
"\"cb\"",
")",
":",... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.send_tokens | 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')
... | vcx/wrappers/python3/vcx/api/wallet.py | 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 ... | 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 ... | [
"Sends",
"tokens",
"to",
"an",
"address",
"payment_handle",
"is",
"always",
"0",
":",
"param",
"payment_handle",
":",
"Integer",
":",
"param",
"tokens",
":",
"Integer",
":",
"param",
"address",
":",
"String",
"Example",
":",
"payment_handle",
"=",
"0",
"amou... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L434-L465 | [
"async",
"def",
"send_tokens",
"(",
"payment_handle",
":",
"int",
",",
"tokens",
":",
"int",
",",
"address",
":",
"str",
")",
"->",
"str",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
"."... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.export | 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. | vcx/wrappers/python3/vcx/api/wallet.py | 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... | 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... | [
"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",... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L468-L491 | [
"async",
"def",
"export",
"(",
"path",
",",
"backup_key",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"export",
",",
"\"cb\"",
")",
":",
"logger",
".",
"debug",
"(",
"\"vcx_wal... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | Wallet.import_wallet | 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":""}'
:... | vcx/wrappers/python3/vcx/api/wallet.py | 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":"",... | 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":"",... | [
"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"... | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/wallet.py#L494-L517 | [
"async",
"def",
"import_wallet",
"(",
"config",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"if",
"not",
"hasattr",
"(",
"Wallet",
".",
"import_wallet",
",",
"\"cb\"",
")",
":",
"logger",
".",
"debug",
"(",
"\"vcx_wallet_imp... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | update_wallet_record_value | 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 | wrappers/python/indy/non_secrets.py | 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... | 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... | [
"Update",
"a",
"non",
"-",
"secret",
"wallet",
"record",
"value"
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/non_secrets.py#L61-L99 | [
"async",
"def",
"update_wallet_record_value",
"(",
"wallet_handle",
":",
"int",
",",
"type_",
":",
"str",
",",
"id_",
":",
"str",
",",
"value",
":",
"str",
")",
"->",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger"... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | get_wallet_record | 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... | wrappers/python/indy/non_secrets.py | 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... | 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... | [
"Get",
"an",
"wallet",
"record",
"by",
"id"
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/non_secrets.py#L273-L323 | [
"async",
"def",
"get_wallet_record",
"(",
"wallet_handle",
":",
"int",
",",
"type_",
":",
"str",
",",
"id",
":",
"str",
",",
"options_json",
":",
"str",
")",
"->",
"str",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | open_wallet_search | 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... | wrappers/python/indy/non_secrets.py | 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... | 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... | [
"Search",
"for",
"wallet",
"records"
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/non_secrets.py#L326-L380 | [
"async",
"def",
"open_wallet_search",
"(",
"wallet_handle",
":",
"int",
",",
"type_",
":",
"str",
",",
"query_json",
":",
"str",
",",
"options_json",
":",
"str",
")",
"->",
"int",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"lo... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | fetch_wallet_search_next_records | 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... | wrappers/python/indy/non_secrets.py | 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... | 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... | [
"Fetch",
"next",
"records",
"for",
"wallet",
"search",
"."
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/non_secrets.py#L383-L426 | [
"async",
"def",
"fetch_wallet_search_next_records",
"(",
"wallet_handle",
":",
"int",
",",
"wallet_search_handle",
":",
"int",
",",
"count",
":",
"int",
")",
"->",
"str",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | close_wallet_search | Close wallet search (make search handle invalid)
:param wallet_search_handle: wallet wallet handle (created by open_wallet_search)
:return: None | wrappers/python/indy/non_secrets.py | 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:... | 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:... | [
"Close",
"wallet",
"search",
"(",
"make",
"search",
"handle",
"invalid",
")"
] | hyperledger/indy-sdk | python | https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/non_secrets.py#L429-L452 | [
"async",
"def",
"close_wallet_search",
"(",
"wallet_search_handle",
":",
"int",
")",
"->",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"debug",
"(",
"\"close_wallet_search: >>> wallet_search_handle: %r\"",
",",
"wall... | 55240dc170308d7883c48f03f308130a6d077be6 |
train | register_mark | 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. | bqplot/marks.py | 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)... | 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)... | [
"Returns",
"a",
"decorator",
"registering",
"a",
"mark",
"class",
"in",
"the",
"mark",
"type",
"registry",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/marks.py#L60-L71 | [
"def",
"register_mark",
"(",
"key",
"=",
"None",
")",
":",
"def",
"wrap",
"(",
"mark",
")",
":",
"name",
"=",
"key",
"if",
"key",
"is",
"not",
"None",
"else",
"mark",
".",
"__module__",
"+",
"mark",
".",
"__name__",
"Mark",
".",
"mark_types",
"[",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | Mark._get_dimension_scales | 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. | bqplot/marks.py | 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 ... | 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 ... | [
"Return",
"the",
"list",
"of",
"scales",
"corresponding",
"to",
"a",
"given",
"dimension",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/marks.py#L192-L213 | [
"def",
"_get_dimension_scales",
"(",
"self",
",",
"dimension",
",",
"preserve_domain",
"=",
"False",
")",
":",
"if",
"preserve_domain",
":",
"return",
"[",
"self",
".",
"scales",
"[",
"k",
"]",
"for",
"k",
"in",
"self",
".",
"scales",
"if",
"(",
"k",
"... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | Mark._validate_scales | Validates the `scales` based on the mark's scaled attributes metadata.
First checks for missing scale and then for 'rtype' compatibility. | bqplot/marks.py | 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 ... | 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 ... | [
"Validates",
"the",
"scales",
"based",
"on",
"the",
"mark",
"s",
"scaled",
"attributes",
"metadata",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/marks.py#L216-L238 | [
"def",
"_validate_scales",
"(",
"self",
",",
"proposal",
")",
":",
"# Validate scales' 'rtype' versus data attribute 'rtype' decoration",
"# At this stage it is already validated that all values in self.scales",
"# are instances of Scale.",
"scales",
"=",
"proposal",
".",
"value",
"f... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | register_axis | 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. | bqplot/axes.py | 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... | 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... | [
"Returns",
"a",
"decorator",
"registering",
"an",
"axis",
"class",
"in",
"the",
"axis",
"type",
"registry",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/axes.py#L39-L50 | [
"def",
"register_axis",
"(",
"key",
"=",
"None",
")",
":",
"def",
"wrap",
"(",
"axis",
")",
":",
"name",
"=",
"key",
"if",
"key",
"is",
"not",
"None",
"else",
"axis",
".",
"__module__",
"+",
"axis",
".",
"__name__",
"BaseAxis",
".",
"axis_types",
"["... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | register_interaction | 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. | bqplot/interacts.py | 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... | 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... | [
"Decorator",
"registering",
"an",
"interaction",
"class",
"in",
"the",
"registry",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/interacts.py#L51-L63 | [
"def",
"register_interaction",
"(",
"key",
"=",
"None",
")",
":",
"def",
"wrap",
"(",
"interaction",
")",
":",
"name",
"=",
"key",
"if",
"key",
"is",
"not",
"None",
"else",
"interaction",
".",
"__module__",
"+",
"interaction",
".",
"__name__",
"interaction... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | panzoom | 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. | bqplot/interacts.py | 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... | 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... | [
"Helper",
"function",
"for",
"panning",
"and",
"zooming",
"over",
"a",
"set",
"of",
"marks",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/interacts.py#L164-L173 | [
"def",
"panzoom",
"(",
"marks",
")",
":",
"return",
"PanZoom",
"(",
"scales",
"=",
"{",
"'x'",
":",
"sum",
"(",
"[",
"mark",
".",
"_get_dimension_scales",
"(",
"'x'",
",",
"preserve_domain",
"=",
"True",
")",
"for",
"mark",
"in",
"marks",
"]",
",",
"... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | register_scale | 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. | bqplot/scales.py | 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... | 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... | [
"Returns",
"a",
"decorator",
"to",
"register",
"a",
"scale",
"type",
"in",
"the",
"scale",
"type",
"registry",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/scales.py#L49-L61 | [
"def",
"register_scale",
"(",
"key",
"=",
"None",
")",
":",
"def",
"wrap",
"(",
"scale",
")",
":",
"label",
"=",
"key",
"if",
"key",
"is",
"not",
"None",
"else",
"scale",
".",
"__module__",
"+",
"scale",
".",
"__name__",
"Scale",
".",
"scale_types",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | install | 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... | bqplot/install.py | 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... | 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... | [
"Install",
"the",
"bqplot",
"nbextension",
".",
"Parameters",
"----------"
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/install.py#L7-L25 | [
"def",
"install",
"(",
"user",
"=",
"False",
",",
"symlink",
"=",
"False",
",",
"overwrite",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"directory",
"=",
"join",
"(",
"dirname",
"(",
"abspath",
"(",
"__file__",
")",
")",
",",
"'nbextension'",
"... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | hashable | Determine whether `v` can be hashed. | bqplot/pyplot.py | def hashable(data, v):
"""Determine whether `v` can be hashed."""
try:
data[v]
except (TypeError, KeyError, IndexError):
return False
return True | def hashable(data, v):
"""Determine whether `v` can be hashed."""
try:
data[v]
except (TypeError, KeyError, IndexError):
return False
return True | [
"Determine",
"whether",
"v",
"can",
"be",
"hashed",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L110-L116 | [
"def",
"hashable",
"(",
"data",
",",
"v",
")",
":",
"try",
":",
"data",
"[",
"v",
"]",
"except",
"(",
"TypeError",
",",
"KeyError",
",",
"IndexError",
")",
":",
"return",
"False",
"return",
"True"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | show | 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.
... | bqplot/pyplot.py | 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... | 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... | [
"Shows",
"the",
"current",
"context",
"figure",
"in",
"the",
"output",
"area",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L119-L158 | [
"def",
"show",
"(",
"key",
"=",
"None",
",",
"display_toolbar",
"=",
"True",
")",
":",
"if",
"key",
"is",
"None",
":",
"figure",
"=",
"current_figure",
"(",
")",
"else",
":",
"figure",
"=",
"_context",
"[",
"'figure_registry'",
"]",
"[",
"key",
"]",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | 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... | bqplot/pyplot.py | 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... | 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... | [
"Creates",
"figures",
"and",
"switches",
"between",
"figures",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L161-L212 | [
"def",
"figure",
"(",
"key",
"=",
"None",
",",
"fig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"scales_arg",
"=",
"kwargs",
".",
"pop",
"(",
"'scales'",
",",
"{",
"}",
")",
"_context",
"[",
"'current_key'",
"]",
"=",
"key",
"if",
"fig",
"i... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | close | 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 | bqplot/pyplot.py | 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 ... | 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 ... | [
"Closes",
"and",
"unregister",
"the",
"context",
"figure",
"corresponding",
"to",
"the",
"key",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L215-L235 | [
"def",
"close",
"(",
"key",
")",
":",
"figure_registry",
"=",
"_context",
"[",
"'figure_registry'",
"]",
"if",
"key",
"not",
"in",
"figure_registry",
":",
"return",
"if",
"_context",
"[",
"'figure'",
"]",
"==",
"figure_registry",
"[",
"key",
"]",
":",
"fig... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _process_data | Helper function to handle data keyword argument | bqplot/pyplot.py | 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... | 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... | [
"Helper",
"function",
"to",
"handle",
"data",
"keyword",
"argument"
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L238-L263 | [
"def",
"_process_data",
"(",
"*",
"kwarg_names",
")",
":",
"def",
"_data_decorator",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"_mark_with_data",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | 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 exists, a new context is
created for t... | bqplot/pyplot.py | 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... | 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... | [
"Creates",
"and",
"switches",
"between",
"context",
"scales",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L266-L317 | [
"def",
"scales",
"(",
"key",
"=",
"None",
",",
"scales",
"=",
"{",
"}",
")",
":",
"old_ctxt",
"=",
"_context",
"[",
"'scales'",
"]",
"if",
"key",
"is",
"None",
":",
"# No key provided",
"_context",
"[",
"'scales'",
"]",
"=",
"{",
"_get_attribute_dimensio... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | set_lim | 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. | bqplot/pyplot.py | 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... | 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... | [
"Set",
"the",
"domain",
"bounds",
"of",
"the",
"scale",
"associated",
"with",
"the",
"provided",
"key",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L332-L349 | [
"def",
"set_lim",
"(",
"min",
",",
"max",
",",
"name",
")",
":",
"scale",
"=",
"_context",
"[",
"'scales'",
"]",
"[",
"_get_attribute_dimension",
"(",
"name",
")",
"]",
"scale",
".",
"min",
"=",
"min",
"scale",
".",
"max",
"=",
"max",
"return",
"scal... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | axes | 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
... | bqplot/pyplot.py | 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... | 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... | [
"Draws",
"axes",
"corresponding",
"to",
"the",
"scales",
"of",
"a",
"given",
"mark",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L352-L404 | [
"def",
"axes",
"(",
"mark",
"=",
"None",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mark",
"is",
"None",
":",
"mark",
"=",
"_context",
"[",
"'last_mark'",
"]",
"if",
"mark",
"is",
"None",
":",
"return",
"{",
"}",
"... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _set_label | Helper function to set labels for an axis | bqplot/pyplot.py | 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... | 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... | [
"Helper",
"function",
"to",
"set",
"labels",
"for",
"an",
"axis"
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L407-L424 | [
"def",
"_set_label",
"(",
"label",
",",
"mark",
",",
"dim",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mark",
"is",
"None",
":",
"mark",
"=",
"_context",
"[",
"'last_mark'",
"]",
"if",
"mark",
"is",
"None",
":",
"return",
"{",
"}",
"fig",
"=",
"kw... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | grids | 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... | bqplot/pyplot.py | 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... | 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",
"value",
"of",
"the",
"grid_lines",
"for",
"the",
"axis",
"to",
"the",
"passed",
"value",
".",
"The",
"default",
"value",
"is",
"solid",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L451-L467 | [
"def",
"grids",
"(",
"fig",
"=",
"None",
",",
"value",
"=",
"'solid'",
")",
":",
"if",
"fig",
"is",
"None",
":",
"fig",
"=",
"current_figure",
"(",
")",
"for",
"a",
"in",
"fig",
".",
"axes",
":",
"a",
".",
"grid_lines",
"=",
"value"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | title | 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 | bqplot/pyplot.py | 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... | 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... | [
"Sets",
"the",
"title",
"for",
"the",
"current",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L470-L483 | [
"def",
"title",
"(",
"label",
",",
"style",
"=",
"None",
")",
":",
"fig",
"=",
"current_figure",
"(",
")",
"fig",
".",
"title",
"=",
"label",
"if",
"style",
"is",
"not",
"None",
":",
"fig",
".",
"title_style",
"=",
"style"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | hline | 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. | bqplot/pyplot.py | 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... | 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... | [
"Draws",
"a",
"horizontal",
"line",
"at",
"the",
"given",
"level",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L492-L518 | [
"def",
"hline",
"(",
"level",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'colors'",
",",
"[",
"'dodgerblue'",
"]",
")",
"kwargs",
".",
"setdefault",
"(",
"'stroke_width'",
",",
"1",
")",
"scales",
"=",
"kwargs",
".",
"pop",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _process_cmap | Returns a kwarg dict suitable for a ColorScale | bqplot/pyplot.py | 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... | 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... | [
"Returns",
"a",
"kwarg",
"dict",
"suitable",
"for",
"a",
"ColorScale"
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L552-L565 | [
"def",
"_process_cmap",
"(",
"cmap",
")",
":",
"option",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"cmap",
",",
"str",
")",
":",
"option",
"[",
"'scheme'",
"]",
"=",
"cmap",
"elif",
"isinstance",
"(",
"cmap",
",",
"list",
")",
":",
"option",
"[",
"'c... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | set_cmap | Set the color map of the current 'color' scale. | bqplot/pyplot.py | 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 | 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 | [
"Set",
"the",
"color",
"map",
"of",
"the",
"current",
"color",
"scale",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L568-L575 | [
"def",
"set_cmap",
"(",
"cmap",
")",
":",
"scale",
"=",
"_context",
"[",
"'scales'",
"]",
"[",
"'color'",
"]",
"for",
"k",
",",
"v",
"in",
"_process_cmap",
"(",
"cmap",
")",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"scale",
",",
"k",
",",
"v"... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _draw_mark | 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... | bqplot/pyplot.py | 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 ... | 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 ... | [
"Draw",
"the",
"mark",
"of",
"specified",
"mark",
"type",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L578-L652 | [
"def",
"_draw_mark",
"(",
"mark_type",
",",
"options",
"=",
"{",
"}",
",",
"axes_options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"fig",
"=",
"kwargs",
".",
"pop",
"(",
"'figure'",
",",
"current_figure",
"(",
")",
")",
"scales",
"=",
"kw... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _infer_x_for_line | Infers the x for a line if no x is provided. | bqplot/pyplot.py | 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]) | 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]) | [
"Infers",
"the",
"x",
"for",
"a",
"line",
"if",
"no",
"x",
"is",
"provided",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L655-L666 | [
"def",
"_infer_x_for_line",
"(",
"y",
")",
":",
"array_shape",
"=",
"shape",
"(",
"y",
")",
"if",
"len",
"(",
"array_shape",
")",
"==",
"0",
":",
"return",
"[",
"]",
"if",
"len",
"(",
"array_shape",
")",
"==",
"1",
":",
"return",
"arange",
"(",
"ar... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | plot | 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... | bqplot/pyplot.py | def plot(*args, **kwargs):
"""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... | def plot(*args, **kwargs):
"""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... | [
"Draw",
"lines",
"in",
"the",
"current",
"context",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L670-L740 | [
"def",
"plot",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"marker_str",
"=",
"None",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"kwargs",
"[",
"'y'",
"]",
"=",
"args",
"[",
"0",
"]",
"if",
"kwargs",
".",
"get",
"(",
"'index_data'"... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | imshow | 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... | bqplot/pyplot.py | 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... | 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",
"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",
... | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L743-L778 | [
"def",
"imshow",
"(",
"image",
",",
"format",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"format",
"==",
"'widget'",
":",
"ipyimage",
"=",
"image",
"elif",
"format",
"==",
"'filename'",
":",
"with",
"open",
"(",
"image",
",",
"'rb'",
")",
"as",
"f",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | ohlc | 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)
... | bqplot/pyplot.py | 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... | 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",
"OHLC",
"bars",
"or",
"candle",
"bars",
"in",
"the",
"current",
"context",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L781-L812 | [
"def",
"ohlc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"2",
":",
"kwargs",
"[",
"'x'",
"]",
"=",
"args",
"[",
"0",
"]",
"kwargs",
"[",
"'y'",
"]",
"=",
"args",
"[",
"1",
"]",
"elif",
"len",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | scatter | 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'... | bqplot/pyplot.py | 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... | 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",
"scatter",
"in",
"the",
"current",
"context",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L816-L837 | [
"def",
"scatter",
"(",
"x",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'x'",
"]",
"=",
"x",
"kwargs",
"[",
"'y'",
"]",
"=",
"y",
"return",
"_draw_mark",
"(",
"Scatter",
",",
"*",
"*",
"kwargs",
")"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | hist | 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[... | bqplot/pyplot.py | 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... | 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",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L841-L867 | [
"def",
"hist",
"(",
"sample",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'sample'",
"]",
"=",
"sample",
"scales",
"=",
"kwargs",
".",
"pop",
"(",
"'scales'",
",",
"{",
"}",
")",
"if",
"'count'",
"not",
"in",... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | bin | 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... | bqplot/pyplot.py | 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'
... | 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'
... | [
"Draw",
"a",
"histogram",
"in",
"the",
"current",
"context",
"figure",
".",
"Parameters",
"----------",
"sample",
":",
"numpy",
".",
"ndarray",
"1d",
"The",
"sample",
"for",
"which",
"the",
"histogram",
"must",
"be",
"generated",
".",
"options",
":",
"dict",... | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L871-L897 | [
"def",
"bin",
"(",
"sample",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'sample'",
"]",
"=",
"sample",
"scales",
"=",
"kwargs",
".",
"pop",
"(",
"'scales'",
",",
"{",
"}",
")",
"for",
"xy",
"in",
"[",
"'x'... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | bar | 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 '... | bqplot/pyplot.py | 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 ... | 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",
"bar",
"chart",
"in",
"the",
"current",
"context",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L901-L922 | [
"def",
"bar",
"(",
"x",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'x'",
"]",
"=",
"x",
"kwargs",
"[",
"'y'",
"]",
"=",
"y",
"return",
"_draw_mark",
"(",
"Bars",
",",
"*",
"*",
"kwargs",
")"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | boxplot | 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... | bqplot/pyplot.py | 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 ... | 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 ... | [
"Draws",
"a",
"boxplot",
"in",
"the",
"current",
"context",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L926-L948 | [
"def",
"boxplot",
"(",
"x",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'x'",
"]",
"=",
"x",
"kwargs",
"[",
"'y'",
"]",
"=",
"y",
"return",
"_draw_mark",
"(",
"Boxplot",
",",
"*",
"*",
"kwargs",
")"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | geo | 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... | bqplot/pyplot.py | 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... | 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... | [
"Draw",
"a",
"map",
"in",
"the",
"current",
"context",
"figure",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1017-L1042 | [
"def",
"geo",
"(",
"map_data",
",",
"*",
"*",
"kwargs",
")",
":",
"scales",
"=",
"kwargs",
".",
"pop",
"(",
"'scales'",
",",
"_context",
"[",
"'scales'",
"]",
")",
"options",
"=",
"kwargs",
".",
"get",
"(",
"'options'",
",",
"{",
"}",
")",
"if",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _add_interaction | 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... | bqplot/pyplot.py | 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... | 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... | [
"Add",
"the",
"interaction",
"for",
"the",
"specified",
"type",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1085-L1113 | [
"def",
"_add_interaction",
"(",
"int_type",
",",
"*",
"*",
"kwargs",
")",
":",
"fig",
"=",
"kwargs",
".",
"pop",
"(",
"'figure'",
",",
"current_figure",
"(",
")",
")",
"marks",
"=",
"kwargs",
".",
"pop",
"(",
"'marks'",
",",
"[",
"_context",
"[",
"'l... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _create_selector | 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... | bqplot/pyplot.py | 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
--------... | 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
--------... | [
"Create",
"a",
"selector",
"of",
"the",
"specified",
"type",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1128-L1151 | [
"def",
"_create_selector",
"(",
"int_type",
",",
"func",
",",
"trait",
",",
"*",
"*",
"kwargs",
")",
":",
"interaction",
"=",
"_add_interaction",
"(",
"int_type",
",",
"*",
"*",
"kwargs",
")",
"if",
"func",
"is",
"not",
"None",
":",
"interaction",
".",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | clear | Clears the current context figure of all marks axes and grid lines. | bqplot/pyplot.py | 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... | 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... | [
"Clears",
"the",
"current",
"context",
"figure",
"of",
"all",
"marks",
"axes",
"and",
"grid",
"lines",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1268-L1278 | [
"def",
"clear",
"(",
")",
":",
"fig",
"=",
"_context",
"[",
"'figure'",
"]",
"if",
"fig",
"is",
"not",
"None",
":",
"fig",
".",
"marks",
"=",
"[",
"]",
"fig",
".",
"axes",
"=",
"[",
"]",
"setattr",
"(",
"fig",
",",
"'axis_registry'",
",",
"{",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | set_context | Sets the current global context dictionary. All the attributes to be set
should be set. Otherwise, it will result in unpredictable behavior. | bqplot/pyplot.py | 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()} | 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()} | [
"Sets",
"the",
"current",
"global",
"context",
"dictionary",
".",
"All",
"the",
"attributes",
"to",
"be",
"set",
"should",
"be",
"set",
".",
"Otherwise",
"it",
"will",
"result",
"in",
"unpredictable",
"behavior",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1296-L1300 | [
"def",
"set_context",
"(",
"context",
")",
":",
"global",
"_context",
"_context",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"context",
".",
"items",
"(",
")",
"}"
] | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _get_attribute_dimension | 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`. | bqplot/pyplot.py | 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):
... | 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):
... | [
"Returns",
"the",
"dimension",
"for",
"the",
"name",
"of",
"the",
"trait",
"for",
"the",
"specified",
"mark",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1326-L1337 | [
"def",
"_get_attribute_dimension",
"(",
"trait_name",
",",
"mark_type",
"=",
"None",
")",
":",
"if",
"(",
"mark_type",
"is",
"None",
")",
":",
"return",
"trait_name",
"scale_metadata",
"=",
"mark_type",
".",
"class_traits",
"(",
")",
"[",
"'scales_metadata'",
... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _apply_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. | bqplot/pyplot.py | 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... | 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... | [
"Applies",
"the",
"specified",
"properties",
"to",
"the",
"widget",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1340-L1348 | [
"def",
"_apply_properties",
"(",
"widget",
",",
"properties",
"=",
"{",
"}",
")",
":",
"with",
"widget",
".",
"hold_sync",
"(",
")",
":",
"for",
"key",
",",
"value",
"in",
"properties",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"widget",
",",
"key... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | _get_line_styles | 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')``. | bqplot/pyplot.py | 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... | 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... | [
"Return",
"line",
"style",
"color",
"and",
"marker",
"type",
"from",
"specified",
"marker",
"string",
"."
] | bloomberg/bqplot | python | https://github.com/bloomberg/bqplot/blob/8eb8b163abe9ee6306f6918067e2f36c1caef2ef/bqplot/pyplot.py#L1351-L1375 | [
"def",
"_get_line_styles",
"(",
"marker_str",
")",
":",
"def",
"_extract_marker_value",
"(",
"marker_str",
",",
"code_dict",
")",
":",
"\"\"\"Extracts the marker value from a given marker string.\n\n Looks up the `code_dict` and returns the corresponding marker for a\n spec... | 8eb8b163abe9ee6306f6918067e2f36c1caef2ef |
train | RequestIter.collect | Create a `self` iterator and collect it into a `TotalList`
(a normal list with a `.total` attribute). | telethon/requestiter.py | 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... | 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... | [
"Create",
"a",
"self",
"iterator",
"and",
"collect",
"it",
"into",
"a",
"TotalList",
"(",
"a",
"normal",
"list",
"with",
"a",
".",
"total",
"attribute",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/requestiter.py#L108-L118 | [
"async",
"def",
"collect",
"(",
"self",
")",
":",
"result",
"=",
"helpers",
".",
"TotalList",
"(",
")",
"async",
"for",
"message",
"in",
"self",
":",
"result",
".",
"append",
"(",
"message",
")",
"result",
".",
"total",
"=",
"self",
".",
"total",
"re... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #full: Advises to read "Accessing the full API" in the docs. | telethon_examples/assistant.py | 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)
]) | 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)
]) | [
"#full",
":",
"Advises",
"to",
"read",
"Accessing",
"the",
"full",
"API",
"in",
"the",
"docs",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L174-L179 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"await",
"asyncio",
".",
"wait",
"(",
"[",
"event",
".",
"delete",
"(",
")",
",",
"event",
".",
"respond",
"(",
"READ_FULL",
",",
"reply_to",
"=",
"event",
".",
"reply_to_msg_id",
")",
"]",
")"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #search query: Searches for "query" in the method reference. | telethon_examples/assistant.py | 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)
]) | 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)
]) | [
"#search",
"query",
":",
"Searches",
"for",
"query",
"in",
"the",
"method",
"reference",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L183-L189 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"query",
"=",
"urllib",
".",
"parse",
".",
"quote",
"(",
"event",
".",
"pattern_match",
".",
"group",
"(",
"1",
")",
")",
"await",
"asyncio",
".",
"wait",
"(",
"[",
"event",
".",
"delete",
"(",
")"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #docs or #ref query: Like #search but shows the query. | telethon_examples/assistant.py | 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=event.reply_to_msg_id)
]) | 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=event.reply_to_msg_id)
]) | [
"#docs",
"or",
"#ref",
"query",
":",
"Like",
"#search",
"but",
"shows",
"the",
"query",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L193-L200 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"q1",
"=",
"event",
".",
"pattern_match",
".",
"group",
"(",
"1",
")",
"q2",
"=",
"urllib",
".",
"parse",
".",
"quote",
"(",
"q1",
")",
"await",
"asyncio",
".",
"wait",
"(",
"[",
"event",
".",
"d... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #rtd: Tells the user to please read the docs. | telethon_examples/assistant.py | 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)
]) | 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)
]) | [
"#rtd",
":",
"Tells",
"the",
"user",
"to",
"please",
"read",
"the",
"docs",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L204-L210 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"rtd",
"=",
"RTFD",
"if",
"event",
".",
"pattern_match",
".",
"group",
"(",
"1",
")",
"else",
"RTD",
"await",
"asyncio",
".",
"wait",
"(",
"[",
"event",
".",
"delete",
"(",
")",
",",
"event",
".",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #client or #msg query: Looks for the given attribute in RTD. | telethon_examples/assistant.py | 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.group(2)),
reply_to=event.reply_to_msg_id
) | 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.group(2)),
reply_to=event.reply_to_msg_id
) | [
"#client",
"or",
"#msg",
"query",
":",
"Looks",
"for",
"the",
"given",
"attribute",
"in",
"RTD",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L244-L252 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"await",
"event",
".",
"delete",
"(",
")",
"await",
"event",
".",
"respond",
"(",
"get_docs_message",
"(",
"kind",
"=",
"event",
".",
"pattern_match",
".",
"group",
"(",
"1",
")",
",",
"query",
"=",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #ot, #offtopic: Tells the user to move to @TelethonOffTopic. | telethon_examples/assistant.py | 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)
]) | 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)
]) | [
"#ot",
"#offtopic",
":",
"Tells",
"the",
"user",
"to",
"move",
"to"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L274-L279 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"await",
"asyncio",
".",
"wait",
"(",
"[",
"event",
".",
"delete",
"(",
")",
",",
"event",
".",
"respond",
"(",
"OFFTOPIC",
"[",
"event",
".",
"chat_id",
"]",
",",
"reply_to",
"=",
"event",
".",
"r... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | handler | #learn or #python: Tells the user to learn some Python first. | telethon_examples/assistant.py | 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)
]) | 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)
]) | [
"#learn",
"or",
"#python",
":",
"Tells",
"the",
"user",
"to",
"learn",
"some",
"Python",
"first",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/assistant.py#L301-L307 | [
"async",
"def",
"handler",
"(",
"event",
")",
":",
"await",
"asyncio",
".",
"wait",
"(",
"[",
"event",
".",
"delete",
"(",
")",
",",
"event",
".",
"respond",
"(",
"LEARN_PYTHON",
",",
"reply_to",
"=",
"event",
".",
"reply_to_msg_id",
",",
"link_preview",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | ButtonMethods.build_reply_markup | 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,
... | telethon/client/buttons.py | def build_reply_markup(self, buttons, inline_only=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 handler... | def build_reply_markup(self, buttons, inline_only=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 handler... | [
"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",
"... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/buttons.py#L7-L74 | [
"def",
"build_reply_markup",
"(",
"self",
",",
"buttons",
",",
"inline_only",
"=",
"False",
")",
":",
"if",
"buttons",
"is",
"None",
":",
"return",
"None",
"try",
":",
"if",
"buttons",
".",
"SUBCLASS_OF_ID",
"==",
"0xe2e10ef2",
":",
"return",
"buttons",
"#... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | TLObject.pretty_format | Pretty formats the given object as a string which is returned.
If indent is None, a single line will be returned. | telethon/tl/tlobject.py | 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.
"""
if indent is None:
if isinstance(obj, TLObject):
obj = obj.to_dict()
if isinstan... | 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.
"""
if indent is None:
if isinstance(obj, TLObject):
obj = obj.to_dict()
if isinstan... | [
"Pretty",
"formats",
"the",
"given",
"object",
"as",
"a",
"string",
"which",
"is",
"returned",
".",
"If",
"indent",
"is",
"None",
"a",
"single",
"line",
"will",
"be",
"returned",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/tlobject.py#L21-L85 | [
"def",
"pretty_format",
"(",
"obj",
",",
"indent",
"=",
"None",
")",
":",
"if",
"indent",
"is",
"None",
":",
"if",
"isinstance",
"(",
"obj",
",",
"TLObject",
")",
":",
"obj",
"=",
"obj",
".",
"to_dict",
"(",
")",
"if",
"isinstance",
"(",
"obj",
","... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | TLObject.serialize_bytes | Write bytes by using Telegram guidelines | telethon/tl/tlobject.py | 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(
'bytes or str expected, not {}'.format(type(d... | 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(
'bytes or str expected, not {}'.format(type(d... | [
"Write",
"bytes",
"by",
"using",
"Telegram",
"guidelines"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/tlobject.py#L88-L120 | [
"def",
"serialize_bytes",
"(",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"bytes",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"data",
"=",
"data",
".",
"encode",
"(",
"'utf-8'",
")",
"else",
":",
"raise",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | TLObject.to_json | 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... | telethon/tl/tlobject.py | def to_json(self, fp=None, default=_json_default, **kwargs):
"""
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 ... | def to_json(self, fp=None, default=_json_default, **kwargs):
"""
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 ... | [
"Represent",
"the",
"current",
"TLObject",
"as",
"JSON",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/tlobject.py#L157-L172 | [
"def",
"to_json",
"(",
"self",
",",
"fp",
"=",
"None",
",",
"default",
"=",
"_json_default",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"self",
".",
"to_dict",
"(",
")",
"if",
"fp",
":",
"return",
"json",
".",
"dump",
"(",
"d",
",",
"fp",
","... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageParseMethods._replace_with_mention | Helper method to replace ``entities[i]`` to mention ``user``,
or do nothing if it can't be found. | telethon/client/messageparse.py | 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:
entities[i] = types.InputMessageEntityMentionName(
entities[i].offset, entities[i].... | 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:
entities[i] = types.InputMessageEntityMentionName(
entities[i].offset, entities[i].... | [
"Helper",
"method",
"to",
"replace",
"entities",
"[",
"i",
"]",
"to",
"mention",
"user",
"or",
"do",
"nothing",
"if",
"it",
"can",
"t",
"be",
"found",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messageparse.py#L48-L60 | [
"async",
"def",
"_replace_with_mention",
"(",
"self",
",",
"entities",
",",
"i",
",",
"user",
")",
":",
"try",
":",
"entities",
"[",
"i",
"]",
"=",
"types",
".",
"InputMessageEntityMentionName",
"(",
"entities",
"[",
"i",
"]",
".",
"offset",
",",
"entiti... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageParseMethods._parse_message_text | Returns a (parsed message, entities) tuple depending on ``parse_mode``. | telethon/client/messageparse.py | 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:
parse_mode = utils.sanitize_parse_mode(parse_mode)
i... | 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:
parse_mode = utils.sanitize_parse_mode(parse_mode)
i... | [
"Returns",
"a",
"(",
"parsed",
"message",
"entities",
")",
"tuple",
"depending",
"on",
"parse_mode",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messageparse.py#L62-L90 | [
"async",
"def",
"_parse_message_text",
"(",
"self",
",",
"message",
",",
"parse_mode",
")",
":",
"if",
"parse_mode",
"is",
"(",
")",
":",
"parse_mode",
"=",
"self",
".",
"_parse_mode",
"else",
":",
"parse_mode",
"=",
"utils",
".",
"sanitize_parse_mode",
"(",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageParseMethods._get_response_message | 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. | telethon/client/messageparse.py | def _get_response_message(self, request, result, input_chat):
"""
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... | def _get_response_message(self, request, result, input_chat):
"""
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... | [
"Extracts",
"the",
"response",
"message",
"known",
"a",
"request",
"and",
"Update",
"result",
".",
"The",
"request",
"may",
"also",
"be",
"the",
"ID",
"of",
"the",
"message",
"to",
"match",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messageparse.py#L92-L153 | [
"def",
"_get_response_message",
"(",
"self",
",",
"request",
",",
"result",
",",
"input_chat",
")",
":",
"if",
"isinstance",
"(",
"result",
",",
"types",
".",
"UpdateShort",
")",
":",
"updates",
"=",
"[",
"result",
".",
"update",
"]",
"entities",
"=",
"{... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | SenderGetter.get_sender | Returns `sender`, but will make an API call to find the
sender unless it's already cached. | telethon/tl/custom/sendergetter.py | 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 :tl:`Channel`.
# It's a flag that will be set if only minimal information is
# availab... | 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 :tl:`Channel`.
# It's a flag that will be set if only minimal information is
# availab... | [
"Returns",
"sender",
"but",
"will",
"make",
"an",
"API",
"call",
"to",
"find",
"the",
"sender",
"unless",
"it",
"s",
"already",
"cached",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/sendergetter.py#L24-L42 | [
"async",
"def",
"get_sender",
"(",
"self",
")",
":",
"# ``sender.min`` is present both in :tl:`User` and :tl:`Channel`.",
"# It's a flag that will be set if only minimal information is",
"# available (such as display name, but username may be missing),",
"# in which case we want to force fetch t... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | SenderGetter.input_sender | 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... | telethon/tl/custom/sendergetter.py | def input_sender(self):
"""
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'... | def input_sender(self):
"""
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'... | [
"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",
... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/sendergetter.py#L45-L60 | [
"def",
"input_sender",
"(",
"self",
")",
":",
"if",
"self",
".",
"_input_sender",
"is",
"None",
"and",
"self",
".",
"_sender_id",
":",
"try",
":",
"self",
".",
"_input_sender",
"=",
"self",
".",
"_client",
".",
"session",
".",
"get_input_entity",
"(",
"s... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | SenderGetter.get_input_sender | Returns `input_sender`, but will make an API call to find the
input sender unless it's already cached. | telethon/tl/custom/sendergetter.py | 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 None and self._sender_id:
await self._refetch_sender()
return self._input_sender | 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 None and self._sender_id:
await self._refetch_sender()
return self._input_sender | [
"Returns",
"input_sender",
"but",
"will",
"make",
"an",
"API",
"call",
"to",
"find",
"the",
"input",
"sender",
"unless",
"it",
"s",
"already",
"cached",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/sendergetter.py#L62-L69 | [
"async",
"def",
"get_input_sender",
"(",
"self",
")",
":",
"if",
"self",
".",
"input_sender",
"is",
"None",
"and",
"self",
".",
"_sender_id",
":",
"await",
"self",
".",
"_refetch_sender",
"(",
")",
"return",
"self",
".",
"_input_sender"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | register | 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 ... | telethon/events/__init__.py | def register(event=None):
"""
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... | def register(event=None):
"""
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... | [
"Decorator",
"method",
"to",
"*",
"register",
"*",
"event",
"handlers",
".",
"This",
"is",
"the",
"client",
"-",
"less",
"add_event_handler",
"<telethon",
".",
"client",
".",
"updates",
".",
"UpdateMethods",
".",
"add_event_handler",
">",
"variant",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/events/__init__.py#L42-L83 | [
"def",
"register",
"(",
"event",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"event",
",",
"type",
")",
":",
"event",
"=",
"event",
"(",
")",
"elif",
"not",
"event",
":",
"event",
"=",
"Raw",
"(",
")",
"def",
"decorator",
"(",
"callback",
")",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | unregister | Inverse operation of `register` (though not a decorator). Client-less
`remove_event_handler
<telethon.client.updates.UpdateMethods.remove_event_handler>`
variant. **Note that this won't remove handlers from the client**,
because it simply can't, so you would generally use this before
adding the hand... | telethon/events/__init__.py | def unregister(callback, event=None):
"""
Inverse operation of `register` (though not a decorator). Client-less
`remove_event_handler
<telethon.client.updates.UpdateMethods.remove_event_handler>`
variant. **Note that this won't remove handlers from the client**,
because it simply can't, so you w... | def unregister(callback, event=None):
"""
Inverse operation of `register` (though not a decorator). Client-less
`remove_event_handler
<telethon.client.updates.UpdateMethods.remove_event_handler>`
variant. **Note that this won't remove handlers from the client**,
because it simply can't, so you w... | [
"Inverse",
"operation",
"of",
"register",
"(",
"though",
"not",
"a",
"decorator",
")",
".",
"Client",
"-",
"less",
"remove_event_handler",
"<telethon",
".",
"client",
".",
"updates",
".",
"UpdateMethods",
".",
"remove_event_handler",
">",
"variant",
".",
"**",
... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/events/__init__.py#L86-L116 | [
"def",
"unregister",
"(",
"callback",
",",
"event",
"=",
"None",
")",
":",
"found",
"=",
"0",
"if",
"event",
"and",
"not",
"isinstance",
"(",
"event",
",",
"type",
")",
":",
"event",
"=",
"type",
"(",
"event",
")",
"handlers",
"=",
"getattr",
"(",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | parse | Parses the given markdown message and returns its stripped representation
plus a list of the MessageEntity's that were found.
:param message: the message with markdown-like syntax to be parsed.
:param delimiters: the delimiters to be used, {delimiter: type}.
:param url_re: the URL bytes regex to be use... | telethon/extensions/markdown.py | def parse(message, delimiters=None, url_re=None):
"""
Parses the given markdown message and returns its stripped representation
plus a list of the MessageEntity's that were found.
:param message: the message with markdown-like syntax to be parsed.
:param delimiters: the delimiters to be used, {deli... | def parse(message, delimiters=None, url_re=None):
"""
Parses the given markdown message and returns its stripped representation
plus a list of the MessageEntity's that were found.
:param message: the message with markdown-like syntax to be parsed.
:param delimiters: the delimiters to be used, {deli... | [
"Parses",
"the",
"given",
"markdown",
"message",
"and",
"returns",
"its",
"stripped",
"representation",
"plus",
"a",
"list",
"of",
"the",
"MessageEntity",
"s",
"that",
"were",
"found",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/markdown.py#L26-L129 | [
"def",
"parse",
"(",
"message",
",",
"delimiters",
"=",
"None",
",",
"url_re",
"=",
"None",
")",
":",
"if",
"not",
"message",
":",
"return",
"message",
",",
"[",
"]",
"if",
"url_re",
"is",
"None",
":",
"url_re",
"=",
"DEFAULT_URL_RE",
"elif",
"isinstan... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | unparse | Performs the reverse operation to .parse(), effectively returning
markdown-like syntax given a normal text and its MessageEntity's.
:param text: the text to be reconverted into markdown.
:param entities: the MessageEntity's applied to the text.
:return: a markdown-like text representing the combination... | telethon/extensions/markdown.py | def unparse(text, entities, delimiters=None, url_fmt=None):
"""
Performs the reverse operation to .parse(), effectively returning
markdown-like syntax given a normal text and its MessageEntity's.
:param text: the text to be reconverted into markdown.
:param entities: the MessageEntity's applied to ... | def unparse(text, entities, delimiters=None, url_fmt=None):
"""
Performs the reverse operation to .parse(), effectively returning
markdown-like syntax given a normal text and its MessageEntity's.
:param text: the text to be reconverted into markdown.
:param entities: the MessageEntity's applied to ... | [
"Performs",
"the",
"reverse",
"operation",
"to",
".",
"parse",
"()",
"effectively",
"returning",
"markdown",
"-",
"like",
"syntax",
"given",
"a",
"normal",
"text",
"and",
"its",
"MessageEntity",
"s",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/extensions/markdown.py#L132-L200 | [
"def",
"unparse",
"(",
"text",
",",
"entities",
",",
"delimiters",
"=",
"None",
",",
"url_fmt",
"=",
"None",
")",
":",
"if",
"not",
"text",
"or",
"not",
"entities",
":",
"return",
"text",
"if",
"not",
"delimiters",
":",
"if",
"delimiters",
"is",
"not",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthKey.calc_new_nonce_hash | Calculates the new nonce hash based on the current attributes.
:param new_nonce: the new nonce to be hashed.
:param number: number to prepend before the hash.
:return: the hash for the given new nonce. | telethon/crypto/authkey.py | def calc_new_nonce_hash(self, new_nonce, number):
"""
Calculates the new nonce hash based on the current attributes.
:param new_nonce: the new nonce to be hashed.
:param number: number to prepend before the hash.
:return: the hash for the given new nonce.
"""
new... | def calc_new_nonce_hash(self, new_nonce, number):
"""
Calculates the new nonce hash based on the current attributes.
:param new_nonce: the new nonce to be hashed.
:param number: number to prepend before the hash.
:return: the hash for the given new nonce.
"""
new... | [
"Calculates",
"the",
"new",
"nonce",
"hash",
"based",
"on",
"the",
"current",
"attributes",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/authkey.py#L45-L57 | [
"def",
"calc_new_nonce_hash",
"(",
"self",
",",
"new_nonce",
",",
"number",
")",
":",
"new_nonce",
"=",
"new_nonce",
".",
"to_bytes",
"(",
"32",
",",
"'little'",
",",
"signed",
"=",
"True",
")",
"data",
"=",
"new_nonce",
"+",
"struct",
".",
"pack",
"(",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | get_byte_array | Return the variable length bytes corresponding to the given int | telethon/crypto/rsa.py | def get_byte_array(integer):
"""Return the variable length bytes corresponding to the given int"""
# Operate in big endian (unlike most of Telegram API) since:
# > "...pq is a representation of a natural number
# (in binary *big endian* format)..."
# > "...current value of dh_prime equals
# ... | def get_byte_array(integer):
"""Return the variable length bytes corresponding to the given int"""
# Operate in big endian (unlike most of Telegram API) since:
# > "...pq is a representation of a natural number
# (in binary *big endian* format)..."
# > "...current value of dh_prime equals
# ... | [
"Return",
"the",
"variable",
"length",
"bytes",
"corresponding",
"to",
"the",
"given",
"int"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/rsa.py#L21-L34 | [
"def",
"get_byte_array",
"(",
"integer",
")",
":",
"# Operate in big endian (unlike most of Telegram API) since:",
"# > \"...pq is a representation of a natural number",
"# (in binary *big endian* format)...\"",
"# > \"...current value of dh_prime equals",
"# (in *big-endian* byte order)..... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | _compute_fingerprint | Given a RSA key, computes its fingerprint like Telegram does.
:param key: the Crypto.RSA key.
:return: its 8-bytes-long fingerprint. | telethon/crypto/rsa.py | def _compute_fingerprint(key):
"""
Given a RSA key, computes its fingerprint like Telegram does.
:param key: the Crypto.RSA key.
:return: its 8-bytes-long fingerprint.
"""
n = TLObject.serialize_bytes(get_byte_array(key.n))
e = TLObject.serialize_bytes(get_byte_array(key.e))
# Telegram ... | def _compute_fingerprint(key):
"""
Given a RSA key, computes its fingerprint like Telegram does.
:param key: the Crypto.RSA key.
:return: its 8-bytes-long fingerprint.
"""
n = TLObject.serialize_bytes(get_byte_array(key.n))
e = TLObject.serialize_bytes(get_byte_array(key.e))
# Telegram ... | [
"Given",
"a",
"RSA",
"key",
"computes",
"its",
"fingerprint",
"like",
"Telegram",
"does",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/rsa.py#L37-L47 | [
"def",
"_compute_fingerprint",
"(",
"key",
")",
":",
"n",
"=",
"TLObject",
".",
"serialize_bytes",
"(",
"get_byte_array",
"(",
"key",
".",
"n",
")",
")",
"e",
"=",
"TLObject",
".",
"serialize_bytes",
"(",
"get_byte_array",
"(",
"key",
".",
"e",
")",
")",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | add_key | Adds a new public key to be used when encrypting new data is needed | telethon/crypto/rsa.py | def add_key(pub):
"""Adds a new public key to be used when encrypting new data is needed"""
global _server_keys
key = rsa.PublicKey.load_pkcs1(pub)
_server_keys[_compute_fingerprint(key)] = key | def add_key(pub):
"""Adds a new public key to be used when encrypting new data is needed"""
global _server_keys
key = rsa.PublicKey.load_pkcs1(pub)
_server_keys[_compute_fingerprint(key)] = key | [
"Adds",
"a",
"new",
"public",
"key",
"to",
"be",
"used",
"when",
"encrypting",
"new",
"data",
"is",
"needed"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/rsa.py#L50-L54 | [
"def",
"add_key",
"(",
"pub",
")",
":",
"global",
"_server_keys",
"key",
"=",
"rsa",
".",
"PublicKey",
".",
"load_pkcs1",
"(",
"pub",
")",
"_server_keys",
"[",
"_compute_fingerprint",
"(",
"key",
")",
"]",
"=",
"key"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | encrypt | Encrypts the given data known the fingerprint to be used
in the way Telegram requires us to do so (sha1(data) + data + padding)
:param fingerprint: the fingerprint of the RSA key.
:param data: the data to be encrypted.
:return:
the cipher text, or None if no key matching this fingerprint is fou... | telethon/crypto/rsa.py | def encrypt(fingerprint, data):
"""
Encrypts the given data known the fingerprint to be used
in the way Telegram requires us to do so (sha1(data) + data + padding)
:param fingerprint: the fingerprint of the RSA key.
:param data: the data to be encrypted.
:return:
the cipher text, or Non... | def encrypt(fingerprint, data):
"""
Encrypts the given data known the fingerprint to be used
in the way Telegram requires us to do so (sha1(data) + data + padding)
:param fingerprint: the fingerprint of the RSA key.
:param data: the data to be encrypted.
:return:
the cipher text, or Non... | [
"Encrypts",
"the",
"given",
"data",
"known",
"the",
"fingerprint",
"to",
"be",
"used",
"in",
"the",
"way",
"Telegram",
"requires",
"us",
"to",
"do",
"so",
"(",
"sha1",
"(",
"data",
")",
"+",
"data",
"+",
"padding",
")"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/rsa.py#L57-L81 | [
"def",
"encrypt",
"(",
"fingerprint",
",",
"data",
")",
":",
"global",
"_server_keys",
"key",
"=",
"_server_keys",
".",
"get",
"(",
"fingerprint",
",",
"None",
")",
"if",
"not",
"key",
":",
"return",
"None",
"# len(sha1.digest) is always 20, so we're left with 255... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.send_message | Sends a message in the context of this conversation. Shorthand
for `telethon.client.messages.MessageMethods.send_message` with
``entity`` already set. | telethon/tl/custom/conversation.py | async def send_message(self, *args, **kwargs):
"""
Sends a message in the context of this conversation. Shorthand
for `telethon.client.messages.MessageMethods.send_message` with
``entity`` already set.
"""
message = await self._client.send_message(
self._input... | async def send_message(self, *args, **kwargs):
"""
Sends a message in the context of this conversation. Shorthand
for `telethon.client.messages.MessageMethods.send_message` with
``entity`` already set.
"""
message = await self._client.send_message(
self._input... | [
"Sends",
"a",
"message",
"in",
"the",
"context",
"of",
"this",
"conversation",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"messages",
".",
"MessageMethods",
".",
"send_message",
"with",
"entity",
"already",
"set",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L71-L82 | [
"async",
"def",
"send_message",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"message",
"=",
"await",
"self",
".",
"_client",
".",
"send_message",
"(",
"self",
".",
"_input_chat",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.mark_read | Marks as read the latest received message if ``message is None``.
Otherwise, marks as read until the given message (or message ID).
This is equivalent to calling `client.send_read_acknowledge
<telethon.client.messages.MessageMethods.send_read_acknowledge>`. | telethon/tl/custom/conversation.py | def mark_read(self, message=None):
"""
Marks as read the latest received message if ``message is None``.
Otherwise, marks as read until the given message (or message ID).
This is equivalent to calling `client.send_read_acknowledge
<telethon.client.messages.MessageMethods.send_re... | def mark_read(self, message=None):
"""
Marks as read the latest received message if ``message is None``.
Otherwise, marks as read until the given message (or message ID).
This is equivalent to calling `client.send_read_acknowledge
<telethon.client.messages.MessageMethods.send_re... | [
"Marks",
"as",
"read",
"the",
"latest",
"received",
"message",
"if",
"message",
"is",
"None",
".",
"Otherwise",
"marks",
"as",
"read",
"until",
"the",
"given",
"message",
"(",
"or",
"message",
"ID",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L97-L114 | [
"def",
"mark_read",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
"is",
"None",
":",
"if",
"self",
".",
"_incoming",
":",
"message",
"=",
"self",
".",
"_incoming",
"[",
"-",
"1",
"]",
".",
"id",
"else",
":",
"message",
"=",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.get_response | Returns a coroutine that will resolve once a response arrives.
Args:
message (`Message <telethon.tl.custom.message.Message>` | `int`, optional):
The message (or the message ID) for which a response
is expected. By default this is the last sent message.
t... | telethon/tl/custom/conversation.py | async def get_response(self, message=None, *, timeout=None):
"""
Returns a coroutine that will resolve once a response arrives.
Args:
message (`Message <telethon.tl.custom.message.Message>` | `int`, optional):
The message (or the message ID) for which a response
... | async def get_response(self, message=None, *, timeout=None):
"""
Returns a coroutine that will resolve once a response arrives.
Args:
message (`Message <telethon.tl.custom.message.Message>` | `int`, optional):
The message (or the message ID) for which a response
... | [
"Returns",
"a",
"coroutine",
"that",
"will",
"resolve",
"once",
"a",
"response",
"arrives",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L116-L132 | [
"async",
"def",
"get_response",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"await",
"self",
".",
"_get_message",
"(",
"message",
",",
"self",
".",
"_response_indices",
",",
"self",
".",
"_pending_... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.get_reply | Returns a coroutine that will resolve once a reply
(that is, a message being a reply) arrives. The
arguments are the same as those for `get_response`. | telethon/tl/custom/conversation.py | async def get_reply(self, message=None, *, timeout=None):
"""
Returns a coroutine that will resolve once a reply
(that is, a message being a reply) arrives. The
arguments are the same as those for `get_response`.
"""
return await self._get_message(
message, se... | async def get_reply(self, message=None, *, timeout=None):
"""
Returns a coroutine that will resolve once a reply
(that is, a message being a reply) arrives. The
arguments are the same as those for `get_response`.
"""
return await self._get_message(
message, se... | [
"Returns",
"a",
"coroutine",
"that",
"will",
"resolve",
"once",
"a",
"reply",
"(",
"that",
"is",
"a",
"message",
"being",
"a",
"reply",
")",
"arrives",
".",
"The",
"arguments",
"are",
"the",
"same",
"as",
"those",
"for",
"get_response",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L134-L143 | [
"async",
"def",
"get_reply",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"await",
"self",
".",
"_get_message",
"(",
"message",
",",
"self",
".",
"_reply_indices",
",",
"self",
".",
"_pending_replie... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation._get_message | Gets the next desired message under the desired condition.
Args:
target_message (`object`):
The target message for which we want to find another
response that applies based on `condition`.
indices (`dict`):
This dictionary remembers the l... | telethon/tl/custom/conversation.py | def _get_message(
self, target_message, indices, pending, timeout, condition):
"""
Gets the next desired message under the desired condition.
Args:
target_message (`object`):
The target message for which we want to find another
response th... | def _get_message(
self, target_message, indices, pending, timeout, condition):
"""
Gets the next desired message under the desired condition.
Args:
target_message (`object`):
The target message for which we want to find another
response th... | [
"Gets",
"the",
"next",
"desired",
"message",
"under",
"the",
"desired",
"condition",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L145-L200 | [
"def",
"_get_message",
"(",
"self",
",",
"target_message",
",",
"indices",
",",
"pending",
",",
"timeout",
",",
"condition",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"target_id",
"=",
"self",
".",
"_get_message_id",
"(",
"target_message",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.get_edit | Awaits for an edit after the last message to arrive.
The arguments are the same as those for `get_response`. | telethon/tl/custom/conversation.py | async def get_edit(self, message=None, *, timeout=None):
"""
Awaits for an edit after the last message to arrive.
The arguments are the same as those for `get_response`.
"""
start_time = time.time()
target_id = self._get_message_id(message)
target_date = self._ed... | async def get_edit(self, message=None, *, timeout=None):
"""
Awaits for an edit after the last message to arrive.
The arguments are the same as those for `get_response`.
"""
start_time = time.time()
target_id = self._get_message_id(message)
target_date = self._ed... | [
"Awaits",
"for",
"an",
"edit",
"after",
"the",
"last",
"message",
"to",
"arrive",
".",
"The",
"arguments",
"are",
"the",
"same",
"as",
"those",
"for",
"get_response",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L202-L228 | [
"async",
"def",
"get_edit",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
",",
"timeout",
"=",
"None",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"target_id",
"=",
"self",
".",
"_get_message_id",
"(",
"message",
")",
"target_date... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.wait_read | Awaits for the sent message to be read. Note that receiving
a response doesn't imply the message was read, and this action
will also trigger even without a response. | telethon/tl/custom/conversation.py | async def wait_read(self, message=None, *, timeout=None):
"""
Awaits for the sent message to be read. Note that receiving
a response doesn't imply the message was read, and this action
will also trigger even without a response.
"""
start_time = time.time()
future ... | async def wait_read(self, message=None, *, timeout=None):
"""
Awaits for the sent message to be read. Note that receiving
a response doesn't imply the message was read, and this action
will also trigger even without a response.
"""
start_time = time.time()
future ... | [
"Awaits",
"for",
"the",
"sent",
"message",
"to",
"be",
"read",
".",
"Note",
"that",
"receiving",
"a",
"response",
"doesn",
"t",
"imply",
"the",
"message",
"was",
"read",
"and",
"this",
"action",
"will",
"also",
"trigger",
"even",
"without",
"a",
"response"... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L230-L247 | [
"async",
"def",
"wait_read",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
",",
"timeout",
"=",
"None",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"future",
"=",
"self",
".",
"_client",
".",
"loop",
".",
"create_future",
"(",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Conversation.wait_event | Waits for a custom event to occur. Timeouts still apply.
Unless you're certain that your code will run fast enough,
generally you should get a "handle" of this special coroutine
before acting. Generally, you should do this:
>>> from telethon import TelegramClient, events
>>>
... | telethon/tl/custom/conversation.py | async def wait_event(self, event, *, timeout=None):
"""
Waits for a custom event to occur. Timeouts still apply.
Unless you're certain that your code will run fast enough,
generally you should get a "handle" of this special coroutine
before acting. Generally, you should do this:... | async def wait_event(self, event, *, timeout=None):
"""
Waits for a custom event to occur. Timeouts still apply.
Unless you're certain that your code will run fast enough,
generally you should get a "handle" of this special coroutine
before acting. Generally, you should do this:... | [
"Waits",
"for",
"a",
"custom",
"event",
"to",
"occur",
".",
"Timeouts",
"still",
"apply",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L249-L295 | [
"async",
"def",
"wait_event",
"(",
"self",
",",
"event",
",",
"*",
",",
"timeout",
"=",
"None",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"if",
"isinstance",
"(",
"event",
",",
"type",
")",
":",
"event",
"=",
"event",
"(",
")",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods.start | Convenience method to interactively connect and sign in if required,
also taking into consideration that 2FA may be enabled in the account.
If the phone doesn't belong to an existing account (and will hence
`sign_up` for a new one), **you are agreeing to Telegram's
Terms of Service. Th... | telethon/client/auth.py | def start(
self,
phone=lambda: input('Please enter your phone (or bot token): '),
password=lambda: getpass.getpass('Please enter your password: '),
*,
bot_token=None, force_sms=False, code_callback=None,
first_name='New User', last_name='', max_att... | def start(
self,
phone=lambda: input('Please enter your phone (or bot token): '),
password=lambda: getpass.getpass('Please enter your password: '),
*,
bot_token=None, force_sms=False, code_callback=None,
first_name='New User', last_name='', max_att... | [
"Convenience",
"method",
"to",
"interactively",
"connect",
"and",
"sign",
"in",
"if",
"required",
"also",
"taking",
"into",
"consideration",
"that",
"2FA",
"may",
"be",
"enabled",
"in",
"the",
"account",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L18-L116 | [
"def",
"start",
"(",
"self",
",",
"phone",
"=",
"lambda",
":",
"input",
"(",
"'Please enter your phone (or bot token): '",
")",
",",
"password",
"=",
"lambda",
":",
"getpass",
".",
"getpass",
"(",
"'Please enter your password: '",
")",
",",
"*",
",",
"bot_token"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods._parse_phone_and_hash | Helper method to both parse and validate phone and its hash. | telethon/client/auth.py | def _parse_phone_and_hash(self, phone, phone_hash):
"""
Helper method to both parse and validate phone and its hash.
"""
phone = utils.parse_phone(phone) or self._phone
if not phone:
raise ValueError(
'Please make sure to call send_code_request first.'... | def _parse_phone_and_hash(self, phone, phone_hash):
"""
Helper method to both parse and validate phone and its hash.
"""
phone = utils.parse_phone(phone) or self._phone
if not phone:
raise ValueError(
'Please make sure to call send_code_request first.'... | [
"Helper",
"method",
"to",
"both",
"parse",
"and",
"validate",
"phone",
"and",
"its",
"hash",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L224-L238 | [
"def",
"_parse_phone_and_hash",
"(",
"self",
",",
"phone",
",",
"phone_hash",
")",
":",
"phone",
"=",
"utils",
".",
"parse_phone",
"(",
"phone",
")",
"or",
"self",
".",
"_phone",
"if",
"not",
"phone",
":",
"raise",
"ValueError",
"(",
"'Please make sure to ca... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods.sign_in | Starts or completes the sign in process with the given phone number
or code that Telegram sent.
Args:
phone (`str` | `int`):
The phone to send the code to if no code was provided,
or to override the phone that was previously used with
these re... | telethon/client/auth.py | async def sign_in(
self, phone=None, code=None, *, password=None,
bot_token=None, phone_code_hash=None):
"""
Starts or completes the sign in process with the given phone number
or code that Telegram sent.
Args:
phone (`str` | `int`):
T... | async def sign_in(
self, phone=None, code=None, *, password=None,
bot_token=None, phone_code_hash=None):
"""
Starts or completes the sign in process with the given phone number
or code that Telegram sent.
Args:
phone (`str` | `int`):
T... | [
"Starts",
"or",
"completes",
"the",
"sign",
"in",
"process",
"with",
"the",
"given",
"phone",
"number",
"or",
"code",
"that",
"Telegram",
"sent",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L240-L305 | [
"async",
"def",
"sign_in",
"(",
"self",
",",
"phone",
"=",
"None",
",",
"code",
"=",
"None",
",",
"*",
",",
"password",
"=",
"None",
",",
"bot_token",
"=",
"None",
",",
"phone_code_hash",
"=",
"None",
")",
":",
"me",
"=",
"await",
"self",
".",
"get... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods.sign_up | Signs up to Telegram if you don't have an account yet.
You must call .send_code_request(phone) first.
**By using this method you're agreeing to Telegram's
Terms of Service. This is required and your account
will be banned otherwise.** See https://telegram.org/tos
and https://cor... | telethon/client/auth.py | async def sign_up(self, code, first_name, last_name='',
*, phone=None, phone_code_hash=None):
"""
Signs up to Telegram if you don't have an account yet.
You must call .send_code_request(phone) first.
**By using this method you're agreeing to Telegram's
Term... | async def sign_up(self, code, first_name, last_name='',
*, phone=None, phone_code_hash=None):
"""
Signs up to Telegram if you don't have an account yet.
You must call .send_code_request(phone) first.
**By using this method you're agreeing to Telegram's
Term... | [
"Signs",
"up",
"to",
"Telegram",
"if",
"you",
"don",
"t",
"have",
"an",
"account",
"yet",
".",
"You",
"must",
"call",
".",
"send_code_request",
"(",
"phone",
")",
"first",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L307-L366 | [
"async",
"def",
"sign_up",
"(",
"self",
",",
"code",
",",
"first_name",
",",
"last_name",
"=",
"''",
",",
"*",
",",
"phone",
"=",
"None",
",",
"phone_code_hash",
"=",
"None",
")",
":",
"me",
"=",
"await",
"self",
".",
"get_me",
"(",
")",
"if",
"me"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods._on_login | Callback called whenever the login or sign up process completes.
Returns the input user parameter. | telethon/client/auth.py | def _on_login(self, user):
"""
Callback called whenever the login or sign up process completes.
Returns the input user parameter.
"""
self._bot = bool(user.bot)
self._self_input_peer = utils.get_input_peer(user, allow_self=False)
self._authorized = True
... | def _on_login(self, user):
"""
Callback called whenever the login or sign up process completes.
Returns the input user parameter.
"""
self._bot = bool(user.bot)
self._self_input_peer = utils.get_input_peer(user, allow_self=False)
self._authorized = True
... | [
"Callback",
"called",
"whenever",
"the",
"login",
"or",
"sign",
"up",
"process",
"completes",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L368-L378 | [
"def",
"_on_login",
"(",
"self",
",",
"user",
")",
":",
"self",
".",
"_bot",
"=",
"bool",
"(",
"user",
".",
"bot",
")",
"self",
".",
"_self_input_peer",
"=",
"utils",
".",
"get_input_peer",
"(",
"user",
",",
"allow_self",
"=",
"False",
")",
"self",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods.send_code_request | Sends a code request to the specified phone number.
Args:
phone (`str` | `int`):
The phone to which the code will be sent.
force_sms (`bool`, optional):
Whether to force sending as SMS.
Returns:
An instance of :tl:`SentCode`. | telethon/client/auth.py | async def send_code_request(self, phone, *, force_sms=False):
"""
Sends a code request to the specified phone number.
Args:
phone (`str` | `int`):
The phone to which the code will be sent.
force_sms (`bool`, optional):
Whether to force se... | async def send_code_request(self, phone, *, force_sms=False):
"""
Sends a code request to the specified phone number.
Args:
phone (`str` | `int`):
The phone to which the code will be sent.
force_sms (`bool`, optional):
Whether to force se... | [
"Sends",
"a",
"code",
"request",
"to",
"the",
"specified",
"phone",
"number",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L380-L417 | [
"async",
"def",
"send_code_request",
"(",
"self",
",",
"phone",
",",
"*",
",",
"force_sms",
"=",
"False",
")",
":",
"phone",
"=",
"utils",
".",
"parse_phone",
"(",
"phone",
")",
"or",
"self",
".",
"_phone",
"phone_hash",
"=",
"self",
".",
"_phone_code_ha... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods.log_out | Logs out Telegram and deletes the current ``*.session`` file.
Returns:
``True`` if the operation was successful. | telethon/client/auth.py | async def log_out(self):
"""
Logs out Telegram and deletes the current ``*.session`` file.
Returns:
``True`` if the operation was successful.
"""
try:
await self(functions.auth.LogOutRequest())
except errors.RPCError:
return False
... | async def log_out(self):
"""
Logs out Telegram and deletes the current ``*.session`` file.
Returns:
``True`` if the operation was successful.
"""
try:
await self(functions.auth.LogOutRequest())
except errors.RPCError:
return False
... | [
"Logs",
"out",
"Telegram",
"and",
"deletes",
"the",
"current",
"*",
".",
"session",
"file",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L419-L438 | [
"async",
"def",
"log_out",
"(",
"self",
")",
":",
"try",
":",
"await",
"self",
"(",
"functions",
".",
"auth",
".",
"LogOutRequest",
"(",
")",
")",
"except",
"errors",
".",
"RPCError",
":",
"return",
"False",
"self",
".",
"_bot",
"=",
"None",
"self",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AuthMethods.edit_2fa | Changes the 2FA settings of the logged in user, according to the
passed parameters. Take note of the parameter explanations.
Note that this method may be *incredibly* slow depending on the
prime numbers that must be used during the process to make sure
that everything is safe.
... | telethon/client/auth.py | async def edit_2fa(
self, current_password=None, new_password=None,
*, hint='', email=None, email_code_callback=None):
"""
Changes the 2FA settings of the logged in user, according to the
passed parameters. Take note of the parameter explanations.
Note that this ... | async def edit_2fa(
self, current_password=None, new_password=None,
*, hint='', email=None, email_code_callback=None):
"""
Changes the 2FA settings of the logged in user, according to the
passed parameters. Take note of the parameter explanations.
Note that this ... | [
"Changes",
"the",
"2FA",
"settings",
"of",
"the",
"logged",
"in",
"user",
"according",
"to",
"the",
"passed",
"parameters",
".",
"Take",
"note",
"of",
"the",
"parameter",
"explanations",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/auth.py#L440-L527 | [
"async",
"def",
"edit_2fa",
"(",
"self",
",",
"current_password",
"=",
"None",
",",
"new_password",
"=",
"None",
",",
"*",
",",
"hint",
"=",
"''",
",",
"email",
"=",
"None",
",",
"email_code_callback",
"=",
"None",
")",
":",
"if",
"new_password",
"is",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.