id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
248,300 | 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"
] | f8f681e64f58d449bfc32646ba8bcc57db90a233 | https://github.com/20c/twentyc.tools/blob/f8f681e64f58d449bfc32646ba8bcc57db90a233/twentyc/tools/cli.py#L56-L80 |
248,301 | 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"
] | d37c5ca1dbdd60dddb968e35f0bbe4bc1299dca1 | https://github.com/neuroticnerd/armory/blob/d37c5ca1dbdd60dddb968e35f0bbe4bc1299dca1/armory/utils/encoding.py#L17-L19 |
248,302 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L330-L356 |
248,303 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L358-L382 |
248,304 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L14-L32 |
248,305 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L34-L53 |
248,306 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L55-L74 |
248,307 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L107-L122 |
248,308 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L139-L157 |
248,309 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L177-L197 |
248,310 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L228-L246 |
248,311 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L267-L282 |
248,312 | 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",
"."
] | ecd899ba2e7b990e2cec62b115742d830e7e4384 | https://github.com/msfrank/cifparser/blob/ecd899ba2e7b990e2cec62b115742d830e7e4384/cifparser/valuetree.py#L284-L299 |
248,313 | 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",
"."
] | 85e1bdd1de0122f56868a483e7599e1b36a439b0 | https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/facts.py#L20-L29 |
248,314 | 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"
] | 85e1bdd1de0122f56868a483e7599e1b36a439b0 | https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/facts.py#L43-L48 |
248,315 | 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"
] | 85e1bdd1de0122f56868a483e7599e1b36a439b0 | https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/facts.py#L51-L66 |
248,316 | 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",
"."
] | 03745eb98d85bc2a5d08920773ab9c4515462d30 | https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L9-L26 |
248,317 | 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",
"."
] | 03745eb98d85bc2a5d08920773ab9c4515462d30 | https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L29-L57 |
248,318 | 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",
"."
] | 03745eb98d85bc2a5d08920773ab9c4515462d30 | https://github.com/eddiejessup/fealty/blob/03745eb98d85bc2a5d08920773ab9c4515462d30/fealty/lattice.py#L60-L75 |
248,319 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L52-L63 |
248,320 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L66-L78 |
248,321 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L134-L141 |
248,322 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L148-L153 |
248,323 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L155-L158 |
248,324 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L160-L163 |
248,325 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L165-L168 |
248,326 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L170-L191 |
248,327 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L193-L196 |
248,328 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L228-L238 |
248,329 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L240-L247 |
248,330 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L251-L260 |
248,331 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L274-L291 |
248,332 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L299-L303 |
248,333 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L305-L309 |
248,334 | 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",
"."
] | 83d45f16ae9abdea4fcc829373c32df501487dda | https://github.com/Cologler/fsoopify-python/blob/83d45f16ae9abdea4fcc829373c32df501487dda/fsoopify/nodes.py#L323-L342 |
248,335 | 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"
] | b3043116050de275124365cb11e7df91fb40169d | https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/rand_bivar.py#L2-L17 |
248,336 | 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... | 3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23 | https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/values/kervi_value.py#L157-L196 |
248,337 | 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",
"."
] | 3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23 | https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/values/kervi_value.py#L198-L236 |
248,338 | 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"
] | 17c915655525f5bc3a6de06a8a86fa8df4401363 | https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L37-L43 |
248,339 | 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"
] | 17c915655525f5bc3a6de06a8a86fa8df4401363 | https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L45-L64 |
248,340 | 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"
] | 17c915655525f5bc3a6de06a8a86fa8df4401363 | https://github.com/mmk2410/uulm-mensa/blob/17c915655525f5bc3a6de06a8a86fa8df4401363/uulm_mensa/cli.py#L66-L84 |
248,341 | 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",
"."
] | 097a25d3257c91a75c194fd44c2797ab356f85dd | https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L194-L215 |
248,342 | 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",
"."
] | 097a25d3257c91a75c194fd44c2797ab356f85dd | https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L220-L242 |
248,343 | 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",
"."
] | 097a25d3257c91a75c194fd44c2797ab356f85dd | https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L247-L306 |
248,344 | 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",
"."
] | 097a25d3257c91a75c194fd44c2797ab356f85dd | https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L311-L349 |
248,345 | 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",
"."
] | 097a25d3257c91a75c194fd44c2797ab356f85dd | https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L397-L451 |
248,346 | 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"
] | e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2 | https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/gp_sims.py#L62-L100 |
248,347 | 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"
] | e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2 | https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/gp_sims.py#L102-L130 |
248,348 | 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",
"."
] | f43ba50a64b17ee4f07596fe225bcb38ca6652ad | https://github.com/yougov/vr.runners/blob/f43ba50a64b17ee4f07596fe225bcb38ca6652ad/vr/runners/image.py#L29-L43 |
248,349 | 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",
"."
] | f43ba50a64b17ee4f07596fe225bcb38ca6652ad | https://github.com/yougov/vr.runners/blob/f43ba50a64b17ee4f07596fe225bcb38ca6652ad/vr/runners/image.py#L79-L96 |
248,350 | 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",
"."
] | 635fb3187fe4021410e0f06ca6896098b5e1d3b4 | https://github.com/lthibault/expmpp/blob/635fb3187fe4021410e0f06ca6896098b5e1d3b4/expmpp/client.py#L87-L94 |
248,351 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L67-L75 |
248,352 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L84-L115 |
248,353 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L117-L131 |
248,354 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L133-L141 |
248,355 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L143-L151 |
248,356 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L153-L157 |
248,357 | 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"
] | f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b | https://github.com/emencia/dr-dump/blob/f03a2ed01fb82e6fe1df66f7fa82e646a3822d4b/drdump/builder.py#L159-L163 |
248,358 | 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"
] | c78806f99f35541a8756987e86edca3438aa97f5 | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/misc.py#L7-L11 |
248,359 | 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"
] | c78806f99f35541a8756987e86edca3438aa97f5 | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/misc.py#L12-L14 |
248,360 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L58-L70 |
248,361 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L211-L220 |
248,362 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L222-L231 |
248,363 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L233-L242 |
248,364 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L244-L253 |
248,365 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L255-L263 |
248,366 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L265-L273 |
248,367 | 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"
] | 3ac2b3bf06f1d704b4853167a967311b0465a76f | https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/result.py#L281-L315 |
248,368 | 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",
"."
] | 11cff3b93785ee4446f99b9134be20380edeb767 | https://github.com/redhog/pieshell/blob/11cff3b93785ee4446f99b9134be20380edeb767/pieshell/environ.py#L67-L81 |
248,369 | 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"
] | 16a648fa15efef144c07cd56fcdb1d8920fac889 | https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L14-L30 |
248,370 | 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"
] | 16a648fa15efef144c07cd56fcdb1d8920fac889 | https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L32-L52 |
248,371 | 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"
] | 16a648fa15efef144c07cd56fcdb1d8920fac889 | https://github.com/thomasballinger/trellocardupdate/blob/16a648fa15efef144c07cd56fcdb1d8920fac889/trellocardupdate/trelloupdate.py#L110-L116 |
248,372 | mrallen1/pygett | pygett/base.py | Gett.get_share | def get_share(self, sharename):
"""
Get a specific share. Does not require authentication.
Input:
* A sharename
Output:
* A :py:mod:`pygett.shares.GettShare` object
Example::
share = client.get_share("4ddfds")
"""
response ... | python | def get_share(self, sharename):
"""
Get a specific share. Does not require authentication.
Input:
* A sharename
Output:
* A :py:mod:`pygett.shares.GettShare` object
Example::
share = client.get_share("4ddfds")
"""
response ... | [
"def",
"get_share",
"(",
"self",
",",
"sharename",
")",
":",
"response",
"=",
"GettRequest",
"(",
")",
".",
"get",
"(",
"\"/shares/%s\"",
"%",
"sharename",
")",
"if",
"response",
".",
"http_status",
"==",
"200",
":",
"return",
"GettShare",
"(",
"self",
"... | Get a specific share. Does not require authentication.
Input:
* A sharename
Output:
* A :py:mod:`pygett.shares.GettShare` object
Example::
share = client.get_share("4ddfds") | [
"Get",
"a",
"specific",
"share",
".",
"Does",
"not",
"require",
"authentication",
"."
] | 1e21f8674a3634a901af054226670174b5ce2d87 | https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L115-L133 |
248,373 | mrallen1/pygett | pygett/base.py | Gett.get_file | def get_file(self, sharename, fileid):
"""
Get a specific file. Does not require authentication.
Input:
* A sharename
* A fileid - must be an integer
Output:
* A :py:mod:`pygett.files.GettFile` object
Example::
file = client.get... | python | def get_file(self, sharename, fileid):
"""
Get a specific file. Does not require authentication.
Input:
* A sharename
* A fileid - must be an integer
Output:
* A :py:mod:`pygett.files.GettFile` object
Example::
file = client.get... | [
"def",
"get_file",
"(",
"self",
",",
"sharename",
",",
"fileid",
")",
":",
"if",
"not",
"isinstance",
"(",
"fileid",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"\"'fileid' must be an integer\"",
")",
"response",
"=",
"GettRequest",
"(",
")",
".",
"ge... | Get a specific file. Does not require authentication.
Input:
* A sharename
* A fileid - must be an integer
Output:
* A :py:mod:`pygett.files.GettFile` object
Example::
file = client.get_file("4ddfds", 0) | [
"Get",
"a",
"specific",
"file",
".",
"Does",
"not",
"require",
"authentication",
"."
] | 1e21f8674a3634a901af054226670174b5ce2d87 | https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L135-L157 |
248,374 | mrallen1/pygett | pygett/base.py | Gett.create_share | def create_share(self, **kwargs):
"""
Create a new share. Takes a keyword argument.
Input:
* ``title`` optional share title (optional)
Output:
* A :py:mod:`pygett.shares.GettShare` object
Example::
new_share = client.create_share( title="Ex... | python | def create_share(self, **kwargs):
"""
Create a new share. Takes a keyword argument.
Input:
* ``title`` optional share title (optional)
Output:
* A :py:mod:`pygett.shares.GettShare` object
Example::
new_share = client.create_share( title="Ex... | [
"def",
"create_share",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"None",
"if",
"'title'",
"in",
"kwargs",
":",
"params",
"=",
"{",
"\"title\"",
":",
"kwargs",
"[",
"'title'",
"]",
"}",
"response",
"=",
"GettRequest",
"(",
")",
".... | Create a new share. Takes a keyword argument.
Input:
* ``title`` optional share title (optional)
Output:
* A :py:mod:`pygett.shares.GettShare` object
Example::
new_share = client.create_share( title="Example Title" ) | [
"Create",
"a",
"new",
"share",
".",
"Takes",
"a",
"keyword",
"argument",
"."
] | 1e21f8674a3634a901af054226670174b5ce2d87 | https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L159-L181 |
248,375 | mrallen1/pygett | pygett/base.py | Gett.upload_file | def upload_file(self, **kwargs):
"""
Upload a file to the Gett service. Takes keyword arguments.
Input:
* ``filename`` the filename to use in the Gett service (required)
* ``data`` the file contents to store in the Gett service (required) - must be a string
*... | python | def upload_file(self, **kwargs):
"""
Upload a file to the Gett service. Takes keyword arguments.
Input:
* ``filename`` the filename to use in the Gett service (required)
* ``data`` the file contents to store in the Gett service (required) - must be a string
*... | [
"def",
"upload_file",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"None",
"if",
"'filename'",
"not",
"in",
"kwargs",
":",
"raise",
"AttributeError",
"(",
"\"Parameter 'filename' must be given\"",
")",
"else",
":",
"params",
"=",
"{",
"\"fi... | Upload a file to the Gett service. Takes keyword arguments.
Input:
* ``filename`` the filename to use in the Gett service (required)
* ``data`` the file contents to store in the Gett service (required) - must be a string
* ``sharename`` the name of the share in which to stor... | [
"Upload",
"a",
"file",
"to",
"the",
"Gett",
"service",
".",
"Takes",
"keyword",
"arguments",
"."
] | 1e21f8674a3634a901af054226670174b5ce2d87 | https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/base.py#L183-L230 |
248,376 | exekias/droplet | droplet/samba/db.py | samdb_connect | def samdb_connect():
"""
Open and return a SamDB connection
"""
with root():
lp = samba.param.LoadParm()
lp.load("/etc/samba/smb.conf")
creds = Credentials()
creds.guess(lp)
session = system_session()
samdb = SamDB("/var/lib/samba/private/sam.ldb",
session_i... | python | def samdb_connect():
"""
Open and return a SamDB connection
"""
with root():
lp = samba.param.LoadParm()
lp.load("/etc/samba/smb.conf")
creds = Credentials()
creds.guess(lp)
session = system_session()
samdb = SamDB("/var/lib/samba/private/sam.ldb",
session_i... | [
"def",
"samdb_connect",
"(",
")",
":",
"with",
"root",
"(",
")",
":",
"lp",
"=",
"samba",
".",
"param",
".",
"LoadParm",
"(",
")",
"lp",
".",
"load",
"(",
"\"/etc/samba/smb.conf\"",
")",
"creds",
"=",
"Credentials",
"(",
")",
"creds",
".",
"guess",
"... | Open and return a SamDB connection | [
"Open",
"and",
"return",
"a",
"SamDB",
"connection"
] | aeac573a2c1c4b774e99d5414a1c79b1bb734941 | https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/samba/db.py#L15-L29 |
248,377 | exekias/droplet | droplet/samba/db.py | load_schema | def load_schema(ldif_file):
"""
Load a schema from the given file into the SamDB
"""
samdb = samdb_connect()
dn = samdb.domain_dn()
samdb.transaction_start()
try:
setup_add_ldif(samdb, ldif_file, {
"DOMAINDN": dn,
})
except:
samdb.transaction_cancel()... | python | def load_schema(ldif_file):
"""
Load a schema from the given file into the SamDB
"""
samdb = samdb_connect()
dn = samdb.domain_dn()
samdb.transaction_start()
try:
setup_add_ldif(samdb, ldif_file, {
"DOMAINDN": dn,
})
except:
samdb.transaction_cancel()... | [
"def",
"load_schema",
"(",
"ldif_file",
")",
":",
"samdb",
"=",
"samdb_connect",
"(",
")",
"dn",
"=",
"samdb",
".",
"domain_dn",
"(",
")",
"samdb",
".",
"transaction_start",
"(",
")",
"try",
":",
"setup_add_ldif",
"(",
"samdb",
",",
"ldif_file",
",",
"{"... | Load a schema from the given file into the SamDB | [
"Load",
"a",
"schema",
"from",
"the",
"given",
"file",
"into",
"the",
"SamDB"
] | aeac573a2c1c4b774e99d5414a1c79b1bb734941 | https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/samba/db.py#L32-L48 |
248,378 | refinery29/chassis | chassis/util/tree.py | DependencyNode.add_child | def add_child(self, child):
""" Add a child node """
if not isinstance(child, DependencyNode):
raise TypeError('"child" must be a DependencyNode')
self._children.append(child) | python | def add_child(self, child):
""" Add a child node """
if not isinstance(child, DependencyNode):
raise TypeError('"child" must be a DependencyNode')
self._children.append(child) | [
"def",
"add_child",
"(",
"self",
",",
"child",
")",
":",
"if",
"not",
"isinstance",
"(",
"child",
",",
"DependencyNode",
")",
":",
"raise",
"TypeError",
"(",
"'\"child\" must be a DependencyNode'",
")",
"self",
".",
"_children",
".",
"append",
"(",
"child",
... | Add a child node | [
"Add",
"a",
"child",
"node"
] | 1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192 | https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L37-L41 |
248,379 | refinery29/chassis | chassis/util/tree.py | DependencyNode.add_children | def add_children(self, children):
""" Add multiple children """
if not isinstance(children, list):
raise TypeError('"children" must be a list')
for child in children:
self.add_child(child) | python | def add_children(self, children):
""" Add multiple children """
if not isinstance(children, list):
raise TypeError('"children" must be a list')
for child in children:
self.add_child(child) | [
"def",
"add_children",
"(",
"self",
",",
"children",
")",
":",
"if",
"not",
"isinstance",
"(",
"children",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"'\"children\" must be a list'",
")",
"for",
"child",
"in",
"children",
":",
"self",
".",
"add_child"... | Add multiple children | [
"Add",
"multiple",
"children"
] | 1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192 | https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L43-L48 |
248,380 | refinery29/chassis | chassis/util/tree.py | DependencyTree.head_values | def head_values(self):
""" Return set of the head values """
values = set()
for head in self._heads:
values.add(head.value)
return values | python | def head_values(self):
""" Return set of the head values """
values = set()
for head in self._heads:
values.add(head.value)
return values | [
"def",
"head_values",
"(",
"self",
")",
":",
"values",
"=",
"set",
"(",
")",
"for",
"head",
"in",
"self",
".",
"_heads",
":",
"values",
".",
"add",
"(",
"head",
".",
"value",
")",
"return",
"values"
] | Return set of the head values | [
"Return",
"set",
"of",
"the",
"head",
"values"
] | 1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192 | https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L77-L82 |
248,381 | refinery29/chassis | chassis/util/tree.py | DependencyTree.add_head | def add_head(self, head):
""" Add head Node """
if not isinstance(head, DependencyNode):
raise TypeError('"head" must be a DependencyNode')
self._heads.append(head) | python | def add_head(self, head):
""" Add head Node """
if not isinstance(head, DependencyNode):
raise TypeError('"head" must be a DependencyNode')
self._heads.append(head) | [
"def",
"add_head",
"(",
"self",
",",
"head",
")",
":",
"if",
"not",
"isinstance",
"(",
"head",
",",
"DependencyNode",
")",
":",
"raise",
"TypeError",
"(",
"'\"head\" must be a DependencyNode'",
")",
"self",
".",
"_heads",
".",
"append",
"(",
"head",
")"
] | Add head Node | [
"Add",
"head",
"Node"
] | 1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192 | https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/tree.py#L95-L99 |
248,382 | qzmfranklin/easyshell | easyshell/main.py | update_parser | def update_parser(parser):
"""Update the parser object for the shell.
Arguments:
parser: An instance of argparse.ArgumentParser.
"""
def __stdin(s):
if s is None:
return None
if s == '-':
return sys.stdin
return open(s, 'r', encoding = 'utf8')
... | python | def update_parser(parser):
"""Update the parser object for the shell.
Arguments:
parser: An instance of argparse.ArgumentParser.
"""
def __stdin(s):
if s is None:
return None
if s == '-':
return sys.stdin
return open(s, 'r', encoding = 'utf8')
... | [
"def",
"update_parser",
"(",
"parser",
")",
":",
"def",
"__stdin",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"None",
"if",
"s",
"==",
"'-'",
":",
"return",
"sys",
".",
"stdin",
"return",
"open",
"(",
"s",
",",
"'r'",
",",
"encod... | Update the parser object for the shell.
Arguments:
parser: An instance of argparse.ArgumentParser. | [
"Update",
"the",
"parser",
"object",
"for",
"the",
"shell",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/main.py#L3-L30 |
248,383 | jmgilman/Neolib | neolib/pyamf/util/imports.py | _init | def _init():
"""
Internal function to install the module finder.
"""
global finder
if finder is None:
finder = ModuleFinder()
if finder not in sys.meta_path:
sys.meta_path.insert(0, finder) | python | def _init():
"""
Internal function to install the module finder.
"""
global finder
if finder is None:
finder = ModuleFinder()
if finder not in sys.meta_path:
sys.meta_path.insert(0, finder) | [
"def",
"_init",
"(",
")",
":",
"global",
"finder",
"if",
"finder",
"is",
"None",
":",
"finder",
"=",
"ModuleFinder",
"(",
")",
"if",
"finder",
"not",
"in",
"sys",
".",
"meta_path",
":",
"sys",
".",
"meta_path",
".",
"insert",
"(",
"0",
",",
"finder",... | Internal function to install the module finder. | [
"Internal",
"function",
"to",
"install",
"the",
"module",
"finder",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L123-L133 |
248,384 | jmgilman/Neolib | neolib/pyamf/util/imports.py | ModuleFinder.find_module | def find_module(self, name, path=None):
"""
Called when an import is made. If there are hooks waiting for this
module to be imported then we stop the normal import process and
manually load the module.
@param name: The name of the module being imported.
@param path The r... | python | def find_module(self, name, path=None):
"""
Called when an import is made. If there are hooks waiting for this
module to be imported then we stop the normal import process and
manually load the module.
@param name: The name of the module being imported.
@param path The r... | [
"def",
"find_module",
"(",
"self",
",",
"name",
",",
"path",
"=",
"None",
")",
":",
"if",
"name",
"in",
"self",
".",
"loaded_modules",
":",
"return",
"None",
"hooks",
"=",
"self",
".",
"post_load_hooks",
".",
"get",
"(",
"name",
",",
"None",
")",
"if... | Called when an import is made. If there are hooks waiting for this
module to be imported then we stop the normal import process and
manually load the module.
@param name: The name of the module being imported.
@param path The root path of the module (if a package). We ignore this.
... | [
"Called",
"when",
"an",
"import",
"is",
"made",
".",
"If",
"there",
"are",
"hooks",
"waiting",
"for",
"this",
"module",
"to",
"be",
"imported",
"then",
"we",
"stop",
"the",
"normal",
"import",
"process",
"and",
"manually",
"load",
"the",
"module",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L52-L70 |
248,385 | jmgilman/Neolib | neolib/pyamf/util/imports.py | ModuleFinder.load_module | def load_module(self, name):
"""
If we get this far, then there are hooks waiting to be called on
import of this module. We manually load the module and then run the
hooks.
@param name: The name of the module to import.
"""
self.loaded_modules.append(name)
... | python | def load_module(self, name):
"""
If we get this far, then there are hooks waiting to be called on
import of this module. We manually load the module and then run the
hooks.
@param name: The name of the module to import.
"""
self.loaded_modules.append(name)
... | [
"def",
"load_module",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"loaded_modules",
".",
"append",
"(",
"name",
")",
"try",
":",
"__import__",
"(",
"name",
",",
"{",
"}",
",",
"{",
"}",
",",
"[",
"]",
")",
"mod",
"=",
"sys",
".",
"modules",
... | If we get this far, then there are hooks waiting to be called on
import of this module. We manually load the module and then run the
hooks.
@param name: The name of the module to import. | [
"If",
"we",
"get",
"this",
"far",
"then",
"there",
"are",
"hooks",
"waiting",
"to",
"be",
"called",
"on",
"import",
"of",
"this",
"module",
".",
"We",
"manually",
"load",
"the",
"module",
"and",
"then",
"run",
"the",
"hooks",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L72-L92 |
248,386 | jmgilman/Neolib | neolib/pyamf/util/imports.py | ModuleFinder._run_hooks | def _run_hooks(self, name, module):
"""
Run all hooks for a module.
"""
hooks = self.post_load_hooks.pop(name, [])
for hook in hooks:
hook(module) | python | def _run_hooks(self, name, module):
"""
Run all hooks for a module.
"""
hooks = self.post_load_hooks.pop(name, [])
for hook in hooks:
hook(module) | [
"def",
"_run_hooks",
"(",
"self",
",",
"name",
",",
"module",
")",
":",
"hooks",
"=",
"self",
".",
"post_load_hooks",
".",
"pop",
"(",
"name",
",",
"[",
"]",
")",
"for",
"hook",
"in",
"hooks",
":",
"hook",
"(",
"module",
")"
] | Run all hooks for a module. | [
"Run",
"all",
"hooks",
"for",
"a",
"module",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/imports.py#L107-L114 |
248,387 | pjuren/pyokit | src/pyokit/scripts/index.py | index_repeatmasker_alignment_by_id | def index_repeatmasker_alignment_by_id(fh, out_fh, vebrose=False):
"""Build an index for a repeat-masker alignment file by repeat-masker ID."""
def extract_UID(rm_alignment):
return rm_alignment.meta[multipleAlignment.RM_ID_KEY]
index = IndexedFile(fh, repeat_masker_alignment_iterator, extract_UID)
index.w... | python | def index_repeatmasker_alignment_by_id(fh, out_fh, vebrose=False):
"""Build an index for a repeat-masker alignment file by repeat-masker ID."""
def extract_UID(rm_alignment):
return rm_alignment.meta[multipleAlignment.RM_ID_KEY]
index = IndexedFile(fh, repeat_masker_alignment_iterator, extract_UID)
index.w... | [
"def",
"index_repeatmasker_alignment_by_id",
"(",
"fh",
",",
"out_fh",
",",
"vebrose",
"=",
"False",
")",
":",
"def",
"extract_UID",
"(",
"rm_alignment",
")",
":",
"return",
"rm_alignment",
".",
"meta",
"[",
"multipleAlignment",
".",
"RM_ID_KEY",
"]",
"index",
... | Build an index for a repeat-masker alignment file by repeat-masker ID. | [
"Build",
"an",
"index",
"for",
"a",
"repeat",
"-",
"masker",
"alignment",
"file",
"by",
"repeat",
"-",
"masker",
"ID",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L76-L82 |
248,388 | pjuren/pyokit | src/pyokit/scripts/index.py | index_genome_alignment_by_locus | def index_genome_alignment_by_locus(fh, out_fh, verbose=False):
"""Build an index for a genome alig. using coords in ref genome as keys."""
bound_iter = functools.partial(genome_alignment_iterator,
reference_species="hg19", index_friendly=True)
hash_func = JustInTimeGenomeAlignmen... | python | def index_genome_alignment_by_locus(fh, out_fh, verbose=False):
"""Build an index for a genome alig. using coords in ref genome as keys."""
bound_iter = functools.partial(genome_alignment_iterator,
reference_species="hg19", index_friendly=True)
hash_func = JustInTimeGenomeAlignmen... | [
"def",
"index_genome_alignment_by_locus",
"(",
"fh",
",",
"out_fh",
",",
"verbose",
"=",
"False",
")",
":",
"bound_iter",
"=",
"functools",
".",
"partial",
"(",
"genome_alignment_iterator",
",",
"reference_species",
"=",
"\"hg19\"",
",",
"index_friendly",
"=",
"Tr... | Build an index for a genome alig. using coords in ref genome as keys. | [
"Build",
"an",
"index",
"for",
"a",
"genome",
"alig",
".",
"using",
"coords",
"in",
"ref",
"genome",
"as",
"keys",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L85-L91 |
248,389 | pjuren/pyokit | src/pyokit/scripts/index.py | lookup_genome_alignment_index | def lookup_genome_alignment_index(index_fh, indexed_fh, out_fh=sys.stdout,
key=None, verbose=False):
"""Load a GA index and its indexed file and extract one or more blocks.
:param index_fh: the index file to load. Can be a filename or a
stream-like object.
... | python | def lookup_genome_alignment_index(index_fh, indexed_fh, out_fh=sys.stdout,
key=None, verbose=False):
"""Load a GA index and its indexed file and extract one or more blocks.
:param index_fh: the index file to load. Can be a filename or a
stream-like object.
... | [
"def",
"lookup_genome_alignment_index",
"(",
"index_fh",
",",
"indexed_fh",
",",
"out_fh",
"=",
"sys",
".",
"stdout",
",",
"key",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"# load the genome alignment as a JIT object",
"bound_iter",
"=",
"functools",
".... | Load a GA index and its indexed file and extract one or more blocks.
:param index_fh: the index file to load. Can be a filename or a
stream-like object.
:param indexed_fh: the file that the index was built for,
:param key: A single key, iterable of keys, or None. This key will be
... | [
"Load",
"a",
"GA",
"index",
"and",
"its",
"indexed",
"file",
"and",
"extract",
"one",
"or",
"more",
"blocks",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L115-L146 |
248,390 | pjuren/pyokit | src/pyokit/scripts/index.py | getUI_build_index | def getUI_build_index(prog_name, args):
"""
build and return a UI object for the 'build' option.
:param args: raw arguments to parse
"""
programName = prog_name
long_description = "Build an index for one or more files."
short_description = long_description
ui = CLI(programName, short_description, long... | python | def getUI_build_index(prog_name, args):
"""
build and return a UI object for the 'build' option.
:param args: raw arguments to parse
"""
programName = prog_name
long_description = "Build an index for one or more files."
short_description = long_description
ui = CLI(programName, short_description, long... | [
"def",
"getUI_build_index",
"(",
"prog_name",
",",
"args",
")",
":",
"programName",
"=",
"prog_name",
"long_description",
"=",
"\"Build an index for one or more files.\"",
"short_description",
"=",
"long_description",
"ui",
"=",
"CLI",
"(",
"programName",
",",
"short_de... | build and return a UI object for the 'build' option.
:param args: raw arguments to parse | [
"build",
"and",
"return",
"a",
"UI",
"object",
"for",
"the",
"build",
"option",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L170-L203 |
248,391 | pjuren/pyokit | src/pyokit/scripts/index.py | __get_indexer | def __get_indexer(in_fns, selected_type=None):
"""Determine which indexer to use based on input files and type option."""
indexer = None
if selected_type is not None:
indexer = get_indexer_by_filetype(selected_type)
else:
if len(in_fns) == 0:
raise IndexError("reading from stdin, unable to guess i... | python | def __get_indexer(in_fns, selected_type=None):
"""Determine which indexer to use based on input files and type option."""
indexer = None
if selected_type is not None:
indexer = get_indexer_by_filetype(selected_type)
else:
if len(in_fns) == 0:
raise IndexError("reading from stdin, unable to guess i... | [
"def",
"__get_indexer",
"(",
"in_fns",
",",
"selected_type",
"=",
"None",
")",
":",
"indexer",
"=",
"None",
"if",
"selected_type",
"is",
"not",
"None",
":",
"indexer",
"=",
"get_indexer_by_filetype",
"(",
"selected_type",
")",
"else",
":",
"if",
"len",
"(",
... | Determine which indexer to use based on input files and type option. | [
"Determine",
"which",
"indexer",
"to",
"use",
"based",
"on",
"input",
"files",
"and",
"type",
"option",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L250-L268 |
248,392 | pjuren/pyokit | src/pyokit/scripts/index.py | __get_lookup | def __get_lookup(in_fn, selected_type=None):
"""Determine which lookup func to use based on inpt files and type option."""
lookup_func = None
if selected_type is not None:
lookup_func = get_lookup_by_filetype(selected_type)
else:
extension = os.path.splitext(in_fn)[1]
lookup_func = get_lookup_by_fil... | python | def __get_lookup(in_fn, selected_type=None):
"""Determine which lookup func to use based on inpt files and type option."""
lookup_func = None
if selected_type is not None:
lookup_func = get_lookup_by_filetype(selected_type)
else:
extension = os.path.splitext(in_fn)[1]
lookup_func = get_lookup_by_fil... | [
"def",
"__get_lookup",
"(",
"in_fn",
",",
"selected_type",
"=",
"None",
")",
":",
"lookup_func",
"=",
"None",
"if",
"selected_type",
"is",
"not",
"None",
":",
"lookup_func",
"=",
"get_lookup_by_filetype",
"(",
"selected_type",
")",
"else",
":",
"extension",
"=... | Determine which lookup func to use based on inpt files and type option. | [
"Determine",
"which",
"lookup",
"func",
"to",
"use",
"based",
"on",
"inpt",
"files",
"and",
"type",
"option",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/index.py#L271-L280 |
248,393 | tducret/precisionmapper-python | python-flask/swagger_server/controllers/user_controller.py | list_surveys | def list_surveys(): # noqa: E501
"""list the surveys available
List the surveys available # noqa: E501
:rtype: List[Survey]
"""
pm = PrecisionMapper(login=_LOGIN, password=_PASSWORD)
pm.sign_in()
surveys = pm.get_surveys()
shared_surveys = pm.get_shared_surveys()
survey_list = [... | python | def list_surveys(): # noqa: E501
"""list the surveys available
List the surveys available # noqa: E501
:rtype: List[Survey]
"""
pm = PrecisionMapper(login=_LOGIN, password=_PASSWORD)
pm.sign_in()
surveys = pm.get_surveys()
shared_surveys = pm.get_shared_surveys()
survey_list = [... | [
"def",
"list_surveys",
"(",
")",
":",
"# noqa: E501",
"pm",
"=",
"PrecisionMapper",
"(",
"login",
"=",
"_LOGIN",
",",
"password",
"=",
"_PASSWORD",
")",
"pm",
".",
"sign_in",
"(",
")",
"surveys",
"=",
"pm",
".",
"get_surveys",
"(",
")",
"shared_surveys",
... | list the surveys available
List the surveys available # noqa: E501
:rtype: List[Survey] | [
"list",
"the",
"surveys",
"available"
] | 462dcc5bccf6edec780b8b7bc42e8c1d717db942 | https://github.com/tducret/precisionmapper-python/blob/462dcc5bccf6edec780b8b7bc42e8c1d717db942/python-flask/swagger_server/controllers/user_controller.py#L15-L35 |
248,394 | merryspankersltd/irenee | irenee/cog.py | pg2df | def pg2df(res):
'''
takes a getlog requests result
returns a table as df
'''
# parse res
soup = BeautifulSoup(res.text)
if u'Pas de r\xe9ponse pour cette recherche.' in soup.text:
pass # <-- don't pass !
else:
params = urlparse.parse_qs(urlparse.urlsplit... | python | def pg2df(res):
'''
takes a getlog requests result
returns a table as df
'''
# parse res
soup = BeautifulSoup(res.text)
if u'Pas de r\xe9ponse pour cette recherche.' in soup.text:
pass # <-- don't pass !
else:
params = urlparse.parse_qs(urlparse.urlsplit... | [
"def",
"pg2df",
"(",
"res",
")",
":",
"# parse res",
"soup",
"=",
"BeautifulSoup",
"(",
"res",
".",
"text",
")",
"if",
"u'Pas de r\\xe9ponse pour cette recherche.'",
"in",
"soup",
".",
"text",
":",
"pass",
"# <-- don't pass !",
"else",
":",
"params",
"=",
"url... | takes a getlog requests result
returns a table as df | [
"takes",
"a",
"getlog",
"requests",
"result",
"returns",
"a",
"table",
"as",
"df"
] | 8bf3c7644dc69001fa4b09be5fbb770dbf06a465 | https://github.com/merryspankersltd/irenee/blob/8bf3c7644dc69001fa4b09be5fbb770dbf06a465/irenee/cog.py#L23-L43 |
248,395 | merryspankersltd/irenee | irenee/cog.py | getlog | def getlog(start, end, deplist=['00'], modlist=['M0'], xlsx=None):
'''
batch gets changelogs for cogs
'''
# entry point url
api = 'http://www.insee.fr/fr/methodes/nomenclatures/cog/recherche_historique.asp'
# build payloads
if modlist == ['M0']:
modlist = ['MA', 'MB', 'MC', 'MD',... | python | def getlog(start, end, deplist=['00'], modlist=['M0'], xlsx=None):
'''
batch gets changelogs for cogs
'''
# entry point url
api = 'http://www.insee.fr/fr/methodes/nomenclatures/cog/recherche_historique.asp'
# build payloads
if modlist == ['M0']:
modlist = ['MA', 'MB', 'MC', 'MD',... | [
"def",
"getlog",
"(",
"start",
",",
"end",
",",
"deplist",
"=",
"[",
"'00'",
"]",
",",
"modlist",
"=",
"[",
"'M0'",
"]",
",",
"xlsx",
"=",
"None",
")",
":",
"# entry point url",
"api",
"=",
"'http://www.insee.fr/fr/methodes/nomenclatures/cog/recherche_historique... | batch gets changelogs for cogs | [
"batch",
"gets",
"changelogs",
"for",
"cogs"
] | 8bf3c7644dc69001fa4b09be5fbb770dbf06a465 | https://github.com/merryspankersltd/irenee/blob/8bf3c7644dc69001fa4b09be5fbb770dbf06a465/irenee/cog.py#L45-L67 |
248,396 | scdoshi/django-bits | bits/currency.py | currency_format | def currency_format(cents):
"""Format currency with symbol and decimal points.
>> currency_format(-600)
- $6.00
TODO: Add localization support.
"""
try:
cents = int(cents)
except ValueError:
return cents
negative = (cents < 0)
if negative:
cents = -1 * cent... | python | def currency_format(cents):
"""Format currency with symbol and decimal points.
>> currency_format(-600)
- $6.00
TODO: Add localization support.
"""
try:
cents = int(cents)
except ValueError:
return cents
negative = (cents < 0)
if negative:
cents = -1 * cent... | [
"def",
"currency_format",
"(",
"cents",
")",
":",
"try",
":",
"cents",
"=",
"int",
"(",
"cents",
")",
"except",
"ValueError",
":",
"return",
"cents",
"negative",
"=",
"(",
"cents",
"<",
"0",
")",
"if",
"negative",
":",
"cents",
"=",
"-",
"1",
"*",
... | Format currency with symbol and decimal points.
>> currency_format(-600)
- $6.00
TODO: Add localization support. | [
"Format",
"currency",
"with",
"symbol",
"and",
"decimal",
"points",
"."
] | 0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f | https://github.com/scdoshi/django-bits/blob/0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f/bits/currency.py#L39-L68 |
248,397 | dariosky/wfcli | wfcli/tossl.py | WebfactionWebsiteToSsl.is_website_affected | def is_website_affected(self, website):
""" Tell if the website is affected by the domain change """
if self.domain is None:
return True
if not self.include_subdomains:
return self.domain in website['subdomains']
else:
dotted_domain = "." + self.domain... | python | def is_website_affected(self, website):
""" Tell if the website is affected by the domain change """
if self.domain is None:
return True
if not self.include_subdomains:
return self.domain in website['subdomains']
else:
dotted_domain = "." + self.domain... | [
"def",
"is_website_affected",
"(",
"self",
",",
"website",
")",
":",
"if",
"self",
".",
"domain",
"is",
"None",
":",
"return",
"True",
"if",
"not",
"self",
".",
"include_subdomains",
":",
"return",
"self",
".",
"domain",
"in",
"website",
"[",
"'subdomains'... | Tell if the website is affected by the domain change | [
"Tell",
"if",
"the",
"website",
"is",
"affected",
"by",
"the",
"domain",
"change"
] | 87a9ed30dbd456f801135a55099f0541b0614ccb | https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L63-L74 |
248,398 | dariosky/wfcli | wfcli/tossl.py | WebfactionWebsiteToSsl.get_affected_domains | def get_affected_domains(self):
""" Return a list of all affected domain and subdomains """
results = set()
dotted_domain = ("." + self.domain) if self.domain else None
for website in self.websites:
for subdomain in website['subdomains']:
if self.domain is Non... | python | def get_affected_domains(self):
""" Return a list of all affected domain and subdomains """
results = set()
dotted_domain = ("." + self.domain) if self.domain else None
for website in self.websites:
for subdomain in website['subdomains']:
if self.domain is Non... | [
"def",
"get_affected_domains",
"(",
"self",
")",
":",
"results",
"=",
"set",
"(",
")",
"dotted_domain",
"=",
"(",
"\".\"",
"+",
"self",
".",
"domain",
")",
"if",
"self",
".",
"domain",
"else",
"None",
"for",
"website",
"in",
"self",
".",
"websites",
":... | Return a list of all affected domain and subdomains | [
"Return",
"a",
"list",
"of",
"all",
"affected",
"domain",
"and",
"subdomains"
] | 87a9ed30dbd456f801135a55099f0541b0614ccb | https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L76-L88 |
248,399 | dariosky/wfcli | wfcli/tossl.py | WebfactionWebsiteToSsl.secured_apps_copy | def secured_apps_copy(self, apps):
""" Given the http app list of a website, return what should be in the secure version """
return [[app_name, path] for app_name, path in apps if
app_name not in (self.LETSENCRYPT_VERIFY_APP_NAME,)] | python | def secured_apps_copy(self, apps):
""" Given the http app list of a website, return what should be in the secure version """
return [[app_name, path] for app_name, path in apps if
app_name not in (self.LETSENCRYPT_VERIFY_APP_NAME,)] | [
"def",
"secured_apps_copy",
"(",
"self",
",",
"apps",
")",
":",
"return",
"[",
"[",
"app_name",
",",
"path",
"]",
"for",
"app_name",
",",
"path",
"in",
"apps",
"if",
"app_name",
"not",
"in",
"(",
"self",
".",
"LETSENCRYPT_VERIFY_APP_NAME",
",",
")",
"]"
... | Given the http app list of a website, return what should be in the secure version | [
"Given",
"the",
"http",
"app",
"list",
"of",
"a",
"website",
"return",
"what",
"should",
"be",
"in",
"the",
"secure",
"version"
] | 87a9ed30dbd456f801135a55099f0541b0614ccb | https://github.com/dariosky/wfcli/blob/87a9ed30dbd456f801135a55099f0541b0614ccb/wfcli/tossl.py#L212-L215 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.