repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
ramrod-project/database-brain
setup/run_once.py
outputscreate
def outputscreate(): """ Brain.Outputs table creation :return: """ # Create table with a nested index r.db("Brain").table_create("Outputs").run() r.db("Brain").table("Outputs").index_create("Output_job_id", r.row["OutputJob"]["id"]).run() r.db("Brain").table("Outputs").index_wait("Output...
python
def outputscreate(): """ Brain.Outputs table creation :return: """ # Create table with a nested index r.db("Brain").table_create("Outputs").run() r.db("Brain").table("Outputs").index_create("Output_job_id", r.row["OutputJob"]["id"]).run() r.db("Brain").table("Outputs").index_wait("Output...
[ "def", "outputscreate", "(", ")", ":", "# Create table with a nested index", "r", ".", "db", "(", "\"Brain\"", ")", ".", "table_create", "(", "\"Outputs\"", ")", ".", "run", "(", ")", "r", ".", "db", "(", "\"Brain\"", ")", ".", "table", "(", "\"Outputs\"",...
Brain.Outputs table creation :return:
[ "Brain", ".", "Outputs", "table", "creation", ":", "return", ":" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/setup/run_once.py#L58-L66
20c/twentyc.tools
twentyc/tools/cli.py
CLIEnv.check_config
def check_config(self, section, name, has_default=False, value=None, allowEmpty=False): """ Check if a config value is set Returns True - config value is set and valid False - config value is not set or invalid """ cfg = self.config if not cfg.has_key(section) or not cfg.get(sect...
python
def check_config(self, section, name, has_default=False, value=None, allowEmpty=False): """ Check if a config value is set Returns True - config value is set and valid False - config value is not set or invalid """ cfg = self.config if not cfg.has_key(section) or not cfg.get(sect...
[ "def", "check_config", "(", "self", ",", "section", ",", "name", ",", "has_default", "=", "False", ",", "value", "=", "None", ",", "allowEmpty", "=", "False", ")", ":", "cfg", "=", "self", ".", "config", "if", "not", "cfg", ".", "has_key", "(", "sect...
Check if a config value is set Returns True - config value is set and valid False - config value is not set or invalid
[ "Check", "if", "a", "config", "value", "is", "set" ]
train
https://github.com/20c/twentyc.tools/blob/f8f681e64f58d449bfc32646ba8bcc57db90a233/twentyc/tools/cli.py#L56-L80
KnowledgeLinks/rdfframework
rdfframework/datasets/dataconverter.py
convert_results
def convert_results(data, **kwargs): """ converts the results of a query to RdfDatatype instances args: data: a list of triples """ if kwargs.get("multiprocessing", False): manager = SharedManager() manager.register("BaseRdfDataType", BaseRdfDataType) manager.reg...
python
def convert_results(data, **kwargs): """ converts the results of a query to RdfDatatype instances args: data: a list of triples """ if kwargs.get("multiprocessing", False): manager = SharedManager() manager.register("BaseRdfDataType", BaseRdfDataType) manager.reg...
[ "def", "convert_results", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "\"multiprocessing\"", ",", "False", ")", ":", "manager", "=", "SharedManager", "(", ")", "manager", ".", "register", "(", "\"BaseRdfDataType\"", ","...
converts the results of a query to RdfDatatype instances args: data: a list of triples
[ "converts", "the", "results", "of", "a", "query", "to", "RdfDatatype", "instances" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/dataconverter.py#L52-L94
neuroticnerd/armory
armory/utils/encoding.py
UnicodeTransformChar.transform
def transform(self, text): """Replaces characters in string ``text`` based in regex sub""" return re.sub(self.regex, self.repl, text)
python
def transform(self, text): """Replaces characters in string ``text`` based in regex sub""" return re.sub(self.regex, self.repl, text)
[ "def", "transform", "(", "self", ",", "text", ")", ":", "return", "re", ".", "sub", "(", "self", ".", "regex", ",", "self", ".", "repl", ",", "text", ")" ]
Replaces characters in string ``text`` based in regex sub
[ "Replaces", "characters", "in", "string", "text", "based", "in", "regex", "sub" ]
train
https://github.com/neuroticnerd/armory/blob/d37c5ca1dbdd60dddb968e35f0bbe4bc1299dca1/armory/utils/encoding.py#L17-L19
msfrank/cifparser
cifparser/valuetree.py
dump
def dump(values): """ Dump a ValueTree instance, returning its dict representation. :param values: :type values: ValueTree :return: :rtype: dict """ root = {} def _dump(_values, container): for name,value in _values._values.items(): if isinstance(value, ValueTree...
python
def dump(values): """ Dump a ValueTree instance, returning its dict representation. :param values: :type values: ValueTree :return: :rtype: dict """ root = {} def _dump(_values, container): for name,value in _values._values.items(): if isinstance(value, ValueTree...
[ "def", "dump", "(", "values", ")", ":", "root", "=", "{", "}", "def", "_dump", "(", "_values", ",", "container", ")", ":", "for", "name", ",", "value", "in", "_values", ".", "_values", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ...
Dump a ValueTree instance, returning its dict representation. :param values: :type values: ValueTree :return: :rtype: dict
[ "Dump", "a", "ValueTree", "instance", "returning", "its", "dict", "representation", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L330-L356
msfrank/cifparser
cifparser/valuetree.py
load
def load(obj): """ Load a ValueTree instance from its dict representation. :param obj: :type obj: dict :return: :rtype: ValueTree """ values = ValueTree() def _load(_obj, container): for name,value in _obj.items(): if isinstance(value, dict): path...
python
def load(obj): """ Load a ValueTree instance from its dict representation. :param obj: :type obj: dict :return: :rtype: ValueTree """ values = ValueTree() def _load(_obj, container): for name,value in _obj.items(): if isinstance(value, dict): path...
[ "def", "load", "(", "obj", ")", ":", "values", "=", "ValueTree", "(", ")", "def", "_load", "(", "_obj", ",", "container", ")", ":", "for", "name", ",", "value", "in", "_obj", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "di...
Load a ValueTree instance from its dict representation. :param obj: :type obj: dict :return: :rtype: ValueTree
[ "Load", "a", "ValueTree", "instance", "from", "its", "dict", "representation", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L358-L382
msfrank/cifparser
cifparser/valuetree.py
ValueTree.put_container
def put_container(self, path): """ Creates a container at the specified path, creating any necessary intermediate containers. :param path: str or Path instance :raises ValueError: A component of path is a field name. """ path = make_path(path) container =...
python
def put_container(self, path): """ Creates a container at the specified path, creating any necessary intermediate containers. :param path: str or Path instance :raises ValueError: A component of path is a field name. """ path = make_path(path) container =...
[ "def", "put_container", "(", "self", ",", "path", ")", ":", "path", "=", "make_path", "(", "path", ")", "container", "=", "self", "for", "segment", "in", "path", ":", "try", ":", "container", "=", "container", ".", "_values", "[", "segment", "]", "if",...
Creates a container at the specified path, creating any necessary intermediate containers. :param path: str or Path instance :raises ValueError: A component of path is a field name.
[ "Creates", "a", "container", "at", "the", "specified", "path", "creating", "any", "necessary", "intermediate", "containers", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L14-L32
msfrank/cifparser
cifparser/valuetree.py
ValueTree.remove_container
def remove_container(self, path): """ Removes the container at the specified path. :param path: str or Path instance :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. """ path = make_path(path) c...
python
def remove_container(self, path): """ Removes the container at the specified path. :param path: str or Path instance :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. """ path = make_path(path) c...
[ "def", "remove_container", "(", "self", ",", "path", ")", ":", "path", "=", "make_path", "(", "path", ")", "container", "=", "self", "parent", "=", "None", "for", "segment", "in", "path", ":", "parent", "=", "container", "try", ":", "container", "=", "...
Removes the container at the specified path. :param path: str or Path instance :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist.
[ "Removes", "the", "container", "at", "the", "specified", "path", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L34-L53
msfrank/cifparser
cifparser/valuetree.py
ValueTree.get_container
def get_container(self, path): """ Retrieves the container at the specified path. :param path: str or Path instance :return: :rtype: ValueTree :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. ""...
python
def get_container(self, path): """ Retrieves the container at the specified path. :param path: str or Path instance :return: :rtype: ValueTree :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. ""...
[ "def", "get_container", "(", "self", ",", "path", ")", ":", "path", "=", "make_path", "(", "path", ")", "container", "=", "self", "for", "segment", "in", "path", ":", "try", ":", "container", "=", "container", ".", "_values", "[", "segment", "]", "if",...
Retrieves the container at the specified path. :param path: str or Path instance :return: :rtype: ValueTree :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist.
[ "Retrieves", "the", "container", "at", "the", "specified", "path", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L55-L74
msfrank/cifparser
cifparser/valuetree.py
ValueTree.get_container_containers
def get_container_containers(self, path): """ :param path: str or Path instance :return: :rtype: dict[str,ValueTree] :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. """ container = self.get_cont...
python
def get_container_containers(self, path): """ :param path: str or Path instance :return: :rtype: dict[str,ValueTree] :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. """ container = self.get_cont...
[ "def", "get_container_containers", "(", "self", ",", "path", ")", ":", "container", "=", "self", ".", "get_container", "(", "path", ")", "containers", "=", "{", "}", "for", "name", ",", "value", "in", "container", ".", "_values", ".", "items", "(", ")", ...
:param path: str or Path instance :return: :rtype: dict[str,ValueTree] :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist.
[ ":", "param", "path", ":", "str", "or", "Path", "instance", ":", "return", ":", ":", "rtype", ":", "dict", "[", "str", "ValueTree", "]", ":", "raises", "ValueError", ":", "A", "component", "of", "path", "is", "a", "field", "name", ".", ":", "raises",...
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L76-L89
msfrank/cifparser
cifparser/valuetree.py
ValueTree.contains_container
def contains_container(self, path): """ Returns True if a container exists at the specified path, otherwise False. :param path: str or Path instance :return: :rtype: bool :raises ValueError: A component of path is a field name. """ path = make_pat...
python
def contains_container(self, path): """ Returns True if a container exists at the specified path, otherwise False. :param path: str or Path instance :return: :rtype: bool :raises ValueError: A component of path is a field name. """ path = make_pat...
[ "def", "contains_container", "(", "self", ",", "path", ")", ":", "path", "=", "make_path", "(", "path", ")", "try", ":", "self", ".", "get_container", "(", "path", ")", "return", "True", "except", "KeyError", ":", "return", "False" ]
Returns True if a container exists at the specified path, otherwise False. :param path: str or Path instance :return: :rtype: bool :raises ValueError: A component of path is a field name.
[ "Returns", "True", "if", "a", "container", "exists", "at", "the", "specified", "path", "otherwise", "False", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L107-L122
msfrank/cifparser
cifparser/valuetree.py
ValueTree.put_field
def put_field(self, path, name, value): """ Creates a field with the specified name an value at path. If the field already exists, it will be overwritten with the new value. :param path: str or Path instance :param name: :type name: str :param value: :ty...
python
def put_field(self, path, name, value): """ Creates a field with the specified name an value at path. If the field already exists, it will be overwritten with the new value. :param path: str or Path instance :param name: :type name: str :param value: :ty...
[ "def", "put_field", "(", "self", ",", "path", ",", "name", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "ValueError", "(", ")", "path", "=", "make_path", "(", "path", ")", "container", "=", "self", ...
Creates a field with the specified name an value at path. If the field already exists, it will be overwritten with the new value. :param path: str or Path instance :param name: :type name: str :param value: :type value: str
[ "Creates", "a", "field", "with", "the", "specified", "name", "an", "value", "at", "path", ".", "If", "the", "field", "already", "exists", "it", "will", "be", "overwritten", "with", "the", "new", "value", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L139-L157
msfrank/cifparser
cifparser/valuetree.py
ValueTree.append_field
def append_field(self, path, name, value): """ Appends the field to the container at the specified path. :param path: str or Path instance :param name: :type name: str :param value: :type value: str """ path = make_path(path) container = s...
python
def append_field(self, path, name, value): """ Appends the field to the container at the specified path. :param path: str or Path instance :param name: :type name: str :param value: :type value: str """ path = make_path(path) container = s...
[ "def", "append_field", "(", "self", ",", "path", ",", "name", ",", "value", ")", ":", "path", "=", "make_path", "(", "path", ")", "container", "=", "self", ".", "get_container", "(", "path", ")", "current", "=", "container", ".", "_values", ".", "get",...
Appends the field to the container at the specified path. :param path: str or Path instance :param name: :type name: str :param value: :type value: str
[ "Appends", "the", "field", "to", "the", "container", "at", "the", "specified", "path", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L177-L197
msfrank/cifparser
cifparser/valuetree.py
ValueTree.remove_field
def remove_field(self, path, name): """ :param path: str or Path instance :param name: :type name: str """ path = make_path(path) container = self.get_container(path) try: value = container._values[name] if isinstance(value, ValueTr...
python
def remove_field(self, path, name): """ :param path: str or Path instance :param name: :type name: str """ path = make_path(path) container = self.get_container(path) try: value = container._values[name] if isinstance(value, ValueTr...
[ "def", "remove_field", "(", "self", ",", "path", ",", "name", ")", ":", "path", "=", "make_path", "(", "path", ")", "container", "=", "self", ".", "get_container", "(", "path", ")", "try", ":", "value", "=", "container", ".", "_values", "[", "name", ...
:param path: str or Path instance :param name: :type name: str
[ ":", "param", "path", ":", "str", "or", "Path", "instance", ":", "param", "name", ":", ":", "type", "name", ":", "str" ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L199-L213
msfrank/cifparser
cifparser/valuetree.py
ValueTree.get
def get(self, path, name): """ :param path: str or Path instance :param name: :type name: str :return: """ container = self.get_container(path) try: return container._values[name] except KeyError: raise KeyError()
python
def get(self, path, name): """ :param path: str or Path instance :param name: :type name: str :return: """ container = self.get_container(path) try: return container._values[name] except KeyError: raise KeyError()
[ "def", "get", "(", "self", ",", "path", ",", "name", ")", ":", "container", "=", "self", ".", "get_container", "(", "path", ")", "try", ":", "return", "container", ".", "_values", "[", "name", "]", "except", "KeyError", ":", "raise", "KeyError", "(", ...
:param path: str or Path instance :param name: :type name: str :return:
[ ":", "param", "path", ":", "str", "or", "Path", "instance", ":", "param", "name", ":", ":", "type", "name", ":", "str", ":", "return", ":" ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L215-L226
msfrank/cifparser
cifparser/valuetree.py
ValueTree.get_field
def get_field(self, path, name): """ Retrieves the value of the field at the specified path. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises KeyError: A component of ...
python
def get_field(self, path, name): """ Retrieves the value of the field at the specified path. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises KeyError: A component of ...
[ "def", "get_field", "(", "self", ",", "path", ",", "name", ")", ":", "try", ":", "value", "=", "self", ".", "get", "(", "path", ",", "name", ")", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "TypeError", "(", ")", "retu...
Retrieves the value of the field at the specified path. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises KeyError: A component of path doesn't exist. :raises TypeError: The fi...
[ "Retrieves", "the", "value", "of", "the", "field", "at", "the", "specified", "path", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L228-L246
msfrank/cifparser
cifparser/valuetree.py
ValueTree.contains_field
def contains_field(self, path, name): """ Returns True if a field exists at the specified path, otherwise False. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises TypeE...
python
def contains_field(self, path, name): """ Returns True if a field exists at the specified path, otherwise False. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises TypeE...
[ "def", "contains_field", "(", "self", ",", "path", ",", "name", ")", ":", "try", ":", "self", ".", "get_field", "(", "path", ",", "name", ")", "return", "True", "except", "KeyError", ":", "return", "False" ]
Returns True if a field exists at the specified path, otherwise False. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises TypeError: The field name is a component of a path.
[ "Returns", "True", "if", "a", "field", "exists", "at", "the", "specified", "path", "otherwise", "False", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L267-L282
msfrank/cifparser
cifparser/valuetree.py
ValueTree.contains_field_list
def contains_field_list(self, path, name): """ Returns True if a multi-valued field exists at the specified path, otherwise False. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. ...
python
def contains_field_list(self, path, name): """ Returns True if a multi-valued field exists at the specified path, otherwise False. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. ...
[ "def", "contains_field_list", "(", "self", ",", "path", ",", "name", ")", ":", "try", ":", "self", ".", "get_field_list", "(", "path", ",", "name", ")", "return", "True", "except", "KeyError", ":", "return", "False" ]
Returns True if a multi-valued field exists at the specified path, otherwise False. :param path: str or Path instance :param name: :type name: str :return: :raises ValueError: A component of path is a field name. :raises TypeError: The field name is a component of a path...
[ "Returns", "True", "if", "a", "multi", "-", "valued", "field", "exists", "at", "the", "specified", "path", "otherwise", "False", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L284-L299
msfrank/cifparser
cifparser/valuetree.py
ValueTree.iter_fields
def iter_fields(self): """ Iterate all fields as a sequence of (path,name,value) tuples. :return: """ def generator(path, values): for name,value in sorted(values.items()): if isinstance(value, ValueTree): for inner in generator(pa...
python
def iter_fields(self): """ Iterate all fields as a sequence of (path,name,value) tuples. :return: """ def generator(path, values): for name,value in sorted(values.items()): if isinstance(value, ValueTree): for inner in generator(pa...
[ "def", "iter_fields", "(", "self", ")", ":", "def", "generator", "(", "path", ",", "values", ")", ":", "for", "name", ",", "value", "in", "sorted", "(", "values", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "value", ",", "ValueTree", ...
Iterate all fields as a sequence of (path,name,value) tuples. :return:
[ "Iterate", "all", "fields", "as", "a", "sequence", "of", "(", "path", "name", "value", ")", "tuples", "." ]
train
https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L315-L328
opinkerfi/nago
nago/extensions/facts.py
get
def get(): """ Get local facts about this machine. Returns: json-compatible dict with all facts of this host """ result = runCommand('facter --json', raise_error_on_fail=True) json_facts = result[1] facts = json.loads(json_facts) return facts
python
def get(): """ Get local facts about this machine. Returns: json-compatible dict with all facts of this host """ result = runCommand('facter --json', raise_error_on_fail=True) json_facts = result[1] facts = json.loads(json_facts) return facts
[ "def", "get", "(", ")", ":", "result", "=", "runCommand", "(", "'facter --json'", ",", "raise_error_on_fail", "=", "True", ")", "json_facts", "=", "result", "[", "1", "]", "facts", "=", "json", ".", "loads", "(", "json_facts", ")", "return", "facts" ]
Get local facts about this machine. Returns: json-compatible dict with all facts of this host
[ "Get", "local", "facts", "about", "this", "machine", "." ]
train
https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/facts.py#L20-L29
opinkerfi/nago
nago/extensions/facts.py
get_all
def get_all(): """ Get all facts about all nodes """ result = {} for k,v in nago.extensions.info.node_data.items(): result[k] = v.get('facts', {}) return result
python
def get_all(): """ Get all facts about all nodes """ result = {} for k,v in nago.extensions.info.node_data.items(): result[k] = v.get('facts', {}) return result
[ "def", "get_all", "(", ")", ":", "result", "=", "{", "}", "for", "k", ",", "v", "in", "nago", ".", "extensions", ".", "info", ".", "node_data", ".", "items", "(", ")", ":", "result", "[", "k", "]", "=", "v", ".", "get", "(", "'facts'", ",", "...
Get all facts about all nodes
[ "Get", "all", "facts", "about", "all", "nodes" ]
train
https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/facts.py#L43-L48
opinkerfi/nago
nago/extensions/facts.py
send
def send(remote_host=None): """ Send my facts to a remote host if remote_host is provided, data will be sent to that host. Otherwise it will be sent to master. """ my_facts = get() if not remote_host: remote_host = nago.extensions.settings.get('server') remote_node = nago.core.get_node(...
python
def send(remote_host=None): """ Send my facts to a remote host if remote_host is provided, data will be sent to that host. Otherwise it will be sent to master. """ my_facts = get() if not remote_host: remote_host = nago.extensions.settings.get('server') remote_node = nago.core.get_node(...
[ "def", "send", "(", "remote_host", "=", "None", ")", ":", "my_facts", "=", "get", "(", ")", "if", "not", "remote_host", ":", "remote_host", "=", "nago", ".", "extensions", ".", "settings", ".", "get", "(", "'server'", ")", "remote_node", "=", "nago", "...
Send my facts to a remote host if remote_host is provided, data will be sent to that host. Otherwise it will be sent to master.
[ "Send", "my", "facts", "to", "a", "remote", "host" ]
train
https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/facts.py#L51-L66
eddiejessup/fealty
fealty/lattice.py
extend_array
def extend_array(a, n): """Increase the resolution of an array by duplicating its values to fill a larger array. Parameters ---------- a: array, shape (a1, a2, a3, ...) n: integer Factor by which to expand the array. Returns ------- ae: array, shape (n * a1, n * a2, n * a3,...
python
def extend_array(a, n): """Increase the resolution of an array by duplicating its values to fill a larger array. Parameters ---------- a: array, shape (a1, a2, a3, ...) n: integer Factor by which to expand the array. Returns ------- ae: array, shape (n * a1, n * a2, n * a3,...
[ "def", "extend_array", "(", "a", ",", "n", ")", ":", "a_new", "=", "a", ".", "copy", "(", ")", "for", "d", "in", "range", "(", "a", ".", "ndim", ")", ":", "a_new", "=", "np", ".", "repeat", "(", "a_new", ",", "n", ",", "axis", "=", "d", ")"...
Increase the resolution of an array by duplicating its values to fill a larger array. Parameters ---------- a: array, shape (a1, a2, a3, ...) n: integer Factor by which to expand the array. Returns ------- ae: array, shape (n * a1, n * a2, n * a3, ...)
[ "Increase", "the", "resolution", "of", "an", "array", "by", "duplicating", "its", "values", "to", "fill", "a", "larger", "array", "." ]
train
https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L9-L26
eddiejessup/fealty
fealty/lattice.py
field_subset
def field_subset(f, inds, rank=0): """Return the value of a field at a subset of points. Parameters ---------- f: array, shape (a1, a2, ..., ad, r1, r2, ..., rrank) Rank-r field in d dimensions inds: integer array, shape (n, d) Index vectors rank: integer The rank of the...
python
def field_subset(f, inds, rank=0): """Return the value of a field at a subset of points. Parameters ---------- f: array, shape (a1, a2, ..., ad, r1, r2, ..., rrank) Rank-r field in d dimensions inds: integer array, shape (n, d) Index vectors rank: integer The rank of the...
[ "def", "field_subset", "(", "f", ",", "inds", ",", "rank", "=", "0", ")", ":", "f_dim_space", "=", "f", ".", "ndim", "-", "rank", "if", "inds", ".", "ndim", ">", "2", ":", "raise", "Exception", "(", "'Too many dimensions in indices array'", ")", "if", ...
Return the value of a field at a subset of points. Parameters ---------- f: array, shape (a1, a2, ..., ad, r1, r2, ..., rrank) Rank-r field in d dimensions inds: integer array, shape (n, d) Index vectors rank: integer The rank of the field (0: scalar field, 1: vector field a...
[ "Return", "the", "value", "of", "a", "field", "at", "a", "subset", "of", "points", "." ]
train
https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L29-L57
eddiejessup/fealty
fealty/lattice.py
pad_to_3d
def pad_to_3d(a): """Return 1- or 2-dimensional cartesian vectors, converted into a 3-dimensional representation, with additional dimensional coordinates assumed to be zero. Parameters ---------- a: array, shape (n, d), d < 3 Returns ------- ap: array, shape (n, 3) """ a_pa...
python
def pad_to_3d(a): """Return 1- or 2-dimensional cartesian vectors, converted into a 3-dimensional representation, with additional dimensional coordinates assumed to be zero. Parameters ---------- a: array, shape (n, d), d < 3 Returns ------- ap: array, shape (n, 3) """ a_pa...
[ "def", "pad_to_3d", "(", "a", ")", ":", "a_pad", "=", "np", ".", "zeros", "(", "[", "len", "(", "a", ")", ",", "3", "]", ",", "dtype", "=", "a", ".", "dtype", ")", "a_pad", "[", ":", ",", ":", "a", ".", "shape", "[", "-", "1", "]", "]", ...
Return 1- or 2-dimensional cartesian vectors, converted into a 3-dimensional representation, with additional dimensional coordinates assumed to be zero. Parameters ---------- a: array, shape (n, d), d < 3 Returns ------- ap: array, shape (n, 3)
[ "Return", "1", "-", "or", "2", "-", "dimensional", "cartesian", "vectors", "converted", "into", "a", "3", "-", "dimensional", "representation", "with", "additional", "dimensional", "coordinates", "assumed", "to", "be", "zero", "." ]
train
https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L60-L75
eddiejessup/fealty
fealty/lattice.py
pad_length
def pad_length(x, d): """Return a vector appropriate to a dimensional space, using an input vector as a prompt depending on its type: - If the input is a vector, return that vector. - If the input is a scalar, return a vector filled with that value. Useful when a function expects an array ...
python
def pad_length(x, d): """Return a vector appropriate to a dimensional space, using an input vector as a prompt depending on its type: - If the input is a vector, return that vector. - If the input is a scalar, return a vector filled with that value. Useful when a function expects an array ...
[ "def", "pad_length", "(", "x", ",", "d", ")", ":", "try", ":", "x", "[", "0", "]", "except", "TypeError", ":", "x", "=", "d", "*", "[", "x", "]", "return", "np", ".", "array", "(", "x", ")" ]
Return a vector appropriate to a dimensional space, using an input vector as a prompt depending on its type: - If the input is a vector, return that vector. - If the input is a scalar, return a vector filled with that value. Useful when a function expects an array specifying values along each ...
[ "Return", "a", "vector", "appropriate", "to", "a", "dimensional", "space", "using", "an", "input", "vector", "as", "a", "prompt", "depending", "on", "its", "type", ":" ]
train
https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L78-L105
Cologler/fsoopify-python
fsoopify/nodes.py
NodeInfo.rename
def rename(self, dest_path: str): ''' use `os.rename()` to move the node. ''' if not isinstance(dest_path, str): raise TypeError os.rename(self._path, dest_path) self._path = Path(dest_path).get_abspath()
python
def rename(self, dest_path: str): ''' use `os.rename()` to move the node. ''' if not isinstance(dest_path, str): raise TypeError os.rename(self._path, dest_path) self._path = Path(dest_path).get_abspath()
[ "def", "rename", "(", "self", ",", "dest_path", ":", "str", ")", ":", "if", "not", "isinstance", "(", "dest_path", ",", "str", ")", ":", "raise", "TypeError", "os", ".", "rename", "(", "self", ".", "_path", ",", "dest_path", ")", "self", ".", "_path"...
use `os.rename()` to move the node.
[ "use", "os", ".", "rename", "()", "to", "move", "the", "node", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L43-L50
Cologler/fsoopify-python
fsoopify/nodes.py
NodeInfo.get_parent
def get_parent(self, level=1): ''' get parent dir as a `DirectoryInfo`. return `None` if self is top. ''' try: parent_path = self.path.get_parent(level) except ValueError: # abspath cannot get parent return None assert parent_path ...
python
def get_parent(self, level=1): ''' get parent dir as a `DirectoryInfo`. return `None` if self is top. ''' try: parent_path = self.path.get_parent(level) except ValueError: # abspath cannot get parent return None assert parent_path ...
[ "def", "get_parent", "(", "self", ",", "level", "=", "1", ")", ":", "try", ":", "parent_path", "=", "self", ".", "path", ".", "get_parent", "(", "level", ")", "except", "ValueError", ":", "# abspath cannot get parent", "return", "None", "assert", "parent_pat...
get parent dir as a `DirectoryInfo`. return `None` if self is top.
[ "get", "parent", "dir", "as", "a", "DirectoryInfo", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L52-L63
Cologler/fsoopify-python
fsoopify/nodes.py
NodeInfo.from_path
def from_path(path): ''' create from path. return `None` if path is not exists. ''' if os.path.isdir(path): return DirectoryInfo(path) if os.path.isfile(path): return FileInfo(path) return None
python
def from_path(path): ''' create from path. return `None` if path is not exists. ''' if os.path.isdir(path): return DirectoryInfo(path) if os.path.isfile(path): return FileInfo(path) return None
[ "def", "from_path", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "return", "DirectoryInfo", "(", "path", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "FileInfo", "(", "path", ...
create from path. return `None` if path is not exists.
[ "create", "from", "path", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L66-L78
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.open
def open(self, mode='r', *, buffering=-1, encoding=None, newline=None, closefd=True): ''' open the file. ''' return open(self._path, mode=mode, buffering=buffering, encoding=encoding, newline=newline, clo...
python
def open(self, mode='r', *, buffering=-1, encoding=None, newline=None, closefd=True): ''' open the file. ''' return open(self._path, mode=mode, buffering=buffering, encoding=encoding, newline=newline, clo...
[ "def", "open", "(", "self", ",", "mode", "=", "'r'", ",", "*", ",", "buffering", "=", "-", "1", ",", "encoding", "=", "None", ",", "newline", "=", "None", ",", "closefd", "=", "True", ")", ":", "return", "open", "(", "self", ".", "_path", ",", ...
open the file.
[ "open", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L134-L141
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.write
def write(self, data, *, mode=None, buffering=-1, encoding=None, newline=None): ''' write data into the file. ''' if mode is None: mode = 'w' if isinstance(data, str) else 'wb' with self.open(mode=mode, buffering=buffering, encoding=encoding, newline=newline) as fp: retur...
python
def write(self, data, *, mode=None, buffering=-1, encoding=None, newline=None): ''' write data into the file. ''' if mode is None: mode = 'w' if isinstance(data, str) else 'wb' with self.open(mode=mode, buffering=buffering, encoding=encoding, newline=newline) as fp: retur...
[ "def", "write", "(", "self", ",", "data", ",", "*", ",", "mode", "=", "None", ",", "buffering", "=", "-", "1", ",", "encoding", "=", "None", ",", "newline", "=", "None", ")", ":", "if", "mode", "is", "None", ":", "mode", "=", "'w'", "if", "isin...
write data into the file.
[ "write", "data", "into", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L148-L153
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.read
def read(self, mode='r', *, buffering=-1, encoding=None, newline=None): ''' read data from the file. ''' with self.open(mode=mode, buffering=buffering, encoding=encoding, newline=newline) as fp: return fp.read()
python
def read(self, mode='r', *, buffering=-1, encoding=None, newline=None): ''' read data from the file. ''' with self.open(mode=mode, buffering=buffering, encoding=encoding, newline=newline) as fp: return fp.read()
[ "def", "read", "(", "self", ",", "mode", "=", "'r'", ",", "*", ",", "buffering", "=", "-", "1", ",", "encoding", "=", "None", ",", "newline", "=", "None", ")", ":", "with", "self", ".", "open", "(", "mode", "=", "mode", ",", "buffering", "=", "...
read data from the file.
[ "read", "data", "from", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L155-L158
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.write_text
def write_text(self, text: str, *, encoding='utf-8', append=True): ''' write text into the file. ''' mode = 'a' if append else 'w' return self.write(text, mode=mode, encoding=encoding)
python
def write_text(self, text: str, *, encoding='utf-8', append=True): ''' write text into the file. ''' mode = 'a' if append else 'w' return self.write(text, mode=mode, encoding=encoding)
[ "def", "write_text", "(", "self", ",", "text", ":", "str", ",", "*", ",", "encoding", "=", "'utf-8'", ",", "append", "=", "True", ")", ":", "mode", "=", "'a'", "if", "append", "else", "'w'", "return", "self", ".", "write", "(", "text", ",", "mode",...
write text into the file.
[ "write", "text", "into", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L160-L163
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.write_bytes
def write_bytes(self, data: bytes, *, append=True): ''' write bytes into the file. ''' mode = 'ab' if append else 'wb' return self.write(data, mode=mode)
python
def write_bytes(self, data: bytes, *, append=True): ''' write bytes into the file. ''' mode = 'ab' if append else 'wb' return self.write(data, mode=mode)
[ "def", "write_bytes", "(", "self", ",", "data", ":", "bytes", ",", "*", ",", "append", "=", "True", ")", ":", "mode", "=", "'ab'", "if", "append", "else", "'wb'", "return", "self", ".", "write", "(", "data", ",", "mode", "=", "mode", ")" ]
write bytes into the file.
[ "write", "bytes", "into", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L165-L168
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.copy_to
def copy_to(self, dest, buffering: int = -1): ''' copy the file to dest path. `dest` canbe `str`, `FileInfo` or `DirectoryInfo`. if `dest` is `DirectoryInfo`, that mean copy into the dir with same name. ''' if isinstance(dest, str): dest_path = dest ...
python
def copy_to(self, dest, buffering: int = -1): ''' copy the file to dest path. `dest` canbe `str`, `FileInfo` or `DirectoryInfo`. if `dest` is `DirectoryInfo`, that mean copy into the dir with same name. ''' if isinstance(dest, str): dest_path = dest ...
[ "def", "copy_to", "(", "self", ",", "dest", ",", "buffering", ":", "int", "=", "-", "1", ")", ":", "if", "isinstance", "(", "dest", ",", "str", ")", ":", "dest_path", "=", "dest", "elif", "isinstance", "(", "dest", ",", "FileInfo", ")", ":", "dest_...
copy the file to dest path. `dest` canbe `str`, `FileInfo` or `DirectoryInfo`. if `dest` is `DirectoryInfo`, that mean copy into the dir with same name.
[ "copy", "the", "file", "to", "dest", "path", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L170-L191
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.read_text
def read_text(self, encoding='utf-8') -> str: ''' read all text into memory. ''' with self.open('r', encoding=encoding) as fp: return fp.read()
python
def read_text(self, encoding='utf-8') -> str: ''' read all text into memory. ''' with self.open('r', encoding=encoding) as fp: return fp.read()
[ "def", "read_text", "(", "self", ",", "encoding", "=", "'utf-8'", ")", "->", "str", ":", "with", "self", ".", "open", "(", "'r'", ",", "encoding", "=", "encoding", ")", "as", "fp", ":", "return", "fp", ".", "read", "(", ")" ]
read all text into memory.
[ "read", "all", "text", "into", "memory", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L193-L196
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.load
def load(self, format=None, *, kwargs={}): ''' deserialize object from the file. auto detect format by file extension name if `format` is None. for example, `.json` will detect as `json`. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any s...
python
def load(self, format=None, *, kwargs={}): ''' deserialize object from the file. auto detect format by file extension name if `format` is None. for example, `.json` will detect as `json`. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any s...
[ "def", "load", "(", "self", ",", "format", "=", "None", ",", "*", ",", "kwargs", "=", "{", "}", ")", ":", "return", "load", "(", "self", ",", "format", "=", "format", ",", "kwargs", "=", "kwargs", ")" ]
deserialize object from the file. auto detect format by file extension name if `format` is None. for example, `.json` will detect as `json`. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any serialize exceptions.
[ "deserialize", "object", "from", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L228-L238
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.dump
def dump(self, obj, format=None, *, kwargs={}): ''' serialize the `obj` into file. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any serialize exceptions. ''' return dump(self, obj, format=format, kwargs=kwargs)
python
def dump(self, obj, format=None, *, kwargs={}): ''' serialize the `obj` into file. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any serialize exceptions. ''' return dump(self, obj, format=format, kwargs=kwargs)
[ "def", "dump", "(", "self", ",", "obj", ",", "format", "=", "None", ",", "*", ",", "kwargs", "=", "{", "}", ")", ":", "return", "dump", "(", "self", ",", "obj", ",", "format", "=", "format", ",", "kwargs", "=", "kwargs", ")" ]
serialize the `obj` into file. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any serialize exceptions.
[ "serialize", "the", "obj", "into", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L240-L247
Cologler/fsoopify-python
fsoopify/nodes.py
FileInfo.get_file_hash
def get_file_hash(self, *algorithms: str): ''' get lower case hash of file. return value is a tuple, you may need to unpack it. for example: `get_file_hash('md5', 'sha1')` return `('XXXX1', 'XXXX2')` ''' from .hashs import hashfile_hexdigest return hashfile_hexd...
python
def get_file_hash(self, *algorithms: str): ''' get lower case hash of file. return value is a tuple, you may need to unpack it. for example: `get_file_hash('md5', 'sha1')` return `('XXXX1', 'XXXX2')` ''' from .hashs import hashfile_hexdigest return hashfile_hexd...
[ "def", "get_file_hash", "(", "self", ",", "*", "algorithms", ":", "str", ")", ":", "from", ".", "hashs", "import", "hashfile_hexdigest", "return", "hashfile_hexdigest", "(", "self", ".", "_path", ",", "algorithms", ")" ]
get lower case hash of file. return value is a tuple, you may need to unpack it. for example: `get_file_hash('md5', 'sha1')` return `('XXXX1', 'XXXX2')`
[ "get", "lower", "case", "hash", "of", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L251-L260
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.iter_items
def iter_items(self, depth: int = 1): ''' get items from directory. ''' if depth is not None and not isinstance(depth, int): raise TypeError def itor(root, d): if d is not None: d -= 1 if d < 0: return ...
python
def iter_items(self, depth: int = 1): ''' get items from directory. ''' if depth is not None and not isinstance(depth, int): raise TypeError def itor(root, d): if d is not None: d -= 1 if d < 0: return ...
[ "def", "iter_items", "(", "self", ",", "depth", ":", "int", "=", "1", ")", ":", "if", "depth", "is", "not", "None", "and", "not", "isinstance", "(", "depth", ",", "int", ")", ":", "raise", "TypeError", "def", "itor", "(", "root", ",", "d", ")", "...
get items from directory.
[ "get", "items", "from", "directory", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L274-L291
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.has_file
def has_file(self, name: str): ''' check whether this directory contains the file. ''' return os.path.isfile(self._path / name)
python
def has_file(self, name: str): ''' check whether this directory contains the file. ''' return os.path.isfile(self._path / name)
[ "def", "has_file", "(", "self", ",", "name", ":", "str", ")", ":", "return", "os", ".", "path", ".", "isfile", "(", "self", ".", "_path", "/", "name", ")" ]
check whether this directory contains the file.
[ "check", "whether", "this", "directory", "contains", "the", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L299-L303
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.has_directory
def has_directory(self, name: str): ''' check whether this directory contains the directory. ''' return os.path.isdir(self._path / name)
python
def has_directory(self, name: str): ''' check whether this directory contains the directory. ''' return os.path.isdir(self._path / name)
[ "def", "has_directory", "(", "self", ",", "name", ":", "str", ")", ":", "return", "os", ".", "path", ".", "isdir", "(", "self", ".", "_path", "/", "name", ")" ]
check whether this directory contains the directory.
[ "check", "whether", "this", "directory", "contains", "the", "directory", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L305-L309
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.get_fileinfo
def get_fileinfo(self, name: str): ''' get a `FileInfo` for a file (without create actual file). ''' return FileInfo(os.path.join(self._path, name))
python
def get_fileinfo(self, name: str): ''' get a `FileInfo` for a file (without create actual file). ''' return FileInfo(os.path.join(self._path, name))
[ "def", "get_fileinfo", "(", "self", ",", "name", ":", "str", ")", ":", "return", "FileInfo", "(", "os", ".", "path", ".", "join", "(", "self", ".", "_path", ",", "name", ")", ")" ]
get a `FileInfo` for a file (without create actual file).
[ "get", "a", "FileInfo", "for", "a", "file", "(", "without", "create", "actual", "file", ")", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L311-L315
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.get_dirinfo
def get_dirinfo(self, name: str): ''' get a `DirectoryInfo` for a directory (without create actual directory). ''' return DirectoryInfo(os.path.join(self._path, name))
python
def get_dirinfo(self, name: str): ''' get a `DirectoryInfo` for a directory (without create actual directory). ''' return DirectoryInfo(os.path.join(self._path, name))
[ "def", "get_dirinfo", "(", "self", ",", "name", ":", "str", ")", ":", "return", "DirectoryInfo", "(", "os", ".", "path", ".", "join", "(", "self", ".", "_path", ",", "name", ")", ")" ]
get a `DirectoryInfo` for a directory (without create actual directory).
[ "get", "a", "DirectoryInfo", "for", "a", "directory", "(", "without", "create", "actual", "directory", ")", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L317-L321
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.create_file
def create_file(self, name: str, generate_unique_name: bool = False): ''' create a `FileInfo` for a new file. if the file was exists, and `generate_unique_name` if `False`, raise `FileExistsError`. the op does mean the file is created on disk. ''' def enumerate_name(): ...
python
def create_file(self, name: str, generate_unique_name: bool = False): ''' create a `FileInfo` for a new file. if the file was exists, and `generate_unique_name` if `False`, raise `FileExistsError`. the op does mean the file is created on disk. ''' def enumerate_name(): ...
[ "def", "create_file", "(", "self", ",", "name", ":", "str", ",", "generate_unique_name", ":", "bool", "=", "False", ")", ":", "def", "enumerate_name", "(", ")", ":", "yield", "name", "index", "=", "0", "while", "True", ":", "index", "+=", "1", "yield",...
create a `FileInfo` for a new file. if the file was exists, and `generate_unique_name` if `False`, raise `FileExistsError`. the op does mean the file is created on disk.
[ "create", "a", "FileInfo", "for", "a", "new", "file", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L323-L342
Cologler/fsoopify-python
fsoopify/nodes.py
DirectoryInfo.create_hardlink
def create_hardlink(self, dest_path: str): ''' create hardlink for the directory (includes childs). ''' # self dirinfo = DirectoryInfo(dest_path) dirinfo.ensure_created() # child for item in self.list_items(): item.create_hardlink(os.path.join(dest_path, ite...
python
def create_hardlink(self, dest_path: str): ''' create hardlink for the directory (includes childs). ''' # self dirinfo = DirectoryInfo(dest_path) dirinfo.ensure_created() # child for item in self.list_items(): item.create_hardlink(os.path.join(dest_path, ite...
[ "def", "create_hardlink", "(", "self", ",", "dest_path", ":", "str", ")", ":", "# self", "dirinfo", "=", "DirectoryInfo", "(", "dest_path", ")", "dirinfo", ".", "ensure_created", "(", ")", "# child", "for", "item", "in", "self", ".", "list_items", "(", ")"...
create hardlink for the directory (includes childs).
[ "create", "hardlink", "for", "the", "directory", "(", "includes", "childs", ")", "." ]
train
https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L365-L374
ulf1/oxyba
oxyba/rand_bivar.py
rand_bivar
def rand_bivar(X, rho): """Transform two unrelated random variables into correlated bivariate data X : ndarray two univariate random variables with N observations as <N x 2> matrix rho : float The Pearson correlations coefficient as number between [-1, +1] """ impor...
python
def rand_bivar(X, rho): """Transform two unrelated random variables into correlated bivariate data X : ndarray two univariate random variables with N observations as <N x 2> matrix rho : float The Pearson correlations coefficient as number between [-1, +1] """ impor...
[ "def", "rand_bivar", "(", "X", ",", "rho", ")", ":", "import", "numpy", "as", "np", "Y", "=", "np", ".", "empty", "(", "X", ".", "shape", ")", "Y", "[", ":", ",", "0", "]", "=", "X", "[", ":", ",", "0", "]", "Y", "[", ":", ",", "1", "]"...
Transform two unrelated random variables into correlated bivariate data X : ndarray two univariate random variables with N observations as <N x 2> matrix rho : float The Pearson correlations coefficient as number between [-1, +1]
[ "Transform", "two", "unrelated", "random", "variables", "into", "correlated", "bivariate", "data" ]
train
https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/rand_bivar.py#L2-L17
kervi/kervi-core
kervi/values/kervi_value.py
KerviValue.link_to
def link_to(self, source, transformation=None): """ Kervi values may be linked together. A KerviValue is configured to be either an input or output. When an output value is linked to an input value the input will become an observer of the output. Every time the output value chan...
python
def link_to(self, source, transformation=None): """ Kervi values may be linked together. A KerviValue is configured to be either an input or output. When an output value is linked to an input value the input will become an observer of the output. Every time the output value chan...
[ "def", "link_to", "(", "self", ",", "source", ",", "transformation", "=", "None", ")", ":", "if", "isinstance", "(", "source", ",", "KerviValue", ")", ":", "if", "source", ".", "is_input", "and", "not", "self", ".", "is_input", ":", "self", ".", "add_o...
Kervi values may be linked together. A KerviValue is configured to be either an input or output. When an output value is linked to an input value the input will become an observer of the output. Every time the output value change it will notify the input about the change. :par...
[ "Kervi", "values", "may", "be", "linked", "together", ".", "A", "KerviValue", "is", "configured", "to", "be", "either", "an", "input", "or", "output", ".", "When", "an", "output", "value", "is", "linked", "to", "an", "input", "value", "the", "input", "wi...
train
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/values/kervi_value.py#L157-L196
kervi/kervi-core
kervi/values/kervi_value.py
KerviValue.link_to_dashboard
def link_to_dashboard(self, dashboard_id=None, panel_id=None, **kwargs): r""" Links this value to a dashboard panel. :param dashboard_id: Id of the dashboard to link to. :type dashboard_id: str :param panel_id: Id of the panel on the dashboard to link to...
python
def link_to_dashboard(self, dashboard_id=None, panel_id=None, **kwargs): r""" Links this value to a dashboard panel. :param dashboard_id: Id of the dashboard to link to. :type dashboard_id: str :param panel_id: Id of the panel on the dashboard to link to...
[ "def", "link_to_dashboard", "(", "self", ",", "dashboard_id", "=", "None", ",", "panel_id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "KerviComponent", ".", "link_to_dashboard", "(", "self", ",", "dashboard_id", ",", "panel_id", ",", "*", "*", "kwarg...
r""" Links this value to a dashboard panel. :param dashboard_id: Id of the dashboard to link to. :type dashboard_id: str :param panel_id: Id of the panel on the dashboard to link to. :type panel_id: str :param \**kwargs: Use ...
[ "r", "Links", "this", "value", "to", "a", "dashboard", "panel", "." ]
train
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/values/kervi_value.py#L198-L236
kervi/kervi-core
kervi/values/kervi_value.py
KerviValue.add_value_event
def add_value_event(self, event_value, func, event_type=None, parameters=None, **kwargs): """ Add a function that is called when the value reach or pass the event_value. :param event_value: A single value or range specified as a tuple. If it is a range the function spec...
python
def add_value_event(self, event_value, func, event_type=None, parameters=None, **kwargs): """ Add a function that is called when the value reach or pass the event_value. :param event_value: A single value or range specified as a tuple. If it is a range the function spec...
[ "def", "add_value_event", "(", "self", ",", "event_value", ",", "func", ",", "event_type", "=", "None", ",", "parameters", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_value_event_handlers", "+=", "[", "(", "event_value", ",", "func", "...
Add a function that is called when the value reach or pass the event_value. :param event_value: A single value or range specified as a tuple. If it is a range the function specified in func is called when the value enters the range. :type event_value: ``float``, ``string``, ``...
[ "Add", "a", "function", "that", "is", "called", "when", "the", "value", "reach", "or", "pass", "the", "event_value", "." ]
train
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/values/kervi_value.py#L305-L327
mmk2410/uulm-mensa
uulm_mensa/cli.py
get
def get(url): """Recieving the JSON file from uulm""" response = urllib.request.urlopen(url) data = response.read() data = data.decode("utf-8") data = json.loads(data) return data
python
def get(url): """Recieving the JSON file from uulm""" response = urllib.request.urlopen(url) data = response.read() data = data.decode("utf-8") data = json.loads(data) return data
[ "def", "get", "(", "url", ")", ":", "response", "=", "urllib", ".", "request", ".", "urlopen", "(", "url", ")", "data", "=", "response", ".", "read", "(", ")", "data", "=", "data", ".", "decode", "(", "\"utf-8\"", ")", "data", "=", "json", ".", "...
Recieving the JSON file from uulm
[ "Recieving", "the", "JSON", "file", "from", "uulm" ]
train
https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L37-L43
mmk2410/uulm-mensa
uulm_mensa/cli.py
get_day
def get_day(): """Function for retrieving the wanted day""" day = datetime.datetime.today().weekday() if len(sys.argv) == 3: if sys.argv[2] == "mon": day = 0 elif sys.argv[2] == "tue": day = 1 elif sys.argv[2] == "wed": day = 2 elif sys.arg...
python
def get_day(): """Function for retrieving the wanted day""" day = datetime.datetime.today().weekday() if len(sys.argv) == 3: if sys.argv[2] == "mon": day = 0 elif sys.argv[2] == "tue": day = 1 elif sys.argv[2] == "wed": day = 2 elif sys.arg...
[ "def", "get_day", "(", ")", ":", "day", "=", "datetime", ".", "datetime", ".", "today", "(", ")", ".", "weekday", "(", ")", "if", "len", "(", "sys", ".", "argv", ")", "==", "3", ":", "if", "sys", ".", "argv", "[", "2", "]", "==", "\"mon\"", "...
Function for retrieving the wanted day
[ "Function", "for", "retrieving", "the", "wanted", "day" ]
train
https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L45-L64
mmk2410/uulm-mensa
uulm_mensa/cli.py
print_menu
def print_menu(place, static=False): """Function for printing the menu Keyword arguments: place -- name of the cafeteria / mensa static -- set true if a static menu exists (default: False) """ day = get_day() if static: plan = get(FILES[1]) for meal in plan["weeks"][0]["days...
python
def print_menu(place, static=False): """Function for printing the menu Keyword arguments: place -- name of the cafeteria / mensa static -- set true if a static menu exists (default: False) """ day = get_day() if static: plan = get(FILES[1]) for meal in plan["weeks"][0]["days...
[ "def", "print_menu", "(", "place", ",", "static", "=", "False", ")", ":", "day", "=", "get_day", "(", ")", "if", "static", ":", "plan", "=", "get", "(", "FILES", "[", "1", "]", ")", "for", "meal", "in", "plan", "[", "\"weeks\"", "]", "[", "0", ...
Function for printing the menu Keyword arguments: place -- name of the cafeteria / mensa static -- set true if a static menu exists (default: False)
[ "Function", "for", "printing", "the", "menu" ]
train
https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L66-L84
mmk2410/uulm-mensa
uulm_mensa/cli.py
main
def main(): """Entry point for the application script""" if len(sys.argv) >= 2: cmd = sys.argv[1] if cmd == "help": print_usage() else: if cmd == "mensa": print_menu("Mensa") elif cmd == "bistro": print_menu("Bistro") ...
python
def main(): """Entry point for the application script""" if len(sys.argv) >= 2: cmd = sys.argv[1] if cmd == "help": print_usage() else: if cmd == "mensa": print_menu("Mensa") elif cmd == "bistro": print_menu("Bistro") ...
[ "def", "main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", ">=", "2", ":", "cmd", "=", "sys", ".", "argv", "[", "1", "]", "if", "cmd", "==", "\"help\"", ":", "print_usage", "(", ")", "else", ":", "if", "cmd", "==", "\"mensa\"", ...
Entry point for the application script
[ "Entry", "point", "for", "the", "application", "script" ]
train
https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L86-L112
miquelo/resort
packages/resort/__init__.py
setup
def setup( work_dir=".resort", profiles=None ): """ Configures a project to be managed by *resort*. :param str work_dir: Path of directory were profiles will be created. :param dict profiles: Dictionary containing profile type and instance entries. """ # Initialize colorama colorama.init() # Pr...
python
def setup( work_dir=".resort", profiles=None ): """ Configures a project to be managed by *resort*. :param str work_dir: Path of directory were profiles will be created. :param dict profiles: Dictionary containing profile type and instance entries. """ # Initialize colorama colorama.init() # Pr...
[ "def", "setup", "(", "work_dir", "=", "\".resort\"", ",", "profiles", "=", "None", ")", ":", "# Initialize colorama", "colorama", ".", "init", "(", ")", "# Program name", "prog_name", "=", "sys", ".", "argv", "[", "0", "]", "# Profile manager", "prof_mgr", "...
Configures a project to be managed by *resort*. :param str work_dir: Path of directory were profiles will be created. :param dict profiles: Dictionary containing profile type and instance entries.
[ "Configures", "a", "project", "to", "be", "managed", "by", "*", "resort", "*", ".", ":", "param", "str", "work_dir", ":", "Path", "of", "directory", "were", "profiles", "will", "be", "created", ".", ":", "param", "dict", "profiles", ":", "Dictionary", "c...
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L31-L85
miquelo/resort
packages/resort/__init__.py
command_init
def command_init(prog_name, prof_mgr, prof_name, prog_args): """ Initialize a profile. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "type", metavar="type", type=str, nargs=1, help="profile type" ) args = parser.parse_args(prog_args) # Profil...
python
def command_init(prog_name, prof_mgr, prof_name, prog_args): """ Initialize a profile. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "type", metavar="type", type=str, nargs=1, help="profile type" ) args = parser.parse_args(prog_args) # Profil...
[ "def", "command_init", "(", "prog_name", ",", "prof_mgr", ",", "prof_name", ",", "prog_args", ")", ":", "# Retrieve arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "prog_name", ")", "parser", ".", "add_argument", "(", "\"type\"", ...
Initialize a profile.
[ "Initialize", "a", "profile", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L194-L215
miquelo/resort
packages/resort/__init__.py
command_list
def command_list(prog_name, prof_mgr, prof_name, prog_args): """ Print the list of components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) args = parser.parse_args(prog_args) # Profile load prof_stub = prof_mgr.load(prof_name) # Print component list out = io.StringIO(...
python
def command_list(prog_name, prof_mgr, prof_name, prog_args): """ Print the list of components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) args = parser.parse_args(prog_args) # Profile load prof_stub = prof_mgr.load(prof_name) # Print component list out = io.StringIO(...
[ "def", "command_list", "(", "prog_name", ",", "prof_mgr", ",", "prof_name", ",", "prog_args", ")", ":", "# Retrieve arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "prog_name", ")", "args", "=", "parser", ".", "parse_args", "(",...
Print the list of components.
[ "Print", "the", "list", "of", "components", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L220-L242
miquelo/resort
packages/resort/__init__.py
command_status
def command_status(prog_name, prof_mgr, prof_name, prog_args): """ Show status of component tree. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "-t", "--type", required=False, action="store_true", default=False, dest="show_type", help="show co...
python
def command_status(prog_name, prof_mgr, prof_name, prog_args): """ Show status of component tree. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "-t", "--type", required=False, action="store_true", default=False, dest="show_type", help="show co...
[ "def", "command_status", "(", "prog_name", ",", "prof_mgr", ",", "prof_name", ",", "prog_args", ")", ":", "# Retrieve arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "prog_name", ")", "parser", ".", "add_argument", "(", "\"-t\"", ...
Show status of component tree.
[ "Show", "status", "of", "component", "tree", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L247-L306
miquelo/resort
packages/resort/__init__.py
command_insert
def command_insert(prog_name, prof_mgr, prof_name, prog_args): """ Insert components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "components", metavar="comps", nargs=argparse.REMAINDER, help="system components" ) args = parser.parse_args(prog_a...
python
def command_insert(prog_name, prof_mgr, prof_name, prog_args): """ Insert components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "components", metavar="comps", nargs=argparse.REMAINDER, help="system components" ) args = parser.parse_args(prog_a...
[ "def", "command_insert", "(", "prog_name", ",", "prof_mgr", ",", "prof_name", ",", "prog_args", ")", ":", "# Retrieve arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "prog_name", ")", "parser", ".", "add_argument", "(", "\"compone...
Insert components.
[ "Insert", "components", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L311-L349
miquelo/resort
packages/resort/__init__.py
command_update
def command_update(prog_name, prof_mgr, prof_name, prog_args): """ Update components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "components", metavar="comps", nargs=argparse.REMAINDER, help="system components" ) args = parser.parse_args(prog_a...
python
def command_update(prog_name, prof_mgr, prof_name, prog_args): """ Update components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "components", metavar="comps", nargs=argparse.REMAINDER, help="system components" ) args = parser.parse_args(prog_a...
[ "def", "command_update", "(", "prog_name", ",", "prof_mgr", ",", "prof_name", ",", "prog_args", ")", ":", "# Retrieve arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "prog_name", ")", "parser", ".", "add_argument", "(", "\"compone...
Update components.
[ "Update", "components", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L397-L451
yv/pathconfig
py_src/pathconfig/plugins.py
load_plugin
def load_plugin(category, name, aux_info=None): '''fetches the entry point for a plugin and calls it with the given aux_info''' func = load_simple_endpoint(category, name) if aux_info is None: return func() else: return func(aux_info) raise KeyError(name)
python
def load_plugin(category, name, aux_info=None): '''fetches the entry point for a plugin and calls it with the given aux_info''' func = load_simple_endpoint(category, name) if aux_info is None: return func() else: return func(aux_info) raise KeyError(name)
[ "def", "load_plugin", "(", "category", ",", "name", ",", "aux_info", "=", "None", ")", ":", "func", "=", "load_simple_endpoint", "(", "category", ",", "name", ")", "if", "aux_info", "is", "None", ":", "return", "func", "(", ")", "else", ":", "return", ...
fetches the entry point for a plugin and calls it with the given aux_info
[ "fetches", "the", "entry", "point", "for", "a", "plugin", "and", "calls", "it", "with", "the", "given", "aux_info" ]
train
https://github.com/yv/pathconfig/blob/ae13901773b8465061e2aa93b2a53fd436ab6c69/py_src/pathconfig/plugins.py#L27-L35
yv/pathconfig
py_src/pathconfig/plugins.py
load_simple_endpoint
def load_simple_endpoint(category, name): '''fetches the entry point for a plugin and calls it with the given aux_info''' for ep in pkg_resources.iter_entry_points(category): if ep.name == name: return ep.load() raise KeyError(name)
python
def load_simple_endpoint(category, name): '''fetches the entry point for a plugin and calls it with the given aux_info''' for ep in pkg_resources.iter_entry_points(category): if ep.name == name: return ep.load() raise KeyError(name)
[ "def", "load_simple_endpoint", "(", "category", ",", "name", ")", ":", "for", "ep", "in", "pkg_resources", ".", "iter_entry_points", "(", "category", ")", ":", "if", "ep", ".", "name", "==", "name", ":", "return", "ep", ".", "load", "(", ")", "raise", ...
fetches the entry point for a plugin and calls it with the given aux_info
[ "fetches", "the", "entry", "point", "for", "a", "plugin", "and", "calls", "it", "with", "the", "given", "aux_info" ]
train
https://github.com/yv/pathconfig/blob/ae13901773b8465061e2aa93b2a53fd436ab6c69/py_src/pathconfig/plugins.py#L37-L43
tschaume/ccsgp_get_started
ccsgp_get_started/examples/gp_sims.py
gp_sims
def gp_sims(version): """example for a batch generating simple plots (cocktail contributions) :param version: plot version / input subdir name :type version: str """ inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, version, 'cocktail_contribs') xmax = { 'pion': 0.125, 'eta': 0.52, 'etap': ...
python
def gp_sims(version): """example for a batch generating simple plots (cocktail contributions) :param version: plot version / input subdir name :type version: str """ inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, version, 'cocktail_contribs') xmax = { 'pion': 0.125, 'eta': 0.52, 'etap': ...
[ "def", "gp_sims", "(", "version", ")", ":", "inDir", ",", "outDir", "=", "getWorkDirs", "(", ")", "inDir", "=", "os", ".", "path", ".", "join", "(", "inDir", ",", "version", ",", "'cocktail_contribs'", ")", "xmax", "=", "{", "'pion'", ":", "0.125", "...
example for a batch generating simple plots (cocktail contributions) :param version: plot version / input subdir name :type version: str
[ "example", "for", "a", "batch", "generating", "simple", "plots", "(", "cocktail", "contributions", ")" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/gp_sims.py#L12-L60
tschaume/ccsgp_get_started
ccsgp_get_started/examples/gp_sims.py
gp_sims_panel
def gp_sims_panel(version): """panel plot of cocktail simulations at all energies, includ. total :param version: plot version / input subdir name :type version: str """ inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, version) mesons = ['pion', 'eta', 'etap', 'rho', 'omega', 'phi', 'jpsi'] fst...
python
def gp_sims_panel(version): """panel plot of cocktail simulations at all energies, includ. total :param version: plot version / input subdir name :type version: str """ inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, version) mesons = ['pion', 'eta', 'etap', 'rho', 'omega', 'phi', 'jpsi'] fst...
[ "def", "gp_sims_panel", "(", "version", ")", ":", "inDir", ",", "outDir", "=", "getWorkDirs", "(", ")", "inDir", "=", "os", ".", "path", ".", "join", "(", "inDir", ",", "version", ")", "mesons", "=", "[", "'pion'", ",", "'eta'", ",", "'etap'", ",", ...
panel plot of cocktail simulations at all energies, includ. total :param version: plot version / input subdir name :type version: str
[ "panel", "plot", "of", "cocktail", "simulations", "at", "all", "energies", "includ", ".", "total" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/gp_sims.py#L62-L100
tschaume/ccsgp_get_started
ccsgp_get_started/examples/gp_sims.py
gp_sims_total_overlay
def gp_sims_total_overlay(version): """single plot comparing total cocktails at all energies :param version: plot version / input subdir name :type version: str """ inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, version) data = OrderedDict() for energy in energies: fname = os.path.join...
python
def gp_sims_total_overlay(version): """single plot comparing total cocktails at all energies :param version: plot version / input subdir name :type version: str """ inDir, outDir = getWorkDirs() inDir = os.path.join(inDir, version) data = OrderedDict() for energy in energies: fname = os.path.join...
[ "def", "gp_sims_total_overlay", "(", "version", ")", ":", "inDir", ",", "outDir", "=", "getWorkDirs", "(", ")", "inDir", "=", "os", ".", "path", ".", "join", "(", "inDir", ",", "version", ")", "data", "=", "OrderedDict", "(", ")", "for", "energy", "in"...
single plot comparing total cocktails at all energies :param version: plot version / input subdir name :type version: str
[ "single", "plot", "comparing", "total", "cocktails", "at", "all", "energies" ]
train
https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/gp_sims.py#L102-L130
yougov/vr.runners
vr/runners/image.py
ensure_image
def ensure_image(name, url, images_root, md5, untar_to=None): """Ensure OS image at url has been downloaded and (optionally) unpacked.""" image_dir_path = os.path.join(images_root, name) mkdir(image_dir_path) image_file_path = os.path.join(image_dir_path, os.path.basename(url)) ensure_file(url, imag...
python
def ensure_image(name, url, images_root, md5, untar_to=None): """Ensure OS image at url has been downloaded and (optionally) unpacked.""" image_dir_path = os.path.join(images_root, name) mkdir(image_dir_path) image_file_path = os.path.join(image_dir_path, os.path.basename(url)) ensure_file(url, imag...
[ "def", "ensure_image", "(", "name", ",", "url", ",", "images_root", ",", "md5", ",", "untar_to", "=", "None", ")", ":", "image_dir_path", "=", "os", ".", "path", ".", "join", "(", "images_root", ",", "name", ")", "mkdir", "(", "image_dir_path", ")", "i...
Ensure OS image at url has been downloaded and (optionally) unpacked.
[ "Ensure", "OS", "image", "at", "url", "has", "been", "downloaded", "and", "(", "optionally", ")", "unpacked", "." ]
train
https://github.com/yougov/vr.runners/blob/f43ba50a64b17ee4f07596fe225bcb38ca6652ad/vr/runners/image.py#L19-L26
yougov/vr.runners
vr/runners/image.py
prepare_image
def prepare_image(tarpath, outfolder, **kwargs): """Unpack the OS image stored at tarpath to outfolder. Prepare the unpacked image for use as a VR base image. """ outfolder = path.Path(outfolder) untar(tarpath, outfolder, **kwargs) # Some OSes have started making /etc/resolv.conf into a symli...
python
def prepare_image(tarpath, outfolder, **kwargs): """Unpack the OS image stored at tarpath to outfolder. Prepare the unpacked image for use as a VR base image. """ outfolder = path.Path(outfolder) untar(tarpath, outfolder, **kwargs) # Some OSes have started making /etc/resolv.conf into a symli...
[ "def", "prepare_image", "(", "tarpath", ",", "outfolder", ",", "*", "*", "kwargs", ")", ":", "outfolder", "=", "path", ".", "Path", "(", "outfolder", ")", "untar", "(", "tarpath", ",", "outfolder", ",", "*", "*", "kwargs", ")", "# Some OSes have started ma...
Unpack the OS image stored at tarpath to outfolder. Prepare the unpacked image for use as a VR base image.
[ "Unpack", "the", "OS", "image", "stored", "at", "tarpath", "to", "outfolder", "." ]
train
https://github.com/yougov/vr.runners/blob/f43ba50a64b17ee4f07596fe225bcb38ca6652ad/vr/runners/image.py#L29-L43
yougov/vr.runners
vr/runners/image.py
ImageRunner.ensure_image
def ensure_image(self): """ Ensure that config.image_url has been downloaded and unpacked. """ image_folder = self.get_image_folder() if os.path.exists(image_folder): print( 'OS image directory {} exists...not overwriting' .format( ...
python
def ensure_image(self): """ Ensure that config.image_url has been downloaded and unpacked. """ image_folder = self.get_image_folder() if os.path.exists(image_folder): print( 'OS image directory {} exists...not overwriting' .format( ...
[ "def", "ensure_image", "(", "self", ")", ":", "image_folder", "=", "self", ".", "get_image_folder", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "image_folder", ")", ":", "print", "(", "'OS image directory {} exists...not overwriting'", ".", "format", ...
Ensure that config.image_url has been downloaded and unpacked.
[ "Ensure", "that", "config", ".", "image_url", "has", "been", "downloaded", "and", "unpacked", "." ]
train
https://github.com/yougov/vr.runners/blob/f43ba50a64b17ee4f07596fe225bcb38ca6652ad/vr/runners/image.py#L79-L96
lthibault/expmpp
expmpp/client.py
Client.notify
def notify(self, msg): """Send a notification to all registered listeners. msg : str Message to send to each listener """ for listener in self.listeners: self._send(listener, msg)
python
def notify(self, msg): """Send a notification to all registered listeners. msg : str Message to send to each listener """ for listener in self.listeners: self._send(listener, msg)
[ "def", "notify", "(", "self", ",", "msg", ")", ":", "for", "listener", "in", "self", ".", "listeners", ":", "self", ".", "_send", "(", "listener", ",", "msg", ")" ]
Send a notification to all registered listeners. msg : str Message to send to each listener
[ "Send", "a", "notification", "to", "all", "registered", "listeners", "." ]
train
https://github.com/lthibault/expmpp/blob/635fb3187fe4021410e0f06ca6896098b5e1d3b4/expmpp/client.py#L87-L94
lthibault/expmpp
expmpp/client.py
Client.monitor
def monitor(self, msg, transformer=lambda _: _, unpack=False): """Decorator that sends a notification to all listeners when the wrapped function returns, optionally reporting said function's return value(s). msg : str Message to send to all listeners. If the message is a ...
python
def monitor(self, msg, transformer=lambda _: _, unpack=False): """Decorator that sends a notification to all listeners when the wrapped function returns, optionally reporting said function's return value(s). msg : str Message to send to all listeners. If the message is a ...
[ "def", "monitor", "(", "self", ",", "msg", ",", "transformer", "=", "lambda", "_", ":", "_", ",", "unpack", "=", "False", ")", ":", "def", "decorator", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "*", "args", ",", ...
Decorator that sends a notification to all listeners when the wrapped function returns, optionally reporting said function's return value(s). msg : str Message to send to all listeners. If the message is a Python-formatted string, the wrapped function's return value wil...
[ "Decorator", "that", "sends", "a", "notification", "to", "all", "listeners", "when", "the", "wrapped", "function", "returns", "optionally", "reporting", "said", "function", "s", "return", "value", "(", "s", ")", "." ]
train
https://github.com/lthibault/expmpp/blob/635fb3187fe4021410e0f06ca6896098b5e1d3b4/expmpp/client.py#L96-L135
emencia/dr-dump
drdump/builder.py
ScriptBuilder.get_deps_manager
def get_deps_manager(self, *args, **kwargs): """ Return instance of the dependancies manager using given args and kwargs Add 'silent_key_error' option in kwargs if not given. """ if 'silent_key_error' not in kwargs: kwargs['silent_key_error'] = self.silent_key_error ...
python
def get_deps_manager(self, *args, **kwargs): """ Return instance of the dependancies manager using given args and kwargs Add 'silent_key_error' option in kwargs if not given. """ if 'silent_key_error' not in kwargs: kwargs['silent_key_error'] = self.silent_key_error ...
[ "def", "get_deps_manager", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'silent_key_error'", "not", "in", "kwargs", ":", "kwargs", "[", "'silent_key_error'", "]", "=", "self", ".", "silent_key_error", "return", "self", ".", "dep...
Return instance of the dependancies manager using given args and kwargs Add 'silent_key_error' option in kwargs if not given.
[ "Return", "instance", "of", "the", "dependancies", "manager", "using", "given", "args", "and", "kwargs" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L67-L75
emencia/dr-dump
drdump/builder.py
ScriptBuilder.build_template
def build_template(self, mapfile, names, renderer): """ Build source from global and item templates """ AVAILABLE_DUMPS = json.load(open(mapfile, "r")) manager = self.get_deps_manager(AVAILABLE_DUMPS) fp = StringIO.StringIO() for i, item in enumerate(manager.ge...
python
def build_template(self, mapfile, names, renderer): """ Build source from global and item templates """ AVAILABLE_DUMPS = json.load(open(mapfile, "r")) manager = self.get_deps_manager(AVAILABLE_DUMPS) fp = StringIO.StringIO() for i, item in enumerate(manager.ge...
[ "def", "build_template", "(", "self", ",", "mapfile", ",", "names", ",", "renderer", ")", ":", "AVAILABLE_DUMPS", "=", "json", ".", "load", "(", "open", "(", "mapfile", ",", "\"r\"", ")", ")", "manager", "=", "self", ".", "get_deps_manager", "(", "AVAILA...
Build source from global and item templates
[ "Build", "source", "from", "global", "and", "item", "templates" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L84-L115
emencia/dr-dump
drdump/builder.py
ScriptBuilder._get_dump_item_context
def _get_dump_item_context(self, index, name, opts): """ Return a formated dict context """ c = { 'item_no': index, 'label': name, 'name': name, 'models': ' '.join(opts['models']), 'natural_key': '', } if opts.ge...
python
def _get_dump_item_context(self, index, name, opts): """ Return a formated dict context """ c = { 'item_no': index, 'label': name, 'name': name, 'models': ' '.join(opts['models']), 'natural_key': '', } if opts.ge...
[ "def", "_get_dump_item_context", "(", "self", ",", "index", ",", "name", ",", "opts", ")", ":", "c", "=", "{", "'item_no'", ":", "index", ",", "'label'", ":", "name", ",", "'name'", ":", "name", ",", "'models'", ":", "' '", ".", "join", "(", "opts", ...
Return a formated dict context
[ "Return", "a", "formated", "dict", "context" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L117-L131
emencia/dr-dump
drdump/builder.py
ScriptBuilder._dumpdata_template
def _dumpdata_template(self, stringbuffer, index, name, opts): """ StringIO "templates" to build a command line for 'dumpdata' """ context = self._get_dump_item_context(index, name, opts) stringbuffer.write(self.dumper_item_template.format(**context)) return stringbuffe...
python
def _dumpdata_template(self, stringbuffer, index, name, opts): """ StringIO "templates" to build a command line for 'dumpdata' """ context = self._get_dump_item_context(index, name, opts) stringbuffer.write(self.dumper_item_template.format(**context)) return stringbuffe...
[ "def", "_dumpdata_template", "(", "self", ",", "stringbuffer", ",", "index", ",", "name", ",", "opts", ")", ":", "context", "=", "self", ".", "_get_dump_item_context", "(", "index", ",", "name", ",", "opts", ")", "stringbuffer", ".", "write", "(", "self", ...
StringIO "templates" to build a command line for 'dumpdata'
[ "StringIO", "templates", "to", "build", "a", "command", "line", "for", "dumpdata" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L133-L141
emencia/dr-dump
drdump/builder.py
ScriptBuilder._loaddata_template
def _loaddata_template(self, stringbuffer, index, name, opts): """ StringIO "templates" to build a command line for 'loaddata' """ context = self._get_dump_item_context(index, name, opts) stringbuffer.write(self.loadder_item_template.format(**context)) return stringbuff...
python
def _loaddata_template(self, stringbuffer, index, name, opts): """ StringIO "templates" to build a command line for 'loaddata' """ context = self._get_dump_item_context(index, name, opts) stringbuffer.write(self.loadder_item_template.format(**context)) return stringbuff...
[ "def", "_loaddata_template", "(", "self", ",", "stringbuffer", ",", "index", ",", "name", ",", "opts", ")", ":", "context", "=", "self", ".", "_get_dump_item_context", "(", "index", ",", "name", ",", "opts", ")", "stringbuffer", ".", "write", "(", "self", ...
StringIO "templates" to build a command line for 'loaddata'
[ "StringIO", "templates", "to", "build", "a", "command", "line", "for", "loaddata" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L143-L151
emencia/dr-dump
drdump/builder.py
ScriptBuilder.generate_dumper
def generate_dumper(self, mapfile, names): """ Build dumpdata commands """ return self.build_template(mapfile, names, self._dumpdata_template)
python
def generate_dumper(self, mapfile, names): """ Build dumpdata commands """ return self.build_template(mapfile, names, self._dumpdata_template)
[ "def", "generate_dumper", "(", "self", ",", "mapfile", ",", "names", ")", ":", "return", "self", ".", "build_template", "(", "mapfile", ",", "names", ",", "self", ".", "_dumpdata_template", ")" ]
Build dumpdata commands
[ "Build", "dumpdata", "commands" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L153-L157
emencia/dr-dump
drdump/builder.py
ScriptBuilder.generate_loader
def generate_loader(self, mapfile, names): """ Build loaddata commands """ return self.build_template(mapfile, names, self._loaddata_template)
python
def generate_loader(self, mapfile, names): """ Build loaddata commands """ return self.build_template(mapfile, names, self._loaddata_template)
[ "def", "generate_loader", "(", "self", ",", "mapfile", ",", "names", ")", ":", "return", "self", ".", "build_template", "(", "mapfile", ",", "names", ",", "self", ".", "_loaddata_template", ")" ]
Build loaddata commands
[ "Build", "loaddata", "commands" ]
train
https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L159-L163
abe-winter/pg13-py
pg13/misc.py
tbframes
def tbframes(tb): 'unwind traceback tb_next structure to array' frames=[tb.tb_frame] while tb.tb_next: tb=tb.tb_next; frames.append(tb.tb_frame) return frames
python
def tbframes(tb): 'unwind traceback tb_next structure to array' frames=[tb.tb_frame] while tb.tb_next: tb=tb.tb_next; frames.append(tb.tb_frame) return frames
[ "def", "tbframes", "(", "tb", ")", ":", "frames", "=", "[", "tb", ".", "tb_frame", "]", "while", "tb", ".", "tb_next", ":", "tb", "=", "tb", ".", "tb_next", "frames", ".", "append", "(", "tb", ".", "tb_frame", ")", "return", "frames" ]
unwind traceback tb_next structure to array
[ "unwind", "traceback", "tb_next", "structure", "to", "array" ]
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/misc.py#L7-L11
abe-winter/pg13-py
pg13/misc.py
tbfuncs
def tbfuncs(frames): 'this takes the frames array returned by tbframes' return ['%s:%s:%s'%(os.path.split(f.f_code.co_filename)[-1],f.f_code.co_name,f.f_lineno) for f in frames]
python
def tbfuncs(frames): 'this takes the frames array returned by tbframes' return ['%s:%s:%s'%(os.path.split(f.f_code.co_filename)[-1],f.f_code.co_name,f.f_lineno) for f in frames]
[ "def", "tbfuncs", "(", "frames", ")", ":", "return", "[", "'%s:%s:%s'", "%", "(", "os", ".", "path", ".", "split", "(", "f", ".", "f_code", ".", "co_filename", ")", "[", "-", "1", "]", ",", "f", ".", "f_code", ".", "co_name", ",", "f", ".", "f_...
this takes the frames array returned by tbframes
[ "this", "takes", "the", "frames", "array", "returned", "by", "tbframes" ]
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/misc.py#L12-L14
abe-winter/pg13-py
pg13/misc.py
meth_once
def meth_once(f): "call once for member function (i.e. takes self as first arg)" attr = '__meth_once_'+f.__name__ @functools.wraps(f) def f2(self,*args,**kwargs): if hasattr(self,attr): raise CallOnceError(f.__name__) setattr(self,attr,True) return f(self,*args,**kwargs) return f2
python
def meth_once(f): "call once for member function (i.e. takes self as first arg)" attr = '__meth_once_'+f.__name__ @functools.wraps(f) def f2(self,*args,**kwargs): if hasattr(self,attr): raise CallOnceError(f.__name__) setattr(self,attr,True) return f(self,*args,**kwargs) return f2
[ "def", "meth_once", "(", "f", ")", ":", "attr", "=", "'__meth_once_'", "+", "f", ".", "__name__", "@", "functools", ".", "wraps", "(", "f", ")", "def", "f2", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", ...
call once for member function (i.e. takes self as first arg)
[ "call", "once", "for", "member", "function", "(", "i", ".", "e", ".", "takes", "self", "as", "first", "arg", ")" ]
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/misc.py#L38-L46
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.add_result
def add_result(self, _type, test, exc_info=None): """ Adds the given result to the list :param _type: type of the state of the test (TestState.failure, TestState.error, ...) :param test: the test :param exc_info: additional execution information """ if exc_info i...
python
def add_result(self, _type, test, exc_info=None): """ Adds the given result to the list :param _type: type of the state of the test (TestState.failure, TestState.error, ...) :param test: the test :param exc_info: additional execution information """ if exc_info i...
[ "def", "add_result", "(", "self", ",", "_type", ",", "test", ",", "exc_info", "=", "None", ")", ":", "if", "exc_info", "is", "not", "None", ":", "exc_info", "=", "FrozenExcInfo", "(", "exc_info", ")", "test", ".", "time_taken", "=", "time", ".", "time"...
Adds the given result to the list :param _type: type of the state of the test (TestState.failure, TestState.error, ...) :param test: the test :param exc_info: additional execution information
[ "Adds", "the", "given", "result", "to", "the", "list" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L58-L70
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.addSuccess
def addSuccess(self, test: unittest.case.TestCase) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save """ # noinspection PyTypeChecker self.add_result(TestState.success, test)
python
def addSuccess(self, test: unittest.case.TestCase) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save """ # noinspection PyTypeChecker self.add_result(TestState.success, test)
[ "def", "addSuccess", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ")", "->", "None", ":", "# noinspection PyTypeChecker", "self", ".", "add_result", "(", "TestState", ".", "success", ",", "test", ")" ]
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L72-L79
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.addFailure
def addFailure(self, test: unittest.case.TestCase, exc_info: tuple) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param exc_info: tuple of the form (Exception class, Exception instance, traceb...
python
def addFailure(self, test: unittest.case.TestCase, exc_info: tuple) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param exc_info: tuple of the form (Exception class, Exception instance, traceb...
[ "def", "addFailure", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ",", "exc_info", ":", "tuple", ")", "->", "None", ":", "# noinspection PyTypeChecker", "self", ".", "add_result", "(", "TestState", ".", "failure", ",", "test", "...
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param exc_info: tuple of the form (Exception class, Exception instance, traceback)
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L81-L89
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.addError
def addError(self, test: unittest.case.TestCase, exc_info: tuple) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param exc_info: tuple of the form (Exception class, Exception instance, tracebac...
python
def addError(self, test: unittest.case.TestCase, exc_info: tuple) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param exc_info: tuple of the form (Exception class, Exception instance, tracebac...
[ "def", "addError", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ",", "exc_info", ":", "tuple", ")", "->", "None", ":", "# noinspection PyTypeChecker", "self", ".", "add_result", "(", "TestState", ".", "error", ",", "test", ",", ...
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param exc_info: tuple of the form (Exception class, Exception instance, traceback)
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L91-L99
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.addExpectedFailure
def addExpectedFailure(self, test: unittest.case.TestCase, err: tuple) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param err: tuple of the form (Exception class, Exception instance, tracebac...
python
def addExpectedFailure(self, test: unittest.case.TestCase, err: tuple) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param err: tuple of the form (Exception class, Exception instance, tracebac...
[ "def", "addExpectedFailure", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ",", "err", ":", "tuple", ")", "->", "None", ":", "# noinspection PyTypeChecker", "self", ".", "add_result", "(", "TestState", ".", "expected_failure", ",", ...
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param err: tuple of the form (Exception class, Exception instance, traceback)
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L101-L109
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.addUnexpectedSuccess
def addUnexpectedSuccess(self, test: unittest.case.TestCase) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save """ # noinspection PyTypeChecker self.add_result(TestState.unexpected_...
python
def addUnexpectedSuccess(self, test: unittest.case.TestCase) -> None: """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save """ # noinspection PyTypeChecker self.add_result(TestState.unexpected_...
[ "def", "addUnexpectedSuccess", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ")", "->", "None", ":", "# noinspection PyTypeChecker", "self", ".", "add_result", "(", "TestState", ".", "unexpected_success", ",", "test", ")" ]
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L111-L118
BenjaminSchubert/NitPycker
nitpycker/result.py
InterProcessResult.addSkip
def addSkip(self, test: unittest.case.TestCase, reason: str): """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param reason: the reason why the test was skipped """ test.time_taken = time....
python
def addSkip(self, test: unittest.case.TestCase, reason: str): """ Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param reason: the reason why the test was skipped """ test.time_taken = time....
[ "def", "addSkip", "(", "self", ",", "test", ":", "unittest", ".", "case", ".", "TestCase", ",", "reason", ":", "str", ")", ":", "test", ".", "time_taken", "=", "time", ".", "time", "(", ")", "-", "self", ".", "start_time", "test", ".", "_outcome", ...
Transforms the test in a serializable version of it and sends it to a queue for further analysis :param test: the test to save :param reason: the reason why the test was skipped
[ "Transforms", "the", "test", "in", "a", "serializable", "version", "of", "it", "and", "sends", "it", "to", "a", "queue", "for", "further", "analysis" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L120-L129
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.addError
def addError(self, test, err): """ registers a test as error :param test: test to register :param err: error the test gave """ super().addError(test, err) self.test_info(test) self._call_test_results('addError', test, err)
python
def addError(self, test, err): """ registers a test as error :param test: test to register :param err: error the test gave """ super().addError(test, err) self.test_info(test) self._call_test_results('addError', test, err)
[ "def", "addError", "(", "self", ",", "test", ",", "err", ")", ":", "super", "(", ")", ".", "addError", "(", "test", ",", "err", ")", "self", ".", "test_info", "(", "test", ")", "self", ".", "_call_test_results", "(", "'addError'", ",", "test", ",", ...
registers a test as error :param test: test to register :param err: error the test gave
[ "registers", "a", "test", "as", "error" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L211-L220
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.addExpectedFailure
def addExpectedFailure(self, test, err): """ registers as test as expected failure :param test: test to register :param err: error the test gave """ super().addExpectedFailure(test, err) self.test_info(test) self._call_test_results('addExpectedFailure', t...
python
def addExpectedFailure(self, test, err): """ registers as test as expected failure :param test: test to register :param err: error the test gave """ super().addExpectedFailure(test, err) self.test_info(test) self._call_test_results('addExpectedFailure', t...
[ "def", "addExpectedFailure", "(", "self", ",", "test", ",", "err", ")", ":", "super", "(", ")", ".", "addExpectedFailure", "(", "test", ",", "err", ")", "self", ".", "test_info", "(", "test", ")", "self", ".", "_call_test_results", "(", "'addExpectedFailur...
registers as test as expected failure :param test: test to register :param err: error the test gave
[ "registers", "as", "test", "as", "expected", "failure" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L222-L231
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.addFailure
def addFailure(self, test, err): """ registers a test as failure :param test: test to register :param err: error the test gave """ super().addFailure(test, err) self.test_info(test) self._call_test_results('addFailure', test, err)
python
def addFailure(self, test, err): """ registers a test as failure :param test: test to register :param err: error the test gave """ super().addFailure(test, err) self.test_info(test) self._call_test_results('addFailure', test, err)
[ "def", "addFailure", "(", "self", ",", "test", ",", "err", ")", ":", "super", "(", ")", ".", "addFailure", "(", "test", ",", "err", ")", "self", ".", "test_info", "(", "test", ")", "self", ".", "_call_test_results", "(", "'addFailure'", ",", "test", ...
registers a test as failure :param test: test to register :param err: error the test gave
[ "registers", "a", "test", "as", "failure" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L233-L242
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.addSkip
def addSkip(self, test, reason): """ registers a test as skipped :param test: test to register :param reason: reason why the test was skipped """ super().addSkip(test, reason) self.test_info(test) self._call_test_results('addSkip', test, reason)
python
def addSkip(self, test, reason): """ registers a test as skipped :param test: test to register :param reason: reason why the test was skipped """ super().addSkip(test, reason) self.test_info(test) self._call_test_results('addSkip', test, reason)
[ "def", "addSkip", "(", "self", ",", "test", ",", "reason", ")", ":", "super", "(", ")", ".", "addSkip", "(", "test", ",", "reason", ")", "self", ".", "test_info", "(", "test", ")", "self", ".", "_call_test_results", "(", "'addSkip'", ",", "test", ","...
registers a test as skipped :param test: test to register :param reason: reason why the test was skipped
[ "registers", "a", "test", "as", "skipped" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L244-L253
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.addSuccess
def addSuccess(self, test): """ registers a test as successful :param test: test to register """ super().addSuccess(test) self.test_info(test) self._call_test_results('addSuccess', test)
python
def addSuccess(self, test): """ registers a test as successful :param test: test to register """ super().addSuccess(test) self.test_info(test) self._call_test_results('addSuccess', test)
[ "def", "addSuccess", "(", "self", ",", "test", ")", ":", "super", "(", ")", ".", "addSuccess", "(", "test", ")", "self", ".", "test_info", "(", "test", ")", "self", ".", "_call_test_results", "(", "'addSuccess'", ",", "test", ")" ]
registers a test as successful :param test: test to register
[ "registers", "a", "test", "as", "successful" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L255-L263
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.addUnexpectedSuccess
def addUnexpectedSuccess(self, test): """ registers a test as an unexpected success :param test: test to register """ super().addUnexpectedSuccess(test) self.test_info(test) self._call_test_results('addUnexpectedSuccess', test)
python
def addUnexpectedSuccess(self, test): """ registers a test as an unexpected success :param test: test to register """ super().addUnexpectedSuccess(test) self.test_info(test) self._call_test_results('addUnexpectedSuccess', test)
[ "def", "addUnexpectedSuccess", "(", "self", ",", "test", ")", ":", "super", "(", ")", ".", "addUnexpectedSuccess", "(", "test", ")", "self", ".", "test_info", "(", "test", ")", "self", ".", "_call_test_results", "(", "'addUnexpectedSuccess'", ",", "test", ")...
registers a test as an unexpected success :param test: test to register
[ "registers", "a", "test", "as", "an", "unexpected", "success" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L265-L273
BenjaminSchubert/NitPycker
nitpycker/result.py
ResultCollector.run
def run(self) -> None: """ processes entries in the queue until told to stop """ while not self.cleanup: try: result, test, additional_info = self.result_queue.get(timeout=1) except queue.Empty: continue self.result_que...
python
def run(self) -> None: """ processes entries in the queue until told to stop """ while not self.cleanup: try: result, test, additional_info = self.result_queue.get(timeout=1) except queue.Empty: continue self.result_que...
[ "def", "run", "(", "self", ")", "->", "None", ":", "while", "not", "self", ".", "cleanup", ":", "try", ":", "result", ",", "test", ",", "additional_info", "=", "self", ".", "result_queue", ".", "get", "(", "timeout", "=", "1", ")", "except", "queue",...
processes entries in the queue until told to stop
[ "processes", "entries", "in", "the", "queue", "until", "told", "to", "stop" ]
train
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L281-L315
redhog/pieshell
pieshell/environ.py
Environment._expand_argument
def _expand_argument(self, arg): """Performs argument glob expansion on an argument string. Returns a list of strings. """ if isinstance(arg, R): return [arg.str] scope = self._scope or self._exports arg = arg % scope arg = os.path.expanduser(arg) res = gl...
python
def _expand_argument(self, arg): """Performs argument glob expansion on an argument string. Returns a list of strings. """ if isinstance(arg, R): return [arg.str] scope = self._scope or self._exports arg = arg % scope arg = os.path.expanduser(arg) res = gl...
[ "def", "_expand_argument", "(", "self", ",", "arg", ")", ":", "if", "isinstance", "(", "arg", ",", "R", ")", ":", "return", "[", "arg", ".", "str", "]", "scope", "=", "self", ".", "_scope", "or", "self", ".", "_exports", "arg", "=", "arg", "%", "...
Performs argument glob expansion on an argument string. Returns a list of strings.
[ "Performs", "argument", "glob", "expansion", "on", "an", "argument", "string", ".", "Returns", "a", "list", "of", "strings", "." ]
train
https://github.com/redhog/pieshell/blob/11cff3b93785ee4446f99b9134be20380edeb767/pieshell/environ.py#L67-L81
thomasballinger/trellocardupdate
trellocardupdate/trelloupdate.py
retry_on_bad_auth
def retry_on_bad_auth(func): """If bad token or board, try again after clearing relevant cache entries""" @wraps(func) def retry_version(self, *args, **kwargs): while True: try: return func(self, *args, **kwargs) except trolly.ResourceUnavailable: ...
python
def retry_on_bad_auth(func): """If bad token or board, try again after clearing relevant cache entries""" @wraps(func) def retry_version(self, *args, **kwargs): while True: try: return func(self, *args, **kwargs) except trolly.ResourceUnavailable: ...
[ "def", "retry_on_bad_auth", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "retry_version", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "while", "True", ":", "try", ":", "return", "func", "(", "self", ",", "*", ...
If bad token or board, try again after clearing relevant cache entries
[ "If", "bad", "token", "or", "board", "try", "again", "after", "clearing", "relevant", "cache", "entries" ]
train
https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L14-L30
thomasballinger/trellocardupdate
trellocardupdate/trelloupdate.py
cached_accessor
def cached_accessor(func_or_att): """Decorated function checks in-memory cache and disc cache for att first""" if callable(func_or_att): #allows decorator to be called without arguments att = func_or_att.__name__ return cached_accessor(func_or_att.__name__)(func_or_att) att = func_or_att ...
python
def cached_accessor(func_or_att): """Decorated function checks in-memory cache and disc cache for att first""" if callable(func_or_att): #allows decorator to be called without arguments att = func_or_att.__name__ return cached_accessor(func_or_att.__name__)(func_or_att) att = func_or_att ...
[ "def", "cached_accessor", "(", "func_or_att", ")", ":", "if", "callable", "(", "func_or_att", ")", ":", "#allows decorator to be called without arguments", "att", "=", "func_or_att", ".", "__name__", "return", "cached_accessor", "(", "func_or_att", ".", "__name__", ")...
Decorated function checks in-memory cache and disc cache for att first
[ "Decorated", "function", "checks", "in", "-", "memory", "cache", "and", "disc", "cache", "for", "att", "first" ]
train
https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L32-L52
thomasballinger/trellocardupdate
trellocardupdate/trelloupdate.py
TrelloUpdater.ask_for_board_id
def ask_for_board_id(self): """Factored out in case interface isn't keyboard""" board_id = raw_input("paste in board id or url: ").strip() m = re.search(r"(?:https?://)?(?:trello.com)?/?b?/?([a-zA-Z]{8})/(?:.*)", board_id) if m: board_id = m.group(1) return board_id
python
def ask_for_board_id(self): """Factored out in case interface isn't keyboard""" board_id = raw_input("paste in board id or url: ").strip() m = re.search(r"(?:https?://)?(?:trello.com)?/?b?/?([a-zA-Z]{8})/(?:.*)", board_id) if m: board_id = m.group(1) return board_id
[ "def", "ask_for_board_id", "(", "self", ")", ":", "board_id", "=", "raw_input", "(", "\"paste in board id or url: \"", ")", ".", "strip", "(", ")", "m", "=", "re", ".", "search", "(", "r\"(?:https?://)?(?:trello.com)?/?b?/?([a-zA-Z]{8})/(?:.*)\"", ",", "board_id", "...
Factored out in case interface isn't keyboard
[ "Factored", "out", "in", "case", "interface", "isn", "t", "keyboard" ]
train
https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L110-L116
thomasballinger/trellocardupdate
trellocardupdate/trelloupdate.py
TrelloUpdater.card_names_and_ids
def card_names_and_ids(self): """Returns [(name, id), ...] pairs of cards from current board""" b = Board(self.client, self.board_id) cards = b.getCards() card_names_and_ids = [(unidecode(c.name), c.id) for c in cards] return card_names_and_ids
python
def card_names_and_ids(self): """Returns [(name, id), ...] pairs of cards from current board""" b = Board(self.client, self.board_id) cards = b.getCards() card_names_and_ids = [(unidecode(c.name), c.id) for c in cards] return card_names_and_ids
[ "def", "card_names_and_ids", "(", "self", ")", ":", "b", "=", "Board", "(", "self", ".", "client", ",", "self", ".", "board_id", ")", "cards", "=", "b", ".", "getCards", "(", ")", "card_names_and_ids", "=", "[", "(", "unidecode", "(", "c", ".", "name...
Returns [(name, id), ...] pairs of cards from current board
[ "Returns", "[", "(", "name", "id", ")", "...", "]", "pairs", "of", "cards", "from", "current", "board" ]
train
https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L128-L133
mrallen1/pygett
pygett/base.py
Gett.get_shares
def get_shares(self, **kwargs): """ Gets *all* shares. Input: * ``skip`` the number of shares to skip (optional) * ``limit`` the maximum number of shares to return (optional) Output: * a dict where keys are sharenames and the values are corresponding...
python
def get_shares(self, **kwargs): """ Gets *all* shares. Input: * ``skip`` the number of shares to skip (optional) * ``limit`` the maximum number of shares to return (optional) Output: * a dict where keys are sharenames and the values are corresponding...
[ "def", "get_shares", "(", "self", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_get_shares", "(", "*", "*", "kwargs", ")", "rv", "=", "dict", "(", ")", "if", "response", ".", "http_status", "==", "200", ":", "for", "share", "in...
Gets *all* shares. Input: * ``skip`` the number of shares to skip (optional) * ``limit`` the maximum number of shares to return (optional) Output: * a dict where keys are sharenames and the values are corresponding :py:mod:`pygett.shares.GettShare` objects ...
[ "Gets", "*", "all", "*", "shares", "." ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L63-L87