Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
FileBasedCache._key_to_file
(self, key, version=None)
Convert a key into a cache file path. Basically this is the root cache path joined with the md5sum of the key and a suffix.
Convert a key into a cache file path. Basically this is the root cache path joined with the md5sum of the key and a suffix.
def _key_to_file(self, key, version=None): """ Convert a key into a cache file path. Basically this is the root cache path joined with the md5sum of the key and a suffix. """ key = self.make_key(key, version=version) self.validate_key(key) return os.path.join(self...
[ "def", "_key_to_file", "(", "self", ",", "key", ",", "version", "=", "None", ")", ":", "key", "=", "self", ".", "make_key", "(", "key", ",", "version", "=", "version", ")", "self", ".", "validate_key", "(", "key", ")", "return", "os", ".", "path", ...
[ 112, 4 ]
[ 120, 76 ]
python
en
['en', 'error', 'th']
False
FileBasedCache.clear
(self)
Remove all the cache files.
Remove all the cache files.
def clear(self): """ Remove all the cache files. """ if not os.path.exists(self._dir): return for fname in self._list_cache_files(): self._delete(fname)
[ "def", "clear", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_dir", ")", ":", "return", "for", "fname", "in", "self", ".", "_list_cache_files", "(", ")", ":", "self", ".", "_delete", "(", "fname", ")" ]
[ 122, 4 ]
[ 129, 31 ]
python
en
['en', 'error', 'th']
False
FileBasedCache._is_expired
(self, f)
Takes an open cache file and determines if it has expired, deletes the file if it is has passed its expiry time.
Takes an open cache file and determines if it has expired, deletes the file if it is has passed its expiry time.
def _is_expired(self, f): """ Takes an open cache file and determines if it has expired, deletes the file if it is has passed its expiry time. """ exp = pickle.load(f) if exp is not None and exp < time.time(): f.close() # On Windows a file has to be closed be...
[ "def", "_is_expired", "(", "self", ",", "f", ")", ":", "exp", "=", "pickle", ".", "load", "(", "f", ")", "if", "exp", "is", "not", "None", "and", "exp", "<", "time", ".", "time", "(", ")", ":", "f", ".", "close", "(", ")", "# On Windows a file ha...
[ 131, 4 ]
[ 141, 20 ]
python
en
['en', 'error', 'th']
False
FileBasedCache._list_cache_files
(self)
Get a list of paths to all the cache files. These are all the files in the root cache dir that end on the cache_suffix.
Get a list of paths to all the cache files. These are all the files in the root cache dir that end on the cache_suffix.
def _list_cache_files(self): """ Get a list of paths to all the cache files. These are all the files in the root cache dir that end on the cache_suffix. """ if not os.path.exists(self._dir): return [] filelist = [os.path.join(self._dir, fname) for fname ...
[ "def", "_list_cache_files", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_dir", ")", ":", "return", "[", "]", "filelist", "=", "[", "os", ".", "path", ".", "join", "(", "self", ".", "_dir", ",", "fname"...
[ 143, 4 ]
[ 152, 23 ]
python
en
['en', 'error', 'th']
False
EmailUserManager._create_user
(self, email, password, is_staff, is_superuser, **extra_fields)
Creates and saves a User with the given email and password.
Creates and saves a User with the given email and password.
def _create_user(self, email, password, is_staff, is_superuser, **extra_fields): """ Creates and saves a User with the given email and password. """ email = self.normalize_email(email) user = self.model(email=email, is_staff=is_staff, is_active=True, ...
[ "def", "_create_user", "(", "self", ",", "email", ",", "password", ",", "is_staff", ",", "is_superuser", ",", "*", "*", "extra_fields", ")", ":", "email", "=", "self", ".", "normalize_email", "(", "email", ")", "user", "=", "self", ".", "model", "(", "...
[ 7, 4 ]
[ 17, 19 ]
python
en
['en', 'error', 'th']
False
up_to_climate
(reset=False, use_mp=None)
Run the tasks you want.
Run the tasks you want.
def up_to_climate(reset=False, use_mp=None): """Run the tasks you want.""" # test directory if not os.path.exists(_TEST_DIR): os.makedirs(_TEST_DIR) if reset: clean_dir(_TEST_DIR) if not os.path.exists(CLI_LOGF): with open(CLI_LOGF, 'wb') as f: pickle.dump('none...
[ "def", "up_to_climate", "(", "reset", "=", "False", ",", "use_mp", "=", "None", ")", ":", "# test directory", "if", "not", "os", ".", "path", ".", "exists", "(", "_TEST_DIR", ")", ":", "os", ".", "makedirs", "(", "_TEST_DIR", ")", "if", "reset", ":", ...
[ 37, 0 ]
[ 100, 16 ]
python
en
['en', 'en', 'en']
True
up_to_inversion
(reset=False)
Run the tasks you want.
Run the tasks you want.
def up_to_inversion(reset=False): """Run the tasks you want.""" gdirs = up_to_climate(reset=reset) with open(CLI_LOGF, 'rb') as f: clilog = pickle.load(f) if clilog != 'histalp': reset = True else: try: tasks.prepare_for_inversion(gdirs[0]) except Excep...
[ "def", "up_to_inversion", "(", "reset", "=", "False", ")", ":", "gdirs", "=", "up_to_climate", "(", "reset", "=", "reset", ")", "with", "open", "(", "CLI_LOGF", ",", "'rb'", ")", "as", "f", ":", "clilog", "=", "pickle", ".", "load", "(", "f", ")", ...
[ 103, 0 ]
[ 131, 16 ]
python
en
['en', 'en', 'en']
True
wallets_prefarm
(two_wallet_nodes)
Sets up the node with 10 blocks, and returns a payer and payee wallet.
Sets up the node with 10 blocks, and returns a payer and payee wallet.
async def wallets_prefarm(two_wallet_nodes): """ Sets up the node with 10 blocks, and returns a payer and payee wallet. """ farm_blocks = 10 buffer = 4 full_nodes, wallets = two_wallet_nodes full_node_api = full_nodes[0] full_node_server = full_node_api.server wallet_node_0, wallet_s...
[ "async", "def", "wallets_prefarm", "(", "two_wallet_nodes", ")", ":", "farm_blocks", "=", "10", "buffer", "=", "4", "full_nodes", ",", "wallets", "=", "two_wallet_nodes", "full_node_api", "=", "full_nodes", "[", "0", "]", "full_node_server", "=", "full_node_api", ...
[ 45, 0 ]
[ 74, 54 ]
python
en
['en', 'error', 'th']
False
FieldRenderer.fix_clearable_file_input
(self, html)
Fix a clearable file input. TODO: This needs improvement Currently Django returns Currently: <a href="dummy.txt">dummy.txt</a> <input id="file4-clear_id" name="file4-clear" type="checkbox" /> <label for="file4-clear_id">Clear</label><br /> Change: <inpu...
Fix a clearable file input.
def fix_clearable_file_input(self, html): """ Fix a clearable file input. TODO: This needs improvement Currently Django returns Currently: <a href="dummy.txt">dummy.txt</a> <input id="file4-clear_id" name="file4-clear" type="checkbox" /> <label for="file...
[ "def", "fix_clearable_file_input", "(", "self", ",", "html", ")", ":", "# TODO This needs improvement", "return", "'<div class=\"row bootstrap3-multi-input\"><div class=\"col-xs-12\">{html}</div></div>'", ".", "format", "(", "html", "=", "html", ")" ]
[ 338, 4 ]
[ 354, 116 ]
python
en
['en', 'error', 'th']
False
explode_glob_path
(path)
Take a glob and hand back the full recursive expansion, ignoring links.
Take a glob and hand back the full recursive expansion, ignoring links.
def explode_glob_path(path): """Take a glob and hand back the full recursive expansion, ignoring links. """ result = [] includes = glob.glob(path) for item in includes: if os.path.isdir(item) and not os.path.islink(item): result.extend(explode_glob_path(os.path.join(item, "*...
[ "def", "explode_glob_path", "(", "path", ")", ":", "result", "=", "[", "]", "includes", "=", "glob", ".", "glob", "(", "path", ")", "for", "item", "in", "includes", ":", "if", "os", ".", "path", ".", "isdir", "(", "item", ")", "and", "not", "os", ...
[ 46, 0 ]
[ 58, 17 ]
python
en
['en', 'en', 'en']
True
proc_data_files
(data_files)
Because data_files doesn't natively support globs... let's add them.
Because data_files doesn't natively support globs... let's add them.
def proc_data_files(data_files): """Because data_files doesn't natively support globs... let's add them. """ result = [] # If running in a virtualenv, don't return data files that would install to # system paths (mainly useful for running tests via tox). if hasattr(sys, 'real_prefix'): ...
[ "def", "proc_data_files", "(", "data_files", ")", ":", "result", "=", "[", "]", "# If running in a virtualenv, don't return data files that would install to", "# system paths (mainly useful for running tests via tox).", "if", "hasattr", "(", "sys", ",", "'real_prefix'", ")", ":...
[ 61, 0 ]
[ 78, 17 ]
python
en
['fr', 'en', 'en']
True
FormBuilder.get_create_field_function
(self, type)
Takes string of field type and returns a Django Form Field Instance. Assumes form field creation functions are in the format: 'create_fieldtype_field'
Takes string of field type and returns a Django Form Field Instance. Assumes form field creation functions are in the format: 'create_fieldtype_field'
def get_create_field_function(self, type): """ Takes string of field type and returns a Django Form Field Instance. Assumes form field creation functions are in the format: 'create_fieldtype_field' """ create_field_function = getattr(self, 'create_%s_field' % ...
[ "def", "get_create_field_function", "(", "self", ",", "type", ")", ":", "create_field_function", "=", "getattr", "(", "self", ",", "'create_%s_field'", "%", "type", ",", "None", ")", "if", "create_field_function", ":", "return", "create_field_function", "else", ":...
[ 83, 4 ]
[ 103, 13 ]
python
en
['en', 'error', 'th']
False
get_configs_dir
()
Generate configs dir path on install, moved from utils due to import error :return: str
Generate configs dir path on install, moved from utils due to import error :return: str
def get_configs_dir(): """ Generate configs dir path on install, moved from utils due to import error :return: str """ # detect virtualenv or pyenv usage if hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): path = sys.prefix else: ...
[ "def", "get_configs_dir", "(", ")", ":", "# detect virtualenv or pyenv usage", "if", "hasattr", "(", "sys", ",", "'real_prefix'", ")", "or", "(", "hasattr", "(", "sys", ",", "'base_prefix'", ")", "and", "sys", ".", "base_prefix", "!=", "sys", ".", "prefix", ...
[ 94, 0 ]
[ 109, 15 ]
python
en
['en', 'error', 'th']
False
RCProvider.get_rc
(self)
Must be implemented in subclasses
Must be implemented in subclasses
def get_rc(self): """ Must be implemented in subclasses """ pass
[ "def", "get_rc", "(", "self", ")", ":", "pass" ]
[ 30, 4 ]
[ 34, 12 ]
python
en
['en', 'error', 'th']
False
ToolError.__init__
(self, message, diagnostics=None)
:type message: str :type diagnostics: list[str]
:type message: str :type diagnostics: list[str]
def __init__(self, message, diagnostics=None): """ :type message: str :type diagnostics: list[str] """ super(ToolError, self).__init__(message) self.diagnostics = diagnostics
[ "def", "__init__", "(", "self", ",", "message", ",", "diagnostics", "=", "None", ")", ":", "super", "(", "ToolError", ",", "self", ")", ".", "__init__", "(", "message", ")", "self", ".", "diagnostics", "=", "diagnostics" ]
[ 54, 4 ]
[ 60, 38 ]
python
en
['en', 'error', 'th']
False
NormalShutdown.get_rc
(self)
Returns normal rc :return: int
Returns normal rc :return: int
def get_rc(self): """ Returns normal rc :return: int """ return 0
[ "def", "get_rc", "(", "self", ")", ":", "return", "0" ]
[ 68, 4 ]
[ 73, 16 ]
python
en
['en', 'error', 'th']
False
ManualShutdown.get_rc
(self)
Returns manual shutdown rc :return: int
Returns manual shutdown rc :return: int
def get_rc(self): """ Returns manual shutdown rc :return: int """ return 2
[ "def", "get_rc", "(", "self", ")", ":", "return", "2" ]
[ 77, 4 ]
[ 82, 16 ]
python
en
['en', 'error', 'th']
False
AutomatedShutdown.get_rc
(self)
Returns automated shutdown rc :return: int
Returns automated shutdown rc :return: int
def get_rc(self): """ Returns automated shutdown rc :return: int """ return 3
[ "def", "get_rc", "(", "self", ")", ":", "return", "3" ]
[ 86, 4 ]
[ 91, 16 ]
python
en
['en', 'error', 'th']
False
wrap_text
(text, width)
wrap_text(text : string, width : int) -> [string] Split 'text' into multiple lines of no more than 'width' characters each, and return the list of strings that results.
wrap_text(text : string, width : int) -> [string]
def wrap_text(text, width): """wrap_text(text : string, width : int) -> [string] Split 'text' into multiple lines of no more than 'width' characters each, and return the list of strings that results. """ if text is None: return [] if len(text) <= width: return [text] text =...
[ "def", "wrap_text", "(", "text", ",", "width", ")", ":", "if", "text", "is", "None", ":", "return", "[", "]", "if", "len", "(", "text", ")", "<=", "width", ":", "return", "[", "text", "]", "text", "=", "text", ".", "expandtabs", "(", ")", "text",...
[ 374, 0 ]
[ 425, 16 ]
python
en
['en', 'en', 'en']
True
translate_longopt
(opt)
Convert a long option name to a valid Python identifier by changing "-" to "_".
Convert a long option name to a valid Python identifier by changing "-" to "_".
def translate_longopt(opt): """Convert a long option name to a valid Python identifier by changing "-" to "_". """ return opt.translate(longopt_xlate)
[ "def", "translate_longopt", "(", "opt", ")", ":", "return", "opt", ".", "translate", "(", "longopt_xlate", ")" ]
[ 428, 0 ]
[ 432, 39 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.has_option
(self, long_option)
Return true if the option table for this parser has an option with long name 'long_option'.
Return true if the option table for this parser has an option with long name 'long_option'.
def has_option(self, long_option): """Return true if the option table for this parser has an option with long name 'long_option'.""" return long_option in self.option_index
[ "def", "has_option", "(", "self", ",", "long_option", ")", ":", "return", "long_option", "in", "self", ".", "option_index" ]
[ 98, 4 ]
[ 101, 47 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.get_attr_name
(self, long_option)
Translate long option name 'long_option' to the form it has as an attribute of some object: ie., translate hyphens to underscores.
Translate long option name 'long_option' to the form it has as an attribute of some object: ie., translate hyphens to underscores.
def get_attr_name(self, long_option): """Translate long option name 'long_option' to the form it has as an attribute of some object: ie., translate hyphens to underscores.""" return long_option.translate(longopt_xlate)
[ "def", "get_attr_name", "(", "self", ",", "long_option", ")", ":", "return", "long_option", ".", "translate", "(", "longopt_xlate", ")" ]
[ 103, 4 ]
[ 107, 51 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.set_aliases
(self, alias)
Set the aliases for this option parser.
Set the aliases for this option parser.
def set_aliases(self, alias): """Set the aliases for this option parser.""" self._check_alias_dict(alias, "alias") self.alias = alias
[ "def", "set_aliases", "(", "self", ",", "alias", ")", ":", "self", ".", "_check_alias_dict", "(", "alias", ",", "\"alias\"", ")", "self", ".", "alias", "=", "alias" ]
[ 119, 4 ]
[ 122, 26 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.set_negative_aliases
(self, negative_alias)
Set the negative aliases for this option parser. 'negative_alias' should be a dictionary mapping option names to option names, both the key and value must already be defined in the option table.
Set the negative aliases for this option parser. 'negative_alias' should be a dictionary mapping option names to option names, both the key and value must already be defined in the option table.
def set_negative_aliases(self, negative_alias): """Set the negative aliases for this option parser. 'negative_alias' should be a dictionary mapping option names to option names, both the key and value must already be defined in the option table.""" self._check_alias_dict(negative...
[ "def", "set_negative_aliases", "(", "self", ",", "negative_alias", ")", ":", "self", ".", "_check_alias_dict", "(", "negative_alias", ",", "\"negative alias\"", ")", "self", ".", "negative_alias", "=", "negative_alias" ]
[ 124, 4 ]
[ 130, 44 ]
python
en
['en', 'en', 'en']
True
FancyGetopt._grok_option_table
(self)
Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile.
Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile.
def _grok_option_table(self): """Populate the various data structures that keep tabs on the option table. Called by 'getopt()' before it can do anything worthwhile. """ self.long_opts = [] self.short_opts = [] self.short2long.clear() self.repeat = {} ...
[ "def", "_grok_option_table", "(", "self", ")", ":", "self", ".", "long_opts", "=", "[", "]", "self", ".", "short_opts", "=", "[", "]", "self", ".", "short2long", ".", "clear", "(", ")", "self", ".", "repeat", "=", "{", "}", "for", "option", "in", "...
[ 132, 4 ]
[ 207, 48 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.getopt
(self, args=None, object=None)
Parse command-line options in args. Store as attributes on object. If 'args' is None or not supplied, uses 'sys.argv[1:]'. If 'object' is None or not supplied, creates a new OptionDummy object, stores option values there, and returns a tuple (args, object). If 'object' is supplied, it...
Parse command-line options in args. Store as attributes on object.
def getopt(self, args=None, object=None): """Parse command-line options in args. Store as attributes on object. If 'args' is None or not supplied, uses 'sys.argv[1:]'. If 'object' is None or not supplied, creates a new OptionDummy object, stores option values there, and returns a tuple...
[ "def", "getopt", "(", "self", ",", "args", "=", "None", ",", "object", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "object", "is", "None", ":", "object", "=", "OptionDummy", ...
[ 209, 4 ]
[ 268, 23 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.get_option_order
(self)
Returns the list of (option, value) tuples processed by the previous run of 'getopt()'. Raises RuntimeError if 'getopt()' hasn't been called yet.
Returns the list of (option, value) tuples processed by the previous run of 'getopt()'. Raises RuntimeError if 'getopt()' hasn't been called yet.
def get_option_order(self): """Returns the list of (option, value) tuples processed by the previous run of 'getopt()'. Raises RuntimeError if 'getopt()' hasn't been called yet. """ if self.option_order is None: raise RuntimeError("'getopt()' hasn't been called yet") ...
[ "def", "get_option_order", "(", "self", ")", ":", "if", "self", ".", "option_order", "is", "None", ":", "raise", "RuntimeError", "(", "\"'getopt()' hasn't been called yet\"", ")", "else", ":", "return", "self", ".", "option_order" ]
[ 270, 4 ]
[ 278, 36 ]
python
en
['en', 'en', 'en']
True
FancyGetopt.generate_help
(self, header=None)
Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.
Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.
def generate_help(self, header=None): """Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object. """ # Blithely assume the option table is good: probably wouldn't call # 'generate_help()' unless you've already ca...
[ "def", "generate_help", "(", "self", ",", "header", "=", "None", ")", ":", "# Blithely assume the option table is good: probably wouldn't call", "# 'generate_help()' unless you've already called 'getopt()'.", "# First pass: determine maximum length of long option names", "max_opt", "=", ...
[ 280, 4 ]
[ 357, 20 ]
python
en
['en', 'en', 'en']
True
OptionDummy.__init__
(self, options=[])
Create a new OptionDummy instance. The attributes listed in 'options' will be initialized to None.
Create a new OptionDummy instance. The attributes listed in 'options' will be initialized to None.
def __init__(self, options=[]): """Create a new OptionDummy instance. The attributes listed in 'options' will be initialized to None.""" for opt in options: setattr(self, opt, None)
[ "def", "__init__", "(", "self", ",", "options", "=", "[", "]", ")", ":", "for", "opt", "in", "options", ":", "setattr", "(", "self", ",", "opt", ",", "None", ")" ]
[ 439, 4 ]
[ 443, 36 ]
python
en
['en', 'en', 'en']
True
lazy
(func, *resultclasses)
Turns any callable into a lazy evaluated callable. You need to give result classes or types -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access.
Turns any callable into a lazy evaluated callable. You need to give result classes or types -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access.
def lazy(func, *resultclasses): """ Turns any callable into a lazy evaluated callable. You need to give result classes or types -- at least one is needed so that the automatic forcing of the lazy evaluation code is triggered. Results are not memoized; the function is evaluated on every access. "...
[ "def", "lazy", "(", "func", ",", "*", "resultclasses", ")", ":", "@", "total_ordering", "class", "__proxy__", "(", "Promise", ")", ":", "\"\"\"\n Encapsulate a function call and act as a proxy for methods that are\n called on the result of that function. The function ...
[ 47, 0 ]
[ 176, 22 ]
python
en
['en', 'error', 'th']
False
lazystr
(text)
Shortcut for the common case of a lazy callable that returns str.
Shortcut for the common case of a lazy callable that returns str.
def lazystr(text): """ Shortcut for the common case of a lazy callable that returns str. """ from django.utils.encoding import force_text # Avoid circular import return lazy(force_text, six.text_type)(text)
[ "def", "lazystr", "(", "text", ")", ":", "from", "django", ".", "utils", ".", "encoding", "import", "force_text", "# Avoid circular import", "return", "lazy", "(", "force_text", ",", "six", ".", "text_type", ")", "(", "text", ")" ]
[ 183, 0 ]
[ 188, 48 ]
python
en
['en', 'error', 'th']
False
keep_lazy
(*resultclasses)
A decorator that allows a function to be called with one or more lazy arguments. If none of the args are lazy, the function is evaluated immediately, otherwise a __proxy__ is returned that will evaluate the function when needed.
A decorator that allows a function to be called with one or more lazy arguments. If none of the args are lazy, the function is evaluated immediately, otherwise a __proxy__ is returned that will evaluate the function when needed.
def keep_lazy(*resultclasses): """ A decorator that allows a function to be called with one or more lazy arguments. If none of the args are lazy, the function is evaluated immediately, otherwise a __proxy__ is returned that will evaluate the function when needed. """ if not resultclasses: ...
[ "def", "keep_lazy", "(", "*", "resultclasses", ")", ":", "if", "not", "resultclasses", ":", "raise", "TypeError", "(", "\"You must pass at least one argument to keep_lazy().\"", ")", "def", "decorator", "(", "func", ")", ":", "lazy_func", "=", "lazy", "(", "func",...
[ 199, 0 ]
[ 221, 20 ]
python
en
['en', 'error', 'th']
False
keep_lazy_text
(func)
A decorator for functions that accept lazy arguments and return text.
A decorator for functions that accept lazy arguments and return text.
def keep_lazy_text(func): """ A decorator for functions that accept lazy arguments and return text. """ return keep_lazy(six.text_type)(func)
[ "def", "keep_lazy_text", "(", "func", ")", ":", "return", "keep_lazy", "(", "six", ".", "text_type", ")", "(", "func", ")" ]
[ 224, 0 ]
[ 228, 41 ]
python
en
['en', 'error', 'th']
False
unpickle_lazyobject
(wrapped)
Used to unpickle lazy objects. Just return its argument, which will be the wrapped object.
Used to unpickle lazy objects. Just return its argument, which will be the wrapped object.
def unpickle_lazyobject(wrapped): """ Used to unpickle lazy objects. Just return its argument, which will be the wrapped object. """ return wrapped
[ "def", "unpickle_lazyobject", "(", "wrapped", ")", ":", "return", "wrapped" ]
[ 356, 0 ]
[ 361, 18 ]
python
en
['en', 'error', 'th']
False
partition
(predicate, values)
Splits the values into two sets, based on the return value of the function (True/False). e.g.: >>> partition(lambda x: x > 3, range(5)) [0, 1, 2, 3], [4]
Splits the values into two sets, based on the return value of the function (True/False). e.g.:
def partition(predicate, values): """ Splits the values into two sets, based on the return value of the function (True/False). e.g.: >>> partition(lambda x: x > 3, range(5)) [0, 1, 2, 3], [4] """ results = ([], []) for item in values: results[predicate(item)].append(item...
[ "def", "partition", "(", "predicate", ",", "values", ")", ":", "results", "=", "(", "[", "]", ",", "[", "]", ")", "for", "item", "in", "values", ":", "results", "[", "predicate", "(", "item", ")", "]", ".", "append", "(", "item", ")", "return", "...
[ 414, 0 ]
[ 425, 18 ]
python
en
['en', 'error', 'th']
False
LazyObject._setup
(self)
Must be implemented by subclasses to initialize the wrapped object.
Must be implemented by subclasses to initialize the wrapped object.
def _setup(self): """ Must be implemented by subclasses to initialize the wrapped object. """ raise NotImplementedError('subclasses of LazyObject must provide a _setup() method')
[ "def", "_setup", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'subclasses of LazyObject must provide a _setup() method'", ")" ]
[ 277, 4 ]
[ 281, 92 ]
python
en
['en', 'error', 'th']
False
LazyObject.__getstate__
(self)
Prevent older versions of pickle from trying to pickle the __dict__ (which in the case of a SimpleLazyObject may contain a lambda). The value will be ignored by __reduce__() and the custom unpickler.
Prevent older versions of pickle from trying to pickle the __dict__ (which in the case of a SimpleLazyObject may contain a lambda). The value will be ignored by __reduce__() and the custom unpickler.
def __getstate__(self): """ Prevent older versions of pickle from trying to pickle the __dict__ (which in the case of a SimpleLazyObject may contain a lambda). The value will be ignored by __reduce__() and the custom unpickler. """ return {}
[ "def", "__getstate__", "(", "self", ")", ":", "return", "{", "}" ]
[ 302, 4 ]
[ 308, 17 ]
python
en
['en', 'error', 'th']
False
SimpleLazyObject.__init__
(self, func)
Pass in a callable that returns the object to be wrapped. If copies are made of the resulting SimpleLazyObject, which can happen in various circumstances within Django, then you must ensure that the callable can be safely run more than once and will return the same value. ...
Pass in a callable that returns the object to be wrapped.
def __init__(self, func): """ Pass in a callable that returns the object to be wrapped. If copies are made of the resulting SimpleLazyObject, which can happen in various circumstances within Django, then you must ensure that the callable can be safely run more than once and will...
[ "def", "__init__", "(", "self", ",", "func", ")", ":", "self", ".", "__dict__", "[", "'_setupfunc'", "]", "=", "func", "super", "(", "SimpleLazyObject", ",", "self", ")", ".", "__init__", "(", ")" ]
[ 371, 4 ]
[ 381, 48 ]
python
en
['en', 'error', 'th']
False
sendfile
(request, filename, attachment=False, attachment_filename=None, mimetype=None, encoding=None, backend=None)
create a response to send file using backend configured in SENDFILE_BACKEND If attachment is True the content-disposition header will be set. This will typically prompt the user to download the file, rather than view it. The content-disposition filename depends on the value of attachment_filename...
create a response to send file using backend configured in SENDFILE_BACKEND
def sendfile(request, filename, attachment=False, attachment_filename=None, mimetype=None, encoding=None, backend=None): ''' create a response to send file using backend configured in SENDFILE_BACKEND If attachment is True the content-disposition header will be set. This will typically prompt the user ...
[ "def", "sendfile", "(", "request", ",", "filename", ",", "attachment", "=", "False", ",", "attachment_filename", "=", "None", ",", "mimetype", "=", "None", ",", "encoding", "=", "None", ",", "backend", "=", "None", ")", ":", "_sendfile", "=", "backend", ...
[ 41, 0 ]
[ 98, 19 ]
python
en
['en', 'error', 'th']
False
CPointerBase.__del__
(self)
Free the memory used by the C++ object.
Free the memory used by the C++ object.
def __del__(self): """ Free the memory used by the C++ object. """ if self.destructor and self._ptr: try: self.destructor(self.ptr) except (AttributeError, TypeError): pass
[ "def", "__del__", "(", "self", ")", ":", "if", "self", ".", "destructor", "and", "self", ".", "_ptr", ":", "try", ":", "self", ".", "destructor", "(", "self", ".", "ptr", ")", "except", "(", "AttributeError", ",", "TypeError", ")", ":", "pass" ]
[ 29, 4 ]
[ 37, 20 ]
python
en
['en', 'error', 'th']
False
MySQLOperations.get_geom_placeholder
(self, f, value, compiler)
The placeholder here has to include MySQL's WKT constructor. Because MySQL does not support spatial transformations, there is no need to modify the placeholder based on the contents of the given value.
The placeholder here has to include MySQL's WKT constructor. Because MySQL does not support spatial transformations, there is no need to modify the placeholder based on the contents of the given value.
def get_geom_placeholder(self, f, value, compiler): """ The placeholder here has to include MySQL's WKT constructor. Because MySQL does not support spatial transformations, there is no need to modify the placeholder based on the contents of the given value. """ if hasatt...
[ "def", "get_geom_placeholder", "(", "self", ",", "f", ",", "value", ",", "compiler", ")", ":", "if", "hasattr", "(", "value", ",", "'as_sql'", ")", ":", "placeholder", ",", "_", "=", "compiler", ".", "compile", "(", "value", ")", "else", ":", "placehol...
[ 86, 4 ]
[ 96, 26 ]
python
en
['en', 'error', 'th']
False
formset_factory
(form, formset=BaseFormSet, extra=1, can_order=False, can_delete=False, max_num=None, validate_max=False, min_num=None, validate_min=False)
Return a FormSet for the given form class.
Return a FormSet for the given form class.
def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, can_delete=False, max_num=None, validate_max=False, min_num=None, validate_min=False): """Return a FormSet for the given form class.""" if min_num is None: min_num = DEFAULT_MIN_NUM if ma...
[ "def", "formset_factory", "(", "form", ",", "formset", "=", "BaseFormSet", ",", "extra", "=", "1", ",", "can_order", "=", "False", ",", "can_delete", "=", "False", ",", "max_num", "=", "None", ",", "validate_max", "=", "False", ",", "min_num", "=", "None...
[ 435, 0 ]
[ 452, 66 ]
python
en
['en', 'en', 'en']
True
all_valid
(formsets)
Returns true if every formset in formsets is valid.
Returns true if every formset in formsets is valid.
def all_valid(formsets): """Returns true if every formset in formsets is valid.""" valid = True for formset in formsets: if not formset.is_valid(): valid = False return valid
[ "def", "all_valid", "(", "formsets", ")", ":", "valid", "=", "True", "for", "formset", "in", "formsets", ":", "if", "not", "formset", ".", "is_valid", "(", ")", ":", "valid", "=", "False", "return", "valid" ]
[ 455, 0 ]
[ 461, 16 ]
python
en
['en', 'en', 'en']
True
get_nulldetections
(image_id, expiration=10)
Returns the runningcatalog sources which: * Are associated with the skyregion of the current image. * Do not have a counterpart in the extractedsources of the current image after source association has run. * Have been seen (in any band) at a timestamp earlier than that of the cu...
Returns the runningcatalog sources which:
def get_nulldetections(image_id, expiration=10): """ Returns the runningcatalog sources which: * Are associated with the skyregion of the current image. * Do not have a counterpart in the extractedsources of the current image after source association has run. * Have been seen (in any ...
[ "def", "get_nulldetections", "(", "image_id", ",", "expiration", "=", "10", ")", ":", "# The first temptable t0 looks for runcat sources that have been seen", "# in the same sky region as the current image,", "# but at an earlier timestamp, irrespective of the band.", "# The second temptab...
[ 15, 0 ]
[ 80, 14 ]
python
en
['en', 'error', 'th']
False
associate_nd
(image_id)
Associate the null detections (ie forced fits) of the current image. They will be inserted in a temporary table, which contains the associations of the forced fits with the running catalog sources. Also, the forced fits are appended to the assocxtrsource (light-curve) table. The runcat_flux table ...
Associate the null detections (ie forced fits) of the current image.
def associate_nd(image_id): """ Associate the null detections (ie forced fits) of the current image. They will be inserted in a temporary table, which contains the associations of the forced fits with the running catalog sources. Also, the forced fits are appended to the assocxtrsource (light-curve...
[ "def", "associate_nd", "(", "image_id", ")", ":", "_del_tempruncat", "(", ")", "_insert_tempruncat", "(", "image_id", ")", "_insert_1_to_1_assoc", "(", ")", "_increment_forcedfits_count", "(", ")", "n_updated", "=", "_update_1_to_1_runcat_flux", "(", ")", "if", "n_u...
[ 83, 0 ]
[ 108, 21 ]
python
en
['en', 'error', 'th']
False
_increment_forcedfits_count
()
Increment the forcedfits count for every runningcatalog entry in the temprunningcatalog table.
Increment the forcedfits count for every runningcatalog entry in the temprunningcatalog table.
def _increment_forcedfits_count(): """ Increment the forcedfits count for every runningcatalog entry in the temprunningcatalog table. """ query = """\ UPDATE runningcatalog SET forcedfits_count = forcedfits_count + 1 WHERE id IN ( SELECT t.runcat FROM temprunningcatal...
[ "def", "_increment_forcedfits_count", "(", ")", ":", "query", "=", "\"\"\"\\\nUPDATE\n runningcatalog\nSET\n forcedfits_count = forcedfits_count + 1\nWHERE id IN (\n SELECT\n t.runcat\n FROM\n temprunningcatalog t,\n runningcatalog r\n WHERE\n t.runcat = r.id...
[ 111, 0 ]
[ 131, 18 ]
python
en
['en', 'error', 'th']
False
_insert_tempruncat
(image_id)
Here the associations of forced fits and their runningcatalog counterparts are inserted into the temporary table. We follow the analogies of the normal association procedure. The difference here is that we know what the runcat ids are for the extractedsource.extract_type = 1 (ff_nd) sources are, s...
Here the associations of forced fits and their runningcatalog counterparts are inserted into the temporary table.
def _insert_tempruncat(image_id): """ Here the associations of forced fits and their runningcatalog counterparts are inserted into the temporary table. We follow the analogies of the normal association procedure. The difference here is that we know what the runcat ids are for the extractedsourc...
[ "def", "_insert_tempruncat", "(", "image_id", ")", ":", "query", "=", "\"\"\"\\\nINSERT INTO temprunningcatalog\n (runcat\n ,xtrsrc\n ,distance_arcsec\n ,r\n ,dataset\n ,band\n ,stokes\n ,datapoints\n ,zone\n ,wm_ra\n ,wm_decl\n ,wm_uncertainty_ew\n ,wm_uncertainty_ns\n ,avg_ra_err\n ...
[ 134, 0 ]
[ 314, 67 ]
python
en
['en', 'error', 'th']
False
_insert_1_to_1_assoc
()
The null detection forced fits are appended to the assocxtrsource (light-curve) table as a type = 7 datapoint. Subtable t1 has to take care of the cases where values and differences might get too small to cause divisions by zero.
The null detection forced fits are appended to the assocxtrsource (light-curve) table as a type = 7 datapoint. Subtable t1 has to take care of the cases where values and differences might get too small to cause divisions by zero.
def _insert_1_to_1_assoc(): """ The null detection forced fits are appended to the assocxtrsource (light-curve) table as a type = 7 datapoint. Subtable t1 has to take care of the cases where values and differences might get too small to cause divisions by zero. """ cursor = execute(ONE_TO_O...
[ "def", "_insert_1_to_1_assoc", "(", ")", ":", "cursor", "=", "execute", "(", "ONE_TO_ONE_ASSOC_QUERY", ",", "{", "'type'", ":", "7", "}", ",", "commit", "=", "True", ")", "cnt", "=", "cursor", ".", "rowcount", "logger", ".", "debug", "(", "\"Inserted %s 1-...
[ 317, 0 ]
[ 327, 78 ]
python
en
['en', 'error', 'th']
False
get_child_assertion
(element)
Returns first failed assertion, or None :rtype lxml.etree.Element
Returns first failed assertion, or None
def get_child_assertion(element): """ Returns first failed assertion, or None :rtype lxml.etree.Element """ for child in element.iterchildren(): msg, name = parse_assertion(child) if msg: return msg, name return "", None
[ "def", "get_child_assertion", "(", "element", ")", ":", "for", "child", "in", "element", ".", "iterchildren", "(", ")", ":", "msg", ",", "name", "=", "parse_assertion", "(", "child", ")", "if", "msg", ":", "return", "msg", ",", "name", "return", "\"\"", ...
[ 49, 0 ]
[ 60, 19 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.get_load
(self)
Helper method to read load specification
Helper method to read load specification
def get_load(self): """ Helper method to read load specification """ load = self.get_specific_load() throughput = load.throughput concurrency = load.concurrency iterations = load.iterations steps = load.steps hold = load.hold ramp_up = loa...
[ "def", "get_load", "(", "self", ")", ":", "load", "=", "self", ".", "get_specific_load", "(", ")", "throughput", "=", "load", ".", "throughput", "concurrency", "=", "load", ".", "concurrency", "iterations", "=", "load", ".", "iterations", "steps", "=", "lo...
[ 111, 4 ]
[ 153, 83 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.get_specific_load
(self)
Helper method to read load specification
Helper method to read load specification
def get_specific_load(self): """ Helper method to read load specification """ # throughput, concurrency, iterations, steps, hold, ramp_up raw_load = self.get_raw_load() hold = try_convert(raw_load.hold or 0, dehumanize_time) ramp_up = try_convert(raw_load.ramp_u...
[ "def", "get_specific_load", "(", "self", ")", ":", "# throughput, concurrency, iterations, steps, hold, ramp_up", "raw_load", "=", "self", ".", "get_raw_load", "(", ")", "hold", "=", "try_convert", "(", "raw_load", ".", "hold", "or", "0", ",", "dehumanize_time", ")"...
[ 155, 4 ]
[ 187, 83 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.prepare
(self)
Preparation for JMeter involves either getting existing JMX and modifying it, or generating new JMX from input data. Then, original JMX is modified to contain JTL writing classes with required settings and have workload as suggested by Provisioning :raise TaurusConfigError: ...
Preparation for JMeter involves either getting existing JMX and modifying it, or generating new JMX from input data. Then, original JMX is modified to contain JTL writing classes with required settings and have workload as suggested by Provisioning
def prepare(self): """ Preparation for JMeter involves either getting existing JMX and modifying it, or generating new JMX from input data. Then, original JMX is modified to contain JTL writing classes with required settings and have workload as suggested by Provisioning ...
[ "def", "prepare", "(", "self", ")", ":", "super", "(", "JMeterExecutor", ",", "self", ")", ".", "prepare", "(", ")", "self", ".", "jmeter_log", "=", "self", ".", "engine", ".", "create_artifact", "(", "\"jmeter\"", ",", "\".log\"", ")", "self", ".", "_...
[ 202, 4 ]
[ 265, 61 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.startup
(self)
Should start JMeter as fast as possible.
Should start JMeter as fast as possible.
def startup(self): """ Should start JMeter as fast as possible. """ cmdline = [self.tool.tool_path, "-t", self.modified_jmx, "-j", self.jmeter_log, "-q", self.properties_file] if not self.settings.get("gui", False): cmdline += ["-n"] if self.distributed_serve...
[ "def", "startup", "(", "self", ")", ":", "cmdline", "=", "[", "self", ".", "tool", ".", "tool_path", ",", "\"-t\"", ",", "self", ".", "modified_jmx", ",", "\"-j\"", ",", "self", ".", "jmeter_log", ",", "\"-q\"", ",", "self", ".", "properties_file", "]"...
[ 312, 4 ]
[ 339, 45 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.check
(self)
Checks if JMeter is still running. Also checks if resulting JTL contains any data and throws exception otherwise. :return: bool :raise ToolError:
Checks if JMeter is still running. Also checks if resulting JTL contains any data and throws exception otherwise.
def check(self): """ Checks if JMeter is still running. Also checks if resulting JTL contains any data and throws exception otherwise. :return: bool :raise ToolError: """ self.retcode = self.process.poll() if self.retcode is not None: if self....
[ "def", "check", "(", "self", ")", ":", "self", ".", "retcode", "=", "self", ".", "process", ".", "poll", "(", ")", "if", "self", ".", "retcode", "is", "not", "None", ":", "if", "self", ".", "retcode", "!=", "0", ":", "raise", "ToolError", "(", "\...
[ 341, 4 ]
[ 355, 20 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.shutdown
(self)
If JMeter is still running - let's stop it.
If JMeter is still running - let's stop it.
def shutdown(self): """ If JMeter is still running - let's stop it. """ distr_multiplier = len(self.execution.get('distributed', [None])) # 1 for regular, N of servers for distributed max_attempts = self.settings.get("shutdown-wait", 5) * distr_multiplier if self._proce...
[ "def", "shutdown", "(", "self", ")", ":", "distr_multiplier", "=", "len", "(", "self", ".", "execution", ".", "get", "(", "'distributed'", ",", "[", "None", "]", ")", ")", "# 1 for regular, N of servers for distributed", "max_attempts", "=", "self", ".", "sett...
[ 357, 4 ]
[ 389, 91 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor._set_remote_port
(self)
set management udp port :return:
set management udp port :return:
def _set_remote_port(self): """ set management udp port :return: """ if not JMeterExecutor.UDP_PORT_NUMBER: JMeterExecutor.UDP_PORT_NUMBER = self.settings.get("shutdown-port", 4445) else: JMeterExecutor.UDP_PORT_NUMBER += 1 while not self...
[ "def", "_set_remote_port", "(", "self", ")", ":", "if", "not", "JMeterExecutor", ".", "UDP_PORT_NUMBER", ":", "JMeterExecutor", ".", "UDP_PORT_NUMBER", "=", "self", ".", "settings", ".", "get", "(", "\"shutdown-port\"", ",", "4445", ")", "else", ":", "JMeterEx...
[ 409, 4 ]
[ 428, 76 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__port_is_free
(self, port_num)
:return: Bool
:return: Bool
def __port_is_free(self, port_num): """ :return: Bool """ udp_sock = socket.socket(type=socket.SOCK_DGRAM) try: self.log.debug("Checking if port %d is free", port_num) udp_sock.bind(("localhost", port_num)) udp_sock.close() self.log...
[ "def", "__port_is_free", "(", "self", ",", "port_num", ")", ":", "udp_sock", "=", "socket", ".", "socket", "(", "type", "=", "socket", ".", "SOCK_DGRAM", ")", "try", ":", "self", ".", "log", ".", "debug", "(", "\"Checking if port %d is free\"", ",", "port_...
[ 430, 4 ]
[ 443, 24 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__disable_listeners
(jmx)
Set ResultCollector to disabled :param jmx: JMX :return:
Set ResultCollector to disabled :param jmx: JMX :return:
def __disable_listeners(jmx): """ Set ResultCollector to disabled :param jmx: JMX :return: """ sel = 'stringProp[name=filename]' xpath = GenericTranslator().css_to_xpath(sel) listeners = jmx.get('ResultCollector') for listener in listeners: ...
[ "def", "__disable_listeners", "(", "jmx", ")", ":", "sel", "=", "'stringProp[name=filename]'", "xpath", "=", "GenericTranslator", "(", ")", ".", "css_to_xpath", "(", "sel", ")", "listeners", "=", "jmx", ".", "get", "(", "'ResultCollector'", ")", "for", "listen...
[ 446, 4 ]
[ 459, 48 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__get_modified_jmx
(self, original, is_jmx_generated)
add two listeners to test plan: - to collect basic stats for KPIs - to collect detailed errors/trace info :return: path to artifact
add two listeners to test plan: - to collect basic stats for KPIs - to collect detailed errors/trace info :return: path to artifact
def __get_modified_jmx(self, original, is_jmx_generated): """ add two listeners to test plan: - to collect basic stats for KPIs - to collect detailed errors/trace info :return: path to artifact """ jmx = JMX(original) if self.get_scenario().get("d...
[ "def", "__get_modified_jmx", "(", "self", ",", "original", ",", "is_jmx_generated", ")", ":", "jmx", "=", "JMX", "(", "original", ")", "if", "self", ".", "get_scenario", "(", ")", ".", "get", "(", "\"disable-listeners\"", ",", "not", "self", ".", "settings...
[ 531, 4 ]
[ 565, 18 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__jmx_from_requests
(self)
Generate jmx file from requests :return:
Generate jmx file from requests :return:
def __jmx_from_requests(self): """ Generate jmx file from requests :return: """ filename = self.engine.create_artifact("requests", ".jmx") jmx = JMeterScenarioBuilder(self) jmx.save(filename) self.settings.merge(jmx.system_props) return filename
[ "def", "__jmx_from_requests", "(", "self", ")", ":", "filename", "=", "self", ".", "engine", ".", "create_artifact", "(", "\"requests\"", ",", "\".jmx\"", ")", "jmx", "=", "JMeterScenarioBuilder", "(", "self", ")", "jmx", ".", "save", "(", "filename", ")", ...
[ 590, 4 ]
[ 599, 23 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__write_props_to_file
(file_path, params)
Write properties to file :param file_path: :param params: :return:
Write properties to file :param file_path: :param params: :return:
def __write_props_to_file(file_path, params): """ Write properties to file :param file_path: :param params: :return: """ with open(file_path, 'w') as fds: for key, val in iteritems(params): fds.write("%s=%s\n" % (key, val))
[ "def", "__write_props_to_file", "(", "file_path", ",", "params", ")", ":", "with", "open", "(", "file_path", ",", "'w'", ")", "as", "fds", ":", "for", "key", ",", "val", "in", "iteritems", "(", "params", ")", ":", "fds", ".", "write", "(", "\"%s=%s\\n\...
[ 602, 4 ]
[ 611, 49 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.get_widget
(self)
Add progress widget to console screen sidebar :return:
Add progress widget to console screen sidebar
def get_widget(self): """ Add progress widget to console screen sidebar :return: """ if not self.widget: label = "%s" % self self.widget = ExecutorWidget(self, "JMeter: " + label.split('/')[1]) return self.widget
[ "def", "get_widget", "(", "self", ")", ":", "if", "not", "self", ".", "widget", ":", "label", "=", "\"%s\"", "%", "self", "self", ".", "widget", "=", "ExecutorWidget", "(", "self", ",", "\"JMeter: \"", "+", "label", ".", "split", "(", "'/'", ")", "["...
[ 613, 4 ]
[ 622, 26 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__modify_resources_paths_in_jmx
(self, jmx, file_list)
Modify resource files paths in jmx etree :param jmx: JMX :param file_list: list :return:
Modify resource files paths in jmx etree
def __modify_resources_paths_in_jmx(self, jmx, file_list): """ Modify resource files paths in jmx etree :param jmx: JMX :param file_list: list :return: """ file_set = set(file_list) missed_files = [] while file_set: filename = file_set...
[ "def", "__modify_resources_paths_in_jmx", "(", "self", ",", "jmx", ",", "file_list", ")", ":", "file_set", "=", "set", "(", "file_list", ")", "missed_files", "=", "[", "]", "while", "file_set", ":", "filename", "=", "file_set", ".", "pop", "(", ")", "file_...
[ 624, 4 ]
[ 645, 72 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor._resolve_jmx_relpaths
(self, resource_files_from_jmx)
Attempt to paths relative to JMX script itself. :param resource_files_from_jmx: :return:
Attempt to paths relative to JMX script itself.
def _resolve_jmx_relpaths(self, resource_files_from_jmx): """ Attempt to paths relative to JMX script itself. :param resource_files_from_jmx: :return: """ resource_files = [] script_basedir = os.path.dirname(get_full_path(self.original_jmx)) for res_file ...
[ "def", "_resolve_jmx_relpaths", "(", "self", ",", "resource_files_from_jmx", ")", ":", "resource_files", "=", "[", "]", "script_basedir", "=", "os", ".", "path", ".", "dirname", "(", "get_full_path", "(", "self", ".", "original_jmx", ")", ")", "for", "res_file...
[ 647, 4 ]
[ 664, 29 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.resource_files
(self)
Get list of resource files, modify jmx file paths if necessary
Get list of resource files, modify jmx file paths if necessary
def resource_files(self): """ Get list of resource files, modify jmx file paths if necessary """ # get all resource files from requests scenario = self.get_scenario() resource_files = self.res_files_from_scenario(scenario) self.original_jmx = self.get_script_path...
[ "def", "resource_files", "(", "self", ")", ":", "# get all resource files from requests", "scenario", "=", "self", ".", "get_scenario", "(", ")", "resource_files", "=", "self", ".", "res_files_from_scenario", "(", "scenario", ")", "self", ".", "original_jmx", "=", ...
[ 666, 4 ]
[ 691, 29 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__get_resource_files_from_jmx
(jmx)
Get list of resource files paths from jmx scenario :return: (file list)
Get list of resource files paths from jmx scenario :return: (file list)
def __get_resource_files_from_jmx(jmx): """ Get list of resource files paths from jmx scenario :return: (file list) """ resource_files = [] exclude_elements = ['kg.apc.jmeter.jmxmon.JMXMonCollector', 'JSR223Listener', 'kg.apc.jmeter.vizualizers...
[ "def", "__get_resource_files_from_jmx", "(", "jmx", ")", ":", "resource_files", "=", "[", "]", "exclude_elements", "=", "[", "'kg.apc.jmeter.jmxmon.JMXMonCollector'", ",", "'JSR223Listener'", ",", "'kg.apc.jmeter.vizualizers.CorrectedResultCollector'", ",", "'kg.apc.jmeter.repo...
[ 694, 4 ]
[ 722, 29 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.__apply_modifications
(self, jmx)
:type jmx: JMX
:type jmx: JMX
def __apply_modifications(self, jmx): """ :type jmx: JMX """ modifs = self.get_scenario().get("modifications") if 'disable' in modifs: self.__apply_enable_disable(modifs, 'disable', jmx) if 'enable' in modifs: self.__apply_enable_disable(modifs, ...
[ "def", "__apply_modifications", "(", "self", ",", "jmx", ")", ":", "modifs", "=", "self", ".", "get_scenario", "(", ")", ".", "get", "(", "\"modifications\"", ")", "if", "'disable'", "in", "modifs", ":", "self", ".", "__apply_enable_disable", "(", "modifs", ...
[ 739, 4 ]
[ 767, 86 ]
python
en
['en', 'error', 'th']
False
JMeterExecutor.install_required_tools
(self)
check tools
check tools
def install_required_tools(self): """ check tools """ self.tool = self._get_tool(JMeter, config=self.settings, props=self.properties) required_tools = [self._get_tool(JavaVM), self._get_tool(TclLibrary), self.tool] for tool in required_tools: if not tool.chec...
[ "def", "install_required_tools", "(", "self", ")", ":", "self", ".", "tool", "=", "self", ".", "_get_tool", "(", "JMeter", ",", "config", "=", "self", ".", "settings", ",", "props", "=", "self", ".", "properties", ")", "required_tools", "=", "[", "self",...
[ 781, 4 ]
[ 792, 51 ]
python
en
['en', 'error', 'th']
False
JTLReader._read
(self, last_pass=False)
Generator method that returns next portion of data :type last_pass: bool
Generator method that returns next portion of data
def _read(self, last_pass=False): """ Generator method that returns next portion of data :type last_pass: bool """ if self.errors_reader: self.errors_reader.read_file(last_pass) for row in self.csvreader.read(last_pass): label = unicode_decode(ro...
[ "def", "_read", "(", "self", ",", "last_pass", "=", "False", ")", ":", "if", "self", ".", "errors_reader", ":", "self", ".", "errors_reader", ".", "read_file", "(", "last_pass", ")", "for", "row", "in", "self", ".", "csvreader", ".", "read", "(", "last...
[ 841, 4 ]
[ 879, 85 ]
python
en
['en', 'error', 'th']
False
FuncJTLReader.read
(self, last_pass=True)
Read the next part of the file
Read the next part of the file
def read(self, last_pass=True): """ Read the next part of the file """ if self.failed_processing: return self.__read_next_chunk(last_pass) for _, elem in self.parser.read_events(): if elem.getparent() is not None and elem.getparent().tag == 'test...
[ "def", "read", "(", "self", ",", "last_pass", "=", "True", ")", ":", "if", "self", ".", "failed_processing", ":", "return", "self", ".", "__read_next_chunk", "(", "last_pass", ")", "for", "_", ",", "elem", "in", "self", ".", "parser", ".", "read_events",...
[ 922, 4 ]
[ 940, 28 ]
python
en
['en', 'error', 'th']
False
FuncJTLReader.get_failure
(self, element)
Returns failure message and a stack trace
Returns failure message and a stack trace
def get_failure(self, element): """ Returns failure message and a stack trace """ r_code = element.get('rc') if r_code and r_code.startswith("2") and element.get('s') == "false": children = [elem for elem in element.iterchildren() if elem.tag == "httpSample"] ...
[ "def", "get_failure", "(", "self", ",", "element", ")", ":", "r_code", "=", "element", ".", "get", "(", "'rc'", ")", "if", "r_code", "and", "r_code", ".", "startswith", "(", "\"2\"", ")", "and", "element", ".", "get", "(", "'s'", ")", "==", "\"false\...
[ 1074, 4 ]
[ 1092, 33 ]
python
en
['en', 'error', 'th']
False
FuncJTLReader.__get_failed_assertion
(element)
Returns first failed assertion, or None :rtype lxml.etree.Element
Returns first failed assertion, or None :rtype lxml.etree.Element
def __get_failed_assertion(element): """ Returns first failed assertion, or None :rtype lxml.etree.Element """ assertions = [elem for elem in element.iterchildren() if elem.tag == "assertionResult"] for assertion in assertions: failed = assertion.find("failure...
[ "def", "__get_failed_assertion", "(", "element", ")", ":", "assertions", "=", "[", "elem", "for", "elem", "in", "element", ".", "iterchildren", "(", ")", "if", "elem", ".", "tag", "==", "\"assertionResult\"", "]", "for", "assertion", "in", "assertions", ":",...
[ 1095, 4 ]
[ 1106, 19 ]
python
en
['en', 'error', 'th']
False
IncrementalCSVReader.read
(self, last_pass=False)
read data from jtl yield csv row :type last_pass: bool
read data from jtl yield csv row :type last_pass: bool
def read(self, last_pass=False): """ read data from jtl yield csv row :type last_pass: bool """ lines = self.file.get_lines(size=self.read_speed, last_pass=last_pass) lines_read = 0 bytes_read = 0 for line in lines: if not line.endswi...
[ "def", "read", "(", "self", ",", "last_pass", "=", "False", ")", ":", "lines", "=", "self", ".", "file", ".", "get_lines", "(", "size", "=", "self", ".", "read_speed", ",", "last_pass", "=", "last_pass", ")", "lines_read", "=", "0", "bytes_read", "=", ...
[ 1123, 4 ]
[ 1163, 35 ]
python
en
['en', 'error', 'th']
False
JTLErrorsReader.read_file
(self, final_pass=False)
Read the next part of the file
Read the next part of the file
def read_file(self, final_pass=False): """ Read the next part of the file """ start_size = os.path.getsize(self.file.name) if self.file.is_ready() else 0 while not self.failed_processing: # we need to feed bytes, not a unicode string, into the parser read ...
[ "def", "read_file", "(", "self", ",", "final_pass", "=", "False", ")", ":", "start_size", "=", "os", ".", "path", ".", "getsize", "(", "self", ".", "file", ".", "name", ")", "if", "self", ".", "file", ".", "is_ready", "(", ")", "else", "0", "while"...
[ 1191, 4 ]
[ 1223, 21 ]
python
en
['en', 'error', 'th']
False
JTLErrorsReader.get_data
(self, max_ts)
Get accumulated errors data up to specified timestamp
Get accumulated errors data up to specified timestamp
def get_data(self, max_ts): """ Get accumulated errors data up to specified timestamp """ result = BetterDict() for t_stamp in sorted(self.buffer.keys()): if t_stamp >= max_ts + 1: break labels = self.buffer.pop(t_stamp) for lab...
[ "def", "get_data", "(", "self", ",", "max_ts", ")", ":", "result", "=", "BetterDict", "(", ")", "for", "t_stamp", "in", "sorted", "(", "self", ".", "buffer", ".", "keys", "(", ")", ")", ":", "if", "t_stamp", ">=", "max_ts", "+", "1", ":", "break", ...
[ 1236, 4 ]
[ 1252, 21 ]
python
en
['en', 'error', 'th']
False
JTLErrorsReader.find_failure
(self, element, def_msg="", def_rc=None)
returns (message, url, rc, tag, err_type)
returns (message, url, rc, tag, err_type)
def find_failure(self, element, def_msg="", def_rc=None): """ returns (message, url, rc, tag, err_type) """ rc = element.get("rc", default="") e_msg = "" url = None err_type = KPISet.ERRTYPE_ERROR a_msg, name = get_child_assertion(element) if not rc.startswith(...
[ "def", "find_failure", "(", "self", ",", "element", ",", "def_msg", "=", "\"\"", ",", "def_rc", "=", "None", ")", ":", "rc", "=", "element", ".", "get", "(", "\"rc\"", ",", "default", "=", "\"\"", ")", "e_msg", "=", "\"\"", "url", "=", "None", "err...
[ 1287, 4 ]
[ 1324, 53 ]
python
da
['da', 'en', 'hi']
False
JMeter.ctg_plugin_installed
(self)
Simple check if ConcurrentThreadGroup is available :return:
Simple check if ConcurrentThreadGroup is available :return:
def ctg_plugin_installed(self): """ Simple check if ConcurrentThreadGroup is available :return: """ ext_dir = os.path.join(get_full_path(self.tool_path, step_up=2), 'lib', 'ext') if os.path.isdir(ext_dir): list_of_jars = [file_name for file_name in os.listdir(...
[ "def", "ctg_plugin_installed", "(", "self", ")", ":", "ext_dir", "=", "os", ".", "path", ".", "join", "(", "get_full_path", "(", "self", ".", "tool_path", ",", "step_up", "=", "2", ")", ",", "'lib'", ",", "'ext'", ")", "if", "os", ".", "path", ".", ...
[ 1551, 4 ]
[ 1562, 20 ]
python
en
['en', 'error', 'th']
False
JarCleaner.clean
(self, path)
Remove old jars :param path: str
Remove old jars :param path: str
def clean(self, path): """ Remove old jars :param path: str """ self.log.debug("Removing old jars from %s", path) jarlib = namedtuple("jarlib", ("file_name", "lib_name", "version")) jars = [fname for fname in os.listdir(path) if '-' in fname and os.path.isfile(os....
[ "def", "clean", "(", "self", ",", "path", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Removing old jars from %s\"", ",", "path", ")", "jarlib", "=", "namedtuple", "(", "\"jarlib\"", ",", "(", "\"file_name\"", ",", "\"lib_name\"", ",", "\"version\"", ...
[ 1574, 4 ]
[ 1597, 67 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.create_more_puzzle_hashes
(self, from_zero: bool = False)
For all wallets in the user store, generates the first few puzzle hashes so that we can restore the wallet from only the private keys.
For all wallets in the user store, generates the first few puzzle hashes so that we can restore the wallet from only the private keys.
async def create_more_puzzle_hashes(self, from_zero: bool = False): """ For all wallets in the user store, generates the first few puzzle hashes so that we can restore the wallet from only the private keys. """ targets = list(self.wallets.keys()) unused: Optional[uint32]...
[ "async", "def", "create_more_puzzle_hashes", "(", "self", ",", "from_zero", ":", "bool", "=", "False", ")", ":", "targets", "=", "list", "(", "self", ".", "wallets", ".", "keys", "(", ")", ")", "unused", ":", "Optional", "[", "uint32", "]", "=", "await...
[ 242, 4 ]
[ 323, 70 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_unused_derivation_record
(self, wallet_id: uint32)
Creates a puzzle hash for the given wallet, and then makes more puzzle hashes for every wallet to ensure we always have more in the database. Never reusue the same public key more than once (for privacy).
Creates a puzzle hash for the given wallet, and then makes more puzzle hashes for every wallet to ensure we always have more in the database. Never reusue the same public key more than once (for privacy).
async def get_unused_derivation_record(self, wallet_id: uint32) -> DerivationRecord: """ Creates a puzzle hash for the given wallet, and then makes more puzzle hashes for every wallet to ensure we always have more in the database. Never reusue the same public key more than once (for priv...
[ "async", "def", "get_unused_derivation_record", "(", "self", ",", "wallet_id", ":", "uint32", ")", "->", "DerivationRecord", ":", "async", "with", "self", ".", "puzzle_store", ".", "lock", ":", "# If we have no unused public keys, we will create new ones", "unused", ":"...
[ 352, 4 ]
[ 375, 25 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.set_callback
(self, callback: Callable)
Callback to be called when the state of the wallet changes.
Callback to be called when the state of the wallet changes.
def set_callback(self, callback: Callable): """ Callback to be called when the state of the wallet changes. """ self.state_changed_callback = callback
[ "def", "set_callback", "(", "self", ",", "callback", ":", "Callable", ")", ":", "self", ".", "state_changed_callback", "=", "callback" ]
[ 385, 4 ]
[ 389, 46 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.set_pending_callback
(self, callback: Callable)
Callback to be called when new pending transaction enters the store
Callback to be called when new pending transaction enters the store
def set_pending_callback(self, callback: Callable): """ Callback to be called when new pending transaction enters the store """ self.pending_tx_callback = callback
[ "def", "set_pending_callback", "(", "self", ",", "callback", ":", "Callable", ")", ":", "self", ".", "pending_tx_callback", "=", "callback" ]
[ 391, 4 ]
[ 395, 43 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.set_coin_with_puzzlehash_created_callback
(self, puzzlehash, callback: Callable)
Callback to be called when new coin is seen with specified puzzlehash
Callback to be called when new coin is seen with specified puzzlehash
def set_coin_with_puzzlehash_created_callback(self, puzzlehash, callback: Callable): """ Callback to be called when new coin is seen with specified puzzlehash """ self.puzzle_hash_created_callbacks[puzzlehash] = callback
[ "def", "set_coin_with_puzzlehash_created_callback", "(", "self", ",", "puzzlehash", ",", "callback", ":", "Callable", ")", ":", "self", ".", "puzzle_hash_created_callbacks", "[", "puzzlehash", "]", "=", "callback" ]
[ 397, 4 ]
[ 401, 65 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.state_changed
(self, state: str, wallet_id: int = None, data_object=None)
Calls the callback if it's present.
Calls the callback if it's present.
def state_changed(self, state: str, wallet_id: int = None, data_object=None): """ Calls the callback if it's present. """ if data_object is None: data_object = {} if self.state_changed_callback is None: return None self.state_changed_callback(state...
[ "def", "state_changed", "(", "self", ",", "state", ":", "str", ",", "wallet_id", ":", "int", "=", "None", ",", "data_object", "=", "None", ")", ":", "if", "data_object", "is", "None", ":", "data_object", "=", "{", "}", "if", "self", ".", "state_changed...
[ 409, 4 ]
[ 417, 66 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.tx_pending_changed
(self)
Notifies the wallet node that there's new tx pending
Notifies the wallet node that there's new tx pending
def tx_pending_changed(self) -> None: """ Notifies the wallet node that there's new tx pending """ if self.pending_tx_callback is None: return None self.pending_tx_callback()
[ "def", "tx_pending_changed", "(", "self", ")", "->", "None", ":", "if", "self", ".", "pending_tx_callback", "is", "None", ":", "return", "None", "self", ".", "pending_tx_callback", "(", ")" ]
[ 419, 4 ]
[ 426, 34 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.set_sync_mode
(self, mode: bool)
Sets the sync mode. This changes the behavior of the wallet node.
Sets the sync mode. This changes the behavior of the wallet node.
def set_sync_mode(self, mode: bool): """ Sets the sync mode. This changes the behavior of the wallet node. """ self.sync_mode = mode self.state_changed("sync_changed")
[ "def", "set_sync_mode", "(", "self", ",", "mode", ":", "bool", ")", ":", "self", ".", "sync_mode", "=", "mode", "self", ".", "state_changed", "(", "\"sync_changed\"", ")" ]
[ 444, 4 ]
[ 449, 42 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_confirmed_spendable_balance_for_wallet
(self, wallet_id: int, unspent_records=None)
Returns the balance amount of all coins that are spendable.
Returns the balance amount of all coins that are spendable.
async def get_confirmed_spendable_balance_for_wallet(self, wallet_id: int, unspent_records=None) -> uint128: """ Returns the balance amount of all coins that are spendable. """ spendable: Set[WalletCoinRecord] = await self.get_spendable_coins_for_wallet(wallet_id, unspent_records) ...
[ "async", "def", "get_confirmed_spendable_balance_for_wallet", "(", "self", ",", "wallet_id", ":", "int", ",", "unspent_records", "=", "None", ")", "->", "uint128", ":", "spendable", ":", "Set", "[", "WalletCoinRecord", "]", "=", "await", "self", ".", "get_spenda...
[ 451, 4 ]
[ 462, 31 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.does_coin_belong_to_wallet
(self, coin: Coin, wallet_id: int)
Returns true if we have the key for this coin.
Returns true if we have the key for this coin.
async def does_coin_belong_to_wallet(self, coin: Coin, wallet_id: int) -> bool: """ Returns true if we have the key for this coin. """ info = await self.puzzle_store.wallet_info_for_puzzle_hash(coin.puzzle_hash) if info is None: return False coin_wallet_id, ...
[ "async", "def", "does_coin_belong_to_wallet", "(", "self", ",", "coin", ":", "Coin", ",", "wallet_id", ":", "int", ")", "->", "bool", ":", "info", "=", "await", "self", ".", "puzzle_store", ".", "wallet_info_for_puzzle_hash", "(", "coin", ".", "puzzle_hash", ...
[ 464, 4 ]
[ 477, 20 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_confirmed_balance_for_wallet
( self, wallet_id: int, unspent_coin_records: Optional[Set[WalletCoinRecord]] = None )
Returns the confirmed balance, including coinbase rewards that are not spendable.
Returns the confirmed balance, including coinbase rewards that are not spendable.
async def get_confirmed_balance_for_wallet( self, wallet_id: int, unspent_coin_records: Optional[Set[WalletCoinRecord]] = None ) -> uint128: """ Returns the confirmed balance, including coinbase rewards that are not spendable. """ # lock only if unspent_coin_records is None ...
[ "async", "def", "get_confirmed_balance_for_wallet", "(", "self", ",", "wallet_id", ":", "int", ",", "unspent_coin_records", ":", "Optional", "[", "Set", "[", "WalletCoinRecord", "]", "]", "=", "None", ")", "->", "uint128", ":", "# lock only if unspent_coin_records i...
[ 479, 4 ]
[ 494, 30 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_unconfirmed_balance
( self, wallet_id, unspent_coin_records: Optional[Set[WalletCoinRecord]] = None )
Returns the balance, including coinbase rewards that are not spendable, and unconfirmed transactions.
Returns the balance, including coinbase rewards that are not spendable, and unconfirmed transactions.
async def get_unconfirmed_balance( self, wallet_id, unspent_coin_records: Optional[Set[WalletCoinRecord]] = None ) -> uint128: """ Returns the balance, including coinbase rewards that are not spendable, and unconfirmed transactions. """ confirmed = await self.get_conf...
[ "async", "def", "get_unconfirmed_balance", "(", "self", ",", "wallet_id", ",", "unspent_coin_records", ":", "Optional", "[", "Set", "[", "WalletCoinRecord", "]", "]", "=", "None", ")", "->", "uint128", ":", "confirmed", "=", "await", "self", ".", "get_confirme...
[ 496, 4 ]
[ 517, 30 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.unconfirmed_additions_for_wallet
(self, wallet_id: int)
Returns change coins for the wallet_id. (Unconfirmed addition transactions that have not been confirmed yet.)
Returns change coins for the wallet_id. (Unconfirmed addition transactions that have not been confirmed yet.)
async def unconfirmed_additions_for_wallet(self, wallet_id: int) -> Dict[bytes32, Coin]: """ Returns change coins for the wallet_id. (Unconfirmed addition transactions that have not been confirmed yet.) """ additions: Dict[bytes32, Coin] = {} unconfirmed_tx = await self.t...
[ "async", "def", "unconfirmed_additions_for_wallet", "(", "self", ",", "wallet_id", ":", "int", ")", "->", "Dict", "[", "bytes32", ",", "Coin", "]", ":", "additions", ":", "Dict", "[", "bytes32", ",", "Coin", "]", "=", "{", "}", "unconfirmed_tx", "=", "aw...
[ 519, 4 ]
[ 530, 24 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.unconfirmed_removals_for_wallet
(self, wallet_id: int)
Returns new removals transactions that have not been confirmed yet.
Returns new removals transactions that have not been confirmed yet.
async def unconfirmed_removals_for_wallet(self, wallet_id: int) -> Dict[bytes32, Coin]: """ Returns new removals transactions that have not been confirmed yet. """ removals: Dict[bytes32, Coin] = {} unconfirmed_tx = await self.tx_store.get_unconfirmed_for_wallet(wallet_id) ...
[ "async", "def", "unconfirmed_removals_for_wallet", "(", "self", ",", "wallet_id", ":", "int", ")", "->", "Dict", "[", "bytes32", ",", "Coin", "]", ":", "removals", ":", "Dict", "[", "bytes32", ",", "Coin", "]", "=", "{", "}", "unconfirmed_tx", "=", "awai...
[ 532, 4 ]
[ 541, 23 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.coin_added
( self, coin: Coin, coinbase: bool, fee_reward: bool, wallet_id: uint32, wallet_type: WalletType, height: uint32, all_outgoing_transaction_records: List[TransactionRecord], )
Adding coin to DB
Adding coin to DB
async def coin_added( self, coin: Coin, coinbase: bool, fee_reward: bool, wallet_id: uint32, wallet_type: WalletType, height: uint32, all_outgoing_transaction_records: List[TransactionRecord], ) -> WalletCoinRecord: """ Adding coin to D...
[ "async", "def", "coin_added", "(", "self", ",", "coin", ":", "Coin", ",", "coinbase", ":", "bool", ",", "fee_reward", ":", "bool", ",", "wallet_id", ":", "uint32", ",", "wallet_type", ":", "WalletType", ",", "height", ":", "uint32", ",", "all_outgoing_tran...
[ 674, 4 ]
[ 761, 26 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.add_pending_transaction
(self, tx_record: TransactionRecord)
Called from wallet before new transaction is sent to the full_node
Called from wallet before new transaction is sent to the full_node
async def add_pending_transaction(self, tx_record: TransactionRecord): """ Called from wallet before new transaction is sent to the full_node """ if self.peak is None or int(time.time()) <= self.constants.INITIAL_FREEZE_END_TIMESTAMP: raise ValueError("Initial Freeze Period")...
[ "async", "def", "add_pending_transaction", "(", "self", ",", "tx_record", ":", "TransactionRecord", ")", ":", "if", "self", ".", "peak", "is", "None", "or", "int", "(", "time", ".", "time", "(", ")", ")", "<=", "self", ".", "constants", ".", "INITIAL_FRE...
[ 763, 4 ]
[ 772, 70 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.add_transaction
(self, tx_record: TransactionRecord)
Called from wallet to add transaction that is not being set to full_node
Called from wallet to add transaction that is not being set to full_node
async def add_transaction(self, tx_record: TransactionRecord): """ Called from wallet to add transaction that is not being set to full_node """ await self.tx_store.add_transaction_record(tx_record, False) self.state_changed("pending_transaction", tx_record.wallet_id)
[ "async", "def", "add_transaction", "(", "self", ",", "tx_record", ":", "TransactionRecord", ")", ":", "await", "self", ".", "tx_store", ".", "add_transaction_record", "(", "tx_record", ",", "False", ")", "self", ".", "state_changed", "(", "\"pending_transaction\""...
[ 774, 4 ]
[ 779, 70 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.remove_from_queue
( self, spendbundle_id: bytes32, name: str, send_status: MempoolInclusionStatus, error: Optional[Err], )
Full node received our transaction, no need to keep it in queue anymore
Full node received our transaction, no need to keep it in queue anymore
async def remove_from_queue( self, spendbundle_id: bytes32, name: str, send_status: MempoolInclusionStatus, error: Optional[Err], ): """ Full node received our transaction, no need to keep it in queue anymore """ updated = await self.tx_store.i...
[ "async", "def", "remove_from_queue", "(", "self", ",", "spendbundle_id", ":", "bytes32", ",", "name", ":", "str", ",", "send_status", ":", "MempoolInclusionStatus", ",", "error", ":", "Optional", "[", "Err", "]", ",", ")", ":", "updated", "=", "await", "se...
[ 781, 4 ]
[ 795, 82 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_send_queue
(self)
Wallet Node uses this to retry sending transactions
Wallet Node uses this to retry sending transactions
async def get_send_queue(self) -> List[TransactionRecord]: """ Wallet Node uses this to retry sending transactions """ records = await self.tx_store.get_not_sent() return records
[ "async", "def", "get_send_queue", "(", "self", ")", "->", "List", "[", "TransactionRecord", "]", ":", "records", "=", "await", "self", ".", "tx_store", ".", "get_not_sent", "(", ")", "return", "records" ]
[ 797, 4 ]
[ 802, 22 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_all_transactions
(self, wallet_id: int)
Retrieves all confirmed and pending transactions
Retrieves all confirmed and pending transactions
async def get_all_transactions(self, wallet_id: int) -> List[TransactionRecord]: """ Retrieves all confirmed and pending transactions """ records = await self.tx_store.get_all_transactions_for_wallet(wallet_id) return records
[ "async", "def", "get_all_transactions", "(", "self", ",", "wallet_id", ":", "int", ")", "->", "List", "[", "TransactionRecord", "]", ":", "records", "=", "await", "self", ".", "tx_store", ".", "get_all_transactions_for_wallet", "(", "wallet_id", ")", "return", ...
[ 804, 4 ]
[ 809, 22 ]
python
en
['en', 'error', 'th']
False
WalletStateManager.get_filter_additions_removals
( self, new_block: HeaderBlock, transactions_filter: bytes, fork_point_with_peak: Optional[uint32] )
Returns a list of our coin ids, and a list of puzzle_hashes that positively match with provided filter.
Returns a list of our coin ids, and a list of puzzle_hashes that positively match with provided filter.
async def get_filter_additions_removals( self, new_block: HeaderBlock, transactions_filter: bytes, fork_point_with_peak: Optional[uint32] ) -> Tuple[List[bytes32], List[bytes32]]: """Returns a list of our coin ids, and a list of puzzle_hashes that positively match with provided filter.""" # ...
[ "async", "def", "get_filter_additions_removals", "(", "self", ",", "new_block", ":", "HeaderBlock", ",", "transactions_filter", ":", "bytes", ",", "fork_point_with_peak", ":", "Optional", "[", "uint32", "]", ")", "->", "Tuple", "[", "List", "[", "bytes32", "]", ...
[ 814, 4 ]
[ 893, 58 ]
python
en
['en', 'en', 'en']
True
WalletStateManager.get_relevant_additions
(self, additions: List[Coin])
Returns the list of coins that are relevant to us.(We can spend them)
Returns the list of coins that are relevant to us.(We can spend them)
async def get_relevant_additions(self, additions: List[Coin]) -> List[Coin]: """Returns the list of coins that are relevant to us.(We can spend them)""" result: List[Coin] = [] my_puzzle_hashes: Set[bytes32] = self.puzzle_store.all_puzzle_hashes for coin in additions: if co...
[ "async", "def", "get_relevant_additions", "(", "self", ",", "additions", ":", "List", "[", "Coin", "]", ")", "->", "List", "[", "Coin", "]", ":", "result", ":", "List", "[", "Coin", "]", "=", "[", "]", "my_puzzle_hashes", ":", "Set", "[", "bytes32", ...
[ 895, 4 ]
[ 905, 21 ]
python
en
['en', 'en', 'en']
True