repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
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", ")", ":", "\"Return a description of the key\"", "vk", ",", "scan", ",", "flags", "=", "self", ".", "_get_key_info", "(", ")", "desc", "=", "''", "if", "vk", ":", "if", "vk", "in", "CODE_NAMES", ":", "desc", "=", "C...
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
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", ")", ":", "\"Virtual keys have extended flag set\"", "if", "(", "(", "self", ".", "key", ">=", "33", "and", "self", ".", "key", "<=", "46", ")", "or", "(", "self", ".", "key", ">=", "91", "and", "self", ".", "key", ...
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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", "=", "{", "}", ")", ":", "r", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "arg_dict", "=", "{", "}", "def", "star...
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
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", "uti...
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
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
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", ")", ":", "r", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "import", "utool", "as", "ut", "modname", "=", "ut", ".", "get_argv...
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
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", "==", "''", ":", "pos_start", "=", "0", "pos_end", "=", ...
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
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
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
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
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
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
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", "=", "''", ")", ":", "if", "tag", "==", "''", ":", "t", "=", "node", ".", "ltag", "else", ":", "t", "=", "tag", ".", "lower", "(", ")", "for", "child", "in", "node", ".", "chil...
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
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
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
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_", ")", ":", "if", "'id'", "in", "node", ".", "lattrib", ":", "id_", "=", "node", ".", "lattrib", "[", "'id'", "]", "else", ":", "id_", "=", "node", ".", "tag", "if", "'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 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
glormph/msstitch
src/app/readers/xml.py
generate_tags_multiple_files
def generate_tags_multiple_files(input_files, tag, ignore_tags, ns=None): """ Calls xmltag generator for multiple files. """ return itertools.chain.from_iterable([generate_xmltags( fn, tag, ignore_tags, ns) for fn in input_files])
python
def generate_tags_multiple_files(input_files, tag, ignore_tags, ns=None): """ Calls xmltag generator for multiple files. """ return itertools.chain.from_iterable([generate_xmltags( fn, tag, ignore_tags, ns) for fn in input_files])
[ "def", "generate_tags_multiple_files", "(", "input_files", ",", "tag", ",", "ignore_tags", ",", "ns", "=", "None", ")", ":", "return", "itertools", ".", "chain", ".", "from_iterable", "(", "[", "generate_xmltags", "(", "fn", ",", "tag", ",", "ignore_tags", "...
Calls xmltag generator for multiple files.
[ "Calls", "xmltag", "generator", "for", "multiple", "files", "." ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/xml.py#L36-L41
train
glormph/msstitch
src/app/readers/xml.py
generate_tags_multiple_files_strings
def generate_tags_multiple_files_strings(input_files, ns, tag, ignore_tags): """ Creates stringified xml output of elements with certain tag. """ for el in generate_tags_multiple_files(input_files, tag, ignore_tags, ns): yield formatting.string_and_clear(el, ns)
python
def generate_tags_multiple_files_strings(input_files, ns, tag, ignore_tags): """ Creates stringified xml output of elements with certain tag. """ for el in generate_tags_multiple_files(input_files, tag, ignore_tags, ns): yield formatting.string_and_clear(el, ns)
[ "def", "generate_tags_multiple_files_strings", "(", "input_files", ",", "ns", ",", "tag", ",", "ignore_tags", ")", ":", "for", "el", "in", "generate_tags_multiple_files", "(", "input_files", ",", "tag", ",", "ignore_tags", ",", "ns", ")", ":", "yield", "formatti...
Creates stringified xml output of elements with certain tag.
[ "Creates", "stringified", "xml", "output", "of", "elements", "with", "certain", "tag", "." ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/xml.py#L44-L49
train
glormph/msstitch
src/app/readers/xml.py
generate_xmltags
def generate_xmltags(fn, returntag, ignore_tags, ns=None): """ Base generator for percolator xml psm, peptide, protein output, as well as for mzML, mzIdentML. ignore_tags are the ones that are cleared when met by parser. """ xmlns = create_namespace(ns) ns_ignore = ['{0}{1}'.format(xmlns, x)...
python
def generate_xmltags(fn, returntag, ignore_tags, ns=None): """ Base generator for percolator xml psm, peptide, protein output, as well as for mzML, mzIdentML. ignore_tags are the ones that are cleared when met by parser. """ xmlns = create_namespace(ns) ns_ignore = ['{0}{1}'.format(xmlns, x)...
[ "def", "generate_xmltags", "(", "fn", ",", "returntag", ",", "ignore_tags", ",", "ns", "=", "None", ")", ":", "xmlns", "=", "create_namespace", "(", "ns", ")", "ns_ignore", "=", "[", "'{0}{1}'", ".", "format", "(", "xmlns", ",", "x", ")", "for", "x", ...
Base generator for percolator xml psm, peptide, protein output, as well as for mzML, mzIdentML. ignore_tags are the ones that are cleared when met by parser.
[ "Base", "generator", "for", "percolator", "xml", "psm", "peptide", "protein", "output", "as", "well", "as", "for", "mzML", "mzIdentML", ".", "ignore_tags", "are", "the", "ones", "that", "are", "cleared", "when", "met", "by", "parser", "." ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/xml.py#L52-L64
train
LEMS/pylems
lems/model/model.py
Model.add_component_type
def add_component_type(self, component_type): """ Adds a component type to the model. @param component_type: Component type to be added. @type component_type: lems.model.fundamental.ComponentType """ name = component_type.name # To handle colons in names...
python
def add_component_type(self, component_type): """ Adds a component type to the model. @param component_type: Component type to be added. @type component_type: lems.model.fundamental.ComponentType """ name = component_type.name # To handle colons in names...
[ "def", "add_component_type", "(", "self", ",", "component_type", ")", ":", "name", "=", "component_type", ".", "name", "if", "':'", "in", "name", ":", "name", "=", "name", ".", "replace", "(", "':'", ",", "'_'", ")", "component_type", ".", "name", "=", ...
Adds a component type to the model. @param component_type: Component type to be added. @type component_type: lems.model.fundamental.ComponentType
[ "Adds", "a", "component", "type", "to", "the", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L140-L154
train
LEMS/pylems
lems/model/model.py
Model.add
def add(self, child): """ Adds a typed child object to the model. @param child: Child object to be added. """ if isinstance(child, Include): self.add_include(child) elif isinstance(child, Dimension): self.add_dimension(child) elif isinsta...
python
def add(self, child): """ Adds a typed child object to the model. @param child: Child object to be added. """ if isinstance(child, Include): self.add_include(child) elif isinstance(child, Dimension): self.add_dimension(child) elif isinsta...
[ "def", "add", "(", "self", ",", "child", ")", ":", "if", "isinstance", "(", "child", ",", "Include", ")", ":", "self", ".", "add_include", "(", "child", ")", "elif", "isinstance", "(", "child", ",", "Dimension", ")", ":", "self", ".", "add_dimension", ...
Adds a typed child object to the model. @param child: Child object to be added.
[ "Adds", "a", "typed", "child", "object", "to", "the", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L186-L208
train
LEMS/pylems
lems/model/model.py
Model.include_file
def include_file(self, path, include_dirs = []): """ Includes a file into the current model. @param path: Path to the file to be included. @type path: str @param include_dirs: Optional alternate include search path. @type include_dirs: list(str) """ if s...
python
def include_file(self, path, include_dirs = []): """ Includes a file into the current model. @param path: Path to the file to be included. @type path: str @param include_dirs: Optional alternate include search path. @type include_dirs: list(str) """ if s...
[ "def", "include_file", "(", "self", ",", "path", ",", "include_dirs", "=", "[", "]", ")", ":", "if", "self", ".", "include_includes", ":", "if", "self", ".", "debug", ":", "print", "(", "\"------------------ Including a file: %s\"", "%", "path"...
Includes a file into the current model. @param path: Path to the file to be included. @type path: str @param include_dirs: Optional alternate include search path. @type include_dirs: list(str)
[ "Includes", "a", "file", "into", "the", "current", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L220-L258
train
LEMS/pylems
lems/model/model.py
Model.import_from_file
def import_from_file(self, filepath): """ Import a model from a file. @param filepath: File to be imported. @type filepath: str """ inc_dirs = self.include_directories[:] inc_dirs.append(dirname(filepath)) parser = LEMSFi...
python
def import_from_file(self, filepath): """ Import a model from a file. @param filepath: File to be imported. @type filepath: str """ inc_dirs = self.include_directories[:] inc_dirs.append(dirname(filepath)) parser = LEMSFi...
[ "def", "import_from_file", "(", "self", ",", "filepath", ")", ":", "inc_dirs", "=", "self", ".", "include_directories", "[", ":", "]", "inc_dirs", ".", "append", "(", "dirname", "(", "filepath", ")", ")", "parser", "=", "LEMSFileParser", "(", "self", ",", ...
Import a model from a file. @param filepath: File to be imported. @type filepath: str
[ "Import", "a", "model", "from", "a", "file", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L260-L273
train
LEMS/pylems
lems/model/model.py
Model.export_to_dom
def export_to_dom(self): """ Exports this model to a DOM. """ namespaces = 'xmlns="http://www.neuroml.org/lems/%s" ' + \ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + \ 'xsi:schemaLocation="http://www.neuroml.org/lems/%s %s"' ...
python
def export_to_dom(self): """ Exports this model to a DOM. """ namespaces = 'xmlns="http://www.neuroml.org/lems/%s" ' + \ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + \ 'xsi:schemaLocation="http://www.neuroml.org/lems/%s %s"' ...
[ "def", "export_to_dom", "(", "self", ")", ":", "namespaces", "=", "'xmlns=\"http://www.neuroml.org/lems/%s\" '", "+", "'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" '", "+", "'xsi:schemaLocation=\"http://www.neuroml.org/lems/%s %s\"'", "namespaces", "=", "namespaces", "%",...
Exports this model to a DOM.
[ "Exports", "this", "model", "to", "a", "DOM", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L275-L311
train
LEMS/pylems
lems/model/model.py
Model.export_to_file
def export_to_file(self, filepath, level_prefix = ' '): """ Exports this model to a file. @param filepath: File to be exported to. @type filepath: str """ xmldom = self.export_to_dom() xmlstr = xmldom.toprettyxml(level_prefix, '\n',) f = open(filepath,...
python
def export_to_file(self, filepath, level_prefix = ' '): """ Exports this model to a file. @param filepath: File to be exported to. @type filepath: str """ xmldom = self.export_to_dom() xmlstr = xmldom.toprettyxml(level_prefix, '\n',) f = open(filepath,...
[ "def", "export_to_file", "(", "self", ",", "filepath", ",", "level_prefix", "=", "' '", ")", ":", "xmldom", "=", "self", ".", "export_to_dom", "(", ")", "xmlstr", "=", "xmldom", ".", "toprettyxml", "(", "level_prefix", ",", "'\\n'", ",", ")", "f", "=", ...
Exports this model to a file. @param filepath: File to be exported to. @type filepath: str
[ "Exports", "this", "model", "to", "a", "file", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L313-L326
train
LEMS/pylems
lems/model/model.py
Model.resolve
def resolve(self): """ Resolves references in this model. """ model = self.copy() for ct in model.component_types: model.resolve_component_type(ct) for c in model.components: if c.id not in model.fat_components: model.add...
python
def resolve(self): """ Resolves references in this model. """ model = self.copy() for ct in model.component_types: model.resolve_component_type(ct) for c in model.components: if c.id not in model.fat_components: model.add...
[ "def", "resolve", "(", "self", ")", ":", "model", "=", "self", ".", "copy", "(", ")", "for", "ct", "in", "model", ".", "component_types", ":", "model", ".", "resolve_component_type", "(", "ct", ")", "for", "c", "in", "model", ".", "components", ":", ...
Resolves references in this model.
[ "Resolves", "references", "in", "this", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L328-L347
train
LEMS/pylems
lems/model/model.py
Model.resolve_component_type
def resolve_component_type(self, component_type): """ Resolves references in the specified component type. @param component_type: Component type to be resolved. @type component_type: lems.model.component.ComponentType """ # Resolve component type from base types...
python
def resolve_component_type(self, component_type): """ Resolves references in the specified component type. @param component_type: Component type to be resolved. @type component_type: lems.model.component.ComponentType """ # Resolve component type from base types...
[ "def", "resolve_component_type", "(", "self", ",", "component_type", ")", ":", "if", "component_type", ".", "extends", ":", "try", ":", "base_ct", "=", "self", ".", "component_types", "[", "component_type", ".", "extends", "]", "except", ":", "raise", "ModelEr...
Resolves references in the specified component type. @param component_type: Component type to be resolved. @type component_type: lems.model.component.ComponentType
[ "Resolves", "references", "in", "the", "specified", "component", "type", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L349-L368
train
LEMS/pylems
lems/model/model.py
Model.merge_component_types
def merge_component_types(self, ct, base_ct): """ Merge various maps in the given component type from a base component type. @param ct: Component type to be resolved. @type ct: lems.model.component.ComponentType @param base_ct: Component type to be resolved. @t...
python
def merge_component_types(self, ct, base_ct): """ Merge various maps in the given component type from a base component type. @param ct: Component type to be resolved. @type ct: lems.model.component.ComponentType @param base_ct: Component type to be resolved. @t...
[ "def", "merge_component_types", "(", "self", ",", "ct", ",", "base_ct", ")", ":", "for", "parameter", "in", "base_ct", ".", "parameters", ":", "if", "parameter", ".", "name", "in", "ct", ".", "parameters", ":", "p", "=", "ct", ".", "parameters", "[", "...
Merge various maps in the given component type from a base component type. @param ct: Component type to be resolved. @type ct: lems.model.component.ComponentType @param base_ct: Component type to be resolved. @type base_ct: lems.model.component.ComponentType
[ "Merge", "various", "maps", "in", "the", "given", "component", "type", "from", "a", "base", "component", "type", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L370-L428
train
LEMS/pylems
lems/model/model.py
Model.resolve_simulation
def resolve_simulation(self, fc, ct): """ Resolve simulation specifications. """ for run in ct.simulation.runs: try: run2 = Run(fc.component_references[run.component].referenced_component, run.variable, fc...
python
def resolve_simulation(self, fc, ct): """ Resolve simulation specifications. """ for run in ct.simulation.runs: try: run2 = Run(fc.component_references[run.component].referenced_component, run.variable, fc...
[ "def", "resolve_simulation", "(", "self", ",", "fc", ",", "ct", ")", ":", "for", "run", "in", "ct", ".", "simulation", ".", "runs", ":", "try", ":", "run2", "=", "Run", "(", "fc", ".", "component_references", "[", "run", ".", "component", "]", ".", ...
Resolve simulation specifications.
[ "Resolve", "simulation", "specifications", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L728-L799
train
LEMS/pylems
lems/model/model.py
Model.get_numeric_value
def get_numeric_value(self, value_str, dimension = None): """ Get the numeric value for a parameter value specification. @param value_str: Value string @type value_str: str @param dimension: Dimension of the value @type dimension: str """ n = None ...
python
def get_numeric_value(self, value_str, dimension = None): """ Get the numeric value for a parameter value specification. @param value_str: Value string @type value_str: str @param dimension: Dimension of the value @type dimension: str """ n = None ...
[ "def", "get_numeric_value", "(", "self", ",", "value_str", ",", "dimension", "=", "None", ")", ":", "n", "=", "None", "i", "=", "len", "(", "value_str", ")", "while", "n", "is", "None", ":", "try", ":", "part", "=", "value_str", "[", "0", ":", "i",...
Get the numeric value for a parameter value specification. @param value_str: Value string @type value_str: str @param dimension: Dimension of the value @type dimension: str
[ "Get", "the", "numeric", "value", "for", "a", "parameter", "value", "specification", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L802-L849
train
glormph/msstitch
src/app/drivers/startup.py
start_msstitch
def start_msstitch(exec_drivers, sysargs): """Passed all drivers of executable, checks which command is passed to the executable and then gets the options for a driver, parses them from command line and runs the driver""" parser = populate_parser(exec_drivers) args = parser.parse_args(sysargs[1:]) ...
python
def start_msstitch(exec_drivers, sysargs): """Passed all drivers of executable, checks which command is passed to the executable and then gets the options for a driver, parses them from command line and runs the driver""" parser = populate_parser(exec_drivers) args = parser.parse_args(sysargs[1:]) ...
[ "def", "start_msstitch", "(", "exec_drivers", ",", "sysargs", ")", ":", "parser", "=", "populate_parser", "(", "exec_drivers", ")", "args", "=", "parser", ".", "parse_args", "(", "sysargs", "[", "1", ":", "]", ")", "args", ".", "func", "(", "**", "vars",...
Passed all drivers of executable, checks which command is passed to the executable and then gets the options for a driver, parses them from command line and runs the driver
[ "Passed", "all", "drivers", "of", "executable", "checks", "which", "command", "is", "passed", "to", "the", "executable", "and", "then", "gets", "the", "options", "for", "a", "driver", "parses", "them", "from", "command", "line", "and", "runs", "the", "driver...
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/drivers/startup.py#L47-L53
train
TriOptima/tri.struct
lib/tri/struct/__init__.py
merged
def merged(*dicts, **kwargs): """ Merge dictionaries. Later keys overwrite. .. code-block:: python merged(dict(a=1), dict(b=2), c=3, d=1) """ if not dicts: return Struct() result = dict() for d in dicts: result.update(d) result.update(kwargs) struct_type = ...
python
def merged(*dicts, **kwargs): """ Merge dictionaries. Later keys overwrite. .. code-block:: python merged(dict(a=1), dict(b=2), c=3, d=1) """ if not dicts: return Struct() result = dict() for d in dicts: result.update(d) result.update(kwargs) struct_type = ...
[ "def", "merged", "(", "*", "dicts", ",", "**", "kwargs", ")", ":", "if", "not", "dicts", ":", "return", "Struct", "(", ")", "result", "=", "dict", "(", ")", "for", "d", "in", "dicts", ":", "result", ".", "update", "(", "d", ")", "result", ".", ...
Merge dictionaries. Later keys overwrite. .. code-block:: python merged(dict(a=1), dict(b=2), c=3, d=1)
[ "Merge", "dictionaries", ".", "Later", "keys", "overwrite", "." ]
8886392da9cd77ce662e0781b0ff0bf82b38b56b
https://github.com/TriOptima/tri.struct/blob/8886392da9cd77ce662e0781b0ff0bf82b38b56b/lib/tri/struct/__init__.py#L60-L76
train
LEMS/pylems
lems/sim/build.py
order_derived_parameters
def order_derived_parameters(component): """ Finds ordering of derived_parameters. @param component: Component containing derived parameters. @type component: lems.model.component.Component @return: Returns ordered list of derived parameters. @rtype: list(string) @raise SimBuildError: Rai...
python
def order_derived_parameters(component): """ Finds ordering of derived_parameters. @param component: Component containing derived parameters. @type component: lems.model.component.Component @return: Returns ordered list of derived parameters. @rtype: list(string) @raise SimBuildError: Rai...
[ "def", "order_derived_parameters", "(", "component", ")", ":", "if", "len", "(", "component", ".", "derived_parameters", ")", "==", "0", ":", "return", "[", "]", "ordering", "=", "[", "]", "dps", "=", "[", "]", "for", "dp", "in", "component", ".", "der...
Finds ordering of derived_parameters. @param component: Component containing derived parameters. @type component: lems.model.component.Component @return: Returns ordered list of derived parameters. @rtype: list(string) @raise SimBuildError: Raised when a proper ordering of derived parameters ...
[ "Finds", "ordering", "of", "derived_parameters", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L1059-L1107
train
LEMS/pylems
lems/sim/build.py
order_derived_variables
def order_derived_variables(regime): """ Finds ordering of derived_variables. @param regime: Dynamics Regime containing derived variables. @type regime: lems.model.dynamics.regime @return: Returns ordered list of derived variables. @rtype: list(string) @raise SimBuildError: Raised when a ...
python
def order_derived_variables(regime): """ Finds ordering of derived_variables. @param regime: Dynamics Regime containing derived variables. @type regime: lems.model.dynamics.regime @return: Returns ordered list of derived variables. @rtype: list(string) @raise SimBuildError: Raised when a ...
[ "def", "order_derived_variables", "(", "regime", ")", ":", "ordering", "=", "[", "]", "dvs", "=", "[", "]", "dvsnoexp", "=", "[", "]", "maxcount", "=", "5", "for", "dv", "in", "regime", ".", "derived_variables", ":", "if", "dv", ".", "expression_tree", ...
Finds ordering of derived_variables. @param regime: Dynamics Regime containing derived variables. @type regime: lems.model.dynamics.regime @return: Returns ordered list of derived variables. @rtype: list(string) @raise SimBuildError: Raised when a proper ordering of derived variables could no...
[ "Finds", "ordering", "of", "derived_variables", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L1110-L1177
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build
def build(self): """ Build the simulation components from the model. @return: A runnable simulation object @rtype: lems.sim.sim.Simulation """ self.sim = Simulation() for component_id in self.model.targets: if component_id not in self.model.componen...
python
def build(self): """ Build the simulation components from the model. @return: A runnable simulation object @rtype: lems.sim.sim.Simulation """ self.sim = Simulation() for component_id in self.model.targets: if component_id not in self.model.componen...
[ "def", "build", "(", "self", ")", ":", "self", ".", "sim", "=", "Simulation", "(", ")", "for", "component_id", "in", "self", ".", "model", ".", "targets", ":", "if", "component_id", "not", "in", "self", ".", "model", ".", "components", ":", "raise", ...
Build the simulation components from the model. @return: A runnable simulation object @rtype: lems.sim.sim.Simulation
[ "Build", "the", "simulation", "components", "from", "the", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L47-L66
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_event_connections
def build_event_connections(self, component, runnable, structure): """ Adds event connections to a runnable component based on the structure specifications in the component model. @param component: Component model containing structure specifications. @type component: lems.model....
python
def build_event_connections(self, component, runnable, structure): """ Adds event connections to a runnable component based on the structure specifications in the component model. @param component: Component model containing structure specifications. @type component: lems.model....
[ "def", "build_event_connections", "(", "self", ",", "component", ",", "runnable", ",", "structure", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"\\n++++++++ Calling build_event_connections of %s with runnable %s, parent %s\"", "%", "(", "component", ".", ...
Adds event connections to a runnable component based on the structure specifications in the component model. @param component: Component model containing structure specifications. @type component: lems.model.component.FatComponent @param runnable: Runnable component to which structure ...
[ "Adds", "event", "connections", "to", "a", "runnable", "component", "based", "on", "the", "structure", "specifications", "in", "the", "component", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L231-L289
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_structure
def build_structure(self, component, runnable, structure): """ Adds structure to a runnable component based on the structure specifications in the component model. @param component: Component model containing structure specifications. @type component: lems.model.component.FatCom...
python
def build_structure(self, component, runnable, structure): """ Adds structure to a runnable component based on the structure specifications in the component model. @param component: Component model containing structure specifications. @type component: lems.model.component.FatCom...
[ "def", "build_structure", "(", "self", ",", "component", ",", "runnable", ",", "structure", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"\\n++++++++ Calling build_structure of %s with runnable %s, parent %s\"", "%", "(", "component", ".", "id", ",", ...
Adds structure to a runnable component based on the structure specifications in the component model. @param component: Component model containing structure specifications. @type component: lems.model.component.FatComponent @param runnable: Runnable component to which structure is to be...
[ "Adds", "structure", "to", "a", "runnable", "component", "based", "on", "the", "structure", "specifications", "in", "the", "component", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L293-L334
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_foreach
def build_foreach(self, component, runnable, foreach, name_mappings = {}): """ Iterate over ForEach constructs and process nested elements. @param component: Component model containing structure specifications. @type component: lems.model.component.FatComponent @param runnable:...
python
def build_foreach(self, component, runnable, foreach, name_mappings = {}): """ Iterate over ForEach constructs and process nested elements. @param component: Component model containing structure specifications. @type component: lems.model.component.FatComponent @param runnable:...
[ "def", "build_foreach", "(", "self", ",", "component", ",", "runnable", ",", "foreach", ",", "name_mappings", "=", "{", "}", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"\\n++++++++ Calling build_foreach of %s with runnable %s, parent %s, name_mappings:...
Iterate over ForEach constructs and process nested elements. @param component: Component model containing structure specifications. @type component: lems.model.component.FatComponent @param runnable: Runnable component to which structure is to be added. @type runnable: lems.sim.runnabl...
[ "Iterate", "over", "ForEach", "constructs", "and", "process", "nested", "elements", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L338-L394
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.process_simulation_specs
def process_simulation_specs(self, component, runnable, simulation): """ Process simulation-related aspects to a runnable component based on the dynamics specifications in the component model. @param component: Component model containing dynamics specifications. @type component:...
python
def process_simulation_specs(self, component, runnable, simulation): """ Process simulation-related aspects to a runnable component based on the dynamics specifications in the component model. @param component: Component model containing dynamics specifications. @type component:...
[ "def", "process_simulation_specs", "(", "self", ",", "component", ",", "runnable", ",", "simulation", ")", ":", "for", "run", "in", "simulation", ".", "runs", ":", "cid", "=", "run", ".", "component", ".", "id", "+", "'_'", "+", "component", ".", "id", ...
Process simulation-related aspects to a runnable component based on the dynamics specifications in the component model. @param component: Component model containing dynamics specifications. @type component: lems.model.component.FatComponent @param runnable: Runnable component to which ...
[ "Process", "simulation", "-", "related", "aspects", "to", "a", "runnable", "component", "based", "on", "the", "dynamics", "specifications", "in", "the", "component", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L606-L640
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_expression_from_tree
def build_expression_from_tree(self, runnable, regime, tree_node): """ Recursively builds a Python expression from a parsed expression tree. @param runnable: Runnable object to which this expression would be added. @type runnable: lems.sim.runnable.Runnable @param regime: Dynam...
python
def build_expression_from_tree(self, runnable, regime, tree_node): """ Recursively builds a Python expression from a parsed expression tree. @param runnable: Runnable object to which this expression would be added. @type runnable: lems.sim.runnable.Runnable @param regime: Dynam...
[ "def", "build_expression_from_tree", "(", "self", ",", "runnable", ",", "regime", ",", "tree_node", ")", ":", "component_type", "=", "self", ".", "model", ".", "component_types", "[", "runnable", ".", "component", ".", "type", "]", "dynamics", "=", "component_...
Recursively builds a Python expression from a parsed expression tree. @param runnable: Runnable object to which this expression would be added. @type runnable: lems.sim.runnable.Runnable @param regime: Dynamics regime being built. @type regime: lems.model.dynamics.Regime @para...
[ "Recursively", "builds", "a", "Python", "expression", "from", "a", "parsed", "expression", "tree", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L703-L767
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_event_handler
def build_event_handler(self, runnable, regime, event_handler): """ Build event handler code. @param event_handler: Event handler object @type event_handler: lems.model.dynamics.EventHandler @return: Generated event handler code. @rtype: list(string) """ ...
python
def build_event_handler(self, runnable, regime, event_handler): """ Build event handler code. @param event_handler: Event handler object @type event_handler: lems.model.dynamics.EventHandler @return: Generated event handler code. @rtype: list(string) """ ...
[ "def", "build_event_handler", "(", "self", ",", "runnable", ",", "regime", ",", "event_handler", ")", ":", "if", "isinstance", "(", "event_handler", ",", "OnCondition", ")", ":", "return", "self", ".", "build_on_condition", "(", "runnable", ",", "regime", ",",...
Build event handler code. @param event_handler: Event handler object @type event_handler: lems.model.dynamics.EventHandler @return: Generated event handler code. @rtype: list(string)
[ "Build", "event", "handler", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L769-L789
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_on_condition
def build_on_condition(self, runnable, regime, on_condition): """ Build OnCondition event handler code. @param on_condition: OnCondition event handler object @type on_condition: lems.model.dynamics.OnCondition @return: Generated OnCondition code @rtype: list(string) ...
python
def build_on_condition(self, runnable, regime, on_condition): """ Build OnCondition event handler code. @param on_condition: OnCondition event handler object @type on_condition: lems.model.dynamics.OnCondition @return: Generated OnCondition code @rtype: list(string) ...
[ "def", "build_on_condition", "(", "self", ",", "runnable", ",", "regime", ",", "on_condition", ")", ":", "on_condition_code", "=", "[", "]", "on_condition_code", "+=", "[", "'if {0}:'", ".", "format", "(", "self", ".", "build_expression_from_tree", "(", "runnabl...
Build OnCondition event handler code. @param on_condition: OnCondition event handler object @type on_condition: lems.model.dynamics.OnCondition @return: Generated OnCondition code @rtype: list(string)
[ "Build", "OnCondition", "event", "handler", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L791-L814
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_on_event
def build_on_event(self, runnable, regime, on_event): """ Build OnEvent event handler code. @param on_event: OnEvent event handler object @type on_event: lems.model.dynamics.OnEvent @return: Generated OnEvent code @rtype: list(string) """ on_event_code =...
python
def build_on_event(self, runnable, regime, on_event): """ Build OnEvent event handler code. @param on_event: OnEvent event handler object @type on_event: lems.model.dynamics.OnEvent @return: Generated OnEvent code @rtype: list(string) """ on_event_code =...
[ "def", "build_on_event", "(", "self", ",", "runnable", ",", "regime", ",", "on_event", ")", ":", "on_event_code", "=", "[", "]", "if", "self", ".", "debug", ":", "on_event_code", "+=", "[", "'print(\"Maybe handling something for %s (\"+str(id(self))+\")\")'", "%", ...
Build OnEvent event handler code. @param on_event: OnEvent event handler object @type on_event: lems.model.dynamics.OnEvent @return: Generated OnEvent code @rtype: list(string)
[ "Build", "OnEvent", "event", "handler", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L816-L844
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_on_start
def build_on_start(self, runnable, regime, on_start): """ Build OnStart start handler code. @param on_start: OnStart start handler object @type on_start: lems.model.dynamics.OnStart @return: Generated OnStart code @rtype: list(string) """ on_start_code ...
python
def build_on_start(self, runnable, regime, on_start): """ Build OnStart start handler code. @param on_start: OnStart start handler object @type on_start: lems.model.dynamics.OnStart @return: Generated OnStart code @rtype: list(string) """ on_start_code ...
[ "def", "build_on_start", "(", "self", ",", "runnable", ",", "regime", ",", "on_start", ")", ":", "on_start_code", "=", "[", "]", "for", "action", "in", "on_start", ".", "actions", ":", "code", "=", "self", ".", "build_action", "(", "runnable", ",", "regi...
Build OnStart start handler code. @param on_start: OnStart start handler object @type on_start: lems.model.dynamics.OnStart @return: Generated OnStart code @rtype: list(string)
[ "Build", "OnStart", "start", "handler", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L846-L864
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_on_entry
def build_on_entry(self, runnable, regime, on_entry): """ Build OnEntry start handler code. @param on_entry: OnEntry start handler object @type on_entry: lems.model.dynamics.OnEntry @return: Generated OnEntry code @rtype: list(string) """ on_entry_code ...
python
def build_on_entry(self, runnable, regime, on_entry): """ Build OnEntry start handler code. @param on_entry: OnEntry start handler object @type on_entry: lems.model.dynamics.OnEntry @return: Generated OnEntry code @rtype: list(string) """ on_entry_code ...
[ "def", "build_on_entry", "(", "self", ",", "runnable", ",", "regime", ",", "on_entry", ")", ":", "on_entry_code", "=", "[", "]", "on_entry_code", "+=", "[", "'if self.current_regime != self.last_regime:'", "]", "on_entry_code", "+=", "[", "' self.last_regime = self...
Build OnEntry start handler code. @param on_entry: OnEntry start handler object @type on_entry: lems.model.dynamics.OnEntry @return: Generated OnEntry code @rtype: list(string)
[ "Build", "OnEntry", "start", "handler", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L866-L887
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_action
def build_action(self, runnable, regime, action): """ Build event handler action code. @param action: Event handler action object @type action: lems.model.dynamics.Action @return: Generated action code @rtype: string """ if isinstance(action, StateAssig...
python
def build_action(self, runnable, regime, action): """ Build event handler action code. @param action: Event handler action object @type action: lems.model.dynamics.Action @return: Generated action code @rtype: string """ if isinstance(action, StateAssig...
[ "def", "build_action", "(", "self", ",", "runnable", ",", "regime", ",", "action", ")", ":", "if", "isinstance", "(", "action", ",", "StateAssignment", ")", ":", "return", "self", ".", "build_state_assignment", "(", "runnable", ",", "regime", ",", "action", ...
Build event handler action code. @param action: Event handler action object @type action: lems.model.dynamics.Action @return: Generated action code @rtype: string
[ "Build", "event", "handler", "action", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L889-L907
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_state_assignment
def build_state_assignment(self, runnable, regime, state_assignment): """ Build state assignment code. @param state_assignment: State assignment object @type state_assignment: lems.model.dynamics.StateAssignment @return: Generated state assignment code @rtype: string ...
python
def build_state_assignment(self, runnable, regime, state_assignment): """ Build state assignment code. @param state_assignment: State assignment object @type state_assignment: lems.model.dynamics.StateAssignment @return: Generated state assignment code @rtype: string ...
[ "def", "build_state_assignment", "(", "self", ",", "runnable", ",", "regime", ",", "state_assignment", ")", ":", "return", "[", "'self.{0} = {1}'", ".", "format", "(", "state_assignment", ".", "variable", ",", "self", ".", "build_expression_from_tree", "(", "runna...
Build state assignment code. @param state_assignment: State assignment object @type state_assignment: lems.model.dynamics.StateAssignment @return: Generated state assignment code @rtype: string
[ "Build", "state", "assignment", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L909-L924
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_event_out
def build_event_out(self, event_out): """ Build event out code. @param event_out: event out object @type event_out: lems.model.dynamics.EventOut @return: Generated event out code @rtype: string """ event_out_code = ['if "{0}" in self.event_out_callbacks...
python
def build_event_out(self, event_out): """ Build event out code. @param event_out: event out object @type event_out: lems.model.dynamics.EventOut @return: Generated event out code @rtype: string """ event_out_code = ['if "{0}" in self.event_out_callbacks...
[ "def", "build_event_out", "(", "self", ",", "event_out", ")", ":", "event_out_code", "=", "[", "'if \"{0}\" in self.event_out_callbacks:'", ".", "format", "(", "event_out", ".", "port", ")", ",", "' for c in self.event_out_callbacks[\\'{0}\\']:'", ".", "format", "(",...
Build event out code. @param event_out: event out object @type event_out: lems.model.dynamics.EventOut @return: Generated event out code @rtype: string
[ "Build", "event", "out", "code", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L926-L941
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.build_reduce_code
def build_reduce_code(self, result, select, reduce): """ Builds a reduce operation on the selected target range. """ select = select.replace('/', '.') select = select.replace(' ', '') if reduce == 'add': reduce_op = '+' acc_start = 0 else:...
python
def build_reduce_code(self, result, select, reduce): """ Builds a reduce operation on the selected target range. """ select = select.replace('/', '.') select = select.replace(' ', '') if reduce == 'add': reduce_op = '+' acc_start = 0 else:...
[ "def", "build_reduce_code", "(", "self", ",", "result", ",", "select", ",", "reduce", ")", ":", "select", "=", "select", ".", "replace", "(", "'/'", ",", "'.'", ")", "select", "=", "select", ".", "replace", "(", "' '", ",", "''", ")", "if", "reduce",...
Builds a reduce operation on the selected target range.
[ "Builds", "a", "reduce", "operation", "on", "the", "selected", "target", "range", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L956-L1015
train
LEMS/pylems
lems/sim/build.py
SimulationBuilder.add_recording_behavior
def add_recording_behavior(self, component, runnable): """ Adds recording-related dynamics to a runnable component based on the dynamics specifications in the component model. @param component: Component model containing dynamics specifications. @type component: lems.model.compo...
python
def add_recording_behavior(self, component, runnable): """ Adds recording-related dynamics to a runnable component based on the dynamics specifications in the component model. @param component: Component model containing dynamics specifications. @type component: lems.model.compo...
[ "def", "add_recording_behavior", "(", "self", ",", "component", ",", "runnable", ")", ":", "simulation", "=", "component", ".", "simulation", "for", "rec", "in", "simulation", ".", "records", ":", "rec", ".", "id", "=", "runnable", ".", "id", "self", ".", ...
Adds recording-related dynamics to a runnable component based on the dynamics specifications in the component model. @param component: Component model containing dynamics specifications. @type component: lems.model.component.FatComponent runnable: Runnable component to which dynamics is to be a...
[ "Adds", "recording", "-", "related", "dynamics", "to", "a", "runnable", "component", "based", "on", "the", "dynamics", "specifications", "in", "the", "component", "model", "." ]
4eeb719d2f23650fe16c38626663b69b5c83818b
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L1038-L1055
train
Erotemic/utool
utool/util_inspect.py
check_static_member_vars
def check_static_member_vars(class_, fpath=None, only_init=True): """ class_ can either be live object or a classname # fpath = ut.truepath('~/code/ibeis/ibeis/viz/viz_graph2.py') # classname = 'AnnotGraphWidget' """ #import ast #import astor import utool as ut if isinstance(class_...
python
def check_static_member_vars(class_, fpath=None, only_init=True): """ class_ can either be live object or a classname # fpath = ut.truepath('~/code/ibeis/ibeis/viz/viz_graph2.py') # classname = 'AnnotGraphWidget' """ #import ast #import astor import utool as ut if isinstance(class_...
[ "def", "check_static_member_vars", "(", "class_", ",", "fpath", "=", "None", ",", "only_init", "=", "True", ")", ":", "import", "utool", "as", "ut", "if", "isinstance", "(", "class_", ",", "six", ".", "string_types", ")", ":", "classname", "=", "class_", ...
class_ can either be live object or a classname # fpath = ut.truepath('~/code/ibeis/ibeis/viz/viz_graph2.py') # classname = 'AnnotGraphWidget'
[ "class_", "can", "either", "be", "live", "object", "or", "a", "classname" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L194-L296
train
Erotemic/utool
utool/util_inspect.py
get_funcnames_from_modpath
def get_funcnames_from_modpath(modpath, include_methods=True): """ Get all functions defined in module """ import utool as ut if True: import jedi source = ut.read_from(modpath) #script = jedi.Script(source=source, source_path=modpath, line=source.count('\n') + 1) def...
python
def get_funcnames_from_modpath(modpath, include_methods=True): """ Get all functions defined in module """ import utool as ut if True: import jedi source = ut.read_from(modpath) #script = jedi.Script(source=source, source_path=modpath, line=source.count('\n') + 1) def...
[ "def", "get_funcnames_from_modpath", "(", "modpath", ",", "include_methods", "=", "True", ")", ":", "import", "utool", "as", "ut", "if", "True", ":", "import", "jedi", "source", "=", "ut", ".", "read_from", "(", "modpath", ")", "definition_list", "=", "jedi"...
Get all functions defined in module
[ "Get", "all", "functions", "defined", "in", "module" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L311-L334
train
Erotemic/utool
utool/util_inspect.py
help_members
def help_members(obj, use_other=False): r""" Inspects members of a class Args: obj (class or module): CommandLine: python -m utool.util_inspect help_members Example: >>> # ENABLE_DOCTEST >>> from utool.util_inspect import * # NOQA >>> import utool as ut ...
python
def help_members(obj, use_other=False): r""" Inspects members of a class Args: obj (class or module): CommandLine: python -m utool.util_inspect help_members Example: >>> # ENABLE_DOCTEST >>> from utool.util_inspect import * # NOQA >>> import utool as ut ...
[ "def", "help_members", "(", "obj", ",", "use_other", "=", "False", ")", ":", "r", "import", "utool", "as", "ut", "attrnames", "=", "dir", "(", "obj", ")", "attr_list", "=", "[", "getattr", "(", "obj", ",", "attrname", ")", "for", "attrname", "in", "a...
r""" Inspects members of a class Args: obj (class or module): CommandLine: python -m utool.util_inspect help_members Example: >>> # ENABLE_DOCTEST >>> from utool.util_inspect import * # NOQA >>> import utool as ut >>> obj = ut.DynStruct >>> res...
[ "r", "Inspects", "members", "of", "a", "class" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L569-L621
train
Erotemic/utool
utool/util_inspect.py
is_defined_by_module
def is_defined_by_module(item, module, parent=None): """ Check if item is directly defined by a module. This check may be prone to errors. """ flag = False if isinstance(item, types.ModuleType): if not hasattr(item, '__file__'): try: # hack for cv2 and xfeatur...
python
def is_defined_by_module(item, module, parent=None): """ Check if item is directly defined by a module. This check may be prone to errors. """ flag = False if isinstance(item, types.ModuleType): if not hasattr(item, '__file__'): try: # hack for cv2 and xfeatur...
[ "def", "is_defined_by_module", "(", "item", ",", "module", ",", "parent", "=", "None", ")", ":", "flag", "=", "False", "if", "isinstance", "(", "item", ",", "types", ".", "ModuleType", ")", ":", "if", "not", "hasattr", "(", "item", ",", "'__file__'", "...
Check if item is directly defined by a module. This check may be prone to errors.
[ "Check", "if", "item", "is", "directly", "defined", "by", "a", "module", ".", "This", "check", "may", "be", "prone", "to", "errors", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1052-L1101
train
Erotemic/utool
utool/util_inspect.py
is_bateries_included
def is_bateries_included(item): """ Returns if a value is a python builtin function Args: item (object): Returns: bool: flag References: http://stackoverflow.com/questions/23149218/check-if-a-python-function-is-builtin CommandLine: python -m utool._internal.me...
python
def is_bateries_included(item): """ Returns if a value is a python builtin function Args: item (object): Returns: bool: flag References: http://stackoverflow.com/questions/23149218/check-if-a-python-function-is-builtin CommandLine: python -m utool._internal.me...
[ "def", "is_bateries_included", "(", "item", ")", ":", "flag", "=", "False", "if", "hasattr", "(", "item", ",", "'__call__'", ")", "and", "hasattr", "(", "item", ",", "'__module__'", ")", ":", "if", "item", ".", "__module__", "is", "not", "None", ":", "...
Returns if a value is a python builtin function Args: item (object): Returns: bool: flag References: http://stackoverflow.com/questions/23149218/check-if-a-python-function-is-builtin CommandLine: python -m utool._internal.meta_util_six is_builtin Example: ...
[ "Returns", "if", "a", "value", "is", "a", "python", "builtin", "function" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1118-L1150
train
Erotemic/utool
utool/util_inspect.py
dummy_func
def dummy_func(arg1, arg2, arg3=None, arg4=[1, 2, 3], arg5={}, **kwargs): """ test func for kwargs parseing """ foo = kwargs.get('foo', None) bar = kwargs.pop('bar', 4) foo2 = kwargs['foo2'] foobar = str(foo) + str(bar) + str(foo2) return foobar
python
def dummy_func(arg1, arg2, arg3=None, arg4=[1, 2, 3], arg5={}, **kwargs): """ test func for kwargs parseing """ foo = kwargs.get('foo', None) bar = kwargs.pop('bar', 4) foo2 = kwargs['foo2'] foobar = str(foo) + str(bar) + str(foo2) return foobar
[ "def", "dummy_func", "(", "arg1", ",", "arg2", ",", "arg3", "=", "None", ",", "arg4", "=", "[", "1", ",", "2", ",", "3", "]", ",", "arg5", "=", "{", "}", ",", "**", "kwargs", ")", ":", "foo", "=", "kwargs", ".", "get", "(", "'foo'", ",", "N...
test func for kwargs parseing
[ "test", "func", "for", "kwargs", "parseing" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1261-L1269
train
Erotemic/utool
utool/util_inspect.py
get_docstr
def get_docstr(func_or_class): """ Get the docstring from a live object """ import utool as ut try: docstr_ = func_or_class.func_doc except AttributeError: docstr_ = func_or_class.__doc__ if docstr_ is None: docstr_ = '' docstr = ut.unindent(docstr_) return docstr
python
def get_docstr(func_or_class): """ Get the docstring from a live object """ import utool as ut try: docstr_ = func_or_class.func_doc except AttributeError: docstr_ = func_or_class.__doc__ if docstr_ is None: docstr_ = '' docstr = ut.unindent(docstr_) return docstr
[ "def", "get_docstr", "(", "func_or_class", ")", ":", "import", "utool", "as", "ut", "try", ":", "docstr_", "=", "func_or_class", ".", "func_doc", "except", "AttributeError", ":", "docstr_", "=", "func_or_class", ".", "__doc__", "if", "docstr_", "is", "None", ...
Get the docstring from a live object
[ "Get", "the", "docstring", "from", "a", "live", "object" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1354-L1364
train
Erotemic/utool
utool/util_inspect.py
find_funcs_called_with_kwargs
def find_funcs_called_with_kwargs(sourcecode, target_kwargs_name='kwargs'): r""" Finds functions that are called with the keyword `kwargs` variable CommandLine: python3 -m utool.util_inspect find_funcs_called_with_kwargs Example: >>> # ENABLE_DOCTEST >>> import utool as ut ...
python
def find_funcs_called_with_kwargs(sourcecode, target_kwargs_name='kwargs'): r""" Finds functions that are called with the keyword `kwargs` variable CommandLine: python3 -m utool.util_inspect find_funcs_called_with_kwargs Example: >>> # ENABLE_DOCTEST >>> import utool as ut ...
[ "def", "find_funcs_called_with_kwargs", "(", "sourcecode", ",", "target_kwargs_name", "=", "'kwargs'", ")", ":", "r", "import", "ast", "sourcecode", "=", "'from __future__ import print_function\\n'", "+", "sourcecode", "pt", "=", "ast", ".", "parse", "(", "sourcecode"...
r""" Finds functions that are called with the keyword `kwargs` variable CommandLine: python3 -m utool.util_inspect find_funcs_called_with_kwargs Example: >>> # ENABLE_DOCTEST >>> import utool as ut >>> sourcecode = ut.codeblock( ''' x, y = li...
[ "r", "Finds", "functions", "that", "are", "called", "with", "the", "keyword", "kwargs", "variable" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1683-L1792
train
Erotemic/utool
utool/util_inspect.py
get_func_argspec
def get_func_argspec(func): """ wrapper around inspect.getargspec but takes into account utool decorators """ if hasattr(func, '_utinfo'): argspec = func._utinfo['orig_argspec'] return argspec if isinstance(func, property): func = func.fget try: argspec = inspect....
python
def get_func_argspec(func): """ wrapper around inspect.getargspec but takes into account utool decorators """ if hasattr(func, '_utinfo'): argspec = func._utinfo['orig_argspec'] return argspec if isinstance(func, property): func = func.fget try: argspec = inspect....
[ "def", "get_func_argspec", "(", "func", ")", ":", "if", "hasattr", "(", "func", ",", "'_utinfo'", ")", ":", "argspec", "=", "func", ".", "_utinfo", "[", "'orig_argspec'", "]", "return", "argspec", "if", "isinstance", "(", "func", ",", "property", ")", ":...
wrapper around inspect.getargspec but takes into account utool decorators
[ "wrapper", "around", "inspect", ".", "getargspec", "but", "takes", "into", "account", "utool", "decorators" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L2445-L2458
train
Erotemic/utool
utool/util_inspect.py
parse_func_kwarg_keys
def parse_func_kwarg_keys(func, with_vals=False): """ hacky inference of kwargs keys SeeAlso: argparse_funckw recursive_parse_kwargs parse_kwarg_keys parse_func_kwarg_keys get_func_kwargs """ sourcecode = get_func_sourcecode(func, strip_docstr=True, ...
python
def parse_func_kwarg_keys(func, with_vals=False): """ hacky inference of kwargs keys SeeAlso: argparse_funckw recursive_parse_kwargs parse_kwarg_keys parse_func_kwarg_keys get_func_kwargs """ sourcecode = get_func_sourcecode(func, strip_docstr=True, ...
[ "def", "parse_func_kwarg_keys", "(", "func", ",", "with_vals", "=", "False", ")", ":", "sourcecode", "=", "get_func_sourcecode", "(", "func", ",", "strip_docstr", "=", "True", ",", "strip_comments", "=", "True", ")", "kwkeys", "=", "parse_kwarg_keys", "(", "so...
hacky inference of kwargs keys SeeAlso: argparse_funckw recursive_parse_kwargs parse_kwarg_keys parse_func_kwarg_keys get_func_kwargs
[ "hacky", "inference", "of", "kwargs", "keys" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L2740-L2755
train
Erotemic/utool
utool/util_inspect.py
get_func_kwargs
def get_func_kwargs(func, recursive=True): """ func = ibeis.run_experiment SeeAlso: argparse_funckw recursive_parse_kwargs parse_kwarg_keys parse_func_kwarg_keys get_func_kwargs """ import utool as ut argspec = ut.get_func_argspec(func) if argspec.def...
python
def get_func_kwargs(func, recursive=True): """ func = ibeis.run_experiment SeeAlso: argparse_funckw recursive_parse_kwargs parse_kwarg_keys parse_func_kwarg_keys get_func_kwargs """ import utool as ut argspec = ut.get_func_argspec(func) if argspec.def...
[ "def", "get_func_kwargs", "(", "func", ",", "recursive", "=", "True", ")", ":", "import", "utool", "as", "ut", "argspec", "=", "ut", ".", "get_func_argspec", "(", "func", ")", "if", "argspec", ".", "defaults", "is", "None", ":", "header_kw", "=", "{", ...
func = ibeis.run_experiment SeeAlso: argparse_funckw recursive_parse_kwargs parse_kwarg_keys parse_func_kwarg_keys get_func_kwargs
[ "func", "=", "ibeis", ".", "run_experiment" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L2758-L2777
train
Erotemic/utool
utool/util_inspect.py
argparse_funckw
def argparse_funckw(func, defaults={}, **kwargs): """ allows kwargs to be specified on the commandline from testfuncs Args: func (function): Kwargs: lbl, verbose, only_specified, force_keys, type_hint, alias_dict Returns: dict: funckw CommandLine: python -m ut...
python
def argparse_funckw(func, defaults={}, **kwargs): """ allows kwargs to be specified on the commandline from testfuncs Args: func (function): Kwargs: lbl, verbose, only_specified, force_keys, type_hint, alias_dict Returns: dict: funckw CommandLine: python -m ut...
[ "def", "argparse_funckw", "(", "func", ",", "defaults", "=", "{", "}", ",", "**", "kwargs", ")", ":", "import", "utool", "as", "ut", "funckw_", "=", "ut", ".", "get_funckw", "(", "func", ",", "recursive", "=", "True", ")", "funckw_", ".", "update", "...
allows kwargs to be specified on the commandline from testfuncs Args: func (function): Kwargs: lbl, verbose, only_specified, force_keys, type_hint, alias_dict Returns: dict: funckw CommandLine: python -m utool.util_inspect argparse_funckw SeeAlso: exec_fu...
[ "allows", "kwargs", "to", "be", "specified", "on", "the", "commandline", "from", "testfuncs" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L3030-L3069
train
Erotemic/utool
utool/Preferences.py
_qt_set_leaf_data
def _qt_set_leaf_data(self, qvar): """ Sets backend data using QVariants """ if VERBOSE_PREF: print('') print('+--- [pref.qt_set_leaf_data]') print('[pref.qt_set_leaf_data] qvar = %r' % qvar) print('[pref.qt_set_leaf_data] _intern.name=%r' % self._intern.name) print('[pre...
python
def _qt_set_leaf_data(self, qvar): """ Sets backend data using QVariants """ if VERBOSE_PREF: print('') print('+--- [pref.qt_set_leaf_data]') print('[pref.qt_set_leaf_data] qvar = %r' % qvar) print('[pref.qt_set_leaf_data] _intern.name=%r' % self._intern.name) print('[pre...
[ "def", "_qt_set_leaf_data", "(", "self", ",", "qvar", ")", ":", "if", "VERBOSE_PREF", ":", "print", "(", "''", ")", "print", "(", "'+--- [pref.qt_set_leaf_data]'", ")", "print", "(", "'[pref.qt_set_leaf_data] qvar = %r'", "%", "qvar", ")", "print", "(", "'[pref....
Sets backend data using QVariants
[ "Sets", "backend", "data", "using", "QVariants" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L511-L591
train
Erotemic/utool
utool/Preferences.py
Pref.toggle
def toggle(self, key): """ Toggles a boolean key """ val = self[key] assert isinstance(val, bool), 'key[%r] = %r is not a bool' % (key, val) self.pref_update(key, not val)
python
def toggle(self, key): """ Toggles a boolean key """ val = self[key] assert isinstance(val, bool), 'key[%r] = %r is not a bool' % (key, val) self.pref_update(key, not val)
[ "def", "toggle", "(", "self", ",", "key", ")", ":", "val", "=", "self", "[", "key", "]", "assert", "isinstance", "(", "val", ",", "bool", ")", ",", "'key[%r] = %r is not a bool'", "%", "(", "key", ",", "val", ")", "self", ".", "pref_update", "(", "ke...
Toggles a boolean key
[ "Toggles", "a", "boolean", "key" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L143-L147
train
Erotemic/utool
utool/Preferences.py
Pref.change_combo_val
def change_combo_val(self, new_val): """ Checks to see if a selection is a valid index or choice of a combo preference """ choice_obj = self._intern.value assert isinstance(self._intern.value, PrefChoice), 'must be a choice' return choice_obj.get_tuple()
python
def change_combo_val(self, new_val): """ Checks to see if a selection is a valid index or choice of a combo preference """ choice_obj = self._intern.value assert isinstance(self._intern.value, PrefChoice), 'must be a choice' return choice_obj.get_tuple()
[ "def", "change_combo_val", "(", "self", ",", "new_val", ")", ":", "choice_obj", "=", "self", ".", "_intern", ".", "value", "assert", "isinstance", "(", "self", ".", "_intern", ".", "value", ",", "PrefChoice", ")", ",", "'must be a choice'", "return", "choice...
Checks to see if a selection is a valid index or choice of a combo preference
[ "Checks", "to", "see", "if", "a", "selection", "is", "a", "valid", "index", "or", "choice", "of", "a", "combo", "preference" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L149-L156
train
Erotemic/utool
utool/Preferences.py
Pref.iteritems
def iteritems(self): """ Wow this class is messed up. I had to overwrite items when moving to python3, just because I haden't called it yet """ for (key, val) in six.iteritems(self.__dict__): if key in self._printable_exclude: continue yiel...
python
def iteritems(self): """ Wow this class is messed up. I had to overwrite items when moving to python3, just because I haden't called it yet """ for (key, val) in six.iteritems(self.__dict__): if key in self._printable_exclude: continue yiel...
[ "def", "iteritems", "(", "self", ")", ":", "for", "(", "key", ",", "val", ")", "in", "six", ".", "iteritems", "(", "self", ".", "__dict__", ")", ":", "if", "key", "in", "self", ".", "_printable_exclude", ":", "continue", "yield", "(", "key", ",", "...
Wow this class is messed up. I had to overwrite items when moving to python3, just because I haden't called it yet
[ "Wow", "this", "class", "is", "messed", "up", ".", "I", "had", "to", "overwrite", "items", "when", "moving", "to", "python3", "just", "because", "I", "haden", "t", "called", "it", "yet" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L320-L328
train
Erotemic/utool
utool/Preferences.py
Pref.to_dict
def to_dict(self, split_structs_bit=False): """ Converts prefeters to a dictionary. Children Pref can be optionally separated """ pref_dict = {} struct_dict = {} for (key, val) in six.iteritems(self): if split_structs_bit and isinstance(val, Pref): str...
python
def to_dict(self, split_structs_bit=False): """ Converts prefeters to a dictionary. Children Pref can be optionally separated """ pref_dict = {} struct_dict = {} for (key, val) in six.iteritems(self): if split_structs_bit and isinstance(val, Pref): str...
[ "def", "to_dict", "(", "self", ",", "split_structs_bit", "=", "False", ")", ":", "pref_dict", "=", "{", "}", "struct_dict", "=", "{", "}", "for", "(", "key", ",", "val", ")", "in", "six", ".", "iteritems", "(", "self", ")", ":", "if", "split_structs_...
Converts prefeters to a dictionary. Children Pref can be optionally separated
[ "Converts", "prefeters", "to", "a", "dictionary", ".", "Children", "Pref", "can", "be", "optionally", "separated" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L342-L354
train
Erotemic/utool
utool/Preferences.py
Pref.save
def save(self): """ Saves prefs to disk in dict format """ fpath = self.get_fpath() if fpath in ['', None]: if self._tree.parent is not None: if VERBOSE_PREF: print('[pref.save] Can my parent save me?') # ...to disk return self._tr...
python
def save(self): """ Saves prefs to disk in dict format """ fpath = self.get_fpath() if fpath in ['', None]: if self._tree.parent is not None: if VERBOSE_PREF: print('[pref.save] Can my parent save me?') # ...to disk return self._tr...
[ "def", "save", "(", "self", ")", ":", "fpath", "=", "self", ".", "get_fpath", "(", ")", "if", "fpath", "in", "[", "''", ",", "None", "]", ":", "if", "self", ".", "_tree", ".", "parent", "is", "not", "None", ":", "if", "VERBOSE_PREF", ":", "print"...
Saves prefs to disk in dict format
[ "Saves", "prefs", "to", "disk", "in", "dict", "format" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L358-L373
train
Erotemic/utool
utool/Preferences.py
Pref.load
def load(self): """ Read pref dict stored on disk. Overwriting current values. """ if VERBOSE_PREF: print('[pref.load()]') #if not os.path.exists(self._intern.fpath): # msg = '[pref] fpath=%r does not exist' % (self._intern.fpath) # return msg ...
python
def load(self): """ Read pref dict stored on disk. Overwriting current values. """ if VERBOSE_PREF: print('[pref.load()]') #if not os.path.exists(self._intern.fpath): # msg = '[pref] fpath=%r does not exist' % (self._intern.fpath) # return msg ...
[ "def", "load", "(", "self", ")", ":", "if", "VERBOSE_PREF", ":", "print", "(", "'[pref.load()]'", ")", "fpath", "=", "self", ".", "get_fpath", "(", ")", "try", ":", "with", "open", "(", "fpath", ",", "'rb'", ")", "as", "f", ":", "if", "VERBOSE_PREF",...
Read pref dict stored on disk. Overwriting current values.
[ "Read", "pref", "dict", "stored", "on", "disk", ".", "Overwriting", "current", "values", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L378-L404
train
Erotemic/utool
utool/Preferences.py
Pref.full_name
def full_name(self): """ returns name all the way up the tree """ if self._tree.parent is None: return self._intern.name return self._tree.parent.full_name() + '.' + self._intern.name
python
def full_name(self): """ returns name all the way up the tree """ if self._tree.parent is None: return self._intern.name return self._tree.parent.full_name() + '.' + self._intern.name
[ "def", "full_name", "(", "self", ")", ":", "if", "self", ".", "_tree", ".", "parent", "is", "None", ":", "return", "self", ".", "_intern", ".", "name", "return", "self", ".", "_tree", ".", "parent", ".", "full_name", "(", ")", "+", "'.'", "+", "sel...
returns name all the way up the tree
[ "returns", "name", "all", "the", "way", "up", "the", "tree" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L418-L422
train
Erotemic/utool
utool/Preferences.py
Pref.pref_update
def pref_update(self, key, new_val): """ Changes a preference value and saves it to disk """ print('Update and save pref from: %s=%r, to: %s=%r' % (key, six.text_type(self[key]), key, six.text_type(new_val))) self.__setattr__(key, new_val) return self.save()
python
def pref_update(self, key, new_val): """ Changes a preference value and saves it to disk """ print('Update and save pref from: %s=%r, to: %s=%r' % (key, six.text_type(self[key]), key, six.text_type(new_val))) self.__setattr__(key, new_val) return self.save()
[ "def", "pref_update", "(", "self", ",", "key", ",", "new_val", ")", ":", "print", "(", "'Update and save pref from: %s=%r, to: %s=%r'", "%", "(", "key", ",", "six", ".", "text_type", "(", "self", "[", "key", "]", ")", ",", "key", ",", "six", ".", "text_t...
Changes a preference value and saves it to disk
[ "Changes", "a", "preference", "value", "and", "saves", "it", "to", "disk" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/Preferences.py#L441-L446
train
product-definition-center/pdc-client
pdc_client/plugins/permission.py
PermissionPlugin.__get_permissions
def __get_permissions(self, res, **kwargs): """ This call returns current login user's permissions. """ response = res._(**kwargs) return response.get('permissions', None)
python
def __get_permissions(self, res, **kwargs): """ This call returns current login user's permissions. """ response = res._(**kwargs) return response.get('permissions', None)
[ "def", "__get_permissions", "(", "self", ",", "res", ",", "**", "kwargs", ")", ":", "response", "=", "res", ".", "_", "(", "**", "kwargs", ")", "return", "response", ".", "get", "(", "'permissions'", ",", "None", ")" ]
This call returns current login user's permissions.
[ "This", "call", "returns", "current", "login", "user", "s", "permissions", "." ]
7236fd8b72e675ebb321bbe337289d9fbeb6119f
https://github.com/product-definition-center/pdc-client/blob/7236fd8b72e675ebb321bbe337289d9fbeb6119f/pdc_client/plugins/permission.py#L32-L37
train
Erotemic/utool
utool/util_class.py
inject_all_external_modules
def inject_all_external_modules(self, classname=None, allow_override='override+warn', strict=True): """ dynamically injects registered module methods into a class instance FIXME: naming convention and use this in all places where this clas is ...
python
def inject_all_external_modules(self, classname=None, allow_override='override+warn', strict=True): """ dynamically injects registered module methods into a class instance FIXME: naming convention and use this in all places where this clas is ...
[ "def", "inject_all_external_modules", "(", "self", ",", "classname", "=", "None", ",", "allow_override", "=", "'override+warn'", ",", "strict", "=", "True", ")", ":", "if", "classname", "is", "None", ":", "classname", "=", "self", ".", "__class__", ".", "__n...
dynamically injects registered module methods into a class instance FIXME: naming convention and use this in all places where this clas is used
[ "dynamically", "injects", "registered", "module", "methods", "into", "a", "class", "instance" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L128-L160
train
Erotemic/utool
utool/util_class.py
decorate_class_method
def decorate_class_method(func, classkey=None, skipmain=False): """ Will inject all decorated function as methods of classkey classkey is some identifying string, tuple, or object func can also be a tuple """ #import utool as ut global __CLASSTYPE_ATTRIBUTES__ assert classkey is not No...
python
def decorate_class_method(func, classkey=None, skipmain=False): """ Will inject all decorated function as methods of classkey classkey is some identifying string, tuple, or object func can also be a tuple """ #import utool as ut global __CLASSTYPE_ATTRIBUTES__ assert classkey is not No...
[ "def", "decorate_class_method", "(", "func", ",", "classkey", "=", "None", ",", "skipmain", "=", "False", ")", ":", "global", "__CLASSTYPE_ATTRIBUTES__", "assert", "classkey", "is", "not", "None", ",", "'must specify classkey'", "__CLASSTYPE_ATTRIBUTES__", "[", "cla...
Will inject all decorated function as methods of classkey classkey is some identifying string, tuple, or object func can also be a tuple
[ "Will", "inject", "all", "decorated", "function", "as", "methods", "of", "classkey" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L413-L426
train
Erotemic/utool
utool/util_class.py
decorate_postinject
def decorate_postinject(func, classkey=None, skipmain=False): """ Will perform func with argument self after inject_instance is called on classkey classkey is some identifying string, tuple, or object """ #import utool as ut global __CLASSTYPE_POSTINJECT_FUNCS__ assert classkey is not None,...
python
def decorate_postinject(func, classkey=None, skipmain=False): """ Will perform func with argument self after inject_instance is called on classkey classkey is some identifying string, tuple, or object """ #import utool as ut global __CLASSTYPE_POSTINJECT_FUNCS__ assert classkey is not None,...
[ "def", "decorate_postinject", "(", "func", ",", "classkey", "=", "None", ",", "skipmain", "=", "False", ")", ":", "global", "__CLASSTYPE_POSTINJECT_FUNCS__", "assert", "classkey", "is", "not", "None", ",", "'must specify classkey'", "__CLASSTYPE_POSTINJECT_FUNCS__", "...
Will perform func with argument self after inject_instance is called on classkey classkey is some identifying string, tuple, or object
[ "Will", "perform", "func", "with", "argument", "self", "after", "inject_instance", "is", "called", "on", "classkey" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L429-L440
train
Erotemic/utool
utool/util_class.py
inject_func_as_method
def inject_func_as_method(self, func, method_name=None, class_=None, allow_override=False, allow_main=False, verbose=True, override=None, force=False): """ Injects a function into an object as a method Wraps func as a bound method of self. Then injects func i...
python
def inject_func_as_method(self, func, method_name=None, class_=None, allow_override=False, allow_main=False, verbose=True, override=None, force=False): """ Injects a function into an object as a method Wraps func as a bound method of self. Then injects func i...
[ "def", "inject_func_as_method", "(", "self", ",", "func", ",", "method_name", "=", "None", ",", "class_", "=", "None", ",", "allow_override", "=", "False", ",", "allow_main", "=", "False", ",", "verbose", "=", "True", ",", "override", "=", "None", ",", "...
Injects a function into an object as a method Wraps func as a bound method of self. Then injects func into self It is preferable to use make_class_method_decorator and inject_instance Args: self (object): class instance func : some function whos first arugment is a class instance meth...
[ "Injects", "a", "function", "into", "an", "object", "as", "a", "method" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L454-L520
train
Erotemic/utool
utool/util_class.py
inject_func_as_unbound_method
def inject_func_as_unbound_method(class_, func, method_name=None): """ This is actually quite simple """ if method_name is None: method_name = get_funcname(func) setattr(class_, method_name, func)
python
def inject_func_as_unbound_method(class_, func, method_name=None): """ This is actually quite simple """ if method_name is None: method_name = get_funcname(func) setattr(class_, method_name, func)
[ "def", "inject_func_as_unbound_method", "(", "class_", ",", "func", ",", "method_name", "=", "None", ")", ":", "if", "method_name", "is", "None", ":", "method_name", "=", "get_funcname", "(", "func", ")", "setattr", "(", "class_", ",", "method_name", ",", "f...
This is actually quite simple
[ "This", "is", "actually", "quite", "simple" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L538-L542
train
Erotemic/utool
utool/util_class.py
reloading_meta_metaclass_factory
def reloading_meta_metaclass_factory(BASE_TYPE=type): """ hack for pyqt """ class ReloadingMetaclass2(BASE_TYPE): def __init__(metaself, name, bases, dct): super(ReloadingMetaclass2, metaself).__init__(name, bases, dct) #print('Making rrr for %r' % (name,)) metaself.r...
python
def reloading_meta_metaclass_factory(BASE_TYPE=type): """ hack for pyqt """ class ReloadingMetaclass2(BASE_TYPE): def __init__(metaself, name, bases, dct): super(ReloadingMetaclass2, metaself).__init__(name, bases, dct) #print('Making rrr for %r' % (name,)) metaself.r...
[ "def", "reloading_meta_metaclass_factory", "(", "BASE_TYPE", "=", "type", ")", ":", "class", "ReloadingMetaclass2", "(", "BASE_TYPE", ")", ":", "def", "__init__", "(", "metaself", ",", "name", ",", "bases", ",", "dct", ")", ":", "super", "(", "ReloadingMetacla...
hack for pyqt
[ "hack", "for", "pyqt" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L695-L702
train
Erotemic/utool
utool/util_class.py
reload_class
def reload_class(self, verbose=True, reload_module=True): """ special class reloading function This function is often injected as rrr of classes """ import utool as ut verbose = verbose or VERBOSE_CLASS classname = self.__class__.__name__ try: modname = self.__class__.__module__ ...
python
def reload_class(self, verbose=True, reload_module=True): """ special class reloading function This function is often injected as rrr of classes """ import utool as ut verbose = verbose or VERBOSE_CLASS classname = self.__class__.__name__ try: modname = self.__class__.__module__ ...
[ "def", "reload_class", "(", "self", ",", "verbose", "=", "True", ",", "reload_module", "=", "True", ")", ":", "import", "utool", "as", "ut", "verbose", "=", "verbose", "or", "VERBOSE_CLASS", "classname", "=", "self", ".", "__class__", ".", "__name__", "try...
special class reloading function This function is often injected as rrr of classes
[ "special", "class", "reloading", "function", "This", "function", "is", "often", "injected", "as", "rrr", "of", "classes" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L705-L785
train
Erotemic/utool
utool/util_class.py
reload_class_methods
def reload_class_methods(self, class_, verbose=True): """ rebinds all class methods Args: self (object): class instance to reload class_ (type): type to reload as Example: >>> # DISABLE_DOCTEST >>> from utool.util_class import * # NOQA >>> self = '?' >>...
python
def reload_class_methods(self, class_, verbose=True): """ rebinds all class methods Args: self (object): class instance to reload class_ (type): type to reload as Example: >>> # DISABLE_DOCTEST >>> from utool.util_class import * # NOQA >>> self = '?' >>...
[ "def", "reload_class_methods", "(", "self", ",", "class_", ",", "verbose", "=", "True", ")", ":", "if", "verbose", ":", "print", "(", "'[util_class] Reloading self=%r as class_=%r'", "%", "(", "self", ",", "class_", ")", ")", "self", ".", "__class__", "=", "...
rebinds all class methods Args: self (object): class instance to reload class_ (type): type to reload as Example: >>> # DISABLE_DOCTEST >>> from utool.util_class import * # NOQA >>> self = '?' >>> class_ = '?' >>> result = reload_class_methods(self, cla...
[ "rebinds", "all", "class", "methods" ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L788-L814
train
Erotemic/utool
utool/util_class.py
remove_private_obfuscation
def remove_private_obfuscation(self): """ removes the python obfuscation of class privates so they can be executed as they appear in class source. Useful when playing with IPython. """ classname = self.__class__.__name__ attrlist = [attr for attr in dir(self) if attr.startswith('_' + classname +...
python
def remove_private_obfuscation(self): """ removes the python obfuscation of class privates so they can be executed as they appear in class source. Useful when playing with IPython. """ classname = self.__class__.__name__ attrlist = [attr for attr in dir(self) if attr.startswith('_' + classname +...
[ "def", "remove_private_obfuscation", "(", "self", ")", ":", "classname", "=", "self", ".", "__class__", ".", "__name__", "attrlist", "=", "[", "attr", "for", "attr", "in", "dir", "(", "self", ")", "if", "attr", ".", "startswith", "(", "'_'", "+", "classn...
removes the python obfuscation of class privates so they can be executed as they appear in class source. Useful when playing with IPython.
[ "removes", "the", "python", "obfuscation", "of", "class", "privates", "so", "they", "can", "be", "executed", "as", "they", "appear", "in", "class", "source", ".", "Useful", "when", "playing", "with", "IPython", "." ]
3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L968-L978
train
glormph/msstitch
src/app/actions/mslookup/proteinquant.py
create_peptidequant_lookup
def create_peptidequant_lookup(fns, pqdb, poolnames, pepseq_colnr, ms1_qcolpattern=None, isobqcolpattern=None, psmnrpattern=None, fdrcolpattern=None, pepcolpattern=None): """Calls lower level function to create a peptide qu...
python
def create_peptidequant_lookup(fns, pqdb, poolnames, pepseq_colnr, ms1_qcolpattern=None, isobqcolpattern=None, psmnrpattern=None, fdrcolpattern=None, pepcolpattern=None): """Calls lower level function to create a peptide qu...
[ "def", "create_peptidequant_lookup", "(", "fns", ",", "pqdb", ",", "poolnames", ",", "pepseq_colnr", ",", "ms1_qcolpattern", "=", "None", ",", "isobqcolpattern", "=", "None", ",", "psmnrpattern", "=", "None", ",", "fdrcolpattern", "=", "None", ",", "pepcolpatter...
Calls lower level function to create a peptide quant lookup
[ "Calls", "lower", "level", "function", "to", "create", "a", "peptide", "quant", "lookup" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/mslookup/proteinquant.py#L5-L15
train
glormph/msstitch
src/app/actions/mslookup/proteinquant.py
create_proteinquant_lookup
def create_proteinquant_lookup(fns, pqdb, poolnames, protacc_colnr, ms1_qcolpattern=None, isobqcolpattern=None, psmnrpattern=None, probcolpattern=None, fdrcolpattern=None, pepcolpattern=None): """Calls lower level function ...
python
def create_proteinquant_lookup(fns, pqdb, poolnames, protacc_colnr, ms1_qcolpattern=None, isobqcolpattern=None, psmnrpattern=None, probcolpattern=None, fdrcolpattern=None, pepcolpattern=None): """Calls lower level function ...
[ "def", "create_proteinquant_lookup", "(", "fns", ",", "pqdb", ",", "poolnames", ",", "protacc_colnr", ",", "ms1_qcolpattern", "=", "None", ",", "isobqcolpattern", "=", "None", ",", "psmnrpattern", "=", "None", ",", "probcolpattern", "=", "None", ",", "fdrcolpatt...
Calls lower level function to create a protein quant lookup
[ "Calls", "lower", "level", "function", "to", "create", "a", "protein", "quant", "lookup" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/mslookup/proteinquant.py#L18-L28
train
glormph/msstitch
src/app/actions/mslookup/proteinquant.py
create_pep_protein_quant_lookup
def create_pep_protein_quant_lookup(fns, pqdb, poolnames, featcolnr, patterns, storefuns, isobqcolpattern=None, psmnrpattern=None): """Does the work when creating peptide and protein quant lookups. This loops through storing options and par...
python
def create_pep_protein_quant_lookup(fns, pqdb, poolnames, featcolnr, patterns, storefuns, isobqcolpattern=None, psmnrpattern=None): """Does the work when creating peptide and protein quant lookups. This loops through storing options and par...
[ "def", "create_pep_protein_quant_lookup", "(", "fns", ",", "pqdb", ",", "poolnames", ",", "featcolnr", ",", "patterns", ",", "storefuns", ",", "isobqcolpattern", "=", "None", ",", "psmnrpattern", "=", "None", ")", ":", "tablefn_map", "=", "create_tablefn_map", "...
Does the work when creating peptide and protein quant lookups. This loops through storing options and parses columns, passing on to the storing functions
[ "Does", "the", "work", "when", "creating", "peptide", "and", "protein", "quant", "lookups", ".", "This", "loops", "through", "storing", "options", "and", "parses", "columns", "passing", "on", "to", "the", "storing", "functions" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/mslookup/proteinquant.py#L31-L57
train
glormph/msstitch
src/app/actions/mslookup/proteinquant.py
store_single_col_data
def store_single_col_data(fns, prottable_id_map, pacc_map, pqdbmethod, protacc_colnr, colmap): """General method to store single column data from protein tables in lookup""" to_store = [] for fn, header, pquant in tsvreader.generate_tsv_pep_protein_quants(fns): pacc_id ...
python
def store_single_col_data(fns, prottable_id_map, pacc_map, pqdbmethod, protacc_colnr, colmap): """General method to store single column data from protein tables in lookup""" to_store = [] for fn, header, pquant in tsvreader.generate_tsv_pep_protein_quants(fns): pacc_id ...
[ "def", "store_single_col_data", "(", "fns", ",", "prottable_id_map", ",", "pacc_map", ",", "pqdbmethod", ",", "protacc_colnr", ",", "colmap", ")", ":", "to_store", "=", "[", "]", "for", "fn", ",", "header", ",", "pquant", "in", "tsvreader", ".", "generate_ts...
General method to store single column data from protein tables in lookup
[ "General", "method", "to", "store", "single", "column", "data", "from", "protein", "tables", "in", "lookup" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/mslookup/proteinquant.py#L87-L99
train
glormph/msstitch
src/app/actions/mslookup/proteinquant.py
map_psmnrcol_to_quantcol
def map_psmnrcol_to_quantcol(quantcols, psmcols, tablefn_map): """This function yields tuples of table filename, isobaric quant column and if necessary number-of-PSM column""" if not psmcols: for fn in quantcols: for qcol in quantcols[fn]: yield (tablefn_map[fn], qcol) ...
python
def map_psmnrcol_to_quantcol(quantcols, psmcols, tablefn_map): """This function yields tuples of table filename, isobaric quant column and if necessary number-of-PSM column""" if not psmcols: for fn in quantcols: for qcol in quantcols[fn]: yield (tablefn_map[fn], qcol) ...
[ "def", "map_psmnrcol_to_quantcol", "(", "quantcols", ",", "psmcols", ",", "tablefn_map", ")", ":", "if", "not", "psmcols", ":", "for", "fn", "in", "quantcols", ":", "for", "qcol", "in", "quantcols", "[", "fn", "]", ":", "yield", "(", "tablefn_map", "[", ...
This function yields tuples of table filename, isobaric quant column and if necessary number-of-PSM column
[ "This", "function", "yields", "tuples", "of", "table", "filename", "isobaric", "quant", "column", "and", "if", "necessary", "number", "-", "of", "-", "PSM", "column" ]
ded7e5cbd813d7797dc9d42805778266e59ff042
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/mslookup/proteinquant.py#L122-L132
train