repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
bcb/jsonrpcclient
jsonrpcclient/response.py
sort_response
def sort_response(response: Dict[str, Any]) -> OrderedDict: """ Sort the keys in a JSON-RPC response object. This has no effect other than making it nicer to read. Useful in Python 3.5 only, dictionaries are already sorted in newer Python versions. Example:: >>> json.dumps(sort_response({...
python
def sort_response(response: Dict[str, Any]) -> OrderedDict: """ Sort the keys in a JSON-RPC response object. This has no effect other than making it nicer to read. Useful in Python 3.5 only, dictionaries are already sorted in newer Python versions. Example:: >>> json.dumps(sort_response({...
[ "def", "sort_response", "(", "response", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "OrderedDict", ":", "root_order", "=", "[", "\"jsonrpc\"", ",", "\"result\"", ",", "\"error\"", ",", "\"id\"", "]", "error_order", "=", "[", "\"code\"", ",", "\...
Sort the keys in a JSON-RPC response object. This has no effect other than making it nicer to read. Useful in Python 3.5 only, dictionaries are already sorted in newer Python versions. Example:: >>> json.dumps(sort_response({'id': 2, 'result': 5, 'jsonrpc': '2.0'})) {"jsonrpc": "2.0", "re...
[ "Sort", "the", "keys", "in", "a", "JSON", "-", "RPC", "response", "object", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/response.py#L13-L38
bcb/jsonrpcclient
jsonrpcclient/response.py
total_results
def total_results( data: Union[List[JSONRPCResponse], JSONRPCResponse, None], *, ok: bool = True ) -> int: """ Returns the total parsed responses, given the return value from parse(). """ if isinstance(data, list): return sum([1 for d in data if d.ok == ok]) elif isinstance(data, JSONRPC...
python
def total_results( data: Union[List[JSONRPCResponse], JSONRPCResponse, None], *, ok: bool = True ) -> int: """ Returns the total parsed responses, given the return value from parse(). """ if isinstance(data, list): return sum([1 for d in data if d.ok == ok]) elif isinstance(data, JSONRPC...
[ "def", "total_results", "(", "data", ":", "Union", "[", "List", "[", "JSONRPCResponse", "]", ",", "JSONRPCResponse", ",", "None", "]", ",", "*", ",", "ok", ":", "bool", "=", "True", ")", "->", "int", ":", "if", "isinstance", "(", "data", ",", "list",...
Returns the total parsed responses, given the return value from parse().
[ "Returns", "the", "total", "parsed", "responses", "given", "the", "return", "value", "from", "parse", "()", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/response.py#L121-L131
bcb/jsonrpcclient
jsonrpcclient/clients/aiohttp_client.py
AiohttpClient.send_message
async def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a res...
python
async def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a res...
[ "async", "def", "send_message", "(", "self", ",", "request", ":", "str", ",", "response_expected", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Response", ":", "with", "async_timeout", ".", "timeout", "(", "self", ".", "timeout", ")", ...
Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response. Returns: A Response object.
[ "Transport", "the", "message", "to", "the", "server", "and", "return", "the", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/clients/aiohttp_client.py#L53-L71
bcb/jsonrpcclient
jsonrpcclient/clients/websockets_client.py
WebSocketsClient.send_message
async def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a res...
python
async def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a res...
[ "async", "def", "send_message", "(", "self", ",", "request", ":", "str", ",", "response_expected", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Response", ":", "await", "self", ".", "socket", ".", "send", "(", "request", ")", "if", "...
Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response. Returns: A Response object.
[ "Transport", "the", "message", "to", "the", "server", "and", "return", "the", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/clients/websockets_client.py#L25-L42
bcb/jsonrpcclient
jsonrpcclient/config.py
parse_callable
def parse_callable(path: str) -> Iterator: """ ConfigParser converter. Calls the specified object, e.g. Option "id_generators.decimal" returns `id_generators.decimal()`. """ module = path[: path.rindex(".")] callable_name = path[path.rindex(".") + 1 :] callable_ = getattr(importlib.impo...
python
def parse_callable(path: str) -> Iterator: """ ConfigParser converter. Calls the specified object, e.g. Option "id_generators.decimal" returns `id_generators.decimal()`. """ module = path[: path.rindex(".")] callable_name = path[path.rindex(".") + 1 :] callable_ = getattr(importlib.impo...
[ "def", "parse_callable", "(", "path", ":", "str", ")", "->", "Iterator", ":", "module", "=", "path", "[", ":", "path", ".", "rindex", "(", "\".\"", ")", "]", "callable_name", "=", "path", "[", "path", ".", "rindex", "(", "\".\"", ")", "+", "1", ":"...
ConfigParser converter. Calls the specified object, e.g. Option "id_generators.decimal" returns `id_generators.decimal()`.
[ "ConfigParser", "converter", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/config.py#L12-L22
bcb/jsonrpcclient
jsonrpcclient/id_generators.py
random
def random(length: int = 8, chars: str = digits + ascii_lowercase) -> Iterator[str]: """ A random string. Not unique, but has around 1 in a million chance of collision (with the default 8 character length). e.g. 'fubui5e6' Args: length: Length of the random string. chars: The chara...
python
def random(length: int = 8, chars: str = digits + ascii_lowercase) -> Iterator[str]: """ A random string. Not unique, but has around 1 in a million chance of collision (with the default 8 character length). e.g. 'fubui5e6' Args: length: Length of the random string. chars: The chara...
[ "def", "random", "(", "length", ":", "int", "=", "8", ",", "chars", ":", "str", "=", "digits", "+", "ascii_lowercase", ")", "->", "Iterator", "[", "str", "]", ":", "while", "True", ":", "yield", "\"\"", ".", "join", "(", "[", "choice", "(", "chars"...
A random string. Not unique, but has around 1 in a million chance of collision (with the default 8 character length). e.g. 'fubui5e6' Args: length: Length of the random string. chars: The characters to randomly choose from.
[ "A", "random", "string", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/id_generators.py#L40-L52
bcb/jsonrpcclient
jsonrpcclient/parse.py
get_response
def get_response(response: Dict[str, Any]) -> JSONRPCResponse: """ Converts a deserialized response into a JSONRPCResponse object. The dictionary be either an error or success response, never a notification. Args: response: Deserialized response dictionary. We can assume the response is valid ...
python
def get_response(response: Dict[str, Any]) -> JSONRPCResponse: """ Converts a deserialized response into a JSONRPCResponse object. The dictionary be either an error or success response, never a notification. Args: response: Deserialized response dictionary. We can assume the response is valid ...
[ "def", "get_response", "(", "response", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "JSONRPCResponse", ":", "if", "\"error\"", "in", "response", ":", "return", "ErrorResponse", "(", "*", "*", "response", ")", "return", "SuccessResponse", "(", "*",...
Converts a deserialized response into a JSONRPCResponse object. The dictionary be either an error or success response, never a notification. Args: response: Deserialized response dictionary. We can assume the response is valid JSON-RPC here, since it passed the jsonschema validation.
[ "Converts", "a", "deserialized", "response", "into", "a", "JSONRPCResponse", "object", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/parse.py#L18-L30
bcb/jsonrpcclient
jsonrpcclient/parse.py
parse
def parse( response_text: str, *, batch: bool, validate_against_schema: bool = True ) -> Union[JSONRPCResponse, List[JSONRPCResponse]]: """ Parses response text, returning JSONRPCResponse objects. Args: response_text: JSON-RPC response string. batch: If the response_text is an empty str...
python
def parse( response_text: str, *, batch: bool, validate_against_schema: bool = True ) -> Union[JSONRPCResponse, List[JSONRPCResponse]]: """ Parses response text, returning JSONRPCResponse objects. Args: response_text: JSON-RPC response string. batch: If the response_text is an empty str...
[ "def", "parse", "(", "response_text", ":", "str", ",", "*", ",", "batch", ":", "bool", ",", "validate_against_schema", ":", "bool", "=", "True", ")", "->", "Union", "[", "JSONRPCResponse", ",", "List", "[", "JSONRPCResponse", "]", "]", ":", "# If the respo...
Parses response text, returning JSONRPCResponse objects. Args: response_text: JSON-RPC response string. batch: If the response_text is an empty string, this determines how to parse. validate_against_schema: Validate against the json-rpc schema. Returns: Either a JSONRPCResponse...
[ "Parses", "response", "text", "returning", "JSONRPCResponse", "objects", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/parse.py#L33-L75
bcb/jsonrpcclient
jsonrpcclient/async_client.py
AsyncClient.send
async def send( self, request: Union[str, Dict, List], trim_log_values: bool = False, validate_against_schema: bool = True, **kwargs: Any ) -> Response: """ Async version of Client.send. """ # We need both the serialized and deserialized versio...
python
async def send( self, request: Union[str, Dict, List], trim_log_values: bool = False, validate_against_schema: bool = True, **kwargs: Any ) -> Response: """ Async version of Client.send. """ # We need both the serialized and deserialized versio...
[ "async", "def", "send", "(", "self", ",", "request", ":", "Union", "[", "str", ",", "Dict", ",", "List", "]", ",", "trim_log_values", ":", "bool", "=", "False", ",", "validate_against_schema", ":", "bool", "=", "True", ",", "*", "*", "kwargs", ":", "...
Async version of Client.send.
[ "Async", "version", "of", "Client", ".", "send", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/async_client.py#L32-L63
bcb/jsonrpcclient
jsonrpcclient/clients/tornado_client.py
TornadoClient.send_message
async def send_message( # type: ignore self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the reque...
python
async def send_message( # type: ignore self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the reque...
[ "async", "def", "send_message", "(", "# type: ignore", "self", ",", "request", ":", "str", ",", "response_expected", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Response", ":", "headers", "=", "dict", "(", "self", ".", "DEFAULT_HEADERS", ...
Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response. Returns: A Response object.
[ "Transport", "the", "message", "to", "the", "server", "and", "return", "the", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/clients/tornado_client.py#L46-L66
bcb/jsonrpcclient
jsonrpcclient/__main__.py
main
def main( context: click.core.Context, method: str, request_type: str, id: Any, send: str ) -> None: """ Create a JSON-RPC request. """ exit_status = 0 # Extract the jsonrpc arguments positional = [a for a in context.args if "=" not in a] named = {a.split("=")[0]: a.split("=")[1] for a i...
python
def main( context: click.core.Context, method: str, request_type: str, id: Any, send: str ) -> None: """ Create a JSON-RPC request. """ exit_status = 0 # Extract the jsonrpc arguments positional = [a for a in context.args if "=" not in a] named = {a.split("=")[0]: a.split("=")[1] for a i...
[ "def", "main", "(", "context", ":", "click", ".", "core", ".", "Context", ",", "method", ":", "str", ",", "request_type", ":", "str", ",", "id", ":", "Any", ",", "send", ":", "str", ")", "->", "None", ":", "exit_status", "=", "0", "# Extract the json...
Create a JSON-RPC request.
[ "Create", "a", "JSON", "-", "RPC", "request", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/__main__.py#L40-L68
bcb/jsonrpcclient
jsonrpcclient/log.py
log_
def log_( message: str, logger: logging.Logger, level: str = "info", extra: Optional[Dict] = None, trim: bool = False, ) -> None: """ Log a request or response Args: message: JSON-RPC request or response string. level: Log level. extra: More details to include in...
python
def log_( message: str, logger: logging.Logger, level: str = "info", extra: Optional[Dict] = None, trim: bool = False, ) -> None: """ Log a request or response Args: message: JSON-RPC request or response string. level: Log level. extra: More details to include in...
[ "def", "log_", "(", "message", ":", "str", ",", "logger", ":", "logging", ".", "Logger", ",", "level", ":", "str", "=", "\"info\"", ",", "extra", ":", "Optional", "[", "Dict", "]", "=", "None", ",", "trim", ":", "bool", "=", "False", ",", ")", "-...
Log a request or response Args: message: JSON-RPC request or response string. level: Log level. extra: More details to include in the log entry. trim: Abbreviate log messages.
[ "Log", "a", "request", "or", "response" ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/log.py#L54-L78
bcb/jsonrpcclient
jsonrpcclient/requests.py
sort_request
def sort_request(request: Dict[str, Any]) -> OrderedDict: """ Sort a JSON-RPC request dict. This has no effect other than making the request nicer to read. >>> json.dumps(sort_request( ... {'id': 2, 'params': [2, 3], 'method': 'add', 'jsonrpc': '2.0'})) '{"jsonrpc": "2.0", "met...
python
def sort_request(request: Dict[str, Any]) -> OrderedDict: """ Sort a JSON-RPC request dict. This has no effect other than making the request nicer to read. >>> json.dumps(sort_request( ... {'id': 2, 'params': [2, 3], 'method': 'add', 'jsonrpc': '2.0'})) '{"jsonrpc": "2.0", "met...
[ "def", "sort_request", "(", "request", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "OrderedDict", ":", "sort_order", "=", "[", "\"jsonrpc\"", ",", "\"method\"", ",", "\"params\"", ",", "\"id\"", "]", "return", "OrderedDict", "(", "sorted", "(", ...
Sort a JSON-RPC request dict. This has no effect other than making the request nicer to read. >>> json.dumps(sort_request( ... {'id': 2, 'params': [2, 3], 'method': 'add', 'jsonrpc': '2.0'})) '{"jsonrpc": "2.0", "method": "add", "params": [2, 3], "id": 2}' Args: request: J...
[ "Sort", "a", "JSON", "-", "RPC", "request", "dict", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/requests.py#L18-L32
bcb/jsonrpcclient
jsonrpcclient/client.py
Client.basic_logging
def basic_logging(self) -> None: """ Call this on the client object to create log handlers to output request and response messages. """ # Request handler if len(request_log.handlers) == 0: request_handler = logging.StreamHandler() request_handler.s...
python
def basic_logging(self) -> None: """ Call this on the client object to create log handlers to output request and response messages. """ # Request handler if len(request_log.handlers) == 0: request_handler = logging.StreamHandler() request_handler.s...
[ "def", "basic_logging", "(", "self", ")", "->", "None", ":", "# Request handler", "if", "len", "(", "request_log", ".", "handlers", ")", "==", "0", ":", "request_handler", "=", "logging", ".", "StreamHandler", "(", ")", "request_handler", ".", "setFormatter", ...
Call this on the client object to create log handlers to output request and response messages.
[ "Call", "this", "on", "the", "client", "object", "to", "create", "log", "handlers", "to", "output", "request", "and", "response", "messages", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/client.py#L57-L77
bcb/jsonrpcclient
jsonrpcclient/client.py
Client.log_request
def log_request( self, request: str, trim_log_values: bool = False, **kwargs: Any ) -> None: """ Log a request. Args: request: The JSON-RPC request string. trim_log_values: Log an abbreviated version of the request. """ return log_(request, re...
python
def log_request( self, request: str, trim_log_values: bool = False, **kwargs: Any ) -> None: """ Log a request. Args: request: The JSON-RPC request string. trim_log_values: Log an abbreviated version of the request. """ return log_(request, re...
[ "def", "log_request", "(", "self", ",", "request", ":", "str", ",", "trim_log_values", ":", "bool", "=", "False", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "return", "log_", "(", "request", ",", "request_log", ",", "\"info\"", ",", ...
Log a request. Args: request: The JSON-RPC request string. trim_log_values: Log an abbreviated version of the request.
[ "Log", "a", "request", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/client.py#L80-L90
bcb/jsonrpcclient
jsonrpcclient/client.py
Client.log_response
def log_response( self, response: Response, trim_log_values: bool = False, **kwargs: Any ) -> None: """ Log a response. Note this is different to log_request, in that it takes a Response object, not a string. Args: response: The Response object to log. N...
python
def log_response( self, response: Response, trim_log_values: bool = False, **kwargs: Any ) -> None: """ Log a response. Note this is different to log_request, in that it takes a Response object, not a string. Args: response: The Response object to log. N...
[ "def", "log_response", "(", "self", ",", "response", ":", "Response", ",", "trim_log_values", ":", "bool", "=", "False", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "return", "log_", "(", "response", ".", "text", ",", "response_log", "...
Log a response. Note this is different to log_request, in that it takes a Response object, not a string. Args: response: The Response object to log. Note this is different to log_request which takes a string. trim_log_values: Log an abbreviated version o...
[ "Log", "a", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/client.py#L93-L107
bcb/jsonrpcclient
jsonrpcclient/client.py
Client.notify
def notify( self, method_name: str, *args: Any, trim_log_values: Optional[bool] = None, validate_against_schema: Optional[bool] = None, **kwargs: Any ) -> Response: """ Send a JSON-RPC request, without expecting a response. Args: m...
python
def notify( self, method_name: str, *args: Any, trim_log_values: Optional[bool] = None, validate_against_schema: Optional[bool] = None, **kwargs: Any ) -> Response: """ Send a JSON-RPC request, without expecting a response. Args: m...
[ "def", "notify", "(", "self", ",", "method_name", ":", "str", ",", "*", "args", ":", "Any", ",", "trim_log_values", ":", "Optional", "[", "bool", "]", "=", "None", ",", "validate_against_schema", ":", "Optional", "[", "bool", "]", "=", "None", ",", "*"...
Send a JSON-RPC request, without expecting a response. Args: method_name: The remote procedure's method name. args: Positional arguments passed to the remote procedure. kwargs: Keyword arguments passed to the remote procedure. trim_log_values: Abbreviate the log ...
[ "Send", "a", "JSON", "-", "RPC", "request", "without", "expecting", "a", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/client.py#L181-L203
bcb/jsonrpcclient
jsonrpcclient/client.py
Client.request
def request( self, method_name: str, *args: Any, trim_log_values: bool = False, validate_against_schema: bool = True, id_generator: Optional[Iterator] = None, **kwargs: Any ) -> Response: """ Send a request by passing the method and arguments. ...
python
def request( self, method_name: str, *args: Any, trim_log_values: bool = False, validate_against_schema: bool = True, id_generator: Optional[Iterator] = None, **kwargs: Any ) -> Response: """ Send a request by passing the method and arguments. ...
[ "def", "request", "(", "self", ",", "method_name", ":", "str", ",", "*", "args", ":", "Any", ",", "trim_log_values", ":", "bool", "=", "False", ",", "validate_against_schema", ":", "bool", "=", "True", ",", "id_generator", ":", "Optional", "[", "Iterator",...
Send a request by passing the method and arguments. >>> client.request("cat", name="Yoko") <Response[1] Args: method_name: The remote procedure's method name. args: Positional arguments passed to the remote procedure. kwargs: Keyword arguments passed to the ...
[ "Send", "a", "request", "by", "passing", "the", "method", "and", "arguments", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/client.py#L206-L233
bcb/jsonrpcclient
jsonrpcclient/clients/socket_client.py
SocketClient.send_message
def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response....
python
def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response....
[ "def", "send_message", "(", "self", ",", "request", ":", "str", ",", "response_expected", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Response", ":", "payload", "=", "str", "(", "request", ")", "+", "self", ".", "delimiter", "self", ...
Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response. Returns: A Response object.
[ "Transport", "the", "message", "to", "the", "server", "and", "return", "the", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/clients/socket_client.py#L35-L68
bcb/jsonrpcclient
jsonrpcclient/clients/http_client.py
HTTPClient.send_message
def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response....
python
def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response....
[ "def", "send_message", "(", "self", ",", "request", ":", "str", ",", "response_expected", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Response", ":", "response", "=", "self", ".", "session", ".", "post", "(", "self", ".", "endpoint", ...
Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response. Returns: A Response object.
[ "Transport", "the", "message", "to", "the", "server", "and", "return", "the", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/clients/http_client.py#L50-L64
bcb/jsonrpcclient
jsonrpcclient/clients/zeromq_client.py
ZeroMQClient.send_message
def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response....
python
def send_message( self, request: str, response_expected: bool, **kwargs: Any ) -> Response: """ Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response....
[ "def", "send_message", "(", "self", ",", "request", ":", "str", ",", "response_expected", ":", "bool", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Response", ":", "self", ".", "socket", ".", "send_string", "(", "request", ")", "return", "Response", ...
Transport the message to the server and return the response. Args: request: The JSON-RPC request string. response_expected: Whether the request expects a response. Returns: A Response object.
[ "Transport", "the", "message", "to", "the", "server", "and", "return", "the", "response", "." ]
train
https://github.com/bcb/jsonrpcclient/blob/5b5abc28d1466d694c80b80c427a5dcb275382bb/jsonrpcclient/clients/zeromq_client.py#L28-L42
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.init
def init(self, acct: Account, payer_acct: Account, gas_limit: int, gas_price: int) -> str: """ This interface is used to call the TotalSupply method in ope4 that initialize smart contract parameter. :param acct: an Account class that used to sign the transaction. :param payer_ac...
python
def init(self, acct: Account, payer_acct: Account, gas_limit: int, gas_price: int) -> str: """ This interface is used to call the TotalSupply method in ope4 that initialize smart contract parameter. :param acct: an Account class that used to sign the transaction. :param payer_ac...
[ "def", "init", "(", "self", ",", "acct", ":", "Account", ",", "payer_acct", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", "->", "str", ":", "func", "=", "InvokeFunction", "(", "'init'", ")", "tx_hash", "=", "self", ...
This interface is used to call the TotalSupply method in ope4 that initialize smart contract parameter. :param acct: an Account class that used to sign the transaction. :param payer_acct: an Account class that used to pay for the transaction. :param gas_limit: an int value that indicate...
[ "This", "interface", "is", "used", "to", "call", "the", "TotalSupply", "method", "in", "ope4", "that", "initialize", "smart", "contract", "parameter", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L73-L87
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.get_total_supply
def get_total_supply(self) -> int: """ This interface is used to call the TotalSupply method in ope4 that return the total supply of the oep4 token. :return: the total supply of the oep4 token. """ func = InvokeFunction('totalSupply') response = self.__sdk.get_ne...
python
def get_total_supply(self) -> int: """ This interface is used to call the TotalSupply method in ope4 that return the total supply of the oep4 token. :return: the total supply of the oep4 token. """ func = InvokeFunction('totalSupply') response = self.__sdk.get_ne...
[ "def", "get_total_supply", "(", "self", ")", "->", "int", ":", "func", "=", "InvokeFunction", "(", "'totalSupply'", ")", "response", "=", "self", ".", "__sdk", ".", "get_network", "(", ")", ".", "send_neo_vm_transaction_pre_exec", "(", "self", ".", "__hex_cont...
This interface is used to call the TotalSupply method in ope4 that return the total supply of the oep4 token. :return: the total supply of the oep4 token.
[ "This", "interface", "is", "used", "to", "call", "the", "TotalSupply", "method", "in", "ope4", "that", "return", "the", "total", "supply", "of", "the", "oep4", "token", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L89-L102
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.balance_of
def balance_of(self, b58_address: str) -> int: """ This interface is used to call the BalanceOf method in ope4 that query the ope4 token balance of the given base58 encode address. :param b58_address: the base58 encode address. :return: the oep4 token balance of the base58 encod...
python
def balance_of(self, b58_address: str) -> int: """ This interface is used to call the BalanceOf method in ope4 that query the ope4 token balance of the given base58 encode address. :param b58_address: the base58 encode address. :return: the oep4 token balance of the base58 encod...
[ "def", "balance_of", "(", "self", ",", "b58_address", ":", "str", ")", "->", "int", ":", "func", "=", "InvokeFunction", "(", "'balanceOf'", ")", "Oep4", ".", "__b58_address_check", "(", "b58_address", ")", "address", "=", "Address", ".", "b58decode", "(", ...
This interface is used to call the BalanceOf method in ope4 that query the ope4 token balance of the given base58 encode address. :param b58_address: the base58 encode address. :return: the oep4 token balance of the base58 encode address.
[ "This", "interface", "is", "used", "to", "call", "the", "BalanceOf", "method", "in", "ope4", "that", "query", "the", "ope4", "token", "balance", "of", "the", "given", "base58", "encode", "address", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L104-L121
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.transfer
def transfer(self, from_acct: Account, b58_to_address: str, value: int, payer_acct: Account, gas_limit: int, gas_price: int) -> str: """ This interface is used to call the Transfer method in ope4 that transfer an amount of tokens from one account to another account. :pa...
python
def transfer(self, from_acct: Account, b58_to_address: str, value: int, payer_acct: Account, gas_limit: int, gas_price: int) -> str: """ This interface is used to call the Transfer method in ope4 that transfer an amount of tokens from one account to another account. :pa...
[ "def", "transfer", "(", "self", ",", "from_acct", ":", "Account", ",", "b58_to_address", ":", "str", ",", "value", ":", "int", ",", "payer_acct", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", "->", "str", ":", "func",...
This interface is used to call the Transfer method in ope4 that transfer an amount of tokens from one account to another account. :param from_acct: an Account class that send the oep4 token. :param b58_to_address: a base58 encode address that receive the oep4 token. :param value: an int...
[ "This", "interface", "is", "used", "to", "call", "the", "Transfer", "method", "in", "ope4", "that", "transfer", "an", "amount", "of", "tokens", "from", "one", "account", "to", "another", "account", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L123-L150
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.transfer_multi
def transfer_multi(self, transfer_list: list, payer_acct: Account, signers: list, gas_limit: int, gas_price: int): """ This interface is used to call the TransferMulti method in ope4 that allow transfer amount of token from multiple from-account to multiple to-account multiple times. :p...
python
def transfer_multi(self, transfer_list: list, payer_acct: Account, signers: list, gas_limit: int, gas_price: int): """ This interface is used to call the TransferMulti method in ope4 that allow transfer amount of token from multiple from-account to multiple to-account multiple times. :p...
[ "def", "transfer_multi", "(", "self", ",", "transfer_list", ":", "list", ",", "payer_acct", ":", "Account", ",", "signers", ":", "list", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", ":", "func", "=", "InvokeFunction", "(", "'transferMul...
This interface is used to call the TransferMulti method in ope4 that allow transfer amount of token from multiple from-account to multiple to-account multiple times. :param transfer_list: a parameter list with each item contains three sub-items: base58 encode transaction sender address,...
[ "This", "interface", "is", "used", "to", "call", "the", "TransferMulti", "method", "in", "ope4", "that", "allow", "transfer", "amount", "of", "token", "from", "multiple", "from", "-", "account", "to", "multiple", "to", "-", "account", "multiple", "times", "....
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L175-L218
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.approve
def approve(self, owner_acct: Account, b58_spender_address: str, amount: int, payer_acct: Account, gas_limit: int, gas_price: int): """ This interface is used to call the Approve method in ope4 that allows spender to withdraw a certain amount of oep4 token from owner account mult...
python
def approve(self, owner_acct: Account, b58_spender_address: str, amount: int, payer_acct: Account, gas_limit: int, gas_price: int): """ This interface is used to call the Approve method in ope4 that allows spender to withdraw a certain amount of oep4 token from owner account mult...
[ "def", "approve", "(", "self", ",", "owner_acct", ":", "Account", ",", "b58_spender_address", ":", "str", ",", "amount", ":", "int", ",", "payer_acct", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", ":", "func", "=", "...
This interface is used to call the Approve method in ope4 that allows spender to withdraw a certain amount of oep4 token from owner account multiple times. If this function is called again, it will overwrite the current allowance with new value. :param owner_acct: an Account class that indicat...
[ "This", "interface", "is", "used", "to", "call", "the", "Approve", "method", "in", "ope4", "that", "allows", "spender", "to", "withdraw", "a", "certain", "amount", "of", "oep4", "token", "from", "owner", "account", "multiple", "times", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L220-L247
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.allowance
def allowance(self, b58_owner_address: str, b58_spender_address: str): """ This interface is used to call the Allowance method in ope4 that query the amount of spender still allowed to withdraw from owner account. :param b58_owner_address: a base58 encode address that represent owner's ...
python
def allowance(self, b58_owner_address: str, b58_spender_address: str): """ This interface is used to call the Allowance method in ope4 that query the amount of spender still allowed to withdraw from owner account. :param b58_owner_address: a base58 encode address that represent owner's ...
[ "def", "allowance", "(", "self", ",", "b58_owner_address", ":", "str", ",", "b58_spender_address", ":", "str", ")", ":", "func", "=", "InvokeFunction", "(", "'allowance'", ")", "Oep4", ".", "__b58_address_check", "(", "b58_owner_address", ")", "owner", "=", "A...
This interface is used to call the Allowance method in ope4 that query the amount of spender still allowed to withdraw from owner account. :param b58_owner_address: a base58 encode address that represent owner's account. :param b58_spender_address: a base58 encode address that represent spender...
[ "This", "interface", "is", "used", "to", "call", "the", "Allowance", "method", "in", "ope4", "that", "query", "the", "amount", "of", "spender", "still", "allowed", "to", "withdraw", "from", "owner", "account", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L249-L269
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/oep4.py
Oep4.transfer_from
def transfer_from(self, spender_acct: Account, b58_from_address: str, b58_to_address: str, value: int, payer_acct: Account, gas_limit: int, gas_price: int): """ This interface is used to call the Allowance method in ope4 that allow spender to withdraw amount of oep4 token f...
python
def transfer_from(self, spender_acct: Account, b58_from_address: str, b58_to_address: str, value: int, payer_acct: Account, gas_limit: int, gas_price: int): """ This interface is used to call the Allowance method in ope4 that allow spender to withdraw amount of oep4 token f...
[ "def", "transfer_from", "(", "self", ",", "spender_acct", ":", "Account", ",", "b58_from_address", ":", "str", ",", "b58_to_address", ":", "str", ",", "value", ":", "int", ",", "payer_acct", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", "...
This interface is used to call the Allowance method in ope4 that allow spender to withdraw amount of oep4 token from from-account to to-account. :param spender_acct: an Account class that actually spend oep4 token. :param b58_from_address: an base58 encode address that actually pay oep4 token f...
[ "This", "interface", "is", "used", "to", "call", "the", "Allowance", "method", "in", "ope4", "that", "allow", "spender", "to", "withdraw", "amount", "of", "oep4", "token", "from", "from", "-", "account", "to", "to", "-", "account", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/oep4.py#L271-L314
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.import_identity
def import_identity(self, label: str, encrypted_pri_key: str, pwd: str, salt: str, b58_address: str) -> Identity: """ This interface is used to import identity by providing encrypted private key, password, salt and base58 encode address which should be correspond to the encrypted private key pro...
python
def import_identity(self, label: str, encrypted_pri_key: str, pwd: str, salt: str, b58_address: str) -> Identity: """ This interface is used to import identity by providing encrypted private key, password, salt and base58 encode address which should be correspond to the encrypted private key pro...
[ "def", "import_identity", "(", "self", ",", "label", ":", "str", ",", "encrypted_pri_key", ":", "str", ",", "pwd", ":", "str", ",", "salt", ":", "str", ",", "b58_address", ":", "str", ")", "->", "Identity", ":", "scrypt_n", "=", "Scrypt", "(", ")", "...
This interface is used to import identity by providing encrypted private key, password, salt and base58 encode address which should be correspond to the encrypted private key provided. :param label: a label for identity. :param encrypted_pri_key: an encrypted private key in base64 encoding from...
[ "This", "interface", "is", "used", "to", "import", "identity", "by", "providing", "encrypted", "private", "key", "password", "salt", "and", "base58", "encode", "address", "which", "should", "be", "correspond", "to", "the", "encrypted", "private", "key", "provide...
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L140-L158
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.create_identity_from_private_key
def create_identity_from_private_key(self, label: str, pwd: str, private_key: str) -> Identity: """ This interface is used to create identity based on given label, password and private key. :param label: a label for identity. :param pwd: a password which will be used to encrypt and decr...
python
def create_identity_from_private_key(self, label: str, pwd: str, private_key: str) -> Identity: """ This interface is used to create identity based on given label, password and private key. :param label: a label for identity. :param pwd: a password which will be used to encrypt and decr...
[ "def", "create_identity_from_private_key", "(", "self", ",", "label", ":", "str", ",", "pwd", ":", "str", ",", "private_key", ":", "str", ")", "->", "Identity", ":", "salt", "=", "get_random_hex_str", "(", "16", ")", "identity", "=", "self", ".", "__create...
This interface is used to create identity based on given label, password and private key. :param label: a label for identity. :param pwd: a password which will be used to encrypt and decrypt the private key. :param private_key: a private key in the form of string. :return: if succeed, a...
[ "This", "interface", "is", "used", "to", "create", "identity", "based", "on", "given", "label", "password", "and", "private", "key", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L178-L189
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.create_account
def create_account(self, pwd: str, label: str = '') -> Account: """ This interface is used to create account based on given password and label. :param label: a label for account. :param pwd: a password which will be used to encrypt and decrypt the private key :return: if succeed...
python
def create_account(self, pwd: str, label: str = '') -> Account: """ This interface is used to create account based on given password and label. :param label: a label for account. :param pwd: a password which will be used to encrypt and decrypt the private key :return: if succeed...
[ "def", "create_account", "(", "self", ",", "pwd", ":", "str", ",", "label", ":", "str", "=", "''", ")", "->", "Account", ":", "pri_key", "=", "get_random_hex_str", "(", "64", ")", "salt", "=", "get_random_hex_str", "(", "16", ")", "if", "len", "(", "...
This interface is used to create account based on given password and label. :param label: a label for account. :param pwd: a password which will be used to encrypt and decrypt the private key :return: if succeed, return an data structure which contain the information of a wallet account.
[ "This", "interface", "is", "used", "to", "create", "account", "based", "on", "given", "password", "and", "label", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L191-L204
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.import_account
def import_account(self, label: str, encrypted_pri_key: str, pwd: str, b58_address: str, b64_salt: str, n: int = 16384) -> AccountData: """ This interface is used to import account by providing account data. :param label: str, wallet label :param encrypted_pri_key...
python
def import_account(self, label: str, encrypted_pri_key: str, pwd: str, b58_address: str, b64_salt: str, n: int = 16384) -> AccountData: """ This interface is used to import account by providing account data. :param label: str, wallet label :param encrypted_pri_key...
[ "def", "import_account", "(", "self", ",", "label", ":", "str", ",", "encrypted_pri_key", ":", "str", ",", "pwd", ":", "str", ",", "b58_address", ":", "str", ",", "b64_salt", ":", "str", ",", "n", ":", "int", "=", "16384", ")", "->", "AccountData", "...
This interface is used to import account by providing account data. :param label: str, wallet label :param encrypted_pri_key: str, an encrypted private key in base64 encoding from :param pwd: str, a password which is used to encrypt and decrypt the private key :param b58_address: str, a...
[ "This", "interface", "is", "used", "to", "import", "account", "by", "providing", "account", "data", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L289-L312
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.create_account_from_private_key
def create_account_from_private_key(self, password: str, private_key: str, label: str = '') -> AccountData: """ This interface is used to create account by providing an encrypted private key and it's decrypt password. :param label: a label for account. :param password: a password which ...
python
def create_account_from_private_key(self, password: str, private_key: str, label: str = '') -> AccountData: """ This interface is used to create account by providing an encrypted private key and it's decrypt password. :param label: a label for account. :param password: a password which ...
[ "def", "create_account_from_private_key", "(", "self", ",", "password", ":", "str", ",", "private_key", ":", "str", ",", "label", ":", "str", "=", "''", ")", "->", "AccountData", ":", "salt", "=", "get_random_hex_str", "(", "16", ")", "if", "len", "(", "...
This interface is used to create account by providing an encrypted private key and it's decrypt password. :param label: a label for account. :param password: a password which is used to decrypt the encrypted private key. :param private_key: a private key in the form of string. :return: ...
[ "This", "interface", "is", "used", "to", "create", "account", "by", "providing", "an", "encrypted", "private", "key", "and", "it", "s", "decrypt", "password", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L324-L341
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.get_account_by_ont_id
def get_account_by_ont_id(self, ont_id: str, password: str) -> Account: """ :param ont_id: OntId. :param password: a password which is used to decrypt the encrypted private key. :return: """ WalletManager.__check_ont_id(ont_id) for identity in self.wallet_in_mem.i...
python
def get_account_by_ont_id(self, ont_id: str, password: str) -> Account: """ :param ont_id: OntId. :param password: a password which is used to decrypt the encrypted private key. :return: """ WalletManager.__check_ont_id(ont_id) for identity in self.wallet_in_mem.i...
[ "def", "get_account_by_ont_id", "(", "self", ",", "ont_id", ":", "str", ",", "password", ":", "str", ")", "->", "Account", ":", "WalletManager", ".", "__check_ont_id", "(", "ont_id", ")", "for", "identity", "in", "self", ".", "wallet_in_mem", ".", "identitie...
:param ont_id: OntId. :param password: a password which is used to decrypt the encrypted private key. :return:
[ ":", "param", "ont_id", ":", "OntId", ".", ":", "param", "password", ":", "a", "password", "which", "is", "used", "to", "decrypt", "the", "encrypted", "private", "key", ".", ":", "return", ":" ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L351-L366
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.get_account_by_b58_address
def get_account_by_b58_address(self, b58_address: str, password: str) -> Account: """ :param b58_address: a base58 encode address. :param password: a password which is used to decrypt the encrypted private key. :return: """ acct = self.get_account_data_by_b58_address(b58_...
python
def get_account_by_b58_address(self, b58_address: str, password: str) -> Account: """ :param b58_address: a base58 encode address. :param password: a password which is used to decrypt the encrypted private key. :return: """ acct = self.get_account_data_by_b58_address(b58_...
[ "def", "get_account_by_b58_address", "(", "self", ",", "b58_address", ":", "str", ",", "password", ":", "str", ")", "->", "Account", ":", "acct", "=", "self", ".", "get_account_data_by_b58_address", "(", "b58_address", ")", "n", "=", "self", ".", "wallet_in_me...
:param b58_address: a base58 encode address. :param password: a password which is used to decrypt the encrypted private key. :return:
[ ":", "param", "b58_address", ":", "a", "base58", "encode", "address", ".", ":", "param", "password", ":", "a", "password", "which", "is", "used", "to", "decrypt", "the", "encrypted", "private", "key", ".", ":", "return", ":" ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L422-L432
ontio/ontology-python-sdk
ontology/wallet/wallet_manager.py
WalletManager.get_default_account_data
def get_default_account_data(self) -> AccountData: """ This interface is used to get the default account in WalletManager. :return: an AccountData object that contain all the information of a default account. """ for acct in self.wallet_in_mem.accounts: if not isinst...
python
def get_default_account_data(self) -> AccountData: """ This interface is used to get the default account in WalletManager. :return: an AccountData object that contain all the information of a default account. """ for acct in self.wallet_in_mem.accounts: if not isinst...
[ "def", "get_default_account_data", "(", "self", ")", "->", "AccountData", ":", "for", "acct", "in", "self", ".", "wallet_in_mem", ".", "accounts", ":", "if", "not", "isinstance", "(", "acct", ",", "AccountData", ")", ":", "raise", "SDKException", "(", "Error...
This interface is used to get the default account in WalletManager. :return: an AccountData object that contain all the information of a default account.
[ "This", "interface", "is", "used", "to", "get", "the", "default", "account", "in", "WalletManager", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/wallet/wallet_manager.py#L440-L451
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/abi/abi_info.py
AbiInfo.get_function
def get_function(self, name: str) -> AbiFunction or None: """ This interface is used to get an AbiFunction object from AbiInfo object by given function name. :param name: the function name in abi file :return: if succeed, an AbiFunction will constructed based on given function name ...
python
def get_function(self, name: str) -> AbiFunction or None: """ This interface is used to get an AbiFunction object from AbiInfo object by given function name. :param name: the function name in abi file :return: if succeed, an AbiFunction will constructed based on given function name ...
[ "def", "get_function", "(", "self", ",", "name", ":", "str", ")", "->", "AbiFunction", "or", "None", ":", "for", "func", "in", "self", ".", "functions", ":", "if", "func", "[", "'name'", "]", "==", "name", ":", "return", "AbiFunction", "(", "func", "...
This interface is used to get an AbiFunction object from AbiInfo object by given function name. :param name: the function name in abi file :return: if succeed, an AbiFunction will constructed based on given function name
[ "This", "interface", "is", "used", "to", "get", "an", "AbiFunction", "object", "from", "AbiInfo", "object", "by", "given", "function", "name", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/abi/abi_info.py#L17-L27
ontio/ontology-python-sdk
ontology/crypto/ecies.py
ECIES.__uncompress_public_key
def __uncompress_public_key(public_key: bytes) -> bytes: """ Uncompress the compressed public key. :param public_key: compressed public key :return: uncompressed public key """ is_even = public_key.startswith(b'\x02') x = string_to_number(public_key[1:]) ...
python
def __uncompress_public_key(public_key: bytes) -> bytes: """ Uncompress the compressed public key. :param public_key: compressed public key :return: uncompressed public key """ is_even = public_key.startswith(b'\x02') x = string_to_number(public_key[1:]) ...
[ "def", "__uncompress_public_key", "(", "public_key", ":", "bytes", ")", "->", "bytes", ":", "is_even", "=", "public_key", ".", "startswith", "(", "b'\\x02'", ")", "x", "=", "string_to_number", "(", "public_key", "[", "1", ":", "]", ")", "curve", "=", "NIST...
Uncompress the compressed public key. :param public_key: compressed public key :return: uncompressed public key
[ "Uncompress", "the", "compressed", "public", "key", ".", ":", "param", "public_key", ":", "compressed", "public", "key", ":", "return", ":", "uncompressed", "public", "key" ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/crypto/ecies.py#L64-L83
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_version
def get_version(self, is_full: bool = False) -> dict or str: """ This interface is used to get the version information of the connected node in current network. Return: the version information of the connected node. """ payload = self.generate_json_rpc_payload(RpcMet...
python
def get_version(self, is_full: bool = False) -> dict or str: """ This interface is used to get the version information of the connected node in current network. Return: the version information of the connected node. """ payload = self.generate_json_rpc_payload(RpcMet...
[ "def", "get_version", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", "or", "str", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_VERSION", ")", "response", "=", "self", ".", "__post", ...
This interface is used to get the version information of the connected node in current network. Return: the version information of the connected node.
[ "This", "interface", "is", "used", "to", "get", "the", "version", "information", "of", "the", "connected", "node", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L152-L163
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_connection_count
def get_connection_count(self, is_full: bool = False) -> int: """ This interface is used to get the current number of connections for the node in current network. Return: the number of connections. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_NODE_COUNT...
python
def get_connection_count(self, is_full: bool = False) -> int: """ This interface is used to get the current number of connections for the node in current network. Return: the number of connections. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_NODE_COUNT...
[ "def", "get_connection_count", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "int", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_NODE_COUNT", ")", "response", "=", "self", ".", "__post", "(",...
This interface is used to get the current number of connections for the node in current network. Return: the number of connections.
[ "This", "interface", "is", "used", "to", "get", "the", "current", "number", "of", "connections", "for", "the", "node", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L165-L176
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_gas_price
def get_gas_price(self, is_full: bool = False) -> int or dict: """ This interface is used to get the gas price in current network. Return: the value of gas price. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_GAS_PRICE) response = self.__post(sel...
python
def get_gas_price(self, is_full: bool = False) -> int or dict: """ This interface is used to get the gas price in current network. Return: the value of gas price. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_GAS_PRICE) response = self.__post(sel...
[ "def", "get_gas_price", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "int", "or", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_GAS_PRICE", ")", "response", "=", "self", ".", "__pos...
This interface is used to get the gas price in current network. Return: the value of gas price.
[ "This", "interface", "is", "used", "to", "get", "the", "gas", "price", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L178-L189
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_network_id
def get_network_id(self, is_full: bool = False) -> int: """ This interface is used to get the network id of current network. Return: the network id of current network. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_NETWORK_ID) response = self.__p...
python
def get_network_id(self, is_full: bool = False) -> int: """ This interface is used to get the network id of current network. Return: the network id of current network. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_NETWORK_ID) response = self.__p...
[ "def", "get_network_id", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "int", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_NETWORK_ID", ")", "response", "=", "self", ".", "__post", "(", "se...
This interface is used to get the network id of current network. Return: the network id of current network.
[ "This", "interface", "is", "used", "to", "get", "the", "network", "id", "of", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L191-L203
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_block_by_hash
def get_block_by_hash(self, block_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the hexadecimal hash value of specified block height in current network. :param block_hash: a hexadecimal value of block hash. :param is_full: :return: the block inform...
python
def get_block_by_hash(self, block_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the hexadecimal hash value of specified block height in current network. :param block_hash: a hexadecimal value of block hash. :param is_full: :return: the block inform...
[ "def", "get_block_by_hash", "(", "self", ",", "block_hash", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_BLOCK", ",", "[", "block_hash", ...
This interface is used to get the hexadecimal hash value of specified block height in current network. :param block_hash: a hexadecimal value of block hash. :param is_full: :return: the block information of the specified block hash.
[ "This", "interface", "is", "used", "to", "get", "the", "hexadecimal", "hash", "value", "of", "specified", "block", "height", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L205-L217
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_block_by_height
def get_block_by_height(self, height: int, is_full: bool = False) -> dict: """ This interface is used to get the block information by block height in current network. Return: the decimal total number of blocks in current network. """ payload = self.generate_json_rpc_...
python
def get_block_by_height(self, height: int, is_full: bool = False) -> dict: """ This interface is used to get the block information by block height in current network. Return: the decimal total number of blocks in current network. """ payload = self.generate_json_rpc_...
[ "def", "get_block_by_height", "(", "self", ",", "height", ":", "int", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_BLOCK", ",", "[", "height", ",", ...
This interface is used to get the block information by block height in current network. Return: the decimal total number of blocks in current network.
[ "This", "interface", "is", "used", "to", "get", "the", "block", "information", "by", "block", "height", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L219-L230
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_block_count
def get_block_count(self, is_full: bool = False) -> int or dict: """ This interface is used to get the decimal block number in current network. Return: the decimal total number of blocks in current network. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_B...
python
def get_block_count(self, is_full: bool = False) -> int or dict: """ This interface is used to get the decimal block number in current network. Return: the decimal total number of blocks in current network. """ payload = self.generate_json_rpc_payload(RpcMethod.GET_B...
[ "def", "get_block_count", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "int", "or", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_BLOCK_COUNT", ")", "response", "=", "self", ".", "_...
This interface is used to get the decimal block number in current network. Return: the decimal total number of blocks in current network.
[ "This", "interface", "is", "used", "to", "get", "the", "decimal", "block", "number", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L232-L243
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_block_height
def get_block_height(self, is_full: bool = False) -> int or dict: """ This interface is used to get the decimal block height in current network. Return: the decimal total height of blocks in current network. """ response = self.get_block_count(is_full=True) r...
python
def get_block_height(self, is_full: bool = False) -> int or dict: """ This interface is used to get the decimal block height in current network. Return: the decimal total height of blocks in current network. """ response = self.get_block_count(is_full=True) r...
[ "def", "get_block_height", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "int", "or", "dict", ":", "response", "=", "self", ".", "get_block_count", "(", "is_full", "=", "True", ")", "response", "[", "'result'", "]", "-=", "1", "if"...
This interface is used to get the decimal block height in current network. Return: the decimal total height of blocks in current network.
[ "This", "interface", "is", "used", "to", "get", "the", "decimal", "block", "height", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L245-L256
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_current_block_hash
def get_current_block_hash(self, is_full: bool = False) -> str: """ This interface is used to get the hexadecimal hash value of the highest block in current network. Return: the hexadecimal hash value of the highest block in current network. """ payload = self.genera...
python
def get_current_block_hash(self, is_full: bool = False) -> str: """ This interface is used to get the hexadecimal hash value of the highest block in current network. Return: the hexadecimal hash value of the highest block in current network. """ payload = self.genera...
[ "def", "get_current_block_hash", "(", "self", ",", "is_full", ":", "bool", "=", "False", ")", "->", "str", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_CURRENT_BLOCK_HASH", ")", "response", "=", "self", ".", "__pos...
This interface is used to get the hexadecimal hash value of the highest block in current network. Return: the hexadecimal hash value of the highest block in current network.
[ "This", "interface", "is", "used", "to", "get", "the", "hexadecimal", "hash", "value", "of", "the", "highest", "block", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L272-L283
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_block_hash_by_height
def get_block_hash_by_height(self, height: int, is_full: bool = False) -> str: """ This interface is used to get the hexadecimal hash value of specified block height in current network. :param height: a decimal block height value. :param is_full: :return: the hexadecimal hash va...
python
def get_block_hash_by_height(self, height: int, is_full: bool = False) -> str: """ This interface is used to get the hexadecimal hash value of specified block height in current network. :param height: a decimal block height value. :param is_full: :return: the hexadecimal hash va...
[ "def", "get_block_hash_by_height", "(", "self", ",", "height", ":", "int", ",", "is_full", ":", "bool", "=", "False", ")", "->", "str", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_BLOCK_HASH", ",", "[", "height"...
This interface is used to get the hexadecimal hash value of specified block height in current network. :param height: a decimal block height value. :param is_full: :return: the hexadecimal hash value of the specified block height.
[ "This", "interface", "is", "used", "to", "get", "the", "hexadecimal", "hash", "value", "of", "specified", "block", "height", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L285-L297
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_balance
def get_balance(self, b58_address: str, is_full: bool = False) -> dict: """ This interface is used to get the account balance of specified base58 encoded address in current network. :param b58_address: a base58 encoded account address. :param is_full: :return: the value of accou...
python
def get_balance(self, b58_address: str, is_full: bool = False) -> dict: """ This interface is used to get the account balance of specified base58 encoded address in current network. :param b58_address: a base58 encoded account address. :param is_full: :return: the value of accou...
[ "def", "get_balance", "(", "self", ",", "b58_address", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_BALANCE", ",", "[", "b58_address", "...
This interface is used to get the account balance of specified base58 encoded address in current network. :param b58_address: a base58 encoded account address. :param is_full: :return: the value of account balance in dictionary form.
[ "This", "interface", "is", "used", "to", "get", "the", "account", "balance", "of", "specified", "base58", "encoded", "address", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L299-L311
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_allowance
def get_allowance(self, asset_name: str, from_address: str, to_address: str, is_full: bool = False) -> str: """ This interface is used to get the the allowance from transfer-from account to transfer-to account in current network. :param asset_name: :param from_address: a base58 ...
python
def get_allowance(self, asset_name: str, from_address: str, to_address: str, is_full: bool = False) -> str: """ This interface is used to get the the allowance from transfer-from account to transfer-to account in current network. :param asset_name: :param from_address: a base58 ...
[ "def", "get_allowance", "(", "self", ",", "asset_name", ":", "str", ",", "from_address", ":", "str", ",", "to_address", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "str", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", ...
This interface is used to get the the allowance from transfer-from account to transfer-to account in current network. :param asset_name: :param from_address: a base58 encoded account address. :param to_address: a base58 encoded account address. :param is_full: :return: t...
[ "This", "interface", "is", "used", "to", "get", "the", "the", "allowance", "from", "transfer", "-", "from", "account", "to", "transfer", "-", "to", "account", "in", "current", "network", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L320-L335
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_storage
def get_storage(self, hex_contract_address: str, hex_key: str, is_full: bool = False) -> str: """ This interface is used to get the corresponding stored value based on hexadecimal contract address and stored key. :param hex_contract_address: hexadecimal contract address. :param ...
python
def get_storage(self, hex_contract_address: str, hex_key: str, is_full: bool = False) -> str: """ This interface is used to get the corresponding stored value based on hexadecimal contract address and stored key. :param hex_contract_address: hexadecimal contract address. :param ...
[ "def", "get_storage", "(", "self", ",", "hex_contract_address", ":", "str", ",", "hex_key", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "str", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_...
This interface is used to get the corresponding stored value based on hexadecimal contract address and stored key. :param hex_contract_address: hexadecimal contract address. :param hex_key: a hexadecimal stored key. :param is_full: :return: the information of contract storage.
[ "This", "interface", "is", "used", "to", "get", "the", "corresponding", "stored", "value", "based", "on", "hexadecimal", "contract", "address", "and", "stored", "key", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L337-L351
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_smart_contract_event_by_tx_hash
def get_smart_contract_event_by_tx_hash(self, tx_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the corresponding smart contract event based on the height of block. :param tx_hash: a hexadecimal hash value. :param is_full: :return: the information o...
python
def get_smart_contract_event_by_tx_hash(self, tx_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the corresponding smart contract event based on the height of block. :param tx_hash: a hexadecimal hash value. :param is_full: :return: the information o...
[ "def", "get_smart_contract_event_by_tx_hash", "(", "self", ",", "tx_hash", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_SMART_CONTRACT_EVENT", ...
This interface is used to get the corresponding smart contract event based on the height of block. :param tx_hash: a hexadecimal hash value. :param is_full: :return: the information of smart contract event in dictionary form.
[ "This", "interface", "is", "used", "to", "get", "the", "corresponding", "smart", "contract", "event", "based", "on", "the", "height", "of", "block", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L353-L365
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_smart_contract_event_by_height
def get_smart_contract_event_by_height(self, height: int, is_full: bool = False) -> List[dict]: """ This interface is used to get the corresponding smart contract event based on the height of block. :param height: a decimal height value. :param is_full: :return: the information ...
python
def get_smart_contract_event_by_height(self, height: int, is_full: bool = False) -> List[dict]: """ This interface is used to get the corresponding smart contract event based on the height of block. :param height: a decimal height value. :param is_full: :return: the information ...
[ "def", "get_smart_contract_event_by_height", "(", "self", ",", "height", ":", "int", ",", "is_full", ":", "bool", "=", "False", ")", "->", "List", "[", "dict", "]", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_SM...
This interface is used to get the corresponding smart contract event based on the height of block. :param height: a decimal height value. :param is_full: :return: the information of smart contract event in dictionary form.
[ "This", "interface", "is", "used", "to", "get", "the", "corresponding", "smart", "contract", "event", "based", "on", "the", "height", "of", "block", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L367-L382
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_transaction_by_tx_hash
def get_transaction_by_tx_hash(self, tx_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the corresponding transaction information based on the specified hash value. :param tx_hash: str, a hexadecimal hash value. :param is_full: :return: dict ...
python
def get_transaction_by_tx_hash(self, tx_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the corresponding transaction information based on the specified hash value. :param tx_hash: str, a hexadecimal hash value. :param is_full: :return: dict ...
[ "def", "get_transaction_by_tx_hash", "(", "self", ",", "tx_hash", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_TRANSACTION", ",", "[", "tx...
This interface is used to get the corresponding transaction information based on the specified hash value. :param tx_hash: str, a hexadecimal hash value. :param is_full: :return: dict
[ "This", "interface", "is", "used", "to", "get", "the", "corresponding", "transaction", "information", "based", "on", "the", "specified", "hash", "value", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L387-L399
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_smart_contract
def get_smart_contract(self, hex_contract_address: str, is_full: bool = False) -> dict: """ This interface is used to get the information of smart contract based on the specified hexadecimal hash value. :param hex_contract_address: str, a hexadecimal hash value. :param is_full: ...
python
def get_smart_contract(self, hex_contract_address: str, is_full: bool = False) -> dict: """ This interface is used to get the information of smart contract based on the specified hexadecimal hash value. :param hex_contract_address: str, a hexadecimal hash value. :param is_full: ...
[ "def", "get_smart_contract", "(", "self", ",", "hex_contract_address", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "if", "not", "isinstance", "(", "hex_contract_address", ",", "str", ")", ":", "raise", "SDKException", "(", ...
This interface is used to get the information of smart contract based on the specified hexadecimal hash value. :param hex_contract_address: str, a hexadecimal hash value. :param is_full: :return: the information of smart contract in dictionary form.
[ "This", "interface", "is", "used", "to", "get", "the", "information", "of", "smart", "contract", "based", "on", "the", "specified", "hexadecimal", "hash", "value", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L401-L417
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.get_merkle_proof
def get_merkle_proof(self, tx_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the corresponding merkle proof based on the specified hexadecimal hash value. :param tx_hash: an hexadecimal transaction hash value. :param is_full: :return: the merkle pro...
python
def get_merkle_proof(self, tx_hash: str, is_full: bool = False) -> dict: """ This interface is used to get the corresponding merkle proof based on the specified hexadecimal hash value. :param tx_hash: an hexadecimal transaction hash value. :param is_full: :return: the merkle pro...
[ "def", "get_merkle_proof", "(", "self", ",", "tx_hash", ":", "str", ",", "is_full", ":", "bool", "=", "False", ")", "->", "dict", ":", "payload", "=", "self", ".", "generate_json_rpc_payload", "(", "RpcMethod", ".", "GET_MERKLE_PROOF", ",", "[", "tx_hash", ...
This interface is used to get the corresponding merkle proof based on the specified hexadecimal hash value. :param tx_hash: an hexadecimal transaction hash value. :param is_full: :return: the merkle proof in dictionary form.
[ "This", "interface", "is", "used", "to", "get", "the", "corresponding", "merkle", "proof", "based", "on", "the", "specified", "hexadecimal", "hash", "value", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L419-L431
ontio/ontology-python-sdk
ontology/network/rpc.py
RpcClient.send_raw_transaction
def send_raw_transaction(self, tx: Transaction, is_full: bool = False) -> str: """ This interface is used to send the transaction into the network. :param tx: Transaction object in ontology Python SDK. :param is_full: :return: a hexadecimal transaction hash value. """ ...
python
def send_raw_transaction(self, tx: Transaction, is_full: bool = False) -> str: """ This interface is used to send the transaction into the network. :param tx: Transaction object in ontology Python SDK. :param is_full: :return: a hexadecimal transaction hash value. """ ...
[ "def", "send_raw_transaction", "(", "self", ",", "tx", ":", "Transaction", ",", "is_full", ":", "bool", "=", "False", ")", "->", "str", ":", "tx_data", "=", "tx", ".", "serialize", "(", "is_hex", "=", "True", ")", "payload", "=", "self", ".", "generate...
This interface is used to send the transaction into the network. :param tx: Transaction object in ontology Python SDK. :param is_full: :return: a hexadecimal transaction hash value.
[ "This", "interface", "is", "used", "to", "send", "the", "transaction", "into", "the", "network", ".", ":", "param", "tx", ":", "Transaction", "object", "in", "ontology", "Python", "SDK", ".", ":", "param", "is_full", ":", ":", "return", ":", "a", "hexade...
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/network/rpc.py#L447-L459
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.parse_ddo
def parse_ddo(ont_id: str, serialized_ddo: str or bytes) -> dict: """ This interface is used to deserialize a hexadecimal string into a DDO object in the from of dict. :param ont_id: the unique ID for identity. :param serialized_ddo: an serialized description object of ONT ID in form of...
python
def parse_ddo(ont_id: str, serialized_ddo: str or bytes) -> dict: """ This interface is used to deserialize a hexadecimal string into a DDO object in the from of dict. :param ont_id: the unique ID for identity. :param serialized_ddo: an serialized description object of ONT ID in form of...
[ "def", "parse_ddo", "(", "ont_id", ":", "str", ",", "serialized_ddo", ":", "str", "or", "bytes", ")", "->", "dict", ":", "if", "len", "(", "serialized_ddo", ")", "==", "0", ":", "return", "dict", "(", ")", "if", "isinstance", "(", "serialized_ddo", ","...
This interface is used to deserialize a hexadecimal string into a DDO object in the from of dict. :param ont_id: the unique ID for identity. :param serialized_ddo: an serialized description object of ONT ID in form of str or bytes. :return: a description object of ONT ID in the from of dict.
[ "This", "interface", "is", "used", "to", "deserialize", "a", "hexadecimal", "string", "into", "a", "DDO", "object", "in", "the", "from", "of", "dict", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L110-L146
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.get_ddo
def get_ddo(self, ont_id: str) -> dict: """ This interface is used to get a DDO object in the from of dict. :param ont_id: the unique ID for identity. :return: a description object of ONT ID in the from of dict. """ args = dict(ontid=ont_id.encode('utf-8')) invok...
python
def get_ddo(self, ont_id: str) -> dict: """ This interface is used to get a DDO object in the from of dict. :param ont_id: the unique ID for identity. :return: a description object of ONT ID in the from of dict. """ args = dict(ontid=ont_id.encode('utf-8')) invok...
[ "def", "get_ddo", "(", "self", ",", "ont_id", ":", "str", ")", "->", "dict", ":", "args", "=", "dict", "(", "ontid", "=", "ont_id", ".", "encode", "(", "'utf-8'", ")", ")", "invoke_code", "=", "build_vm", ".", "build_native_invoke_code", "(", "self", "...
This interface is used to get a DDO object in the from of dict. :param ont_id: the unique ID for identity. :return: a description object of ONT ID in the from of dict.
[ "This", "interface", "is", "used", "to", "get", "a", "DDO", "object", "in", "the", "from", "of", "dict", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L171-L184
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.registry_ont_id
def registry_ont_id(self, ont_id: str, ctrl_acct: Account, payer: Account, gas_limit: int, gas_price: int): """ This interface is used to send a Transaction object which is used to registry ontid. :param ont_id: OntId. :param ctrl_acct: an Account object which indicate who will sign for...
python
def registry_ont_id(self, ont_id: str, ctrl_acct: Account, payer: Account, gas_limit: int, gas_price: int): """ This interface is used to send a Transaction object which is used to registry ontid. :param ont_id: OntId. :param ctrl_acct: an Account object which indicate who will sign for...
[ "def", "registry_ont_id", "(", "self", ",", "ont_id", ":", "str", ",", "ctrl_acct", ":", "Account", ",", "payer", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", ":", "if", "not", "isinstance", "(", "ctrl_acct", ",", "A...
This interface is used to send a Transaction object which is used to registry ontid. :param ont_id: OntId. :param ctrl_acct: an Account object which indicate who will sign for the transaction. :param payer: an Account object which indicate who will pay for the transaction. :param gas_li...
[ "This", "interface", "is", "used", "to", "send", "a", "Transaction", "object", "which", "is", "used", "to", "registry", "ontid", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L187-L205
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.add_public_key
def add_public_key(self, ont_id: str, operator: Account, hex_new_public_key: str, payer: Account, gas_limit: int, gas_price: int, is_recovery: bool = False): """ This interface is used to send a Transaction object which is used to add public key. :param ont_id: OntId. ...
python
def add_public_key(self, ont_id: str, operator: Account, hex_new_public_key: str, payer: Account, gas_limit: int, gas_price: int, is_recovery: bool = False): """ This interface is used to send a Transaction object which is used to add public key. :param ont_id: OntId. ...
[ "def", "add_public_key", "(", "self", ",", "ont_id", ":", "str", ",", "operator", ":", "Account", ",", "hex_new_public_key", ":", "str", ",", "payer", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ",", "is_recovery", ":", "b...
This interface is used to send a Transaction object which is used to add public key. :param ont_id: OntId. :param operator: an Account object which indicate who will sign for the transaction. :param hex_new_public_key: the new hexadecimal public key in the form of string. :param payer: ...
[ "This", "interface", "is", "used", "to", "send", "a", "Transaction", "object", "which", "is", "used", "to", "add", "public", "key", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L208-L233
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.add_attribute
def add_attribute(self, ont_id: str, ctrl_acct: Account, attributes: Attribute, payer: Account, gas_limit: int, gas_price: int) -> str: """ This interface is used to send a Transaction object which is used to add attribute. :param ont_id: OntId. :param ctrl_acct: a...
python
def add_attribute(self, ont_id: str, ctrl_acct: Account, attributes: Attribute, payer: Account, gas_limit: int, gas_price: int) -> str: """ This interface is used to send a Transaction object which is used to add attribute. :param ont_id: OntId. :param ctrl_acct: a...
[ "def", "add_attribute", "(", "self", ",", "ont_id", ":", "str", ",", "ctrl_acct", ":", "Account", ",", "attributes", ":", "Attribute", ",", "payer", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", "->", "str", ":", "if"...
This interface is used to send a Transaction object which is used to add attribute. :param ont_id: OntId. :param ctrl_acct: an Account object which indicate who will sign for the transaction. :param attributes: a list of attributes we want to add. :param payer: an Account object which i...
[ "This", "interface", "is", "used", "to", "send", "a", "Transaction", "object", "which", "is", "used", "to", "add", "attribute", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L264-L285
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.remove_attribute
def remove_attribute(self, ont_id: str, operator: Account, attrib_key: str, payer: Account, gas_limit: int, gas_price: int): """ This interface is used to send a Transaction object which is used to remove attribute. :param ont_id: OntId. :param operator: an Acco...
python
def remove_attribute(self, ont_id: str, operator: Account, attrib_key: str, payer: Account, gas_limit: int, gas_price: int): """ This interface is used to send a Transaction object which is used to remove attribute. :param ont_id: OntId. :param operator: an Acco...
[ "def", "remove_attribute", "(", "self", ",", "ont_id", ":", "str", ",", "operator", ":", "Account", ",", "attrib_key", ":", "str", ",", "payer", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", ":", "pub_key", "=", "oper...
This interface is used to send a Transaction object which is used to remove attribute. :param ont_id: OntId. :param operator: an Account object which indicate who will sign for the transaction. :param attrib_key: a string which is used to indicate which attribute we want to remove. :par...
[ "This", "interface", "is", "used", "to", "send", "a", "Transaction", "object", "which", "is", "used", "to", "remove", "attribute", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L288-L306
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.add_recovery
def add_recovery(self, ont_id: str, ctrl_acct: Account, b58_recovery_address: str, payer: Account, gas_limit: int, gas_price: int): """ This interface is used to send a Transaction object which is used to add the recovery. :param ont_id: OntId. :param ctrl_acct: an ...
python
def add_recovery(self, ont_id: str, ctrl_acct: Account, b58_recovery_address: str, payer: Account, gas_limit: int, gas_price: int): """ This interface is used to send a Transaction object which is used to add the recovery. :param ont_id: OntId. :param ctrl_acct: an ...
[ "def", "add_recovery", "(", "self", ",", "ont_id", ":", "str", ",", "ctrl_acct", ":", "Account", ",", "b58_recovery_address", ":", "str", ",", "payer", ":", "Account", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", ":", "b58_payer_address...
This interface is used to send a Transaction object which is used to add the recovery. :param ont_id: OntId. :param ctrl_acct: an Account object which indicate who will sign for the transaction. :param b58_recovery_address: a base58 encode address which indicate who is the recovery. :pa...
[ "This", "interface", "is", "used", "to", "send", "a", "Transaction", "object", "which", "is", "used", "to", "add", "the", "recovery", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L309-L329
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.new_registry_ont_id_transaction
def new_registry_ont_id_transaction(self, ont_id: str, pub_key: str or bytes, b58_payer_address: str, gas_limit: int, gas_price: int) -> Transaction: """ This interface is used to generate a Transaction object which is used to register ONT ID. :param ont_...
python
def new_registry_ont_id_transaction(self, ont_id: str, pub_key: str or bytes, b58_payer_address: str, gas_limit: int, gas_price: int) -> Transaction: """ This interface is used to generate a Transaction object which is used to register ONT ID. :param ont_...
[ "def", "new_registry_ont_id_transaction", "(", "self", ",", "ont_id", ":", "str", ",", "pub_key", ":", "str", "or", "bytes", ",", "b58_payer_address", ":", "str", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ")", "->", "Transaction", ":", "i...
This interface is used to generate a Transaction object which is used to register ONT ID. :param ont_id: OntId. :param pub_key: the hexadecimal public key in the form of string. :param b58_payer_address: a base58 encode address which indicate who will pay for the transaction. :param gas...
[ "This", "interface", "is", "used", "to", "generate", "a", "Transaction", "object", "which", "is", "used", "to", "register", "ONT", "ID", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L386-L406
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.new_add_public_key_transaction
def new_add_public_key_transaction(self, ont_id: str, bytes_operator: bytes, new_pub_key: str or bytes, b58_payer_address: str, gas_limit: int, gas_price: int, is_recovery: bool = False): """ This interface is used to send a T...
python
def new_add_public_key_transaction(self, ont_id: str, bytes_operator: bytes, new_pub_key: str or bytes, b58_payer_address: str, gas_limit: int, gas_price: int, is_recovery: bool = False): """ This interface is used to send a T...
[ "def", "new_add_public_key_transaction", "(", "self", ",", "ont_id", ":", "str", ",", "bytes_operator", ":", "bytes", ",", "new_pub_key", ":", "str", "or", "bytes", ",", "b58_payer_address", ":", "str", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "i...
This interface is used to send a Transaction object which is used to add public key. :param ont_id: OntId. :param bytes_operator: operator args in from of bytes. :param new_pub_key: the new hexadecimal public key in the form of string. :param b58_payer_address: a base58 encode address w...
[ "This", "interface", "is", "used", "to", "send", "a", "Transaction", "object", "which", "is", "used", "to", "add", "public", "key", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L409-L435
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.new_revoke_public_key_transaction
def new_revoke_public_key_transaction(self, ont_id: str, bytes_operator: bytes, revoked_pub_key: str or bytes, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to remove public key...
python
def new_revoke_public_key_transaction(self, ont_id: str, bytes_operator: bytes, revoked_pub_key: str or bytes, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to remove public key...
[ "def", "new_revoke_public_key_transaction", "(", "self", ",", "ont_id", ":", "str", ",", "bytes_operator", ":", "bytes", ",", "revoked_pub_key", ":", "str", "or", "bytes", ",", "b58_payer_address", ":", "str", ",", "gas_limit", ":", "int", ",", "gas_price", ":...
This interface is used to generate a Transaction object which is used to remove public key. :param ont_id: OntId. :param bytes_operator: operator args in from of bytes. :param revoked_pub_key: a public key string which will be removed. :param b58_payer_address: a base58 encode address w...
[ "This", "interface", "is", "used", "to", "generate", "a", "Transaction", "object", "which", "is", "used", "to", "remove", "public", "key", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L438-L460
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.new_add_attribute_transaction
def new_add_attribute_transaction(self, ont_id: str, pub_key: str or bytes, attributes: Attribute, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to add attribute. :param on...
python
def new_add_attribute_transaction(self, ont_id: str, pub_key: str or bytes, attributes: Attribute, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to add attribute. :param on...
[ "def", "new_add_attribute_transaction", "(", "self", ",", "ont_id", ":", "str", ",", "pub_key", ":", "str", "or", "bytes", ",", "attributes", ":", "Attribute", ",", "b58_payer_address", ":", "str", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", ...
This interface is used to generate a Transaction object which is used to add attribute. :param ont_id: OntId. :param pub_key: the hexadecimal public key in the form of string. :param attributes: a list of attributes we want to add. :param b58_payer_address: a base58 encode address which...
[ "This", "interface", "is", "used", "to", "generate", "a", "Transaction", "object", "which", "is", "used", "to", "add", "attribute", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L463-L488
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.new_remove_attribute_transaction
def new_remove_attribute_transaction(self, ont_id: str, pub_key: str or bytes, attrib_key: str, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to remove attribute. :param...
python
def new_remove_attribute_transaction(self, ont_id: str, pub_key: str or bytes, attrib_key: str, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to remove attribute. :param...
[ "def", "new_remove_attribute_transaction", "(", "self", ",", "ont_id", ":", "str", ",", "pub_key", ":", "str", "or", "bytes", ",", "attrib_key", ":", "str", ",", "b58_payer_address", ":", "str", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int", "...
This interface is used to generate a Transaction object which is used to remove attribute. :param ont_id: OntId. :param pub_key: the hexadecimal public key in the form of string. :param attrib_key: a string which is used to indicate which attribute we want to remove. :param b58_payer_ad...
[ "This", "interface", "is", "used", "to", "generate", "a", "Transaction", "object", "which", "is", "used", "to", "remove", "attribute", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L491-L512
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
OntId.new_add_recovery_transaction
def new_add_recovery_transaction(self, ont_id: str, pub_key: str or bytes, b58_recovery_address: str, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to add the recovery. :par...
python
def new_add_recovery_transaction(self, ont_id: str, pub_key: str or bytes, b58_recovery_address: str, b58_payer_address: str, gas_limit: int, gas_price: int): """ This interface is used to generate a Transaction object which is used to add the recovery. :par...
[ "def", "new_add_recovery_transaction", "(", "self", ",", "ont_id", ":", "str", ",", "pub_key", ":", "str", "or", "bytes", ",", "b58_recovery_address", ":", "str", ",", "b58_payer_address", ":", "str", ",", "gas_limit", ":", "int", ",", "gas_price", ":", "int...
This interface is used to generate a Transaction object which is used to add the recovery. :param ont_id: OntId. :param pub_key: the hexadecimal public key in the form of string. :param b58_recovery_address: a base58 encode address which indicate who is the recovery. :param b58_payer_ad...
[ "This", "interface", "is", "used", "to", "generate", "a", "Transaction", "object", "which", "is", "used", "to", "add", "the", "recovery", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L515-L537
ontio/ontology-python-sdk
ontology/core/transaction.py
Transaction.sign_transaction
def sign_transaction(self, signer: Account): """ This interface is used to sign the transaction. :param signer: an Account object which will sign the transaction. :return: a Transaction object which has been signed. """ tx_hash = self.hash256() sig_data = signer....
python
def sign_transaction(self, signer: Account): """ This interface is used to sign the transaction. :param signer: an Account object which will sign the transaction. :return: a Transaction object which has been signed. """ tx_hash = self.hash256() sig_data = signer....
[ "def", "sign_transaction", "(", "self", ",", "signer", ":", "Account", ")", ":", "tx_hash", "=", "self", ".", "hash256", "(", ")", "sig_data", "=", "signer", ".", "generate_signature", "(", "tx_hash", ")", "sig", "=", "[", "Sig", "(", "[", "signer", "....
This interface is used to sign the transaction. :param signer: an Account object which will sign the transaction. :return: a Transaction object which has been signed.
[ "This", "interface", "is", "used", "to", "sign", "the", "transaction", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/core/transaction.py#L137-L147
ontio/ontology-python-sdk
ontology/core/transaction.py
Transaction.add_sign_transaction
def add_sign_transaction(self, signer: Account): """ This interface is used to add signature into the transaction. :param signer: an Account object which will sign the transaction. :return: a Transaction object which has been signed. """ if self.sig_list is None or len(s...
python
def add_sign_transaction(self, signer: Account): """ This interface is used to add signature into the transaction. :param signer: an Account object which will sign the transaction. :return: a Transaction object which has been signed. """ if self.sig_list is None or len(s...
[ "def", "add_sign_transaction", "(", "self", ",", "signer", ":", "Account", ")", ":", "if", "self", ".", "sig_list", "is", "None", "or", "len", "(", "self", ".", "sig_list", ")", "==", "0", ":", "self", ".", "sig_list", "=", "[", "]", "elif", "len", ...
This interface is used to add signature into the transaction. :param signer: an Account object which will sign the transaction. :return: a Transaction object which has been signed.
[ "This", "interface", "is", "used", "to", "add", "signature", "into", "the", "transaction", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/core/transaction.py#L149-L163
ontio/ontology-python-sdk
ontology/core/transaction.py
Transaction.add_multi_sign_transaction
def add_multi_sign_transaction(self, m: int, pub_keys: List[bytes] or List[str], signer: Account): """ This interface is used to generate an Transaction object which has multi signature. :param tx: a Transaction object which will be signed. :param m: the amount of signer. :param...
python
def add_multi_sign_transaction(self, m: int, pub_keys: List[bytes] or List[str], signer: Account): """ This interface is used to generate an Transaction object which has multi signature. :param tx: a Transaction object which will be signed. :param m: the amount of signer. :param...
[ "def", "add_multi_sign_transaction", "(", "self", ",", "m", ":", "int", ",", "pub_keys", ":", "List", "[", "bytes", "]", "or", "List", "[", "str", "]", ",", "signer", ":", "Account", ")", ":", "for", "index", ",", "pk", "in", "enumerate", "(", "pub_k...
This interface is used to generate an Transaction object which has multi signature. :param tx: a Transaction object which will be signed. :param m: the amount of signer. :param pub_keys: a list of public keys. :param signer: an Account object which will sign the transaction. :re...
[ "This", "interface", "is", "used", "to", "generate", "an", "Transaction", "object", "which", "has", "multi", "signature", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/core/transaction.py#L165-L195
ontio/ontology-python-sdk
ontology/io/memory_stream.py
StreamManager.get_stream
def get_stream(data=None): """ Get a MemoryStream instance. Args: data (bytes, bytearray, BytesIO): (Optional) data to create the stream from. Returns: MemoryStream: instance. """ if len(__mstreams_available__) == 0: if data: ...
python
def get_stream(data=None): """ Get a MemoryStream instance. Args: data (bytes, bytearray, BytesIO): (Optional) data to create the stream from. Returns: MemoryStream: instance. """ if len(__mstreams_available__) == 0: if data: ...
[ "def", "get_stream", "(", "data", "=", "None", ")", ":", "if", "len", "(", "__mstreams_available__", ")", "==", "0", ":", "if", "data", ":", "mstream", "=", "MemoryStream", "(", "data", ")", "mstream", ".", "seek", "(", "0", ")", "else", ":", "mstrea...
Get a MemoryStream instance. Args: data (bytes, bytearray, BytesIO): (Optional) data to create the stream from. Returns: MemoryStream: instance.
[ "Get", "a", "MemoryStream", "instance", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/memory_stream.py#L28-L55
ontio/ontology-python-sdk
ontology/common/address.py
Address.address_from_vm_code
def address_from_vm_code(code: str): """ generate contract address from avm bytecode. :param code: str :return: Address """ script_hash = Address.to_script_hash(bytearray.fromhex(code))[::-1] return Address(script_hash)
python
def address_from_vm_code(code: str): """ generate contract address from avm bytecode. :param code: str :return: Address """ script_hash = Address.to_script_hash(bytearray.fromhex(code))[::-1] return Address(script_hash)
[ "def", "address_from_vm_code", "(", "code", ":", "str", ")", ":", "script_hash", "=", "Address", ".", "to_script_hash", "(", "bytearray", ".", "fromhex", "(", "code", ")", ")", "[", ":", ":", "-", "1", "]", "return", "Address", "(", "script_hash", ")" ]
generate contract address from avm bytecode. :param code: str :return: Address
[ "generate", "contract", "address", "from", "avm", "bytecode", ".", ":", "param", "code", ":", "str", ":", "return", ":", "Address" ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/common/address.py#L47-L54
ontio/ontology-python-sdk
ontology/account/account.py
Account.export_gcm_encrypted_private_key
def export_gcm_encrypted_private_key(self, password: str, salt: str, n: int = 16384) -> str: """ This interface is used to export an AES algorithm encrypted private key with the mode of GCM. :param password: the secret pass phrase to generate the keys from. :param salt: A string to use ...
python
def export_gcm_encrypted_private_key(self, password: str, salt: str, n: int = 16384) -> str: """ This interface is used to export an AES algorithm encrypted private key with the mode of GCM. :param password: the secret pass phrase to generate the keys from. :param salt: A string to use ...
[ "def", "export_gcm_encrypted_private_key", "(", "self", ",", "password", ":", "str", ",", "salt", ":", "str", ",", "n", ":", "int", "=", "16384", ")", "->", "str", ":", "r", "=", "8", "p", "=", "8", "dk_len", "=", "64", "scrypt", "=", "Scrypt", "("...
This interface is used to export an AES algorithm encrypted private key with the mode of GCM. :param password: the secret pass phrase to generate the keys from. :param salt: A string to use for better protection from dictionary attacks. This value does not need to be kept secret, ...
[ "This", "interface", "is", "used", "to", "export", "an", "AES", "algorithm", "encrypted", "private", "key", "with", "the", "mode", "of", "GCM", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/account/account.py#L108-L130
ontio/ontology-python-sdk
ontology/account/account.py
Account.get_gcm_decoded_private_key
def get_gcm_decoded_private_key(encrypted_key_str: str, password: str, b58_address: str, salt: str, n: int, scheme: SignatureScheme) -> str: """ This interface is used to decrypt an private key which has been encrypted. :param encrypted_key_str: an gcm encryp...
python
def get_gcm_decoded_private_key(encrypted_key_str: str, password: str, b58_address: str, salt: str, n: int, scheme: SignatureScheme) -> str: """ This interface is used to decrypt an private key which has been encrypted. :param encrypted_key_str: an gcm encryp...
[ "def", "get_gcm_decoded_private_key", "(", "encrypted_key_str", ":", "str", ",", "password", ":", "str", ",", "b58_address", ":", "str", ",", "salt", ":", "str", ",", "n", ":", "int", ",", "scheme", ":", "SignatureScheme", ")", "->", "str", ":", "r", "="...
This interface is used to decrypt an private key which has been encrypted. :param encrypted_key_str: an gcm encrypted private key in the form of string. :param password: the secret pass phrase to generate the keys from. :param b58_address: a base58 encode address which should be correspond with...
[ "This", "interface", "is", "used", "to", "decrypt", "an", "private", "key", "which", "has", "been", "encrypted", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/account/account.py#L133-L162
ontio/ontology-python-sdk
ontology/account/account.py
Account.export_wif
def export_wif(self) -> str: """ This interface is used to get export ECDSA private key in the form of WIF which is a way to encoding an ECDSA private key and make it easier to copy. :return: a WIF encode private key. """ data = b''.join([b'\x80', self.__private_key, b'\...
python
def export_wif(self) -> str: """ This interface is used to get export ECDSA private key in the form of WIF which is a way to encoding an ECDSA private key and make it easier to copy. :return: a WIF encode private key. """ data = b''.join([b'\x80', self.__private_key, b'\...
[ "def", "export_wif", "(", "self", ")", "->", "str", ":", "data", "=", "b''", ".", "join", "(", "[", "b'\\x80'", ",", "self", ".", "__private_key", ",", "b'\\01'", "]", ")", "checksum", "=", "Digest", ".", "hash256", "(", "data", "[", "0", ":", "34"...
This interface is used to get export ECDSA private key in the form of WIF which is a way to encoding an ECDSA private key and make it easier to copy. :return: a WIF encode private key.
[ "This", "interface", "is", "used", "to", "get", "export", "ECDSA", "private", "key", "in", "the", "form", "of", "WIF", "which", "is", "a", "way", "to", "encoding", "an", "ECDSA", "private", "key", "and", "make", "it", "easier", "to", "copy", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/account/account.py#L216-L226
ontio/ontology-python-sdk
ontology/account/account.py
Account.get_private_key_from_wif
def get_private_key_from_wif(wif: str) -> bytes: """ This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes. """ if wif is None or wif is "": raise Exception("no...
python
def get_private_key_from_wif(wif: str) -> bytes: """ This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes. """ if wif is None or wif is "": raise Exception("no...
[ "def", "get_private_key_from_wif", "(", "wif", ":", "str", ")", "->", "bytes", ":", "if", "wif", "is", "None", "or", "wif", "is", "\"\"", ":", "raise", "Exception", "(", "\"none wif\"", ")", "data", "=", "base58", ".", "b58decode", "(", "wif", ")", "if...
This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes.
[ "This", "interface", "is", "used", "to", "decode", "a", "WIF", "encode", "ECDSA", "private", "key", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/account/account.py#L229-L245
ontio/ontology-python-sdk
ontology/crypto/kdf.py
pbkdf2
def pbkdf2(seed: str or bytes, dk_len: int) -> bytes: """ Derive one key from a seed. :param seed: the secret pass phrase to generate the keys from. :param dk_len: the length in bytes of every derived key. :return: """ key = b'' index = 1 bytes_seed = str_to_bytes(seed) while le...
python
def pbkdf2(seed: str or bytes, dk_len: int) -> bytes: """ Derive one key from a seed. :param seed: the secret pass phrase to generate the keys from. :param dk_len: the length in bytes of every derived key. :return: """ key = b'' index = 1 bytes_seed = str_to_bytes(seed) while le...
[ "def", "pbkdf2", "(", "seed", ":", "str", "or", "bytes", ",", "dk_len", ":", "int", ")", "->", "bytes", ":", "key", "=", "b''", "index", "=", "1", "bytes_seed", "=", "str_to_bytes", "(", "seed", ")", "while", "len", "(", "key", ")", "<", "dk_len", ...
Derive one key from a seed. :param seed: the secret pass phrase to generate the keys from. :param dk_len: the length in bytes of every derived key. :return:
[ "Derive", "one", "key", "from", "a", "seed", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/crypto/kdf.py#L9-L23
ontio/ontology-python-sdk
ontology/core/program.py
ProgramBuilder.sort_public_keys
def sort_public_keys(pub_keys: List[bytes] or List[str]): """ :param pub_keys: a list of public keys in format of bytes. :return: sorted public keys. """ for index, key in enumerate(pub_keys): if isinstance(key, str): pub_keys[index] = bytes.fromhex(ke...
python
def sort_public_keys(pub_keys: List[bytes] or List[str]): """ :param pub_keys: a list of public keys in format of bytes. :return: sorted public keys. """ for index, key in enumerate(pub_keys): if isinstance(key, str): pub_keys[index] = bytes.fromhex(ke...
[ "def", "sort_public_keys", "(", "pub_keys", ":", "List", "[", "bytes", "]", "or", "List", "[", "str", "]", ")", ":", "for", "index", ",", "key", "in", "enumerate", "(", "pub_keys", ")", ":", "if", "isinstance", "(", "key", ",", "str", ")", ":", "pu...
:param pub_keys: a list of public keys in format of bytes. :return: sorted public keys.
[ ":", "param", "pub_keys", ":", "a", "list", "of", "public", "keys", "in", "format", "of", "bytes", ".", ":", "return", ":", "sorted", "public", "keys", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/core/program.py#L94-L102
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/abi/abi_function.py
AbiFunction.set_params_value
def set_params_value(self, *params): """ This interface is used to set parameter value for an function in abi file. """ if len(params) != len(self.parameters): raise Exception("parameter error") temp = self.parameters self.parameters = [] for i in rang...
python
def set_params_value(self, *params): """ This interface is used to set parameter value for an function in abi file. """ if len(params) != len(self.parameters): raise Exception("parameter error") temp = self.parameters self.parameters = [] for i in rang...
[ "def", "set_params_value", "(", "self", ",", "*", "params", ")", ":", "if", "len", "(", "params", ")", "!=", "len", "(", "self", ".", "parameters", ")", ":", "raise", "Exception", "(", "\"parameter error\"", ")", "temp", "=", "self", ".", "parameters", ...
This interface is used to set parameter value for an function in abi file.
[ "This", "interface", "is", "used", "to", "set", "parameter", "value", "for", "an", "function", "in", "abi", "file", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/abi/abi_function.py#L12-L22
ontio/ontology-python-sdk
ontology/smart_contract/neo_contract/abi/abi_function.py
AbiFunction.get_parameter
def get_parameter(self, param_name: str) -> Parameter: """ This interface is used to get a Parameter object from an AbiFunction object which contain given function parameter's name, type and value. :param param_name: a string used to indicate which parameter we want to get from AbiFunct...
python
def get_parameter(self, param_name: str) -> Parameter: """ This interface is used to get a Parameter object from an AbiFunction object which contain given function parameter's name, type and value. :param param_name: a string used to indicate which parameter we want to get from AbiFunct...
[ "def", "get_parameter", "(", "self", ",", "param_name", ":", "str", ")", "->", "Parameter", ":", "for", "p", "in", "self", ".", "parameters", ":", "if", "p", ".", "name", "==", "param_name", ":", "return", "p", "raise", "SDKException", "(", "ErrorCode", ...
This interface is used to get a Parameter object from an AbiFunction object which contain given function parameter's name, type and value. :param param_name: a string used to indicate which parameter we want to get from AbiFunction. :return: a Parameter object which contain given function param...
[ "This", "interface", "is", "used", "to", "get", "a", "Parameter", "object", "from", "an", "AbiFunction", "object", "which", "contain", "given", "function", "parameter", "s", "name", "type", "and", "value", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/neo_contract/abi/abi_function.py#L24-L35
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.unpack
def unpack(self, fmt, length=1): """ Unpack the stream contents according to the specified format in `fmt`. For more information about the `fmt` format see: https://docs.python.org/3/library/struct.html Args: fmt (str): format string. length (int): amount of byte...
python
def unpack(self, fmt, length=1): """ Unpack the stream contents according to the specified format in `fmt`. For more information about the `fmt` format see: https://docs.python.org/3/library/struct.html Args: fmt (str): format string. length (int): amount of byte...
[ "def", "unpack", "(", "self", ",", "fmt", ",", "length", "=", "1", ")", ":", "try", ":", "info", "=", "struct", ".", "unpack", "(", "fmt", ",", "self", ".", "stream", ".", "read", "(", "length", ")", ")", "[", "0", "]", "except", "struct", ".",...
Unpack the stream contents according to the specified format in `fmt`. For more information about the `fmt` format see: https://docs.python.org/3/library/struct.html Args: fmt (str): format string. length (int): amount of bytes to read. Returns: variable: th...
[ "Unpack", "the", "stream", "contents", "according", "to", "the", "specified", "format", "in", "fmt", ".", "For", "more", "information", "about", "the", "fmt", "format", "see", ":", "https", ":", "//", "docs", ".", "python", ".", "org", "/", "3", "/", "...
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L37-L53
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_byte
def read_byte(self, do_ord=True) -> int: """ Read a single byte. Args: do_ord (bool): (default True) convert the byte to an ordinal first. Returns: bytes: a single byte if successful. 0 (int) if an exception occurred. """ try: if do_ord...
python
def read_byte(self, do_ord=True) -> int: """ Read a single byte. Args: do_ord (bool): (default True) convert the byte to an ordinal first. Returns: bytes: a single byte if successful. 0 (int) if an exception occurred. """ try: if do_ord...
[ "def", "read_byte", "(", "self", ",", "do_ord", "=", "True", ")", "->", "int", ":", "try", ":", "if", "do_ord", ":", "return", "ord", "(", "self", ".", "stream", ".", "read", "(", "1", ")", ")", "else", ":", "return", "self", ".", "stream", ".", ...
Read a single byte. Args: do_ord (bool): (default True) convert the byte to an ordinal first. Returns: bytes: a single byte if successful. 0 (int) if an exception occurred.
[ "Read", "a", "single", "byte", ".", "Args", ":", "do_ord", "(", "bool", ")", ":", "(", "default", "True", ")", "convert", "the", "byte", "to", "an", "ordinal", "first", ".", "Returns", ":", "bytes", ":", "a", "single", "byte", "if", "successful", "."...
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L55-L69
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_bytes
def read_bytes(self, length) -> bytes: """ Read the specified number of bytes from the stream. Args: length (int): number of bytes to read. Returns: bytes: `length` number of bytes. """ value = self.stream.read(length) return value
python
def read_bytes(self, length) -> bytes: """ Read the specified number of bytes from the stream. Args: length (int): number of bytes to read. Returns: bytes: `length` number of bytes. """ value = self.stream.read(length) return value
[ "def", "read_bytes", "(", "self", ",", "length", ")", "->", "bytes", ":", "value", "=", "self", ".", "stream", ".", "read", "(", "length", ")", "return", "value" ]
Read the specified number of bytes from the stream. Args: length (int): number of bytes to read. Returns: bytes: `length` number of bytes.
[ "Read", "the", "specified", "number", "of", "bytes", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L71-L82
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_float
def read_float(self, little_endian=True): """ Read 4 bytes as a float value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: float: """ if little_endian: endian = "<" else:...
python
def read_float(self, little_endian=True): """ Read 4 bytes as a float value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: float: """ if little_endian: endian = "<" else:...
[ "def", "read_float", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "\"%sf\"", "%", "endian", ",", "4", ")" ]
Read 4 bytes as a float value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: float:
[ "Read", "4", "bytes", "as", "a", "float", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L102-L116
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_double
def read_double(self, little_endian=True): """ Read 8 bytes as a double value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: float: """ if little_endian: endian = "<" els...
python
def read_double(self, little_endian=True): """ Read 8 bytes as a double value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: float: """ if little_endian: endian = "<" els...
[ "def", "read_double", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "\"%sd\"", "%", "endian", ",", "8", ")" ]
Read 8 bytes as a double value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: float:
[ "Read", "8", "bytes", "as", "a", "double", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L118-L132
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_int8
def read_int8(self, little_endian=True): """ Read 1 byte as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_int8(self, little_endian=True): """ Read 1 byte as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_int8", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sb'", "%", "endian", ")" ]
Read 1 byte as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "1", "byte", "as", "a", "signed", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L134-L148
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_uint8
def read_uint8(self, little_endian=True): """ Read 1 byte as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_uint8(self, little_endian=True): """ Read 1 byte as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_uint8", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sB'", "%", "endian", ")" ]
Read 1 byte as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "1", "byte", "as", "an", "unsigned", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L150-L164
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_int16
def read_int16(self, little_endian=True): """ Read 2 byte as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_int16(self, little_endian=True): """ Read 2 byte as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_int16", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sh'", "%", "endian", ",", "2", ")" ]
Read 2 byte as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "2", "byte", "as", "a", "signed", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L166-L180
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_uint16
def read_uint16(self, little_endian=True): """ Read 2 byte as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_uint16(self, little_endian=True): """ Read 2 byte as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_uint16", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sH'", "%", "endian", ",", "2", ")" ]
Read 2 byte as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "2", "byte", "as", "an", "unsigned", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L182-L196
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_int32
def read_int32(self, little_endian=True): """ Read 4 bytes as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_int32(self, little_endian=True): """ Read 4 bytes as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_int32", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%si'", "%", "endian", ",", "4", ")" ]
Read 4 bytes as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "4", "bytes", "as", "a", "signed", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L198-L212
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_uint32
def read_uint32(self, little_endian=True): """ Read 4 bytes as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_uint32(self, little_endian=True): """ Read 4 bytes as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_uint32", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sI'", "%", "endian", ",", "4", ")" ]
Read 4 bytes as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "4", "bytes", "as", "an", "unsigned", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L214-L228
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_int64
def read_int64(self, little_endian=True): """ Read 8 bytes as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_int64(self, little_endian=True): """ Read 8 bytes as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_int64", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sq'", "%", "endian", ",", "8", ")" ]
Read 8 bytes as a signed integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "8", "bytes", "as", "a", "signed", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L230-L244
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_uint64
def read_uint64(self, little_endian=True): """ Read 8 bytes as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
python
def read_uint64(self, little_endian=True): """ Read 8 bytes as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: """ if little_endian: endian = "<" ...
[ "def", "read_uint64", "(", "self", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "unpack", "(", "'%sQ'", "%", "endian", ",", "8", ")" ]
Read 8 bytes as an unsigned integer value from the stream. Args: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int:
[ "Read", "8", "bytes", "as", "an", "unsigned", "integer", "value", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L246-L260
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_var_int
def read_var_int(self, max_size=sys.maxsize): """ Read a variable length integer from the stream. The NEO network protocol supports encoded storage for space saving. See: http://docs.neo.org/en-us/node/network-protocol.html#convention Args: max_size (int): (Optional) maximum...
python
def read_var_int(self, max_size=sys.maxsize): """ Read a variable length integer from the stream. The NEO network protocol supports encoded storage for space saving. See: http://docs.neo.org/en-us/node/network-protocol.html#convention Args: max_size (int): (Optional) maximum...
[ "def", "read_var_int", "(", "self", ",", "max_size", "=", "sys", ".", "maxsize", ")", ":", "fb", "=", "self", ".", "read_byte", "(", ")", "if", "fb", "is", "0", ":", "return", "fb", "if", "hex", "(", "fb", ")", "==", "'0xfd'", ":", "value", "=", ...
Read a variable length integer from the stream. The NEO network protocol supports encoded storage for space saving. See: http://docs.neo.org/en-us/node/network-protocol.html#convention Args: max_size (int): (Optional) maximum number of bytes to read. Returns: int:
[ "Read", "a", "variable", "length", "integer", "from", "the", "stream", ".", "The", "NEO", "network", "protocol", "supports", "encoded", "storage", "for", "space", "saving", ".", "See", ":", "http", ":", "//", "docs", ".", "neo", ".", "org", "/", "en", ...
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L262-L286
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_var_bytes
def read_var_bytes(self, max_size=sys.maxsize) -> bytes: """ Read a variable length of bytes from the stream. Args: max_size (int): (Optional) maximum number of bytes to read. Returns: bytes: """ length = self.read_var_int(max_size) retur...
python
def read_var_bytes(self, max_size=sys.maxsize) -> bytes: """ Read a variable length of bytes from the stream. Args: max_size (int): (Optional) maximum number of bytes to read. Returns: bytes: """ length = self.read_var_int(max_size) retur...
[ "def", "read_var_bytes", "(", "self", ",", "max_size", "=", "sys", ".", "maxsize", ")", "->", "bytes", ":", "length", "=", "self", ".", "read_var_int", "(", "max_size", ")", "return", "self", ".", "read_bytes", "(", "length", ")" ]
Read a variable length of bytes from the stream. Args: max_size (int): (Optional) maximum number of bytes to read. Returns: bytes:
[ "Read", "a", "variable", "length", "of", "bytes", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L288-L299
ontio/ontology-python-sdk
ontology/io/binary_reader.py
BinaryReader.read_str
def read_str(self): """ Read a string from the stream. Returns: str: """ length = self.read_uint8() return self.unpack(str(length) + 's', length)
python
def read_str(self): """ Read a string from the stream. Returns: str: """ length = self.read_uint8() return self.unpack(str(length) + 's', length)
[ "def", "read_str", "(", "self", ")", ":", "length", "=", "self", ".", "read_uint8", "(", ")", "return", "self", ".", "unpack", "(", "str", "(", "length", ")", "+", "'s'", ",", "length", ")" ]
Read a string from the stream. Returns: str:
[ "Read", "a", "string", "from", "the", "stream", "." ]
train
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_reader.py#L301-L309