repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
Erotemic/utool
utool/util_cplat.py
print_system_users
def print_system_users(): r""" prints users on the system On unix looks for /bin/bash users in /etc/passwd CommandLine: python -m utool.util_cplat --test-print_system_users Example: >>> # DISABLE_DOCTEST >>> # SCRIPT >>> from utool.util_cplat import * # NOQA ...
python
def print_system_users(): r""" prints users on the system On unix looks for /bin/bash users in /etc/passwd CommandLine: python -m utool.util_cplat --test-print_system_users Example: >>> # DISABLE_DOCTEST >>> # SCRIPT >>> from utool.util_cplat import * # NOQA ...
[ "def", "print_system_users", "(", ")", ":", "import", "utool", "as", "ut", "text", "=", "ut", ".", "read_from", "(", "'/etc/passwd'", ")", "userinfo_text_list", "=", "text", ".", "splitlines", "(", ")", "userinfo_list", "=", "[", "uitext", ".", "split", "(...
r""" prints users on the system On unix looks for /bin/bash users in /etc/passwd CommandLine: python -m utool.util_cplat --test-print_system_users Example: >>> # DISABLE_DOCTEST >>> # SCRIPT >>> from utool.util_cplat import * # NOQA >>> result = print_system_...
[ "r" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cplat.py#L1403-L1426
train
r Prints the system users on the system On unix looks for bash users in / etc. passwd and print them on the system
Erotemic/utool
utool/util_cplat.py
check_installed_debian
def check_installed_debian(pkgname): """ References: http://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/ """ import utool as ut #pkgname = 'espeak' #pkgname = 'sudo' #ut.cmd('hash ' + pkgname + ' 2>/dev/null') tup = ut.cmd('hash ' + pkgname + ' 2>/dev/null', q...
python
def check_installed_debian(pkgname): """ References: http://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/ """ import utool as ut #pkgname = 'espeak' #pkgname = 'sudo' #ut.cmd('hash ' + pkgname + ' 2>/dev/null') tup = ut.cmd('hash ' + pkgname + ' 2>/dev/null', q...
[ "def", "check_installed_debian", "(", "pkgname", ")", ":", "import", "utool", "as", "ut", "#pkgname = 'espeak'", "#pkgname = 'sudo'", "#ut.cmd('hash ' + pkgname + ' 2>/dev/null')", "tup", "=", "ut", ".", "cmd", "(", "'hash '", "+", "pkgname", "+", "' 2>/dev/null'", ",...
References: http://www.cyberciti.biz/faq/find-out-if-package-is-installed-in-linux/
[ "References", ":", "http", ":", "//", "www", ".", "cyberciti", ".", "biz", "/", "faq", "/", "find", "-", "out", "-", "if", "-", "package", "-", "is", "-", "installed", "-", "in", "-", "linux", "/" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cplat.py#L1429-L1441
train
Check if a given package is installed in Debian
Erotemic/utool
utool/util_cplat.py
unload_module
def unload_module(modname): """ WARNING POTENTIALLY DANGEROUS AND MAY NOT WORK References: http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module CommandLine: python -m utool.util_cplat --test-unload_module Example: >>> # DISABLE_DOCTEST >...
python
def unload_module(modname): """ WARNING POTENTIALLY DANGEROUS AND MAY NOT WORK References: http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module CommandLine: python -m utool.util_cplat --test-unload_module Example: >>> # DISABLE_DOCTEST >...
[ "def", "unload_module", "(", "modname", ")", ":", "import", "sys", "import", "gc", "if", "modname", "in", "sys", ".", "modules", ":", "referrer_list", "=", "gc", ".", "get_referrers", "(", "sys", ".", "modules", "[", "modname", "]", ")", "#module = sys.mod...
WARNING POTENTIALLY DANGEROUS AND MAY NOT WORK References: http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module CommandLine: python -m utool.util_cplat --test-unload_module Example: >>> # DISABLE_DOCTEST >>> import sys, gc # NOQA >>> im...
[ "WARNING", "POTENTIALLY", "DANGEROUS", "AND", "MAY", "NOT", "WORK" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cplat.py#L1450-L1486
train
Unloads a module and all its children.
glormph/msstitch
src/app/actions/shared/pepprot_isoquant.py
base_add_isoquant_data
def base_add_isoquant_data(features, quantfeatures, acc_col, quantacc_col, quantfields): """Generic function that takes a peptide or protein table and adds quant data from ANOTHER such table.""" quant_map = get_quantmap(quantfeatures, quantacc_col, quantfields) for feature in ...
python
def base_add_isoquant_data(features, quantfeatures, acc_col, quantacc_col, quantfields): """Generic function that takes a peptide or protein table and adds quant data from ANOTHER such table.""" quant_map = get_quantmap(quantfeatures, quantacc_col, quantfields) for feature in ...
[ "def", "base_add_isoquant_data", "(", "features", ",", "quantfeatures", ",", "acc_col", ",", "quantacc_col", ",", "quantfields", ")", ":", "quant_map", "=", "get_quantmap", "(", "quantfeatures", ",", "quantacc_col", ",", "quantfields", ")", "for", "feature", "in",...
Generic function that takes a peptide or protein table and adds quant data from ANOTHER such table.
[ "Generic", "function", "that", "takes", "a", "peptide", "or", "protein", "table", "and", "adds", "quant", "data", "from", "ANOTHER", "such", "table", "." ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/shared/pepprot_isoquant.py#L4-L16
train
Generic function that takes a peptide or protein table and adds the quant data from ANOTHER such table.
glormph/msstitch
src/app/actions/shared/pepprot_isoquant.py
get_quantmap
def get_quantmap(features, acc_col, quantfields): """Runs through proteins that are in a quanted protein table, extracts and maps their information based on the quantfields list input. Map is a dict with protein_accessions as keys.""" qmap = {} for feature in features: feat_acc = feature.pop...
python
def get_quantmap(features, acc_col, quantfields): """Runs through proteins that are in a quanted protein table, extracts and maps their information based on the quantfields list input. Map is a dict with protein_accessions as keys.""" qmap = {} for feature in features: feat_acc = feature.pop...
[ "def", "get_quantmap", "(", "features", ",", "acc_col", ",", "quantfields", ")", ":", "qmap", "=", "{", "}", "for", "feature", "in", "features", ":", "feat_acc", "=", "feature", ".", "pop", "(", "acc_col", ")", "qmap", "[", "feat_acc", "]", "=", "{", ...
Runs through proteins that are in a quanted protein table, extracts and maps their information based on the quantfields list input. Map is a dict with protein_accessions as keys.
[ "Runs", "through", "proteins", "that", "are", "in", "a", "quanted", "protein", "table", "extracts", "and", "maps", "their", "information", "based", "on", "the", "quantfields", "list", "input", ".", "Map", "is", "a", "dict", "with", "protein_accessions", "as", ...
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/shared/pepprot_isoquant.py#L19-L27
train
Extracts the information based on the quantfields list input.
Erotemic/utool
utool/util_gridsearch.py
parse_argv_cfg
def parse_argv_cfg(argname, default=[''], named_defaults_dict=None, valid_keys=None, alias_keys=None): """ simple configs Args: argname (str): default (list): (default = []) named_defaults_dict (dict): (default = None) valid_keys (None): (default = None) ...
python
def parse_argv_cfg(argname, default=[''], named_defaults_dict=None, valid_keys=None, alias_keys=None): """ simple configs Args: argname (str): default (list): (default = []) named_defaults_dict (dict): (default = None) valid_keys (None): (default = None) ...
[ "def", "parse_argv_cfg", "(", "argname", ",", "default", "=", "[", "''", "]", ",", "named_defaults_dict", "=", "None", ",", "valid_keys", "=", "None", ",", "alias_keys", "=", "None", ")", ":", "import", "utool", "as", "ut", "if", "ut", ".", "in_jupyter_n...
simple configs Args: argname (str): default (list): (default = []) named_defaults_dict (dict): (default = None) valid_keys (None): (default = None) Returns: list: cfg_list CommandLine: python -m utool.util_gridsearch --exec-parse_argv_cfg --filt :foo=bar ...
[ "simple", "configs" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L87-L128
train
Parse the argv - cfg list
Erotemic/utool
utool/util_gridsearch.py
get_varied_cfg_lbls
def get_varied_cfg_lbls(cfg_list, default_cfg=None, mainkey='_cfgname', checkname=False): r""" Args: cfg_list (list): default_cfg (None): (default = None) checkname (bool): if True removes names if they are all the same. Returns: list: cfglbl_list ...
python
def get_varied_cfg_lbls(cfg_list, default_cfg=None, mainkey='_cfgname', checkname=False): r""" Args: cfg_list (list): default_cfg (None): (default = None) checkname (bool): if True removes names if they are all the same. Returns: list: cfglbl_list ...
[ "def", "get_varied_cfg_lbls", "(", "cfg_list", ",", "default_cfg", "=", "None", ",", "mainkey", "=", "'_cfgname'", ",", "checkname", "=", "False", ")", ":", "import", "utool", "as", "ut", "try", ":", "cfgname_list", "=", "[", "cfg", "[", "mainkey", "]", ...
r""" Args: cfg_list (list): default_cfg (None): (default = None) checkname (bool): if True removes names if they are all the same. Returns: list: cfglbl_list CommandLine: python -m utool.util_gridsearch --exec-get_varied_cfg_lbls Example: >>> # ENABLE_D...
[ "r", "Args", ":", "cfg_list", "(", "list", ")", ":", "default_cfg", "(", "None", ")", ":", "(", "default", "=", "None", ")", "checkname", "(", "bool", ")", ":", "if", "True", "removes", "names", "if", "they", "are", "all", "the", "same", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L131-L170
train
r Returns a list of varied cfg names
Erotemic/utool
utool/util_gridsearch.py
get_nonvaried_cfg_lbls
def get_nonvaried_cfg_lbls(cfg_list, default_cfg=None, mainkey='_cfgname'): r""" TODO: this might only need to return a single value. Maybe not if the names are different. Args: cfg_list (list): default_cfg (None): (default = None) Returns: list: cfglbl_list Comman...
python
def get_nonvaried_cfg_lbls(cfg_list, default_cfg=None, mainkey='_cfgname'): r""" TODO: this might only need to return a single value. Maybe not if the names are different. Args: cfg_list (list): default_cfg (None): (default = None) Returns: list: cfglbl_list Comman...
[ "def", "get_nonvaried_cfg_lbls", "(", "cfg_list", ",", "default_cfg", "=", "None", ",", "mainkey", "=", "'_cfgname'", ")", ":", "try", ":", "cfgname_list", "=", "[", "cfg", "[", "mainkey", "]", "for", "cfg", "in", "cfg_list", "]", "except", "KeyError", ":"...
r""" TODO: this might only need to return a single value. Maybe not if the names are different. Args: cfg_list (list): default_cfg (None): (default = None) Returns: list: cfglbl_list CommandLine: python -m utool.util_gridsearch --exec-get_nonvaried_cfg_lbls ...
[ "r", "TODO", ":", "this", "might", "only", "need", "to", "return", "a", "single", "value", ".", "Maybe", "not", "if", "the", "names", "are", "different", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L173-L207
train
r Returns a list of non - variied cfg names
Erotemic/utool
utool/util_gridsearch.py
partition_varied_cfg_list
def partition_varied_cfg_list(cfg_list, default_cfg=None, recursive=False): r""" Separates varied from non-varied parameters in a list of configs TODO: partition nested configs CommandLine: python -m utool.util_gridsearch --exec-partition_varied_cfg_list:0 Example: >>> # ENABLE_DO...
python
def partition_varied_cfg_list(cfg_list, default_cfg=None, recursive=False): r""" Separates varied from non-varied parameters in a list of configs TODO: partition nested configs CommandLine: python -m utool.util_gridsearch --exec-partition_varied_cfg_list:0 Example: >>> # ENABLE_DO...
[ "def", "partition_varied_cfg_list", "(", "cfg_list", ",", "default_cfg", "=", "None", ",", "recursive", "=", "False", ")", ":", "import", "utool", "as", "ut", "if", "default_cfg", "is", "None", ":", "nonvaried_cfg", "=", "reduce", "(", "ut", ".", "dict_inter...
r""" Separates varied from non-varied parameters in a list of configs TODO: partition nested configs CommandLine: python -m utool.util_gridsearch --exec-partition_varied_cfg_list:0 Example: >>> # ENABLE_DOCTEST >>> from utool.util_gridsearch import * # NOQA >>> import...
[ "r", "Separates", "varied", "from", "non", "-", "varied", "parameters", "in", "a", "list", "of", "configs" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L210-L264
train
r Separates varied from non - varied parameters in a list of configs
Erotemic/utool
utool/util_gridsearch.py
get_cfg_lbl
def get_cfg_lbl(cfg, name=None, nonlbl_keys=INTERNAL_CFGKEYS, key_order=None, with_name=True, default_cfg=None, sep=''): r""" Formats a flat configuration dict into a short string label. This is useful for re-creating command line strings. Args: cfg (dict): name (str): (...
python
def get_cfg_lbl(cfg, name=None, nonlbl_keys=INTERNAL_CFGKEYS, key_order=None, with_name=True, default_cfg=None, sep=''): r""" Formats a flat configuration dict into a short string label. This is useful for re-creating command line strings. Args: cfg (dict): name (str): (...
[ "def", "get_cfg_lbl", "(", "cfg", ",", "name", "=", "None", ",", "nonlbl_keys", "=", "INTERNAL_CFGKEYS", ",", "key_order", "=", "None", ",", "with_name", "=", "True", ",", "default_cfg", "=", "None", ",", "sep", "=", "''", ")", ":", "import", "utool", ...
r""" Formats a flat configuration dict into a short string label. This is useful for re-creating command line strings. Args: cfg (dict): name (str): (default = None) nonlbl_keys (list): (default = INTERNAL_CFGKEYS) Returns: str: cfg_lbl CommandLine: python ...
[ "r", "Formats", "a", "flat", "configuration", "dict", "into", "a", "short", "string", "label", ".", "This", "is", "useful", "for", "re", "-", "creating", "command", "line", "strings", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L267-L356
train
r Returns a short string label for a flat configuration dict
Erotemic/utool
utool/util_gridsearch.py
parse_nestings2
def parse_nestings2(string, nesters=['()', '[]', '<>', "''", '""'], escape='\\'): r""" References: http://stackoverflow.com/questions/4801403/pyparsing-nested-mutiple-opener-clo Example: >>> # DISABLE_DOCTEST >>> from utool.util_gridsearch import * # NOQA >>> import utool a...
python
def parse_nestings2(string, nesters=['()', '[]', '<>', "''", '""'], escape='\\'): r""" References: http://stackoverflow.com/questions/4801403/pyparsing-nested-mutiple-opener-clo Example: >>> # DISABLE_DOCTEST >>> from utool.util_gridsearch import * # NOQA >>> import utool a...
[ "def", "parse_nestings2", "(", "string", ",", "nesters", "=", "[", "'()'", ",", "'[]'", ",", "'<>'", ",", "\"''\"", ",", "'\"\"'", "]", ",", "escape", "=", "'\\\\'", ")", ":", "import", "utool", "as", "ut", "# NOQA", "import", "pyparsing", "as", "pp", ...
r""" References: http://stackoverflow.com/questions/4801403/pyparsing-nested-mutiple-opener-clo Example: >>> # DISABLE_DOCTEST >>> from utool.util_gridsearch import * # NOQA >>> import utool as ut >>> string = r'lambda u: sign(u) * abs(u)**3.0 * greater(u, 0)' >...
[ "r", "References", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "4801403", "/", "pyparsing", "-", "nested", "-", "mutiple", "-", "opener", "-", "clo" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L426-L552
train
r Parse a string of nested mutiple opener nesters into a single nested mutiple opener nesters.
Erotemic/utool
utool/util_gridsearch.py
parse_cfgstr3
def parse_cfgstr3(string, debug=None): r""" http://stackoverflow.com/questions/4801403/how-can-i-use-pyparsing-to-parse-nested-expressions-that-have-mutiple-opener-clo Ignore: >>> from utool.util_gridsearch import * # NOQA cfgopt_strs = 'f=2,c=[(1,2),(3,4)],d=1,j=[[1,2],[3,4]],foobar,x="[f...
python
def parse_cfgstr3(string, debug=None): r""" http://stackoverflow.com/questions/4801403/how-can-i-use-pyparsing-to-parse-nested-expressions-that-have-mutiple-opener-clo Ignore: >>> from utool.util_gridsearch import * # NOQA cfgopt_strs = 'f=2,c=[(1,2),(3,4)],d=1,j=[[1,2],[3,4]],foobar,x="[f...
[ "def", "parse_cfgstr3", "(", "string", ",", "debug", "=", "None", ")", ":", "import", "utool", "as", "ut", "# NOQA", "import", "pyparsing", "as", "pp", "if", "debug", "is", "None", ":", "debug_", "=", "ut", ".", "VERBOSE", "else", ":", "debug_", "=", ...
r""" http://stackoverflow.com/questions/4801403/how-can-i-use-pyparsing-to-parse-nested-expressions-that-have-mutiple-opener-clo Ignore: >>> from utool.util_gridsearch import * # NOQA cfgopt_strs = 'f=2,c=[(1,2),(3,4)],d=1,j=[[1,2],[3,4]],foobar,x="[fdsfds",y="]fdsfds",e=[[1,2],[3,4]],[]' ...
[ "r", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "4801403", "/", "how", "-", "can", "-", "i", "-", "use", "-", "pyparsing", "-", "to", "-", "parse", "-", "nested", "-", "expressions", "-", "that", "-", "have", "-", "mutip...
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L691-L866
train
r Parses a CF - GSTR string and returns a dictionary of the nested structure that is represented by the nested structure.
Erotemic/utool
utool/util_gridsearch.py
noexpand_parse_cfgstrs
def noexpand_parse_cfgstrs(cfgopt_strs, alias_keys=None): r""" alias_keys = None cfgopt_strs = 'f=2,c=[(1,2),(3,4)],d=1' string = cfgopt_strs cfgopt_strs = 'f=2,c=[1,2,3,4]' CommandLine: python -m utool.util_gridsearch noexpand_parse_cfgstrs Example: >>> # ENABLE_DOCTEST ...
python
def noexpand_parse_cfgstrs(cfgopt_strs, alias_keys=None): r""" alias_keys = None cfgopt_strs = 'f=2,c=[(1,2),(3,4)],d=1' string = cfgopt_strs cfgopt_strs = 'f=2,c=[1,2,3,4]' CommandLine: python -m utool.util_gridsearch noexpand_parse_cfgstrs Example: >>> # ENABLE_DOCTEST ...
[ "def", "noexpand_parse_cfgstrs", "(", "cfgopt_strs", ",", "alias_keys", "=", "None", ")", ":", "import", "re", "import", "utool", "as", "ut", "# Parse dict out of a string", "#ANYTHING_NOT_BRACE = r'[^\\[\\]]*\\]'", "#NOT_PAREN_OR_BRACE = r'[^()\\[\\]]*'", "if", "True", ":"...
r""" alias_keys = None cfgopt_strs = 'f=2,c=[(1,2),(3,4)],d=1' string = cfgopt_strs cfgopt_strs = 'f=2,c=[1,2,3,4]' CommandLine: python -m utool.util_gridsearch noexpand_parse_cfgstrs Example: >>> # ENABLE_DOCTEST >>> from utool.util_gridsearch import * # NOQA ...
[ "r", "alias_keys", "=", "None", "cfgopt_strs", "=", "f", "=", "2", "c", "=", "[", "(", "1", "2", ")", "(", "3", "4", ")", "]", "d", "=", "1", "string", "=", "cfgopt_strs" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L869-L915
train
r No expands a string of cfgstr - style options into a dict
Erotemic/utool
utool/util_gridsearch.py
customize_base_cfg
def customize_base_cfg(cfgname, cfgopt_strs, base_cfg, cfgtype, alias_keys=None, valid_keys=None, offset=0, strict=True): """ Args: cfgname (str): config name cfgopt_strs (str): mini-language defining key variations base_cfg (dict): specifies...
python
def customize_base_cfg(cfgname, cfgopt_strs, base_cfg, cfgtype, alias_keys=None, valid_keys=None, offset=0, strict=True): """ Args: cfgname (str): config name cfgopt_strs (str): mini-language defining key variations base_cfg (dict): specifies...
[ "def", "customize_base_cfg", "(", "cfgname", ",", "cfgopt_strs", ",", "base_cfg", ",", "cfgtype", ",", "alias_keys", "=", "None", ",", "valid_keys", "=", "None", ",", "offset", "=", "0", ",", "strict", "=", "True", ")", ":", "import", "utool", "as", "ut"...
Args: cfgname (str): config name cfgopt_strs (str): mini-language defining key variations base_cfg (dict): specifies the default cfg to customize cfgtype (?): alias_keys (None): (default = None) valid_keys (None): if base_cfg is not specied, this defines the valid ...
[ "Args", ":", "cfgname", "(", "str", ")", ":", "config", "name", "cfgopt_strs", "(", "str", ")", ":", "mini", "-", "language", "defining", "key", "variations", "base_cfg", "(", "dict", ")", ":", "specifies", "the", "default", "cfg", "to", "customize", "cf...
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L921-L997
train
This function is used to customize the base config for a key variation.
Erotemic/utool
utool/util_gridsearch.py
parse_cfgstr_name_options
def parse_cfgstr_name_options(cfgstr): r""" Args: cfgstr (str): Returns: tuple: (cfgname, cfgopt_strs, subx) CommandLine: python -m utool.util_gridsearch --test-parse_cfgstr_name_options Example: >>> # ENABLE_DOCTEST >>> from utool.util_gridsearch import * ...
python
def parse_cfgstr_name_options(cfgstr): r""" Args: cfgstr (str): Returns: tuple: (cfgname, cfgopt_strs, subx) CommandLine: python -m utool.util_gridsearch --test-parse_cfgstr_name_options Example: >>> # ENABLE_DOCTEST >>> from utool.util_gridsearch import * ...
[ "def", "parse_cfgstr_name_options", "(", "cfgstr", ")", ":", "import", "utool", "as", "ut", "cfgname_regex", "=", "ut", ".", "named_field", "(", "'cfgname'", ",", "r'[^\\[:]*'", ")", "# name is optional", "subx_regex", "=", "r'\\['", "+", "ut", ".", "named_field...
r""" Args: cfgstr (str): Returns: tuple: (cfgname, cfgopt_strs, subx) CommandLine: python -m utool.util_gridsearch --test-parse_cfgstr_name_options Example: >>> # ENABLE_DOCTEST >>> from utool.util_gridsearch import * # NOQA >>> import utool as ut ...
[ "r", "Args", ":", "cfgstr", "(", "str", ")", ":" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1000-L1057
train
r Parses the name options of a node in a tree.
Erotemic/utool
utool/util_gridsearch.py
parse_cfgstr_list2
def parse_cfgstr_list2(cfgstr_list, named_defaults_dict=None, cfgtype=None, alias_keys=None, valid_keys=None, expand_nested=True, strict=True, special_join_dict=None, is_nestedcfgtype=False, metadata=None): r""" Parses config strings. By looki...
python
def parse_cfgstr_list2(cfgstr_list, named_defaults_dict=None, cfgtype=None, alias_keys=None, valid_keys=None, expand_nested=True, strict=True, special_join_dict=None, is_nestedcfgtype=False, metadata=None): r""" Parses config strings. By looki...
[ "def", "parse_cfgstr_list2", "(", "cfgstr_list", ",", "named_defaults_dict", "=", "None", ",", "cfgtype", "=", "None", ",", "alias_keys", "=", "None", ",", "valid_keys", "=", "None", ",", "expand_nested", "=", "True", ",", "strict", "=", "True", ",", "specia...
r""" Parses config strings. By looking up name in a dict of configs Args: cfgstr_list (list): named_defaults_dict (dict): (default = None) cfgtype (None): (default = None) alias_keys (None): (default = None) valid_keys (None): (default = None) expand_nested (bool...
[ "r", "Parses", "config", "strings", ".", "By", "looking", "up", "name", "in", "a", "dict", "of", "configs" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1078-L1294
train
r Parses a list of config strings and returns a dict of config names and config types
Erotemic/utool
utool/util_gridsearch.py
grid_search_generator
def grid_search_generator(grid_basis=[], *args, **kwargs): r""" Iteratively yeilds individual configuration points inside a defined basis. Args: grid_basis (list): a list of 2-component tuple. The named tuple looks like this: CommandLine: python -m utool.util_gridsearch...
python
def grid_search_generator(grid_basis=[], *args, **kwargs): r""" Iteratively yeilds individual configuration points inside a defined basis. Args: grid_basis (list): a list of 2-component tuple. The named tuple looks like this: CommandLine: python -m utool.util_gridsearch...
[ "def", "grid_search_generator", "(", "grid_basis", "=", "[", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "grid_basis_", "=", "grid_basis", "+", "list", "(", "args", ")", "+", "list", "(", "kwargs", ".", "items", "(", ")", ")", "grid_bas...
r""" Iteratively yeilds individual configuration points inside a defined basis. Args: grid_basis (list): a list of 2-component tuple. The named tuple looks like this: CommandLine: python -m utool.util_gridsearch --test-grid_search_generator Example: >>> # ENABL...
[ "r", "Iteratively", "yeilds", "individual", "configuration", "points", "inside", "a", "defined", "basis", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1837-L1882
train
r This function will iterate over individual configuration points in a defined basis set and print out the results.
Erotemic/utool
utool/util_gridsearch.py
make_constrained_cfg_and_lbl_list
def make_constrained_cfg_and_lbl_list(varied_dict, constraint_func=None, slice_dict=None, defaultslice=slice(0, 1)): r""" Args: varied_dict (dict): parameters to vary with possible variations constraint_func (func): fun...
python
def make_constrained_cfg_and_lbl_list(varied_dict, constraint_func=None, slice_dict=None, defaultslice=slice(0, 1)): r""" Args: varied_dict (dict): parameters to vary with possible variations constraint_func (func): fun...
[ "def", "make_constrained_cfg_and_lbl_list", "(", "varied_dict", ",", "constraint_func", "=", "None", ",", "slice_dict", "=", "None", ",", "defaultslice", "=", "slice", "(", "0", ",", "1", ")", ")", ":", "# Restrict via slices", "if", "slice_dict", "is", "None", ...
r""" Args: varied_dict (dict): parameters to vary with possible variations constraint_func (func): function to restirct parameter variations slice_dict (dict): dict of slices for each param of valid possible values defaultslice (slice): default slice used if slice is not specified ...
[ "r", "Args", ":", "varied_dict", "(", "dict", ")", ":", "parameters", "to", "vary", "with", "possible", "variations", "constraint_func", "(", "func", ")", ":", "function", "to", "restirct", "parameter", "variations", "slice_dict", "(", "dict", ")", ":", "dic...
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1885-L1934
train
r This function returns a list of cfgdict_list and cfglbl_list for the current node.
Erotemic/utool
utool/util_gridsearch.py
get_cfgdict_list_subset
def get_cfgdict_list_subset(cfgdict_list, keys): r""" returns list of unique dictionaries only with keys specified in keys Args: cfgdict_list (list): keys (list): Returns: list: cfglbl_list CommandLine: python -m utool.util_gridsearch --test-get_cfgdict_list_subset...
python
def get_cfgdict_list_subset(cfgdict_list, keys): r""" returns list of unique dictionaries only with keys specified in keys Args: cfgdict_list (list): keys (list): Returns: list: cfglbl_list CommandLine: python -m utool.util_gridsearch --test-get_cfgdict_list_subset...
[ "def", "get_cfgdict_list_subset", "(", "cfgdict_list", ",", "keys", ")", ":", "import", "utool", "as", "ut", "cfgdict_sublist_", "=", "[", "ut", ".", "dict_subset", "(", "cfgdict", ",", "keys", ")", "for", "cfgdict", "in", "cfgdict_list", "]", "cfgtups_sublist...
r""" returns list of unique dictionaries only with keys specified in keys Args: cfgdict_list (list): keys (list): Returns: list: cfglbl_list CommandLine: python -m utool.util_gridsearch --test-get_cfgdict_list_subset Example: >>> # ENABLE_DOCTEST >...
[ "r", "returns", "list", "of", "unique", "dictionaries", "only", "with", "keys", "specified", "in", "keys" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1944-L1988
train
r Returns list of unique dictionaries only with keys specified in keys
Erotemic/utool
utool/util_gridsearch.py
constrain_cfgdict_list
def constrain_cfgdict_list(cfgdict_list_, constraint_func): """ constrains configurations and removes duplicates """ cfgdict_list = [] for cfg_ in cfgdict_list_: cfg = cfg_.copy() if constraint_func(cfg) is not False and len(cfg) > 0: if cfg not in cfgdict_list: c...
python
def constrain_cfgdict_list(cfgdict_list_, constraint_func): """ constrains configurations and removes duplicates """ cfgdict_list = [] for cfg_ in cfgdict_list_: cfg = cfg_.copy() if constraint_func(cfg) is not False and len(cfg) > 0: if cfg not in cfgdict_list: c...
[ "def", "constrain_cfgdict_list", "(", "cfgdict_list_", ",", "constraint_func", ")", ":", "cfgdict_list", "=", "[", "]", "for", "cfg_", "in", "cfgdict_list_", ":", "cfg", "=", "cfg_", ".", "copy", "(", ")", "if", "constraint_func", "(", "cfg", ")", "is", "n...
constrains configurations and removes duplicates
[ "constrains", "configurations", "and", "removes", "duplicates" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1991-L1999
train
constrains configurations and removes duplicates
Erotemic/utool
utool/util_gridsearch.py
make_cfglbls
def make_cfglbls(cfgdict_list, varied_dict): """ Show only the text in labels that mater from the cfgdict """ import textwrap wrapper = textwrap.TextWrapper(width=50) cfglbl_list = [] for cfgdict_ in cfgdict_list: cfgdict = cfgdict_.copy() for key in six.iterkeys(cfgdict_): ...
python
def make_cfglbls(cfgdict_list, varied_dict): """ Show only the text in labels that mater from the cfgdict """ import textwrap wrapper = textwrap.TextWrapper(width=50) cfglbl_list = [] for cfgdict_ in cfgdict_list: cfgdict = cfgdict_.copy() for key in six.iterkeys(cfgdict_): ...
[ "def", "make_cfglbls", "(", "cfgdict_list", ",", "varied_dict", ")", ":", "import", "textwrap", "wrapper", "=", "textwrap", ".", "TextWrapper", "(", "width", "=", "50", ")", "cfglbl_list", "=", "[", "]", "for", "cfgdict_", "in", "cfgdict_list", ":", "cfgdict...
Show only the text in labels that mater from the cfgdict
[ "Show", "only", "the", "text", "in", "labels", "that", "mater", "from", "the", "cfgdict" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L2002-L2030
train
Create a list of text in labels that mater from the cfgdict
Erotemic/utool
utool/util_gridsearch.py
interact_gridsearch_result_images
def interact_gridsearch_result_images(show_result_func, cfgdict_list, cfglbl_list, cfgresult_list, score_list=None, fnum=None, figtitle='', unpack=False, max_plots=25, verbose=True, ...
python
def interact_gridsearch_result_images(show_result_func, cfgdict_list, cfglbl_list, cfgresult_list, score_list=None, fnum=None, figtitle='', unpack=False, max_plots=25, verbose=True, ...
[ "def", "interact_gridsearch_result_images", "(", "show_result_func", ",", "cfgdict_list", ",", "cfglbl_list", ",", "cfgresult_list", ",", "score_list", "=", "None", ",", "fnum", "=", "None", ",", "figtitle", "=", "''", ",", "unpack", "=", "False", ",", "max_plot...
helper function for visualizing results of gridsearch
[ "helper", "function", "for", "visualizing", "results", "of", "gridsearch" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L2033-L2117
train
function to interact with gridsearch results
Erotemic/utool
utool/util_gridsearch.py
gridsearch_timer
def gridsearch_timer(func_list, args_list, niters=None, **searchkw): """ Times a series of functions on a series of inputs args_list is a list should vary the input sizes can also be a func that take a count param items in args_list list or returned by the func should be a tuple so it can be u...
python
def gridsearch_timer(func_list, args_list, niters=None, **searchkw): """ Times a series of functions on a series of inputs args_list is a list should vary the input sizes can also be a func that take a count param items in args_list list or returned by the func should be a tuple so it can be u...
[ "def", "gridsearch_timer", "(", "func_list", ",", "args_list", ",", "niters", "=", "None", ",", "*", "*", "searchkw", ")", ":", "import", "utool", "as", "ut", "timings", "=", "ut", ".", "ddict", "(", "list", ")", "if", "niters", "is", "None", ":", "n...
Times a series of functions on a series of inputs args_list is a list should vary the input sizes can also be a func that take a count param items in args_list list or returned by the func should be a tuple so it can be unpacked CommandLine: python -m ibeis.annotmatch_funcs --exec-get_ann...
[ "Times", "a", "series", "of", "functions", "on", "a", "series", "of", "inputs" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L2120-L2227
train
This function runs the gridsearch command and returns a dictionary of timings and the result of the function
Thermondo/django-heroku-connect
heroku_connect/utils.py
get_mapping
def get_mapping(version=1, exported_at=None, app_name=None): """ Return Heroku Connect mapping for the entire project. Args: version (int): Version of the Heroku Connect mapping, default: ``1``. exported_at (datetime.datetime): Time the export was created, default is ``now()``. app_...
python
def get_mapping(version=1, exported_at=None, app_name=None): """ Return Heroku Connect mapping for the entire project. Args: version (int): Version of the Heroku Connect mapping, default: ``1``. exported_at (datetime.datetime): Time the export was created, default is ``now()``. app_...
[ "def", "get_mapping", "(", "version", "=", "1", ",", "exported_at", "=", "None", ",", "app_name", "=", "None", ")", ":", "if", "exported_at", "is", "None", ":", "exported_at", "=", "timezone", ".", "now", "(", ")", "app_name", "=", "app_name", "or", "s...
Return Heroku Connect mapping for the entire project. Args: version (int): Version of the Heroku Connect mapping, default: ``1``. exported_at (datetime.datetime): Time the export was created, default is ``now()``. app_name (str): Name of Heroku application associated with Heroku Connect the...
[ "Return", "Heroku", "Connect", "mapping", "for", "the", "entire", "project", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L30-L61
train
Returns a Heroku Connect mapping for the entire project.
Thermondo/django-heroku-connect
heroku_connect/utils.py
get_heroku_connect_models
def get_heroku_connect_models(): """ Return all registered Heroku Connect Models. Returns: (Iterator): All registered models that are subclasses of `.HerokuConnectModel`. Abstract models are excluded, since they are not registered. """ from django.apps import apps ...
python
def get_heroku_connect_models(): """ Return all registered Heroku Connect Models. Returns: (Iterator): All registered models that are subclasses of `.HerokuConnectModel`. Abstract models are excluded, since they are not registered. """ from django.apps import apps ...
[ "def", "get_heroku_connect_models", "(", ")", ":", "from", "django", ".", "apps", "import", "apps", "apps", ".", "check_models_ready", "(", ")", "from", "heroku_connect", ".", "db", ".", "models", "import", "HerokuConnectModel", "return", "(", "model", "for", ...
Return all registered Heroku Connect Models. Returns: (Iterator): All registered models that are subclasses of `.HerokuConnectModel`. Abstract models are excluded, since they are not registered.
[ "Return", "all", "registered", "Heroku", "Connect", "Models", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L64-L84
train
Returns all registered Heroku Connect Models.
Thermondo/django-heroku-connect
heroku_connect/utils.py
get_connected_model_for_table_name
def get_connected_model_for_table_name(table_name): """Return a connected model's table name (which read and written to by Heroku Connect).""" for connected_model in get_heroku_connect_models(): if connected_model.get_heroku_connect_table_name() == table_name: return connected_model rais...
python
def get_connected_model_for_table_name(table_name): """Return a connected model's table name (which read and written to by Heroku Connect).""" for connected_model in get_heroku_connect_models(): if connected_model.get_heroku_connect_table_name() == table_name: return connected_model rais...
[ "def", "get_connected_model_for_table_name", "(", "table_name", ")", ":", "for", "connected_model", "in", "get_heroku_connect_models", "(", ")", ":", "if", "connected_model", ".", "get_heroku_connect_table_name", "(", ")", "==", "table_name", ":", "return", "connected_m...
Return a connected model's table name (which read and written to by Heroku Connect).
[ "Return", "a", "connected", "model", "s", "table", "name", "(", "which", "read", "and", "written", "to", "by", "Heroku", "Connect", ")", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L88-L93
train
Return a connected model for a given table name.
Thermondo/django-heroku-connect
heroku_connect/utils.py
create_heroku_connect_schema
def create_heroku_connect_schema(using=DEFAULT_DB_ALIAS): """ Create Heroku Connect schema. Note: This function is only meant to be used for local development. In a production environment the schema will be created by Heroku Connect. Args: using (str): Alias for databas...
python
def create_heroku_connect_schema(using=DEFAULT_DB_ALIAS): """ Create Heroku Connect schema. Note: This function is only meant to be used for local development. In a production environment the schema will be created by Heroku Connect. Args: using (str): Alias for databas...
[ "def", "create_heroku_connect_schema", "(", "using", "=", "DEFAULT_DB_ALIAS", ")", ":", "connection", "=", "connections", "[", "using", "]", "with", "connection", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "_SCHEMA_EXISTS_QUERY"...
Create Heroku Connect schema. Note: This function is only meant to be used for local development. In a production environment the schema will be created by Heroku Connect. Args: using (str): Alias for database connection. Returns: bool: ``True`` if the schema was c...
[ "Create", "Heroku", "Connect", "schema", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L105-L142
train
Create Heroku Connect schema.
Thermondo/django-heroku-connect
heroku_connect/utils.py
get_connections
def get_connections(app): """ Return all Heroku Connect connections setup with the given application. For more details check the link - https://devcenter.heroku.com/articles/heroku-connect-api#step-4-retrieve-the-new-connection-s-id Sample response from the API call is below:: { ...
python
def get_connections(app): """ Return all Heroku Connect connections setup with the given application. For more details check the link - https://devcenter.heroku.com/articles/heroku-connect-api#step-4-retrieve-the-new-connection-s-id Sample response from the API call is below:: { ...
[ "def", "get_connections", "(", "app", ")", ":", "payload", "=", "{", "'app'", ":", "app", "}", "url", "=", "os", ".", "path", ".", "join", "(", "settings", ".", "HEROKU_CONNECT_API_ENDPOINT", ",", "'connections'", ")", "response", "=", "requests", ".", "...
Return all Heroku Connect connections setup with the given application. For more details check the link - https://devcenter.heroku.com/articles/heroku-connect-api#step-4-retrieve-the-new-connection-s-id Sample response from the API call is below:: { "count": 1, "results":[...
[ "Return", "all", "Heroku", "Connect", "connections", "setup", "with", "the", "given", "application", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L151-L186
train
Returns all Heroku Connect connections setup with the given application.
Thermondo/django-heroku-connect
heroku_connect/utils.py
get_connection
def get_connection(connection_id, deep=False): """ Get Heroku Connection connection information. For more details check the link - https://devcenter.heroku.com/articles/heroku-connect-api#step-8-monitor-the-connection-and-mapping-status Sample response from API call is below:: { ...
python
def get_connection(connection_id, deep=False): """ Get Heroku Connection connection information. For more details check the link - https://devcenter.heroku.com/articles/heroku-connect-api#step-8-monitor-the-connection-and-mapping-status Sample response from API call is below:: { ...
[ "def", "get_connection", "(", "connection_id", ",", "deep", "=", "False", ")", ":", "url", "=", "os", ".", "path", ".", "join", "(", "settings", ".", "HEROKU_CONNECT_API_ENDPOINT", ",", "'connections'", ",", "connection_id", ")", "payload", "=", "{", "'deep'...
Get Heroku Connection connection information. For more details check the link - https://devcenter.heroku.com/articles/heroku-connect-api#step-8-monitor-the-connection-and-mapping-status Sample response from API call is below:: { "id": "<connection_id>", "name": "<app_name>...
[ "Get", "Heroku", "Connection", "connection", "information", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L189-L240
train
Get Heroku Connection information.
Thermondo/django-heroku-connect
heroku_connect/utils.py
import_mapping
def import_mapping(connection_id, mapping): """ Import Heroku Connection mapping for given connection. Args: connection_id (str): Heroku Connection connection ID. mapping (dict): Heroku Connect mapping. Raises: requests.HTTPError: If an error occurs uploading the mapping. ...
python
def import_mapping(connection_id, mapping): """ Import Heroku Connection mapping for given connection. Args: connection_id (str): Heroku Connection connection ID. mapping (dict): Heroku Connect mapping. Raises: requests.HTTPError: If an error occurs uploading the mapping. ...
[ "def", "import_mapping", "(", "connection_id", ",", "mapping", ")", ":", "url", "=", "os", ".", "path", ".", "join", "(", "settings", ".", "HEROKU_CONNECT_API_ENDPOINT", ",", "'connections'", ",", "connection_id", ",", "'actions'", ",", "'import'", ")", "respo...
Import Heroku Connection mapping for given connection. Args: connection_id (str): Heroku Connection connection ID. mapping (dict): Heroku Connect mapping. Raises: requests.HTTPError: If an error occurs uploading the mapping. ValueError: If the mapping is not JSON serializable.
[ "Import", "Heroku", "Connection", "mapping", "for", "given", "connection", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L243-L264
train
Imports Heroku Connect mapping for given connection.
Thermondo/django-heroku-connect
heroku_connect/utils.py
link_connection_to_account
def link_connection_to_account(app): """ Link the connection to your Heroku user account. https://devcenter.heroku.com/articles/heroku-connect-api#step-3-link-the-connection-to-your-heroku-user-account """ url = os.path.join(settings.HEROKU_CONNECT_API_ENDPOINT, 'users', 'me', 'apps', app, 'auth') ...
python
def link_connection_to_account(app): """ Link the connection to your Heroku user account. https://devcenter.heroku.com/articles/heroku-connect-api#step-3-link-the-connection-to-your-heroku-user-account """ url = os.path.join(settings.HEROKU_CONNECT_API_ENDPOINT, 'users', 'me', 'apps', app, 'auth') ...
[ "def", "link_connection_to_account", "(", "app", ")", ":", "url", "=", "os", ".", "path", ".", "join", "(", "settings", ".", "HEROKU_CONNECT_API_ENDPOINT", ",", "'users'", ",", "'me'", ",", "'apps'", ",", "app", ",", "'auth'", ")", "response", "=", "reques...
Link the connection to your Heroku user account. https://devcenter.heroku.com/articles/heroku-connect-api#step-3-link-the-connection-to-your-heroku-user-account
[ "Link", "the", "connection", "to", "your", "Heroku", "user", "account", "." ]
f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5
https://github.com/Thermondo/django-heroku-connect/blob/f390e0fbf256ee79b30bb88f9a8c9576c6c8d9b5/heroku_connect/utils.py#L267-L278
train
Link the connection to your Heroku user account.
glormph/msstitch
src/app/readers/spectra.py
fetch_cvparams_values_from_subel
def fetch_cvparams_values_from_subel(base, subelname, paramnames, ns): """Searches a base element for subelement by name, then takes the cvParams of that subelement and returns the values as a list for the paramnames that match. Value order in list equals input paramnames order.""" sub_el = baseread...
python
def fetch_cvparams_values_from_subel(base, subelname, paramnames, ns): """Searches a base element for subelement by name, then takes the cvParams of that subelement and returns the values as a list for the paramnames that match. Value order in list equals input paramnames order.""" sub_el = baseread...
[ "def", "fetch_cvparams_values_from_subel", "(", "base", ",", "subelname", ",", "paramnames", ",", "ns", ")", ":", "sub_el", "=", "basereader", ".", "find_element_xpath", "(", "base", ",", "subelname", ",", "ns", ")", "cvparams", "=", "get_all_cvparams", "(", "...
Searches a base element for subelement by name, then takes the cvParams of that subelement and returns the values as a list for the paramnames that match. Value order in list equals input paramnames order.
[ "Searches", "a", "base", "element", "for", "subelement", "by", "name", "then", "takes", "the", "cvParams", "of", "that", "subelement", "and", "returns", "the", "values", "as", "a", "list", "for", "the", "paramnames", "that", "match", ".", "Value", "order", ...
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/spectra.py#L39-L49
train
Searches a base element for subelement by name then takes the cvParams of that subelement and returns the values as a list for the paramnames that match.
ColinDuquesnoy/QCrash
qcrash/formatters/email.py
EmailFormatter.format_body
def format_body(self, description, sys_info=None, traceback=None): """ Formats the body in plain text. (add a series of '-' under each section title). :param description: Description of the issue, written by the user. :param sys_info: Optional system information string ...
python
def format_body(self, description, sys_info=None, traceback=None): """ Formats the body in plain text. (add a series of '-' under each section title). :param description: Description of the issue, written by the user. :param sys_info: Optional system information string ...
[ "def", "format_body", "(", "self", ",", "description", ",", "sys_info", "=", "None", ",", "traceback", "=", "None", ")", ":", "name", "=", "'Description'", "delim", "=", "'-'", "*", "40", "body", "=", "BODY_ITEM_TEMPLATE", "%", "{", "'name'", ":", "name"...
Formats the body in plain text. (add a series of '-' under each section title). :param description: Description of the issue, written by the user. :param sys_info: Optional system information string :param log: Optional application log :param traceback: Optional traceback.
[ "Formats", "the", "body", "in", "plain", "text", ".", "(", "add", "a", "series", "of", "-", "under", "each", "section", "title", ")", "." ]
775e1b15764e2041a8f9a08bea938e4d6ce817c7
https://github.com/ColinDuquesnoy/QCrash/blob/775e1b15764e2041a8f9a08bea938e4d6ce817c7/qcrash/formatters/email.py#L37-L63
train
Formats the issue s body in plain text.
glormph/msstitch
src/app/lookups/sqlite/base.py
DatabaseConnection.create_tables
def create_tables(self, tables): """Creates database tables in sqlite lookup db""" cursor = self.get_cursor() for table in tables: columns = mslookup_tables[table] try: cursor.execute('CREATE TABLE {0}({1})'.format( table, ', '.join(col...
python
def create_tables(self, tables): """Creates database tables in sqlite lookup db""" cursor = self.get_cursor() for table in tables: columns = mslookup_tables[table] try: cursor.execute('CREATE TABLE {0}({1})'.format( table, ', '.join(col...
[ "def", "create_tables", "(", "self", ",", "tables", ")", ":", "cursor", "=", "self", ".", "get_cursor", "(", ")", "for", "table", "in", "tables", ":", "columns", "=", "mslookup_tables", "[", "table", "]", "try", ":", "cursor", ".", "execute", "(", "'CR...
Creates database tables in sqlite lookup db
[ "Creates", "database", "tables", "in", "sqlite", "lookup", "db" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L368-L382
train
Creates database tables in sqlite lookup db
glormph/msstitch
src/app/lookups/sqlite/base.py
DatabaseConnection.connect
def connect(self, fn): """SQLite connect method initialize db""" self.conn = sqlite3.connect(fn) cur = self.get_cursor() cur.execute('PRAGMA page_size=4096') cur.execute('PRAGMA FOREIGN_KEYS=ON') cur.execute('PRAGMA cache_size=10000') cur.execute('PRAGMA journal_m...
python
def connect(self, fn): """SQLite connect method initialize db""" self.conn = sqlite3.connect(fn) cur = self.get_cursor() cur.execute('PRAGMA page_size=4096') cur.execute('PRAGMA FOREIGN_KEYS=ON') cur.execute('PRAGMA cache_size=10000') cur.execute('PRAGMA journal_m...
[ "def", "connect", "(", "self", ",", "fn", ")", ":", "self", ".", "conn", "=", "sqlite3", ".", "connect", "(", "fn", ")", "cur", "=", "self", ".", "get_cursor", "(", ")", "cur", ".", "execute", "(", "'PRAGMA page_size=4096'", ")", "cur", ".", "execute...
SQLite connect method initialize db
[ "SQLite", "connect", "method", "initialize", "db" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L384-L391
train
SQLite connect method initialize db
glormph/msstitch
src/app/lookups/sqlite/base.py
DatabaseConnection.index_column
def index_column(self, index_name, table, column): """Called by interfaces to index specific column in table""" cursor = self.get_cursor() try: cursor.execute( 'CREATE INDEX {0} on {1}({2})'.format(index_name, table, column)) except sqlite3.OperationalError as...
python
def index_column(self, index_name, table, column): """Called by interfaces to index specific column in table""" cursor = self.get_cursor() try: cursor.execute( 'CREATE INDEX {0} on {1}({2})'.format(index_name, table, column)) except sqlite3.OperationalError as...
[ "def", "index_column", "(", "self", ",", "index_name", ",", "table", ",", "column", ")", ":", "cursor", "=", "self", ".", "get_cursor", "(", ")", "try", ":", "cursor", ".", "execute", "(", "'CREATE INDEX {0} on {1}({2})'", ".", "format", "(", "index_name", ...
Called by interfaces to index specific column in table
[ "Called", "by", "interfaces", "to", "index", "specific", "column", "in", "table" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L401-L411
train
Called by interfaces to index specific column in table
glormph/msstitch
src/app/lookups/sqlite/base.py
DatabaseConnection.get_sql_select
def get_sql_select(self, columns, table, distinct=False): """Creates and returns an SQL SELECT statement""" sql = 'SELECT {0} {1} FROM {2}' dist = {True: 'DISTINCT', False: ''}[distinct] return sql.format(dist, ', '.join(columns), table)
python
def get_sql_select(self, columns, table, distinct=False): """Creates and returns an SQL SELECT statement""" sql = 'SELECT {0} {1} FROM {2}' dist = {True: 'DISTINCT', False: ''}[distinct] return sql.format(dist, ', '.join(columns), table)
[ "def", "get_sql_select", "(", "self", ",", "columns", ",", "table", ",", "distinct", "=", "False", ")", ":", "sql", "=", "'SELECT {0} {1} FROM {2}'", "dist", "=", "{", "True", ":", "'DISTINCT'", ",", "False", ":", "''", "}", "[", "distinct", "]", "return...
Creates and returns an SQL SELECT statement
[ "Creates", "and", "returns", "an", "SQL", "SELECT", "statement" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L417-L421
train
Creates and returns an SQL SELECT statement
glormph/msstitch
src/app/lookups/sqlite/base.py
DatabaseConnection.store_many
def store_many(self, sql, values): """Abstraction over executemany method""" cursor = self.get_cursor() cursor.executemany(sql, values) self.conn.commit()
python
def store_many(self, sql, values): """Abstraction over executemany method""" cursor = self.get_cursor() cursor.executemany(sql, values) self.conn.commit()
[ "def", "store_many", "(", "self", ",", "sql", ",", "values", ")", ":", "cursor", "=", "self", ".", "get_cursor", "(", ")", "cursor", ".", "executemany", "(", "sql", ",", "values", ")", "self", ".", "conn", ".", "commit", "(", ")" ]
Abstraction over executemany method
[ "Abstraction", "over", "executemany", "method" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L423-L427
train
Abstraction over executemany method
glormph/msstitch
src/app/lookups/sqlite/base.py
DatabaseConnection.execute_sql
def execute_sql(self, sql): """Executes SQL and returns cursor for it""" cursor = self.get_cursor() cursor.execute(sql) return cursor
python
def execute_sql(self, sql): """Executes SQL and returns cursor for it""" cursor = self.get_cursor() cursor.execute(sql) return cursor
[ "def", "execute_sql", "(", "self", ",", "sql", ")", ":", "cursor", "=", "self", ".", "get_cursor", "(", ")", "cursor", ".", "execute", "(", "sql", ")", "return", "cursor" ]
Executes SQL and returns cursor for it
[ "Executes", "SQL", "and", "returns", "cursor", "for", "it" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L429-L433
train
Executes SQL and returns cursor for it
glormph/msstitch
src/app/lookups/sqlite/base.py
ResultLookupInterface.get_mzmlfile_map
def get_mzmlfile_map(self): """Returns dict of mzmlfilenames and their db ids""" cursor = self.get_cursor() cursor.execute('SELECT mzmlfile_id, mzmlfilename FROM mzmlfiles') return {fn: fnid for fnid, fn in cursor.fetchall()}
python
def get_mzmlfile_map(self): """Returns dict of mzmlfilenames and their db ids""" cursor = self.get_cursor() cursor.execute('SELECT mzmlfile_id, mzmlfilename FROM mzmlfiles') return {fn: fnid for fnid, fn in cursor.fetchall()}
[ "def", "get_mzmlfile_map", "(", "self", ")", ":", "cursor", "=", "self", ".", "get_cursor", "(", ")", "cursor", ".", "execute", "(", "'SELECT mzmlfile_id, mzmlfilename FROM mzmlfiles'", ")", "return", "{", "fn", ":", "fnid", "for", "fnid", ",", "fn", "in", "...
Returns dict of mzmlfilenames and their db ids
[ "Returns", "dict", "of", "mzmlfilenames", "and", "their", "db", "ids" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L440-L444
train
Returns dict of mzmlfilenames and their db ids
glormph/msstitch
src/app/lookups/sqlite/base.py
ResultLookupInterface.get_spectra_id
def get_spectra_id(self, fn_id, retention_time=None, scan_nr=None): """Returns spectra id for spectra filename and retention time""" cursor = self.get_cursor() sql = 'SELECT spectra_id FROM mzml WHERE mzmlfile_id=? ' values = [fn_id] if retention_time is not None: sql...
python
def get_spectra_id(self, fn_id, retention_time=None, scan_nr=None): """Returns spectra id for spectra filename and retention time""" cursor = self.get_cursor() sql = 'SELECT spectra_id FROM mzml WHERE mzmlfile_id=? ' values = [fn_id] if retention_time is not None: sql...
[ "def", "get_spectra_id", "(", "self", ",", "fn_id", ",", "retention_time", "=", "None", ",", "scan_nr", "=", "None", ")", ":", "cursor", "=", "self", ".", "get_cursor", "(", ")", "sql", "=", "'SELECT spectra_id FROM mzml WHERE mzmlfile_id=? '", "values", "=", ...
Returns spectra id for spectra filename and retention time
[ "Returns", "spectra", "id", "for", "spectra", "filename", "and", "retention", "time" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/lookups/sqlite/base.py#L446-L458
train
Returns the spectra id for the given file ID and retention time
Erotemic/utool
utool/experimental/pandas_highlight.py
to_string_monkey
def to_string_monkey(df, highlight_cols=None, latex=False): """ monkey patch to pandas to highlight the maximum value in specified cols of a row Example: >>> from utool.experimental.pandas_highlight import * >>> import pandas as pd >>> df = pd.DataFrame( >>> np.array([[...
python
def to_string_monkey(df, highlight_cols=None, latex=False): """ monkey patch to pandas to highlight the maximum value in specified cols of a row Example: >>> from utool.experimental.pandas_highlight import * >>> import pandas as pd >>> df = pd.DataFrame( >>> np.array([[...
[ "def", "to_string_monkey", "(", "df", ",", "highlight_cols", "=", "None", ",", "latex", "=", "False", ")", ":", "try", ":", "import", "pandas", "as", "pd", "import", "utool", "as", "ut", "import", "numpy", "as", "np", "import", "six", "if", "isinstance",...
monkey patch to pandas to highlight the maximum value in specified cols of a row Example: >>> from utool.experimental.pandas_highlight import * >>> import pandas as pd >>> df = pd.DataFrame( >>> np.array([[ 0.9, 0.86886931, 0.86842073, 0.9 ], >>> ...
[ "monkey", "patch", "to", "pandas", "to", "highlight", "the", "maximum", "value", "in", "specified", "cols", "of", "a", "row" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/experimental/pandas_highlight.py#L131-L214
train
monkey patch to pandas to highlight the maximum value in specified columns
neithere/monk
monk/validators.py
translate
def translate(value): """ Translates given schema from "pythonic" syntax to a validator. Usage:: >>> translate(str) IsA(str) >>> translate('hello') IsA(str, default='hello') """ if isinstance(value, BaseValidator): return value if value is None: ...
python
def translate(value): """ Translates given schema from "pythonic" syntax to a validator. Usage:: >>> translate(str) IsA(str) >>> translate('hello') IsA(str, default='hello') """ if isinstance(value, BaseValidator): return value if value is None: ...
[ "def", "translate", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "BaseValidator", ")", ":", "return", "value", "if", "value", "is", "None", ":", "return", "Anything", "(", ")", "if", "isinstance", "(", "value", ",", "type", ")", ":", ...
Translates given schema from "pythonic" syntax to a validator. Usage:: >>> translate(str) IsA(str) >>> translate('hello') IsA(str, default='hello')
[ "Translates", "given", "schema", "from", "pythonic", "syntax", "to", "a", "validator", "." ]
4b2ee5152b081ac288ce8568422a027b5e7d2b1c
https://github.com/neithere/monk/blob/4b2ee5152b081ac288ce8568422a027b5e7d2b1c/monk/validators.py#L699-L753
train
Translate given schema from pythonic syntax to a validator.
neithere/monk
monk/validators.py
BaseListOf._merge
def _merge(self, value): """ Returns a list based on `value`: * missing required value is converted to an empty list; * missing required items are never created; * nested items are merged recursively. """ if not value: return [] if value is not None...
python
def _merge(self, value): """ Returns a list based on `value`: * missing required value is converted to an empty list; * missing required items are never created; * nested items are merged recursively. """ if not value: return [] if value is not None...
[ "def", "_merge", "(", "self", ",", "value", ")", ":", "if", "not", "value", ":", "return", "[", "]", "if", "value", "is", "not", "None", "and", "not", "isinstance", "(", "value", ",", "list", ")", ":", "# bogus value; will not pass validation but should be p...
Returns a list based on `value`: * missing required value is converted to an empty list; * missing required items are never created; * nested items are merged recursively.
[ "Returns", "a", "list", "based", "on", "value", ":" ]
4b2ee5152b081ac288ce8568422a027b5e7d2b1c
https://github.com/neithere/monk/blob/4b2ee5152b081ac288ce8568422a027b5e7d2b1c/monk/validators.py#L431-L447
train
Merge the items in value into a list based on self. _nested_validator. get_default_for.
neithere/monk
monk/validators.py
DictOf._merge
def _merge(self, value): """ Returns a dictionary based on `value` with each value recursively merged with `spec`. """ if value is not None and not isinstance(value, dict): # bogus value; will not pass validation but should be preserved return value ...
python
def _merge(self, value): """ Returns a dictionary based on `value` with each value recursively merged with `spec`. """ if value is not None and not isinstance(value, dict): # bogus value; will not pass validation but should be preserved return value ...
[ "def", "_merge", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", "and", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "# bogus value; will not pass validation but should be preserved", "return", "value", "if", "not", "self", ...
Returns a dictionary based on `value` with each value recursively merged with `spec`.
[ "Returns", "a", "dictionary", "based", "on", "value", "with", "each", "value", "recursively", "merged", "with", "spec", "." ]
4b2ee5152b081ac288ce8568422a027b5e7d2b1c
https://github.com/neithere/monk/blob/4b2ee5152b081ac288ce8568422a027b5e7d2b1c/monk/validators.py#L589-L622
train
Merge the value with each value recursively
Erotemic/utool
utool/_internal/win32_send_keys.py
handle_code
def handle_code(code): "Handle a key or sequence of keys in braces" code_keys = [] # it is a known code (e.g. {DOWN}, {ENTER}, etc) if code in CODES: code_keys.append(VirtualKeyAction(CODES[code])) # it is an escaped modifier e.g. {%}, {^}, {+} elif len(code) == 1: code_keys.ap...
python
def handle_code(code): "Handle a key or sequence of keys in braces" code_keys = [] # it is a known code (e.g. {DOWN}, {ENTER}, etc) if code in CODES: code_keys.append(VirtualKeyAction(CODES[code])) # it is an escaped modifier e.g. {%}, {^}, {+} elif len(code) == 1: code_keys.ap...
[ "def", "handle_code", "(", "code", ")", ":", "code_keys", "=", "[", "]", "# it is a known code (e.g. {DOWN}, {ENTER}, etc)", "if", "code", "in", "CODES", ":", "code_keys", ".", "append", "(", "VirtualKeyAction", "(", "CODES", "[", "code", "]", ")", ")", "# it ...
Handle a key or sequence of keys in braces
[ "Handle", "a", "key", "or", "sequence", "of", "keys", "in", "braces" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L478-L523
train
Handle a key or sequence of keys in braces
Erotemic/utool
utool/_internal/win32_send_keys.py
parse_keys
def parse_keys(string, with_spaces = False, with_tabs = False, with_newlines = False, modifiers = None): "Return the parsed keys" keys = [] if not modifiers: modifiers = [] index = 0 while index < len(string): c = stri...
python
def parse_keys(string, with_spaces = False, with_tabs = False, with_newlines = False, modifiers = None): "Return the parsed keys" keys = [] if not modifiers: modifiers = [] index = 0 while index < len(string): c = stri...
[ "def", "parse_keys", "(", "string", ",", "with_spaces", "=", "False", ",", "with_tabs", "=", "False", ",", "with_newlines", "=", "False", ",", "modifiers", "=", "None", ")", ":", "keys", "=", "[", "]", "if", "not", "modifiers", ":", "modifiers", "=", "...
Return the parsed keys
[ "Return", "the", "parsed", "keys" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L526-L614
train
Return the parsed keys
Erotemic/utool
utool/_internal/win32_send_keys.py
SendKeys
def SendKeys(keys, pause=0.05, with_spaces=False, with_tabs=False, with_newlines=False, turn_off_numlock=True): "Parse the keys and type them" keys = parse_keys(keys, with_spaces, with_tabs, with_newlines) for k in keys: k.Run() ...
python
def SendKeys(keys, pause=0.05, with_spaces=False, with_tabs=False, with_newlines=False, turn_off_numlock=True): "Parse the keys and type them" keys = parse_keys(keys, with_spaces, with_tabs, with_newlines) for k in keys: k.Run() ...
[ "def", "SendKeys", "(", "keys", ",", "pause", "=", "0.05", ",", "with_spaces", "=", "False", ",", "with_tabs", "=", "False", ",", "with_newlines", "=", "False", ",", "turn_off_numlock", "=", "True", ")", ":", "keys", "=", "parse_keys", "(", "keys", ",", ...
Parse the keys and type them
[ "Parse", "the", "keys", "and", "type", "them" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L624-L635
train
Parse the keys and type them
Erotemic/utool
utool/_internal/win32_send_keys.py
main
def main(): "Send some test strings" actions = """ {LWIN} {PAUSE .25} r {PAUSE .25} Notepad.exe{ENTER} {PAUSE 1} Hello{SPACE}World! {PAUSE 1} %{F4} {PAUSE .25} n """ SendKeys(actions, pause = .1) keys = par...
python
def main(): "Send some test strings" actions = """ {LWIN} {PAUSE .25} r {PAUSE .25} Notepad.exe{ENTER} {PAUSE 1} Hello{SPACE}World! {PAUSE 1} %{F4} {PAUSE .25} n """ SendKeys(actions, pause = .1) keys = par...
[ "def", "main", "(", ")", ":", "actions", "=", "\"\"\"\n {LWIN}\n {PAUSE .25}\n r\n {PAUSE .25}\n Notepad.exe{ENTER}\n {PAUSE 1}\n Hello{SPACE}World!\n {PAUSE 1}\n %{F4}\n {PAUSE .25}\n n\n \"\"\"", "SendKeys", "(",...
Send some test strings
[ "Send", "some", "test", "strings" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L638-L688
train
Send some test strings
Erotemic/utool
utool/_internal/win32_send_keys.py
KeyAction.GetInput
def GetInput(self): "Build the INPUT structure for the action" actions = 1 # if both up and down if self.up and self.down: actions = 2 inputs = (INPUT * actions)() vk, scan, flags = self._get_key_info() for inp in inputs: inp.type = INPU...
python
def GetInput(self): "Build the INPUT structure for the action" actions = 1 # if both up and down if self.up and self.down: actions = 2 inputs = (INPUT * actions)() vk, scan, flags = self._get_key_info() for inp in inputs: inp.type = INPU...
[ "def", "GetInput", "(", "self", ")", ":", "actions", "=", "1", "# if both up and down", "if", "self", ".", "up", "and", "self", ".", "down", ":", "actions", "=", "2", "inputs", "=", "(", "INPUT", "*", "actions", ")", "(", ")", "vk", ",", "scan", ",...
Build the INPUT structure for the action
[ "Build", "the", "INPUT", "structure", "for", "the", "action" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L312-L334
train
Build the INPUT structure for the action
Erotemic/utool
utool/_internal/win32_send_keys.py
KeyAction.Run
def Run(self): "Execute the action" inputs = self.GetInput() return SendInput( len(inputs), ctypes.byref(inputs), ctypes.sizeof(INPUT))
python
def Run(self): "Execute the action" inputs = self.GetInput() return SendInput( len(inputs), ctypes.byref(inputs), ctypes.sizeof(INPUT))
[ "def", "Run", "(", "self", ")", ":", "inputs", "=", "self", ".", "GetInput", "(", ")", "return", "SendInput", "(", "len", "(", "inputs", ")", ",", "ctypes", ".", "byref", "(", "inputs", ")", ",", "ctypes", ".", "sizeof", "(", "INPUT", ")", ")" ]
Execute the action
[ "Execute", "the", "action" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L336-L342
train
Execute the action
Erotemic/utool
utool/_internal/win32_send_keys.py
KeyAction._get_down_up_string
def _get_down_up_string(self): """Return a string that will show whether the string is up or down return 'down' if the key is a press only return 'up' if the key is up only return '' if the key is up & down (as default) """ down_up = "" if not (self.down and self...
python
def _get_down_up_string(self): """Return a string that will show whether the string is up or down return 'down' if the key is a press only return 'up' if the key is up only return '' if the key is up & down (as default) """ down_up = "" if not (self.down and self...
[ "def", "_get_down_up_string", "(", "self", ")", ":", "down_up", "=", "\"\"", "if", "not", "(", "self", ".", "down", "and", "self", ".", "up", ")", ":", "if", "self", ".", "down", ":", "down_up", "=", "\"down\"", "elif", "self", ".", "up", ":", "dow...
Return a string that will show whether the string is up or down return 'down' if the key is a press only return 'up' if the key is up only return '' if the key is up & down (as default)
[ "Return", "a", "string", "that", "will", "show", "whether", "the", "string", "is", "up", "or", "down" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L344-L357
train
Return a string that will show whether the string is up or down
Erotemic/utool
utool/_internal/win32_send_keys.py
KeyAction.key_description
def key_description(self): "Return a description of the key" vk, scan, flags = self._get_key_info() desc = '' if vk: if vk in CODE_NAMES: desc = CODE_NAMES[vk] else: desc = "VK %d"% vk else: desc = "%s"% self.key...
python
def key_description(self): "Return a description of the key" vk, scan, flags = self._get_key_info() desc = '' if vk: if vk in CODE_NAMES: desc = CODE_NAMES[vk] else: desc = "VK %d"% vk else: desc = "%s"% self.key...
[ "def", "key_description", "(", "self", ")", ":", "vk", ",", "scan", ",", "flags", "=", "self", ".", "_get_key_info", "(", ")", "desc", "=", "''", "if", "vk", ":", "if", "vk", "in", "CODE_NAMES", ":", "desc", "=", "CODE_NAMES", "[", "vk", "]", "else...
Return a description of the key
[ "Return", "a", "description", "of", "the", "key" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L359-L371
train
Return a description of the key
Erotemic/utool
utool/_internal/win32_send_keys.py
VirtualKeyAction._get_key_info
def _get_key_info(self): "Virtual keys have extended flag set" # copied more or less verbatim from # http://www.pinvoke.net/default.aspx/user32.sendinput if ( (self.key >= 33 and self.key <= 46) or (self.key >= 91 and self.key <= 93) ): flags = KEYEVE...
python
def _get_key_info(self): "Virtual keys have extended flag set" # copied more or less verbatim from # http://www.pinvoke.net/default.aspx/user32.sendinput if ( (self.key >= 33 and self.key <= 46) or (self.key >= 91 and self.key <= 93) ): flags = KEYEVE...
[ "def", "_get_key_info", "(", "self", ")", ":", "# copied more or less verbatim from", "# http://www.pinvoke.net/default.aspx/user32.sendinput", "if", "(", "(", "self", ".", "key", ">=", "33", "and", "self", ".", "key", "<=", "46", ")", "or", "(", "self", ".", "k...
Virtual keys have extended flag set
[ "Virtual", "keys", "have", "extended", "flag", "set" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L389-L404
train
Virtual keys have extended flag set
Erotemic/utool
utool/_internal/win32_send_keys.py
EscapedKeyAction._get_key_info
def _get_key_info(self): """EscapedKeyAction doesn't send it as Unicode and the vk and scan code are generated differently""" vkey_scan = LoByte(VkKeyScan(self.key)) return (vkey_scan, MapVirtualKey(vkey_scan, 0), 0)
python
def _get_key_info(self): """EscapedKeyAction doesn't send it as Unicode and the vk and scan code are generated differently""" vkey_scan = LoByte(VkKeyScan(self.key)) return (vkey_scan, MapVirtualKey(vkey_scan, 0), 0)
[ "def", "_get_key_info", "(", "self", ")", ":", "vkey_scan", "=", "LoByte", "(", "VkKeyScan", "(", "self", ".", "key", ")", ")", "return", "(", "vkey_scan", ",", "MapVirtualKey", "(", "vkey_scan", ",", "0", ")", ",", "0", ")" ]
EscapedKeyAction doesn't send it as Unicode and the vk and scan code are generated differently
[ "EscapedKeyAction", "doesn", "t", "send", "it", "as", "Unicode", "and", "the", "vk", "and", "scan", "code", "are", "generated", "differently" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/win32_send_keys.py#L412-L417
train
Return the vk and scan code for this key.
ThreatResponse/aws_ir_plugins
aws_ir_plugins/revokests_key.py
Plugin.setup
def setup(self): """Method runs the plugin attaching policies to the user in question""" self.template = self._generate_inline_policy() if self.dry_run is not True: self.client = self._get_client() username = self._get_username_for_key() policy_document = self...
python
def setup(self): """Method runs the plugin attaching policies to the user in question""" self.template = self._generate_inline_policy() if self.dry_run is not True: self.client = self._get_client() username = self._get_username_for_key() policy_document = self...
[ "def", "setup", "(", "self", ")", ":", "self", ".", "template", "=", "self", ".", "_generate_inline_policy", "(", ")", "if", "self", ".", "dry_run", "is", "not", "True", ":", "self", ".", "client", "=", "self", ".", "_get_client", "(", ")", "username",...
Method runs the plugin attaching policies to the user in question
[ "Method", "runs", "the", "plugin", "attaching", "policies", "to", "the", "user", "in", "question" ]
b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73
https://github.com/ThreatResponse/aws_ir_plugins/blob/b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73/aws_ir_plugins/revokests_key.py#L27-L35
train
Method runs the plugin attaching policies to the user in question
ThreatResponse/aws_ir_plugins
aws_ir_plugins/revokests_key.py
Plugin._get_policies
def _get_policies(self): """Returns all the policy names for a given user""" username = self._get_username_for_key() policies = self.client.list_user_policies( UserName=username ) return policies
python
def _get_policies(self): """Returns all the policy names for a given user""" username = self._get_username_for_key() policies = self.client.list_user_policies( UserName=username ) return policies
[ "def", "_get_policies", "(", "self", ")", ":", "username", "=", "self", ".", "_get_username_for_key", "(", ")", "policies", "=", "self", ".", "client", ".", "list_user_policies", "(", "UserName", "=", "username", ")", "return", "policies" ]
Returns all the policy names for a given user
[ "Returns", "all", "the", "policy", "names", "for", "a", "given", "user" ]
b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73
https://github.com/ThreatResponse/aws_ir_plugins/blob/b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73/aws_ir_plugins/revokests_key.py#L53-L59
train
Returns all the policy names for a given user
ThreatResponse/aws_ir_plugins
aws_ir_plugins/revokests_key.py
Plugin._get_username_for_key
def _get_username_for_key(self): """Find the user for a given access key""" response = self.client.get_access_key_last_used( AccessKeyId=self.compromised_resource['access_key_id'] ) username = response['UserName'] return username
python
def _get_username_for_key(self): """Find the user for a given access key""" response = self.client.get_access_key_last_used( AccessKeyId=self.compromised_resource['access_key_id'] ) username = response['UserName'] return username
[ "def", "_get_username_for_key", "(", "self", ")", ":", "response", "=", "self", ".", "client", ".", "get_access_key_last_used", "(", "AccessKeyId", "=", "self", ".", "compromised_resource", "[", "'access_key_id'", "]", ")", "username", "=", "response", "[", "'Us...
Find the user for a given access key
[ "Find", "the", "user", "for", "a", "given", "access", "key" ]
b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73
https://github.com/ThreatResponse/aws_ir_plugins/blob/b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73/aws_ir_plugins/revokests_key.py#L66-L72
train
Find the user for a given access key
ThreatResponse/aws_ir_plugins
aws_ir_plugins/revokests_key.py
Plugin._generate_inline_policy
def _generate_inline_policy(self): """Renders a policy from a jinja template""" template_name = self._locate_file('deny-sts-before-time.json.j2') template_file = open(template_name) template_contents = template_file.read() template_file.close() jinja_template = Template(t...
python
def _generate_inline_policy(self): """Renders a policy from a jinja template""" template_name = self._locate_file('deny-sts-before-time.json.j2') template_file = open(template_name) template_contents = template_file.read() template_file.close() jinja_template = Template(t...
[ "def", "_generate_inline_policy", "(", "self", ")", ":", "template_name", "=", "self", ".", "_locate_file", "(", "'deny-sts-before-time.json.j2'", ")", "template_file", "=", "open", "(", "template_name", ")", "template_contents", "=", "template_file", ".", "read", "...
Renders a policy from a jinja template
[ "Renders", "a", "policy", "from", "a", "jinja", "template" ]
b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73
https://github.com/ThreatResponse/aws_ir_plugins/blob/b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73/aws_ir_plugins/revokests_key.py#L74-L84
train
Renders a policy from a jinja template
ThreatResponse/aws_ir_plugins
aws_ir_plugins/revokests_key.py
Plugin._attach_inline_policy
def _attach_inline_policy(self, username, policy_document): """Attaches the policy to the user""" response = self.client.put_user_policy( UserName=username, PolicyName="threatresponse-temporal-key-revocation", PolicyDocument=policy_document ) logger.in...
python
def _attach_inline_policy(self, username, policy_document): """Attaches the policy to the user""" response = self.client.put_user_policy( UserName=username, PolicyName="threatresponse-temporal-key-revocation", PolicyDocument=policy_document ) logger.in...
[ "def", "_attach_inline_policy", "(", "self", ",", "username", ",", "policy_document", ")", ":", "response", "=", "self", ".", "client", ".", "put_user_policy", "(", "UserName", "=", "username", ",", "PolicyName", "=", "\"threatresponse-temporal-key-revocation\"", ",...
Attaches the policy to the user
[ "Attaches", "the", "policy", "to", "the", "user" ]
b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73
https://github.com/ThreatResponse/aws_ir_plugins/blob/b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73/aws_ir_plugins/revokests_key.py#L86-L97
train
Attaches the inline policy to the user
ThreatResponse/aws_ir_plugins
aws_ir_plugins/revokests_key.py
Plugin._locate_file
def _locate_file(self, pattern, root=os.path.dirname('revokests_key.py')): """Locate all files matching supplied filename pattern in and below supplied root directory. """ for path, dirs, files in os.walk(os.path.abspath(root)): for filename in fnmatch.filter(files, pattern...
python
def _locate_file(self, pattern, root=os.path.dirname('revokests_key.py')): """Locate all files matching supplied filename pattern in and below supplied root directory. """ for path, dirs, files in os.walk(os.path.abspath(root)): for filename in fnmatch.filter(files, pattern...
[ "def", "_locate_file", "(", "self", ",", "pattern", ",", "root", "=", "os", ".", "path", ".", "dirname", "(", "'revokests_key.py'", ")", ")", ":", "for", "path", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "os", ".", "path", ".", "absp...
Locate all files matching supplied filename pattern in and below supplied root directory.
[ "Locate", "all", "files", "matching", "supplied", "filename", "pattern", "in", "and", "below" ]
b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73
https://github.com/ThreatResponse/aws_ir_plugins/blob/b5128ef5cbd91fc0b5d55615f1c14cb036ae7c73/aws_ir_plugins/revokests_key.py#L99-L107
train
Locate all files matching pattern in and below supplied root directory.
glormph/msstitch
src/app/readers/tsv.py
generate_tsv_pep_protein_quants
def generate_tsv_pep_protein_quants(fns): """Unlike generate_tsv_lines_multifile, this generates tsv lines from multiple files that may have different headers. Yields fn, header as well as quant data for each protein quant""" for fn in fns: header = get_tsv_header(fn) for pquant in gener...
python
def generate_tsv_pep_protein_quants(fns): """Unlike generate_tsv_lines_multifile, this generates tsv lines from multiple files that may have different headers. Yields fn, header as well as quant data for each protein quant""" for fn in fns: header = get_tsv_header(fn) for pquant in gener...
[ "def", "generate_tsv_pep_protein_quants", "(", "fns", ")", ":", "for", "fn", "in", "fns", ":", "header", "=", "get_tsv_header", "(", "fn", ")", "for", "pquant", "in", "generate_split_tsv_lines", "(", "fn", ",", "header", ")", ":", "yield", "os", ".", "path...
Unlike generate_tsv_lines_multifile, this generates tsv lines from multiple files that may have different headers. Yields fn, header as well as quant data for each protein quant
[ "Unlike", "generate_tsv_lines_multifile", "this", "generates", "tsv", "lines", "from", "multiple", "files", "that", "may", "have", "different", "headers", ".", "Yields", "fn", "header", "as", "well", "as", "quant", "data", "for", "each", "protein", "quant" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/tsv.py#L22-L29
train
This function generates tsv lines from multiple files that may have different headers.
glormph/msstitch
src/app/readers/tsv.py
mzmlfn_kronikfeature_generator
def mzmlfn_kronikfeature_generator(mzmlfns, kronikfns): """Generates tuples of spectra filename and corresponding output features from kronik""" for mzmlfn, kronikfn in zip(mzmlfns, kronikfns): for quant_el in generate_kronik_feats(kronikfn): yield os.path.basename(mzmlfn), quant_el
python
def mzmlfn_kronikfeature_generator(mzmlfns, kronikfns): """Generates tuples of spectra filename and corresponding output features from kronik""" for mzmlfn, kronikfn in zip(mzmlfns, kronikfns): for quant_el in generate_kronik_feats(kronikfn): yield os.path.basename(mzmlfn), quant_el
[ "def", "mzmlfn_kronikfeature_generator", "(", "mzmlfns", ",", "kronikfns", ")", ":", "for", "mzmlfn", ",", "kronikfn", "in", "zip", "(", "mzmlfns", ",", "kronikfns", ")", ":", "for", "quant_el", "in", "generate_kronik_feats", "(", "kronikfn", ")", ":", "yield"...
Generates tuples of spectra filename and corresponding output features from kronik
[ "Generates", "tuples", "of", "spectra", "filename", "and", "corresponding", "output", "features", "from", "kronik" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/tsv.py#L38-L43
train
Generates tuples of spectra filename and corresponding output features from kronik
glormph/msstitch
src/app/readers/tsv.py
generate_split_tsv_lines
def generate_split_tsv_lines(fn, header): """Returns dicts with header-keys and psm statistic values""" for line in generate_tsv_psms_line(fn): yield {x: y for (x, y) in zip(header, line.strip().split('\t'))}
python
def generate_split_tsv_lines(fn, header): """Returns dicts with header-keys and psm statistic values""" for line in generate_tsv_psms_line(fn): yield {x: y for (x, y) in zip(header, line.strip().split('\t'))}
[ "def", "generate_split_tsv_lines", "(", "fn", ",", "header", ")", ":", "for", "line", "in", "generate_tsv_psms_line", "(", "fn", ")", ":", "yield", "{", "x", ":", "y", "for", "(", "x", ",", "y", ")", "in", "zip", "(", "header", ",", "line", ".", "s...
Returns dicts with header-keys and psm statistic values
[ "Returns", "dicts", "with", "header", "-", "keys", "and", "psm", "statistic", "values" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/tsv.py#L55-L58
train
Returns a generator that yields a list of dicts with header - keys and psm statistic values
glormph/msstitch
src/app/readers/tsv.py
get_proteins_from_psm
def get_proteins_from_psm(line): """From a line, return list of proteins reported by Mzid2TSV. When unrolled lines are given, this returns the single protein from the line.""" proteins = line[mzidtsvdata.HEADER_PROTEIN].split(';') outproteins = [] for protein in proteins: prepost_protein = r...
python
def get_proteins_from_psm(line): """From a line, return list of proteins reported by Mzid2TSV. When unrolled lines are given, this returns the single protein from the line.""" proteins = line[mzidtsvdata.HEADER_PROTEIN].split(';') outproteins = [] for protein in proteins: prepost_protein = r...
[ "def", "get_proteins_from_psm", "(", "line", ")", ":", "proteins", "=", "line", "[", "mzidtsvdata", ".", "HEADER_PROTEIN", "]", ".", "split", "(", "';'", ")", "outproteins", "=", "[", "]", "for", "protein", "in", "proteins", ":", "prepost_protein", "=", "r...
From a line, return list of proteins reported by Mzid2TSV. When unrolled lines are given, this returns the single protein from the line.
[ "From", "a", "line", "return", "list", "of", "proteins", "reported", "by", "Mzid2TSV", ".", "When", "unrolled", "lines", "are", "given", "this", "returns", "the", "single", "protein", "from", "the", "line", "." ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/tsv.py#L74-L82
train
From a line return list of proteins reported by Mzid2TSV. When unrolled lines are given this returns the single protein from the line.
glormph/msstitch
src/app/readers/tsv.py
get_psm
def get_psm(line, unroll=False, specfncol=None): """Returns from a PSM line peptide sequence, and other information about the PSM. Return values: specfn - str psm_id - str scan - str peptideseq - str score - str """ if sp...
python
def get_psm(line, unroll=False, specfncol=None): """Returns from a PSM line peptide sequence, and other information about the PSM. Return values: specfn - str psm_id - str scan - str peptideseq - str score - str """ if sp...
[ "def", "get_psm", "(", "line", ",", "unroll", "=", "False", ",", "specfncol", "=", "None", ")", ":", "if", "specfncol", "is", "None", ":", "specfncol", "=", "mzidtsvdata", ".", "HEADER_SPECFILE", "specfn", "=", "line", "[", "specfncol", "]", "psm_id", "=...
Returns from a PSM line peptide sequence, and other information about the PSM. Return values: specfn - str psm_id - str scan - str peptideseq - str score - str
[ "Returns", "from", "a", "PSM", "line", "peptide", "sequence", "and", "other", "information", "about", "the", "PSM", ".", "Return", "values", ":", "specfn", "-", "str", "psm_id", "-", "str", "scan", "-", "str", "peptideseq", "-", "str", "score", "-", "str...
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/tsv.py#L85-L102
train
Returns from a PSM line and other information about the PSM.
glormph/msstitch
src/app/readers/tsv.py
get_pepproteins
def get_pepproteins(line): """Returns from a PSM line peptide sequence, and other information about the PSM. Return values: psm_id - str proteins - list of str """ psm_id = get_psm_id(line) proteins = get_proteins_from_psm(line) return psm_id, proteins
python
def get_pepproteins(line): """Returns from a PSM line peptide sequence, and other information about the PSM. Return values: psm_id - str proteins - list of str """ psm_id = get_psm_id(line) proteins = get_proteins_from_psm(line) return psm_id, proteins
[ "def", "get_pepproteins", "(", "line", ")", ":", "psm_id", "=", "get_psm_id", "(", "line", ")", "proteins", "=", "get_proteins_from_psm", "(", "line", ")", "return", "psm_id", ",", "proteins" ]
Returns from a PSM line peptide sequence, and other information about the PSM. Return values: psm_id - str proteins - list of str
[ "Returns", "from", "a", "PSM", "line", "peptide", "sequence", "and", "other", "information", "about", "the", "PSM", ".", "Return", "values", ":", "psm_id", "-", "str", "proteins", "-", "list", "of", "str" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/tsv.py#L112-L121
train
Returns from a PSM line peptide sequence and other information about the PSM.
Erotemic/utool
utool/util_arg.py
aug_sysargv
def aug_sysargv(cmdstr): """ DEBUG FUNC modify argv to look like you ran a command """ import shlex argv = shlex.split(cmdstr) sys.argv.extend(argv)
python
def aug_sysargv(cmdstr): """ DEBUG FUNC modify argv to look like you ran a command """ import shlex argv = shlex.split(cmdstr) sys.argv.extend(argv)
[ "def", "aug_sysargv", "(", "cmdstr", ")", ":", "import", "shlex", "argv", "=", "shlex", ".", "split", "(", "cmdstr", ")", "sys", ".", "argv", ".", "extend", "(", "argv", ")" ]
DEBUG FUNC modify argv to look like you ran a command
[ "DEBUG", "FUNC", "modify", "argv", "to", "look", "like", "you", "ran", "a", "command" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L40-L44
train
Augment sys. argv with the command line arguments.
Erotemic/utool
utool/util_arg.py
get_module_verbosity_flags
def get_module_verbosity_flags(*labels): """ checks for standard flags for enableing module specific verbosity """ verbose_prefix_list = ['--verbose-', '--verb', '--verb-'] veryverbose_prefix_list = ['--veryverbose-', '--veryverb', '--veryverb-'] verbose_flags = tuple( [prefix + lbl for prefix, ...
python
def get_module_verbosity_flags(*labels): """ checks for standard flags for enableing module specific verbosity """ verbose_prefix_list = ['--verbose-', '--verb', '--verb-'] veryverbose_prefix_list = ['--veryverbose-', '--veryverb', '--veryverb-'] verbose_flags = tuple( [prefix + lbl for prefix, ...
[ "def", "get_module_verbosity_flags", "(", "*", "labels", ")", ":", "verbose_prefix_list", "=", "[", "'--verbose-'", ",", "'--verb'", ",", "'--verb-'", "]", "veryverbose_prefix_list", "=", "[", "'--veryverbose-'", ",", "'--veryverb'", ",", "'--veryverb-'", "]", "verb...
checks for standard flags for enableing module specific verbosity
[ "checks", "for", "standard", "flags", "for", "enableing", "module", "specific", "verbosity" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L48-L62
train
checks for standard flags for enableing module specific verbosity
Erotemic/utool
utool/util_arg.py
autogen_argparse_block
def autogen_argparse_block(extra_args=[]): """ SHOULD TURN ANY REGISTERED ARGS INTO A A NEW PARSING CONFIG FILE FOR BETTER --help COMMANDS import utool as ut __REGISTERED_ARGS__ = ut.util_arg.__REGISTERED_ARGS__ Args: extra_args (list): (default = []) CommandLine: python -...
python
def autogen_argparse_block(extra_args=[]): """ SHOULD TURN ANY REGISTERED ARGS INTO A A NEW PARSING CONFIG FILE FOR BETTER --help COMMANDS import utool as ut __REGISTERED_ARGS__ = ut.util_arg.__REGISTERED_ARGS__ Args: extra_args (list): (default = []) CommandLine: python -...
[ "def", "autogen_argparse_block", "(", "extra_args", "=", "[", "]", ")", ":", "#import utool as ut # NOQA", "#__REGISTERED_ARGS__", "# TODO FINISHME", "grouped_args", "=", "[", "]", "# Group similar a args", "for", "argtup", "in", "__REGISTERED_ARGS__", ":", "argstr_list"...
SHOULD TURN ANY REGISTERED ARGS INTO A A NEW PARSING CONFIG FILE FOR BETTER --help COMMANDS import utool as ut __REGISTERED_ARGS__ = ut.util_arg.__REGISTERED_ARGS__ Args: extra_args (list): (default = []) CommandLine: python -m utool.util_arg --test-autogen_argparse_block Exa...
[ "SHOULD", "TURN", "ANY", "REGISTERED", "ARGS", "INTO", "A", "A", "NEW", "PARSING", "CONFIG", "FILE", "FOR", "BETTER", "--", "help", "COMMANDS" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L79-L132
train
A function that automatically sets up the autocleaned - argument - set for each entry in the config file.
Erotemic/utool
utool/util_arg.py
get_argflag
def get_argflag(argstr_, default=False, help_='', return_specified=None, need_prefix=True, return_was_specified=False, argv=None, debug=None, **kwargs): """ Checks if the commandline has a flag or a corresponding noflag Args: argstr_ (str, list, or tu...
python
def get_argflag(argstr_, default=False, help_='', return_specified=None, need_prefix=True, return_was_specified=False, argv=None, debug=None, **kwargs): """ Checks if the commandline has a flag or a corresponding noflag Args: argstr_ (str, list, or tu...
[ "def", "get_argflag", "(", "argstr_", ",", "default", "=", "False", ",", "help_", "=", "''", ",", "return_specified", "=", "None", ",", "need_prefix", "=", "True", ",", "return_was_specified", "=", "False", ",", "argv", "=", "None", ",", "debug", "=", "N...
Checks if the commandline has a flag or a corresponding noflag Args: argstr_ (str, list, or tuple): the flag to look for default (bool): dont use this (default = False) help_ (str): a help string (default = '') return_specified (bool): returns if flag was specified or not (default =...
[ "Checks", "if", "the", "commandline", "has", "a", "flag", "or", "a", "corresponding", "noflag" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L135-L253
train
Get the value of a flag or a corresponding noflag
Erotemic/utool
utool/util_arg.py
get_argval
def get_argval(argstr_, type_=None, default=None, help_=None, smartcast=True, return_specified=None, argv=None, verbose=None, debug=None, return_was_specified=False, pos=None): r""" Returns a value of an argument specified on the command line after some flag Args: args...
python
def get_argval(argstr_, type_=None, default=None, help_=None, smartcast=True, return_specified=None, argv=None, verbose=None, debug=None, return_was_specified=False, pos=None): r""" Returns a value of an argument specified on the command line after some flag Args: args...
[ "def", "get_argval", "(", "argstr_", ",", "type_", "=", "None", ",", "default", "=", "None", ",", "help_", "=", "None", ",", "smartcast", "=", "True", ",", "return_specified", "=", "None", ",", "argv", "=", "None", ",", "verbose", "=", "None", ",", "...
r""" Returns a value of an argument specified on the command line after some flag Args: argstr_ (str or tuple): string or tuple of strings denoting the command line values to parse type_ (None): type of the variable to parse (default = None) default (None): (default = None) help...
[ "r", "Returns", "a", "value", "of", "an", "argument", "specified", "on", "the", "command", "line", "after", "some", "flag" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L260-L531
train
r Returns a value of an argument specified on the command line after some flag
Erotemic/utool
utool/util_arg.py
parse_cfgstr_list
def parse_cfgstr_list(cfgstr_list, smartcast=True, oldmode=True): r""" Parses a list of items in the format ['var1:val1', 'var2:val2', 'var3:val3'] the '=' character can be used instead of the ':' character if desired TODO: see ut.parse_cfgstr3 Args: cfgstr_list (list): Returns: ...
python
def parse_cfgstr_list(cfgstr_list, smartcast=True, oldmode=True): r""" Parses a list of items in the format ['var1:val1', 'var2:val2', 'var3:val3'] the '=' character can be used instead of the ':' character if desired TODO: see ut.parse_cfgstr3 Args: cfgstr_list (list): Returns: ...
[ "def", "parse_cfgstr_list", "(", "cfgstr_list", ",", "smartcast", "=", "True", ",", "oldmode", "=", "True", ")", ":", "cfgdict", "=", "{", "}", "for", "item", "in", "cfgstr_list", ":", "if", "item", "==", "''", ":", "continue", "if", "oldmode", ":", "k...
r""" Parses a list of items in the format ['var1:val1', 'var2:val2', 'var3:val3'] the '=' character can be used instead of the ':' character if desired TODO: see ut.parse_cfgstr3 Args: cfgstr_list (list): Returns: dict: cfgdict Example: >>> # ENABLE_DOCTEST ...
[ "r", "Parses", "a", "list", "of", "items", "in", "the", "format", "[", "var1", ":", "val1", "var2", ":", "val2", "var3", ":", "val3", "]", "the", "=", "character", "can", "be", "used", "instead", "of", "the", ":", "character", "if", "desired" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L535-L584
train
r Parses a list of items in the format var1 = val1 var2 = val2 var3 = val3 var4 = val1 var5 = val2 var6 = val1 var4 = val1 var5 = val2 var6 = val3 var6 = val1 var4 = val1 var5 = val2 var6 = val3
Erotemic/utool
utool/util_arg.py
get_arg_dict
def get_arg_dict(argv=None, prefix_list=['--'], type_hints={}): r""" Yet another way for parsing args CommandLine: python -m utool.util_arg --exec-get_arg_dict python -m utool.util_arg --test-get_arg_dict Example: >>> # ENABLE_DOCTEST >>> from utool.util_arg import * #...
python
def get_arg_dict(argv=None, prefix_list=['--'], type_hints={}): r""" Yet another way for parsing args CommandLine: python -m utool.util_arg --exec-get_arg_dict python -m utool.util_arg --test-get_arg_dict Example: >>> # ENABLE_DOCTEST >>> from utool.util_arg import * #...
[ "def", "get_arg_dict", "(", "argv", "=", "None", ",", "prefix_list", "=", "[", "'--'", "]", ",", "type_hints", "=", "{", "}", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "arg_dict", "=", "{", "}", "def", "startswith_...
r""" Yet another way for parsing args CommandLine: python -m utool.util_arg --exec-get_arg_dict python -m utool.util_arg --test-get_arg_dict Example: >>> # ENABLE_DOCTEST >>> from utool.util_arg import * # NOQA >>> import utool as ut >>> import shlex ...
[ "r", "Yet", "another", "way", "for", "parsing", "args" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L602-L671
train
r Get the dictionary of arguments for the current language.
Erotemic/utool
utool/util_arg.py
autogen_argparse2
def autogen_argparse2(dpath_list): r""" FUNCTION IS NOT FULLY IMPLEMENTED CURRENTLY ONLY RETURNS LIST OF FLAGS THAT THE PROGRAM SILENTLY TAKES Example: >>> # DISABLE_DOCTEST >>> from utool.util_arg import * # NOQA >>> import utool as ut >>> dpath_list = [ ... ...
python
def autogen_argparse2(dpath_list): r""" FUNCTION IS NOT FULLY IMPLEMENTED CURRENTLY ONLY RETURNS LIST OF FLAGS THAT THE PROGRAM SILENTLY TAKES Example: >>> # DISABLE_DOCTEST >>> from utool.util_arg import * # NOQA >>> import utool as ut >>> dpath_list = [ ... ...
[ "def", "autogen_argparse2", "(", "dpath_list", ")", ":", "import", "utool", "as", "ut", "import", "parse", "include_patterns", "=", "[", "'*.py'", "]", "regex_list", "=", "[", "'get_argflag'", ",", "'get_argval'", "]", "recursive", "=", "True", "result", "=", ...
r""" FUNCTION IS NOT FULLY IMPLEMENTED CURRENTLY ONLY RETURNS LIST OF FLAGS THAT THE PROGRAM SILENTLY TAKES Example: >>> # DISABLE_DOCTEST >>> from utool.util_arg import * # NOQA >>> import utool as ut >>> dpath_list = [ ... ut.truepath('~/code/utool/utool'), ...
[ "r" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L751-L819
train
r Automatically creates a new object of the same class and all of its attributes.
Erotemic/utool
utool/util_arg.py
argv_flag_dec
def argv_flag_dec(*argin, **kwargs): """ Decorators which control program flow based on sys.argv the decorated function does not execute without its corresponding flag Kwargs: default, quiet, indent, default ReturnKwargs: alias_flags """ kwargs = kwargs.copy() kwarg...
python
def argv_flag_dec(*argin, **kwargs): """ Decorators which control program flow based on sys.argv the decorated function does not execute without its corresponding flag Kwargs: default, quiet, indent, default ReturnKwargs: alias_flags """ kwargs = kwargs.copy() kwarg...
[ "def", "argv_flag_dec", "(", "*", "argin", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "kwargs", ".", "copy", "(", ")", "kwargs", "[", "'default'", "]", "=", "kwargs", ".", "get", "(", "'default'", ",", "False", ")", "from", "utool", "import", ...
Decorators which control program flow based on sys.argv the decorated function does not execute without its corresponding flag Kwargs: default, quiet, indent, default ReturnKwargs: alias_flags
[ "Decorators", "which", "control", "program", "flow", "based", "on", "sys", ".", "argv", "the", "decorated", "function", "does", "not", "execute", "without", "its", "corresponding", "flag" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L853-L878
train
Decorator for sys. argv
Erotemic/utool
utool/util_arg.py
__argv_flag_dec
def __argv_flag_dec(func, default=False, quiet=QUIET, indent=False): """ Logic for controlling if a function gets called based on command line """ from utool import util_decor flagname = meta_util_six.get_funcname(func) if flagname.find('no') == 0: flagname = flagname[2:] flags = ( ...
python
def __argv_flag_dec(func, default=False, quiet=QUIET, indent=False): """ Logic for controlling if a function gets called based on command line """ from utool import util_decor flagname = meta_util_six.get_funcname(func) if flagname.find('no') == 0: flagname = flagname[2:] flags = ( ...
[ "def", "__argv_flag_dec", "(", "func", ",", "default", "=", "False", ",", "quiet", "=", "QUIET", ",", "indent", "=", "False", ")", ":", "from", "utool", "import", "util_decor", "flagname", "=", "meta_util_six", ".", "get_funcname", "(", "func", ")", "if", ...
Logic for controlling if a function gets called based on command line
[ "Logic", "for", "controlling", "if", "a", "function", "gets", "called", "based", "on", "command", "line" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L885-L930
train
Decorator for controlling if a function gets called based on command line flags
Erotemic/utool
utool/util_arg.py
argparse_dict
def argparse_dict(default_dict_, lbl=None, verbose=None, only_specified=False, force_keys={}, type_hint=None, alias_dict={}): r""" Gets values for a dict based on the command line Args: default_dict_ (?): only_specified (bool): if True only returns keys t...
python
def argparse_dict(default_dict_, lbl=None, verbose=None, only_specified=False, force_keys={}, type_hint=None, alias_dict={}): r""" Gets values for a dict based on the command line Args: default_dict_ (?): only_specified (bool): if True only returns keys t...
[ "def", "argparse_dict", "(", "default_dict_", ",", "lbl", "=", "None", ",", "verbose", "=", "None", ",", "only_specified", "=", "False", ",", "force_keys", "=", "{", "}", ",", "type_hint", "=", "None", ",", "alias_dict", "=", "{", "}", ")", ":", "if", ...
r""" Gets values for a dict based on the command line Args: default_dict_ (?): only_specified (bool): if True only returns keys that are specified on commandline. no defaults. Returns: dict_: dict_ - a dictionary CommandLine: python -m utool.util_arg --test-argparse_d...
[ "r", "Gets", "values", "for", "a", "dict", "based", "on", "the", "command", "line" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L934-L1065
train
r Runs argparse s dict command line
Erotemic/utool
utool/util_arg.py
get_argv_tail
def get_argv_tail(scriptname, prefer_main=None, argv=None): r""" gets the rest of the arguments after a script has been invoked hack. accounts for python -m scripts. Args: scriptname (str): CommandLine: python -m utool.util_arg --test-get_argv_tail Example: >>> # ENABL...
python
def get_argv_tail(scriptname, prefer_main=None, argv=None): r""" gets the rest of the arguments after a script has been invoked hack. accounts for python -m scripts. Args: scriptname (str): CommandLine: python -m utool.util_arg --test-get_argv_tail Example: >>> # ENABL...
[ "def", "get_argv_tail", "(", "scriptname", ",", "prefer_main", "=", "None", ",", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "import", "utool", "as", "ut", "modname", "=", "ut", ".", "get_argval", ...
r""" gets the rest of the arguments after a script has been invoked hack. accounts for python -m scripts. Args: scriptname (str): CommandLine: python -m utool.util_arg --test-get_argv_tail Example: >>> # ENABLE_DOCTEST >>> from utool.util_arg import * # NOQA ...
[ "r", "gets", "the", "rest", "of", "the", "arguments", "after", "a", "script", "has", "been", "invoked", "hack", ".", "accounts", "for", "python", "-", "m", "scripts", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L1068-L1127
train
r Returns the rest of the arguments after a script has been invoked hack.
Erotemic/utool
utool/util_arg.py
get_cmdline_varargs
def get_cmdline_varargs(argv=None): """ Returns positional args specified directly after the scriptname and before any args starting with '-' on the commandline. """ if argv is None: argv = sys.argv scriptname = argv[0] if scriptname == '': # python invoked by iteself ...
python
def get_cmdline_varargs(argv=None): """ Returns positional args specified directly after the scriptname and before any args starting with '-' on the commandline. """ if argv is None: argv = sys.argv scriptname = argv[0] if scriptname == '': # python invoked by iteself ...
[ "def", "get_cmdline_varargs", "(", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "scriptname", "=", "argv", "[", "0", "]", "if", "scriptname", "==", "''", ":", "# python invoked by iteself", "pos_start", ...
Returns positional args specified directly after the scriptname and before any args starting with '-' on the commandline.
[ "Returns", "positional", "args", "specified", "directly", "after", "the", "scriptname", "and", "before", "any", "args", "starting", "with", "-", "on", "the", "commandline", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L1130-L1151
train
Returns positional args specified directly after the scriptname and before any args starting with - on the commandline.
Erotemic/utool
utool/util_arg.py
argval
def argval(key, default=None, type=None, smartcast=True, return_exists=False, argv=None): """ alias for get_argval Example: >>> # ENABLE_DOCTEST >>> import utool as ut >>> import sys >>> argv = ['--aids=[1,2,3]'] >>> value = ut.argval('--aids', default=[1,...
python
def argval(key, default=None, type=None, smartcast=True, return_exists=False, argv=None): """ alias for get_argval Example: >>> # ENABLE_DOCTEST >>> import utool as ut >>> import sys >>> argv = ['--aids=[1,2,3]'] >>> value = ut.argval('--aids', default=[1,...
[ "def", "argval", "(", "key", ",", "default", "=", "None", ",", "type", "=", "None", ",", "smartcast", "=", "True", ",", "return_exists", "=", "False", ",", "argv", "=", "None", ")", ":", "defaultable_types", "=", "(", "tuple", ",", "list", ",", "int"...
alias for get_argval Example: >>> # ENABLE_DOCTEST >>> import utool as ut >>> import sys >>> argv = ['--aids=[1,2,3]'] >>> value = ut.argval('--aids', default=[1, 2], argv=argv) >>> assert isinstance(value, list) >>> value2 = ut.argval('--aids', smartcast=Fal...
[ "alias", "for", "get_argval" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L1167-L1189
train
get_argval alias for get_argval
Erotemic/utool
utool/util_func.py
compose_functions
def compose_functions(*func_list): """ Referenes: https://mathieularose.com/function-composition-in-python/ """ def apply_composition(f, g): def compose(x): return f(g(x)) return compose composed_func = functools.reduce(apply_composition, func_list) return com...
python
def compose_functions(*func_list): """ Referenes: https://mathieularose.com/function-composition-in-python/ """ def apply_composition(f, g): def compose(x): return f(g(x)) return compose composed_func = functools.reduce(apply_composition, func_list) return com...
[ "def", "compose_functions", "(", "*", "func_list", ")", ":", "def", "apply_composition", "(", "f", ",", "g", ")", ":", "def", "compose", "(", "x", ")", ":", "return", "f", "(", "g", "(", "x", ")", ")", "return", "compose", "composed_func", "=", "func...
Referenes: https://mathieularose.com/function-composition-in-python/
[ "Referenes", ":", "https", ":", "//", "mathieularose", ".", "com", "/", "function", "-", "composition", "-", "in", "-", "python", "/" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_func.py#L8-L18
train
Compose a list of functions into one function.
Erotemic/utool
utool/_internal/meta_util_six.py
ensure_unicode
def ensure_unicode(str_): """ TODO: rob gp "isinstance\\(.*\\\\bstr\\\\b\\)" """ if isinstance(str_, __STR__): return str_ else: try: return __STR__(str_) except UnicodeDecodeError: if str_.startswith(codecs.BOM_UTF8): # Can saf...
python
def ensure_unicode(str_): """ TODO: rob gp "isinstance\\(.*\\\\bstr\\\\b\\)" """ if isinstance(str_, __STR__): return str_ else: try: return __STR__(str_) except UnicodeDecodeError: if str_.startswith(codecs.BOM_UTF8): # Can saf...
[ "def", "ensure_unicode", "(", "str_", ")", ":", "if", "isinstance", "(", "str_", ",", "__STR__", ")", ":", "return", "str_", "else", ":", "try", ":", "return", "__STR__", "(", "str_", ")", "except", "UnicodeDecodeError", ":", "if", "str_", ".", "startswi...
TODO: rob gp "isinstance\\(.*\\\\bstr\\\\b\\)"
[ "TODO", ":", "rob", "gp", "isinstance", "\\\\", "(", ".", "*", "\\\\\\\\", "bstr", "\\\\\\\\", "b", "\\\\", ")" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/meta_util_six.py#L123-L138
train
Ensure that the given string is unicode.
YuriyGuts/pygoose
pygoose/kg/eda.py
plot_real_feature
def plot_real_feature(df, feature_name, bins=50, figsize=(15, 15)): """ Plot the distribution of a real-valued feature conditioned by the target. Examples: `plot_real_feature(X, 'emb_mean_euclidean')` Args: df: Pandas dataframe containing the target column (named 'target'). fea...
python
def plot_real_feature(df, feature_name, bins=50, figsize=(15, 15)): """ Plot the distribution of a real-valued feature conditioned by the target. Examples: `plot_real_feature(X, 'emb_mean_euclidean')` Args: df: Pandas dataframe containing the target column (named 'target'). fea...
[ "def", "plot_real_feature", "(", "df", ",", "feature_name", ",", "bins", "=", "50", ",", "figsize", "=", "(", "15", ",", "15", ")", ")", ":", "ix_negative_target", "=", "df", "[", "df", ".", "target", "==", "0", "]", ".", "index", "ix_positive_target",...
Plot the distribution of a real-valued feature conditioned by the target. Examples: `plot_real_feature(X, 'emb_mean_euclidean')` Args: df: Pandas dataframe containing the target column (named 'target'). feature_name: The name of the feature to plot. bins: The number of histogra...
[ "Plot", "the", "distribution", "of", "a", "real", "-", "valued", "feature", "conditioned", "by", "the", "target", "." ]
4d9b8827c6d6c4b79949d1cd653393498c0bb3c2
https://github.com/YuriyGuts/pygoose/blob/4d9b8827c6d6c4b79949d1cd653393498c0bb3c2/pygoose/kg/eda.py#L6-L65
train
Plot the distribution of a real - valued feature conditioned by the target column.
YuriyGuts/pygoose
pygoose/kg/eda.py
plot_pair
def plot_pair(df, feature_name_1, feature_name_2, kind='scatter', alpha=0.01, **kwargs): """ Plot a scatterplot of two features against one another, and calculate Pearson correlation coefficient. Examples: `plot_pair(X, 'emb_mean_euclidean', 'emb_mean_cosine')` Args: df: fe...
python
def plot_pair(df, feature_name_1, feature_name_2, kind='scatter', alpha=0.01, **kwargs): """ Plot a scatterplot of two features against one another, and calculate Pearson correlation coefficient. Examples: `plot_pair(X, 'emb_mean_euclidean', 'emb_mean_cosine')` Args: df: fe...
[ "def", "plot_pair", "(", "df", ",", "feature_name_1", ",", "feature_name_2", ",", "kind", "=", "'scatter'", ",", "alpha", "=", "0.01", ",", "*", "*", "kwargs", ")", ":", "plt", ".", "figure", "(", ")", "sns", ".", "jointplot", "(", "feature_name_1", ",...
Plot a scatterplot of two features against one another, and calculate Pearson correlation coefficient. Examples: `plot_pair(X, 'emb_mean_euclidean', 'emb_mean_cosine')` Args: df: feature_name_1: The name of the first feature. feature_name_2: The name of the second feature. ...
[ "Plot", "a", "scatterplot", "of", "two", "features", "against", "one", "another", "and", "calculate", "Pearson", "correlation", "coefficient", "." ]
4d9b8827c6d6c4b79949d1cd653393498c0bb3c2
https://github.com/YuriyGuts/pygoose/blob/4d9b8827c6d6c4b79949d1cd653393498c0bb3c2/pygoose/kg/eda.py#L68-L94
train
Plot a scatterplot of two features against one another.
YuriyGuts/pygoose
pygoose/kg/eda.py
plot_feature_correlation_heatmap
def plot_feature_correlation_heatmap(df, features, font_size=9, figsize=(15, 15), save_filename=None): """ Plot a correlation heatmap between every feature pair. Args: df: Pandas dataframe containing the target column (named 'target'). features: The list of features to include in the correl...
python
def plot_feature_correlation_heatmap(df, features, font_size=9, figsize=(15, 15), save_filename=None): """ Plot a correlation heatmap between every feature pair. Args: df: Pandas dataframe containing the target column (named 'target'). features: The list of features to include in the correl...
[ "def", "plot_feature_correlation_heatmap", "(", "df", ",", "features", ",", "font_size", "=", "9", ",", "figsize", "=", "(", "15", ",", "15", ")", ",", "save_filename", "=", "None", ")", ":", "features", "=", "features", "[", ":", "]", "features", "+=", ...
Plot a correlation heatmap between every feature pair. Args: df: Pandas dataframe containing the target column (named 'target'). features: The list of features to include in the correlation plot. font_size: Font size for heatmap cells and axis labels. figsize: The size of the plot. ...
[ "Plot", "a", "correlation", "heatmap", "between", "every", "feature", "pair", "." ]
4d9b8827c6d6c4b79949d1cd653393498c0bb3c2
https://github.com/YuriyGuts/pygoose/blob/4d9b8827c6d6c4b79949d1cd653393498c0bb3c2/pygoose/kg/eda.py#L97-L138
train
Plot a correlation heatmap between each feature pair.
YuriyGuts/pygoose
pygoose/kg/eda.py
scatterplot_matrix
def scatterplot_matrix(df, features, downsample_frac=None, figsize=(15, 15)): """ Plot a scatterplot matrix for a list of features, colored by target value. Example: `scatterplot_matrix(X, X.columns.tolist(), downsample_frac=0.01)` Args: df: Pandas dataframe containing the target column (named...
python
def scatterplot_matrix(df, features, downsample_frac=None, figsize=(15, 15)): """ Plot a scatterplot matrix for a list of features, colored by target value. Example: `scatterplot_matrix(X, X.columns.tolist(), downsample_frac=0.01)` Args: df: Pandas dataframe containing the target column (named...
[ "def", "scatterplot_matrix", "(", "df", ",", "features", ",", "downsample_frac", "=", "None", ",", "figsize", "=", "(", "15", ",", "15", ")", ")", ":", "if", "downsample_frac", ":", "df", "=", "df", ".", "sample", "(", "frac", "=", "downsample_frac", "...
Plot a scatterplot matrix for a list of features, colored by target value. Example: `scatterplot_matrix(X, X.columns.tolist(), downsample_frac=0.01)` Args: df: Pandas dataframe containing the target column (named 'target'). features: The list of features to include in the correlation plot. ...
[ "Plot", "a", "scatterplot", "matrix", "for", "a", "list", "of", "features", "colored", "by", "target", "value", "." ]
4d9b8827c6d6c4b79949d1cd653393498c0bb3c2
https://github.com/YuriyGuts/pygoose/blob/4d9b8827c6d6c4b79949d1cd653393498c0bb3c2/pygoose/kg/eda.py#L141-L159
train
Plot a scatterplot matrix for a list of features colored by target value.
anayjoshi/platypus
platypus/frontend/grammar.py
p_stmt_cmp_eq
def p_stmt_cmp_eq(p): """stmt : VAR EQUALS value comparison_op value""" p[0] = ast.EqNode(ast.VariableNode(p[1]), ast.CmpExprNode(p[4], p[3], p[5]))
python
def p_stmt_cmp_eq(p): """stmt : VAR EQUALS value comparison_op value""" p[0] = ast.EqNode(ast.VariableNode(p[1]), ast.CmpExprNode(p[4], p[3], p[5]))
[ "def", "p_stmt_cmp_eq", "(", "p", ")", ":", "p", "[", "0", "]", "=", "ast", ".", "EqNode", "(", "ast", ".", "VariableNode", "(", "p", "[", "1", "]", ")", ",", "ast", ".", "CmpExprNode", "(", "p", "[", "4", "]", ",", "p", "[", "3", "]", ",",...
stmt : VAR EQUALS value comparison_op value
[ "stmt", ":", "VAR", "EQUALS", "value", "comparison_op", "value" ]
71712f58c99651efbd2e6dfd75a9b1228d42e9ef
https://github.com/anayjoshi/platypus/blob/71712f58c99651efbd2e6dfd75a9b1228d42e9ef/platypus/frontend/grammar.py#L56-L58
train
P Statement for comparison eq.
anayjoshi/platypus
platypus/frontend/grammar.py
p_stmt_ariarithh_eq
def p_stmt_ariarithh_eq(p): """stmt : VAR EQUALS value arithmetic_op value""" p[0] = ast.EqNode(ast.VariableNode(p[1]), ast.ArithExprNode(p[4], p[3], p[5]))
python
def p_stmt_ariarithh_eq(p): """stmt : VAR EQUALS value arithmetic_op value""" p[0] = ast.EqNode(ast.VariableNode(p[1]), ast.ArithExprNode(p[4], p[3], p[5]))
[ "def", "p_stmt_ariarithh_eq", "(", "p", ")", ":", "p", "[", "0", "]", "=", "ast", ".", "EqNode", "(", "ast", ".", "VariableNode", "(", "p", "[", "1", "]", ")", ",", "ast", ".", "ArithExprNode", "(", "p", "[", "4", "]", ",", "p", "[", "3", "]"...
stmt : VAR EQUALS value arithmetic_op value
[ "stmt", ":", "VAR", "EQUALS", "value", "arithmetic_op", "value" ]
71712f58c99651efbd2e6dfd75a9b1228d42e9ef
https://github.com/anayjoshi/platypus/blob/71712f58c99651efbd2e6dfd75a9b1228d42e9ef/platypus/frontend/grammar.py#L60-L62
train
P - statement ariarithh_eq
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.init_parser
def init_parser(self): """ Initializes the parser """ #self.token_list = None #self.prev_token_lists = None self.valid_children = dict() self.valid_children['lems'] = ['component', 'componenttype', 'target', 'include', ...
python
def init_parser(self): """ Initializes the parser """ #self.token_list = None #self.prev_token_lists = None self.valid_children = dict() self.valid_children['lems'] = ['component', 'componenttype', 'target', 'include', ...
[ "def", "init_parser", "(", "self", ")", ":", "#self.token_list = None", "#self.prev_token_lists = None", "self", ".", "valid_children", "=", "dict", "(", ")", "self", ".", "valid_children", "[", "'lems'", "]", "=", "[", "'component'", ",", "'componenttype'", ",", ...
Initializes the parser
[ "Initializes", "the", "parser" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L98-L229
train
Initializes the parser for the current locale.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.process_nested_tags
def process_nested_tags(self, node, tag = ''): """ Process child tags. @param node: Current node being parsed. @type node: xml.etree.Element @raise ParseError: Raised when an unexpected nested tag is found. """ ##print("---------Processing: %s, %s"%(node.tag,tag...
python
def process_nested_tags(self, node, tag = ''): """ Process child tags. @param node: Current node being parsed. @type node: xml.etree.Element @raise ParseError: Raised when an unexpected nested tag is found. """ ##print("---------Processing: %s, %s"%(node.tag,tag...
[ "def", "process_nested_tags", "(", "self", ",", "node", ",", "tag", "=", "''", ")", ":", "##print(\"---------Processing: %s, %s\"%(node.tag,tag))", "if", "tag", "==", "''", ":", "t", "=", "node", ".", "ltag", "else", ":", "t", "=", "tag", ".", "lower", "("...
Process child tags. @param node: Current node being parsed. @type node: xml.etree.Element @raise ParseError: Raised when an unexpected nested tag is found.
[ "Process", "child", "tags", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L232-L260
train
Process nested tags.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse
def parse(self, xmltext): """ Parse a string containing LEMS XML text. @param xmltext: String containing LEMS XML formatted text. @type xmltext: str """ xml = LEMSXMLNode(xe.XML(xmltext)) if xml.ltag != 'lems' and xml.ltag != 'neuroml': rais...
python
def parse(self, xmltext): """ Parse a string containing LEMS XML text. @param xmltext: String containing LEMS XML formatted text. @type xmltext: str """ xml = LEMSXMLNode(xe.XML(xmltext)) if xml.ltag != 'lems' and xml.ltag != 'neuroml': rais...
[ "def", "parse", "(", "self", ",", "xmltext", ")", ":", "xml", "=", "LEMSXMLNode", "(", "xe", ".", "XML", "(", "xmltext", ")", ")", "if", "xml", ".", "ltag", "!=", "'lems'", "and", "xml", ".", "ltag", "!=", "'neuroml'", ":", "raise", "ParseError", "...
Parse a string containing LEMS XML text. @param xmltext: String containing LEMS XML formatted text. @type xmltext: str
[ "Parse", "a", "string", "containing", "LEMS", "XML", "text", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L262-L280
train
Parse a string containing LEMS XML formatted text.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.raise_error
def raise_error(self, message, *params, **key_params): """ Raise a parse error. """ s = 'Parser error in ' self.xml_node_stack.reverse() if len(self.xml_node_stack) > 1: node = self.xml_node_stack[0] s += '<{0}'.format(node.tag) ...
python
def raise_error(self, message, *params, **key_params): """ Raise a parse error. """ s = 'Parser error in ' self.xml_node_stack.reverse() if len(self.xml_node_stack) > 1: node = self.xml_node_stack[0] s += '<{0}'.format(node.tag) ...
[ "def", "raise_error", "(", "self", ",", "message", ",", "*", "params", ",", "*", "*", "key_params", ")", ":", "s", "=", "'Parser error in '", "self", ".", "xml_node_stack", ".", "reverse", "(", ")", "if", "len", "(", "self", ".", "xml_node_stack", ")", ...
Raise a parse error.
[ "Raise", "a", "parse", "error", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L283-L312
train
Raise a parse error.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_attachments
def parse_attachments(self, node): """ Parses <Attachments> @param node: Node containing the <Attachments> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.raise_error('<Attachmen...
python
def parse_attachments(self, node): """ Parses <Attachments> @param node: Node containing the <Attachments> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.raise_error('<Attachmen...
[ "def", "parse_attachments", "(", "self", ",", "node", ")", ":", "if", "'name'", "in", "node", ".", "lattrib", ":", "name", "=", "node", ".", "lattrib", "[", "'name'", "]", "else", ":", "self", ".", "raise_error", "(", "'<Attachments> must specify a name.'", ...
Parses <Attachments> @param node: Node containing the <Attachments> element @type node: xml.etree.Element
[ "Parses", "<Attachments", ">" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L369-L389
train
Parses the attachments element and adds them to the current component type.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_child
def parse_child(self, node): """ Parses <Child> @param node: Node containing the <Child> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.raise_error('<Child> must specify a name....
python
def parse_child(self, node): """ Parses <Child> @param node: Node containing the <Child> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.raise_error('<Child> must specify a name....
[ "def", "parse_child", "(", "self", ",", "node", ")", ":", "if", "'name'", "in", "node", ".", "lattrib", ":", "name", "=", "node", ".", "lattrib", "[", "'name'", "]", "else", ":", "self", ".", "raise_error", "(", "'<Child> must specify a name.'", ")", "if...
Parses <Child> @param node: Node containing the <Child> element @type node: xml.etree.Element
[ "Parses", "<Child", ">" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L391-L409
train
Parses the child element of the current component type.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_child_instance
def parse_child_instance(self, node): """ Parses <ChildInstance> @param node: Node containing the <ChildInstance> element @type node: xml.etree.Element """ if 'component' in node.lattrib: component = node.lattrib['component'] else: self.r...
python
def parse_child_instance(self, node): """ Parses <ChildInstance> @param node: Node containing the <ChildInstance> element @type node: xml.etree.Element """ if 'component' in node.lattrib: component = node.lattrib['component'] else: self.r...
[ "def", "parse_child_instance", "(", "self", ",", "node", ")", ":", "if", "'component'", "in", "node", ".", "lattrib", ":", "component", "=", "node", ".", "lattrib", "[", "'component'", "]", "else", ":", "self", ".", "raise_error", "(", "'<ChildInstance> must...
Parses <ChildInstance> @param node: Node containing the <ChildInstance> element @type node: xml.etree.Element
[ "Parses", "<ChildInstance", ">" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L411-L424
train
Parses the ChildInstance element and adds it to the current structure.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_children
def parse_children(self, node): """ Parses <Children> @param node: Node containing the <Children> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.raise_error('<Children> must spe...
python
def parse_children(self, node): """ Parses <Children> @param node: Node containing the <Children> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.raise_error('<Children> must spe...
[ "def", "parse_children", "(", "self", ",", "node", ")", ":", "if", "'name'", "in", "node", ".", "lattrib", ":", "name", "=", "node", ".", "lattrib", "[", "'name'", "]", "else", ":", "self", ".", "raise_error", "(", "'<Children> must specify a name.'", ")",...
Parses <Children> @param node: Node containing the <Children> element @type node: xml.etree.Element
[ "Parses", "<Children", ">" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L426-L444
train
Parses the children of the current component type.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_component_by_typename
def parse_component_by_typename(self, node, type_): """ Parses components defined directly by component name. @param node: Node containing the <Component> element @type node: xml.etree.Element @param type_: Type of this component. @type type_: string @raise Par...
python
def parse_component_by_typename(self, node, type_): """ Parses components defined directly by component name. @param node: Node containing the <Component> element @type node: xml.etree.Element @param type_: Type of this component. @type type_: string @raise Par...
[ "def", "parse_component_by_typename", "(", "self", ",", "node", ",", "type_", ")", ":", "#print('Parsing component {0} by typename {1}'.format(node, type_))", "if", "'id'", "in", "node", ".", "lattrib", ":", "id_", "=", "node", ".", "lattrib", "[", "'id'", "]", "e...
Parses components defined directly by component name. @param node: Node containing the <Component> element @type node: xml.etree.Element @param type_: Type of this component. @type type_: string @raise ParseError: Raised when the component does not have an id.
[ "Parses", "components", "defined", "directly", "by", "component", "name", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L446-L486
train
Parses the component by typename.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_component
def parse_component(self, node): """ Parses <Component> @param node: Node containing the <Component> element @type node: xml.etree.Element """ if 'id' in node.lattrib: id_ = node.lattrib['id'] else: #self.raise_error('Component must have ...
python
def parse_component(self, node): """ Parses <Component> @param node: Node containing the <Component> element @type node: xml.etree.Element """ if 'id' in node.lattrib: id_ = node.lattrib['id'] else: #self.raise_error('Component must have ...
[ "def", "parse_component", "(", "self", ",", "node", ")", ":", "if", "'id'", "in", "node", ".", "lattrib", ":", "id_", "=", "node", ".", "lattrib", "[", "'id'", "]", "else", ":", "#self.raise_error('Component must have an id')", "id_", "=", "make_id", "(", ...
Parses <Component> @param node: Node containing the <Component> element @type node: xml.etree.Element
[ "Parses", "<Component", ">" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L488-L523
train
Parses the component element and stores the attributes in the current component object.
LEMS/pylems
lems/parser/LEMS.py
LEMSFileParser.parse_component_reference
def parse_component_reference(self, node): """ Parses <ComponentReference> @param node: Node containing the <ComponentTypeRef> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.rai...
python
def parse_component_reference(self, node): """ Parses <ComponentReference> @param node: Node containing the <ComponentTypeRef> element @type node: xml.etree.Element """ if 'name' in node.lattrib: name = node.lattrib['name'] else: self.rai...
[ "def", "parse_component_reference", "(", "self", ",", "node", ")", ":", "if", "'name'", "in", "node", ".", "lattrib", ":", "name", "=", "node", ".", "lattrib", "[", "'name'", "]", "else", ":", "self", ".", "raise_error", "(", "'<ComponentReference> must spec...
Parses <ComponentReference> @param node: Node containing the <ComponentTypeRef> element @type node: xml.etree.Element
[ "Parses", "<ComponentReference", ">" ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L525-L550
train
Parses the component reference element and adds it to the current component type.