id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
46,800 | blockstack/virtualchain | virtualchain/lib/indexer.py | sqlite3_backup | def sqlite3_backup(src_path, dest_path):
"""
Back up a sqlite3 database, while ensuring
that no ongoing queries are being executed.
Return True on success
Return False on error.
"""
# find sqlite3
sqlite3_path = sqlite3_find_tool()
if sqlite3_path is None:
log.error("Failed... | python | def sqlite3_backup(src_path, dest_path):
"""
Back up a sqlite3 database, while ensuring
that no ongoing queries are being executed.
Return True on success
Return False on error.
"""
# find sqlite3
sqlite3_path = sqlite3_find_tool()
if sqlite3_path is None:
log.error("Failed... | [
"def",
"sqlite3_backup",
"(",
"src_path",
",",
"dest_path",
")",
":",
"# find sqlite3",
"sqlite3_path",
"=",
"sqlite3_find_tool",
"(",
")",
"if",
"sqlite3_path",
"is",
"None",
":",
"log",
".",
"error",
"(",
"\"Failed to find sqlite3 tool\"",
")",
"return",
"False"... | Back up a sqlite3 database, while ensuring
that no ongoing queries are being executed.
Return True on success
Return False on error. | [
"Back",
"up",
"a",
"sqlite3",
"database",
"while",
"ensuring",
"that",
"no",
"ongoing",
"queries",
"are",
"being",
"executed",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1681-L1745 |
46,801 | blockstack/virtualchain | virtualchain/lib/indexer.py | state_engine_replay_block | def state_engine_replay_block(existing_state_engine, new_state_engine, block_height, expected_snapshots={}):
"""
Extract the existing chain state transactions from the existing state engine at a particular block height,
parse them using the new state engine, and process them using the new state engine.
... | python | def state_engine_replay_block(existing_state_engine, new_state_engine, block_height, expected_snapshots={}):
"""
Extract the existing chain state transactions from the existing state engine at a particular block height,
parse them using the new state engine, and process them using the new state engine.
... | [
"def",
"state_engine_replay_block",
"(",
"existing_state_engine",
",",
"new_state_engine",
",",
"block_height",
",",
"expected_snapshots",
"=",
"{",
"}",
")",
":",
"assert",
"new_state_engine",
".",
"lastblock",
"+",
"1",
"==",
"block_height",
",",
"'Block height mism... | Extract the existing chain state transactions from the existing state engine at a particular block height,
parse them using the new state engine, and process them using the new state engine.
Returns the consensus hash of the block on success. | [
"Extract",
"the",
"existing",
"chain",
"state",
"transactions",
"from",
"the",
"existing",
"state",
"engine",
"at",
"a",
"particular",
"block",
"height",
"parse",
"them",
"using",
"the",
"new",
"state",
"engine",
"and",
"process",
"them",
"using",
"the",
"new"... | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1748-L1786 |
46,802 | blockstack/virtualchain | virtualchain/lib/indexer.py | state_engine_verify | def state_engine_verify(trusted_consensus_hash, consensus_block_height, consensus_impl, untrusted_working_dir, new_state_engine, start_block=None, expected_snapshots={}):
"""
Verify that a database is consistent with a
known-good consensus hash.
This algorithm works by creating a new database,
pars... | python | def state_engine_verify(trusted_consensus_hash, consensus_block_height, consensus_impl, untrusted_working_dir, new_state_engine, start_block=None, expected_snapshots={}):
"""
Verify that a database is consistent with a
known-good consensus hash.
This algorithm works by creating a new database,
pars... | [
"def",
"state_engine_verify",
"(",
"trusted_consensus_hash",
",",
"consensus_block_height",
",",
"consensus_impl",
",",
"untrusted_working_dir",
",",
"new_state_engine",
",",
"start_block",
"=",
"None",
",",
"expected_snapshots",
"=",
"{",
"}",
")",
":",
"assert",
"ha... | Verify that a database is consistent with a
known-good consensus hash.
This algorithm works by creating a new database,
parsing the untrusted database, and feeding the untrusted
operations into the new database block-by-block. If we
derive the same consensus hash, then we can trust the
databas... | [
"Verify",
"that",
"a",
"database",
"is",
"consistent",
"with",
"a",
"known",
"-",
"good",
"consensus",
"hash",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1845-L1871 |
46,803 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_restore | def db_restore(self, block_number=None):
"""
Restore the database and clear the indexing lockfile.
Restore to a given block if given; otherwise use the most recent valid backup.
Return True on success
Return False if there is no state to restore
Raise exception on error
... | python | def db_restore(self, block_number=None):
"""
Restore the database and clear the indexing lockfile.
Restore to a given block if given; otherwise use the most recent valid backup.
Return True on success
Return False if there is no state to restore
Raise exception on error
... | [
"def",
"db_restore",
"(",
"self",
",",
"block_number",
"=",
"None",
")",
":",
"restored",
"=",
"False",
"if",
"block_number",
"is",
"not",
"None",
":",
"# restore a specific backup",
"try",
":",
"self",
".",
"backup_restore",
"(",
"block_number",
",",
"self",
... | Restore the database and clear the indexing lockfile.
Restore to a given block if given; otherwise use the most recent valid backup.
Return True on success
Return False if there is no state to restore
Raise exception on error | [
"Restore",
"the",
"database",
"and",
"clear",
"the",
"indexing",
"lockfile",
".",
"Restore",
"to",
"a",
"given",
"block",
"if",
"given",
";",
"otherwise",
"use",
"the",
"most",
"recent",
"valid",
"backup",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L252-L291 |
46,804 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_exists | def db_exists(cls, impl, working_dir):
"""
Does the chainstate db exist?
"""
path = config.get_snapshots_filename(impl, working_dir)
return os.path.exists(path) | python | def db_exists(cls, impl, working_dir):
"""
Does the chainstate db exist?
"""
path = config.get_snapshots_filename(impl, working_dir)
return os.path.exists(path) | [
"def",
"db_exists",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"path",
"=",
"config",
".",
"get_snapshots_filename",
"(",
"impl",
",",
"working_dir",
")",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")"
] | Does the chainstate db exist? | [
"Does",
"the",
"chainstate",
"db",
"exist?"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L295-L300 |
46,805 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_create | def db_create(cls, impl, working_dir):
"""
Create a sqlite3 db at the given path.
Create all the tables and indexes we need.
Returns a db connection on success
Raises an exception on error
"""
global VIRTUALCHAIN_DB_SCRIPT
log.debug("Setup chain s... | python | def db_create(cls, impl, working_dir):
"""
Create a sqlite3 db at the given path.
Create all the tables and indexes we need.
Returns a db connection on success
Raises an exception on error
"""
global VIRTUALCHAIN_DB_SCRIPT
log.debug("Setup chain s... | [
"def",
"db_create",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"global",
"VIRTUALCHAIN_DB_SCRIPT",
"log",
".",
"debug",
"(",
"\"Setup chain state in {}\"",
".",
"format",
"(",
"working_dir",
")",
")",
"path",
"=",
"config",
".",
"get_snapshots_filena... | Create a sqlite3 db at the given path.
Create all the tables and indexes we need.
Returns a db connection on success
Raises an exception on error | [
"Create",
"a",
"sqlite3",
"db",
"at",
"the",
"given",
"path",
".",
"Create",
"all",
"the",
"tables",
"and",
"indexes",
"we",
"need",
".",
"Returns",
"a",
"db",
"connection",
"on",
"success",
"Raises",
"an",
"exception",
"on",
"error"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L304-L327 |
46,806 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_connect | def db_connect(cls, path):
"""
connect to our chainstate db
"""
con = sqlite3.connect(path, isolation_level=None, timeout=2**30)
con.row_factory = StateEngine.db_row_factory
return con | python | def db_connect(cls, path):
"""
connect to our chainstate db
"""
con = sqlite3.connect(path, isolation_level=None, timeout=2**30)
con.row_factory = StateEngine.db_row_factory
return con | [
"def",
"db_connect",
"(",
"cls",
",",
"path",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"path",
",",
"isolation_level",
"=",
"None",
",",
"timeout",
"=",
"2",
"**",
"30",
")",
"con",
".",
"row_factory",
"=",
"StateEngine",
".",
"db_row_fact... | connect to our chainstate db | [
"connect",
"to",
"our",
"chainstate",
"db"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L330-L336 |
46,807 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_open | def db_open(cls, impl, working_dir):
"""
Open a connection to our chainstate db
"""
path = config.get_snapshots_filename(impl, working_dir)
return cls.db_connect(path) | python | def db_open(cls, impl, working_dir):
"""
Open a connection to our chainstate db
"""
path = config.get_snapshots_filename(impl, working_dir)
return cls.db_connect(path) | [
"def",
"db_open",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"path",
"=",
"config",
".",
"get_snapshots_filename",
"(",
"impl",
",",
"working_dir",
")",
"return",
"cls",
".",
"db_connect",
"(",
"path",
")"
] | Open a connection to our chainstate db | [
"Open",
"a",
"connection",
"to",
"our",
"chainstate",
"db"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L340-L345 |
46,808 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_query_execute | def db_query_execute(cls, cur, query, values, verbose=True):
"""
Execute a query.
Handle db timeouts.
Abort on failure.
"""
timeout = 1.0
if verbose:
log.debug(cls.db_format_query(query, values))
while True:
try:
r... | python | def db_query_execute(cls, cur, query, values, verbose=True):
"""
Execute a query.
Handle db timeouts.
Abort on failure.
"""
timeout = 1.0
if verbose:
log.debug(cls.db_format_query(query, values))
while True:
try:
r... | [
"def",
"db_query_execute",
"(",
"cls",
",",
"cur",
",",
"query",
",",
"values",
",",
"verbose",
"=",
"True",
")",
":",
"timeout",
"=",
"1.0",
"if",
"verbose",
":",
"log",
".",
"debug",
"(",
"cls",
".",
"db_format_query",
"(",
"query",
",",
"values",
... | Execute a query.
Handle db timeouts.
Abort on failure. | [
"Execute",
"a",
"query",
".",
"Handle",
"db",
"timeouts",
".",
"Abort",
"on",
"failure",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L361-L392 |
46,809 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_chainstate_append | def db_chainstate_append(cls, cur, **fields):
"""
Insert a row into the chain state.
Meant to be executed as part of a transaction.
Return True on success
Raise an exception if the fields are invalid
Abort on db error.
"""
missing = []
extra = []
... | python | def db_chainstate_append(cls, cur, **fields):
"""
Insert a row into the chain state.
Meant to be executed as part of a transaction.
Return True on success
Raise an exception if the fields are invalid
Abort on db error.
"""
missing = []
extra = []
... | [
"def",
"db_chainstate_append",
"(",
"cls",
",",
"cur",
",",
"*",
"*",
"fields",
")",
":",
"missing",
"=",
"[",
"]",
"extra",
"=",
"[",
"]",
"for",
"reqfield",
"in",
"CHAINSTATE_FIELDS",
":",
"if",
"reqfield",
"not",
"in",
"fields",
":",
"missing",
".",... | Insert a row into the chain state.
Meant to be executed as part of a transaction.
Return True on success
Raise an exception if the fields are invalid
Abort on db error. | [
"Insert",
"a",
"row",
"into",
"the",
"chain",
"state",
".",
"Meant",
"to",
"be",
"executed",
"as",
"part",
"of",
"a",
"transaction",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L396-L424 |
46,810 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_snapshot_append | def db_snapshot_append(cls, cur, block_id, consensus_hash, ops_hash, timestamp):
"""
Append hash info for the last block processed, and the time at which it was done.
Meant to be executed as part of a transaction.
Return True on success
Raise an exception on invalid block number... | python | def db_snapshot_append(cls, cur, block_id, consensus_hash, ops_hash, timestamp):
"""
Append hash info for the last block processed, and the time at which it was done.
Meant to be executed as part of a transaction.
Return True on success
Raise an exception on invalid block number... | [
"def",
"db_snapshot_append",
"(",
"cls",
",",
"cur",
",",
"block_id",
",",
"consensus_hash",
",",
"ops_hash",
",",
"timestamp",
")",
":",
"query",
"=",
"'INSERT INTO snapshots (block_id,consensus_hash,ops_hash,timestamp) VALUES (?,?,?,?);'",
"args",
"=",
"(",
"block_id",
... | Append hash info for the last block processed, and the time at which it was done.
Meant to be executed as part of a transaction.
Return True on success
Raise an exception on invalid block number
Abort on db error | [
"Append",
"hash",
"info",
"for",
"the",
"last",
"block",
"processed",
"and",
"the",
"time",
"at",
"which",
"it",
"was",
"done",
".",
"Meant",
"to",
"be",
"executed",
"as",
"part",
"of",
"a",
"transaction",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L428-L442 |
46,811 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_chainstate_get_block | def db_chainstate_get_block(cls, cur, block_height):
"""
Get the list of virtualchain transactions accepted at a given block.
Returns the list of rows, where each row is a dict.
"""
query = 'SELECT * FROM chainstate WHERE block_id = ? ORDER BY vtxindex;'
args = (block_hei... | python | def db_chainstate_get_block(cls, cur, block_height):
"""
Get the list of virtualchain transactions accepted at a given block.
Returns the list of rows, where each row is a dict.
"""
query = 'SELECT * FROM chainstate WHERE block_id = ? ORDER BY vtxindex;'
args = (block_hei... | [
"def",
"db_chainstate_get_block",
"(",
"cls",
",",
"cur",
",",
"block_height",
")",
":",
"query",
"=",
"'SELECT * FROM chainstate WHERE block_id = ? ORDER BY vtxindex;'",
"args",
"=",
"(",
"block_height",
",",
")",
"rows",
"=",
"cls",
".",
"db_query_execute",
"(",
"... | Get the list of virtualchain transactions accepted at a given block.
Returns the list of rows, where each row is a dict. | [
"Get",
"the",
"list",
"of",
"virtualchain",
"transactions",
"accepted",
"at",
"a",
"given",
"block",
".",
"Returns",
"the",
"list",
"of",
"rows",
"where",
"each",
"row",
"is",
"a",
"dict",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L446-L473 |
46,812 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_set_indexing | def db_set_indexing(cls, is_indexing, impl, working_dir):
"""
Set lockfile path as to whether or not the system is indexing.
NOT THREAD SAFE, USE ONLY FOR CRASH DETECTION.
"""
indexing_lockfile_path = config.get_lockfile_filename(impl, working_dir)
if is_indexing:
... | python | def db_set_indexing(cls, is_indexing, impl, working_dir):
"""
Set lockfile path as to whether or not the system is indexing.
NOT THREAD SAFE, USE ONLY FOR CRASH DETECTION.
"""
indexing_lockfile_path = config.get_lockfile_filename(impl, working_dir)
if is_indexing:
... | [
"def",
"db_set_indexing",
"(",
"cls",
",",
"is_indexing",
",",
"impl",
",",
"working_dir",
")",
":",
"indexing_lockfile_path",
"=",
"config",
".",
"get_lockfile_filename",
"(",
"impl",
",",
"working_dir",
")",
"if",
"is_indexing",
":",
"# make sure this exists",
"... | Set lockfile path as to whether or not the system is indexing.
NOT THREAD SAFE, USE ONLY FOR CRASH DETECTION. | [
"Set",
"lockfile",
"path",
"as",
"to",
"whether",
"or",
"not",
"the",
"system",
"is",
"indexing",
".",
"NOT",
"THREAD",
"SAFE",
"USE",
"ONLY",
"FOR",
"CRASH",
"DETECTION",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L477-L493 |
46,813 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.db_is_indexing | def db_is_indexing(cls, impl, working_dir):
"""
Is the system indexing?
Return True if so, False if not.
"""
indexing_lockfile_path = config.get_lockfile_filename(impl, working_dir)
return os.path.exists(indexing_lockfile_path) | python | def db_is_indexing(cls, impl, working_dir):
"""
Is the system indexing?
Return True if so, False if not.
"""
indexing_lockfile_path = config.get_lockfile_filename(impl, working_dir)
return os.path.exists(indexing_lockfile_path) | [
"def",
"db_is_indexing",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"indexing_lockfile_path",
"=",
"config",
".",
"get_lockfile_filename",
"(",
"impl",
",",
"working_dir",
")",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"indexing_lockfile_path"... | Is the system indexing?
Return True if so, False if not. | [
"Is",
"the",
"system",
"indexing?",
"Return",
"True",
"if",
"so",
"False",
"if",
"not",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L497-L503 |
46,814 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_lastblock | def get_lastblock(cls, impl, working_dir):
"""
What was the last block processed?
Return the number on success
Return None on failure to read
"""
if not cls.db_exists(impl, working_dir):
return None
con = cls.db_open(impl, working_dir)
query =... | python | def get_lastblock(cls, impl, working_dir):
"""
What was the last block processed?
Return the number on success
Return None on failure to read
"""
if not cls.db_exists(impl, working_dir):
return None
con = cls.db_open(impl, working_dir)
query =... | [
"def",
"get_lastblock",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"if",
"not",
"cls",
".",
"db_exists",
"(",
"impl",
",",
"working_dir",
")",
":",
"return",
"None",
"con",
"=",
"cls",
".",
"db_open",
"(",
"impl",
",",
"working_dir",
")",
... | What was the last block processed?
Return the number on success
Return None on failure to read | [
"What",
"was",
"the",
"last",
"block",
"processed?",
"Return",
"the",
"number",
"on",
"success",
"Return",
"None",
"on",
"failure",
"to",
"read"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L507-L525 |
46,815 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_state_paths | def get_state_paths(cls, impl, working_dir):
"""
Get the set of state paths that point to the current chain and state info.
Returns a list of paths.
"""
return [config.get_db_filename(impl, working_dir), config.get_snapshots_filename(impl, working_dir)] | python | def get_state_paths(cls, impl, working_dir):
"""
Get the set of state paths that point to the current chain and state info.
Returns a list of paths.
"""
return [config.get_db_filename(impl, working_dir), config.get_snapshots_filename(impl, working_dir)] | [
"def",
"get_state_paths",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"return",
"[",
"config",
".",
"get_db_filename",
"(",
"impl",
",",
"working_dir",
")",
",",
"config",
".",
"get_snapshots_filename",
"(",
"impl",
",",
"working_dir",
")",
"]"
] | Get the set of state paths that point to the current chain and state info.
Returns a list of paths. | [
"Get",
"the",
"set",
"of",
"state",
"paths",
"that",
"point",
"to",
"the",
"current",
"chain",
"and",
"state",
"info",
".",
"Returns",
"a",
"list",
"of",
"paths",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L647-L652 |
46,816 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_backup_blocks | def get_backup_blocks(cls, impl, working_dir):
"""
Get the set of block IDs that were backed up
"""
ret = []
backup_dir = config.get_backups_directory(impl, working_dir)
if not os.path.exists(backup_dir):
return []
for name in os.listdir( backup_dir )... | python | def get_backup_blocks(cls, impl, working_dir):
"""
Get the set of block IDs that were backed up
"""
ret = []
backup_dir = config.get_backups_directory(impl, working_dir)
if not os.path.exists(backup_dir):
return []
for name in os.listdir( backup_dir )... | [
"def",
"get_backup_blocks",
"(",
"cls",
",",
"impl",
",",
"working_dir",
")",
":",
"ret",
"=",
"[",
"]",
"backup_dir",
"=",
"config",
".",
"get_backups_directory",
"(",
"impl",
",",
"working_dir",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
... | Get the set of block IDs that were backed up | [
"Get",
"the",
"set",
"of",
"block",
"IDs",
"that",
"were",
"backed",
"up"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L656-L687 |
46,817 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_backup_paths | def get_backup_paths(cls, block_id, impl, working_dir):
"""
Get the set of backup paths, given the virtualchain implementation module and block number
"""
backup_dir = config.get_backups_directory(impl, working_dir)
backup_paths = []
for p in cls.get_state_paths(impl, wor... | python | def get_backup_paths(cls, block_id, impl, working_dir):
"""
Get the set of backup paths, given the virtualchain implementation module and block number
"""
backup_dir = config.get_backups_directory(impl, working_dir)
backup_paths = []
for p in cls.get_state_paths(impl, wor... | [
"def",
"get_backup_paths",
"(",
"cls",
",",
"block_id",
",",
"impl",
",",
"working_dir",
")",
":",
"backup_dir",
"=",
"config",
".",
"get_backups_directory",
"(",
"impl",
",",
"working_dir",
")",
"backup_paths",
"=",
"[",
"]",
"for",
"p",
"in",
"cls",
".",... | Get the set of backup paths, given the virtualchain implementation module and block number | [
"Get",
"the",
"set",
"of",
"backup",
"paths",
"given",
"the",
"virtualchain",
"implementation",
"module",
"and",
"block",
"number"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L691-L702 |
46,818 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.backup_restore | def backup_restore(cls, block_id, impl, working_dir):
"""
Restore from a backup, given the virutalchain implementation module and block number.
NOT THREAD SAFE. DO NOT CALL WHILE INDEXING.
Return True on success
Raise exception on error, i.e. if a backup file is missing... | python | def backup_restore(cls, block_id, impl, working_dir):
"""
Restore from a backup, given the virutalchain implementation module and block number.
NOT THREAD SAFE. DO NOT CALL WHILE INDEXING.
Return True on success
Raise exception on error, i.e. if a backup file is missing... | [
"def",
"backup_restore",
"(",
"cls",
",",
"block_id",
",",
"impl",
",",
"working_dir",
")",
":",
"backup_dir",
"=",
"config",
".",
"get_backups_directory",
"(",
"impl",
",",
"working_dir",
")",
"backup_paths",
"=",
"cls",
".",
"get_backup_paths",
"(",
"block_i... | Restore from a backup, given the virutalchain implementation module and block number.
NOT THREAD SAFE. DO NOT CALL WHILE INDEXING.
Return True on success
Raise exception on error, i.e. if a backup file is missing | [
"Restore",
"from",
"a",
"backup",
"given",
"the",
"virutalchain",
"implementation",
"module",
"and",
"block",
"number",
".",
"NOT",
"THREAD",
"SAFE",
".",
"DO",
"NOT",
"CALL",
"WHILE",
"INDEXING",
".",
"Return",
"True",
"on",
"success",
"Raise",
"exception",
... | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L706-L725 |
46,819 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.make_backups | def make_backups(self, block_id):
"""
If we're doing backups on a regular basis, then
carry them out here if it is time to do so.
This method does nothing otherwise.
Return None on success
Abort on failure
"""
assert self.setup, "Not set up yet. Call .d... | python | def make_backups(self, block_id):
"""
If we're doing backups on a regular basis, then
carry them out here if it is time to do so.
This method does nothing otherwise.
Return None on success
Abort on failure
"""
assert self.setup, "Not set up yet. Call .d... | [
"def",
"make_backups",
"(",
"self",
",",
"block_id",
")",
":",
"assert",
"self",
".",
"setup",
",",
"\"Not set up yet. Call .db_setup() first!\"",
"# make a backup?",
"if",
"self",
".",
"backup_frequency",
"is",
"not",
"None",
":",
"if",
"(",
"block_id",
"%",
"... | If we're doing backups on a regular basis, then
carry them out here if it is time to do so.
This method does nothing otherwise.
Return None on success
Abort on failure | [
"If",
"we",
"re",
"doing",
"backups",
"on",
"a",
"regular",
"basis",
"then",
"carry",
"them",
"out",
"here",
"if",
"it",
"is",
"time",
"to",
"do",
"so",
".",
"This",
"method",
"does",
"nothing",
"otherwise",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L728-L773 |
46,820 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.save | def save(self, block_id, consensus_hash, ops_hash, accepted_ops, virtualchain_ops_hints, backup=False):
"""
Write out all state to the working directory.
Calls the implementation's 'db_save' method to store any state for this block.
Calls the implementation's 'db_continue' method at the ... | python | def save(self, block_id, consensus_hash, ops_hash, accepted_ops, virtualchain_ops_hints, backup=False):
"""
Write out all state to the working directory.
Calls the implementation's 'db_save' method to store any state for this block.
Calls the implementation's 'db_continue' method at the ... | [
"def",
"save",
"(",
"self",
",",
"block_id",
",",
"consensus_hash",
",",
"ops_hash",
",",
"accepted_ops",
",",
"virtualchain_ops_hints",
",",
"backup",
"=",
"False",
")",
":",
"assert",
"self",
".",
"setup",
",",
"\"Not set up yet. Call .db_setup() first!\"",
"as... | Write out all state to the working directory.
Calls the implementation's 'db_save' method to store any state for this block.
Calls the implementation's 'db_continue' method at the very end, to signal
to the implementation that all virtualchain state has been saved. This method
can retur... | [
"Write",
"out",
"all",
"state",
"to",
"the",
"working",
"directory",
".",
"Calls",
"the",
"implementation",
"s",
"db_save",
"method",
"to",
"store",
"any",
"state",
"for",
"this",
"block",
".",
"Calls",
"the",
"implementation",
"s",
"db_continue",
"method",
... | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L824-L921 |
46,821 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.make_snapshot_from_ops_hash | def make_snapshot_from_ops_hash( cls, record_root_hash, prev_consensus_hashes ):
"""
Generate the consensus hash from the hash over the current ops, and
all previous required consensus hashes.
"""
# mix into previous consensus hashes...
all_hashes = prev_consensus_hashes... | python | def make_snapshot_from_ops_hash( cls, record_root_hash, prev_consensus_hashes ):
"""
Generate the consensus hash from the hash over the current ops, and
all previous required consensus hashes.
"""
# mix into previous consensus hashes...
all_hashes = prev_consensus_hashes... | [
"def",
"make_snapshot_from_ops_hash",
"(",
"cls",
",",
"record_root_hash",
",",
"prev_consensus_hashes",
")",
":",
"# mix into previous consensus hashes...",
"all_hashes",
"=",
"prev_consensus_hashes",
"[",
":",
"]",
"+",
"[",
"record_root_hash",
"]",
"all_hashes",
".",
... | Generate the consensus hash from the hash over the current ops, and
all previous required consensus hashes. | [
"Generate",
"the",
"consensus",
"hash",
"from",
"the",
"hash",
"over",
"the",
"current",
"ops",
"and",
"all",
"previous",
"required",
"consensus",
"hashes",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L954-L966 |
46,822 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.set_virtualchain_field | def set_virtualchain_field(cls, opdata, virtualchain_field, value):
"""
Set a virtualchain field value.
Used by implementations that generate extra consensus data at the end of a block
"""
assert virtualchain_field in RESERVED_KEYS, 'Invalid field name {} (choose from {})'.format... | python | def set_virtualchain_field(cls, opdata, virtualchain_field, value):
"""
Set a virtualchain field value.
Used by implementations that generate extra consensus data at the end of a block
"""
assert virtualchain_field in RESERVED_KEYS, 'Invalid field name {} (choose from {})'.format... | [
"def",
"set_virtualchain_field",
"(",
"cls",
",",
"opdata",
",",
"virtualchain_field",
",",
"value",
")",
":",
"assert",
"virtualchain_field",
"in",
"RESERVED_KEYS",
",",
"'Invalid field name {} (choose from {})'",
".",
"format",
"(",
"virtualchain_field",
",",
"','",
... | Set a virtualchain field value.
Used by implementations that generate extra consensus data at the end of a block | [
"Set",
"a",
"virtualchain",
"field",
"value",
".",
"Used",
"by",
"implementations",
"that",
"generate",
"extra",
"consensus",
"data",
"at",
"the",
"end",
"of",
"a",
"block"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1092-L1098 |
46,823 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.parse_transaction | def parse_transaction(self, block_id, tx):
"""
Given a block ID and an data-bearing transaction,
try to parse it into a virtual chain operation.
Use the implementation's 'db_parse' method to do so.
Data transactions that do not have the magic bytes or a valid opcode
... | python | def parse_transaction(self, block_id, tx):
"""
Given a block ID and an data-bearing transaction,
try to parse it into a virtual chain operation.
Use the implementation's 'db_parse' method to do so.
Data transactions that do not have the magic bytes or a valid opcode
... | [
"def",
"parse_transaction",
"(",
"self",
",",
"block_id",
",",
"tx",
")",
":",
"data_hex",
"=",
"tx",
"[",
"'nulldata'",
"]",
"inputs",
"=",
"tx",
"[",
"'ins'",
"]",
"outputs",
"=",
"tx",
"[",
"'outs'",
"]",
"senders",
"=",
"tx",
"[",
"'senders'",
"]... | Given a block ID and an data-bearing transaction,
try to parse it into a virtual chain operation.
Use the implementation's 'db_parse' method to do so.
Data transactions that do not have the magic bytes or a valid opcode
will be skipped automatically. The db_parse method does ... | [
"Given",
"a",
"block",
"ID",
"and",
"an",
"data",
"-",
"bearing",
"transaction",
"try",
"to",
"parse",
"it",
"into",
"a",
"virtual",
"chain",
"operation",
".",
"Use",
"the",
"implementation",
"s",
"db_parse",
"method",
"to",
"do",
"so",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1101-L1183 |
46,824 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.parse_block | def parse_block(self, block_id, txs):
"""
Given the sequence of transactions in a block, turn them into a
sequence of virtual chain operations.
Return the list of successfully-parsed virtualchain transactions
"""
ops = []
for i in range(0,len(txs)):
t... | python | def parse_block(self, block_id, txs):
"""
Given the sequence of transactions in a block, turn them into a
sequence of virtual chain operations.
Return the list of successfully-parsed virtualchain transactions
"""
ops = []
for i in range(0,len(txs)):
t... | [
"def",
"parse_block",
"(",
"self",
",",
"block_id",
",",
"txs",
")",
":",
"ops",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"txs",
")",
")",
":",
"tx",
"=",
"txs",
"[",
"i",
"]",
"op",
"=",
"self",
".",
"parse_transa... | Given the sequence of transactions in a block, turn them into a
sequence of virtual chain operations.
Return the list of successfully-parsed virtualchain transactions | [
"Given",
"the",
"sequence",
"of",
"transactions",
"in",
"a",
"block",
"turn",
"them",
"into",
"a",
"sequence",
"of",
"virtual",
"chain",
"operations",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1186-L1200 |
46,825 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.remove_reserved_keys | def remove_reserved_keys(self, op):
"""
Remove reserved keywords from an op dict,
which can then safely be passed into the db.
Returns a new op dict, and the reserved fields
"""
sanitized = {}
reserved = {}
for k in op.keys():
... | python | def remove_reserved_keys(self, op):
"""
Remove reserved keywords from an op dict,
which can then safely be passed into the db.
Returns a new op dict, and the reserved fields
"""
sanitized = {}
reserved = {}
for k in op.keys():
... | [
"def",
"remove_reserved_keys",
"(",
"self",
",",
"op",
")",
":",
"sanitized",
"=",
"{",
"}",
"reserved",
"=",
"{",
"}",
"for",
"k",
"in",
"op",
".",
"keys",
"(",
")",
":",
"if",
"str",
"(",
"k",
")",
"not",
"in",
"RESERVED_KEYS",
":",
"sanitized",
... | Remove reserved keywords from an op dict,
which can then safely be passed into the db.
Returns a new op dict, and the reserved fields | [
"Remove",
"reserved",
"keywords",
"from",
"an",
"op",
"dict",
"which",
"can",
"then",
"safely",
"be",
"passed",
"into",
"the",
"db",
".",
"Returns",
"a",
"new",
"op",
"dict",
"and",
"the",
"reserved",
"fields"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1203-L1219 |
46,826 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.log_accept | def log_accept(self, block_id, vtxindex, opcode, op_data):
"""
Log an accepted operation
"""
log.debug("ACCEPT op {} at ({}, {}) ({})".format(opcode, block_id, vtxindex, json.dumps(op_data, sort_keys=True))) | python | def log_accept(self, block_id, vtxindex, opcode, op_data):
"""
Log an accepted operation
"""
log.debug("ACCEPT op {} at ({}, {}) ({})".format(opcode, block_id, vtxindex, json.dumps(op_data, sort_keys=True))) | [
"def",
"log_accept",
"(",
"self",
",",
"block_id",
",",
"vtxindex",
",",
"opcode",
",",
"op_data",
")",
":",
"log",
".",
"debug",
"(",
"\"ACCEPT op {} at ({}, {}) ({})\"",
".",
"format",
"(",
"opcode",
",",
"block_id",
",",
"vtxindex",
",",
"json",
".",
"d... | Log an accepted operation | [
"Log",
"an",
"accepted",
"operation"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1230-L1234 |
46,827 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.process_ops | def process_ops(self, block_id, ops):
"""
Given a transaction-ordered sequence of parsed operations,
check their validity and give them to the state engine to
affect state changes.
It calls 'db_check' to validate each operation, and 'db_commit'
to add it to the state en... | python | def process_ops(self, block_id, ops):
"""
Given a transaction-ordered sequence of parsed operations,
check their validity and give them to the state engine to
affect state changes.
It calls 'db_check' to validate each operation, and 'db_commit'
to add it to the state en... | [
"def",
"process_ops",
"(",
"self",
",",
"block_id",
",",
"ops",
")",
":",
"new_ops",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"op",
"in",
"self",
".",
"opcodes",
":",
"new_ops",
"[",
"op",
"]",
"=",
"[",
"]",
"# transaction-ordered listing of accepted ... | Given a transaction-ordered sequence of parsed operations,
check their validity and give them to the state engine to
affect state changes.
It calls 'db_check' to validate each operation, and 'db_commit'
to add it to the state engine. Gets back a list of state
transitions (ops)... | [
"Given",
"a",
"transaction",
"-",
"ordered",
"sequence",
"of",
"parsed",
"operations",
"check",
"their",
"validity",
"and",
"give",
"them",
"to",
"the",
"state",
"engine",
"to",
"affect",
"state",
"changes",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1244-L1340 |
46,828 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_block_statistics | def get_block_statistics(cls, block_id):
"""
Get block statistics.
Only works in test mode.
"""
if not os.environ.get("BLOCKSTACK_TEST"):
raise Exception("This method is only available in the test framework")
global STATISTICS
return STATISTICS.get(bl... | python | def get_block_statistics(cls, block_id):
"""
Get block statistics.
Only works in test mode.
"""
if not os.environ.get("BLOCKSTACK_TEST"):
raise Exception("This method is only available in the test framework")
global STATISTICS
return STATISTICS.get(bl... | [
"def",
"get_block_statistics",
"(",
"cls",
",",
"block_id",
")",
":",
"if",
"not",
"os",
".",
"environ",
".",
"get",
"(",
"\"BLOCKSTACK_TEST\"",
")",
":",
"raise",
"Exception",
"(",
"\"This method is only available in the test framework\"",
")",
"global",
"STATISTIC... | Get block statistics.
Only works in test mode. | [
"Get",
"block",
"statistics",
".",
"Only",
"works",
"in",
"test",
"mode",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1403-L1412 |
46,829 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_consensus_at | def get_consensus_at(self, block_id):
"""
Get the consensus hash at a given block.
Return the consensus hash if we have one for this block.
Return None if we don't
"""
query = 'SELECT consensus_hash FROM snapshots WHERE block_id = ?;'
args = (block_id,)
c... | python | def get_consensus_at(self, block_id):
"""
Get the consensus hash at a given block.
Return the consensus hash if we have one for this block.
Return None if we don't
"""
query = 'SELECT consensus_hash FROM snapshots WHERE block_id = ?;'
args = (block_id,)
c... | [
"def",
"get_consensus_at",
"(",
"self",
",",
"block_id",
")",
":",
"query",
"=",
"'SELECT consensus_hash FROM snapshots WHERE block_id = ?;'",
"args",
"=",
"(",
"block_id",
",",
")",
"con",
"=",
"self",
".",
"db_open",
"(",
"self",
".",
"impl",
",",
"self",
".... | Get the consensus hash at a given block.
Return the consensus hash if we have one for this block.
Return None if we don't | [
"Get",
"the",
"consensus",
"hash",
"at",
"a",
"given",
"block",
".",
"Return",
"the",
"consensus",
"hash",
"if",
"we",
"have",
"one",
"for",
"this",
"block",
".",
"Return",
"None",
"if",
"we",
"don",
"t"
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1491-L1508 |
46,830 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_block_from_consensus | def get_block_from_consensus( self, consensus_hash ):
"""
Get the block number with the given consensus hash.
Return None if there is no such block.
"""
query = 'SELECT block_id FROM snapshots WHERE consensus_hash = ?;'
args = (consensus_hash,)
con = self.db_open... | python | def get_block_from_consensus( self, consensus_hash ):
"""
Get the block number with the given consensus hash.
Return None if there is no such block.
"""
query = 'SELECT block_id FROM snapshots WHERE consensus_hash = ?;'
args = (consensus_hash,)
con = self.db_open... | [
"def",
"get_block_from_consensus",
"(",
"self",
",",
"consensus_hash",
")",
":",
"query",
"=",
"'SELECT block_id FROM snapshots WHERE consensus_hash = ?;'",
"args",
"=",
"(",
"consensus_hash",
",",
")",
"con",
"=",
"self",
".",
"db_open",
"(",
"self",
".",
"impl",
... | Get the block number with the given consensus hash.
Return None if there is no such block. | [
"Get",
"the",
"block",
"number",
"with",
"the",
"given",
"consensus",
"hash",
".",
"Return",
"None",
"if",
"there",
"is",
"no",
"such",
"block",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1536-L1552 |
46,831 | blockstack/virtualchain | virtualchain/lib/indexer.py | StateEngine.get_valid_consensus_hashes | def get_valid_consensus_hashes( self, block_id ):
"""
Get the list of valid consensus hashes for a given block.
"""
first_block_to_check = block_id - self.impl.get_valid_transaction_window()
query = 'SELECT consensus_hash FROM snapshots WHERE block_id >= ? AND block_id <= ?;'
... | python | def get_valid_consensus_hashes( self, block_id ):
"""
Get the list of valid consensus hashes for a given block.
"""
first_block_to_check = block_id - self.impl.get_valid_transaction_window()
query = 'SELECT consensus_hash FROM snapshots WHERE block_id >= ? AND block_id <= ?;'
... | [
"def",
"get_valid_consensus_hashes",
"(",
"self",
",",
"block_id",
")",
":",
"first_block_to_check",
"=",
"block_id",
"-",
"self",
".",
"impl",
".",
"get_valid_transaction_window",
"(",
")",
"query",
"=",
"'SELECT consensus_hash FROM snapshots WHERE block_id >= ? AND block_... | Get the list of valid consensus hashes for a given block. | [
"Get",
"the",
"list",
"of",
"valid",
"consensus",
"hashes",
"for",
"a",
"given",
"block",
"."
] | fcfc970064ca7dfcab26ebd3ab955870a763ea39 | https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/indexer.py#L1555-L1576 |
46,832 | gregreen/dustmaps | dustmaps/bayestar.py | fetch | def fetch(version='bayestar2017'):
"""
Downloads the specified version of the Bayestar dust map.
Args:
version (Optional[:obj:`str`]): The map version to download. Valid versions are
:obj:`'bayestar2017'` (Green, Schlafly, Finkbeiner et al. 2018) and
:obj:`'bayestar2015'` (G... | python | def fetch(version='bayestar2017'):
"""
Downloads the specified version of the Bayestar dust map.
Args:
version (Optional[:obj:`str`]): The map version to download. Valid versions are
:obj:`'bayestar2017'` (Green, Schlafly, Finkbeiner et al. 2018) and
:obj:`'bayestar2015'` (G... | [
"def",
"fetch",
"(",
"version",
"=",
"'bayestar2017'",
")",
":",
"doi",
"=",
"{",
"'bayestar2015'",
":",
"'10.7910/DVN/40C44C'",
",",
"'bayestar2017'",
":",
"'10.7910/DVN/LCYHJG'",
"}",
"# Raise an error if the specified version of the map does not exist",
"try",
":",
"do... | Downloads the specified version of the Bayestar dust map.
Args:
version (Optional[:obj:`str`]): The map version to download. Valid versions are
:obj:`'bayestar2017'` (Green, Schlafly, Finkbeiner et al. 2018) and
:obj:`'bayestar2015'` (Green, Schlafly, Finkbeiner et al. 2015). Defaul... | [
"Downloads",
"the",
"specified",
"version",
"of",
"the",
"Bayestar",
"dust",
"map",
"."
] | c8f571a71da0d951bf8ea865621bee14492bdfd9 | https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/bayestar.py#L553-L598 |
46,833 | sacrud/pyramid_sacrud | pyramid_sacrud/common.py | set_jinja2_silent_none | def set_jinja2_silent_none(config): # pragma: no cover
""" if variable is None print '' instead of 'None'
"""
config.commit()
jinja2_env = config.get_jinja2_environment()
jinja2_env.finalize = _silent_none | python | def set_jinja2_silent_none(config): # pragma: no cover
""" if variable is None print '' instead of 'None'
"""
config.commit()
jinja2_env = config.get_jinja2_environment()
jinja2_env.finalize = _silent_none | [
"def",
"set_jinja2_silent_none",
"(",
"config",
")",
":",
"# pragma: no cover",
"config",
".",
"commit",
"(",
")",
"jinja2_env",
"=",
"config",
".",
"get_jinja2_environment",
"(",
")",
"jinja2_env",
".",
"finalize",
"=",
"_silent_none"
] | if variable is None print '' instead of 'None' | [
"if",
"variable",
"is",
"None",
"print",
"instead",
"of",
"None"
] | 05c30e219a32166b4e09ec3524767fe4a4d3c788 | https://github.com/sacrud/pyramid_sacrud/blob/05c30e219a32166b4e09ec3524767fe4a4d3c788/pyramid_sacrud/common.py#L51-L56 |
46,834 | anjianshi/flask-restful-extend | flask_restful_extend/model_validates.py | complex_validates | def complex_validates(validate_rule):
"""Quickly setup attributes validation by one-time, based on `sqlalchemy.orm.validates`.
Don't like `sqlalchemy.orm.validates`, you don't need create many model method,
as long as pass formatted validate rule.
(Cause of SQLAlchemy's validate mechanism, you need ass... | python | def complex_validates(validate_rule):
"""Quickly setup attributes validation by one-time, based on `sqlalchemy.orm.validates`.
Don't like `sqlalchemy.orm.validates`, you don't need create many model method,
as long as pass formatted validate rule.
(Cause of SQLAlchemy's validate mechanism, you need ass... | [
"def",
"complex_validates",
"(",
"validate_rule",
")",
":",
"ref_dict",
"=",
"{",
"# column_name: (",
"# (predicate, arg1, ... argN),",
"# ...",
"# )",
"}",
"for",
"column_names",
",",
"predicate_refs",
"in",
"validate_rule",
".",
"items",
"(",
")",
":",
"for",
... | Quickly setup attributes validation by one-time, based on `sqlalchemy.orm.validates`.
Don't like `sqlalchemy.orm.validates`, you don't need create many model method,
as long as pass formatted validate rule.
(Cause of SQLAlchemy's validate mechanism, you need assignment this funciton's return value
to a... | [
"Quickly",
"setup",
"attributes",
"validation",
"by",
"one",
"-",
"time",
"based",
"on",
"sqlalchemy",
".",
"orm",
".",
"validates",
"."
] | cc168729bf341d4f9c0f6938be30463acbf770f1 | https://github.com/anjianshi/flask-restful-extend/blob/cc168729bf341d4f9c0f6938be30463acbf770f1/flask_restful_extend/model_validates.py#L34-L125 |
46,835 | anjianshi/flask-restful-extend | flask_restful_extend/model_validates.py | _validate_handler | def _validate_handler(column_name, value, predicate_refs):
"""handle predicate's return value"""
# only does validate when attribute value is not None
# else, just return it, let sqlalchemy decide if the value was legal according to `nullable` argument's value
if value is not None:
for predicat... | python | def _validate_handler(column_name, value, predicate_refs):
"""handle predicate's return value"""
# only does validate when attribute value is not None
# else, just return it, let sqlalchemy decide if the value was legal according to `nullable` argument's value
if value is not None:
for predicat... | [
"def",
"_validate_handler",
"(",
"column_name",
",",
"value",
",",
"predicate_refs",
")",
":",
"# only does validate when attribute value is not None",
"# else, just return it, let sqlalchemy decide if the value was legal according to `nullable` argument's value",
"if",
"value",
"is",
... | handle predicate's return value | [
"handle",
"predicate",
"s",
"return",
"value"
] | cc168729bf341d4f9c0f6938be30463acbf770f1 | https://github.com/anjianshi/flask-restful-extend/blob/cc168729bf341d4f9c0f6938be30463acbf770f1/flask_restful_extend/model_validates.py#L143-L162 |
46,836 | probcomp/crosscat | src/utils/sample_utils.py | simple_predictive_probability_multistate | def simple_predictive_probability_multistate(M_c, X_L_list, X_D_list, Y, Q):
"""Returns the simple predictive probability, averaged over each sample."""
logprobs = [float(simple_predictive_probability(M_c, X_L, X_D, Y, Q))
for X_L, X_D in zip(X_L_list, X_D_list)]
return logmeanexp(logprobs) | python | def simple_predictive_probability_multistate(M_c, X_L_list, X_D_list, Y, Q):
"""Returns the simple predictive probability, averaged over each sample."""
logprobs = [float(simple_predictive_probability(M_c, X_L, X_D, Y, Q))
for X_L, X_D in zip(X_L_list, X_D_list)]
return logmeanexp(logprobs) | [
"def",
"simple_predictive_probability_multistate",
"(",
"M_c",
",",
"X_L_list",
",",
"X_D_list",
",",
"Y",
",",
"Q",
")",
":",
"logprobs",
"=",
"[",
"float",
"(",
"simple_predictive_probability",
"(",
"M_c",
",",
"X_L",
",",
"X_D",
",",
"Y",
",",
"Q",
")",... | Returns the simple predictive probability, averaged over each sample. | [
"Returns",
"the",
"simple",
"predictive",
"probability",
"averaged",
"over",
"each",
"sample",
"."
] | 4a05bddb06a45f3b7b3e05e095720f16257d1535 | https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/sample_utils.py#L240-L244 |
46,837 | probcomp/crosscat | src/utils/sample_utils.py | predictive_probability_multistate | def predictive_probability_multistate(M_c, X_L_list, X_D_list, Y, Q):
"""
Returns the predictive probability, averaged over each sample.
"""
logprobs = [float(predictive_probability(M_c, X_L, X_D, Y, Q))
for X_L, X_D in zip(X_L_list, X_D_list)]
return logmeanexp(logprobs) | python | def predictive_probability_multistate(M_c, X_L_list, X_D_list, Y, Q):
"""
Returns the predictive probability, averaged over each sample.
"""
logprobs = [float(predictive_probability(M_c, X_L, X_D, Y, Q))
for X_L, X_D in zip(X_L_list, X_D_list)]
return logmeanexp(logprobs) | [
"def",
"predictive_probability_multistate",
"(",
"M_c",
",",
"X_L_list",
",",
"X_D_list",
",",
"Y",
",",
"Q",
")",
":",
"logprobs",
"=",
"[",
"float",
"(",
"predictive_probability",
"(",
"M_c",
",",
"X_L",
",",
"X_D",
",",
"Y",
",",
"Q",
")",
")",
"for... | Returns the predictive probability, averaged over each sample. | [
"Returns",
"the",
"predictive",
"probability",
"averaged",
"over",
"each",
"sample",
"."
] | 4a05bddb06a45f3b7b3e05e095720f16257d1535 | https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/sample_utils.py#L247-L253 |
46,838 | probcomp/crosscat | src/utils/sample_utils.py | similarity | def similarity(
M_c, X_L_list, X_D_list, given_row_id, target_row_id,
target_column=None):
"""Returns the similarity of the given row to the target row, averaged over
all the column indexes given by col_idxs.
Similarity is defined as the proportion of times that two cells are in the same
... | python | def similarity(
M_c, X_L_list, X_D_list, given_row_id, target_row_id,
target_column=None):
"""Returns the similarity of the given row to the target row, averaged over
all the column indexes given by col_idxs.
Similarity is defined as the proportion of times that two cells are in the same
... | [
"def",
"similarity",
"(",
"M_c",
",",
"X_L_list",
",",
"X_D_list",
",",
"given_row_id",
",",
"target_row_id",
",",
"target_column",
"=",
"None",
")",
":",
"score",
"=",
"0.0",
"# Set col_idxs: defaults to all columns.",
"if",
"target_column",
":",
"if",
"type",
... | Returns the similarity of the given row to the target row, averaged over
all the column indexes given by col_idxs.
Similarity is defined as the proportion of times that two cells are in the same
view and category. | [
"Returns",
"the",
"similarity",
"of",
"the",
"given",
"row",
"to",
"the",
"target",
"row",
"averaged",
"over",
"all",
"the",
"column",
"indexes",
"given",
"by",
"col_idxs",
"."
] | 4a05bddb06a45f3b7b3e05e095720f16257d1535 | https://github.com/probcomp/crosscat/blob/4a05bddb06a45f3b7b3e05e095720f16257d1535/src/utils/sample_utils.py#L256-L286 |
46,839 | sacrud/pyramid_sacrud | examples/docker_crud/views.py | admin_docker_list_view | def admin_docker_list_view(context, request):
"""Show list of docker images."""
return {
'paginator': Page(
context.all,
url_maker=lambda p: request.path_url + "?page=%s" % p,
page=int(request.params.get('page', 1)),
items_per_page=6
)
} | python | def admin_docker_list_view(context, request):
"""Show list of docker images."""
return {
'paginator': Page(
context.all,
url_maker=lambda p: request.path_url + "?page=%s" % p,
page=int(request.params.get('page', 1)),
items_per_page=6
)
} | [
"def",
"admin_docker_list_view",
"(",
"context",
",",
"request",
")",
":",
"return",
"{",
"'paginator'",
":",
"Page",
"(",
"context",
".",
"all",
",",
"url_maker",
"=",
"lambda",
"p",
":",
"request",
".",
"path_url",
"+",
"\"?page=%s\"",
"%",
"p",
",",
"... | Show list of docker images. | [
"Show",
"list",
"of",
"docker",
"images",
"."
] | 05c30e219a32166b4e09ec3524767fe4a4d3c788 | https://github.com/sacrud/pyramid_sacrud/blob/05c30e219a32166b4e09ec3524767fe4a4d3c788/examples/docker_crud/views.py#L24-L33 |
46,840 | sacrud/pyramid_sacrud | examples/docker_crud/views.py | admin_docker_massaction_view | def admin_docker_massaction_view(context, request):
"""Mass action view."""
items_list = request.POST.getall('selected_item')
for item in items_list:
try:
context.cli.remove_image(item)
request.session.flash(["deleted {}".format(item), "success"])
except docker.errors... | python | def admin_docker_massaction_view(context, request):
"""Mass action view."""
items_list = request.POST.getall('selected_item')
for item in items_list:
try:
context.cli.remove_image(item)
request.session.flash(["deleted {}".format(item), "success"])
except docker.errors... | [
"def",
"admin_docker_massaction_view",
"(",
"context",
",",
"request",
")",
":",
"items_list",
"=",
"request",
".",
"POST",
".",
"getall",
"(",
"'selected_item'",
")",
"for",
"item",
"in",
"items_list",
":",
"try",
":",
"context",
".",
"cli",
".",
"remove_im... | Mass action view. | [
"Mass",
"action",
"view",
"."
] | 05c30e219a32166b4e09ec3524767fe4a4d3c788 | https://github.com/sacrud/pyramid_sacrud/blob/05c30e219a32166b4e09ec3524767fe4a4d3c788/examples/docker_crud/views.py#L41-L51 |
46,841 | gregreen/dustmaps | dustmaps/map_base.py | coord2healpix | def coord2healpix(coords, frame, nside, nest=True):
"""
Calculate HEALPix indices from an astropy SkyCoord. Assume the HEALPix
system is defined on the coordinate frame ``frame``.
Args:
coords (:obj:`astropy.coordinates.SkyCoord`): The input coordinates.
frame (:obj:`str`): The frame in... | python | def coord2healpix(coords, frame, nside, nest=True):
"""
Calculate HEALPix indices from an astropy SkyCoord. Assume the HEALPix
system is defined on the coordinate frame ``frame``.
Args:
coords (:obj:`astropy.coordinates.SkyCoord`): The input coordinates.
frame (:obj:`str`): The frame in... | [
"def",
"coord2healpix",
"(",
"coords",
",",
"frame",
",",
"nside",
",",
"nest",
"=",
"True",
")",
":",
"if",
"coords",
".",
"frame",
".",
"name",
"!=",
"frame",
":",
"c",
"=",
"coords",
".",
"transform_to",
"(",
"frame",
")",
"else",
":",
"c",
"=",... | Calculate HEALPix indices from an astropy SkyCoord. Assume the HEALPix
system is defined on the coordinate frame ``frame``.
Args:
coords (:obj:`astropy.coordinates.SkyCoord`): The input coordinates.
frame (:obj:`str`): The frame in which the HEALPix system is defined.
nside (:obj:`int`)... | [
"Calculate",
"HEALPix",
"indices",
"from",
"an",
"astropy",
"SkyCoord",
".",
"Assume",
"the",
"HEALPix",
"system",
"is",
"defined",
"on",
"the",
"coordinate",
"frame",
"frame",
"."
] | c8f571a71da0d951bf8ea865621bee14492bdfd9 | https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/map_base.py#L41-L80 |
46,842 | gregreen/dustmaps | dustmaps/map_base.py | DustMap.query_gal | def query_gal(self, l, b, d=None, **kwargs):
"""
Query using Galactic coordinates.
Args:
l (:obj:`float`, scalar or array-like): Galactic longitude, in degrees,
or as an :obj:`astropy.unit.Quantity`.
b (:obj:`float`, scalar or array-like): Galactic latitu... | python | def query_gal(self, l, b, d=None, **kwargs):
"""
Query using Galactic coordinates.
Args:
l (:obj:`float`, scalar or array-like): Galactic longitude, in degrees,
or as an :obj:`astropy.unit.Quantity`.
b (:obj:`float`, scalar or array-like): Galactic latitu... | [
"def",
"query_gal",
"(",
"self",
",",
"l",
",",
"b",
",",
"d",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"l",
",",
"units",
".",
"Quantity",
")",
":",
"l",
"=",
"l",
"*",
"units",
".",
"deg",
"if",
"not",... | Query using Galactic coordinates.
Args:
l (:obj:`float`, scalar or array-like): Galactic longitude, in degrees,
or as an :obj:`astropy.unit.Quantity`.
b (:obj:`float`, scalar or array-like): Galactic latitude, in degrees,
or as an :obj:`astropy.unit.Quant... | [
"Query",
"using",
"Galactic",
"coordinates",
"."
] | c8f571a71da0d951bf8ea865621bee14492bdfd9 | https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/map_base.py#L323-L358 |
46,843 | anjianshi/flask-restful-extend | flask_restful_extend/model_reqparse.py | make_request_parser | def make_request_parser(model_or_inst, excludes=None, only=None, for_populate=False):
"""Pass a `model class` or `model instance` to this function,
then, it will generate a `RequestParser` that extract user request data from `request.json`
according to the model class's definition.
Parameter `exclude... | python | def make_request_parser(model_or_inst, excludes=None, only=None, for_populate=False):
"""Pass a `model class` or `model instance` to this function,
then, it will generate a `RequestParser` that extract user request data from `request.json`
according to the model class's definition.
Parameter `exclude... | [
"def",
"make_request_parser",
"(",
"model_or_inst",
",",
"excludes",
"=",
"None",
",",
"only",
"=",
"None",
",",
"for_populate",
"=",
"False",
")",
":",
"is_inst",
"=",
"_is_inst",
"(",
"model_or_inst",
")",
"if",
"isinstance",
"(",
"excludes",
",",
"six",
... | Pass a `model class` or `model instance` to this function,
then, it will generate a `RequestParser` that extract user request data from `request.json`
according to the model class's definition.
Parameter `excludes` and `only` can be `str` or list of `str`,
then are used to specify which columns shou... | [
"Pass",
"a",
"model",
"class",
"or",
"model",
"instance",
"to",
"this",
"function",
"then",
"it",
"will",
"generate",
"a",
"RequestParser",
"that",
"extract",
"user",
"request",
"data",
"from",
"request",
".",
"json",
"according",
"to",
"the",
"model",
"clas... | cc168729bf341d4f9c0f6938be30463acbf770f1 | https://github.com/anjianshi/flask-restful-extend/blob/cc168729bf341d4f9c0f6938be30463acbf770f1/flask_restful_extend/model_reqparse.py#L18-L61 |
46,844 | mdickinson/bigfloat | bigfloat/core.py | set_flagstate | def set_flagstate(flagset):
"""
Set all flags in ``flagset``, and clear all other flags.
"""
if not flagset <= _all_flags:
raise ValueError("unrecognized flags in flagset")
for f in flagset:
set_flag(f)
for f in _all_flags - flagset:
clear_flag(f) | python | def set_flagstate(flagset):
"""
Set all flags in ``flagset``, and clear all other flags.
"""
if not flagset <= _all_flags:
raise ValueError("unrecognized flags in flagset")
for f in flagset:
set_flag(f)
for f in _all_flags - flagset:
clear_flag(f) | [
"def",
"set_flagstate",
"(",
"flagset",
")",
":",
"if",
"not",
"flagset",
"<=",
"_all_flags",
":",
"raise",
"ValueError",
"(",
"\"unrecognized flags in flagset\"",
")",
"for",
"f",
"in",
"flagset",
":",
"set_flag",
"(",
"f",
")",
"for",
"f",
"in",
"_all_flag... | Set all flags in ``flagset``, and clear all other flags. | [
"Set",
"all",
"flags",
"in",
"flagset",
"and",
"clear",
"all",
"other",
"flags",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L940-L951 |
46,845 | mdickinson/bigfloat | bigfloat/core.py | set_str2 | def set_str2(s, base, context=None):
"""
Convert the string ``s`` in base ``base`` to a BigFloat instance, rounding
according to the current context.
Raise ValueError if ``s`` doesn't represent a valid string in the given
base.
"""
return _apply_function_in_current_context(
BigFloa... | python | def set_str2(s, base, context=None):
"""
Convert the string ``s`` in base ``base`` to a BigFloat instance, rounding
according to the current context.
Raise ValueError if ``s`` doesn't represent a valid string in the given
base.
"""
return _apply_function_in_current_context(
BigFloa... | [
"def",
"set_str2",
"(",
"s",
",",
"base",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"_set_from_whole_string",
",",
"(",
"s",
",",
"base",
")",
",",
"context",
",",
")"
] | Convert the string ``s`` in base ``base`` to a BigFloat instance, rounding
according to the current context.
Raise ValueError if ``s`` doesn't represent a valid string in the given
base. | [
"Convert",
"the",
"string",
"s",
"in",
"base",
"base",
"to",
"a",
"BigFloat",
"instance",
"rounding",
"according",
"to",
"the",
"current",
"context",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L989-L1003 |
46,846 | mdickinson/bigfloat | bigfloat/core.py | pos | def pos(x, context=None):
"""
Return ``x``.
As usual, the result is rounded to the current context. The ``pos``
function can be useful for rounding an intermediate result, computed with a
temporary increase in precision, back to the current context. For
example::
>>> from bigfloat im... | python | def pos(x, context=None):
"""
Return ``x``.
As usual, the result is rounded to the current context. The ``pos``
function can be useful for rounding an intermediate result, computed with a
temporary increase in precision, back to the current context. For
example::
>>> from bigfloat im... | [
"def",
"pos",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_set",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return ``x``.
As usual, the result is rounded to the current context. The ``pos``
function can be useful for rounding an intermediate result, computed with a
temporary increase in precision, back to the current context. For
example::
>>> from bigfloat import precision
>>> pow(3, 20) ... | [
"Return",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1010-L1036 |
46,847 | mdickinson/bigfloat | bigfloat/core.py | add | def add(x, y, context=None):
"""
Return ``x`` + ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_add,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | python | def add(x, y, context=None):
"""
Return ``x`` + ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_add,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | [
"def",
"add",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_add",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"... | Return ``x`` + ``y``. | [
"Return",
"x",
"+",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1043-L1056 |
46,848 | mdickinson/bigfloat | bigfloat/core.py | sub | def sub(x, y, context=None):
"""
Return ``x`` - ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sub,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | python | def sub(x, y, context=None):
"""
Return ``x`` - ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sub,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | [
"def",
"sub",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sub",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"... | Return ``x`` - ``y``. | [
"Return",
"x",
"-",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1059-L1072 |
46,849 | mdickinson/bigfloat | bigfloat/core.py | mul | def mul(x, y, context=None):
"""
Return ``x`` times ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_mul,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | python | def mul(x, y, context=None):
"""
Return ``x`` times ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_mul,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | [
"def",
"mul",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_mul",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"... | Return ``x`` times ``y``. | [
"Return",
"x",
"times",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1075-L1088 |
46,850 | mdickinson/bigfloat | bigfloat/core.py | sqr | def sqr(x, context=None):
"""
Return the square of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sqr,
(BigFloat._implicit_convert(x),),
context,
) | python | def sqr(x, context=None):
"""
Return the square of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sqr,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"sqr",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sqr",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the square of ``x``. | [
"Return",
"the",
"square",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1091-L1101 |
46,851 | mdickinson/bigfloat | bigfloat/core.py | div | def div(x, y, context=None):
"""
Return ``x`` divided by ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_div,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | python | def div(x, y, context=None):
"""
Return ``x`` divided by ``y``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_div,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
context,
) | [
"def",
"div",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_div",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"... | Return ``x`` divided by ``y``. | [
"Return",
"x",
"divided",
"by",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1104-L1117 |
46,852 | mdickinson/bigfloat | bigfloat/core.py | floordiv | def floordiv(x, y, context=None):
"""
Return the floor of ``x`` divided by ``y``.
The result is a ``BigFloat`` instance, rounded to the
context if necessary. Special cases match those of the
``div`` function.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr_fl... | python | def floordiv(x, y, context=None):
"""
Return the floor of ``x`` divided by ``y``.
The result is a ``BigFloat`` instance, rounded to the
context if necessary. Special cases match those of the
``div`` function.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr_fl... | [
"def",
"floordiv",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr_floordiv",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"_implic... | Return the floor of ``x`` divided by ``y``.
The result is a ``BigFloat`` instance, rounded to the
context if necessary. Special cases match those of the
``div`` function. | [
"Return",
"the",
"floor",
"of",
"x",
"divided",
"by",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1120-L1137 |
46,853 | mdickinson/bigfloat | bigfloat/core.py | mod | def mod(x, y, context=None):
"""
Return the remainder of x divided by y, with sign matching that of y.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr_mod,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
co... | python | def mod(x, y, context=None):
"""
Return the remainder of x divided by y, with sign matching that of y.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr_mod,
(
BigFloat._implicit_convert(x),
BigFloat._implicit_convert(y),
),
co... | [
"def",
"mod",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr_mod",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"_implicit_convert... | Return the remainder of x divided by y, with sign matching that of y. | [
"Return",
"the",
"remainder",
"of",
"x",
"divided",
"by",
"y",
"with",
"sign",
"matching",
"that",
"of",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1140-L1153 |
46,854 | mdickinson/bigfloat | bigfloat/core.py | sqrt | def sqrt(x, context=None):
"""
Return the square root of ``x``.
Return -0 if x is -0, to be consistent with the IEEE 754 standard. Return
NaN if x is negative.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sqrt,
(BigFloat._implicit_convert(x),),
... | python | def sqrt(x, context=None):
"""
Return the square root of ``x``.
Return -0 if x is -0, to be consistent with the IEEE 754 standard. Return
NaN if x is negative.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sqrt,
(BigFloat._implicit_convert(x),),
... | [
"def",
"sqrt",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sqrt",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the square root of ``x``.
Return -0 if x is -0, to be consistent with the IEEE 754 standard. Return
NaN if x is negative. | [
"Return",
"the",
"square",
"root",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1166-L1179 |
46,855 | mdickinson/bigfloat | bigfloat/core.py | rec_sqrt | def rec_sqrt(x, context=None):
"""
Return the reciprocal square root of x.
Return +Inf if x is ±0, +0 if x is +Inf, and NaN if x is negative.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_rec_sqrt,
(BigFloat._implicit_convert(x),),
context,
... | python | def rec_sqrt(x, context=None):
"""
Return the reciprocal square root of x.
Return +Inf if x is ±0, +0 if x is +Inf, and NaN if x is negative.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_rec_sqrt,
(BigFloat._implicit_convert(x),),
context,
... | [
"def",
"rec_sqrt",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_rec_sqrt",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
... | Return the reciprocal square root of x.
Return +Inf if x is ±0, +0 if x is +Inf, and NaN if x is negative. | [
"Return",
"the",
"reciprocal",
"square",
"root",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1182-L1194 |
46,856 | mdickinson/bigfloat | bigfloat/core.py | cbrt | def cbrt(x, context=None):
"""
Return the cube root of x.
For x negative, return a negative number. The cube root of -0 is defined
to be -0.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cbrt,
(BigFloat._implicit_convert(x),),
context,
... | python | def cbrt(x, context=None):
"""
Return the cube root of x.
For x negative, return a negative number. The cube root of -0 is defined
to be -0.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cbrt,
(BigFloat._implicit_convert(x),),
context,
... | [
"def",
"cbrt",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_cbrt",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the cube root of x.
For x negative, return a negative number. The cube root of -0 is defined
to be -0. | [
"Return",
"the",
"cube",
"root",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1197-L1210 |
46,857 | mdickinson/bigfloat | bigfloat/core.py | root | def root(x, k, context=None):
"""
Return the kth root of x.
For k odd and x negative (including -Inf), return a negative number.
For k even and x negative (including -Inf), return NaN.
The kth root of -0 is defined to be -0, whatever the parity of k.
This function is only implemented for nonn... | python | def root(x, k, context=None):
"""
Return the kth root of x.
For k odd and x negative (including -Inf), return a negative number.
For k even and x negative (including -Inf), return NaN.
The kth root of -0 is defined to be -0, whatever the parity of k.
This function is only implemented for nonn... | [
"def",
"root",
"(",
"x",
",",
"k",
",",
"context",
"=",
"None",
")",
":",
"if",
"k",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"root function not implemented for negative k\"",
")",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",... | Return the kth root of x.
For k odd and x negative (including -Inf), return a negative number.
For k even and x negative (including -Inf), return NaN.
The kth root of -0 is defined to be -0, whatever the parity of k.
This function is only implemented for nonnegative k. | [
"Return",
"the",
"kth",
"root",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1213-L1233 |
46,858 | mdickinson/bigfloat | bigfloat/core.py | pow | def pow(x, y, context=None):
"""
Return ``x`` raised to the power ``y``.
Special values are handled as described in the ISO C99 and IEEE 754-2008
standards for the pow function.
* pow(±0, y) returns plus or minus infinity for y a negative odd integer.
* pow(±0, y) returns plus infinity fo... | python | def pow(x, y, context=None):
"""
Return ``x`` raised to the power ``y``.
Special values are handled as described in the ISO C99 and IEEE 754-2008
standards for the pow function.
* pow(±0, y) returns plus or minus infinity for y a negative odd integer.
* pow(±0, y) returns plus infinity fo... | [
"def",
"pow",
"(",
"x",
",",
"y",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_pow",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
"BigFloat",
".",
"... | Return ``x`` raised to the power ``y``.
Special values are handled as described in the ISO C99 and IEEE 754-2008
standards for the pow function.
* pow(±0, y) returns plus or minus infinity for y a negative odd integer.
* pow(±0, y) returns plus infinity for y negative and not an odd integer.
... | [
"Return",
"x",
"raised",
"to",
"the",
"power",
"y",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1236-L1286 |
46,859 | mdickinson/bigfloat | bigfloat/core.py | neg | def neg(x, context=None):
"""
Return -x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_neg,
(BigFloat._implicit_convert(x),),
context,
) | python | def neg(x, context=None):
"""
Return -x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_neg,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"neg",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_neg",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return -x. | [
"Return",
"-",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1289-L1299 |
46,860 | mdickinson/bigfloat | bigfloat/core.py | cmp | def cmp(op1, op2):
"""
Perform a three-way comparison of op1 and op2.
Return a positive value if op1 > op2, zero if op1 = op2, and a negative
value if op1 < op2. Both op1 and op2 are considered to their full own
precision, which may differ. If one of the operands is NaN, raise
ValueError.
... | python | def cmp(op1, op2):
"""
Perform a three-way comparison of op1 and op2.
Return a positive value if op1 > op2, zero if op1 = op2, and a negative
value if op1 < op2. Both op1 and op2 are considered to their full own
precision, which may differ. If one of the operands is NaN, raise
ValueError.
... | [
"def",
"cmp",
"(",
"op1",
",",
"op2",
")",
":",
"op1",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"op1",
")",
"op2",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"op2",
")",
"if",
"is_nan",
"(",
"op1",
")",
"or",
"is_nan",
"(",
"op2",
")",
... | Perform a three-way comparison of op1 and op2.
Return a positive value if op1 > op2, zero if op1 = op2, and a negative
value if op1 < op2. Both op1 and op2 are considered to their full own
precision, which may differ. If one of the operands is NaN, raise
ValueError.
Note: This function may be usef... | [
"Perform",
"a",
"three",
"-",
"way",
"comparison",
"of",
"op1",
"and",
"op2",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1337-L1356 |
46,861 | mdickinson/bigfloat | bigfloat/core.py | cmpabs | def cmpabs(op1, op2):
"""
Compare the absolute values of op1 and op2.
Return a positive value if op1 > op2, zero if op1 = op2, and a negative
value if op1 < op2. Both op1 and op2 are considered to their full own
precision, which may differ. If one of the operands is NaN, raise
ValueError.
... | python | def cmpabs(op1, op2):
"""
Compare the absolute values of op1 and op2.
Return a positive value if op1 > op2, zero if op1 = op2, and a negative
value if op1 < op2. Both op1 and op2 are considered to their full own
precision, which may differ. If one of the operands is NaN, raise
ValueError.
... | [
"def",
"cmpabs",
"(",
"op1",
",",
"op2",
")",
":",
"op1",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"op1",
")",
"op2",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"op2",
")",
"if",
"is_nan",
"(",
"op1",
")",
"or",
"is_nan",
"(",
"op2",
")",... | Compare the absolute values of op1 and op2.
Return a positive value if op1 > op2, zero if op1 = op2, and a negative
value if op1 < op2. Both op1 and op2 are considered to their full own
precision, which may differ. If one of the operands is NaN, raise
ValueError.
Note: This function may be useful ... | [
"Compare",
"the",
"absolute",
"values",
"of",
"op1",
"and",
"op2",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1359-L1378 |
46,862 | mdickinson/bigfloat | bigfloat/core.py | sgn | def sgn(x):
"""
Return the sign of x.
Return a positive integer if x > 0, 0 if x == 0, and a negative integer if
x < 0. Raise ValueError if x is a NaN.
This function is equivalent to cmp(x, 0), but more efficient.
"""
x = BigFloat._implicit_convert(x)
if is_nan(x):
raise Valu... | python | def sgn(x):
"""
Return the sign of x.
Return a positive integer if x > 0, 0 if x == 0, and a negative integer if
x < 0. Raise ValueError if x is a NaN.
This function is equivalent to cmp(x, 0), but more efficient.
"""
x = BigFloat._implicit_convert(x)
if is_nan(x):
raise Valu... | [
"def",
"sgn",
"(",
"x",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"if",
"is_nan",
"(",
"x",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot take sign of a NaN.\"",
")",
"return",
"mpfr",
".",
"mpfr_sgn",
"(",
"x",
")"
] | Return the sign of x.
Return a positive integer if x > 0, 0 if x == 0, and a negative integer if
x < 0. Raise ValueError if x is a NaN.
This function is equivalent to cmp(x, 0), but more efficient. | [
"Return",
"the",
"sign",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1420-L1433 |
46,863 | mdickinson/bigfloat | bigfloat/core.py | greater | def greater(x, y):
"""
Return True if x > y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_greater_p(x, y) | python | def greater(x, y):
"""
Return True if x > y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_greater_p(x, y) | [
"def",
"greater",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"mpfr",
".",
"mpfr_greater_p",
"(",
"x",
",",
"y",
")"
] | Return True if x > y and False otherwise.
This function returns False whenever x and/or y is a NaN. | [
"Return",
"True",
"if",
"x",
">",
"y",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1436-L1445 |
46,864 | mdickinson/bigfloat | bigfloat/core.py | greaterequal | def greaterequal(x, y):
"""
Return True if x >= y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_greaterequal_p(x, y) | python | def greaterequal(x, y):
"""
Return True if x >= y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_greaterequal_p(x, y) | [
"def",
"greaterequal",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"mpfr",
".",
"mpfr_greaterequal_p",
"(",
"x",
",",
"y",
")"
] | Return True if x >= y and False otherwise.
This function returns False whenever x and/or y is a NaN. | [
"Return",
"True",
"if",
"x",
">",
"=",
"y",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1448-L1457 |
46,865 | mdickinson/bigfloat | bigfloat/core.py | less | def less(x, y):
"""
Return True if x < y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_less_p(x, y) | python | def less(x, y):
"""
Return True if x < y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_less_p(x, y) | [
"def",
"less",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"mpfr",
".",
"mpfr_less_p",
"(",
"x",
",",
"y",
")"
] | Return True if x < y and False otherwise.
This function returns False whenever x and/or y is a NaN. | [
"Return",
"True",
"if",
"x",
"<",
"y",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1460-L1469 |
46,866 | mdickinson/bigfloat | bigfloat/core.py | lessequal | def lessequal(x, y):
"""
Return True if x <= y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_lessequal_p(x, y) | python | def lessequal(x, y):
"""
Return True if x <= y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_lessequal_p(x, y) | [
"def",
"lessequal",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"mpfr",
".",
"mpfr_lessequal_p",
"(",
"x",
",",
"y",
")"
] | Return True if x <= y and False otherwise.
This function returns False whenever x and/or y is a NaN. | [
"Return",
"True",
"if",
"x",
"<",
"=",
"y",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1472-L1481 |
46,867 | mdickinson/bigfloat | bigfloat/core.py | equal | def equal(x, y):
"""
Return True if x == y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_equal_p(x, y) | python | def equal(x, y):
"""
Return True if x == y and False otherwise.
This function returns False whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_equal_p(x, y) | [
"def",
"equal",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"mpfr",
".",
"mpfr_equal_p",
"(",
"x",
",",
"y",
")"
] | Return True if x == y and False otherwise.
This function returns False whenever x and/or y is a NaN. | [
"Return",
"True",
"if",
"x",
"==",
"y",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1484-L1493 |
46,868 | mdickinson/bigfloat | bigfloat/core.py | notequal | def notequal(x, y):
"""
Return True if x != y and False otherwise.
This function returns True whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return not mpfr.mpfr_equal_p(x, y) | python | def notequal(x, y):
"""
Return True if x != y and False otherwise.
This function returns True whenever x and/or y is a NaN.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return not mpfr.mpfr_equal_p(x, y) | [
"def",
"notequal",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"not",
"mpfr",
".",
"mpfr_equal_p",
"(",
"x",
",",
"y",
")"
] | Return True if x != y and False otherwise.
This function returns True whenever x and/or y is a NaN. | [
"Return",
"True",
"if",
"x",
"!",
"=",
"y",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1496-L1505 |
46,869 | mdickinson/bigfloat | bigfloat/core.py | unordered | def unordered(x, y):
"""
Return True if x or y is a NaN and False otherwise.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_unordered_p(x, y) | python | def unordered(x, y):
"""
Return True if x or y is a NaN and False otherwise.
"""
x = BigFloat._implicit_convert(x)
y = BigFloat._implicit_convert(y)
return mpfr.mpfr_unordered_p(x, y) | [
"def",
"unordered",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
"y",
"=",
"BigFloat",
".",
"_implicit_convert",
"(",
"y",
")",
"return",
"mpfr",
".",
"mpfr_unordered_p",
"(",
"x",
",",
"y",
")"
] | Return True if x or y is a NaN and False otherwise. | [
"Return",
"True",
"if",
"x",
"or",
"y",
"is",
"a",
"NaN",
"and",
"False",
"otherwise",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1520-L1527 |
46,870 | mdickinson/bigfloat | bigfloat/core.py | log | def log(x, context=None):
"""
Return the natural logarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log,
(BigFloat._implicit_convert(x),),
context,
) | python | def log(x, context=None):
"""
Return the natural logarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"log",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_log",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the natural logarithm of x. | [
"Return",
"the",
"natural",
"logarithm",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1534-L1544 |
46,871 | mdickinson/bigfloat | bigfloat/core.py | log2 | def log2(x, context=None):
"""
Return the base-two logarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log2,
(BigFloat._implicit_convert(x),),
context,
) | python | def log2(x, context=None):
"""
Return the base-two logarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log2,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"log2",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_log2",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the base-two logarithm of x. | [
"Return",
"the",
"base",
"-",
"two",
"logarithm",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1547-L1557 |
46,872 | mdickinson/bigfloat | bigfloat/core.py | log10 | def log10(x, context=None):
"""
Return the base-ten logarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log10,
(BigFloat._implicit_convert(x),),
context,
) | python | def log10(x, context=None):
"""
Return the base-ten logarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log10,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"log10",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_log10",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the base-ten logarithm of x. | [
"Return",
"the",
"base",
"-",
"ten",
"logarithm",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1560-L1570 |
46,873 | mdickinson/bigfloat | bigfloat/core.py | exp | def exp(x, context=None):
"""
Return the exponential of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_exp,
(BigFloat._implicit_convert(x),),
context,
) | python | def exp(x, context=None):
"""
Return the exponential of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_exp,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"exp",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_exp",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the exponential of x. | [
"Return",
"the",
"exponential",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1573-L1583 |
46,874 | mdickinson/bigfloat | bigfloat/core.py | exp2 | def exp2(x, context=None):
"""
Return two raised to the power x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_exp2,
(BigFloat._implicit_convert(x),),
context,
) | python | def exp2(x, context=None):
"""
Return two raised to the power x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_exp2,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"exp2",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_exp2",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return two raised to the power x. | [
"Return",
"two",
"raised",
"to",
"the",
"power",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1586-L1596 |
46,875 | mdickinson/bigfloat | bigfloat/core.py | exp10 | def exp10(x, context=None):
"""
Return ten raised to the power x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_exp10,
(BigFloat._implicit_convert(x),),
context,
) | python | def exp10(x, context=None):
"""
Return ten raised to the power x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_exp10,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"exp10",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_exp10",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return ten raised to the power x. | [
"Return",
"ten",
"raised",
"to",
"the",
"power",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1599-L1609 |
46,876 | mdickinson/bigfloat | bigfloat/core.py | cos | def cos(x, context=None):
"""
Return the cosine of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cos,
(BigFloat._implicit_convert(x),),
context,
) | python | def cos(x, context=None):
"""
Return the cosine of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cos,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"cos",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_cos",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the cosine of ``x``. | [
"Return",
"the",
"cosine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1612-L1622 |
46,877 | mdickinson/bigfloat | bigfloat/core.py | sin | def sin(x, context=None):
"""
Return the sine of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sin,
(BigFloat._implicit_convert(x),),
context,
) | python | def sin(x, context=None):
"""
Return the sine of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sin,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"sin",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sin",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the sine of ``x``. | [
"Return",
"the",
"sine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1625-L1635 |
46,878 | mdickinson/bigfloat | bigfloat/core.py | tan | def tan(x, context=None):
"""
Return the tangent of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_tan,
(BigFloat._implicit_convert(x),),
context,
) | python | def tan(x, context=None):
"""
Return the tangent of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_tan,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"tan",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_tan",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the tangent of ``x``. | [
"Return",
"the",
"tangent",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1638-L1648 |
46,879 | mdickinson/bigfloat | bigfloat/core.py | sec | def sec(x, context=None):
"""
Return the secant of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sec,
(BigFloat._implicit_convert(x),),
context,
) | python | def sec(x, context=None):
"""
Return the secant of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sec,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"sec",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sec",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the secant of ``x``. | [
"Return",
"the",
"secant",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1651-L1661 |
46,880 | mdickinson/bigfloat | bigfloat/core.py | csc | def csc(x, context=None):
"""
Return the cosecant of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_csc,
(BigFloat._implicit_convert(x),),
context,
) | python | def csc(x, context=None):
"""
Return the cosecant of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_csc,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"csc",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_csc",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the cosecant of ``x``. | [
"Return",
"the",
"cosecant",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1664-L1674 |
46,881 | mdickinson/bigfloat | bigfloat/core.py | cot | def cot(x, context=None):
"""
Return the cotangent of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cot,
(BigFloat._implicit_convert(x),),
context,
) | python | def cot(x, context=None):
"""
Return the cotangent of ``x``.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cot,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"cot",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_cot",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the cotangent of ``x``. | [
"Return",
"the",
"cotangent",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1677-L1687 |
46,882 | mdickinson/bigfloat | bigfloat/core.py | acos | def acos(x, context=None):
"""
Return the inverse cosine of ``x``.
The mathematically exact result lies in the range [0, π]. However, note
that as a result of rounding to the current context, it's possible for the
actual value returned to be fractionally larger than π::
>>> from bigfloat ... | python | def acos(x, context=None):
"""
Return the inverse cosine of ``x``.
The mathematically exact result lies in the range [0, π]. However, note
that as a result of rounding to the current context, it's possible for the
actual value returned to be fractionally larger than π::
>>> from bigfloat ... | [
"def",
"acos",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_acos",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the inverse cosine of ``x``.
The mathematically exact result lies in the range [0, π]. However, note
that as a result of rounding to the current context, it's possible for the
actual value returned to be fractionally larger than π::
>>> from bigfloat import precision
>>> with preci... | [
"Return",
"the",
"inverse",
"cosine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1690-L1713 |
46,883 | mdickinson/bigfloat | bigfloat/core.py | asin | def asin(x, context=None):
"""
Return the inverse sine of ``x``.
The mathematically exact result lies in the range [-π/2, π/2]. However,
note that as a result of rounding to the current context, it's possible
for the actual value to lie just outside this range.
"""
return _apply_function_... | python | def asin(x, context=None):
"""
Return the inverse sine of ``x``.
The mathematically exact result lies in the range [-π/2, π/2]. However,
note that as a result of rounding to the current context, it's possible
for the actual value to lie just outside this range.
"""
return _apply_function_... | [
"def",
"asin",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_asin",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the inverse sine of ``x``.
The mathematically exact result lies in the range [-π/2, π/2]. However,
note that as a result of rounding to the current context, it's possible
for the actual value to lie just outside this range. | [
"Return",
"the",
"inverse",
"sine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1716-L1730 |
46,884 | mdickinson/bigfloat | bigfloat/core.py | atan | def atan(x, context=None):
"""
Return the inverse tangent of ``x``.
The mathematically exact result lies in the range [-π/2, π/2]. However,
note that as a result of rounding to the current context, it's possible
for the actual value to lie just outside this range.
"""
return _apply_functi... | python | def atan(x, context=None):
"""
Return the inverse tangent of ``x``.
The mathematically exact result lies in the range [-π/2, π/2]. However,
note that as a result of rounding to the current context, it's possible
for the actual value to lie just outside this range.
"""
return _apply_functi... | [
"def",
"atan",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_atan",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the inverse tangent of ``x``.
The mathematically exact result lies in the range [-π/2, π/2]. However,
note that as a result of rounding to the current context, it's possible
for the actual value to lie just outside this range. | [
"Return",
"the",
"inverse",
"tangent",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1733-L1747 |
46,885 | mdickinson/bigfloat | bigfloat/core.py | cosh | def cosh(x, context=None):
"""
Return the hyperbolic cosine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cosh,
(BigFloat._implicit_convert(x),),
context,
) | python | def cosh(x, context=None):
"""
Return the hyperbolic cosine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_cosh,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"cosh",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_cosh",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the hyperbolic cosine of x. | [
"Return",
"the",
"hyperbolic",
"cosine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1805-L1815 |
46,886 | mdickinson/bigfloat | bigfloat/core.py | sinh | def sinh(x, context=None):
"""
Return the hyperbolic sine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sinh,
(BigFloat._implicit_convert(x),),
context,
) | python | def sinh(x, context=None):
"""
Return the hyperbolic sine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sinh,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"sinh",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sinh",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the hyperbolic sine of x. | [
"Return",
"the",
"hyperbolic",
"sine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1818-L1828 |
46,887 | mdickinson/bigfloat | bigfloat/core.py | tanh | def tanh(x, context=None):
"""
Return the hyperbolic tangent of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_tanh,
(BigFloat._implicit_convert(x),),
context,
) | python | def tanh(x, context=None):
"""
Return the hyperbolic tangent of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_tanh,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"tanh",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_tanh",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the hyperbolic tangent of x. | [
"Return",
"the",
"hyperbolic",
"tangent",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1831-L1841 |
46,888 | mdickinson/bigfloat | bigfloat/core.py | sech | def sech(x, context=None):
"""
Return the hyperbolic secant of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sech,
(BigFloat._implicit_convert(x),),
context,
) | python | def sech(x, context=None):
"""
Return the hyperbolic secant of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_sech,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"sech",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_sech",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the hyperbolic secant of x. | [
"Return",
"the",
"hyperbolic",
"secant",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1844-L1854 |
46,889 | mdickinson/bigfloat | bigfloat/core.py | csch | def csch(x, context=None):
"""
Return the hyperbolic cosecant of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_csch,
(BigFloat._implicit_convert(x),),
context,
) | python | def csch(x, context=None):
"""
Return the hyperbolic cosecant of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_csch,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"csch",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_csch",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the hyperbolic cosecant of x. | [
"Return",
"the",
"hyperbolic",
"cosecant",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1857-L1867 |
46,890 | mdickinson/bigfloat | bigfloat/core.py | coth | def coth(x, context=None):
"""
Return the hyperbolic cotangent of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_coth,
(BigFloat._implicit_convert(x),),
context,
) | python | def coth(x, context=None):
"""
Return the hyperbolic cotangent of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_coth,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"coth",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_coth",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the hyperbolic cotangent of x. | [
"Return",
"the",
"hyperbolic",
"cotangent",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1870-L1880 |
46,891 | mdickinson/bigfloat | bigfloat/core.py | acosh | def acosh(x, context=None):
"""
Return the inverse hyperbolic cosine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_acosh,
(BigFloat._implicit_convert(x),),
context,
) | python | def acosh(x, context=None):
"""
Return the inverse hyperbolic cosine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_acosh,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"acosh",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_acosh",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the inverse hyperbolic cosine of x. | [
"Return",
"the",
"inverse",
"hyperbolic",
"cosine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1883-L1893 |
46,892 | mdickinson/bigfloat | bigfloat/core.py | asinh | def asinh(x, context=None):
"""
Return the inverse hyperbolic sine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_asinh,
(BigFloat._implicit_convert(x),),
context,
) | python | def asinh(x, context=None):
"""
Return the inverse hyperbolic sine of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_asinh,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"asinh",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_asinh",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the inverse hyperbolic sine of x. | [
"Return",
"the",
"inverse",
"hyperbolic",
"sine",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1896-L1906 |
46,893 | mdickinson/bigfloat | bigfloat/core.py | atanh | def atanh(x, context=None):
"""
Return the inverse hyperbolic tangent of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_atanh,
(BigFloat._implicit_convert(x),),
context,
) | python | def atanh(x, context=None):
"""
Return the inverse hyperbolic tangent of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_atanh,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"atanh",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_atanh",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the inverse hyperbolic tangent of x. | [
"Return",
"the",
"inverse",
"hyperbolic",
"tangent",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1909-L1919 |
46,894 | mdickinson/bigfloat | bigfloat/core.py | log1p | def log1p(x, context=None):
"""
Return the logarithm of one plus x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log1p,
(BigFloat._implicit_convert(x),),
context,
) | python | def log1p(x, context=None):
"""
Return the logarithm of one plus x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_log1p,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"log1p",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_log1p",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the logarithm of one plus x. | [
"Return",
"the",
"logarithm",
"of",
"one",
"plus",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1935-L1945 |
46,895 | mdickinson/bigfloat | bigfloat/core.py | expm1 | def expm1(x, context=None):
"""
Return one less than the exponential of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_expm1,
(BigFloat._implicit_convert(x),),
context,
) | python | def expm1(x, context=None):
"""
Return one less than the exponential of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_expm1,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"expm1",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_expm1",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return one less than the exponential of x. | [
"Return",
"one",
"less",
"than",
"the",
"exponential",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1948-L1958 |
46,896 | mdickinson/bigfloat | bigfloat/core.py | eint | def eint(x, context=None):
"""
Return the exponential integral of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_eint,
(BigFloat._implicit_convert(x),),
context,
) | python | def eint(x, context=None):
"""
Return the exponential integral of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_eint,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"eint",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_eint",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the exponential integral of x. | [
"Return",
"the",
"exponential",
"integral",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1961-L1971 |
46,897 | mdickinson/bigfloat | bigfloat/core.py | li2 | def li2(x, context=None):
"""
Return the real part of the dilogarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_li2,
(BigFloat._implicit_convert(x),),
context,
) | python | def li2(x, context=None):
"""
Return the real part of the dilogarithm of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_li2,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"li2",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_li2",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
")... | Return the real part of the dilogarithm of x. | [
"Return",
"the",
"real",
"part",
"of",
"the",
"dilogarithm",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1974-L1984 |
46,898 | mdickinson/bigfloat | bigfloat/core.py | gamma | def gamma(x, context=None):
"""
Return the value of the Gamma function of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_gamma,
(BigFloat._implicit_convert(x),),
context,
) | python | def gamma(x, context=None):
"""
Return the value of the Gamma function of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_gamma,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"gamma",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_gamma",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
",",
... | Return the value of the Gamma function of x. | [
"Return",
"the",
"value",
"of",
"the",
"Gamma",
"function",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L1987-L1997 |
46,899 | mdickinson/bigfloat | bigfloat/core.py | lngamma | def lngamma(x, context=None):
"""
Return the value of the logarithm of the Gamma function of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_lngamma,
(BigFloat._implicit_convert(x),),
context,
) | python | def lngamma(x, context=None):
"""
Return the value of the logarithm of the Gamma function of x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_lngamma,
(BigFloat._implicit_convert(x),),
context,
) | [
"def",
"lngamma",
"(",
"x",
",",
"context",
"=",
"None",
")",
":",
"return",
"_apply_function_in_current_context",
"(",
"BigFloat",
",",
"mpfr",
".",
"mpfr_lngamma",
",",
"(",
"BigFloat",
".",
"_implicit_convert",
"(",
"x",
")",
",",
")",
",",
"context",
"... | Return the value of the logarithm of the Gamma function of x. | [
"Return",
"the",
"value",
"of",
"the",
"logarithm",
"of",
"the",
"Gamma",
"function",
"of",
"x",
"."
] | e5fdd1048615191ed32a2b7460e14b3b3ff24662 | https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2000-L2010 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.