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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
230,600 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_name_history | def get_name_history( self, name, offset=None, count=None, reverse=False):
"""
Get the historic states for a name, grouped by block height.
"""
cur = self.db.cursor()
name_hist = namedb_get_history( cur, name, offset=offset, count=count, reverse=reverse )
return name_hist | python | def get_name_history( self, name, offset=None, count=None, reverse=False):
"""
Get the historic states for a name, grouped by block height.
"""
cur = self.db.cursor()
name_hist = namedb_get_history( cur, name, offset=offset, count=count, reverse=reverse )
return name_hist | [
"def",
"get_name_history",
"(",
"self",
",",
"name",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"name_hist",
"=",
"namedb_get_history",
"(",
"... | Get the historic states for a name, grouped by block height. | [
"Get",
"the",
"historic",
"states",
"for",
"a",
"name",
"grouped",
"by",
"block",
"height",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L941-L947 |
230,601 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_name_zonefile_hash | def is_name_zonefile_hash(self, name, zonefile_hash):
"""
Was a zone file sent by a name?
"""
cur = self.db.cursor()
return namedb_is_name_zonefile_hash(cur, name, zonefile_hash) | python | def is_name_zonefile_hash(self, name, zonefile_hash):
"""
Was a zone file sent by a name?
"""
cur = self.db.cursor()
return namedb_is_name_zonefile_hash(cur, name, zonefile_hash) | [
"def",
"is_name_zonefile_hash",
"(",
"self",
",",
"name",
",",
"zonefile_hash",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"return",
"namedb_is_name_zonefile_hash",
"(",
"cur",
",",
"name",
",",
"zonefile_hash",
")"
] | Was a zone file sent by a name? | [
"Was",
"a",
"zone",
"file",
"sent",
"by",
"a",
"name?"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L950-L955 |
230,602 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_all_blockstack_ops_at | def get_all_blockstack_ops_at( self, block_number, offset=None, count=None, include_history=None, restore_history=None ):
"""
Get all name, namespace, and account records affected at a particular block,
in the state they were at the given block number.
Paginate if offset, count ... | python | def get_all_blockstack_ops_at( self, block_number, offset=None, count=None, include_history=None, restore_history=None ):
"""
Get all name, namespace, and account records affected at a particular block,
in the state they were at the given block number.
Paginate if offset, count ... | [
"def",
"get_all_blockstack_ops_at",
"(",
"self",
",",
"block_number",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
",",
"include_history",
"=",
"None",
",",
"restore_history",
"=",
"None",
")",
":",
"if",
"include_history",
"is",
"not",
"None",
":"... | Get all name, namespace, and account records affected at a particular block,
in the state they were at the given block number.
Paginate if offset, count are given. | [
"Get",
"all",
"name",
"namespace",
"and",
"account",
"records",
"affected",
"at",
"a",
"particular",
"block",
"in",
"the",
"state",
"they",
"were",
"at",
"the",
"given",
"block",
"number",
".",
"Paginate",
"if",
"offset",
"count",
"are",
"given",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L958-L979 |
230,603 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_name_from_name_hash128 | def get_name_from_name_hash128( self, name ):
"""
Get the name from a name hash
"""
cur = self.db.cursor()
name = namedb_get_name_from_name_hash128( cur, name, self.lastblock )
return name | python | def get_name_from_name_hash128( self, name ):
"""
Get the name from a name hash
"""
cur = self.db.cursor()
name = namedb_get_name_from_name_hash128( cur, name, self.lastblock )
return name | [
"def",
"get_name_from_name_hash128",
"(",
"self",
",",
"name",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"name",
"=",
"namedb_get_name_from_name_hash128",
"(",
"cur",
",",
"name",
",",
"self",
".",
"lastblock",
")",
"return",
"name"... | Get the name from a name hash | [
"Get",
"the",
"name",
"from",
"a",
"name",
"hash"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L990-L996 |
230,604 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_num_historic_names_by_address | def get_num_historic_names_by_address( self, address ):
"""
Get the number of names historically owned by an address
"""
cur = self.db.cursor()
count = namedb_get_num_historic_names_by_address( cur, address )
return count | python | def get_num_historic_names_by_address( self, address ):
"""
Get the number of names historically owned by an address
"""
cur = self.db.cursor()
count = namedb_get_num_historic_names_by_address( cur, address )
return count | [
"def",
"get_num_historic_names_by_address",
"(",
"self",
",",
"address",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"count",
"=",
"namedb_get_num_historic_names_by_address",
"(",
"cur",
",",
"address",
")",
"return",
"count"
] | Get the number of names historically owned by an address | [
"Get",
"the",
"number",
"of",
"names",
"historically",
"owned",
"by",
"an",
"address"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1019-L1025 |
230,605 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_names_owned_by_sender | def get_names_owned_by_sender( self, sender_pubkey, lastblock=None ):
"""
Get the set of names owned by a particular script-pubkey.
"""
cur = self.db.cursor()
if lastblock is None:
lastblock = self.lastblock
names = namedb_get_names_by_sender( cur, sender_pu... | python | def get_names_owned_by_sender( self, sender_pubkey, lastblock=None ):
"""
Get the set of names owned by a particular script-pubkey.
"""
cur = self.db.cursor()
if lastblock is None:
lastblock = self.lastblock
names = namedb_get_names_by_sender( cur, sender_pu... | [
"def",
"get_names_owned_by_sender",
"(",
"self",
",",
"sender_pubkey",
",",
"lastblock",
"=",
"None",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"if",
"lastblock",
"is",
"None",
":",
"lastblock",
"=",
"self",
".",
"lastblock",
"nam... | Get the set of names owned by a particular script-pubkey. | [
"Get",
"the",
"set",
"of",
"names",
"owned",
"by",
"a",
"particular",
"script",
"-",
"pubkey",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1028-L1037 |
230,606 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_num_names | def get_num_names( self, include_expired=False ):
"""
Get the number of names that exist.
"""
cur = self.db.cursor()
return namedb_get_num_names( cur, self.lastblock, include_expired=include_expired ) | python | def get_num_names( self, include_expired=False ):
"""
Get the number of names that exist.
"""
cur = self.db.cursor()
return namedb_get_num_names( cur, self.lastblock, include_expired=include_expired ) | [
"def",
"get_num_names",
"(",
"self",
",",
"include_expired",
"=",
"False",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"return",
"namedb_get_num_names",
"(",
"cur",
",",
"self",
".",
"lastblock",
",",
"include_expired",
"=",
"include_... | Get the number of names that exist. | [
"Get",
"the",
"number",
"of",
"names",
"that",
"exist",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1040-L1045 |
230,607 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_all_names | def get_all_names( self, offset=None, count=None, include_expired=False ):
"""
Get the set of all registered names, with optional pagination
Returns the list of names.
"""
if offset is not None and offset < 0:
offset = None
if count is not None and count < 0:... | python | def get_all_names( self, offset=None, count=None, include_expired=False ):
"""
Get the set of all registered names, with optional pagination
Returns the list of names.
"""
if offset is not None and offset < 0:
offset = None
if count is not None and count < 0:... | [
"def",
"get_all_names",
"(",
"self",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
",",
"include_expired",
"=",
"False",
")",
":",
"if",
"offset",
"is",
"not",
"None",
"and",
"offset",
"<",
"0",
":",
"offset",
"=",
"None",
"if",
"count",
"is... | Get the set of all registered names, with optional pagination
Returns the list of names. | [
"Get",
"the",
"set",
"of",
"all",
"registered",
"names",
"with",
"optional",
"pagination",
"Returns",
"the",
"list",
"of",
"names",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1048-L1061 |
230,608 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_num_names_in_namespace | def get_num_names_in_namespace( self, namespace_id ):
"""
Get the number of names in a namespace
"""
cur = self.db.cursor()
return namedb_get_num_names_in_namespace( cur, namespace_id, self.lastblock ) | python | def get_num_names_in_namespace( self, namespace_id ):
"""
Get the number of names in a namespace
"""
cur = self.db.cursor()
return namedb_get_num_names_in_namespace( cur, namespace_id, self.lastblock ) | [
"def",
"get_num_names_in_namespace",
"(",
"self",
",",
"namespace_id",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"return",
"namedb_get_num_names_in_namespace",
"(",
"cur",
",",
"namespace_id",
",",
"self",
".",
"lastblock",
")"
] | Get the number of names in a namespace | [
"Get",
"the",
"number",
"of",
"names",
"in",
"a",
"namespace"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1064-L1069 |
230,609 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_names_in_namespace | def get_names_in_namespace( self, namespace_id, offset=None, count=None ):
"""
Get the set of all registered names in a particular namespace.
Returns the list of names.
"""
if offset is not None and offset < 0:
offset = None
if count is not None and count < ... | python | def get_names_in_namespace( self, namespace_id, offset=None, count=None ):
"""
Get the set of all registered names in a particular namespace.
Returns the list of names.
"""
if offset is not None and offset < 0:
offset = None
if count is not None and count < ... | [
"def",
"get_names_in_namespace",
"(",
"self",
",",
"namespace_id",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
")",
":",
"if",
"offset",
"is",
"not",
"None",
"and",
"offset",
"<",
"0",
":",
"offset",
"=",
"None",
"if",
"count",
"is",
"not",
... | Get the set of all registered names in a particular namespace.
Returns the list of names. | [
"Get",
"the",
"set",
"of",
"all",
"registered",
"names",
"in",
"a",
"particular",
"namespace",
".",
"Returns",
"the",
"list",
"of",
"names",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1072-L1085 |
230,610 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_all_namespace_ids | def get_all_namespace_ids( self ):
"""
Get the set of all existing, READY namespace IDs.
"""
cur = self.db.cursor()
namespace_ids = namedb_get_all_namespace_ids( cur )
return namespace_ids | python | def get_all_namespace_ids( self ):
"""
Get the set of all existing, READY namespace IDs.
"""
cur = self.db.cursor()
namespace_ids = namedb_get_all_namespace_ids( cur )
return namespace_ids | [
"def",
"get_all_namespace_ids",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"namespace_ids",
"=",
"namedb_get_all_namespace_ids",
"(",
"cur",
")",
"return",
"namespace_ids"
] | Get the set of all existing, READY namespace IDs. | [
"Get",
"the",
"set",
"of",
"all",
"existing",
"READY",
"namespace",
"IDs",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1088-L1094 |
230,611 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_all_revealed_namespace_ids | def get_all_revealed_namespace_ids( self ):
"""
Get all revealed namespace IDs that have not expired.
"""
cur = self.db.cursor()
namespace_ids = namedb_get_all_revealed_namespace_ids( cur, self.lastblock )
return namespace_ids | python | def get_all_revealed_namespace_ids( self ):
"""
Get all revealed namespace IDs that have not expired.
"""
cur = self.db.cursor()
namespace_ids = namedb_get_all_revealed_namespace_ids( cur, self.lastblock )
return namespace_ids | [
"def",
"get_all_revealed_namespace_ids",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"namespace_ids",
"=",
"namedb_get_all_revealed_namespace_ids",
"(",
"cur",
",",
"self",
".",
"lastblock",
")",
"return",
"namespace_ids"
] | Get all revealed namespace IDs that have not expired. | [
"Get",
"all",
"revealed",
"namespace",
"IDs",
"that",
"have",
"not",
"expired",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1097-L1103 |
230,612 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_all_preordered_namespace_hashes | def get_all_preordered_namespace_hashes( self ):
"""
Get all oustanding namespace preorder hashes that have not expired.
Used for testing
"""
cur = self.db.cursor()
namespace_hashes = namedb_get_all_preordered_namespace_hashes( cur, self.lastblock )
return namespa... | python | def get_all_preordered_namespace_hashes( self ):
"""
Get all oustanding namespace preorder hashes that have not expired.
Used for testing
"""
cur = self.db.cursor()
namespace_hashes = namedb_get_all_preordered_namespace_hashes( cur, self.lastblock )
return namespa... | [
"def",
"get_all_preordered_namespace_hashes",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"namespace_hashes",
"=",
"namedb_get_all_preordered_namespace_hashes",
"(",
"cur",
",",
"self",
".",
"lastblock",
")",
"return",
"namespace... | Get all oustanding namespace preorder hashes that have not expired.
Used for testing | [
"Get",
"all",
"oustanding",
"namespace",
"preorder",
"hashes",
"that",
"have",
"not",
"expired",
".",
"Used",
"for",
"testing"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1106-L1113 |
230,613 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_all_importing_namespace_hashes | def get_all_importing_namespace_hashes( self ):
"""
Get the set of all preordered and revealed namespace hashes that have not expired.
"""
cur = self.db.cursor()
namespace_hashes = namedb_get_all_importing_namespace_hashes( cur, self.lastblock )
return namespace_hashes | python | def get_all_importing_namespace_hashes( self ):
"""
Get the set of all preordered and revealed namespace hashes that have not expired.
"""
cur = self.db.cursor()
namespace_hashes = namedb_get_all_importing_namespace_hashes( cur, self.lastblock )
return namespace_hashes | [
"def",
"get_all_importing_namespace_hashes",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"namespace_hashes",
"=",
"namedb_get_all_importing_namespace_hashes",
"(",
"cur",
",",
"self",
".",
"lastblock",
")",
"return",
"namespace_h... | Get the set of all preordered and revealed namespace hashes that have not expired. | [
"Get",
"the",
"set",
"of",
"all",
"preordered",
"and",
"revealed",
"namespace",
"hashes",
"that",
"have",
"not",
"expired",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1116-L1122 |
230,614 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_name_preorder | def get_name_preorder( self, name, sender_script_pubkey, register_addr, include_failed=False ):
"""
Get the current preorder for a name, given the name, the sender's script pubkey, and
the registration address used to calculate the preorder hash.
Return the preorder record on success.
... | python | def get_name_preorder( self, name, sender_script_pubkey, register_addr, include_failed=False ):
"""
Get the current preorder for a name, given the name, the sender's script pubkey, and
the registration address used to calculate the preorder hash.
Return the preorder record on success.
... | [
"def",
"get_name_preorder",
"(",
"self",
",",
"name",
",",
"sender_script_pubkey",
",",
"register_addr",
",",
"include_failed",
"=",
"False",
")",
":",
"# name registered and not expired?",
"name_rec",
"=",
"self",
".",
"get_name",
"(",
"name",
")",
"if",
"name_re... | Get the current preorder for a name, given the name, the sender's script pubkey, and
the registration address used to calculate the preorder hash.
Return the preorder record on success.
Return None if not found, or the preorder is already registered and not expired (even if revoked).
N... | [
"Get",
"the",
"current",
"preorder",
"for",
"a",
"name",
"given",
"the",
"name",
"the",
"sender",
"s",
"script",
"pubkey",
"and",
"the",
"registration",
"address",
"used",
"to",
"calculate",
"the",
"preorder",
"hash",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1166-L1203 |
230,615 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_names_with_value_hash | def get_names_with_value_hash( self, value_hash ):
"""
Get the list of names with the given value hash, at the current block height.
This excludes revoked names and expired names.
Return None if there are no such names
"""
cur = self.db.cursor()
names = namedb_ge... | python | def get_names_with_value_hash( self, value_hash ):
"""
Get the list of names with the given value hash, at the current block height.
This excludes revoked names and expired names.
Return None if there are no such names
"""
cur = self.db.cursor()
names = namedb_ge... | [
"def",
"get_names_with_value_hash",
"(",
"self",
",",
"value_hash",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"names",
"=",
"namedb_get_names_with_value_hash",
"(",
"cur",
",",
"value_hash",
",",
"self",
".",
"lastblock",
")",
"return... | Get the list of names with the given value hash, at the current block height.
This excludes revoked names and expired names.
Return None if there are no such names | [
"Get",
"the",
"list",
"of",
"names",
"with",
"the",
"given",
"value",
"hash",
"at",
"the",
"current",
"block",
"height",
".",
"This",
"excludes",
"revoked",
"names",
"and",
"expired",
"names",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1235-L1244 |
230,616 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_atlas_zonefile_info_at | def get_atlas_zonefile_info_at( self, block_id ):
"""
Get the blockchain-ordered sequence of names, value hashes, and txids.
added at the given block height. The order will be
in tx-order.
Return [{'name': name, 'value_hash': value_hash, 'txid': txid}]
"""
nameo... | python | def get_atlas_zonefile_info_at( self, block_id ):
"""
Get the blockchain-ordered sequence of names, value hashes, and txids.
added at the given block height. The order will be
in tx-order.
Return [{'name': name, 'value_hash': value_hash, 'txid': txid}]
"""
nameo... | [
"def",
"get_atlas_zonefile_info_at",
"(",
"self",
",",
"block_id",
")",
":",
"nameops",
"=",
"self",
".",
"get_all_blockstack_ops_at",
"(",
"block_id",
")",
"ret",
"=",
"[",
"]",
"for",
"nameop",
"in",
"nameops",
":",
"if",
"nameop",
".",
"has_key",
"(",
"... | Get the blockchain-ordered sequence of names, value hashes, and txids.
added at the given block height. The order will be
in tx-order.
Return [{'name': name, 'value_hash': value_hash, 'txid': txid}] | [
"Get",
"the",
"blockchain",
"-",
"ordered",
"sequence",
"of",
"names",
"value",
"hashes",
"and",
"txids",
".",
"added",
"at",
"the",
"given",
"block",
"height",
".",
"The",
"order",
"will",
"be",
"in",
"tx",
"-",
"order",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1247-L1267 |
230,617 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_namespace_reveal | def get_namespace_reveal( self, namespace_id, include_history=True ):
"""
Given the name of a namespace, get it if it is currently
being revealed.
Return the reveal record on success.
Return None if it is not being revealed, or is expired.
"""
cur = self.db.curso... | python | def get_namespace_reveal( self, namespace_id, include_history=True ):
"""
Given the name of a namespace, get it if it is currently
being revealed.
Return the reveal record on success.
Return None if it is not being revealed, or is expired.
"""
cur = self.db.curso... | [
"def",
"get_namespace_reveal",
"(",
"self",
",",
"namespace_id",
",",
"include_history",
"=",
"True",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"namespace_reveal",
"=",
"namedb_get_namespace_reveal",
"(",
"cur",
",",
"namespace_id",
","... | Given the name of a namespace, get it if it is currently
being revealed.
Return the reveal record on success.
Return None if it is not being revealed, or is expired. | [
"Given",
"the",
"name",
"of",
"a",
"namespace",
"get",
"it",
"if",
"it",
"is",
"currently",
"being",
"revealed",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1306-L1316 |
230,618 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_name_registered | def is_name_registered( self, name ):
"""
Given the fully-qualified name, is it registered, not revoked, and not expired
at the current block?
"""
name_rec = self.get_name( name ) # won't return the name if expired
if name_rec is None:
return False
... | python | def is_name_registered( self, name ):
"""
Given the fully-qualified name, is it registered, not revoked, and not expired
at the current block?
"""
name_rec = self.get_name( name ) # won't return the name if expired
if name_rec is None:
return False
... | [
"def",
"is_name_registered",
"(",
"self",
",",
"name",
")",
":",
"name_rec",
"=",
"self",
".",
"get_name",
"(",
"name",
")",
"# won't return the name if expired",
"if",
"name_rec",
"is",
"None",
":",
"return",
"False",
"if",
"name_rec",
"[",
"'revoked'",
"]",
... | Given the fully-qualified name, is it registered, not revoked, and not expired
at the current block? | [
"Given",
"the",
"fully",
"-",
"qualified",
"name",
"is",
"it",
"registered",
"not",
"revoked",
"and",
"not",
"expired",
"at",
"the",
"current",
"block?"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1392-L1404 |
230,619 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_namespace_ready | def is_namespace_ready( self, namespace_id ):
"""
Given a namespace ID, determine if the namespace is ready
at the current block.
"""
namespace = self.get_namespace( namespace_id )
if namespace is not None:
return True
else:
return False | python | def is_namespace_ready( self, namespace_id ):
"""
Given a namespace ID, determine if the namespace is ready
at the current block.
"""
namespace = self.get_namespace( namespace_id )
if namespace is not None:
return True
else:
return False | [
"def",
"is_namespace_ready",
"(",
"self",
",",
"namespace_id",
")",
":",
"namespace",
"=",
"self",
".",
"get_namespace",
"(",
"namespace_id",
")",
"if",
"namespace",
"is",
"not",
"None",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | Given a namespace ID, determine if the namespace is ready
at the current block. | [
"Given",
"a",
"namespace",
"ID",
"determine",
"if",
"the",
"namespace",
"is",
"ready",
"at",
"the",
"current",
"block",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1407-L1416 |
230,620 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_namespace_preordered | def is_namespace_preordered( self, namespace_id_hash ):
"""
Given a namespace preorder hash, determine if it is preordered
at the current block.
"""
namespace_preorder = self.get_namespace_preorder(namespace_id_hash)
if namespace_preorder is None:
return False... | python | def is_namespace_preordered( self, namespace_id_hash ):
"""
Given a namespace preorder hash, determine if it is preordered
at the current block.
"""
namespace_preorder = self.get_namespace_preorder(namespace_id_hash)
if namespace_preorder is None:
return False... | [
"def",
"is_namespace_preordered",
"(",
"self",
",",
"namespace_id_hash",
")",
":",
"namespace_preorder",
"=",
"self",
".",
"get_namespace_preorder",
"(",
"namespace_id_hash",
")",
"if",
"namespace_preorder",
"is",
"None",
":",
"return",
"False",
"else",
":",
"return... | Given a namespace preorder hash, determine if it is preordered
at the current block. | [
"Given",
"a",
"namespace",
"preorder",
"hash",
"determine",
"if",
"it",
"is",
"preordered",
"at",
"the",
"current",
"block",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1419-L1428 |
230,621 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_namespace_revealed | def is_namespace_revealed( self, namespace_id ):
"""
Given the name of a namespace, has it been revealed but not made ready
at the current block?
"""
namespace_reveal = self.get_namespace_reveal( namespace_id )
if namespace_reveal is not None:
return True
... | python | def is_namespace_revealed( self, namespace_id ):
"""
Given the name of a namespace, has it been revealed but not made ready
at the current block?
"""
namespace_reveal = self.get_namespace_reveal( namespace_id )
if namespace_reveal is not None:
return True
... | [
"def",
"is_namespace_revealed",
"(",
"self",
",",
"namespace_id",
")",
":",
"namespace_reveal",
"=",
"self",
".",
"get_namespace_reveal",
"(",
"namespace_id",
")",
"if",
"namespace_reveal",
"is",
"not",
"None",
":",
"return",
"True",
"else",
":",
"return",
"Fals... | Given the name of a namespace, has it been revealed but not made ready
at the current block? | [
"Given",
"the",
"name",
"of",
"a",
"namespace",
"has",
"it",
"been",
"revealed",
"but",
"not",
"made",
"ready",
"at",
"the",
"current",
"block?"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1431-L1440 |
230,622 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_name_owner | def is_name_owner( self, name, sender_script_pubkey ):
"""
Given the fully-qualified name and a sender's script pubkey,
determine if the sender owns the name.
The name must exist and not be revoked or expired at the
current block.
"""
if not self.is_name_register... | python | def is_name_owner( self, name, sender_script_pubkey ):
"""
Given the fully-qualified name and a sender's script pubkey,
determine if the sender owns the name.
The name must exist and not be revoked or expired at the
current block.
"""
if not self.is_name_register... | [
"def",
"is_name_owner",
"(",
"self",
",",
"name",
",",
"sender_script_pubkey",
")",
":",
"if",
"not",
"self",
".",
"is_name_registered",
"(",
"name",
")",
":",
"# no one owns it ",
"return",
"False",
"owner",
"=",
"self",
".",
"get_name_owner",
"(",
"name",
... | Given the fully-qualified name and a sender's script pubkey,
determine if the sender owns the name.
The name must exist and not be revoked or expired at the
current block. | [
"Given",
"the",
"fully",
"-",
"qualified",
"name",
"and",
"a",
"sender",
"s",
"script",
"pubkey",
"determine",
"if",
"the",
"sender",
"owns",
"the",
"name",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1443-L1459 |
230,623 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_new_preorder | def is_new_preorder( self, preorder_hash, lastblock=None ):
"""
Given a preorder hash of a name, determine whether or not it is unseen before.
"""
if lastblock is None:
lastblock = self.lastblock
preorder = namedb_get_name_preorder( self.db, preorder_hash, lastblock... | python | def is_new_preorder( self, preorder_hash, lastblock=None ):
"""
Given a preorder hash of a name, determine whether or not it is unseen before.
"""
if lastblock is None:
lastblock = self.lastblock
preorder = namedb_get_name_preorder( self.db, preorder_hash, lastblock... | [
"def",
"is_new_preorder",
"(",
"self",
",",
"preorder_hash",
",",
"lastblock",
"=",
"None",
")",
":",
"if",
"lastblock",
"is",
"None",
":",
"lastblock",
"=",
"self",
".",
"lastblock",
"preorder",
"=",
"namedb_get_name_preorder",
"(",
"self",
".",
"db",
",",
... | Given a preorder hash of a name, determine whether or not it is unseen before. | [
"Given",
"a",
"preorder",
"hash",
"of",
"a",
"name",
"determine",
"whether",
"or",
"not",
"it",
"is",
"unseen",
"before",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1462-L1473 |
230,624 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_new_namespace_preorder | def is_new_namespace_preorder( self, namespace_id_hash, lastblock=None ):
"""
Given a namespace preorder hash, determine whether or not is is unseen before.
"""
if lastblock is None:
lastblock = self.lastblock
preorder = namedb_get_namespace_preorder( self.db, names... | python | def is_new_namespace_preorder( self, namespace_id_hash, lastblock=None ):
"""
Given a namespace preorder hash, determine whether or not is is unseen before.
"""
if lastblock is None:
lastblock = self.lastblock
preorder = namedb_get_namespace_preorder( self.db, names... | [
"def",
"is_new_namespace_preorder",
"(",
"self",
",",
"namespace_id_hash",
",",
"lastblock",
"=",
"None",
")",
":",
"if",
"lastblock",
"is",
"None",
":",
"lastblock",
"=",
"self",
".",
"lastblock",
"preorder",
"=",
"namedb_get_namespace_preorder",
"(",
"self",
"... | Given a namespace preorder hash, determine whether or not is is unseen before. | [
"Given",
"a",
"namespace",
"preorder",
"hash",
"determine",
"whether",
"or",
"not",
"is",
"is",
"unseen",
"before",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1476-L1487 |
230,625 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.is_name_revoked | def is_name_revoked( self, name ):
"""
Determine if a name is revoked at this block.
"""
name = self.get_name( name )
if name is None:
return False
if name['revoked']:
return True
else:
return False | python | def is_name_revoked( self, name ):
"""
Determine if a name is revoked at this block.
"""
name = self.get_name( name )
if name is None:
return False
if name['revoked']:
return True
else:
return False | [
"def",
"is_name_revoked",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"self",
".",
"get_name",
"(",
"name",
")",
"if",
"name",
"is",
"None",
":",
"return",
"False",
"if",
"name",
"[",
"'revoked'",
"]",
":",
"return",
"True",
"else",
":",
"return... | Determine if a name is revoked at this block. | [
"Determine",
"if",
"a",
"name",
"is",
"revoked",
"at",
"this",
"block",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1490-L1501 |
230,626 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.get_value_hash_txids | def get_value_hash_txids(self, value_hash):
"""
Get the list of txids by value hash
"""
cur = self.db.cursor()
return namedb_get_value_hash_txids(cur, value_hash) | python | def get_value_hash_txids(self, value_hash):
"""
Get the list of txids by value hash
"""
cur = self.db.cursor()
return namedb_get_value_hash_txids(cur, value_hash) | [
"def",
"get_value_hash_txids",
"(",
"self",
",",
"value_hash",
")",
":",
"cur",
"=",
"self",
".",
"db",
".",
"cursor",
"(",
")",
"return",
"namedb_get_value_hash_txids",
"(",
"cur",
",",
"value_hash",
")"
] | Get the list of txids by value hash | [
"Get",
"the",
"list",
"of",
"txids",
"by",
"value",
"hash"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1511-L1516 |
230,627 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.nameop_set_collided | def nameop_set_collided( cls, nameop, history_id_key, history_id ):
"""
Mark a nameop as collided
"""
nameop['__collided__'] = True
nameop['__collided_history_id_key__'] = history_id_key
nameop['__collided_history_id__'] = history_id | python | def nameop_set_collided( cls, nameop, history_id_key, history_id ):
"""
Mark a nameop as collided
"""
nameop['__collided__'] = True
nameop['__collided_history_id_key__'] = history_id_key
nameop['__collided_history_id__'] = history_id | [
"def",
"nameop_set_collided",
"(",
"cls",
",",
"nameop",
",",
"history_id_key",
",",
"history_id",
")",
":",
"nameop",
"[",
"'__collided__'",
"]",
"=",
"True",
"nameop",
"[",
"'__collided_history_id_key__'",
"]",
"=",
"history_id_key",
"nameop",
"[",
"'__collided_... | Mark a nameop as collided | [
"Mark",
"a",
"nameop",
"as",
"collided"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1530-L1536 |
230,628 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.nameop_put_collision | def nameop_put_collision( cls, collisions, nameop ):
"""
Record a nameop as collided with another nameop in this block.
"""
# these are supposed to have been put here by nameop_set_collided
history_id_key = nameop.get('__collided_history_id_key__', None)
history_id = name... | python | def nameop_put_collision( cls, collisions, nameop ):
"""
Record a nameop as collided with another nameop in this block.
"""
# these are supposed to have been put here by nameop_set_collided
history_id_key = nameop.get('__collided_history_id_key__', None)
history_id = name... | [
"def",
"nameop_put_collision",
"(",
"cls",
",",
"collisions",
",",
"nameop",
")",
":",
"# these are supposed to have been put here by nameop_set_collided",
"history_id_key",
"=",
"nameop",
".",
"get",
"(",
"'__collided_history_id_key__'",
",",
"None",
")",
"history_id",
"... | Record a nameop as collided with another nameop in this block. | [
"Record",
"a",
"nameop",
"as",
"collided",
"with",
"another",
"nameop",
"in",
"this",
"block",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1548-L1568 |
230,629 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.extract_consensus_op | def extract_consensus_op(self, opcode, op_data, processed_op_data, current_block_number):
"""
Using the operation data extracted from parsing the virtualchain operation (@op_data),
and the checked, processed operation (@processed_op_data), return a dict that contains
(1) all of the conse... | python | def extract_consensus_op(self, opcode, op_data, processed_op_data, current_block_number):
"""
Using the operation data extracted from parsing the virtualchain operation (@op_data),
and the checked, processed operation (@processed_op_data), return a dict that contains
(1) all of the conse... | [
"def",
"extract_consensus_op",
"(",
"self",
",",
"opcode",
",",
"op_data",
",",
"processed_op_data",
",",
"current_block_number",
")",
":",
"ret",
"=",
"{",
"}",
"consensus_fields",
"=",
"op_get_consensus_fields",
"(",
"opcode",
")",
"quirk_fields",
"=",
"op_get_q... | Using the operation data extracted from parsing the virtualchain operation (@op_data),
and the checked, processed operation (@processed_op_data), return a dict that contains
(1) all of the consensus fields to snapshot this operation, and
(2) all of the data fields that we need to store for the n... | [
"Using",
"the",
"operation",
"data",
"extracted",
"from",
"parsing",
"the",
"virtualchain",
"operation",
"("
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1571-L1597 |
230,630 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.commit_operation | def commit_operation( self, input_op_data, accepted_nameop, current_block_number ):
"""
Commit an operation, thereby carrying out a state transition.
Returns a dict with the new db record fields
"""
# have to have read-write disposition
if self.disposition != DISPOS... | python | def commit_operation( self, input_op_data, accepted_nameop, current_block_number ):
"""
Commit an operation, thereby carrying out a state transition.
Returns a dict with the new db record fields
"""
# have to have read-write disposition
if self.disposition != DISPOS... | [
"def",
"commit_operation",
"(",
"self",
",",
"input_op_data",
",",
"accepted_nameop",
",",
"current_block_number",
")",
":",
"# have to have read-write disposition ",
"if",
"self",
".",
"disposition",
"!=",
"DISPOSITION_RW",
":",
"log",
".",
"error",
"(",
"\"FATAL: bo... | Commit an operation, thereby carrying out a state transition.
Returns a dict with the new db record fields | [
"Commit",
"an",
"operation",
"thereby",
"carrying",
"out",
"a",
"state",
"transition",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1600-L1654 |
230,631 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.commit_token_operation | def commit_token_operation(self, token_op, current_block_number):
"""
Commit a token operation that debits one account and credits another
Returns the new canonicalized record (with all compatibility quirks preserved)
DO NOT CALL THIS DIRECTLY
"""
# have to have read-wr... | python | def commit_token_operation(self, token_op, current_block_number):
"""
Commit a token operation that debits one account and credits another
Returns the new canonicalized record (with all compatibility quirks preserved)
DO NOT CALL THIS DIRECTLY
"""
# have to have read-wr... | [
"def",
"commit_token_operation",
"(",
"self",
",",
"token_op",
",",
"current_block_number",
")",
":",
"# have to have read-write disposition ",
"if",
"self",
".",
"disposition",
"!=",
"DISPOSITION_RW",
":",
"log",
".",
"error",
"(",
"\"FATAL: borrowing violation: not a re... | Commit a token operation that debits one account and credits another
Returns the new canonicalized record (with all compatibility quirks preserved)
DO NOT CALL THIS DIRECTLY | [
"Commit",
"a",
"token",
"operation",
"that",
"debits",
"one",
"account",
"and",
"credits",
"another"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1935-L1990 |
230,632 | blockstack/blockstack-core | blockstack/lib/nameset/namedb.py | BlockstackDB.commit_account_vesting | def commit_account_vesting(self, block_height):
"""
vest any tokens at this block height
"""
# save all state
log.debug("Commit all database state before vesting")
self.db.commit()
if block_height in self.vesting:
traceback.print_stack()
l... | python | def commit_account_vesting(self, block_height):
"""
vest any tokens at this block height
"""
# save all state
log.debug("Commit all database state before vesting")
self.db.commit()
if block_height in self.vesting:
traceback.print_stack()
l... | [
"def",
"commit_account_vesting",
"(",
"self",
",",
"block_height",
")",
":",
"# save all state",
"log",
".",
"debug",
"(",
"\"Commit all database state before vesting\"",
")",
"self",
".",
"db",
".",
"commit",
"(",
")",
"if",
"block_height",
"in",
"self",
".",
"... | vest any tokens at this block height | [
"vest",
"any",
"tokens",
"at",
"this",
"block",
"height"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1993-L2013 |
230,633 | blockstack/blockstack-core | blockstack/lib/scripts.py | is_name_valid | def is_name_valid(fqn):
"""
Is a fully-qualified name acceptable?
Return True if so
Return False if not
>>> is_name_valid('abcd')
False
>>> is_name_valid('abcd.')
False
>>> is_name_valid('.abcd')
False
>>> is_name_valid('Abcd.abcd')
False
>>> is_name_valid('abcd.abc.... | python | def is_name_valid(fqn):
"""
Is a fully-qualified name acceptable?
Return True if so
Return False if not
>>> is_name_valid('abcd')
False
>>> is_name_valid('abcd.')
False
>>> is_name_valid('.abcd')
False
>>> is_name_valid('Abcd.abcd')
False
>>> is_name_valid('abcd.abc.... | [
"def",
"is_name_valid",
"(",
"fqn",
")",
":",
"if",
"not",
"isinstance",
"(",
"fqn",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"return",
"False",
"if",
"fqn",
".",
"count",
"(",
"\".\"",
")",
"!=",
"1",
":",
"return",
"False",
"name",
",",
... | Is a fully-qualified name acceptable?
Return True if so
Return False if not
>>> is_name_valid('abcd')
False
>>> is_name_valid('abcd.')
False
>>> is_name_valid('.abcd')
False
>>> is_name_valid('Abcd.abcd')
False
>>> is_name_valid('abcd.abc.d')
False
>>> is_name_valid(... | [
"Is",
"a",
"fully",
"-",
"qualified",
"name",
"acceptable?",
"Return",
"True",
"if",
"so",
"Return",
"False",
"if",
"not"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L35-L96 |
230,634 | blockstack/blockstack-core | blockstack/lib/scripts.py | is_namespace_valid | def is_namespace_valid( namespace_id ):
"""
Is a namespace ID valid?
>>> is_namespace_valid('abcd')
True
>>> is_namespace_valid('+abcd')
False
>>> is_namespace_valid('abc.def')
False
>>> is_namespace_valid('.abcd')
False
>>> is_namespace_valid('abcdabcdabcdabcdabcd')
Fal... | python | def is_namespace_valid( namespace_id ):
"""
Is a namespace ID valid?
>>> is_namespace_valid('abcd')
True
>>> is_namespace_valid('+abcd')
False
>>> is_namespace_valid('abc.def')
False
>>> is_namespace_valid('.abcd')
False
>>> is_namespace_valid('abcdabcdabcdabcdabcd')
Fal... | [
"def",
"is_namespace_valid",
"(",
"namespace_id",
")",
":",
"if",
"not",
"is_b40",
"(",
"namespace_id",
")",
"or",
"\"+\"",
"in",
"namespace_id",
"or",
"namespace_id",
".",
"count",
"(",
"\".\"",
")",
">",
"0",
":",
"return",
"False",
"if",
"len",
"(",
"... | Is a namespace ID valid?
>>> is_namespace_valid('abcd')
True
>>> is_namespace_valid('+abcd')
False
>>> is_namespace_valid('abc.def')
False
>>> is_namespace_valid('.abcd')
False
>>> is_namespace_valid('abcdabcdabcdabcdabcd')
False
>>> is_namespace_valid('abcdabcdabcdabcdabc')... | [
"Is",
"a",
"namespace",
"ID",
"valid?"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L99-L122 |
230,635 | blockstack/blockstack-core | blockstack/lib/scripts.py | price_namespace | def price_namespace( namespace_id, block_height, units ):
"""
Calculate the cost of a namespace.
Returns the price on success
Returns None if the namespace is invalid or if the units are invalid
"""
price_table = get_epoch_namespace_prices( block_height, units )
if price_table is None:
... | python | def price_namespace( namespace_id, block_height, units ):
"""
Calculate the cost of a namespace.
Returns the price on success
Returns None if the namespace is invalid or if the units are invalid
"""
price_table = get_epoch_namespace_prices( block_height, units )
if price_table is None:
... | [
"def",
"price_namespace",
"(",
"namespace_id",
",",
"block_height",
",",
"units",
")",
":",
"price_table",
"=",
"get_epoch_namespace_prices",
"(",
"block_height",
",",
"units",
")",
"if",
"price_table",
"is",
"None",
":",
"return",
"None",
"if",
"len",
"(",
"n... | Calculate the cost of a namespace.
Returns the price on success
Returns None if the namespace is invalid or if the units are invalid | [
"Calculate",
"the",
"cost",
"of",
"a",
"namespace",
".",
"Returns",
"the",
"price",
"on",
"success",
"Returns",
"None",
"if",
"the",
"namespace",
"is",
"invalid",
"or",
"if",
"the",
"units",
"are",
"invalid"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L311-L324 |
230,636 | blockstack/blockstack-core | blockstack/lib/scripts.py | find_by_opcode | def find_by_opcode( checked_ops, opcode ):
"""
Given all previously-accepted operations in this block,
find the ones that are of a particular opcode.
@opcode can be one opcode, or a list of opcodes
>>> find_by_opcode([{'op': '+'}, {'op': '>'}], 'NAME_UPDATE')
[{'op': '+'}]
>>> find_by_... | python | def find_by_opcode( checked_ops, opcode ):
"""
Given all previously-accepted operations in this block,
find the ones that are of a particular opcode.
@opcode can be one opcode, or a list of opcodes
>>> find_by_opcode([{'op': '+'}, {'op': '>'}], 'NAME_UPDATE')
[{'op': '+'}]
>>> find_by_... | [
"def",
"find_by_opcode",
"(",
"checked_ops",
",",
"opcode",
")",
":",
"if",
"type",
"(",
"opcode",
")",
"!=",
"list",
":",
"opcode",
"=",
"[",
"opcode",
"]",
"ret",
"=",
"[",
"]",
"for",
"opdata",
"in",
"checked_ops",
":",
"if",
"op_get_opcode_name",
"... | Given all previously-accepted operations in this block,
find the ones that are of a particular opcode.
@opcode can be one opcode, or a list of opcodes
>>> find_by_opcode([{'op': '+'}, {'op': '>'}], 'NAME_UPDATE')
[{'op': '+'}]
>>> find_by_opcode([{'op': '+'}, {'op': '>'}], ['NAME_UPDATE', 'NAM... | [
"Given",
"all",
"previously",
"-",
"accepted",
"operations",
"in",
"this",
"block",
"find",
"the",
"ones",
"that",
"are",
"of",
"a",
"particular",
"opcode",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L327-L352 |
230,637 | blockstack/blockstack-core | blockstack/lib/scripts.py | get_public_key_hex_from_tx | def get_public_key_hex_from_tx( inputs, address ):
"""
Given a list of inputs and the address of one of the inputs,
find the public key.
This only works for p2pkh scripts.
We only really need this for NAMESPACE_REVEAL, but we included
it in other transactions' consensus data for legacy reason... | python | def get_public_key_hex_from_tx( inputs, address ):
"""
Given a list of inputs and the address of one of the inputs,
find the public key.
This only works for p2pkh scripts.
We only really need this for NAMESPACE_REVEAL, but we included
it in other transactions' consensus data for legacy reason... | [
"def",
"get_public_key_hex_from_tx",
"(",
"inputs",
",",
"address",
")",
":",
"ret",
"=",
"None",
"for",
"inp",
"in",
"inputs",
":",
"input_scriptsig",
"=",
"inp",
"[",
"'script'",
"]",
"input_script_code",
"=",
"virtualchain",
".",
"btc_script_deserialize",
"("... | Given a list of inputs and the address of one of the inputs,
find the public key.
This only works for p2pkh scripts.
We only really need this for NAMESPACE_REVEAL, but we included
it in other transactions' consensus data for legacy reasons that
now have to be supported forever :( | [
"Given",
"a",
"list",
"of",
"inputs",
"and",
"the",
"address",
"of",
"one",
"of",
"the",
"inputs",
"find",
"the",
"public",
"key",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L355-L388 |
230,638 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_name | def check_name(name):
"""
Verify the name is well-formed
>>> check_name(123)
False
>>> check_name('')
False
>>> check_name('abc')
False
>>> check_name('abc.def')
True
>>> check_name('abc.def.ghi')
False
>>> check_name('abc.d-ef')
True
>>> check_name('abc.d+ef... | python | def check_name(name):
"""
Verify the name is well-formed
>>> check_name(123)
False
>>> check_name('')
False
>>> check_name('abc')
False
>>> check_name('abc.def')
True
>>> check_name('abc.def.ghi')
False
>>> check_name('abc.d-ef')
True
>>> check_name('abc.d+ef... | [
"def",
"check_name",
"(",
"name",
")",
":",
"if",
"type",
"(",
"name",
")",
"not",
"in",
"[",
"str",
",",
"unicode",
"]",
":",
"return",
"False",
"if",
"not",
"is_name_valid",
"(",
"name",
")",
":",
"return",
"False",
"return",
"True"
] | Verify the name is well-formed
>>> check_name(123)
False
>>> check_name('')
False
>>> check_name('abc')
False
>>> check_name('abc.def')
True
>>> check_name('abc.def.ghi')
False
>>> check_name('abc.d-ef')
True
>>> check_name('abc.d+ef')
False
>>> check_name('.... | [
"Verify",
"the",
"name",
"is",
"well",
"-",
"formed"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L391-L424 |
230,639 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_namespace | def check_namespace(namespace_id):
"""
Verify that a namespace ID is well-formed
>>> check_namespace(123)
False
>>> check_namespace(None)
False
>>> check_namespace('')
False
>>> check_namespace('abcd')
True
>>> check_namespace('Abcd')
False
>>> check_namespace('a+bcd... | python | def check_namespace(namespace_id):
"""
Verify that a namespace ID is well-formed
>>> check_namespace(123)
False
>>> check_namespace(None)
False
>>> check_namespace('')
False
>>> check_namespace('abcd')
True
>>> check_namespace('Abcd')
False
>>> check_namespace('a+bcd... | [
"def",
"check_namespace",
"(",
"namespace_id",
")",
":",
"if",
"type",
"(",
"namespace_id",
")",
"not",
"in",
"[",
"str",
",",
"unicode",
"]",
":",
"return",
"False",
"if",
"not",
"is_namespace_valid",
"(",
"namespace_id",
")",
":",
"return",
"False",
"ret... | Verify that a namespace ID is well-formed
>>> check_namespace(123)
False
>>> check_namespace(None)
False
>>> check_namespace('')
False
>>> check_namespace('abcd')
True
>>> check_namespace('Abcd')
False
>>> check_namespace('a+bcd')
False
>>> check_namespace('.abcd')
... | [
"Verify",
"that",
"a",
"namespace",
"ID",
"is",
"well",
"-",
"formed"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L427-L456 |
230,640 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_token_type | def check_token_type(token_type):
"""
Verify that a token type is well-formed
>>> check_token_type('STACKS')
True
>>> check_token_type('BTC')
False
>>> check_token_type('abcdabcdabcd')
True
>>> check_token_type('abcdabcdabcdabcdabcd')
False
"""
return check_string(token_... | python | def check_token_type(token_type):
"""
Verify that a token type is well-formed
>>> check_token_type('STACKS')
True
>>> check_token_type('BTC')
False
>>> check_token_type('abcdabcdabcd')
True
>>> check_token_type('abcdabcdabcdabcdabcd')
False
"""
return check_string(token_... | [
"def",
"check_token_type",
"(",
"token_type",
")",
":",
"return",
"check_string",
"(",
"token_type",
",",
"min_length",
"=",
"1",
",",
"max_length",
"=",
"LENGTHS",
"[",
"'namespace_id'",
"]",
",",
"pattern",
"=",
"'^{}$|{}'",
".",
"format",
"(",
"TOKEN_TYPE_S... | Verify that a token type is well-formed
>>> check_token_type('STACKS')
True
>>> check_token_type('BTC')
False
>>> check_token_type('abcdabcdabcd')
True
>>> check_token_type('abcdabcdabcdabcdabcd')
False | [
"Verify",
"that",
"a",
"token",
"type",
"is",
"well",
"-",
"formed"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L459-L472 |
230,641 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_subdomain | def check_subdomain(fqn):
"""
Verify that the given fqn is a subdomain
>>> check_subdomain('a.b.c')
True
>>> check_subdomain(123)
False
>>> check_subdomain('a.b.c.d')
False
>>> check_subdomain('A.b.c')
False
>>> check_subdomain('abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab... | python | def check_subdomain(fqn):
"""
Verify that the given fqn is a subdomain
>>> check_subdomain('a.b.c')
True
>>> check_subdomain(123)
False
>>> check_subdomain('a.b.c.d')
False
>>> check_subdomain('A.b.c')
False
>>> check_subdomain('abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab... | [
"def",
"check_subdomain",
"(",
"fqn",
")",
":",
"if",
"type",
"(",
"fqn",
")",
"not",
"in",
"[",
"str",
",",
"unicode",
"]",
":",
"return",
"False",
"if",
"not",
"is_subdomain",
"(",
"fqn",
")",
":",
"return",
"False",
"return",
"True"
] | Verify that the given fqn is a subdomain
>>> check_subdomain('a.b.c')
True
>>> check_subdomain(123)
False
>>> check_subdomain('a.b.c.d')
False
>>> check_subdomain('A.b.c')
False
>>> check_subdomain('abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.a.b')
True
>>> check_subdom... | [
"Verify",
"that",
"the",
"given",
"fqn",
"is",
"a",
"subdomain"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L475-L502 |
230,642 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_block | def check_block(block_id):
"""
Verify that a block ID is valid
>>> check_block(FIRST_BLOCK_MAINNET)
True
>>> check_block(FIRST_BLOCK_MAINNET-1)
False
>>> check_block(-1)
False
>>> check_block("abc")
False
>>> check_block(int(1e7) + 1)
False
>>> check_block(int(1e7) -... | python | def check_block(block_id):
"""
Verify that a block ID is valid
>>> check_block(FIRST_BLOCK_MAINNET)
True
>>> check_block(FIRST_BLOCK_MAINNET-1)
False
>>> check_block(-1)
False
>>> check_block("abc")
False
>>> check_block(int(1e7) + 1)
False
>>> check_block(int(1e7) -... | [
"def",
"check_block",
"(",
"block_id",
")",
":",
"if",
"type",
"(",
"block_id",
")",
"not",
"in",
"[",
"int",
",",
"long",
"]",
":",
"return",
"False",
"if",
"BLOCKSTACK_TEST",
":",
"if",
"block_id",
"<=",
"0",
":",
"return",
"False",
"else",
":",
"i... | Verify that a block ID is valid
>>> check_block(FIRST_BLOCK_MAINNET)
True
>>> check_block(FIRST_BLOCK_MAINNET-1)
False
>>> check_block(-1)
False
>>> check_block("abc")
False
>>> check_block(int(1e7) + 1)
False
>>> check_block(int(1e7) - 1)
True | [
"Verify",
"that",
"a",
"block",
"ID",
"is",
"valid"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L505-L537 |
230,643 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_offset | def check_offset(offset, max_value=None):
"""
Verify that an offset is valid
>>> check_offset(0)
True
>>> check_offset(-1)
False
>>> check_offset(2, max_value=2)
True
>>> check_offset(0)
True
>>> check_offset(2, max_value=1)
False
>>> check_offset('abc')
False
... | python | def check_offset(offset, max_value=None):
"""
Verify that an offset is valid
>>> check_offset(0)
True
>>> check_offset(-1)
False
>>> check_offset(2, max_value=2)
True
>>> check_offset(0)
True
>>> check_offset(2, max_value=1)
False
>>> check_offset('abc')
False
... | [
"def",
"check_offset",
"(",
"offset",
",",
"max_value",
"=",
"None",
")",
":",
"if",
"type",
"(",
"offset",
")",
"not",
"in",
"[",
"int",
",",
"long",
"]",
":",
"return",
"False",
"if",
"offset",
"<",
"0",
":",
"return",
"False",
"if",
"max_value",
... | Verify that an offset is valid
>>> check_offset(0)
True
>>> check_offset(-1)
False
>>> check_offset(2, max_value=2)
True
>>> check_offset(0)
True
>>> check_offset(2, max_value=1)
False
>>> check_offset('abc')
False | [
"Verify",
"that",
"an",
"offset",
"is",
"valid"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L540-L566 |
230,644 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_string | def check_string(value, min_length=None, max_length=None, pattern=None):
"""
verify that a string has a particular size and conforms
to a particular alphabet
>>> check_string(1)
False
>>> check_string(None)
False
>>> check_string(True)
False
>>> check_string({})
False
>>... | python | def check_string(value, min_length=None, max_length=None, pattern=None):
"""
verify that a string has a particular size and conforms
to a particular alphabet
>>> check_string(1)
False
>>> check_string(None)
False
>>> check_string(True)
False
>>> check_string({})
False
>>... | [
"def",
"check_string",
"(",
"value",
",",
"min_length",
"=",
"None",
",",
"max_length",
"=",
"None",
",",
"pattern",
"=",
"None",
")",
":",
"if",
"type",
"(",
"value",
")",
"not",
"in",
"[",
"str",
",",
"unicode",
"]",
":",
"return",
"False",
"if",
... | verify that a string has a particular size and conforms
to a particular alphabet
>>> check_string(1)
False
>>> check_string(None)
False
>>> check_string(True)
False
>>> check_string({})
False
>>> check_string([])
False
>>> check_string((1,2))
False
>>> check_stri... | [
"verify",
"that",
"a",
"string",
"has",
"a",
"particular",
"size",
"and",
"conforms",
"to",
"a",
"particular",
"alphabet"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L606-L654 |
230,645 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_address | def check_address(address):
"""
verify that a string is a base58check address
>>> check_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg')
True
>>> check_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJh')
False
>>> check_address('mkkJsS22dnDJhD8duFkpGnHNr9uz3JEcWu')
True
>>> check_address('mk... | python | def check_address(address):
"""
verify that a string is a base58check address
>>> check_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg')
True
>>> check_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJh')
False
>>> check_address('mkkJsS22dnDJhD8duFkpGnHNr9uz3JEcWu')
True
>>> check_address('mk... | [
"def",
"check_address",
"(",
"address",
")",
":",
"if",
"not",
"check_string",
"(",
"address",
",",
"min_length",
"=",
"26",
",",
"max_length",
"=",
"35",
",",
"pattern",
"=",
"OP_ADDRESS_PATTERN",
")",
":",
"return",
"False",
"try",
":",
"keylib",
".",
... | verify that a string is a base58check address
>>> check_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg')
True
>>> check_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJh')
False
>>> check_address('mkkJsS22dnDJhD8duFkpGnHNr9uz3JEcWu')
True
>>> check_address('mkkJsS22dnDJhD8duFkpGnHNr9uz3JEcWv')
F... | [
"verify",
"that",
"a",
"string",
"is",
"a",
"base58check",
"address"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L657-L689 |
230,646 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_account_address | def check_account_address(address):
"""
verify that a string is a valid account address.
Can be a b58-check address, a c32-check address, as well as the string "treasury" or "unallocated" or a string starting with 'not_distributed_'
>>> check_account_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg')
Tr... | python | def check_account_address(address):
"""
verify that a string is a valid account address.
Can be a b58-check address, a c32-check address, as well as the string "treasury" or "unallocated" or a string starting with 'not_distributed_'
>>> check_account_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg')
Tr... | [
"def",
"check_account_address",
"(",
"address",
")",
":",
"if",
"address",
"==",
"'treasury'",
"or",
"address",
"==",
"'unallocated'",
":",
"return",
"True",
"if",
"address",
".",
"startswith",
"(",
"'not_distributed_'",
")",
"and",
"len",
"(",
"address",
")",... | verify that a string is a valid account address.
Can be a b58-check address, a c32-check address, as well as the string "treasury" or "unallocated" or a string starting with 'not_distributed_'
>>> check_account_address('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg')
True
>>> check_account_address('16EMaNw3pkn3v6... | [
"verify",
"that",
"a",
"string",
"is",
"a",
"valid",
"account",
"address",
".",
"Can",
"be",
"a",
"b58",
"-",
"check",
"address",
"a",
"c32",
"-",
"check",
"address",
"as",
"well",
"as",
"the",
"string",
"treasury",
"or",
"unallocated",
"or",
"a",
"str... | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L692-L731 |
230,647 | blockstack/blockstack-core | blockstack/lib/scripts.py | check_tx_output_types | def check_tx_output_types(outputs, block_height):
"""
Verify that the list of transaction outputs are acceptable
"""
# for now, we do not allow nonstandard outputs (all outputs must be p2pkh or p2sh outputs)
# this excludes bech32 outputs, for example.
supported_output_types = get_epoch_btc_scri... | python | def check_tx_output_types(outputs, block_height):
"""
Verify that the list of transaction outputs are acceptable
"""
# for now, we do not allow nonstandard outputs (all outputs must be p2pkh or p2sh outputs)
# this excludes bech32 outputs, for example.
supported_output_types = get_epoch_btc_scri... | [
"def",
"check_tx_output_types",
"(",
"outputs",
",",
"block_height",
")",
":",
"# for now, we do not allow nonstandard outputs (all outputs must be p2pkh or p2sh outputs)",
"# this excludes bech32 outputs, for example.",
"supported_output_types",
"=",
"get_epoch_btc_script_types",
"(",
"... | Verify that the list of transaction outputs are acceptable | [
"Verify",
"that",
"the",
"list",
"of",
"transaction",
"outputs",
"are",
"acceptable"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L734-L747 |
230,648 | blockstack/blockstack-core | blockstack/lib/scripts.py | address_as_b58 | def address_as_b58(addr):
"""
Given a b58check or c32check address,
return the b58check encoding
"""
if is_c32_address(addr):
return c32ToB58(addr)
else:
if check_address(addr):
return addr
else:
raise ValueError('Address {} is not b58 or c32'.for... | python | def address_as_b58(addr):
"""
Given a b58check or c32check address,
return the b58check encoding
"""
if is_c32_address(addr):
return c32ToB58(addr)
else:
if check_address(addr):
return addr
else:
raise ValueError('Address {} is not b58 or c32'.for... | [
"def",
"address_as_b58",
"(",
"addr",
")",
":",
"if",
"is_c32_address",
"(",
"addr",
")",
":",
"return",
"c32ToB58",
"(",
"addr",
")",
"else",
":",
"if",
"check_address",
"(",
"addr",
")",
":",
"return",
"addr",
"else",
":",
"raise",
"ValueError",
"(",
... | Given a b58check or c32check address,
return the b58check encoding | [
"Given",
"a",
"b58check",
"or",
"c32check",
"address",
"return",
"the",
"b58check",
"encoding"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/scripts.py#L770-L782 |
230,649 | blockstack/blockstack-core | blockstack/lib/subdomains.py | verify | def verify(address, plaintext, scriptSigb64):
"""
Verify that a given plaintext is signed by the given scriptSig, given the address
"""
assert isinstance(address, str)
assert isinstance(scriptSigb64, str)
scriptSig = base64.b64decode(scriptSigb64)
hash_hex = hashlib.sha256(plaintext).hexdig... | python | def verify(address, plaintext, scriptSigb64):
"""
Verify that a given plaintext is signed by the given scriptSig, given the address
"""
assert isinstance(address, str)
assert isinstance(scriptSigb64, str)
scriptSig = base64.b64decode(scriptSigb64)
hash_hex = hashlib.sha256(plaintext).hexdig... | [
"def",
"verify",
"(",
"address",
",",
"plaintext",
",",
"scriptSigb64",
")",
":",
"assert",
"isinstance",
"(",
"address",
",",
"str",
")",
"assert",
"isinstance",
"(",
"scriptSigb64",
",",
"str",
")",
"scriptSig",
"=",
"base64",
".",
"b64decode",
"(",
"scr... | Verify that a given plaintext is signed by the given scriptSig, given the address | [
"Verify",
"that",
"a",
"given",
"plaintext",
"is",
"signed",
"by",
"the",
"given",
"scriptSig",
"given",
"the",
"address"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1727-L1745 |
230,650 | blockstack/blockstack-core | blockstack/lib/subdomains.py | verify_singlesig | def verify_singlesig(address, hash_hex, scriptSig):
"""
Verify that a p2pkh address is signed by the given pay-to-pubkey-hash scriptsig
"""
try:
sighex, pubkey_hex = virtualchain.btc_script_deserialize(scriptSig)
except:
log.warn("Wrong signature structure for {}".format(address))
... | python | def verify_singlesig(address, hash_hex, scriptSig):
"""
Verify that a p2pkh address is signed by the given pay-to-pubkey-hash scriptsig
"""
try:
sighex, pubkey_hex = virtualchain.btc_script_deserialize(scriptSig)
except:
log.warn("Wrong signature structure for {}".format(address))
... | [
"def",
"verify_singlesig",
"(",
"address",
",",
"hash_hex",
",",
"scriptSig",
")",
":",
"try",
":",
"sighex",
",",
"pubkey_hex",
"=",
"virtualchain",
".",
"btc_script_deserialize",
"(",
"scriptSig",
")",
"except",
":",
"log",
".",
"warn",
"(",
"\"Wrong signatu... | Verify that a p2pkh address is signed by the given pay-to-pubkey-hash scriptsig | [
"Verify",
"that",
"a",
"p2pkh",
"address",
"is",
"signed",
"by",
"the",
"given",
"pay",
"-",
"to",
"-",
"pubkey",
"-",
"hash",
"scriptsig"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1748-L1764 |
230,651 | blockstack/blockstack-core | blockstack/lib/subdomains.py | verify_multisig | def verify_multisig(address, hash_hex, scriptSig):
"""
verify that a p2sh address is signed by the given scriptsig
"""
script_parts = virtualchain.btc_script_deserialize(scriptSig)
if len(script_parts) < 2:
log.warn("Verfiying multisig failed, couldn't grab script parts")
return Fals... | python | def verify_multisig(address, hash_hex, scriptSig):
"""
verify that a p2sh address is signed by the given scriptsig
"""
script_parts = virtualchain.btc_script_deserialize(scriptSig)
if len(script_parts) < 2:
log.warn("Verfiying multisig failed, couldn't grab script parts")
return Fals... | [
"def",
"verify_multisig",
"(",
"address",
",",
"hash_hex",
",",
"scriptSig",
")",
":",
"script_parts",
"=",
"virtualchain",
".",
"btc_script_deserialize",
"(",
"scriptSig",
")",
"if",
"len",
"(",
"script_parts",
")",
"<",
"2",
":",
"log",
".",
"warn",
"(",
... | verify that a p2sh address is signed by the given scriptsig | [
"verify",
"that",
"a",
"p2sh",
"address",
"is",
"signed",
"by",
"the",
"given",
"scriptsig"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1767-L1800 |
230,652 | blockstack/blockstack-core | blockstack/lib/subdomains.py | is_subdomain_missing_zonefiles_record | def is_subdomain_missing_zonefiles_record(rec):
"""
Does a given parsed zone file TXT record encode a missing-zonefile vector?
Return True if so
Return False if not
"""
if rec['name'] != SUBDOMAIN_TXT_RR_MISSING:
return False
txt_entry = rec['txt']
if isinstance(txt_entry, list)... | python | def is_subdomain_missing_zonefiles_record(rec):
"""
Does a given parsed zone file TXT record encode a missing-zonefile vector?
Return True if so
Return False if not
"""
if rec['name'] != SUBDOMAIN_TXT_RR_MISSING:
return False
txt_entry = rec['txt']
if isinstance(txt_entry, list)... | [
"def",
"is_subdomain_missing_zonefiles_record",
"(",
"rec",
")",
":",
"if",
"rec",
"[",
"'name'",
"]",
"!=",
"SUBDOMAIN_TXT_RR_MISSING",
":",
"return",
"False",
"txt_entry",
"=",
"rec",
"[",
"'txt'",
"]",
"if",
"isinstance",
"(",
"txt_entry",
",",
"list",
")",... | Does a given parsed zone file TXT record encode a missing-zonefile vector?
Return True if so
Return False if not | [
"Does",
"a",
"given",
"parsed",
"zone",
"file",
"TXT",
"record",
"encode",
"a",
"missing",
"-",
"zonefile",
"vector?",
"Return",
"True",
"if",
"so",
"Return",
"False",
"if",
"not"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1810-L1830 |
230,653 | blockstack/blockstack-core | blockstack/lib/subdomains.py | is_subdomain_record | def is_subdomain_record(rec):
"""
Does a given parsed zone file TXT record (@rec) encode a subdomain?
Return True if so
Return False if not
"""
txt_entry = rec['txt']
if not isinstance(txt_entry, list):
return False
has_parts_entry = False
has_pk_entry = False
has_seqn_e... | python | def is_subdomain_record(rec):
"""
Does a given parsed zone file TXT record (@rec) encode a subdomain?
Return True if so
Return False if not
"""
txt_entry = rec['txt']
if not isinstance(txt_entry, list):
return False
has_parts_entry = False
has_pk_entry = False
has_seqn_e... | [
"def",
"is_subdomain_record",
"(",
"rec",
")",
":",
"txt_entry",
"=",
"rec",
"[",
"'txt'",
"]",
"if",
"not",
"isinstance",
"(",
"txt_entry",
",",
"list",
")",
":",
"return",
"False",
"has_parts_entry",
"=",
"False",
"has_pk_entry",
"=",
"False",
"has_seqn_en... | Does a given parsed zone file TXT record (@rec) encode a subdomain?
Return True if so
Return False if not | [
"Does",
"a",
"given",
"parsed",
"zone",
"file",
"TXT",
"record",
"("
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1833-L1854 |
230,654 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomain_info | def get_subdomain_info(fqn, db_path=None, atlasdb_path=None, zonefiles_dir=None, check_pending=False, include_did=False):
"""
Static method for getting the state of a subdomain, given its fully-qualified name.
Return the subdomain record on success.
Return None if not found.
"""
opts = get_block... | python | def get_subdomain_info(fqn, db_path=None, atlasdb_path=None, zonefiles_dir=None, check_pending=False, include_did=False):
"""
Static method for getting the state of a subdomain, given its fully-qualified name.
Return the subdomain record on success.
Return None if not found.
"""
opts = get_block... | [
"def",
"get_subdomain_info",
"(",
"fqn",
",",
"db_path",
"=",
"None",
",",
"atlasdb_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
",",
"check_pending",
"=",
"False",
",",
"include_did",
"=",
"False",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"("... | Static method for getting the state of a subdomain, given its fully-qualified name.
Return the subdomain record on success.
Return None if not found. | [
"Static",
"method",
"for",
"getting",
"the",
"state",
"of",
"a",
"subdomain",
"given",
"its",
"fully",
"-",
"qualified",
"name",
".",
"Return",
"the",
"subdomain",
"record",
"on",
"success",
".",
"Return",
"None",
"if",
"not",
"found",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1857-L1894 |
230,655 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomain_resolver | def get_subdomain_resolver(name, db_path=None, zonefiles_dir=None):
"""
Static method for determining the last-known resolver for a domain name.
Returns the resolver URL on success
Returns None on error
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
log.warn("Su... | python | def get_subdomain_resolver(name, db_path=None, zonefiles_dir=None):
"""
Static method for determining the last-known resolver for a domain name.
Returns the resolver URL on success
Returns None on error
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
log.warn("Su... | [
"def",
"get_subdomain_resolver",
"(",
"name",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"log",
".",
"warn",
"(",
"\"S... | Static method for determining the last-known resolver for a domain name.
Returns the resolver URL on success
Returns None on error | [
"Static",
"method",
"for",
"determining",
"the",
"last",
"-",
"known",
"resolver",
"for",
"a",
"domain",
"name",
".",
"Returns",
"the",
"resolver",
"URL",
"on",
"success",
"Returns",
"None",
"on",
"error"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1897-L1917 |
230,656 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomains_count | def get_subdomains_count(db_path=None, zonefiles_dir=None):
"""
Static method for getting count of all subdomains
Return number of subdomains on success
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
log.warn("Subdomain support is disabled")
return None
... | python | def get_subdomains_count(db_path=None, zonefiles_dir=None):
"""
Static method for getting count of all subdomains
Return number of subdomains on success
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
log.warn("Subdomain support is disabled")
return None
... | [
"def",
"get_subdomains_count",
"(",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"log",
".",
"warn",
"(",
"\"Subdomain support is... | Static method for getting count of all subdomains
Return number of subdomains on success | [
"Static",
"method",
"for",
"getting",
"count",
"of",
"all",
"subdomains",
"Return",
"number",
"of",
"subdomains",
"on",
"success"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1920-L1937 |
230,657 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomain_DID_info | def get_subdomain_DID_info(fqn, db_path=None, zonefiles_dir=None):
"""
Get a subdomain's DID info.
Return None if not found
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
log.warn("Subdomain support is disabled")
return None
if db_path is None:
... | python | def get_subdomain_DID_info(fqn, db_path=None, zonefiles_dir=None):
"""
Get a subdomain's DID info.
Return None if not found
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
log.warn("Subdomain support is disabled")
return None
if db_path is None:
... | [
"def",
"get_subdomain_DID_info",
"(",
"fqn",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"log",
".",
"warn",
"(",
"\"Su... | Get a subdomain's DID info.
Return None if not found | [
"Get",
"a",
"subdomain",
"s",
"DID",
"info",
".",
"Return",
"None",
"if",
"not",
"found"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1940-L1966 |
230,658 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_DID_subdomain | def get_DID_subdomain(did, db_path=None, zonefiles_dir=None, atlasdb_path=None, check_pending=False):
"""
Static method for resolving a DID to a subdomain
Return the subdomain record on success
Return None on error
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
... | python | def get_DID_subdomain(did, db_path=None, zonefiles_dir=None, atlasdb_path=None, check_pending=False):
"""
Static method for resolving a DID to a subdomain
Return the subdomain record on success
Return None on error
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
... | [
"def",
"get_DID_subdomain",
"(",
"did",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
",",
"atlasdb_path",
"=",
"None",
",",
"check_pending",
"=",
"False",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_... | Static method for resolving a DID to a subdomain
Return the subdomain record on success
Return None on error | [
"Static",
"method",
"for",
"resolving",
"a",
"DID",
"to",
"a",
"subdomain",
"Return",
"the",
"subdomain",
"record",
"on",
"success",
"Return",
"None",
"on",
"error"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1969-L2005 |
230,659 | blockstack/blockstack-core | blockstack/lib/subdomains.py | is_subdomain_zonefile_hash | def is_subdomain_zonefile_hash(fqn, zonefile_hash, db_path=None, zonefiles_dir=None):
"""
Static method for getting all historic zone file hashes for a subdomain
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['su... | python | def is_subdomain_zonefile_hash(fqn, zonefile_hash, db_path=None, zonefiles_dir=None):
"""
Static method for getting all historic zone file hashes for a subdomain
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['su... | [
"def",
"is_subdomain_zonefile_hash",
"(",
"fqn",
",",
"zonefile_hash",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"return"... | Static method for getting all historic zone file hashes for a subdomain | [
"Static",
"method",
"for",
"getting",
"all",
"historic",
"zone",
"file",
"hashes",
"for",
"a",
"subdomain"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2008-L2024 |
230,660 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomain_history | def get_subdomain_history(fqn, offset=None, count=None, reverse=False, db_path=None, zonefiles_dir=None, json=False):
"""
Static method for getting all historic operations on a subdomain
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
... | python | def get_subdomain_history(fqn, offset=None, count=None, reverse=False, db_path=None, zonefiles_dir=None, json=False):
"""
Static method for getting all historic operations on a subdomain
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
... | [
"def",
"get_subdomain_history",
"(",
"fqn",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
",",
"reverse",
"=",
"False",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
",",
"json",
"=",
"False",
")",
":",
"opts",
"=",
"get_bloc... | Static method for getting all historic operations on a subdomain | [
"Static",
"method",
"for",
"getting",
"all",
"historic",
"operations",
"on",
"a",
"subdomain"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2027-L2063 |
230,661 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_all_subdomains | def get_all_subdomains(offset=None, count=None, min_sequence=None, db_path=None, zonefiles_dir=None):
"""
Static method for getting the list of all subdomains
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['subdo... | python | def get_all_subdomains(offset=None, count=None, min_sequence=None, db_path=None, zonefiles_dir=None):
"""
Static method for getting the list of all subdomains
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['subdo... | [
"def",
"get_all_subdomains",
"(",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
",",
"min_sequence",
"=",
"None",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is... | Static method for getting the list of all subdomains | [
"Static",
"method",
"for",
"getting",
"the",
"list",
"of",
"all",
"subdomains"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2066-L2081 |
230,662 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomain_ops_at_txid | def get_subdomain_ops_at_txid(txid, db_path=None, zonefiles_dir=None):
"""
Static method for getting the list of subdomain operations accepted at a given txid.
Includes unaccepted subdomain operations
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if ... | python | def get_subdomain_ops_at_txid(txid, db_path=None, zonefiles_dir=None):
"""
Static method for getting the list of subdomain operations accepted at a given txid.
Includes unaccepted subdomain operations
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if ... | [
"def",
"get_subdomain_ops_at_txid",
"(",
"txid",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"return",
"[",
"]",
"if",
... | Static method for getting the list of subdomain operations accepted at a given txid.
Includes unaccepted subdomain operations | [
"Static",
"method",
"for",
"getting",
"the",
"list",
"of",
"subdomain",
"operations",
"accepted",
"at",
"a",
"given",
"txid",
".",
"Includes",
"unaccepted",
"subdomain",
"operations"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2084-L2100 |
230,663 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomains_owned_by_address | def get_subdomains_owned_by_address(address, db_path=None, zonefiles_dir=None):
"""
Static method for getting the list of subdomains for a given address
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['subdomaindb... | python | def get_subdomains_owned_by_address(address, db_path=None, zonefiles_dir=None):
"""
Static method for getting the list of subdomains for a given address
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['subdomaindb... | [
"def",
"get_subdomains_owned_by_address",
"(",
"address",
",",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"return",
"[",
"]",
... | Static method for getting the list of subdomains for a given address | [
"Static",
"method",
"for",
"getting",
"the",
"list",
"of",
"subdomains",
"for",
"a",
"given",
"address"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2103-L2118 |
230,664 | blockstack/blockstack-core | blockstack/lib/subdomains.py | get_subdomain_last_sequence | def get_subdomain_last_sequence(db_path=None, zonefiles_dir=None):
"""
Static method for getting the last sequence number in the database
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['subdomaindb_path']
if... | python | def get_subdomain_last_sequence(db_path=None, zonefiles_dir=None):
"""
Static method for getting the last sequence number in the database
"""
opts = get_blockstack_opts()
if not is_subdomains_enabled(opts):
return []
if db_path is None:
db_path = opts['subdomaindb_path']
if... | [
"def",
"get_subdomain_last_sequence",
"(",
"db_path",
"=",
"None",
",",
"zonefiles_dir",
"=",
"None",
")",
":",
"opts",
"=",
"get_blockstack_opts",
"(",
")",
"if",
"not",
"is_subdomains_enabled",
"(",
"opts",
")",
":",
"return",
"[",
"]",
"if",
"db_path",
"i... | Static method for getting the last sequence number in the database | [
"Static",
"method",
"for",
"getting",
"the",
"last",
"sequence",
"number",
"in",
"the",
"database"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2121-L2136 |
230,665 | blockstack/blockstack-core | blockstack/lib/subdomains.py | sign | def sign(privkey_bundle, plaintext):
"""
Sign a subdomain plaintext with a private key bundle
Returns the base64-encoded scriptsig
"""
if virtualchain.is_singlesig(privkey_bundle):
return sign_singlesig(privkey_bundle, plaintext)
elif virtualchain.is_multisig(privkey_bundle):
ret... | python | def sign(privkey_bundle, plaintext):
"""
Sign a subdomain plaintext with a private key bundle
Returns the base64-encoded scriptsig
"""
if virtualchain.is_singlesig(privkey_bundle):
return sign_singlesig(privkey_bundle, plaintext)
elif virtualchain.is_multisig(privkey_bundle):
ret... | [
"def",
"sign",
"(",
"privkey_bundle",
",",
"plaintext",
")",
":",
"if",
"virtualchain",
".",
"is_singlesig",
"(",
"privkey_bundle",
")",
":",
"return",
"sign_singlesig",
"(",
"privkey_bundle",
",",
"plaintext",
")",
"elif",
"virtualchain",
".",
"is_multisig",
"(... | Sign a subdomain plaintext with a private key bundle
Returns the base64-encoded scriptsig | [
"Sign",
"a",
"subdomain",
"plaintext",
"with",
"a",
"private",
"key",
"bundle",
"Returns",
"the",
"base64",
"-",
"encoded",
"scriptsig"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2152-L2162 |
230,666 | blockstack/blockstack-core | blockstack/lib/subdomains.py | subdomains_init | def subdomains_init(blockstack_opts, working_dir, atlas_state):
"""
Set up subdomain state
Returns a SubdomainIndex object that has been successfully connected to Atlas
"""
if not is_subdomains_enabled(blockstack_opts):
return None
subdomain_state = SubdomainIndex(blockstack_opts['subdo... | python | def subdomains_init(blockstack_opts, working_dir, atlas_state):
"""
Set up subdomain state
Returns a SubdomainIndex object that has been successfully connected to Atlas
"""
if not is_subdomains_enabled(blockstack_opts):
return None
subdomain_state = SubdomainIndex(blockstack_opts['subdo... | [
"def",
"subdomains_init",
"(",
"blockstack_opts",
",",
"working_dir",
",",
"atlas_state",
")",
":",
"if",
"not",
"is_subdomains_enabled",
"(",
"blockstack_opts",
")",
":",
"return",
"None",
"subdomain_state",
"=",
"SubdomainIndex",
"(",
"blockstack_opts",
"[",
"'sub... | Set up subdomain state
Returns a SubdomainIndex object that has been successfully connected to Atlas | [
"Set",
"up",
"subdomain",
"state",
"Returns",
"a",
"SubdomainIndex",
"object",
"that",
"has",
"been",
"successfully",
"connected",
"to",
"Atlas"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L2220-L2231 |
230,667 | blockstack/blockstack-core | blockstack/lib/subdomains.py | Subdomain.verify_signature | def verify_signature(self, addr):
"""
Given an address, verify whether or not it was signed by it
"""
return verify(virtualchain.address_reencode(addr), self.get_plaintext_to_sign(), self.sig) | python | def verify_signature(self, addr):
"""
Given an address, verify whether or not it was signed by it
"""
return verify(virtualchain.address_reencode(addr), self.get_plaintext_to_sign(), self.sig) | [
"def",
"verify_signature",
"(",
"self",
",",
"addr",
")",
":",
"return",
"verify",
"(",
"virtualchain",
".",
"address_reencode",
"(",
"addr",
")",
",",
"self",
".",
"get_plaintext_to_sign",
"(",
")",
",",
"self",
".",
"sig",
")"
] | Given an address, verify whether or not it was signed by it | [
"Given",
"an",
"address",
"verify",
"whether",
"or",
"not",
"it",
"was",
"signed",
"by",
"it"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L202-L206 |
230,668 | blockstack/blockstack-core | blockstack/lib/subdomains.py | Subdomain.serialize_to_txt | def serialize_to_txt(self):
"""
Serialize this subdomain record to a TXT record. The trailing newline will be omitted
"""
txtrec = {
'name': self.fqn if self.independent else self.subdomain,
'txt': self.pack_subdomain()[1:]
}
return blockstack_zon... | python | def serialize_to_txt(self):
"""
Serialize this subdomain record to a TXT record. The trailing newline will be omitted
"""
txtrec = {
'name': self.fqn if self.independent else self.subdomain,
'txt': self.pack_subdomain()[1:]
}
return blockstack_zon... | [
"def",
"serialize_to_txt",
"(",
"self",
")",
":",
"txtrec",
"=",
"{",
"'name'",
":",
"self",
".",
"fqn",
"if",
"self",
".",
"independent",
"else",
"self",
".",
"subdomain",
",",
"'txt'",
":",
"self",
".",
"pack_subdomain",
"(",
")",
"[",
"1",
":",
"]... | Serialize this subdomain record to a TXT record. The trailing newline will be omitted | [
"Serialize",
"this",
"subdomain",
"record",
"to",
"a",
"TXT",
"record",
".",
"The",
"trailing",
"newline",
"will",
"be",
"omitted"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L224-L232 |
230,669 | blockstack/blockstack-core | blockstack/lib/subdomains.py | Subdomain.parse_subdomain_missing_zonefiles_record | def parse_subdomain_missing_zonefiles_record(cls, rec):
"""
Parse a missing-zonefiles vector given by the domain.
Returns the list of zone file indexes on success
Raises ParseError on unparseable records
"""
txt_entry = rec['txt']
if isinstance(txt_entry, list):
... | python | def parse_subdomain_missing_zonefiles_record(cls, rec):
"""
Parse a missing-zonefiles vector given by the domain.
Returns the list of zone file indexes on success
Raises ParseError on unparseable records
"""
txt_entry = rec['txt']
if isinstance(txt_entry, list):
... | [
"def",
"parse_subdomain_missing_zonefiles_record",
"(",
"cls",
",",
"rec",
")",
":",
"txt_entry",
"=",
"rec",
"[",
"'txt'",
"]",
"if",
"isinstance",
"(",
"txt_entry",
",",
"list",
")",
":",
"raise",
"ParseError",
"(",
"\"TXT entry too long for a missing zone file li... | Parse a missing-zonefiles vector given by the domain.
Returns the list of zone file indexes on success
Raises ParseError on unparseable records | [
"Parse",
"a",
"missing",
"-",
"zonefiles",
"vector",
"given",
"by",
"the",
"domain",
".",
"Returns",
"the",
"list",
"of",
"zone",
"file",
"indexes",
"on",
"success",
"Raises",
"ParseError",
"on",
"unparseable",
"records"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L260-L273 |
230,670 | blockstack/blockstack-core | blockstack/lib/subdomains.py | Subdomain.get_public_key | def get_public_key(self):
"""
Parse the scriptSig and extract the public key.
Raises ValueError if this is a multisig-controlled subdomain.
"""
res = self.get_public_key_info()
if 'error' in res:
raise ValueError(res['error'])
if res['type'] != 'singl... | python | def get_public_key(self):
"""
Parse the scriptSig and extract the public key.
Raises ValueError if this is a multisig-controlled subdomain.
"""
res = self.get_public_key_info()
if 'error' in res:
raise ValueError(res['error'])
if res['type'] != 'singl... | [
"def",
"get_public_key",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"get_public_key_info",
"(",
")",
"if",
"'error'",
"in",
"res",
":",
"raise",
"ValueError",
"(",
"res",
"[",
"'error'",
"]",
")",
"if",
"res",
"[",
"'type'",
"]",
"!=",
"'singlesig... | Parse the scriptSig and extract the public key.
Raises ValueError if this is a multisig-controlled subdomain. | [
"Parse",
"the",
"scriptSig",
"and",
"extract",
"the",
"public",
"key",
".",
"Raises",
"ValueError",
"if",
"this",
"is",
"a",
"multisig",
"-",
"controlled",
"subdomain",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L345-L357 |
230,671 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.close | def close(self):
"""
Close the index
"""
with self.subdomain_db_lock:
self.subdomain_db.close()
self.subdomain_db = None
self.subdomain_db_path = None | python | def close(self):
"""
Close the index
"""
with self.subdomain_db_lock:
self.subdomain_db.close()
self.subdomain_db = None
self.subdomain_db_path = None | [
"def",
"close",
"(",
"self",
")",
":",
"with",
"self",
".",
"subdomain_db_lock",
":",
"self",
".",
"subdomain_db",
".",
"close",
"(",
")",
"self",
".",
"subdomain_db",
"=",
"None",
"self",
".",
"subdomain_db_path",
"=",
"None"
] | Close the index | [
"Close",
"the",
"index"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L441-L448 |
230,672 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.make_new_subdomain_history | def make_new_subdomain_history(self, cursor, subdomain_rec):
"""
Recalculate the history for this subdomain from genesis up until this record.
Returns the list of subdomain records we need to save.
"""
# what's the subdomain's history up until this subdomain record?
hist ... | python | def make_new_subdomain_history(self, cursor, subdomain_rec):
"""
Recalculate the history for this subdomain from genesis up until this record.
Returns the list of subdomain records we need to save.
"""
# what's the subdomain's history up until this subdomain record?
hist ... | [
"def",
"make_new_subdomain_history",
"(",
"self",
",",
"cursor",
",",
"subdomain_rec",
")",
":",
"# what's the subdomain's history up until this subdomain record?",
"hist",
"=",
"self",
".",
"subdomain_db",
".",
"get_subdomain_history",
"(",
"subdomain_rec",
".",
"get_fqn",... | Recalculate the history for this subdomain from genesis up until this record.
Returns the list of subdomain records we need to save. | [
"Recalculate",
"the",
"history",
"for",
"this",
"subdomain",
"from",
"genesis",
"up",
"until",
"this",
"record",
".",
"Returns",
"the",
"list",
"of",
"subdomain",
"records",
"we",
"need",
"to",
"save",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L570-L605 |
230,673 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.make_new_subdomain_future | def make_new_subdomain_future(self, cursor, subdomain_rec):
"""
Recalculate the future for this subdomain from the current record
until the latest known record.
Returns the list of subdomain records we need to save.
"""
assert subdomain_rec.accepted, 'BUG: given subdomain... | python | def make_new_subdomain_future(self, cursor, subdomain_rec):
"""
Recalculate the future for this subdomain from the current record
until the latest known record.
Returns the list of subdomain records we need to save.
"""
assert subdomain_rec.accepted, 'BUG: given subdomain... | [
"def",
"make_new_subdomain_future",
"(",
"self",
",",
"cursor",
",",
"subdomain_rec",
")",
":",
"assert",
"subdomain_rec",
".",
"accepted",
",",
"'BUG: given subdomain record must already be accepted'",
"# what's the subdomain's future after this record?",
"fut",
"=",
"self",
... | Recalculate the future for this subdomain from the current record
until the latest known record.
Returns the list of subdomain records we need to save. | [
"Recalculate",
"the",
"future",
"for",
"this",
"subdomain",
"from",
"the",
"current",
"record",
"until",
"the",
"latest",
"known",
"record",
".",
"Returns",
"the",
"list",
"of",
"subdomain",
"records",
"we",
"need",
"to",
"save",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L608-L647 |
230,674 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.subdomain_try_insert | def subdomain_try_insert(self, cursor, subdomain_rec, history_neighbors):
"""
Try to insert a subdomain record into its history neighbors.
This is an optimization that handles the "usual" case.
We can do this without having to rewrite this subdomain's past and future
if (1) we c... | python | def subdomain_try_insert(self, cursor, subdomain_rec, history_neighbors):
"""
Try to insert a subdomain record into its history neighbors.
This is an optimization that handles the "usual" case.
We can do this without having to rewrite this subdomain's past and future
if (1) we c... | [
"def",
"subdomain_try_insert",
"(",
"self",
",",
"cursor",
",",
"subdomain_rec",
",",
"history_neighbors",
")",
":",
"blockchain_order",
"=",
"history_neighbors",
"[",
"'prev'",
"]",
"+",
"history_neighbors",
"[",
"'cur'",
"]",
"+",
"history_neighbors",
"[",
"'fut... | Try to insert a subdomain record into its history neighbors.
This is an optimization that handles the "usual" case.
We can do this without having to rewrite this subdomain's past and future
if (1) we can find a previously-accepted subdomain record, and (2) the transition
from this subd... | [
"Try",
"to",
"insert",
"a",
"subdomain",
"record",
"into",
"its",
"history",
"neighbors",
".",
"This",
"is",
"an",
"optimization",
"that",
"handles",
"the",
"usual",
"case",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L684-L743 |
230,675 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.enqueue_zonefile | def enqueue_zonefile(self, zonefile_hash, block_height):
"""
Called when we discover a zone file. Queues up a request to reprocess this name's zone files' subdomains.
zonefile_hash is the hash of the zonefile.
block_height is the minimium block height at which this zone file occurs.
... | python | def enqueue_zonefile(self, zonefile_hash, block_height):
"""
Called when we discover a zone file. Queues up a request to reprocess this name's zone files' subdomains.
zonefile_hash is the hash of the zonefile.
block_height is the minimium block height at which this zone file occurs.
... | [
"def",
"enqueue_zonefile",
"(",
"self",
",",
"zonefile_hash",
",",
"block_height",
")",
":",
"with",
"self",
".",
"serialized_enqueue_zonefile",
":",
"log",
".",
"debug",
"(",
"\"Append {} from {}\"",
".",
"format",
"(",
"zonefile_hash",
",",
"block_height",
")",
... | Called when we discover a zone file. Queues up a request to reprocess this name's zone files' subdomains.
zonefile_hash is the hash of the zonefile.
block_height is the minimium block height at which this zone file occurs.
This gets called by:
* AtlasZonefileCrawler (as it's "store_zon... | [
"Called",
"when",
"we",
"discover",
"a",
"zone",
"file",
".",
"Queues",
"up",
"a",
"request",
"to",
"reprocess",
"this",
"name",
"s",
"zone",
"files",
"subdomains",
".",
"zonefile_hash",
"is",
"the",
"hash",
"of",
"the",
"zonefile",
".",
"block_height",
"i... | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L823-L835 |
230,676 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.index_blockchain | def index_blockchain(self, block_start, block_end):
"""
Go through the sequence of zone files discovered in a block range, and reindex the names' subdomains.
"""
log.debug("Processing subdomain updates for zonefiles in blocks {}-{}".format(block_start, block_end))
res = ... | python | def index_blockchain(self, block_start, block_end):
"""
Go through the sequence of zone files discovered in a block range, and reindex the names' subdomains.
"""
log.debug("Processing subdomain updates for zonefiles in blocks {}-{}".format(block_start, block_end))
res = ... | [
"def",
"index_blockchain",
"(",
"self",
",",
"block_start",
",",
"block_end",
")",
":",
"log",
".",
"debug",
"(",
"\"Processing subdomain updates for zonefiles in blocks {}-{}\"",
".",
"format",
"(",
"block_start",
",",
"block_end",
")",
")",
"res",
"=",
"self",
"... | Go through the sequence of zone files discovered in a block range, and reindex the names' subdomains. | [
"Go",
"through",
"the",
"sequence",
"of",
"zone",
"files",
"discovered",
"in",
"a",
"block",
"range",
"and",
"reindex",
"the",
"names",
"subdomains",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L838-L847 |
230,677 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainIndex.index_discovered_zonefiles | def index_discovered_zonefiles(self, lastblock):
"""
Go through the list of zone files we discovered via Atlas, grouped by name and ordered by block height.
Find all subsequent zone files for this name, and process all subdomain operations contained within them.
"""
all_queued_zf... | python | def index_discovered_zonefiles(self, lastblock):
"""
Go through the list of zone files we discovered via Atlas, grouped by name and ordered by block height.
Find all subsequent zone files for this name, and process all subdomain operations contained within them.
"""
all_queued_zf... | [
"def",
"index_discovered_zonefiles",
"(",
"self",
",",
"lastblock",
")",
":",
"all_queued_zfinfos",
"=",
"[",
"]",
"# contents of the queue",
"subdomain_zonefile_infos",
"=",
"{",
"}",
"# map subdomain fqn to list of zonefile info bundles, for process_subdomains",
"name_blocks",
... | Go through the list of zone files we discovered via Atlas, grouped by name and ordered by block height.
Find all subsequent zone files for this name, and process all subdomain operations contained within them. | [
"Go",
"through",
"the",
"list",
"of",
"zone",
"files",
"we",
"discovered",
"via",
"Atlas",
"grouped",
"by",
"name",
"and",
"ordered",
"by",
"block",
"height",
".",
"Find",
"all",
"subsequent",
"zone",
"files",
"for",
"this",
"name",
"and",
"process",
"all"... | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L850-L929 |
230,678 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.subdomain_row_factory | def subdomain_row_factory(cls, cursor, row):
"""
Dict row factory for subdomains
"""
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d | python | def subdomain_row_factory(cls, cursor, row):
"""
Dict row factory for subdomains
"""
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d | [
"def",
"subdomain_row_factory",
"(",
"cls",
",",
"cursor",
",",
"row",
")",
":",
"d",
"=",
"{",
"}",
"for",
"idx",
",",
"col",
"in",
"enumerate",
"(",
"cursor",
".",
"description",
")",
":",
"d",
"[",
"col",
"[",
"0",
"]",
"]",
"=",
"row",
"[",
... | Dict row factory for subdomains | [
"Dict",
"row",
"factory",
"for",
"subdomains"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1000-L1008 |
230,679 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB._extract_subdomain | def _extract_subdomain(self, rowdata):
"""
Extract a single subdomain from a DB cursor
Raise SubdomainNotFound if there are no valid rows
"""
name = str(rowdata['fully_qualified_subdomain'])
domain = str(rowdata['domain'])
n = str(rowdata['sequence'])
enco... | python | def _extract_subdomain(self, rowdata):
"""
Extract a single subdomain from a DB cursor
Raise SubdomainNotFound if there are no valid rows
"""
name = str(rowdata['fully_qualified_subdomain'])
domain = str(rowdata['domain'])
n = str(rowdata['sequence'])
enco... | [
"def",
"_extract_subdomain",
"(",
"self",
",",
"rowdata",
")",
":",
"name",
"=",
"str",
"(",
"rowdata",
"[",
"'fully_qualified_subdomain'",
"]",
")",
"domain",
"=",
"str",
"(",
"rowdata",
"[",
"'domain'",
"]",
")",
"n",
"=",
"str",
"(",
"rowdata",
"[",
... | Extract a single subdomain from a DB cursor
Raise SubdomainNotFound if there are no valid rows | [
"Extract",
"a",
"single",
"subdomain",
"from",
"a",
"DB",
"cursor",
"Raise",
"SubdomainNotFound",
"if",
"there",
"are",
"no",
"valid",
"rows"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1025-L1065 |
230,680 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_subdomains_count | def get_subdomains_count(self, accepted=True, cur=None):
"""
Fetch subdomain names
"""
if accepted:
accepted_filter = 'WHERE accepted=1'
else:
accepted_filter = ''
get_cmd = "SELECT COUNT(DISTINCT fully_qualified_subdomain) as count FROM {} {};".f... | python | def get_subdomains_count(self, accepted=True, cur=None):
"""
Fetch subdomain names
"""
if accepted:
accepted_filter = 'WHERE accepted=1'
else:
accepted_filter = ''
get_cmd = "SELECT COUNT(DISTINCT fully_qualified_subdomain) as count FROM {} {};".f... | [
"def",
"get_subdomains_count",
"(",
"self",
",",
"accepted",
"=",
"True",
",",
"cur",
"=",
"None",
")",
":",
"if",
"accepted",
":",
"accepted_filter",
"=",
"'WHERE accepted=1'",
"else",
":",
"accepted_filter",
"=",
"''",
"get_cmd",
"=",
"\"SELECT COUNT(DISTINCT ... | Fetch subdomain names | [
"Fetch",
"subdomain",
"names"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1068-L1092 |
230,681 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_all_subdomains | def get_all_subdomains(self, offset=None, count=None, min_sequence=None, cur=None):
"""
Get and all subdomain names, optionally over a range
"""
get_cmd = 'SELECT DISTINCT fully_qualified_subdomain FROM {}'.format(self.subdomain_table)
args = ()
if min_sequence is not No... | python | def get_all_subdomains(self, offset=None, count=None, min_sequence=None, cur=None):
"""
Get and all subdomain names, optionally over a range
"""
get_cmd = 'SELECT DISTINCT fully_qualified_subdomain FROM {}'.format(self.subdomain_table)
args = ()
if min_sequence is not No... | [
"def",
"get_all_subdomains",
"(",
"self",
",",
"offset",
"=",
"None",
",",
"count",
"=",
"None",
",",
"min_sequence",
"=",
"None",
",",
"cur",
"=",
"None",
")",
":",
"get_cmd",
"=",
"'SELECT DISTINCT fully_qualified_subdomain FROM {}'",
".",
"format",
"(",
"se... | Get and all subdomain names, optionally over a range | [
"Get",
"and",
"all",
"subdomain",
"names",
"optionally",
"over",
"a",
"range"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1095-L1127 |
230,682 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_subdomain_ops_at_txid | def get_subdomain_ops_at_txid(self, txid, cur=None):
"""
Given a txid, get all subdomain operations at that txid.
Include unaccepted operations.
Order by zone file index
"""
get_cmd = 'SELECT * FROM {} WHERE txid = ? ORDER BY zonefile_offset'.format(self.subdomain_table)
... | python | def get_subdomain_ops_at_txid(self, txid, cur=None):
"""
Given a txid, get all subdomain operations at that txid.
Include unaccepted operations.
Order by zone file index
"""
get_cmd = 'SELECT * FROM {} WHERE txid = ? ORDER BY zonefile_offset'.format(self.subdomain_table)
... | [
"def",
"get_subdomain_ops_at_txid",
"(",
"self",
",",
"txid",
",",
"cur",
"=",
"None",
")",
":",
"get_cmd",
"=",
"'SELECT * FROM {} WHERE txid = ? ORDER BY zonefile_offset'",
".",
"format",
"(",
"self",
".",
"subdomain_table",
")",
"cursor",
"=",
"None",
"if",
"cu... | Given a txid, get all subdomain operations at that txid.
Include unaccepted operations.
Order by zone file index | [
"Given",
"a",
"txid",
"get",
"all",
"subdomain",
"operations",
"at",
"that",
"txid",
".",
"Include",
"unaccepted",
"operations",
".",
"Order",
"by",
"zone",
"file",
"index"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1202-L1224 |
230,683 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_subdomains_owned_by_address | def get_subdomains_owned_by_address(self, owner, cur=None):
"""
Get the list of subdomain names that are owned by a given address.
"""
get_cmd = "SELECT fully_qualified_subdomain, MAX(sequence) FROM {} WHERE owner = ? AND accepted=1 GROUP BY fully_qualified_subdomain".format(self.subdoma... | python | def get_subdomains_owned_by_address(self, owner, cur=None):
"""
Get the list of subdomain names that are owned by a given address.
"""
get_cmd = "SELECT fully_qualified_subdomain, MAX(sequence) FROM {} WHERE owner = ? AND accepted=1 GROUP BY fully_qualified_subdomain".format(self.subdoma... | [
"def",
"get_subdomains_owned_by_address",
"(",
"self",
",",
"owner",
",",
"cur",
"=",
"None",
")",
":",
"get_cmd",
"=",
"\"SELECT fully_qualified_subdomain, MAX(sequence) FROM {} WHERE owner = ? AND accepted=1 GROUP BY fully_qualified_subdomain\"",
".",
"format",
"(",
"self",
"... | Get the list of subdomain names that are owned by a given address. | [
"Get",
"the",
"list",
"of",
"subdomain",
"names",
"that",
"are",
"owned",
"by",
"a",
"given",
"address",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1227-L1247 |
230,684 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_domain_resolver | def get_domain_resolver(self, domain_name, cur=None):
"""
Get the last-knwon resolver entry for a domain name
Returns None if not found.
"""
get_cmd = "SELECT resolver FROM {} WHERE domain=? AND resolver != '' AND accepted=1 ORDER BY sequence DESC, parent_zonefile_index DESC LIMI... | python | def get_domain_resolver(self, domain_name, cur=None):
"""
Get the last-knwon resolver entry for a domain name
Returns None if not found.
"""
get_cmd = "SELECT resolver FROM {} WHERE domain=? AND resolver != '' AND accepted=1 ORDER BY sequence DESC, parent_zonefile_index DESC LIMI... | [
"def",
"get_domain_resolver",
"(",
"self",
",",
"domain_name",
",",
"cur",
"=",
"None",
")",
":",
"get_cmd",
"=",
"\"SELECT resolver FROM {} WHERE domain=? AND resolver != '' AND accepted=1 ORDER BY sequence DESC, parent_zonefile_index DESC LIMIT 1;\"",
".",
"format",
"(",
"self"... | Get the last-knwon resolver entry for a domain name
Returns None if not found. | [
"Get",
"the",
"last",
"-",
"knwon",
"resolver",
"entry",
"for",
"a",
"domain",
"name",
"Returns",
"None",
"if",
"not",
"found",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1250-L1269 |
230,685 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_subdomain_DID_info | def get_subdomain_DID_info(self, fqn, cur=None):
"""
Get the DID information for a subdomain.
Raise SubdomainNotFound if there is no such subdomain
Return {'name_type': ..., 'address': ..., 'index': ...}
"""
subrec = self.get_subdomain_entry_at_sequence(fqn, 0, cur=cur)
... | python | def get_subdomain_DID_info(self, fqn, cur=None):
"""
Get the DID information for a subdomain.
Raise SubdomainNotFound if there is no such subdomain
Return {'name_type': ..., 'address': ..., 'index': ...}
"""
subrec = self.get_subdomain_entry_at_sequence(fqn, 0, cur=cur)
... | [
"def",
"get_subdomain_DID_info",
"(",
"self",
",",
"fqn",
",",
"cur",
"=",
"None",
")",
":",
"subrec",
"=",
"self",
".",
"get_subdomain_entry_at_sequence",
"(",
"fqn",
",",
"0",
",",
"cur",
"=",
"cur",
")",
"cmd",
"=",
"'SELECT zonefile_offset FROM {} WHERE fu... | Get the DID information for a subdomain.
Raise SubdomainNotFound if there is no such subdomain
Return {'name_type': ..., 'address': ..., 'index': ...} | [
"Get",
"the",
"DID",
"information",
"for",
"a",
"subdomain",
".",
"Raise",
"SubdomainNotFound",
"if",
"there",
"is",
"no",
"such",
"subdomain"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1272-L1311 |
230,686 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_DID_subdomain | def get_DID_subdomain(self, did, cur=None):
"""
Get a subdomain, given its DID
Raise ValueError if the DID is invalid
Raise SubdomainNotFound if the DID does not correspond to a subdomain
"""
did = str(did)
try:
did_info = parse_DID(did)
a... | python | def get_DID_subdomain(self, did, cur=None):
"""
Get a subdomain, given its DID
Raise ValueError if the DID is invalid
Raise SubdomainNotFound if the DID does not correspond to a subdomain
"""
did = str(did)
try:
did_info = parse_DID(did)
a... | [
"def",
"get_DID_subdomain",
"(",
"self",
",",
"did",
",",
"cur",
"=",
"None",
")",
":",
"did",
"=",
"str",
"(",
"did",
")",
"try",
":",
"did_info",
"=",
"parse_DID",
"(",
"did",
")",
"assert",
"did_info",
"[",
"'name_type'",
"]",
"==",
"'subdomain'",
... | Get a subdomain, given its DID
Raise ValueError if the DID is invalid
Raise SubdomainNotFound if the DID does not correspond to a subdomain | [
"Get",
"a",
"subdomain",
"given",
"its",
"DID",
"Raise",
"ValueError",
"if",
"the",
"DID",
"is",
"invalid",
"Raise",
"SubdomainNotFound",
"if",
"the",
"DID",
"does",
"not",
"correspond",
"to",
"a",
"subdomain"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1314-L1354 |
230,687 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.is_subdomain_zonefile_hash | def is_subdomain_zonefile_hash(self, fqn, zonefile_hash, cur=None):
"""
Does this zone file hash belong to this subdomain?
"""
sql = 'SELECT COUNT(zonefile_hash) FROM {} WHERE fully_qualified_subdomain = ? and zonefile_hash = ?;'.format(self.subdomain_table)
args = (fqn,zonefile_... | python | def is_subdomain_zonefile_hash(self, fqn, zonefile_hash, cur=None):
"""
Does this zone file hash belong to this subdomain?
"""
sql = 'SELECT COUNT(zonefile_hash) FROM {} WHERE fully_qualified_subdomain = ? and zonefile_hash = ?;'.format(self.subdomain_table)
args = (fqn,zonefile_... | [
"def",
"is_subdomain_zonefile_hash",
"(",
"self",
",",
"fqn",
",",
"zonefile_hash",
",",
"cur",
"=",
"None",
")",
":",
"sql",
"=",
"'SELECT COUNT(zonefile_hash) FROM {} WHERE fully_qualified_subdomain = ? and zonefile_hash = ?;'",
".",
"format",
"(",
"self",
".",
"subdoma... | Does this zone file hash belong to this subdomain? | [
"Does",
"this",
"zone",
"file",
"hash",
"belong",
"to",
"this",
"subdomain?"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1357-L1377 |
230,688 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.update_subdomain_entry | def update_subdomain_entry(self, subdomain_obj, cur=None):
"""
Update the subdomain history table for this subdomain entry.
Creates it if it doesn't exist.
Return True on success
Raise exception on error
"""
# sanity checks
assert isinstance(subdomain_obj... | python | def update_subdomain_entry(self, subdomain_obj, cur=None):
"""
Update the subdomain history table for this subdomain entry.
Creates it if it doesn't exist.
Return True on success
Raise exception on error
"""
# sanity checks
assert isinstance(subdomain_obj... | [
"def",
"update_subdomain_entry",
"(",
"self",
",",
"subdomain_obj",
",",
"cur",
"=",
"None",
")",
":",
"# sanity checks",
"assert",
"isinstance",
"(",
"subdomain_obj",
",",
"Subdomain",
")",
"# NOTE: there is no need to call fsync() on the zone file fd here---we already have ... | Update the subdomain history table for this subdomain entry.
Creates it if it doesn't exist.
Return True on success
Raise exception on error | [
"Update",
"the",
"subdomain",
"history",
"table",
"for",
"this",
"subdomain",
"entry",
".",
"Creates",
"it",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1435-L1478 |
230,689 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_last_block | def get_last_block(self, cur=None):
"""
Get the highest block last processed
"""
sql = 'SELECT MAX(block_height) FROM {};'.format(self.subdomain_table)
cursor = None
if cur is None:
cursor = self.conn.cursor()
else:
cursor = cur
ro... | python | def get_last_block(self, cur=None):
"""
Get the highest block last processed
"""
sql = 'SELECT MAX(block_height) FROM {};'.format(self.subdomain_table)
cursor = None
if cur is None:
cursor = self.conn.cursor()
else:
cursor = cur
ro... | [
"def",
"get_last_block",
"(",
"self",
",",
"cur",
"=",
"None",
")",
":",
"sql",
"=",
"'SELECT MAX(block_height) FROM {};'",
".",
"format",
"(",
"self",
".",
"subdomain_table",
")",
"cursor",
"=",
"None",
"if",
"cur",
"is",
"None",
":",
"cursor",
"=",
"self... | Get the highest block last processed | [
"Get",
"the",
"highest",
"block",
"last",
"processed"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1513-L1532 |
230,690 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB.get_last_sequence | def get_last_sequence(self, cur=None):
"""
Get the highest sequence number in this db
"""
sql = 'SELECT sequence FROM {} ORDER BY sequence DESC LIMIT 1;'.format(self.subdomain_table)
cursor = None
if cur is None:
cursor = self.conn.cursor()
else:
... | python | def get_last_sequence(self, cur=None):
"""
Get the highest sequence number in this db
"""
sql = 'SELECT sequence FROM {} ORDER BY sequence DESC LIMIT 1;'.format(self.subdomain_table)
cursor = None
if cur is None:
cursor = self.conn.cursor()
else:
... | [
"def",
"get_last_sequence",
"(",
"self",
",",
"cur",
"=",
"None",
")",
":",
"sql",
"=",
"'SELECT sequence FROM {} ORDER BY sequence DESC LIMIT 1;'",
".",
"format",
"(",
"self",
".",
"subdomain_table",
")",
"cursor",
"=",
"None",
"if",
"cur",
"is",
"None",
":",
... | Get the highest sequence number in this db | [
"Get",
"the",
"highest",
"sequence",
"number",
"in",
"this",
"db"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1535-L1553 |
230,691 | blockstack/blockstack-core | blockstack/lib/subdomains.py | SubdomainDB._drop_tables | def _drop_tables(self):
"""
Clear the subdomain db's tables
"""
drop_cmd = "DROP TABLE IF EXISTS {};"
for table in [self.subdomain_table, self.blocked_table]:
cursor = self.conn.cursor()
db_query_execute(cursor, drop_cmd.format(table), ()) | python | def _drop_tables(self):
"""
Clear the subdomain db's tables
"""
drop_cmd = "DROP TABLE IF EXISTS {};"
for table in [self.subdomain_table, self.blocked_table]:
cursor = self.conn.cursor()
db_query_execute(cursor, drop_cmd.format(table), ()) | [
"def",
"_drop_tables",
"(",
"self",
")",
":",
"drop_cmd",
"=",
"\"DROP TABLE IF EXISTS {};\"",
"for",
"table",
"in",
"[",
"self",
".",
"subdomain_table",
",",
"self",
".",
"blocked_table",
"]",
":",
"cursor",
"=",
"self",
".",
"conn",
".",
"cursor",
"(",
"... | Clear the subdomain db's tables | [
"Clear",
"the",
"subdomain",
"db",
"s",
"tables"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L1556-L1563 |
230,692 | blockstack/blockstack-core | blockstack/lib/hashing.py | hash_name | def hash_name(name, script_pubkey, register_addr=None):
"""
Generate the hash over a name and hex-string script pubkey
"""
bin_name = b40_to_bin(name)
name_and_pubkey = bin_name + unhexlify(script_pubkey)
if register_addr is not None:
name_and_pubkey += str(register_addr)
return hex_has... | python | def hash_name(name, script_pubkey, register_addr=None):
"""
Generate the hash over a name and hex-string script pubkey
"""
bin_name = b40_to_bin(name)
name_and_pubkey = bin_name + unhexlify(script_pubkey)
if register_addr is not None:
name_and_pubkey += str(register_addr)
return hex_has... | [
"def",
"hash_name",
"(",
"name",
",",
"script_pubkey",
",",
"register_addr",
"=",
"None",
")",
":",
"bin_name",
"=",
"b40_to_bin",
"(",
"name",
")",
"name_and_pubkey",
"=",
"bin_name",
"+",
"unhexlify",
"(",
"script_pubkey",
")",
"if",
"register_addr",
"is",
... | Generate the hash over a name and hex-string script pubkey | [
"Generate",
"the",
"hash",
"over",
"a",
"name",
"and",
"hex",
"-",
"string",
"script",
"pubkey"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/hashing.py#L32-L42 |
230,693 | blockstack/blockstack-core | api/search/basic_index.py | fetch_profile_data_from_file | def fetch_profile_data_from_file():
""" takes profile data from file and saves in the profile_data DB
"""
with open(SEARCH_PROFILE_DATA_FILE, 'r') as fin:
profiles = json.load(fin)
counter = 0
log.debug("-" * 5)
log.debug("Fetching profile data from file")
for entry in profiles:
... | python | def fetch_profile_data_from_file():
""" takes profile data from file and saves in the profile_data DB
"""
with open(SEARCH_PROFILE_DATA_FILE, 'r') as fin:
profiles = json.load(fin)
counter = 0
log.debug("-" * 5)
log.debug("Fetching profile data from file")
for entry in profiles:
... | [
"def",
"fetch_profile_data_from_file",
"(",
")",
":",
"with",
"open",
"(",
"SEARCH_PROFILE_DATA_FILE",
",",
"'r'",
")",
"as",
"fin",
":",
"profiles",
"=",
"json",
".",
"load",
"(",
"fin",
")",
"counter",
"=",
"0",
"log",
".",
"debug",
"(",
"\"-\"",
"*",
... | takes profile data from file and saves in the profile_data DB | [
"takes",
"profile",
"data",
"from",
"file",
"and",
"saves",
"in",
"the",
"profile_data",
"DB"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/api/search/basic_index.py#L65-L95 |
230,694 | blockstack/blockstack-core | api/search/basic_index.py | create_search_index | def create_search_index():
""" takes people names from blockchain and writes deduped names in a 'cache'
"""
# create people name cache
counter = 0
people_names = []
twitter_handles = []
usernames = []
log.debug("-" * 5)
log.debug("Creating search index")
for user in namespace... | python | def create_search_index():
""" takes people names from blockchain and writes deduped names in a 'cache'
"""
# create people name cache
counter = 0
people_names = []
twitter_handles = []
usernames = []
log.debug("-" * 5)
log.debug("Creating search index")
for user in namespace... | [
"def",
"create_search_index",
"(",
")",
":",
"# create people name cache",
"counter",
"=",
"0",
"people_names",
"=",
"[",
"]",
"twitter_handles",
"=",
"[",
"]",
"usernames",
"=",
"[",
"]",
"log",
".",
"debug",
"(",
"\"-\"",
"*",
"5",
")",
"log",
".",
"de... | takes people names from blockchain and writes deduped names in a 'cache' | [
"takes",
"people",
"names",
"from",
"blockchain",
"and",
"writes",
"deduped",
"names",
"in",
"a",
"cache"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/api/search/basic_index.py#L177-L277 |
230,695 | blockstack/blockstack-core | blockstack/lib/operations/__init__.py | op_extract | def op_extract(op_name, data, senders, inputs, outputs, block_id, vtxindex, txid):
"""
Extract an operation from transaction data.
Return the extracted fields as a dict.
"""
global EXTRACT_METHODS
if op_name not in EXTRACT_METHODS.keys():
raise Exception("No such operation '%s'" % op_na... | python | def op_extract(op_name, data, senders, inputs, outputs, block_id, vtxindex, txid):
"""
Extract an operation from transaction data.
Return the extracted fields as a dict.
"""
global EXTRACT_METHODS
if op_name not in EXTRACT_METHODS.keys():
raise Exception("No such operation '%s'" % op_na... | [
"def",
"op_extract",
"(",
"op_name",
",",
"data",
",",
"senders",
",",
"inputs",
",",
"outputs",
",",
"block_id",
",",
"vtxindex",
",",
"txid",
")",
":",
"global",
"EXTRACT_METHODS",
"if",
"op_name",
"not",
"in",
"EXTRACT_METHODS",
".",
"keys",
"(",
")",
... | Extract an operation from transaction data.
Return the extracted fields as a dict. | [
"Extract",
"an",
"operation",
"from",
"transaction",
"data",
".",
"Return",
"the",
"extracted",
"fields",
"as",
"a",
"dict",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/operations/__init__.py#L183-L195 |
230,696 | blockstack/blockstack-core | blockstack/lib/operations/__init__.py | op_canonicalize | def op_canonicalize(op_name, parsed_op):
"""
Get the canonical representation of a parsed operation's data.
Meant for backwards-compatibility
"""
global CANONICALIZE_METHODS
if op_name not in CANONICALIZE_METHODS:
# no canonicalization needed
return parsed_op
else:
r... | python | def op_canonicalize(op_name, parsed_op):
"""
Get the canonical representation of a parsed operation's data.
Meant for backwards-compatibility
"""
global CANONICALIZE_METHODS
if op_name not in CANONICALIZE_METHODS:
# no canonicalization needed
return parsed_op
else:
r... | [
"def",
"op_canonicalize",
"(",
"op_name",
",",
"parsed_op",
")",
":",
"global",
"CANONICALIZE_METHODS",
"if",
"op_name",
"not",
"in",
"CANONICALIZE_METHODS",
":",
"# no canonicalization needed",
"return",
"parsed_op",
"else",
":",
"return",
"CANONICALIZE_METHODS",
"[",
... | Get the canonical representation of a parsed operation's data.
Meant for backwards-compatibility | [
"Get",
"the",
"canonical",
"representation",
"of",
"a",
"parsed",
"operation",
"s",
"data",
".",
"Meant",
"for",
"backwards",
"-",
"compatibility"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/operations/__init__.py#L198-L209 |
230,697 | blockstack/blockstack-core | blockstack/lib/operations/__init__.py | op_decanonicalize | def op_decanonicalize(op_name, canonical_op):
"""
Get the current representation of a parsed operation's data, given the canonical representation
Meant for backwards-compatibility
"""
global DECANONICALIZE_METHODS
if op_name not in DECANONICALIZE_METHODS:
# no decanonicalization needed
... | python | def op_decanonicalize(op_name, canonical_op):
"""
Get the current representation of a parsed operation's data, given the canonical representation
Meant for backwards-compatibility
"""
global DECANONICALIZE_METHODS
if op_name not in DECANONICALIZE_METHODS:
# no decanonicalization needed
... | [
"def",
"op_decanonicalize",
"(",
"op_name",
",",
"canonical_op",
")",
":",
"global",
"DECANONICALIZE_METHODS",
"if",
"op_name",
"not",
"in",
"DECANONICALIZE_METHODS",
":",
"# no decanonicalization needed",
"return",
"canonical_op",
"else",
":",
"return",
"DECANONICALIZE_M... | Get the current representation of a parsed operation's data, given the canonical representation
Meant for backwards-compatibility | [
"Get",
"the",
"current",
"representation",
"of",
"a",
"parsed",
"operation",
"s",
"data",
"given",
"the",
"canonical",
"representation",
"Meant",
"for",
"backwards",
"-",
"compatibility"
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/operations/__init__.py#L212-L223 |
230,698 | blockstack/blockstack-core | blockstack/lib/operations/__init__.py | op_check | def op_check( state_engine, nameop, block_id, checked_ops ):
"""
Given the state engine, the current block, the list of pending
operations processed so far, and the current operation, determine
whether or not it should be accepted.
The operation is allowed to be "type-cast" to a new operation, but ... | python | def op_check( state_engine, nameop, block_id, checked_ops ):
"""
Given the state engine, the current block, the list of pending
operations processed so far, and the current operation, determine
whether or not it should be accepted.
The operation is allowed to be "type-cast" to a new operation, but ... | [
"def",
"op_check",
"(",
"state_engine",
",",
"nameop",
",",
"block_id",
",",
"checked_ops",
")",
":",
"global",
"CHECK_METHODS",
",",
"MUTATE_FIELDS",
"nameop_clone",
"=",
"copy",
".",
"deepcopy",
"(",
"nameop",
")",
"opcode",
"=",
"None",
"if",
"'opcode'",
... | Given the state engine, the current block, the list of pending
operations processed so far, and the current operation, determine
whether or not it should be accepted.
The operation is allowed to be "type-cast" to a new operation, but only once.
If this happens, the operation will be checked again.
... | [
"Given",
"the",
"state",
"engine",
"the",
"current",
"block",
"the",
"list",
"of",
"pending",
"operations",
"processed",
"so",
"far",
"and",
"the",
"current",
"operation",
"determine",
"whether",
"or",
"not",
"it",
"should",
"be",
"accepted",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/operations/__init__.py#L284-L343 |
230,699 | blockstack/blockstack-core | blockstack/lib/operations/__init__.py | op_get_mutate_fields | def op_get_mutate_fields( op_name ):
"""
Get the names of the fields that will change
when this operation gets applied to a record.
"""
global MUTATE_FIELDS
if op_name not in MUTATE_FIELDS.keys():
raise Exception("No such operation '%s'" % op_name)
fields = MUTATE_FIELDS[op_name][:... | python | def op_get_mutate_fields( op_name ):
"""
Get the names of the fields that will change
when this operation gets applied to a record.
"""
global MUTATE_FIELDS
if op_name not in MUTATE_FIELDS.keys():
raise Exception("No such operation '%s'" % op_name)
fields = MUTATE_FIELDS[op_name][:... | [
"def",
"op_get_mutate_fields",
"(",
"op_name",
")",
":",
"global",
"MUTATE_FIELDS",
"if",
"op_name",
"not",
"in",
"MUTATE_FIELDS",
".",
"keys",
"(",
")",
":",
"raise",
"Exception",
"(",
"\"No such operation '%s'\"",
"%",
"op_name",
")",
"fields",
"=",
"MUTATE_FI... | Get the names of the fields that will change
when this operation gets applied to a record. | [
"Get",
"the",
"names",
"of",
"the",
"fields",
"that",
"will",
"change",
"when",
"this",
"operation",
"gets",
"applied",
"to",
"a",
"record",
"."
] | 1dcfdd39b152d29ce13e736a6a1a0981401a0505 | https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/operations/__init__.py#L346-L357 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.