partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | TransactionBuilder.set_fee_asset | Set asset to fee | graphenecommon/transactionbuilder.py | def set_fee_asset(self, fee_asset):
""" Set asset to fee
"""
if isinstance(fee_asset, self.amount_class):
self.fee_asset_id = fee_asset["id"]
elif isinstance(fee_asset, self.asset_class):
self.fee_asset_id = fee_asset["id"]
elif fee_asset:
self... | def set_fee_asset(self, fee_asset):
""" Set asset to fee
"""
if isinstance(fee_asset, self.amount_class):
self.fee_asset_id = fee_asset["id"]
elif isinstance(fee_asset, self.asset_class):
self.fee_asset_id = fee_asset["id"]
elif fee_asset:
self... | [
"Set",
"asset",
"to",
"fee"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L329-L339 | [
"def",
"set_fee_asset",
"(",
"self",
",",
"fee_asset",
")",
":",
"if",
"isinstance",
"(",
"fee_asset",
",",
"self",
".",
"amount_class",
")",
":",
"self",
".",
"fee_asset_id",
"=",
"fee_asset",
"[",
"\"id\"",
"]",
"elif",
"isinstance",
"(",
"fee_asset",
",... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.add_required_fees | Auxiliary method to obtain the required fees for a set of
operations. Requires a websocket connection to a witness node! | graphenecommon/transactionbuilder.py | def add_required_fees(self, ops, asset_id="1.3.0"):
""" Auxiliary method to obtain the required fees for a set of
operations. Requires a websocket connection to a witness node!
"""
ws = self.blockchain.rpc
fees = ws.get_required_fees([i.json() for i in ops], asset_id)
... | def add_required_fees(self, ops, asset_id="1.3.0"):
""" Auxiliary method to obtain the required fees for a set of
operations. Requires a websocket connection to a witness node!
"""
ws = self.blockchain.rpc
fees = ws.get_required_fees([i.json() for i in ops], asset_id)
... | [
"Auxiliary",
"method",
"to",
"obtain",
"the",
"required",
"fees",
"for",
"a",
"set",
"of",
"operations",
".",
"Requires",
"a",
"websocket",
"connection",
"to",
"a",
"witness",
"node!"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L341-L365 | [
"def",
"add_required_fees",
"(",
"self",
",",
"ops",
",",
"asset_id",
"=",
"\"1.3.0\"",
")",
":",
"ws",
"=",
"self",
".",
"blockchain",
".",
"rpc",
"fees",
"=",
"ws",
".",
"get_required_fees",
"(",
"[",
"i",
".",
"json",
"(",
")",
"for",
"i",
"in",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.constructTx | Construct the actual transaction and store it in the class's dict
store | graphenecommon/transactionbuilder.py | def constructTx(self):
""" Construct the actual transaction and store it in the class's dict
store
"""
ops = list()
for op in self.ops:
if isinstance(op, ProposalBuilder):
# This operation is a proposal an needs to be deal with
# di... | def constructTx(self):
""" Construct the actual transaction and store it in the class's dict
store
"""
ops = list()
for op in self.ops:
if isinstance(op, ProposalBuilder):
# This operation is a proposal an needs to be deal with
# di... | [
"Construct",
"the",
"actual",
"transaction",
"and",
"store",
"it",
"in",
"the",
"class",
"s",
"dict",
"store"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L367-L400 | [
"def",
"constructTx",
"(",
"self",
")",
":",
"ops",
"=",
"list",
"(",
")",
"for",
"op",
"in",
"self",
".",
"ops",
":",
"if",
"isinstance",
"(",
"op",
",",
"ProposalBuilder",
")",
":",
"# This operation is a proposal an needs to be deal with",
"# differently",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.get_block_params | Auxiliary method to obtain ``ref_block_num`` and
``ref_block_prefix``. Requires a websocket connection to a
witness node! | graphenecommon/transactionbuilder.py | def get_block_params(self):
""" Auxiliary method to obtain ``ref_block_num`` and
``ref_block_prefix``. Requires a websocket connection to a
witness node!
"""
ws = self.blockchain.rpc
dynBCParams = ws.get_dynamic_global_properties()
ref_block_num = dynBCPar... | def get_block_params(self):
""" Auxiliary method to obtain ``ref_block_num`` and
``ref_block_prefix``. Requires a websocket connection to a
witness node!
"""
ws = self.blockchain.rpc
dynBCParams = ws.get_dynamic_global_properties()
ref_block_num = dynBCPar... | [
"Auxiliary",
"method",
"to",
"obtain",
"ref_block_num",
"and",
"ref_block_prefix",
".",
"Requires",
"a",
"websocket",
"connection",
"to",
"a",
"witness",
"node!"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L402-L413 | [
"def",
"get_block_params",
"(",
"self",
")",
":",
"ws",
"=",
"self",
".",
"blockchain",
".",
"rpc",
"dynBCParams",
"=",
"ws",
".",
"get_dynamic_global_properties",
"(",
")",
"ref_block_num",
"=",
"dynBCParams",
"[",
"\"head_block_number\"",
"]",
"&",
"0xFFFF",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.sign | Sign a provided transaction with the provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
from the wallet as defined in "missin... | graphenecommon/transactionbuilder.py | def sign(self):
""" Sign a provided transaction with the provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
from the ... | def sign(self):
""" Sign a provided transaction with the provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
from the ... | [
"Sign",
"a",
"provided",
"transaction",
"with",
"the",
"provided",
"key",
"(",
"s",
")"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L415-L456 | [
"def",
"sign",
"(",
"self",
")",
":",
"self",
".",
"constructTx",
"(",
")",
"if",
"\"operations\"",
"not",
"in",
"self",
"or",
"not",
"self",
"[",
"\"operations\"",
"]",
":",
"return",
"# Legacy compatibility!",
"# If we are doing a proposal, obtain the account from... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.verify_authority | Verify the authority of the signed transaction | graphenecommon/transactionbuilder.py | def verify_authority(self):
""" Verify the authority of the signed transaction
"""
try:
if not self.blockchain.rpc.verify_authority(self.json()):
raise InsufficientAuthorityError
except Exception as e:
raise e | def verify_authority(self):
""" Verify the authority of the signed transaction
"""
try:
if not self.blockchain.rpc.verify_authority(self.json()):
raise InsufficientAuthorityError
except Exception as e:
raise e | [
"Verify",
"the",
"authority",
"of",
"the",
"signed",
"transaction"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L458-L465 | [
"def",
"verify_authority",
"(",
"self",
")",
":",
"try",
":",
"if",
"not",
"self",
".",
"blockchain",
".",
"rpc",
".",
"verify_authority",
"(",
"self",
".",
"json",
"(",
")",
")",
":",
"raise",
"InsufficientAuthorityError",
"except",
"Exception",
"as",
"e"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.broadcast | Broadcast a transaction to the blockchain network
:param tx tx: Signed transaction to broadcast | graphenecommon/transactionbuilder.py | def broadcast(self):
""" Broadcast a transaction to the blockchain network
:param tx tx: Signed transaction to broadcast
"""
# Sign if not signed
if not self._is_signed():
self.sign()
# Cannot broadcast an empty transaction
if "operations" not in... | def broadcast(self):
""" Broadcast a transaction to the blockchain network
:param tx tx: Signed transaction to broadcast
"""
# Sign if not signed
if not self._is_signed():
self.sign()
# Cannot broadcast an empty transaction
if "operations" not in... | [
"Broadcast",
"a",
"transaction",
"to",
"the",
"blockchain",
"network"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L467-L504 | [
"def",
"broadcast",
"(",
"self",
")",
":",
"# Sign if not signed",
"if",
"not",
"self",
".",
"_is_signed",
"(",
")",
":",
"self",
".",
"sign",
"(",
")",
"# Cannot broadcast an empty transaction",
"if",
"\"operations\"",
"not",
"in",
"self",
"or",
"not",
"self"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.clear | Clear the transaction builder and start from scratch | graphenecommon/transactionbuilder.py | def clear(self):
""" Clear the transaction builder and start from scratch
"""
self.ops = []
self.wifs = set()
self.signing_accounts = []
# This makes sure that _is_constructed will return False afterwards
self["expiration"] = None
dict.__init__(self, {}) | def clear(self):
""" Clear the transaction builder and start from scratch
"""
self.ops = []
self.wifs = set()
self.signing_accounts = []
# This makes sure that _is_constructed will return False afterwards
self["expiration"] = None
dict.__init__(self, {}) | [
"Clear",
"the",
"transaction",
"builder",
"and",
"start",
"from",
"scratch"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L506-L514 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"ops",
"=",
"[",
"]",
"self",
".",
"wifs",
"=",
"set",
"(",
")",
"self",
".",
"signing_accounts",
"=",
"[",
"]",
"# This makes sure that _is_constructed will return False afterwards",
"self",
"[",
"\"expirati... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.addSigningInformation | This is a private method that adds side information to a
unsigned/partial transaction in order to simplify later
signing (e.g. for multisig or coldstorage)
FIXME: Does not work with owner keys! | graphenecommon/transactionbuilder.py | def addSigningInformation(self, account, permission):
""" This is a private method that adds side information to a
unsigned/partial transaction in order to simplify later
signing (e.g. for multisig or coldstorage)
FIXME: Does not work with owner keys!
"""
sel... | def addSigningInformation(self, account, permission):
""" This is a private method that adds side information to a
unsigned/partial transaction in order to simplify later
signing (e.g. for multisig or coldstorage)
FIXME: Does not work with owner keys!
"""
sel... | [
"This",
"is",
"a",
"private",
"method",
"that",
"adds",
"side",
"information",
"to",
"a",
"unsigned",
"/",
"partial",
"transaction",
"in",
"order",
"to",
"simplify",
"later",
"signing",
"(",
"e",
".",
"g",
".",
"for",
"multisig",
"or",
"coldstorage",
")"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L516-L548 | [
"def",
"addSigningInformation",
"(",
"self",
",",
"account",
",",
"permission",
")",
":",
"self",
".",
"constructTx",
"(",
")",
"self",
"[",
"\"blockchain\"",
"]",
"=",
"self",
".",
"blockchain",
".",
"rpc",
".",
"chain_params",
"if",
"isinstance",
"(",
"a... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | TransactionBuilder.appendMissingSignatures | Store which accounts/keys are supposed to sign the transaction
This method is used for an offline-signer! | graphenecommon/transactionbuilder.py | def appendMissingSignatures(self):
""" Store which accounts/keys are supposed to sign the transaction
This method is used for an offline-signer!
"""
missing_signatures = self.get("missing_signatures", [])
for pub in missing_signatures:
wif = self.blockchain.walle... | def appendMissingSignatures(self):
""" Store which accounts/keys are supposed to sign the transaction
This method is used for an offline-signer!
"""
missing_signatures = self.get("missing_signatures", [])
for pub in missing_signatures:
wif = self.blockchain.walle... | [
"Store",
"which",
"accounts",
"/",
"keys",
"are",
"supposed",
"to",
"sign",
"the",
"transaction"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L550-L559 | [
"def",
"appendMissingSignatures",
"(",
"self",
")",
":",
"missing_signatures",
"=",
"self",
".",
"get",
"(",
"\"missing_signatures\"",
",",
"[",
"]",
")",
"for",
"pub",
"in",
"missing_signatures",
":",
"wif",
"=",
"self",
".",
"blockchain",
".",
"wallet",
".... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Price.as_base | Returns the price instance so that the base asset is ``base``.
Note: This makes a copy of the object! | graphenecommon/price.py | def as_base(self, base):
""" Returns the price instance so that the base asset is ``base``.
Note: This makes a copy of the object!
"""
if base == self["base"]["symbol"]:
return self.copy()
elif base == self["quote"]["symbol"]:
return self.copy().inver... | def as_base(self, base):
""" Returns the price instance so that the base asset is ``base``.
Note: This makes a copy of the object!
"""
if base == self["base"]["symbol"]:
return self.copy()
elif base == self["quote"]["symbol"]:
return self.copy().inver... | [
"Returns",
"the",
"price",
"instance",
"so",
"that",
"the",
"base",
"asset",
"is",
"base",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/price.py#L255-L265 | [
"def",
"as_base",
"(",
"self",
",",
"base",
")",
":",
"if",
"base",
"==",
"self",
"[",
"\"base\"",
"]",
"[",
"\"symbol\"",
"]",
":",
"return",
"self",
".",
"copy",
"(",
")",
"elif",
"base",
"==",
"self",
"[",
"\"quote\"",
"]",
"[",
"\"symbol\"",
"]... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Price.as_quote | Returns the price instance so that the quote asset is ``quote``.
Note: This makes a copy of the object! | graphenecommon/price.py | def as_quote(self, quote):
""" Returns the price instance so that the quote asset is ``quote``.
Note: This makes a copy of the object!
"""
if quote == self["quote"]["symbol"]:
return self.copy()
elif quote == self["base"]["symbol"]:
return self.copy()... | def as_quote(self, quote):
""" Returns the price instance so that the quote asset is ``quote``.
Note: This makes a copy of the object!
"""
if quote == self["quote"]["symbol"]:
return self.copy()
elif quote == self["base"]["symbol"]:
return self.copy()... | [
"Returns",
"the",
"price",
"instance",
"so",
"that",
"the",
"quote",
"asset",
"is",
"quote",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/price.py#L267-L277 | [
"def",
"as_quote",
"(",
"self",
",",
"quote",
")",
":",
"if",
"quote",
"==",
"self",
"[",
"\"quote\"",
"]",
"[",
"\"symbol\"",
"]",
":",
"return",
"self",
".",
"copy",
"(",
")",
"elif",
"quote",
"==",
"self",
"[",
"\"base\"",
"]",
"[",
"\"symbol\"",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Price.invert | Invert the price (e.g. go from ``USD/BTS`` into ``BTS/USD``) | graphenecommon/price.py | def invert(self):
""" Invert the price (e.g. go from ``USD/BTS`` into ``BTS/USD``)
"""
tmp = self["quote"]
self["quote"] = self["base"]
self["base"] = tmp
if "for_sale" in self and self["for_sale"]:
self["for_sale"] = self.amount_class(
self["f... | def invert(self):
""" Invert the price (e.g. go from ``USD/BTS`` into ``BTS/USD``)
"""
tmp = self["quote"]
self["quote"] = self["base"]
self["base"] = tmp
if "for_sale" in self and self["for_sale"]:
self["for_sale"] = self.amount_class(
self["f... | [
"Invert",
"the",
"price",
"(",
"e",
".",
"g",
".",
"go",
"from",
"USD",
"/",
"BTS",
"into",
"BTS",
"/",
"USD",
")"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/price.py#L279-L289 | [
"def",
"invert",
"(",
"self",
")",
":",
"tmp",
"=",
"self",
"[",
"\"quote\"",
"]",
"self",
"[",
"\"quote\"",
"]",
"=",
"self",
"[",
"\"base\"",
"]",
"self",
"[",
"\"base\"",
"]",
"=",
"tmp",
"if",
"\"for_sale\"",
"in",
"self",
"and",
"self",
"[",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Price.json | return {
"base": self["base"].json(),
"quote": self["quote"].json()
} | graphenecommon/price.py | def json(self):
"""
return {
"base": self["base"].json(),
"quote": self["quote"].json()
}
"""
quote = self["quote"]
base = self["base"]
frac = Fraction(int(quote) / int(base)).limit_denominator(
10 ** base["asset"]["precision"]
... | def json(self):
"""
return {
"base": self["base"].json(),
"quote": self["quote"].json()
}
"""
quote = self["quote"]
base = self["base"]
frac = Fraction(int(quote) / int(base)).limit_denominator(
10 ** base["asset"]["precision"]
... | [
"return",
"{",
"base",
":",
"self",
"[",
"base",
"]",
".",
"json",
"()",
"quote",
":",
"self",
"[",
"quote",
"]",
".",
"json",
"()",
"}"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/price.py#L291-L306 | [
"def",
"json",
"(",
"self",
")",
":",
"quote",
"=",
"self",
"[",
"\"quote\"",
"]",
"base",
"=",
"self",
"[",
"\"base\"",
"]",
"frac",
"=",
"Fraction",
"(",
"int",
"(",
"quote",
")",
"/",
"int",
"(",
"base",
")",
")",
".",
"limit_denominator",
"(",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | InRamStore.wipe | Wipe the store | graphenestorage/ram.py | def wipe(self):
""" Wipe the store
"""
keys = list(self.keys()).copy()
for key in keys:
self.delete(key) | def wipe(self):
""" Wipe the store
"""
keys = list(self.keys()).copy()
for key in keys:
self.delete(key) | [
"Wipe",
"the",
"store"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenestorage/ram.py#L26-L31 | [
"def",
"wipe",
"(",
"self",
")",
":",
"keys",
"=",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
".",
"copy",
"(",
")",
"for",
"key",
"in",
"keys",
":",
"self",
".",
"delete",
"(",
"key",
")"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AbstractGrapheneChain.connect | Connect to blockchain network (internal use only) | graphenecommon/chain.py | def connect(self, node="", rpcuser="", rpcpassword="", **kwargs):
""" Connect to blockchain network (internal use only)
"""
if not node:
if "node" in self.config:
node = self.config["node"]
else:
raise ValueError("A Blockchain node needs to... | def connect(self, node="", rpcuser="", rpcpassword="", **kwargs):
""" Connect to blockchain network (internal use only)
"""
if not node:
if "node" in self.config:
node = self.config["node"]
else:
raise ValueError("A Blockchain node needs to... | [
"Connect",
"to",
"blockchain",
"network",
"(",
"internal",
"use",
"only",
")"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L60-L75 | [
"def",
"connect",
"(",
"self",
",",
"node",
"=",
"\"\"",
",",
"rpcuser",
"=",
"\"\"",
",",
"rpcpassword",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"node",
":",
"if",
"\"node\"",
"in",
"self",
".",
"config",
":",
"node",
"=",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AbstractGrapheneChain.finalizeOp | This method obtains the required private keys if present in
the wallet, finalizes the transaction, signs it and
broadacasts it
:param operation ops: The operation (or list of operaions) to
broadcast
:param operation account: The account that authorizes th... | graphenecommon/chain.py | def finalizeOp(self, ops, account, permission, **kwargs):
""" This method obtains the required private keys if present in
the wallet, finalizes the transaction, signs it and
broadacasts it
:param operation ops: The operation (or list of operaions) to
broadcas... | def finalizeOp(self, ops, account, permission, **kwargs):
""" This method obtains the required private keys if present in
the wallet, finalizes the transaction, signs it and
broadacasts it
:param operation ops: The operation (or list of operaions) to
broadcas... | [
"This",
"method",
"obtains",
"the",
"required",
"private",
"keys",
"if",
"present",
"in",
"the",
"wallet",
"finalizes",
"the",
"transaction",
"signs",
"it",
"and",
"broadacasts",
"it"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L144-L227 | [
"def",
"finalizeOp",
"(",
"self",
",",
"ops",
",",
"account",
",",
"permission",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"append_to\"",
"in",
"kwargs",
"and",
"kwargs",
"[",
"\"append_to\"",
"]",
":",
"if",
"self",
".",
"proposer",
":",
"log",
".",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AbstractGrapheneChain.sign | Sign a provided transaction witht he provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
from the wallet as defined in "missin... | graphenecommon/chain.py | def sign(self, tx=None, wifs=[]):
""" Sign a provided transaction witht he provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
... | def sign(self, tx=None, wifs=[]):
""" Sign a provided transaction witht he provided key(s)
:param dict tx: The transaction to be signed and returned
:param string wifs: One or many wif keys to use for signing
a transaction. If not present, the keys will be loaded
... | [
"Sign",
"a",
"provided",
"transaction",
"witht",
"he",
"provided",
"key",
"(",
"s",
")"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L229-L245 | [
"def",
"sign",
"(",
"self",
",",
"tx",
"=",
"None",
",",
"wifs",
"=",
"[",
"]",
")",
":",
"if",
"tx",
":",
"txbuffer",
"=",
"self",
".",
"transactionbuilder_class",
"(",
"tx",
",",
"blockchain_instance",
"=",
"self",
")",
"else",
":",
"txbuffer",
"="... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AbstractGrapheneChain.broadcast | Broadcast a transaction to the Blockchain
:param tx tx: Signed transaction to broadcast | graphenecommon/chain.py | def broadcast(self, tx=None):
""" Broadcast a transaction to the Blockchain
:param tx tx: Signed transaction to broadcast
"""
if tx:
# If tx is provided, we broadcast the tx
return self.transactionbuilder_class(
tx, blockchain_instance=self
... | def broadcast(self, tx=None):
""" Broadcast a transaction to the Blockchain
:param tx tx: Signed transaction to broadcast
"""
if tx:
# If tx is provided, we broadcast the tx
return self.transactionbuilder_class(
tx, blockchain_instance=self
... | [
"Broadcast",
"a",
"transaction",
"to",
"the",
"Blockchain"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L247-L258 | [
"def",
"broadcast",
"(",
"self",
",",
"tx",
"=",
"None",
")",
":",
"if",
"tx",
":",
"# If tx is provided, we broadcast the tx",
"return",
"self",
".",
"transactionbuilder_class",
"(",
"tx",
",",
"blockchain_instance",
"=",
"self",
")",
".",
"broadcast",
"(",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AbstractGrapheneChain.proposal | Return the default proposal buffer
... note:: If any parameter is set, the default proposal
parameters will be changed! | graphenecommon/chain.py | def proposal(self, proposer=None, proposal_expiration=None, proposal_review=None):
""" Return the default proposal buffer
... note:: If any parameter is set, the default proposal
parameters will be changed!
"""
if not self._propbuffer:
return self.new_prop... | def proposal(self, proposer=None, proposal_expiration=None, proposal_review=None):
""" Return the default proposal buffer
... note:: If any parameter is set, the default proposal
parameters will be changed!
"""
if not self._propbuffer:
return self.new_prop... | [
"Return",
"the",
"default",
"proposal",
"buffer"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L280-L296 | [
"def",
"proposal",
"(",
"self",
",",
"proposer",
"=",
"None",
",",
"proposal_expiration",
"=",
"None",
",",
"proposal_review",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_propbuffer",
":",
"return",
"self",
".",
"new_proposal",
"(",
"self",
".",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AbstractGrapheneChain.new_tx | Let's obtain a new txbuffer
:returns int txid: id of the new txbuffer | graphenecommon/chain.py | def new_tx(self, *args, **kwargs):
""" Let's obtain a new txbuffer
:returns int txid: id of the new txbuffer
"""
builder = self.transactionbuilder_class(
*args, blockchain_instance=self, **kwargs
)
self._txbuffers.append(builder)
return builder | def new_tx(self, *args, **kwargs):
""" Let's obtain a new txbuffer
:returns int txid: id of the new txbuffer
"""
builder = self.transactionbuilder_class(
*args, blockchain_instance=self, **kwargs
)
self._txbuffers.append(builder)
return builder | [
"Let",
"s",
"obtain",
"a",
"new",
"txbuffer"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/chain.py#L332-L341 | [
"def",
"new_tx",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"builder",
"=",
"self",
".",
"transactionbuilder_class",
"(",
"*",
"args",
",",
"blockchain_instance",
"=",
"self",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_txbuffer... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | AccountOptions.detail | This is an example how to sort votes prior to using them in the
Object | graphenebase/operations.py | def detail(self, *args, **kwargs):
prefix = kwargs.pop("prefix", default_prefix)
# remove dublicates
kwargs["votes"] = list(set(kwargs["votes"]))
""" This is an example how to sort votes prior to using them in the
Object
"""
# # Sort votes
# kwargs["vo... | def detail(self, *args, **kwargs):
prefix = kwargs.pop("prefix", default_prefix)
# remove dublicates
kwargs["votes"] = list(set(kwargs["votes"]))
""" This is an example how to sort votes prior to using them in the
Object
"""
# # Sort votes
# kwargs["vo... | [
"This",
"is",
"an",
"example",
"how",
"to",
"sort",
"votes",
"prior",
"to",
"using",
"them",
"in",
"the",
"Object"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/operations.py#L88-L109 | [
"def",
"detail",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"prefix",
"=",
"kwargs",
".",
"pop",
"(",
"\"prefix\"",
",",
"default_prefix",
")",
"# remove dublicates",
"kwargs",
"[",
"\"votes\"",
"]",
"=",
"list",
"(",
"set",
"(",... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Signed_Transaction.id | The transaction id of this transaction | graphenebase/signedtransactions.py | def id(self):
""" The transaction id of this transaction
"""
# Store signatures temporarily since they are not part of
# transaction id
sigs = self.data["signatures"]
self.data.pop("signatures", None)
# Generage Hash of the seriliazed version
h = hashlib.... | def id(self):
""" The transaction id of this transaction
"""
# Store signatures temporarily since they are not part of
# transaction id
sigs = self.data["signatures"]
self.data.pop("signatures", None)
# Generage Hash of the seriliazed version
h = hashlib.... | [
"The",
"transaction",
"id",
"of",
"this",
"transaction"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/signedtransactions.py#L84-L99 | [
"def",
"id",
"(",
"self",
")",
":",
"# Store signatures temporarily since they are not part of",
"# transaction id",
"sigs",
"=",
"self",
".",
"data",
"[",
"\"signatures\"",
"]",
"self",
".",
"data",
".",
"pop",
"(",
"\"signatures\"",
",",
"None",
")",
"# Generage... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Signed_Transaction.sign | Sign the transaction with the provided private keys.
:param array wifkeys: Array of wif keys
:param str chain: identifier for the chain | graphenebase/signedtransactions.py | def sign(self, wifkeys, chain=None):
""" Sign the transaction with the provided private keys.
:param array wifkeys: Array of wif keys
:param str chain: identifier for the chain
"""
if not chain:
chain = self.get_default_prefix()
self.deriveDigest(cha... | def sign(self, wifkeys, chain=None):
""" Sign the transaction with the provided private keys.
:param array wifkeys: Array of wif keys
:param str chain: identifier for the chain
"""
if not chain:
chain = self.get_default_prefix()
self.deriveDigest(cha... | [
"Sign",
"the",
"transaction",
"with",
"the",
"provided",
"private",
"keys",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/signedtransactions.py#L179-L203 | [
"def",
"sign",
"(",
"self",
",",
"wifkeys",
",",
"chain",
"=",
"None",
")",
":",
"if",
"not",
"chain",
":",
"chain",
"=",
"self",
".",
"get_default_prefix",
"(",
")",
"self",
".",
"deriveDigest",
"(",
"chain",
")",
"# Get Unique private keys",
"self",
".... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | BlockchainObjects.store | Cache the list
:param list data: List of objects to cache | graphenecommon/blockchainobject.py | def store(self, data, key=None, *args, **kwargs):
""" Cache the list
:param list data: List of objects to cache
"""
list.__init__(self, data)
self._store_items(self._cache_key(key)) | def store(self, data, key=None, *args, **kwargs):
""" Cache the list
:param list data: List of objects to cache
"""
list.__init__(self, data)
self._store_items(self._cache_key(key)) | [
"Cache",
"the",
"list"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchainobject.py#L176-L182 | [
"def",
"store",
"(",
"self",
",",
"data",
",",
"key",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"list",
".",
"__init__",
"(",
"self",
",",
"data",
")",
"self",
".",
"_store_items",
"(",
"self",
".",
"_cache_key",
"(",
"key... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | BlockchainObject.store | Cache the list
:param list data: List of objects to cache | graphenecommon/blockchainobject.py | def store(self, data, key="id"):
""" Cache the list
:param list data: List of objects to cache
"""
dict.__init__(self, data)
self._store_item(key) | def store(self, data, key="id"):
""" Cache the list
:param list data: List of objects to cache
"""
dict.__init__(self, data)
self._store_item(key) | [
"Cache",
"the",
"list"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchainobject.py#L267-L273 | [
"def",
"store",
"(",
"self",
",",
"data",
",",
"key",
"=",
"\"id\"",
")",
":",
"dict",
".",
"__init__",
"(",
"self",
",",
"data",
")",
"self",
".",
"_store_item",
"(",
"key",
")"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | BlockchainObject.objectid_valid | Test if a string looks like a regular object id of the
form:::
xxxx.yyyyy.zzzz
with those being numbers. | graphenecommon/blockchainobject.py | def objectid_valid(i):
""" Test if a string looks like a regular object id of the
form:::
xxxx.yyyyy.zzzz
with those being numbers.
"""
if "." not in i:
return False
parts = i.split(".")
if len(parts) == 3:
try:
... | def objectid_valid(i):
""" Test if a string looks like a regular object id of the
form:::
xxxx.yyyyy.zzzz
with those being numbers.
"""
if "." not in i:
return False
parts = i.split(".")
if len(parts) == 3:
try:
... | [
"Test",
"if",
"a",
"string",
"looks",
"like",
"a",
"regular",
"object",
"id",
"of",
"the",
"form",
":::"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchainobject.py#L289-L306 | [
"def",
"objectid_valid",
"(",
"i",
")",
":",
"if",
"\".\"",
"not",
"in",
"i",
":",
"return",
"False",
"parts",
"=",
"i",
".",
"split",
"(",
"\".\"",
")",
"if",
"len",
"(",
"parts",
")",
"==",
"3",
":",
"try",
":",
"[",
"int",
"(",
"x",
")",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Object.refresh | This is the refresh method that overloads the prototype in
BlockchainObject. | graphenecommon/blockchainobject.py | def refresh(self):
""" This is the refresh method that overloads the prototype in
BlockchainObject.
"""
dict.__init__(
self,
self.blockchain.rpc.get_object(self.identifier),
blockchain_instance=self.blockchain,
) | def refresh(self):
""" This is the refresh method that overloads the prototype in
BlockchainObject.
"""
dict.__init__(
self,
self.blockchain.rpc.get_object(self.identifier),
blockchain_instance=self.blockchain,
) | [
"This",
"is",
"the",
"refresh",
"method",
"that",
"overloads",
"the",
"prototype",
"in",
"BlockchainObject",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/blockchainobject.py#L337-L345 | [
"def",
"refresh",
"(",
"self",
")",
":",
"dict",
".",
"__init__",
"(",
"self",
",",
"self",
".",
"blockchain",
".",
"rpc",
".",
"get_object",
"(",
"self",
".",
"identifier",
")",
",",
"blockchain_instance",
"=",
"self",
".",
"blockchain",
",",
")"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | _encrypt_xor | Returns encrypt(a ^ b). | graphenebase/bip38.py | def _encrypt_xor(a, b, aes):
""" Returns encrypt(a ^ b). """
a = unhexlify("%0.32x" % (int((a), 16) ^ int(hexlify(b), 16)))
return aes.encrypt(a) | def _encrypt_xor(a, b, aes):
""" Returns encrypt(a ^ b). """
a = unhexlify("%0.32x" % (int((a), 16) ^ int(hexlify(b), 16)))
return aes.encrypt(a) | [
"Returns",
"encrypt",
"(",
"a",
"^",
"b",
")",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/bip38.py#L40-L43 | [
"def",
"_encrypt_xor",
"(",
"a",
",",
"b",
",",
"aes",
")",
":",
"a",
"=",
"unhexlify",
"(",
"\"%0.32x\"",
"%",
"(",
"int",
"(",
"(",
"a",
")",
",",
"16",
")",
"^",
"int",
"(",
"hexlify",
"(",
"b",
")",
",",
"16",
")",
")",
")",
"return",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | encrypt | BIP0038 non-ec-multiply encryption. Returns BIP0038 encrypted privkey.
:param privkey: Private key
:type privkey: Base58
:param str passphrase: UTF-8 encoded passphrase for encryption
:return: BIP0038 non-ec-multiply encrypted wif key
:rtype: Base58 | graphenebase/bip38.py | def encrypt(privkey, passphrase):
""" BIP0038 non-ec-multiply encryption. Returns BIP0038 encrypted privkey.
:param privkey: Private key
:type privkey: Base58
:param str passphrase: UTF-8 encoded passphrase for encryption
:return: BIP0038 non-ec-multiply encrypted wif key
:rtype: Base58
""... | def encrypt(privkey, passphrase):
""" BIP0038 non-ec-multiply encryption. Returns BIP0038 encrypted privkey.
:param privkey: Private key
:type privkey: Base58
:param str passphrase: UTF-8 encoded passphrase for encryption
:return: BIP0038 non-ec-multiply encrypted wif key
:rtype: Base58
""... | [
"BIP0038",
"non",
"-",
"ec",
"-",
"multiply",
"encryption",
".",
"Returns",
"BIP0038",
"encrypted",
"privkey",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/bip38.py#L46-L80 | [
"def",
"encrypt",
"(",
"privkey",
",",
"passphrase",
")",
":",
"if",
"isinstance",
"(",
"privkey",
",",
"str",
")",
":",
"privkey",
"=",
"PrivateKey",
"(",
"privkey",
")",
"else",
":",
"privkey",
"=",
"PrivateKey",
"(",
"repr",
"(",
"privkey",
")",
")"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | decrypt | BIP0038 non-ec-multiply decryption. Returns WIF privkey.
:param Base58 encrypted_privkey: Private key
:param str passphrase: UTF-8 encoded passphrase for decryption
:return: BIP0038 non-ec-multiply decrypted key
:rtype: Base58
:raises SaltException: if checksum verification failed (e.g. wrong
... | graphenebase/bip38.py | def decrypt(encrypted_privkey, passphrase):
"""BIP0038 non-ec-multiply decryption. Returns WIF privkey.
:param Base58 encrypted_privkey: Private key
:param str passphrase: UTF-8 encoded passphrase for decryption
:return: BIP0038 non-ec-multiply decrypted key
:rtype: Base58
:raises SaltException... | def decrypt(encrypted_privkey, passphrase):
"""BIP0038 non-ec-multiply decryption. Returns WIF privkey.
:param Base58 encrypted_privkey: Private key
:param str passphrase: UTF-8 encoded passphrase for decryption
:return: BIP0038 non-ec-multiply decrypted key
:rtype: Base58
:raises SaltException... | [
"BIP0038",
"non",
"-",
"ec",
"-",
"multiply",
"decryption",
".",
"Returns",
"WIF",
"privkey",
"."
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/bip38.py#L83-L125 | [
"def",
"decrypt",
"(",
"encrypted_privkey",
",",
"passphrase",
")",
":",
"d",
"=",
"unhexlify",
"(",
"base58decode",
"(",
"encrypted_privkey",
")",
")",
"d",
"=",
"d",
"[",
"2",
":",
"]",
"# remove trailing 0x01 and 0x42",
"flagbyte",
"=",
"d",
"[",
"0",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.setKeys | This method is strictly only for in memory keys that are
passed to Wallet with the ``keys`` argument | graphenecommon/wallet.py | def setKeys(self, loadkeys):
""" This method is strictly only for in memory keys that are
passed to Wallet with the ``keys`` argument
"""
log.debug("Force setting of private keys. Not using the wallet database!")
if isinstance(loadkeys, dict):
loadkeys = list(load... | def setKeys(self, loadkeys):
""" This method is strictly only for in memory keys that are
passed to Wallet with the ``keys`` argument
"""
log.debug("Force setting of private keys. Not using the wallet database!")
if isinstance(loadkeys, dict):
loadkeys = list(load... | [
"This",
"method",
"is",
"strictly",
"only",
"for",
"in",
"memory",
"keys",
"that",
"are",
"passed",
"to",
"Wallet",
"with",
"the",
"keys",
"argument"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L82-L93 | [
"def",
"setKeys",
"(",
"self",
",",
"loadkeys",
")",
":",
"log",
".",
"debug",
"(",
"\"Force setting of private keys. Not using the wallet database!\"",
")",
"if",
"isinstance",
"(",
"loadkeys",
",",
"dict",
")",
":",
"loadkeys",
"=",
"list",
"(",
"loadkeys",
".... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.unlock | Unlock the wallet database | graphenecommon/wallet.py | def unlock(self, pwd):
""" Unlock the wallet database
"""
if self.store.is_encrypted():
return self.store.unlock(pwd) | def unlock(self, pwd):
""" Unlock the wallet database
"""
if self.store.is_encrypted():
return self.store.unlock(pwd) | [
"Unlock",
"the",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L100-L104 | [
"def",
"unlock",
"(",
"self",
",",
"pwd",
")",
":",
"if",
"self",
".",
"store",
".",
"is_encrypted",
"(",
")",
":",
"return",
"self",
".",
"store",
".",
"unlock",
"(",
"pwd",
")"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.newWallet | Create a new wallet database | graphenecommon/wallet.py | def newWallet(self, pwd):
""" Create a new wallet database
"""
if self.created():
raise WalletExists("You already have created a wallet!")
self.store.unlock(pwd) | def newWallet(self, pwd):
""" Create a new wallet database
"""
if self.created():
raise WalletExists("You already have created a wallet!")
self.store.unlock(pwd) | [
"Create",
"a",
"new",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L147-L152 | [
"def",
"newWallet",
"(",
"self",
",",
"pwd",
")",
":",
"if",
"self",
".",
"created",
"(",
")",
":",
"raise",
"WalletExists",
"(",
"\"You already have created a wallet!\"",
")",
"self",
".",
"store",
".",
"unlock",
"(",
"pwd",
")"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.addPrivateKey | Add a private key to the wallet database | graphenecommon/wallet.py | def addPrivateKey(self, wif):
""" Add a private key to the wallet database
"""
try:
pub = self.publickey_from_wif(wif)
except Exception:
raise InvalidWifError("Invalid Key format!")
if str(pub) in self.store:
raise KeyAlreadyInStoreException("K... | def addPrivateKey(self, wif):
""" Add a private key to the wallet database
"""
try:
pub = self.publickey_from_wif(wif)
except Exception:
raise InvalidWifError("Invalid Key format!")
if str(pub) in self.store:
raise KeyAlreadyInStoreException("K... | [
"Add",
"a",
"private",
"key",
"to",
"the",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L154-L163 | [
"def",
"addPrivateKey",
"(",
"self",
",",
"wif",
")",
":",
"try",
":",
"pub",
"=",
"self",
".",
"publickey_from_wif",
"(",
"wif",
")",
"except",
"Exception",
":",
"raise",
"InvalidWifError",
"(",
"\"Invalid Key format!\"",
")",
"if",
"str",
"(",
"pub",
")"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getPrivateKeyForPublicKey | Obtain the private key for a given public key
:param str pub: Public Key | graphenecommon/wallet.py | def getPrivateKeyForPublicKey(self, pub):
""" Obtain the private key for a given public key
:param str pub: Public Key
"""
if str(pub) not in self.store:
raise KeyNotFound
return self.store.getPrivateKeyForPublicKey(str(pub)) | def getPrivateKeyForPublicKey(self, pub):
""" Obtain the private key for a given public key
:param str pub: Public Key
"""
if str(pub) not in self.store:
raise KeyNotFound
return self.store.getPrivateKeyForPublicKey(str(pub)) | [
"Obtain",
"the",
"private",
"key",
"for",
"a",
"given",
"public",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L165-L172 | [
"def",
"getPrivateKeyForPublicKey",
"(",
"self",
",",
"pub",
")",
":",
"if",
"str",
"(",
"pub",
")",
"not",
"in",
"self",
".",
"store",
":",
"raise",
"KeyNotFound",
"return",
"self",
".",
"store",
".",
"getPrivateKeyForPublicKey",
"(",
"str",
"(",
"pub",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.removeAccount | Remove all keys associated with a given account | graphenecommon/wallet.py | def removeAccount(self, account):
""" Remove all keys associated with a given account
"""
accounts = self.getAccounts()
for a in accounts:
if a["name"] == account:
self.store.delete(a["pubkey"]) | def removeAccount(self, account):
""" Remove all keys associated with a given account
"""
accounts = self.getAccounts()
for a in accounts:
if a["name"] == account:
self.store.delete(a["pubkey"]) | [
"Remove",
"all",
"keys",
"associated",
"with",
"a",
"given",
"account"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L179-L185 | [
"def",
"removeAccount",
"(",
"self",
",",
"account",
")",
":",
"accounts",
"=",
"self",
".",
"getAccounts",
"(",
")",
"for",
"a",
"in",
"accounts",
":",
"if",
"a",
"[",
"\"name\"",
"]",
"==",
"account",
":",
"self",
".",
"store",
".",
"delete",
"(",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getOwnerKeyForAccount | Obtain owner Private Key for an account from the wallet database | graphenecommon/wallet.py | def getOwnerKeyForAccount(self, name):
""" Obtain owner Private Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
for authority in account["owner"]["key_auths"]:
key = self.getPrivateKeyForPublicKey(authority[0])
if key:
... | def getOwnerKeyForAccount(self, name):
""" Obtain owner Private Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
for authority in account["owner"]["key_auths"]:
key = self.getPrivateKeyForPublicKey(authority[0])
if key:
... | [
"Obtain",
"owner",
"Private",
"Key",
"for",
"an",
"account",
"from",
"the",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L187-L195 | [
"def",
"getOwnerKeyForAccount",
"(",
"self",
",",
"name",
")",
":",
"account",
"=",
"self",
".",
"rpc",
".",
"get_account",
"(",
"name",
")",
"for",
"authority",
"in",
"account",
"[",
"\"owner\"",
"]",
"[",
"\"key_auths\"",
"]",
":",
"key",
"=",
"self",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getMemoKeyForAccount | Obtain owner Memo Key for an account from the wallet database | graphenecommon/wallet.py | def getMemoKeyForAccount(self, name):
""" Obtain owner Memo Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
key = self.getPrivateKeyForPublicKey(account["options"]["memo_key"])
if key:
return key
return False | def getMemoKeyForAccount(self, name):
""" Obtain owner Memo Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
key = self.getPrivateKeyForPublicKey(account["options"]["memo_key"])
if key:
return key
return False | [
"Obtain",
"owner",
"Memo",
"Key",
"for",
"an",
"account",
"from",
"the",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L197-L204 | [
"def",
"getMemoKeyForAccount",
"(",
"self",
",",
"name",
")",
":",
"account",
"=",
"self",
".",
"rpc",
".",
"get_account",
"(",
"name",
")",
"key",
"=",
"self",
".",
"getPrivateKeyForPublicKey",
"(",
"account",
"[",
"\"options\"",
"]",
"[",
"\"memo_key\"",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getActiveKeyForAccount | Obtain owner Active Key for an account from the wallet database | graphenecommon/wallet.py | def getActiveKeyForAccount(self, name):
""" Obtain owner Active Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
for authority in account["active"]["key_auths"]:
try:
return self.getPrivateKeyForPublicKey(authority[0])
... | def getActiveKeyForAccount(self, name):
""" Obtain owner Active Key for an account from the wallet database
"""
account = self.rpc.get_account(name)
for authority in account["active"]["key_auths"]:
try:
return self.getPrivateKeyForPublicKey(authority[0])
... | [
"Obtain",
"owner",
"Active",
"Key",
"for",
"an",
"account",
"from",
"the",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L206-L215 | [
"def",
"getActiveKeyForAccount",
"(",
"self",
",",
"name",
")",
":",
"account",
"=",
"self",
".",
"rpc",
".",
"get_account",
"(",
"name",
")",
"for",
"authority",
"in",
"account",
"[",
"\"active\"",
"]",
"[",
"\"key_auths\"",
"]",
":",
"try",
":",
"retur... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getAccountFromPrivateKey | Obtain account name from private key | graphenecommon/wallet.py | def getAccountFromPrivateKey(self, wif):
""" Obtain account name from private key
"""
pub = self.publickey_from_wif(wif)
return self.getAccountFromPublicKey(pub) | def getAccountFromPrivateKey(self, wif):
""" Obtain account name from private key
"""
pub = self.publickey_from_wif(wif)
return self.getAccountFromPublicKey(pub) | [
"Obtain",
"account",
"name",
"from",
"private",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L217-L221 | [
"def",
"getAccountFromPrivateKey",
"(",
"self",
",",
"wif",
")",
":",
"pub",
"=",
"self",
".",
"publickey_from_wif",
"(",
"wif",
")",
"return",
"self",
".",
"getAccountFromPublicKey",
"(",
"pub",
")"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getAccountsFromPublicKey | Obtain all accounts associated with a public key | graphenecommon/wallet.py | def getAccountsFromPublicKey(self, pub):
""" Obtain all accounts associated with a public key
"""
names = self.rpc.get_key_references([str(pub)])[0]
for name in names:
yield name | def getAccountsFromPublicKey(self, pub):
""" Obtain all accounts associated with a public key
"""
names = self.rpc.get_key_references([str(pub)])[0]
for name in names:
yield name | [
"Obtain",
"all",
"accounts",
"associated",
"with",
"a",
"public",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L223-L228 | [
"def",
"getAccountsFromPublicKey",
"(",
"self",
",",
"pub",
")",
":",
"names",
"=",
"self",
".",
"rpc",
".",
"get_key_references",
"(",
"[",
"str",
"(",
"pub",
")",
"]",
")",
"[",
"0",
"]",
"for",
"name",
"in",
"names",
":",
"yield",
"name"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getAccountFromPublicKey | Obtain the first account name from public key | graphenecommon/wallet.py | def getAccountFromPublicKey(self, pub):
""" Obtain the first account name from public key
"""
# FIXME, this only returns the first associated key.
# If the key is used by multiple accounts, this
# will surely lead to undesired behavior
names = list(self.getAccountsFromPub... | def getAccountFromPublicKey(self, pub):
""" Obtain the first account name from public key
"""
# FIXME, this only returns the first associated key.
# If the key is used by multiple accounts, this
# will surely lead to undesired behavior
names = list(self.getAccountsFromPub... | [
"Obtain",
"the",
"first",
"account",
"name",
"from",
"public",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L230-L238 | [
"def",
"getAccountFromPublicKey",
"(",
"self",
",",
"pub",
")",
":",
"# FIXME, this only returns the first associated key.",
"# If the key is used by multiple accounts, this",
"# will surely lead to undesired behavior",
"names",
"=",
"list",
"(",
"self",
".",
"getAccountsFromPublic... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getKeyType | Get key type | graphenecommon/wallet.py | def getKeyType(self, account, pub):
""" Get key type
"""
for authority in ["owner", "active"]:
for key in account[authority]["key_auths"]:
if str(pub) == key[0]:
return authority
if str(pub) == account["options"]["memo_key"]:
re... | def getKeyType(self, account, pub):
""" Get key type
"""
for authority in ["owner", "active"]:
for key in account[authority]["key_auths"]:
if str(pub) == key[0]:
return authority
if str(pub) == account["options"]["memo_key"]:
re... | [
"Get",
"key",
"type"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L249-L258 | [
"def",
"getKeyType",
"(",
"self",
",",
"account",
",",
"pub",
")",
":",
"for",
"authority",
"in",
"[",
"\"owner\"",
",",
"\"active\"",
"]",
":",
"for",
"key",
"in",
"account",
"[",
"authority",
"]",
"[",
"\"key_auths\"",
"]",
":",
"if",
"str",
"(",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getAccounts | Return all accounts installed in the wallet database | graphenecommon/wallet.py | def getAccounts(self):
""" Return all accounts installed in the wallet database
"""
pubkeys = self.getPublicKeys()
accounts = []
for pubkey in pubkeys:
# Filter those keys not for our network
if pubkey[: len(self.prefix)] == self.prefix:
ac... | def getAccounts(self):
""" Return all accounts installed in the wallet database
"""
pubkeys = self.getPublicKeys()
accounts = []
for pubkey in pubkeys:
# Filter those keys not for our network
if pubkey[: len(self.prefix)] == self.prefix:
ac... | [
"Return",
"all",
"accounts",
"installed",
"in",
"the",
"wallet",
"database"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L260-L269 | [
"def",
"getAccounts",
"(",
"self",
")",
":",
"pubkeys",
"=",
"self",
".",
"getPublicKeys",
"(",
")",
"accounts",
"=",
"[",
"]",
"for",
"pubkey",
"in",
"pubkeys",
":",
"# Filter those keys not for our network",
"if",
"pubkey",
"[",
":",
"len",
"(",
"self",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Wallet.getPublicKeys | Return all installed public keys
:param bool current: If true, returns only keys for currently
connected blockchain | graphenecommon/wallet.py | def getPublicKeys(self, current=False):
""" Return all installed public keys
:param bool current: If true, returns only keys for currently
connected blockchain
"""
pubkeys = self.store.getPublicKeys()
if not current:
return pubkeys
pubs = ... | def getPublicKeys(self, current=False):
""" Return all installed public keys
:param bool current: If true, returns only keys for currently
connected blockchain
"""
pubkeys = self.store.getPublicKeys()
if not current:
return pubkeys
pubs = ... | [
"Return",
"all",
"installed",
"public",
"keys"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/wallet.py#L271-L285 | [
"def",
"getPublicKeys",
"(",
"self",
",",
"current",
"=",
"False",
")",
":",
"pubkeys",
"=",
"self",
".",
"store",
".",
"getPublicKeys",
"(",
")",
"if",
"not",
"current",
":",
"return",
"pubkeys",
"pubs",
"=",
"[",
"]",
"for",
"pubkey",
"in",
"pubkeys"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Websocket.rpcexec | Execute a call by sending the payload
:param json payload: Payload data
:raises ValueError: if the server does not respond in proper JSON
format | grapheneapi/websocket.py | def rpcexec(self, payload):
""" Execute a call by sending the payload
:param json payload: Payload data
:raises ValueError: if the server does not respond in proper JSON
format
"""
if not self.ws: # pragma: no cover
self.connect()
lo... | def rpcexec(self, payload):
""" Execute a call by sending the payload
:param json payload: Payload data
:raises ValueError: if the server does not respond in proper JSON
format
"""
if not self.ws: # pragma: no cover
self.connect()
lo... | [
"Execute",
"a",
"call",
"by",
"sending",
"the",
"payload"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/grapheneapi/websocket.py#L52-L80 | [
"def",
"rpcexec",
"(",
"self",
",",
"payload",
")",
":",
"if",
"not",
"self",
".",
"ws",
":",
"# pragma: no cover",
"self",
".",
"connect",
"(",
")",
"log",
".",
"debug",
"(",
"json",
".",
"dumps",
"(",
"payload",
")",
")",
"# Mutex/Lock",
"# We need t... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Memo.unlock_wallet | Unlock the library internal wallet | graphenecommon/memo.py | def unlock_wallet(self, *args, **kwargs):
""" Unlock the library internal wallet
"""
self.blockchain.wallet.unlock(*args, **kwargs)
return self | def unlock_wallet(self, *args, **kwargs):
""" Unlock the library internal wallet
"""
self.blockchain.wallet.unlock(*args, **kwargs)
return self | [
"Unlock",
"the",
"library",
"internal",
"wallet"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/memo.py#L62-L66 | [
"def",
"unlock_wallet",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"blockchain",
".",
"wallet",
".",
"unlock",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self"
] | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Memo.encrypt | Encrypt a memo
:param str message: clear text memo message
:returns: encrypted message
:rtype: str | graphenecommon/memo.py | def encrypt(self, message):
""" Encrypt a memo
:param str message: clear text memo message
:returns: encrypted message
:rtype: str
"""
if not message:
return None
nonce = str(random.getrandbits(64))
try:
memo_wif = sel... | def encrypt(self, message):
""" Encrypt a memo
:param str message: clear text memo message
:returns: encrypted message
:rtype: str
"""
if not message:
return None
nonce = str(random.getrandbits(64))
try:
memo_wif = sel... | [
"Encrypt",
"a",
"memo"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/memo.py#L68-L112 | [
"def",
"encrypt",
"(",
"self",
",",
"message",
")",
":",
"if",
"not",
"message",
":",
"return",
"None",
"nonce",
"=",
"str",
"(",
"random",
".",
"getrandbits",
"(",
"64",
")",
")",
"try",
":",
"memo_wif",
"=",
"self",
".",
"blockchain",
".",
"wallet"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | Memo.decrypt | Decrypt a message
:param dict message: encrypted memo message
:returns: decrypted message
:rtype: str | graphenecommon/memo.py | def decrypt(self, message):
""" Decrypt a message
:param dict message: encrypted memo message
:returns: decrypted message
:rtype: str
"""
if not message:
return None
# We first try to decode assuming we received the memo
try:
... | def decrypt(self, message):
""" Decrypt a message
:param dict message: encrypted memo message
:returns: decrypted message
:rtype: str
"""
if not message:
return None
# We first try to decode assuming we received the memo
try:
... | [
"Decrypt",
"a",
"message"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/memo.py#L114-L150 | [
"def",
"decrypt",
"(",
"self",
",",
"message",
")",
":",
"if",
"not",
"message",
":",
"return",
"None",
"# We first try to decode assuming we received the memo",
"try",
":",
"memo_wif",
"=",
"self",
".",
"blockchain",
".",
"wallet",
".",
"getPrivateKeyForPublicKey",... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | get_shared_secret | Derive the share secret between ``priv`` and ``pub``
:param `Base58` priv: Private Key
:param `Base58` pub: Public Key
:return: Shared secret
:rtype: hex
The shared secret is generated such that::
Pub(Alice) * Priv(Bob) = Pub(Bob) * Priv(Alice) | graphenebase/memo.py | def get_shared_secret(priv, pub):
""" Derive the share secret between ``priv`` and ``pub``
:param `Base58` priv: Private Key
:param `Base58` pub: Public Key
:return: Shared secret
:rtype: hex
The shared secret is generated such that::
Pub(Alice) * Priv(Bob) = P... | def get_shared_secret(priv, pub):
""" Derive the share secret between ``priv`` and ``pub``
:param `Base58` priv: Private Key
:param `Base58` pub: Public Key
:return: Shared secret
:rtype: hex
The shared secret is generated such that::
Pub(Alice) * Priv(Bob) = P... | [
"Derive",
"the",
"share",
"secret",
"between",
"priv",
"and",
"pub"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/memo.py#L18-L37 | [
"def",
"get_shared_secret",
"(",
"priv",
",",
"pub",
")",
":",
"pub_point",
"=",
"pub",
".",
"point",
"(",
")",
"priv_point",
"=",
"int",
"(",
"repr",
"(",
"priv",
")",
",",
"16",
")",
"res",
"=",
"pub_point",
"*",
"priv_point",
"res_hex",
"=",
"\"%0... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | init_aes | Initialize AES instance
:param hex shared_secret: Shared Secret to use as encryption key
:param int nonce: Random nonce
:return: AES instance
:rtype: AES | graphenebase/memo.py | def init_aes(shared_secret, nonce):
""" Initialize AES instance
:param hex shared_secret: Shared Secret to use as encryption key
:param int nonce: Random nonce
:return: AES instance
:rtype: AES
"""
" Shared Secret "
ss = hashlib.sha512(unhexlify(shared_secret)).digest()... | def init_aes(shared_secret, nonce):
""" Initialize AES instance
:param hex shared_secret: Shared Secret to use as encryption key
:param int nonce: Random nonce
:return: AES instance
:rtype: AES
"""
" Shared Secret "
ss = hashlib.sha512(unhexlify(shared_secret)).digest()... | [
"Initialize",
"AES",
"instance"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/memo.py#L40-L57 | [
"def",
"init_aes",
"(",
"shared_secret",
",",
"nonce",
")",
":",
"\" Shared Secret \"",
"ss",
"=",
"hashlib",
".",
"sha512",
"(",
"unhexlify",
"(",
"shared_secret",
")",
")",
".",
"digest",
"(",
")",
"\" Seed \"",
"seed",
"=",
"bytes",
"(",
"str",
"(",
"... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | encode_memo | Encode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Alice)
:param PublicKey pub: Public Key (of Bob)
:param int nonce: Random nonce
:param str message: Memo message
:return: Encrypted message
:rtype: hex | graphenebase/memo.py | def encode_memo(priv, pub, nonce, message):
""" Encode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Alice)
:param PublicKey pub: Public Key (of Bob)
:param int nonce: Random nonce
:param str message: Memo message
:return: Encry... | def encode_memo(priv, pub, nonce, message):
""" Encode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Alice)
:param PublicKey pub: Public Key (of Bob)
:param int nonce: Random nonce
:param str message: Memo message
:return: Encry... | [
"Encode",
"a",
"message",
"with",
"a",
"shared",
"secret",
"between",
"Alice",
"and",
"Bob"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/memo.py#L72-L92 | [
"def",
"encode_memo",
"(",
"priv",
",",
"pub",
",",
"nonce",
",",
"message",
")",
":",
"shared_secret",
"=",
"get_shared_secret",
"(",
"priv",
",",
"pub",
")",
"aes",
"=",
"init_aes",
"(",
"shared_secret",
",",
"nonce",
")",
"\" Checksum \"",
"raw",
"=",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | decode_memo | Decode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Bob)
:param PublicKey pub: Public Key (of Alice)
:param int nonce: Nonce used for Encryption
:param bytes message: Encrypted Memo message
:return: Decrypted message
:rtype... | graphenebase/memo.py | def decode_memo(priv, pub, nonce, message):
""" Decode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Bob)
:param PublicKey pub: Public Key (of Alice)
:param int nonce: Nonce used for Encryption
:param bytes message: Encrypted Memo messa... | def decode_memo(priv, pub, nonce, message):
""" Decode a message with a shared secret between Alice and Bob
:param PrivateKey priv: Private Key (of Bob)
:param PublicKey pub: Public Key (of Alice)
:param int nonce: Nonce used for Encryption
:param bytes message: Encrypted Memo messa... | [
"Decode",
"a",
"message",
"with",
"a",
"shared",
"secret",
"between",
"Alice",
"and",
"Bob"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenebase/memo.py#L95-L121 | [
"def",
"decode_memo",
"(",
"priv",
",",
"pub",
",",
"nonce",
",",
"message",
")",
":",
"shared_secret",
"=",
"get_shared_secret",
"(",
"priv",
",",
"pub",
")",
"aes",
"=",
"init_aes",
"(",
"shared_secret",
",",
"nonce",
")",
"\" Encryption \"",
"raw",
"=",... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | MessageV1.sign | Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the signed message encapsulated in a known format | graphenecommon/message.py | def sign(self, account=None, **kwargs):
""" Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the sign... | def sign(self, account=None, **kwargs):
""" Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the sign... | [
"Sign",
"a",
"message",
"with",
"an",
"account",
"s",
"memo",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/message.py#L64-L110 | [
"def",
"sign",
"(",
"self",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"account",
":",
"if",
"\"default_account\"",
"in",
"self",
".",
"blockchain",
".",
"config",
":",
"account",
"=",
"self",
".",
"blockchain",
".",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | MessageV1.verify | Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature if the signature is not ok | graphenecommon/message.py | def verify(self, **kwargs):
""" Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature ... | def verify(self, **kwargs):
""" Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature ... | [
"Verify",
"a",
"message",
"with",
"an",
"account",
"s",
"memo",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/message.py#L112-L190 | [
"def",
"verify",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Split message into its parts",
"parts",
"=",
"re",
".",
"split",
"(",
"\"|\"",
".",
"join",
"(",
"self",
".",
"MESSAGE_SPLIT",
")",
",",
"self",
".",
"message",
")",
"parts",
"=",
"[",... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | MessageV2.sign | Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the signed message encapsulated in a known format | graphenecommon/message.py | def sign(self, account=None, **kwargs):
""" Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the sign... | def sign(self, account=None, **kwargs):
""" Sign a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:raises ValueError: If not account for signing is provided
:returns: the sign... | [
"Sign",
"a",
"message",
"with",
"an",
"account",
"s",
"memo",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/message.py#L208-L246 | [
"def",
"sign",
"(",
"self",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"account",
":",
"if",
"\"default_account\"",
"in",
"self",
".",
"blockchain",
".",
"config",
":",
"account",
"=",
"self",
".",
"blockchain",
".",
... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | MessageV2.verify | Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature if the signature is not ok | graphenecommon/message.py | def verify(self, **kwargs):
""" Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature ... | def verify(self, **kwargs):
""" Verify a message with an account's memo key
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
:returns: True if the message is verified successfully
:raises InvalidMessageSignature ... | [
"Verify",
"a",
"message",
"with",
"an",
"account",
"s",
"memo",
"key"
] | xeroc/python-graphenelib | python | https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/message.py#L248-L326 | [
"def",
"verify",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"message",
",",
"dict",
")",
":",
"try",
":",
"self",
".",
"message",
"=",
"json",
".",
"loads",
"(",
"self",
".",
"message",
")",
"exce... | 8bb5396bc79998ee424cf3813af478304173f3a6 |
valid | env | Verify IPMI environment | modules/cij/ipmi.py | def env():
"""Verify IPMI environment"""
ipmi = cij.env_to_dict(PREFIX, REQUIRED)
if ipmi is None:
ipmi["USER"] = "admin"
ipmi["PASS"] = "admin"
ipmi["HOST"] = "localhost"
ipmi["PORT"] = "623"
cij.info("ipmi.env: USER: %s, PASS: %s, HOST: %s, PORT: %s" % (
... | def env():
"""Verify IPMI environment"""
ipmi = cij.env_to_dict(PREFIX, REQUIRED)
if ipmi is None:
ipmi["USER"] = "admin"
ipmi["PASS"] = "admin"
ipmi["HOST"] = "localhost"
ipmi["PORT"] = "623"
cij.info("ipmi.env: USER: %s, PASS: %s, HOST: %s, PORT: %s" % (
... | [
"Verify",
"IPMI",
"environment"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ipmi.py#L27-L43 | [
"def",
"env",
"(",
")",
":",
"ipmi",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"if",
"ipmi",
"is",
"None",
":",
"ipmi",
"[",
"\"USER\"",
"]",
"=",
"\"admin\"",
"ipmi",
"[",
"\"PASS\"",
"]",
"=",
"\"admin\"",
"ipmi",
"[",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | cmd | Send IPMI 'command' via ipmitool | modules/cij/ipmi.py | def cmd(command):
"""Send IPMI 'command' via ipmitool"""
env()
ipmi = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
command = "ipmitool -U %s -P %s -H %s -p %s %s" % (
ipmi["USER"], ipmi["PASS"], ipmi["HOST"], ipmi["PORT"], command)
cij.info("ipmi.command: %s" % command)
return cij.ut... | def cmd(command):
"""Send IPMI 'command' via ipmitool"""
env()
ipmi = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
command = "ipmitool -U %s -P %s -H %s -p %s %s" % (
ipmi["USER"], ipmi["PASS"], ipmi["HOST"], ipmi["PORT"], command)
cij.info("ipmi.command: %s" % command)
return cij.ut... | [
"Send",
"IPMI",
"command",
"via",
"ipmitool"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ipmi.py#L46-L57 | [
"def",
"cmd",
"(",
"command",
")",
":",
"env",
"(",
")",
"ipmi",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"EXPORTED",
"+",
"REQUIRED",
")",
"command",
"=",
"\"ipmitool -U %s -P %s -H %s -p %s %s\"",
"%",
"(",
"ipmi",
"[",
"\"USER\"",
"]",
",",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | regex_find | Find the given 'pattern' in 'content | modules/cij/util.py | def regex_find(pattern, content):
"""Find the given 'pattern' in 'content'"""
find = re.findall(pattern, content)
if not find:
cij.err("pattern <%r> is invalid, no matches!" % pattern)
cij.err("content: %r" % content)
return ''
if len(find) >= 2:
cij.err("pattern <%r> i... | def regex_find(pattern, content):
"""Find the given 'pattern' in 'content'"""
find = re.findall(pattern, content)
if not find:
cij.err("pattern <%r> is invalid, no matches!" % pattern)
cij.err("content: %r" % content)
return ''
if len(find) >= 2:
cij.err("pattern <%r> i... | [
"Find",
"the",
"given",
"pattern",
"in",
"content"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/util.py#L17-L31 | [
"def",
"regex_find",
"(",
"pattern",
",",
"content",
")",
":",
"find",
"=",
"re",
".",
"findall",
"(",
"pattern",
",",
"content",
")",
"if",
"not",
"find",
":",
"cij",
".",
"err",
"(",
"\"pattern <%r> is invalid, no matches!\"",
"%",
"pattern",
")",
"cij",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | execute | Execute the given 'cmd'
@returns (rcode, stdout, stderr) | modules/cij/util.py | def execute(cmd=None, shell=True, echo=True):
"""
Execute the given 'cmd'
@returns (rcode, stdout, stderr)
"""
if echo:
cij.emph("cij.util.execute: shell: %r, cmd: %r" % (shell, cmd))
rcode = 1
stdout, stderr = ("", "")
if cmd:
if shell:
cmd = " ".join(cmd)... | def execute(cmd=None, shell=True, echo=True):
"""
Execute the given 'cmd'
@returns (rcode, stdout, stderr)
"""
if echo:
cij.emph("cij.util.execute: shell: %r, cmd: %r" % (shell, cmd))
rcode = 1
stdout, stderr = ("", "")
if cmd:
if shell:
cmd = " ".join(cmd)... | [
"Execute",
"the",
"given",
"cmd"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/util.py#L34-L59 | [
"def",
"execute",
"(",
"cmd",
"=",
"None",
",",
"shell",
"=",
"True",
",",
"echo",
"=",
"True",
")",
":",
"if",
"echo",
":",
"cij",
".",
"emph",
"(",
"\"cij.util.execute: shell: %r, cmd: %r\"",
"%",
"(",
"shell",
",",
"cmd",
")",
")",
"rcode",
"=",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify BOARD variables and construct exported variables | modules/cij/board.py | def env():
"""Verify BOARD variables and construct exported variables"""
if cij.ssh.env():
cij.err("board.env: invalid SSH environment")
return 1
board = cij.env_to_dict(PREFIX, REQUIRED) # Verify REQUIRED variables
if board is None:
cij.err("board.env: invalid BOARD environm... | def env():
"""Verify BOARD variables and construct exported variables"""
if cij.ssh.env():
cij.err("board.env: invalid SSH environment")
return 1
board = cij.env_to_dict(PREFIX, REQUIRED) # Verify REQUIRED variables
if board is None:
cij.err("board.env: invalid BOARD environm... | [
"Verify",
"BOARD",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/board.py#L12-L29 | [
"def",
"env",
"(",
")",
":",
"if",
"cij",
".",
"ssh",
".",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"board.env: invalid SSH environment\"",
")",
"return",
"1",
"board",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"# Veri... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | cat_file | Cat file and return content | deprecated/modules/cij/nvme.py | def cat_file(path):
"""Cat file and return content"""
cmd = ["cat", path]
status, stdout, _ = cij.ssh.command(cmd, shell=True, echo=True)
if status:
raise RuntimeError("cij.nvme.env: cat %s failed" % path)
return stdout.strip() | def cat_file(path):
"""Cat file and return content"""
cmd = ["cat", path]
status, stdout, _ = cij.ssh.command(cmd, shell=True, echo=True)
if status:
raise RuntimeError("cij.nvme.env: cat %s failed" % path)
return stdout.strip() | [
"Cat",
"file",
"and",
"return",
"content"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvme.py#L30-L37 | [
"def",
"cat_file",
"(",
"path",
")",
":",
"cmd",
"=",
"[",
"\"cat\"",
",",
"path",
"]",
"status",
",",
"stdout",
",",
"_",
"=",
"cij",
".",
"ssh",
".",
"command",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"echo",
"=",
"True",
")",
"if",
"stat... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify NVME variables and construct exported variables | deprecated/modules/cij/nvme.py | def env():
"""Verify NVME variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.nvme.env: invalid SSH environment")
return 1
nvme = cij.env_to_dict(PREFIX, REQUIRED)
nvme["DEV_PATH"] = os.path.join("/dev", nvme["DEV_NAME"])
# get version, chunks, luns and c... | def env():
"""Verify NVME variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.nvme.env: invalid SSH environment")
return 1
nvme = cij.env_to_dict(PREFIX, REQUIRED)
nvme["DEV_PATH"] = os.path.join("/dev", nvme["DEV_NAME"])
# get version, chunks, luns and c... | [
"Verify",
"NVME",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvme.py#L40-L100 | [
"def",
"env",
"(",
")",
":",
"if",
"cij",
".",
"ssh",
".",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.nvme.env: invalid SSH environment\"",
")",
"return",
"1",
"nvme",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"nvme... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | fmt | Do format for NVMe device | deprecated/modules/cij/nvme.py | def fmt(lbaf=3):
"""Do format for NVMe device"""
if env():
cij.err("cij.nvme.exists: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cmd = ["nvme", "format", nvme["DEV_PATH"], "-l", str(lbaf)]
rcode, _, _ = cij.ssh.command(cmd, shell=True)
ret... | def fmt(lbaf=3):
"""Do format for NVMe device"""
if env():
cij.err("cij.nvme.exists: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cmd = ["nvme", "format", nvme["DEV_PATH"], "-l", str(lbaf)]
rcode, _, _ = cij.ssh.command(cmd, shell=True)
ret... | [
"Do",
"format",
"for",
"NVMe",
"device"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvme.py#L103-L115 | [
"def",
"fmt",
"(",
"lbaf",
"=",
"3",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.nvme.exists: Invalid NVMe ENV.\"",
")",
"return",
"1",
"nvme",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"EXPORTED",
"+",
"REQUIRED",
")... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | get_meta | Get chunk meta of NVMe device | deprecated/modules/cij/nvme.py | def get_meta(offset, length, output):
"""Get chunk meta of NVMe device"""
if env():
cij.err("cij.nvme.meta: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
max_size = 0x40000
with open(output, "wb") as fout:
for off in range(offset, length,... | def get_meta(offset, length, output):
"""Get chunk meta of NVMe device"""
if env():
cij.err("cij.nvme.meta: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
max_size = 0x40000
with open(output, "wb") as fout:
for off in range(offset, length,... | [
"Get",
"chunk",
"meta",
"of",
"NVMe",
"device"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvme.py#L135-L161 | [
"def",
"get_meta",
"(",
"offset",
",",
"length",
",",
"output",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.nvme.meta: Invalid NVMe ENV.\"",
")",
"return",
"1",
"nvme",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"EXPORTE... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | comp_meta | Compare chunk meta, mode=[pfail, power, reboot] | deprecated/modules/cij/nvme.py | def comp_meta(file_bef, file_aft, mode="pfail"):
"""Compare chunk meta, mode=[pfail, power, reboot]"""
if env():
cij.err("cij.nvme.comp_meta: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
num_chk = int(nvme["LNVM_TOTAL_CHUNKS"])
meta_bef = cij.bin... | def comp_meta(file_bef, file_aft, mode="pfail"):
"""Compare chunk meta, mode=[pfail, power, reboot]"""
if env():
cij.err("cij.nvme.comp_meta: Invalid NVMe ENV.")
return 1
nvme = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
num_chk = int(nvme["LNVM_TOTAL_CHUNKS"])
meta_bef = cij.bin... | [
"Compare",
"chunk",
"meta",
"mode",
"=",
"[",
"pfail",
"power",
"reboot",
"]"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvme.py#L164-L194 | [
"def",
"comp_meta",
"(",
"file_bef",
",",
"file_aft",
",",
"mode",
"=",
"\"pfail\"",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.nvme.comp_meta: Invalid NVMe ENV.\"",
")",
"return",
"1",
"nvme",
"=",
"cij",
".",
"env_to_dict",
"(",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | get_sizeof_descriptor_table | Get sizeof DescriptorTable | deprecated/modules/cij/struct/chunk_info.py | def get_sizeof_descriptor_table(version="Denali"):
"""
Get sizeof DescriptorTable
"""
if version == "Denali":
return sizeof(DescriptorTableDenali)
elif version == "Spec20":
return sizeof(DescriptorTableSpec20)
elif version == "Spec12":
return 0
else:
... | def get_sizeof_descriptor_table(version="Denali"):
"""
Get sizeof DescriptorTable
"""
if version == "Denali":
return sizeof(DescriptorTableDenali)
elif version == "Spec20":
return sizeof(DescriptorTableSpec20)
elif version == "Spec12":
return 0
else:
... | [
"Get",
"sizeof",
"DescriptorTable"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/struct/chunk_info.py#L53-L64 | [
"def",
"get_sizeof_descriptor_table",
"(",
"version",
"=",
"\"Denali\"",
")",
":",
"if",
"version",
"==",
"\"Denali\"",
":",
"return",
"sizeof",
"(",
"DescriptorTableDenali",
")",
"elif",
"version",
"==",
"\"Spec20\"",
":",
"return",
"sizeof",
"(",
"DescriptorTabl... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify LNVM variables and construct exported variables | modules/cij/lnvm.py | def env():
"""Verify LNVM variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.lnvm.env: invalid SSH environment")
return 1
lnvm = cij.env_to_dict(PREFIX, REQUIRED)
nvme = cij.env_to_dict("NVME", ["DEV_NAME"])
if "BGN" not in lnvm.keys():
cij.err("c... | def env():
"""Verify LNVM variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.lnvm.env: invalid SSH environment")
return 1
lnvm = cij.env_to_dict(PREFIX, REQUIRED)
nvme = cij.env_to_dict("NVME", ["DEV_NAME"])
if "BGN" not in lnvm.keys():
cij.err("c... | [
"Verify",
"LNVM",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/lnvm.py#L13-L38 | [
"def",
"env",
"(",
")",
":",
"if",
"cij",
".",
"ssh",
".",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.lnvm.env: invalid SSH environment\"",
")",
"return",
"1",
"lnvm",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"nvme... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | create | Create LNVM device | modules/cij/lnvm.py | def create():
"""Create LNVM device"""
if env():
cij.err("cij.lnvm.create: Invalid LNVM ENV")
return 1
nvme = cij.env_to_dict("NVME", ["DEV_NAME"])
lnvm = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cij.emph("lnvm.create: LNVM_DEV_NAME: %s" % lnvm["DEV_NAME"])
cmd = ["nvme ln... | def create():
"""Create LNVM device"""
if env():
cij.err("cij.lnvm.create: Invalid LNVM ENV")
return 1
nvme = cij.env_to_dict("NVME", ["DEV_NAME"])
lnvm = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cij.emph("lnvm.create: LNVM_DEV_NAME: %s" % lnvm["DEV_NAME"])
cmd = ["nvme ln... | [
"Create",
"LNVM",
"device"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/lnvm.py#L41-L59 | [
"def",
"create",
"(",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.lnvm.create: Invalid LNVM ENV\"",
")",
"return",
"1",
"nvme",
"=",
"cij",
".",
"env_to_dict",
"(",
"\"NVME\"",
",",
"[",
"\"DEV_NAME\"",
"]",
")",
"lnvm",
"=",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | dump | Dump UnionType/StructType to STDOUT | modules/cij/bin.py | def dump(buf, indent=0, skip=""):
"""Dump UnionType/StructType to STDOUT"""
if not isinstance(type(buf), (type(Union), type(Structure))):
raise RuntimeError("Error type(%s)" % type(buf))
for field in getattr(buf, '_fields_'):
name, types = field[0], field[1]
if name in skip:
... | def dump(buf, indent=0, skip=""):
"""Dump UnionType/StructType to STDOUT"""
if not isinstance(type(buf), (type(Union), type(Structure))):
raise RuntimeError("Error type(%s)" % type(buf))
for field in getattr(buf, '_fields_'):
name, types = field[0], field[1]
if name in skip:
... | [
"Dump",
"UnionType",
"/",
"StructType",
"to",
"STDOUT"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L19-L43 | [
"def",
"dump",
"(",
"buf",
",",
"indent",
"=",
"0",
",",
"skip",
"=",
"\"\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"type",
"(",
"buf",
")",
",",
"(",
"type",
"(",
"Union",
")",
",",
"type",
"(",
"Structure",
")",
")",
")",
":",
"raise",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | compare | Compare of two Buffer item | modules/cij/bin.py | def compare(buf_a, buf_b, ignore):
"""Compare of two Buffer item"""
for field in getattr(buf_a, '_fields_'):
name, types = field[0], field[1]
if name in ignore:
continue
val_a = getattr(buf_a, name)
val_b = getattr(buf_b, name)
if isinstance(types, (type(Un... | def compare(buf_a, buf_b, ignore):
"""Compare of two Buffer item"""
for field in getattr(buf_a, '_fields_'):
name, types = field[0], field[1]
if name in ignore:
continue
val_a = getattr(buf_a, name)
val_b = getattr(buf_b, name)
if isinstance(types, (type(Un... | [
"Compare",
"of",
"two",
"Buffer",
"item"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L46-L72 | [
"def",
"compare",
"(",
"buf_a",
",",
"buf_b",
",",
"ignore",
")",
":",
"for",
"field",
"in",
"getattr",
"(",
"buf_a",
",",
"'_fields_'",
")",
":",
"name",
",",
"types",
"=",
"field",
"[",
"0",
"]",
",",
"field",
"[",
"1",
"]",
"if",
"name",
"in",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Buffer.memcopy | Copy stream to buffer | modules/cij/bin.py | def memcopy(self, stream, offset=0, length=float("inf")):
"""Copy stream to buffer"""
data = [ord(i) for i in list(stream)]
size = min(length, len(data), self.m_size)
buff = cast(self.m_buf, POINTER(c_uint8))
for i in range(size):
buff[offset + i] = data[i] | def memcopy(self, stream, offset=0, length=float("inf")):
"""Copy stream to buffer"""
data = [ord(i) for i in list(stream)]
size = min(length, len(data), self.m_size)
buff = cast(self.m_buf, POINTER(c_uint8))
for i in range(size):
buff[offset + i] = data[i] | [
"Copy",
"stream",
"to",
"buffer"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L106-L112 | [
"def",
"memcopy",
"(",
"self",
",",
"stream",
",",
"offset",
"=",
"0",
",",
"length",
"=",
"float",
"(",
"\"inf\"",
")",
")",
":",
"data",
"=",
"[",
"ord",
"(",
"i",
")",
"for",
"i",
"in",
"list",
"(",
"stream",
")",
"]",
"size",
"=",
"min",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Buffer.write | Write buffer to file | modules/cij/bin.py | def write(self, path):
"""Write buffer to file"""
with open(path, "wb") as fout:
fout.write(self.m_buf) | def write(self, path):
"""Write buffer to file"""
with open(path, "wb") as fout:
fout.write(self.m_buf) | [
"Write",
"buffer",
"to",
"file"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L114-L118 | [
"def",
"write",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"\"wb\"",
")",
"as",
"fout",
":",
"fout",
".",
"write",
"(",
"self",
".",
"m_buf",
")"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Buffer.read | Read file to buffer | modules/cij/bin.py | def read(self, path):
"""Read file to buffer"""
with open(path, "rb") as fout:
memmove(self.m_buf, fout.read(self.m_size), self.m_size) | def read(self, path):
"""Read file to buffer"""
with open(path, "rb") as fout:
memmove(self.m_buf, fout.read(self.m_size), self.m_size) | [
"Read",
"file",
"to",
"buffer"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L120-L124 | [
"def",
"read",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"\"rb\"",
")",
"as",
"fout",
":",
"memmove",
"(",
"self",
".",
"m_buf",
",",
"fout",
".",
"read",
"(",
"self",
".",
"m_size",
")",
",",
"self",
".",
"m_size",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Buffer.dump | Dump item | modules/cij/bin.py | def dump(self, offset=0, length=1):
"""Dump item"""
for i in range(offset, offset + length):
if "ctypes" in str(self.m_types):
cij.info("Buff[%s]: %s" % (i, self.m_buf[i]))
else:
cij.info("Buff[%s]:" % i)
dump(self.m_buf[i], 2) | def dump(self, offset=0, length=1):
"""Dump item"""
for i in range(offset, offset + length):
if "ctypes" in str(self.m_types):
cij.info("Buff[%s]: %s" % (i, self.m_buf[i]))
else:
cij.info("Buff[%s]:" % i)
dump(self.m_buf[i], 2) | [
"Dump",
"item"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L126-L134 | [
"def",
"dump",
"(",
"self",
",",
"offset",
"=",
"0",
",",
"length",
"=",
"1",
")",
":",
"for",
"i",
"in",
"range",
"(",
"offset",
",",
"offset",
"+",
"length",
")",
":",
"if",
"\"ctypes\"",
"in",
"str",
"(",
"self",
".",
"m_types",
")",
":",
"c... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Buffer.compare | Compare buffer | modules/cij/bin.py | def compare(self, buf, offset=0, length=1, ignore=""):
"""Compare buffer"""
for i in range(offset, offset + length):
if isinstance(self.m_types, (type(Union), type(Structure))):
if compare(self.m_buf[i], buf[i], ignore=ignore):
return 1
elif s... | def compare(self, buf, offset=0, length=1, ignore=""):
"""Compare buffer"""
for i in range(offset, offset + length):
if isinstance(self.m_types, (type(Union), type(Structure))):
if compare(self.m_buf[i], buf[i], ignore=ignore):
return 1
elif s... | [
"Compare",
"buffer"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/bin.py#L136-L146 | [
"def",
"compare",
"(",
"self",
",",
"buf",
",",
"offset",
"=",
"0",
",",
"length",
"=",
"1",
",",
"ignore",
"=",
"\"\"",
")",
":",
"for",
"i",
"in",
"range",
"(",
"offset",
",",
"offset",
"+",
"length",
")",
":",
"if",
"isinstance",
"(",
"self",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Relay.power_on | 230v power on | modules/cij/usb.py | def power_on(self, interval=200):
"""230v power on"""
if self.__power_on_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_ON")
return 1
return self.__press(self.__power_on_port, interval=interval) | def power_on(self, interval=200):
"""230v power on"""
if self.__power_on_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_ON")
return 1
return self.__press(self.__power_on_port, interval=interval) | [
"230v",
"power",
"on"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/usb.py#L99-L105 | [
"def",
"power_on",
"(",
"self",
",",
"interval",
"=",
"200",
")",
":",
"if",
"self",
".",
"__power_on_port",
"is",
"None",
":",
"cij",
".",
"err",
"(",
"\"cij.usb.relay: Invalid USB_RELAY_POWER_ON\"",
")",
"return",
"1",
"return",
"self",
".",
"__press",
"("... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Relay.power_off | 230v power off | modules/cij/usb.py | def power_off(self, interval=200):
"""230v power off"""
if self.__power_off_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_OFF")
return 1
return self.__press(self.__power_off_port, interval=interval) | def power_off(self, interval=200):
"""230v power off"""
if self.__power_off_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_OFF")
return 1
return self.__press(self.__power_off_port, interval=interval) | [
"230v",
"power",
"off"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/usb.py#L107-L113 | [
"def",
"power_off",
"(",
"self",
",",
"interval",
"=",
"200",
")",
":",
"if",
"self",
".",
"__power_off_port",
"is",
"None",
":",
"cij",
".",
"err",
"(",
"\"cij.usb.relay: Invalid USB_RELAY_POWER_OFF\"",
")",
"return",
"1",
"return",
"self",
".",
"__press",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Relay.power_btn | TARGET power button | modules/cij/usb.py | def power_btn(self, interval=200):
"""TARGET power button"""
if self.__power_btn_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_BTN")
return 1
return self.__press(self.__power_btn_port, interval=interval) | def power_btn(self, interval=200):
"""TARGET power button"""
if self.__power_btn_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_BTN")
return 1
return self.__press(self.__power_btn_port, interval=interval) | [
"TARGET",
"power",
"button"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/usb.py#L115-L121 | [
"def",
"power_btn",
"(",
"self",
",",
"interval",
"=",
"200",
")",
":",
"if",
"self",
".",
"__power_btn_port",
"is",
"None",
":",
"cij",
".",
"err",
"(",
"\"cij.usb.relay: Invalid USB_RELAY_POWER_BTN\"",
")",
"return",
"1",
"return",
"self",
".",
"__press",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.get_chunk_information | Get chunk information | deprecated/modules/cij/spdk.py | def get_chunk_information(self, chk, lun, chunk_name):
"""Get chunk information"""
cmd = ["nvm_cmd rprt_lun", self.envs,
"%d %d > %s" % (chk, lun, chunk_name)]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | def get_chunk_information(self, chk, lun, chunk_name):
"""Get chunk information"""
cmd = ["nvm_cmd rprt_lun", self.envs,
"%d %d > %s" % (chk, lun, chunk_name)]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | [
"Get",
"chunk",
"information"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L55-L60 | [
"def",
"get_chunk_information",
"(",
"self",
",",
"chk",
",",
"lun",
",",
"chunk_name",
")",
":",
"cmd",
"=",
"[",
"\"nvm_cmd rprt_lun\"",
",",
"self",
".",
"envs",
",",
"\"%d %d > %s\"",
"%",
"(",
"chk",
",",
"lun",
",",
"chunk_name",
")",
"]",
"status"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.is_bad_chunk | Check the chunk is offline or not | deprecated/modules/cij/spdk.py | def is_bad_chunk(self, chk, yml):
"""Check the chunk is offline or not"""
cs = self.get_chunk_status(chk, yml)
if cs >= 8:
return True
return False | def is_bad_chunk(self, chk, yml):
"""Check the chunk is offline or not"""
cs = self.get_chunk_status(chk, yml)
if cs >= 8:
return True
return False | [
"Check",
"the",
"chunk",
"is",
"offline",
"or",
"not"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L62-L67 | [
"def",
"is_bad_chunk",
"(",
"self",
",",
"chk",
",",
"yml",
")",
":",
"cs",
"=",
"self",
".",
"get_chunk_status",
"(",
"chk",
",",
"yml",
")",
"if",
"cs",
">=",
"8",
":",
"return",
"True",
"return",
"False"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.is_free_chunk | Check the chunk is free or not | deprecated/modules/cij/spdk.py | def is_free_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x1 != 0:
return True
return False | def is_free_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x1 != 0:
return True
return False | [
"Check",
"the",
"chunk",
"is",
"free",
"or",
"not"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L69-L74 | [
"def",
"is_free_chunk",
"(",
"self",
",",
"chk",
")",
":",
"cs",
"=",
"self",
".",
"get_chunk_status",
"(",
"chk",
")",
"if",
"cs",
"&",
"0x1",
"!=",
"0",
":",
"return",
"True",
"return",
"False"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.is_closed_chunk | Check the chunk is free or not | deprecated/modules/cij/spdk.py | def is_closed_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x2 != 0:
return True
return False | def is_closed_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x2 != 0:
return True
return False | [
"Check",
"the",
"chunk",
"is",
"free",
"or",
"not"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L76-L81 | [
"def",
"is_closed_chunk",
"(",
"self",
",",
"chk",
")",
":",
"cs",
"=",
"self",
".",
"get_chunk_status",
"(",
"chk",
")",
"if",
"cs",
"&",
"0x2",
"!=",
"0",
":",
"return",
"True",
"return",
"False"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.is_open_chunk | Check the chunk is free or not | deprecated/modules/cij/spdk.py | def is_open_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x4 != 0:
return True
return False | def is_open_chunk(self, chk):
"""Check the chunk is free or not"""
cs = self.get_chunk_status(chk)
if cs & 0x4 != 0:
return True
return False | [
"Check",
"the",
"chunk",
"is",
"free",
"or",
"not"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L83-L88 | [
"def",
"is_open_chunk",
"(",
"self",
",",
"chk",
")",
":",
"cs",
"=",
"self",
".",
"get_chunk_status",
"(",
"chk",
")",
"if",
"cs",
"&",
"0x4",
"!=",
"0",
":",
"return",
"True",
"return",
"False"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.vblk_erase | nvm_vblk erase | deprecated/modules/cij/spdk.py | def vblk_erase(self, address):
"""nvm_vblk erase"""
cmd = ["nvm_vblk erase", self.envs, "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | def vblk_erase(self, address):
"""nvm_vblk erase"""
cmd = ["nvm_vblk erase", self.envs, "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | [
"nvm_vblk",
"erase"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L117-L121 | [
"def",
"vblk_erase",
"(",
"self",
",",
"address",
")",
":",
"cmd",
"=",
"[",
"\"nvm_vblk erase\"",
",",
"self",
".",
"envs",
",",
"\"0x%x\"",
"%",
"address",
"]",
"status",
",",
"_",
",",
"_",
"=",
"cij",
".",
"ssh",
".",
"command",
"(",
"cmd",
","... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Spdk.slc_erase | slc erase | deprecated/modules/cij/spdk.py | def slc_erase(self, address, BE_ID=0x1, PMODE=0x0100):
"""slc erase"""
cmd = ["NVM_CLI_BE_ID=0x%x" % BE_ID, "NVM_CLI_PMODE=0x%x" % PMODE, "nvm_cmd erase", self.envs, "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | def slc_erase(self, address, BE_ID=0x1, PMODE=0x0100):
"""slc erase"""
cmd = ["NVM_CLI_BE_ID=0x%x" % BE_ID, "NVM_CLI_PMODE=0x%x" % PMODE, "nvm_cmd erase", self.envs, "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | [
"slc",
"erase"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/spdk.py#L205-L209 | [
"def",
"slc_erase",
"(",
"self",
",",
"address",
",",
"BE_ID",
"=",
"0x1",
",",
"PMODE",
"=",
"0x0100",
")",
":",
"cmd",
"=",
"[",
"\"NVM_CLI_BE_ID=0x%x\"",
"%",
"BE_ID",
",",
"\"NVM_CLI_PMODE=0x%x\"",
"%",
"PMODE",
",",
"\"nvm_cmd erase\"",
",",
"self",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify BLOCK variables and construct exported variables | modules/cij/block.py | def env():
"""Verify BLOCK variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.block.env: invalid SSH environment")
return 1
block = cij.env_to_dict(PREFIX, REQUIRED)
block["DEV_PATH"] = "/dev/%s" % block["DEV_NAME"]
cij.env_export(PREFIX, EXPORTED, block... | def env():
"""Verify BLOCK variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.block.env: invalid SSH environment")
return 1
block = cij.env_to_dict(PREFIX, REQUIRED)
block["DEV_PATH"] = "/dev/%s" % block["DEV_NAME"]
cij.env_export(PREFIX, EXPORTED, block... | [
"Verify",
"BLOCK",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/block.py#L13-L26 | [
"def",
"env",
"(",
")",
":",
"if",
"cij",
".",
"ssh",
".",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.block.env: invalid SSH environment\"",
")",
"return",
"1",
"block",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"bl... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | script_run | Execute a script or testcase | modules/cij/runner.py | def script_run(trun, script):
"""Execute a script or testcase"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:script:run { script: %s }" % script)
cij.emph("rnr:script:run:evars: %s" % script["evars"])
launchers = {
".py": "python",
".sh": "source"
}
ext = os.path.spl... | def script_run(trun, script):
"""Execute a script or testcase"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:script:run { script: %s }" % script)
cij.emph("rnr:script:run:evars: %s" % script["evars"])
launchers = {
".py": "python",
".sh": "source"
}
ext = os.path.spl... | [
"Execute",
"a",
"script",
"or",
"testcase"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L115-L176 | [
"def",
"script_run",
"(",
"trun",
",",
"script",
")",
":",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:script:run { script: %s }\"",
"%",
"script",
")",
"cij",
".",
"emph",
"(",
"\"rnr:script:run:evars: %... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | hook_setup | Setup hook | modules/cij/runner.py | def hook_setup(parent, hook_fpath):
"""Setup hook"""
hook = copy.deepcopy(HOOK)
hook["name"] = os.path.splitext(os.path.basename(hook_fpath))[0]
hook["name"] = hook["name"].replace("_enter", "").replace("_exit", "")
hook["res_root"] = parent["res_root"]
hook["fpath_orig"] = hook_fpath
hook[... | def hook_setup(parent, hook_fpath):
"""Setup hook"""
hook = copy.deepcopy(HOOK)
hook["name"] = os.path.splitext(os.path.basename(hook_fpath))[0]
hook["name"] = hook["name"].replace("_enter", "").replace("_exit", "")
hook["res_root"] = parent["res_root"]
hook["fpath_orig"] = hook_fpath
hook[... | [
"Setup",
"hook"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L178-L197 | [
"def",
"hook_setup",
"(",
"parent",
",",
"hook_fpath",
")",
":",
"hook",
"=",
"copy",
".",
"deepcopy",
"(",
"HOOK",
")",
"hook",
"[",
"\"name\"",
"]",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"hook_fpath"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | hooks_setup | Setup test-hooks
@returns dict of hook filepaths {"enter": [], "exit": []} | modules/cij/runner.py | def hooks_setup(trun, parent, hnames=None):
"""
Setup test-hooks
@returns dict of hook filepaths {"enter": [], "exit": []}
"""
hooks = {
"enter": [],
"exit": []
}
if hnames is None: # Nothing to do, just return the struct
return hooks
for hname in hnames:... | def hooks_setup(trun, parent, hnames=None):
"""
Setup test-hooks
@returns dict of hook filepaths {"enter": [], "exit": []}
"""
hooks = {
"enter": [],
"exit": []
}
if hnames is None: # Nothing to do, just return the struct
return hooks
for hname in hnames:... | [
"Setup",
"test",
"-",
"hooks"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L199-L230 | [
"def",
"hooks_setup",
"(",
"trun",
",",
"parent",
",",
"hnames",
"=",
"None",
")",
":",
"hooks",
"=",
"{",
"\"enter\"",
":",
"[",
"]",
",",
"\"exit\"",
":",
"[",
"]",
"}",
"if",
"hnames",
"is",
"None",
":",
"# Nothing to do, just return the struct",
"ret... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | trun_to_file | Dump the given trun to file | modules/cij/runner.py | def trun_to_file(trun, fpath=None):
"""Dump the given trun to file"""
if fpath is None:
fpath = yml_fpath(trun["conf"]["OUTPUT"])
with open(fpath, 'w') as yml_file:
data = yaml.dump(trun, explicit_start=True, default_flow_style=False)
yml_file.write(data) | def trun_to_file(trun, fpath=None):
"""Dump the given trun to file"""
if fpath is None:
fpath = yml_fpath(trun["conf"]["OUTPUT"])
with open(fpath, 'w') as yml_file:
data = yaml.dump(trun, explicit_start=True, default_flow_style=False)
yml_file.write(data) | [
"Dump",
"the",
"given",
"trun",
"to",
"file"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L233-L241 | [
"def",
"trun_to_file",
"(",
"trun",
",",
"fpath",
"=",
"None",
")",
":",
"if",
"fpath",
"is",
"None",
":",
"fpath",
"=",
"yml_fpath",
"(",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"OUTPUT\"",
"]",
")",
"with",
"open",
"(",
"fpath",
",",
"'w'",
")",
"as... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | trun_emph | Print essential info on | modules/cij/runner.py | def trun_emph(trun):
"""Print essential info on"""
if trun["conf"]["VERBOSE"] > 1: # Print environment variables
cij.emph("rnr:CONF {")
for cvar in sorted(trun["conf"].keys()):
cij.emph(" % 16s: %r" % (cvar, trun["conf"][cvar]))
cij.emph("}")
if trun["con... | def trun_emph(trun):
"""Print essential info on"""
if trun["conf"]["VERBOSE"] > 1: # Print environment variables
cij.emph("rnr:CONF {")
for cvar in sorted(trun["conf"].keys()):
cij.emph(" % 16s: %r" % (cvar, trun["conf"][cvar]))
cij.emph("}")
if trun["con... | [
"Print",
"essential",
"info",
"on"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L251-L264 | [
"def",
"trun_emph",
"(",
"trun",
")",
":",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
">",
"1",
":",
"# Print environment variables",
"cij",
".",
"emph",
"(",
"\"rnr:CONF {\"",
")",
"for",
"cvar",
"in",
"sorted",
"(",
"trun",
"[",
"\"co... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tcase_setup | Create and initialize a testcase | modules/cij/runner.py | def tcase_setup(trun, parent, tcase_fname):
"""
Create and initialize a testcase
"""
#pylint: disable=locally-disabled, unused-argument
case = copy.deepcopy(TESTCASE)
case["fname"] = tcase_fname
case["fpath_orig"] = os.sep.join([trun["conf"]["TESTCASES"], case["fname"]])
if not os.pat... | def tcase_setup(trun, parent, tcase_fname):
"""
Create and initialize a testcase
"""
#pylint: disable=locally-disabled, unused-argument
case = copy.deepcopy(TESTCASE)
case["fname"] = tcase_fname
case["fpath_orig"] = os.sep.join([trun["conf"]["TESTCASES"], case["fname"]])
if not os.pat... | [
"Create",
"and",
"initialize",
"a",
"testcase"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L267-L301 | [
"def",
"tcase_setup",
"(",
"trun",
",",
"parent",
",",
"tcase_fname",
")",
":",
"#pylint: disable=locally-disabled, unused-argument",
"case",
"=",
"copy",
".",
"deepcopy",
"(",
"TESTCASE",
")",
"case",
"[",
"\"fname\"",
"]",
"=",
"tcase_fname",
"case",
"[",
"\"f... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tsuite_exit | Triggers when exiting the given testsuite | modules/cij/runner.py | def tsuite_exit(trun, tsuite):
"""Triggers when exiting the given testsuite"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tsuite:exit")
rcode = 0
for hook in reversed(tsuite["hooks"]["exit"]): # EXIT-hooks
rcode = script_run(trun, hook)
if rcode:
break
if t... | def tsuite_exit(trun, tsuite):
"""Triggers when exiting the given testsuite"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tsuite:exit")
rcode = 0
for hook in reversed(tsuite["hooks"]["exit"]): # EXIT-hooks
rcode = script_run(trun, hook)
if rcode:
break
if t... | [
"Triggers",
"when",
"exiting",
"the",
"given",
"testsuite"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L304-L319 | [
"def",
"tsuite_exit",
"(",
"trun",
",",
"tsuite",
")",
":",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:tsuite:exit\"",
")",
"rcode",
"=",
"0",
"for",
"hook",
"in",
"reversed",
"(",
"tsuite",
"[",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tsuite_enter | Triggers when entering the given testsuite | modules/cij/runner.py | def tsuite_enter(trun, tsuite):
"""Triggers when entering the given testsuite"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tsuite:enter { name: %r }" % tsuite["name"])
rcode = 0
for hook in tsuite["hooks"]["enter"]: # ENTER-hooks
rcode = script_run(trun, hook)
if rcode:
... | def tsuite_enter(trun, tsuite):
"""Triggers when entering the given testsuite"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tsuite:enter { name: %r }" % tsuite["name"])
rcode = 0
for hook in tsuite["hooks"]["enter"]: # ENTER-hooks
rcode = script_run(trun, hook)
if rcode:
... | [
"Triggers",
"when",
"entering",
"the",
"given",
"testsuite"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L322-L337 | [
"def",
"tsuite_enter",
"(",
"trun",
",",
"tsuite",
")",
":",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:tsuite:enter { name: %r }\"",
"%",
"tsuite",
"[",
"\"name\"",
"]",
")",
"rcode",
"=",
"0",
"for... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tsuite_setup | Creates and initialized a TESTSUITE struct and site-effects such as creating
output directories and forwarding initialization of testcases | modules/cij/runner.py | def tsuite_setup(trun, declr, enum):
"""
Creates and initialized a TESTSUITE struct and site-effects such as creating
output directories and forwarding initialization of testcases
"""
suite = copy.deepcopy(TESTSUITE) # Setup the test-suite
suite["name"] = declr.get("name")
if suite["name"... | def tsuite_setup(trun, declr, enum):
"""
Creates and initialized a TESTSUITE struct and site-effects such as creating
output directories and forwarding initialization of testcases
"""
suite = copy.deepcopy(TESTSUITE) # Setup the test-suite
suite["name"] = declr.get("name")
if suite["name"... | [
"Creates",
"and",
"initialized",
"a",
"TESTSUITE",
"struct",
"and",
"site",
"-",
"effects",
"such",
"as",
"creating",
"output",
"directories",
"and",
"forwarding",
"initialization",
"of",
"testcases"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L339-L402 | [
"def",
"tsuite_setup",
"(",
"trun",
",",
"declr",
",",
"enum",
")",
":",
"suite",
"=",
"copy",
".",
"deepcopy",
"(",
"TESTSUITE",
")",
"# Setup the test-suite",
"suite",
"[",
"\"name\"",
"]",
"=",
"declr",
".",
"get",
"(",
"\"name\"",
")",
"if",
"suite",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tcase_exit | ... | modules/cij/runner.py | def tcase_exit(trun, tsuite, tcase):
"""..."""
#pylint: disable=locally-disabled, unused-argument
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tcase:exit { fname: %r }" % tcase["fname"])
rcode = 0
for hook in reversed(tcase["hooks"]["exit"]): # tcase EXIT-hooks
rcode = script_run(t... | def tcase_exit(trun, tsuite, tcase):
"""..."""
#pylint: disable=locally-disabled, unused-argument
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tcase:exit { fname: %r }" % tcase["fname"])
rcode = 0
for hook in reversed(tcase["hooks"]["exit"]): # tcase EXIT-hooks
rcode = script_run(t... | [
"..."
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L405-L421 | [
"def",
"tcase_exit",
"(",
"trun",
",",
"tsuite",
",",
"tcase",
")",
":",
"#pylint: disable=locally-disabled, unused-argument",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:tcase:exit { fname: %r }\"",
"%",
"tcas... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tcase_enter | setup res_root and aux_root, log info and run tcase-enter-hooks
@returns 0 when all hooks succeed, some value othervise | modules/cij/runner.py | def tcase_enter(trun, tsuite, tcase):
"""
setup res_root and aux_root, log info and run tcase-enter-hooks
@returns 0 when all hooks succeed, some value othervise
"""
#pylint: disable=locally-disabled, unused-argument
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tcase:enter")
cij.e... | def tcase_enter(trun, tsuite, tcase):
"""
setup res_root and aux_root, log info and run tcase-enter-hooks
@returns 0 when all hooks succeed, some value othervise
"""
#pylint: disable=locally-disabled, unused-argument
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:tcase:enter")
cij.e... | [
"setup",
"res_root",
"and",
"aux_root",
"log",
"info",
"and",
"run",
"tcase",
"-",
"enter",
"-",
"hooks"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L424-L446 | [
"def",
"tcase_enter",
"(",
"trun",
",",
"tsuite",
",",
"tcase",
")",
":",
"#pylint: disable=locally-disabled, unused-argument",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:tcase:enter\"",
")",
"cij",
".",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.