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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37,500 | Chilipp/psy-simple | psy_simple/plugin.py | validate_cbarpos | def validate_cbarpos(value):
"""Validate a colorbar position
Parameters
----------
value: bool or str
A string can be a combination of 'sh|sv|fl|fr|ft|fb|b|r'
Returns
-------
list
list of strings with possible colorbar positions
Raises
------
ValueError"""
... | python | def validate_cbarpos(value):
"""Validate a colorbar position
Parameters
----------
value: bool or str
A string can be a combination of 'sh|sv|fl|fr|ft|fb|b|r'
Returns
-------
list
list of strings with possible colorbar positions
Raises
------
ValueError"""
... | [
"def",
"validate_cbarpos",
"(",
"value",
")",
":",
"patt",
"=",
"'sh|sv|fl|fr|ft|fb|b|r'",
"if",
"value",
"is",
"True",
":",
"value",
"=",
"{",
"'b'",
"}",
"elif",
"not",
"value",
":",
"value",
"=",
"set",
"(",
")",
"elif",
"isinstance",
"(",
"value",
... | Validate a colorbar position
Parameters
----------
value: bool or str
A string can be a combination of 'sh|sv|fl|fr|ft|fb|b|r'
Returns
-------
list
list of strings with possible colorbar positions
Raises
------
ValueError | [
"Validate",
"a",
"colorbar",
"position"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L269-L300 |
37,501 | Chilipp/psy-simple | psy_simple/plugin.py | validate_cmap | def validate_cmap(val):
"""Validate a colormap
Parameters
----------
val: str or :class:`mpl.colors.Colormap`
Returns
-------
str or :class:`mpl.colors.Colormap`
Raises
------
ValueError"""
from matplotlib.colors import Colormap
try:
return validate_str(val)
... | python | def validate_cmap(val):
"""Validate a colormap
Parameters
----------
val: str or :class:`mpl.colors.Colormap`
Returns
-------
str or :class:`mpl.colors.Colormap`
Raises
------
ValueError"""
from matplotlib.colors import Colormap
try:
return validate_str(val)
... | [
"def",
"validate_cmap",
"(",
"val",
")",
":",
"from",
"matplotlib",
".",
"colors",
"import",
"Colormap",
"try",
":",
"return",
"validate_str",
"(",
"val",
")",
"except",
"ValueError",
":",
"if",
"not",
"isinstance",
"(",
"val",
",",
"Colormap",
")",
":",
... | Validate a colormap
Parameters
----------
val: str or :class:`mpl.colors.Colormap`
Returns
-------
str or :class:`mpl.colors.Colormap`
Raises
------
ValueError | [
"Validate",
"a",
"colormap"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L303-L324 |
37,502 | Chilipp/psy-simple | psy_simple/plugin.py | validate_cmaps | def validate_cmaps(cmaps):
"""Validate a dictionary of color lists
Parameters
----------
cmaps: dict
a mapping from a colormap name to a list of colors
Raises
------
ValueError
If one of the values in `cmaps` is not a color list
Notes
-----
For all items (listn... | python | def validate_cmaps(cmaps):
"""Validate a dictionary of color lists
Parameters
----------
cmaps: dict
a mapping from a colormap name to a list of colors
Raises
------
ValueError
If one of the values in `cmaps` is not a color list
Notes
-----
For all items (listn... | [
"def",
"validate_cmaps",
"(",
"cmaps",
")",
":",
"cmaps",
"=",
"{",
"validate_str",
"(",
"key",
")",
":",
"validate_colorlist",
"(",
"val",
")",
"for",
"key",
",",
"val",
"in",
"cmaps",
"}",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(... | Validate a dictionary of color lists
Parameters
----------
cmaps: dict
a mapping from a colormap name to a list of colors
Raises
------
ValueError
If one of the values in `cmaps` is not a color list
Notes
-----
For all items (listname, list) in `cmaps`, the reverse... | [
"Validate",
"a",
"dictionary",
"of",
"color",
"lists"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L327-L347 |
37,503 | Chilipp/psy-simple | psy_simple/plugin.py | validate_lineplot | def validate_lineplot(value):
"""Validate the value for the LinePlotter.plot formatoption
Parameters
----------
value: None, str or list with mixture of both
The value to validate"""
if value is None:
return value
elif isinstance(value, six.string_types):
return six.text... | python | def validate_lineplot(value):
"""Validate the value for the LinePlotter.plot formatoption
Parameters
----------
value: None, str or list with mixture of both
The value to validate"""
if value is None:
return value
elif isinstance(value, six.string_types):
return six.text... | [
"def",
"validate_lineplot",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"elif",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"return",
"six",
".",
"text_type",
"(",
"value",
")",
"else",
":",
"... | Validate the value for the LinePlotter.plot formatoption
Parameters
----------
value: None, str or list with mixture of both
The value to validate | [
"Validate",
"the",
"value",
"for",
"the",
"LinePlotter",
".",
"plot",
"formatoption"
] | 7d916406a6d3c3c27c0b7102f98fef07a4da0a61 | https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/plugin.py#L377-L397 |
37,504 | rob-smallshire/trailer | trailer/writers/json/renderer.py | GpxJsonEncoder.visit_GpxModel | def visit_GpxModel(self, gpx_model, *args, **kwargs):
"""Render a GPXModel as a single JSON structure."""
result = OrderedDict()
put_scalar = lambda name, json_name=None: self.optional_attribute_scalar(result, gpx_model, name, json_name)
put_list = lambda name, json_name=None: self.opti... | python | def visit_GpxModel(self, gpx_model, *args, **kwargs):
"""Render a GPXModel as a single JSON structure."""
result = OrderedDict()
put_scalar = lambda name, json_name=None: self.optional_attribute_scalar(result, gpx_model, name, json_name)
put_list = lambda name, json_name=None: self.opti... | [
"def",
"visit_GpxModel",
"(",
"self",
",",
"gpx_model",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"OrderedDict",
"(",
")",
"put_scalar",
"=",
"lambda",
"name",
",",
"json_name",
"=",
"None",
":",
"self",
".",
"optional_attribute... | Render a GPXModel as a single JSON structure. | [
"Render",
"a",
"GPXModel",
"as",
"a",
"single",
"JSON",
"structure",
"."
] | e4b8a240561bfb6df91cc71247b7ef0c61e7d363 | https://github.com/rob-smallshire/trailer/blob/e4b8a240561bfb6df91cc71247b7ef0c61e7d363/trailer/writers/json/renderer.py#L62-L76 |
37,505 | rob-smallshire/trailer | trailer/writers/json/renderer.py | GpxJsonEncoder.visit_Metadata | def visit_Metadata(self, metadata, *args, **kwargs):
"""Render GPX Metadata as a single JSON structure."""
result = OrderedDict()
put_scalar = lambda name, json_name=None: self.optional_attribute_scalar(result, metadata, name, json_name)
put_list = lambda name, json_name=None: self.optio... | python | def visit_Metadata(self, metadata, *args, **kwargs):
"""Render GPX Metadata as a single JSON structure."""
result = OrderedDict()
put_scalar = lambda name, json_name=None: self.optional_attribute_scalar(result, metadata, name, json_name)
put_list = lambda name, json_name=None: self.optio... | [
"def",
"visit_Metadata",
"(",
"self",
",",
"metadata",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"OrderedDict",
"(",
")",
"put_scalar",
"=",
"lambda",
"name",
",",
"json_name",
"=",
"None",
":",
"self",
".",
"optional_attribute_... | Render GPX Metadata as a single JSON structure. | [
"Render",
"GPX",
"Metadata",
"as",
"a",
"single",
"JSON",
"structure",
"."
] | e4b8a240561bfb6df91cc71247b7ef0c61e7d363 | https://github.com/rob-smallshire/trailer/blob/e4b8a240561bfb6df91cc71247b7ef0c61e7d363/trailer/writers/json/renderer.py#L79-L95 |
37,506 | wheeler-microfluidics/dmf-control-board-firmware | dmf_control_board_firmware/calibrate/feedback.py | swap_default | def swap_default(mode, equation, symbol_names, default, **kwargs):
'''
Given a `sympy` equation or equality, along with a list of symbol names,
substitute the specified default value for each symbol for which a value is
not provided through a keyword argument.
For example, consider the following eq... | python | def swap_default(mode, equation, symbol_names, default, **kwargs):
'''
Given a `sympy` equation or equality, along with a list of symbol names,
substitute the specified default value for each symbol for which a value is
not provided through a keyword argument.
For example, consider the following eq... | [
"def",
"swap_default",
"(",
"mode",
",",
"equation",
",",
"symbol_names",
",",
"default",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mode",
"==",
"'subs'",
":",
"swap_f",
"=",
"_subs",
"default_swap_f",
"=",
"_subs",
"elif",
"mode",
"==",
"'limit'",
":",
... | Given a `sympy` equation or equality, along with a list of symbol names,
substitute the specified default value for each symbol for which a value is
not provided through a keyword argument.
For example, consider the following equality:
>>> sp.pprint(H)
Vβ Zβ
ββ = ββ
Vβ Zβ
Let us s... | [
"Given",
"a",
"sympy",
"equation",
"or",
"equality",
"along",
"with",
"a",
"list",
"of",
"symbol",
"names",
"substitute",
"the",
"specified",
"default",
"value",
"for",
"each",
"symbol",
"for",
"which",
"a",
"value",
"is",
"not",
"provided",
"through",
"a",
... | 1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c | https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/dmf_control_board_firmware/calibrate/feedback.py#L43-L101 |
37,507 | wheeler-microfluidics/dmf-control-board-firmware | dmf_control_board_firmware/calibrate/feedback.py | z_transfer_functions | def z_transfer_functions():
r'''
Return a symbolic equality representation of the transfer function of RMS
voltage measured by either control board analog feedback circuits.
According to the figure below, the transfer function describes the
following relationship::
# Hardware V1 # ... | python | def z_transfer_functions():
r'''
Return a symbolic equality representation of the transfer function of RMS
voltage measured by either control board analog feedback circuits.
According to the figure below, the transfer function describes the
following relationship::
# Hardware V1 # ... | [
"def",
"z_transfer_functions",
"(",
")",
":",
"# Define transfer function as a symbolic equality using SymPy.",
"V1",
",",
"V2",
",",
"Z1",
",",
"Z2",
"=",
"sp",
".",
"symbols",
"(",
"'V1 V2 Z1 Z2'",
")",
"xfer_funcs",
"=",
"pd",
".",
"Series",
"(",
"[",
"sp",
... | r'''
Return a symbolic equality representation of the transfer function of RMS
voltage measured by either control board analog feedback circuits.
According to the figure below, the transfer function describes the
following relationship::
# Hardware V1 # # Hardware V2 #... | [
"r",
"Return",
"a",
"symbolic",
"equality",
"representation",
"of",
"the",
"transfer",
"function",
"of",
"RMS",
"voltage",
"measured",
"by",
"either",
"control",
"board",
"analog",
"feedback",
"circuits",
"."
] | 1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c | https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/dmf_control_board_firmware/calibrate/feedback.py#L104-L159 |
37,508 | studionow/pybrightcove | pybrightcove/config.py | has_option | def has_option(section, name):
"""
Wrapper around ConfigParser's ``has_option`` method.
"""
cfg = ConfigParser.SafeConfigParser({"working_dir": "/tmp", "debug": "0"})
cfg.read(CONFIG_LOCATIONS)
return cfg.has_option(section, name) | python | def has_option(section, name):
"""
Wrapper around ConfigParser's ``has_option`` method.
"""
cfg = ConfigParser.SafeConfigParser({"working_dir": "/tmp", "debug": "0"})
cfg.read(CONFIG_LOCATIONS)
return cfg.has_option(section, name) | [
"def",
"has_option",
"(",
"section",
",",
"name",
")",
":",
"cfg",
"=",
"ConfigParser",
".",
"SafeConfigParser",
"(",
"{",
"\"working_dir\"",
":",
"\"/tmp\"",
",",
"\"debug\"",
":",
"\"0\"",
"}",
")",
"cfg",
".",
"read",
"(",
"CONFIG_LOCATIONS",
")",
"retu... | Wrapper around ConfigParser's ``has_option`` method. | [
"Wrapper",
"around",
"ConfigParser",
"s",
"has_option",
"method",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/config.py#L40-L46 |
37,509 | studionow/pybrightcove | pybrightcove/config.py | get | def get(section, name):
"""
Wrapper around ConfigParser's ``get`` method.
"""
cfg = ConfigParser.SafeConfigParser({"working_dir": "/tmp", "debug": "0"})
cfg.read(CONFIG_LOCATIONS)
val = cfg.get(section, name)
return val.strip("'").strip('"') | python | def get(section, name):
"""
Wrapper around ConfigParser's ``get`` method.
"""
cfg = ConfigParser.SafeConfigParser({"working_dir": "/tmp", "debug": "0"})
cfg.read(CONFIG_LOCATIONS)
val = cfg.get(section, name)
return val.strip("'").strip('"') | [
"def",
"get",
"(",
"section",
",",
"name",
")",
":",
"cfg",
"=",
"ConfigParser",
".",
"SafeConfigParser",
"(",
"{",
"\"working_dir\"",
":",
"\"/tmp\"",
",",
"\"debug\"",
":",
"\"0\"",
"}",
")",
"cfg",
".",
"read",
"(",
"CONFIG_LOCATIONS",
")",
"val",
"="... | Wrapper around ConfigParser's ``get`` method. | [
"Wrapper",
"around",
"ConfigParser",
"s",
"get",
"method",
"."
] | 19c946b689a80156e070fe9bc35589c4b768e614 | https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/config.py#L49-L56 |
37,510 | memphis-iis/GLUDB | gludb/backends/gcd.py | make_key | def make_key(table_name, objid):
"""Create an object key for storage."""
key = datastore.Key()
path = key.path_element.add()
path.kind = table_name
path.name = str(objid)
return key | python | def make_key(table_name, objid):
"""Create an object key for storage."""
key = datastore.Key()
path = key.path_element.add()
path.kind = table_name
path.name = str(objid)
return key | [
"def",
"make_key",
"(",
"table_name",
",",
"objid",
")",
":",
"key",
"=",
"datastore",
".",
"Key",
"(",
")",
"path",
"=",
"key",
".",
"path_element",
".",
"add",
"(",
")",
"path",
".",
"kind",
"=",
"table_name",
"path",
".",
"name",
"=",
"str",
"("... | Create an object key for storage. | [
"Create",
"an",
"object",
"key",
"for",
"storage",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/gcd.py#L53-L59 |
37,511 | memphis-iis/GLUDB | gludb/backends/gcd.py | extract_entity | def extract_entity(found):
"""Copy found entity to a dict."""
obj = dict()
for prop in found.entity.property:
obj[prop.name] = prop.value.string_value
return obj | python | def extract_entity(found):
"""Copy found entity to a dict."""
obj = dict()
for prop in found.entity.property:
obj[prop.name] = prop.value.string_value
return obj | [
"def",
"extract_entity",
"(",
"found",
")",
":",
"obj",
"=",
"dict",
"(",
")",
"for",
"prop",
"in",
"found",
".",
"entity",
".",
"property",
":",
"obj",
"[",
"prop",
".",
"name",
"]",
"=",
"prop",
".",
"value",
".",
"string_value",
"return",
"obj"
] | Copy found entity to a dict. | [
"Copy",
"found",
"entity",
"to",
"a",
"dict",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/gcd.py#L83-L88 |
37,512 | memphis-iis/GLUDB | gludb/backends/gcd.py | read_rec | def read_rec(table_name, objid):
"""Generator that yields keyed recs from store."""
req = datastore.LookupRequest()
req.key.extend([make_key(table_name, objid)])
for found in datastore.lookup(req).found:
yield extract_entity(found) | python | def read_rec(table_name, objid):
"""Generator that yields keyed recs from store."""
req = datastore.LookupRequest()
req.key.extend([make_key(table_name, objid)])
for found in datastore.lookup(req).found:
yield extract_entity(found) | [
"def",
"read_rec",
"(",
"table_name",
",",
"objid",
")",
":",
"req",
"=",
"datastore",
".",
"LookupRequest",
"(",
")",
"req",
".",
"key",
".",
"extend",
"(",
"[",
"make_key",
"(",
"table_name",
",",
"objid",
")",
"]",
")",
"for",
"found",
"in",
"data... | Generator that yields keyed recs from store. | [
"Generator",
"that",
"yields",
"keyed",
"recs",
"from",
"store",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/gcd.py#L91-L97 |
37,513 | memphis-iis/GLUDB | gludb/backends/gcd.py | read_by_indexes | def read_by_indexes(table_name, index_name_values=None):
"""Index reader."""
req = datastore.RunQueryRequest()
query = req.query
query.kind.add().name = table_name
if not index_name_values:
index_name_values = []
for name, val in index_name_values:
queryFilter = query.filter.pr... | python | def read_by_indexes(table_name, index_name_values=None):
"""Index reader."""
req = datastore.RunQueryRequest()
query = req.query
query.kind.add().name = table_name
if not index_name_values:
index_name_values = []
for name, val in index_name_values:
queryFilter = query.filter.pr... | [
"def",
"read_by_indexes",
"(",
"table_name",
",",
"index_name_values",
"=",
"None",
")",
":",
"req",
"=",
"datastore",
".",
"RunQueryRequest",
"(",
")",
"query",
"=",
"req",
".",
"query",
"query",
".",
"kind",
".",
"add",
"(",
")",
".",
"name",
"=",
"t... | Index reader. | [
"Index",
"reader",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/gcd.py#L100-L138 |
37,514 | memphis-iis/GLUDB | gludb/backends/gcd.py | delete_table | def delete_table(table_name):
"""Mainly for testing."""
to_delete = [
make_key(table_name, rec['id'])
for rec in read_by_indexes(table_name, [])
]
with DatastoreTransaction() as tx:
tx.get_commit_req().mutation.delete.extend(to_delete) | python | def delete_table(table_name):
"""Mainly for testing."""
to_delete = [
make_key(table_name, rec['id'])
for rec in read_by_indexes(table_name, [])
]
with DatastoreTransaction() as tx:
tx.get_commit_req().mutation.delete.extend(to_delete) | [
"def",
"delete_table",
"(",
"table_name",
")",
":",
"to_delete",
"=",
"[",
"make_key",
"(",
"table_name",
",",
"rec",
"[",
"'id'",
"]",
")",
"for",
"rec",
"in",
"read_by_indexes",
"(",
"table_name",
",",
"[",
"]",
")",
"]",
"with",
"DatastoreTransaction",
... | Mainly for testing. | [
"Mainly",
"for",
"testing",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/gcd.py#L141-L149 |
37,515 | memphis-iis/GLUDB | gludb/backends/gcd.py | DatastoreTransaction.get_commit_req | def get_commit_req(self):
"""Lazy commit request getter."""
if not self.commit_req:
self.commit_req = datastore.CommitRequest()
self.commit_req.transaction = self.tx
return self.commit_req | python | def get_commit_req(self):
"""Lazy commit request getter."""
if not self.commit_req:
self.commit_req = datastore.CommitRequest()
self.commit_req.transaction = self.tx
return self.commit_req | [
"def",
"get_commit_req",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"commit_req",
":",
"self",
".",
"commit_req",
"=",
"datastore",
".",
"CommitRequest",
"(",
")",
"self",
".",
"commit_req",
".",
"transaction",
"=",
"self",
".",
"tx",
"return",
"se... | Lazy commit request getter. | [
"Lazy",
"commit",
"request",
"getter",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/gcd.py#L31-L36 |
37,516 | toumorokoshi/sprinter | sprinter/lib/command.py | call | def call(command, stdin=None, stdout=subprocess.PIPE, env=os.environ, cwd=None,
shell=False, output_log_level=logging.INFO, sensitive_info=False):
""" Better, smarter call logic """
if not sensitive_info:
logger.debug("calling command: %s" % command)
else:
logger.debug("calling comm... | python | def call(command, stdin=None, stdout=subprocess.PIPE, env=os.environ, cwd=None,
shell=False, output_log_level=logging.INFO, sensitive_info=False):
""" Better, smarter call logic """
if not sensitive_info:
logger.debug("calling command: %s" % command)
else:
logger.debug("calling comm... | [
"def",
"call",
"(",
"command",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"env",
"=",
"os",
".",
"environ",
",",
"cwd",
"=",
"None",
",",
"shell",
"=",
"False",
",",
"output_log_level",
"=",
"logging",
".",
"INFO",... | Better, smarter call logic | [
"Better",
"smarter",
"call",
"logic"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/command.py#L22-L53 |
37,517 | toumorokoshi/sprinter | sprinter/lib/command.py | whitespace_smart_split | def whitespace_smart_split(command):
"""
Split a command by whitespace, taking care to not split on
whitespace within quotes.
>>> whitespace_smart_split("test this \\\"in here\\\" again")
['test', 'this', '"in here"', 'again']
"""
return_array = []
s = ""
in_double_quotes = False
... | python | def whitespace_smart_split(command):
"""
Split a command by whitespace, taking care to not split on
whitespace within quotes.
>>> whitespace_smart_split("test this \\\"in here\\\" again")
['test', 'this', '"in here"', 'again']
"""
return_array = []
s = ""
in_double_quotes = False
... | [
"def",
"whitespace_smart_split",
"(",
"command",
")",
":",
"return_array",
"=",
"[",
"]",
"s",
"=",
"\"\"",
"in_double_quotes",
"=",
"False",
"escape",
"=",
"False",
"for",
"c",
"in",
"command",
":",
"if",
"c",
"==",
"'\"'",
":",
"if",
"in_double_quotes",
... | Split a command by whitespace, taking care to not split on
whitespace within quotes.
>>> whitespace_smart_split("test this \\\"in here\\\" again")
['test', 'this', '"in here"', 'again'] | [
"Split",
"a",
"command",
"by",
"whitespace",
"taking",
"care",
"to",
"not",
"split",
"on",
"whitespace",
"within",
"quotes",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/command.py#L56-L97 |
37,518 | toumorokoshi/sprinter | sprinter/feature/__init__.py | Feature.sync | def sync(self):
"""
execute the steps required to have the
feature end with the desired state.
"""
phase = _get_phase(self._formula_instance)
self.logger.info("%s %s..." % (phase.verb.capitalize(), self.feature_name))
message = "...finished %s %s." % (phase.verb, ... | python | def sync(self):
"""
execute the steps required to have the
feature end with the desired state.
"""
phase = _get_phase(self._formula_instance)
self.logger.info("%s %s..." % (phase.verb.capitalize(), self.feature_name))
message = "...finished %s %s." % (phase.verb, ... | [
"def",
"sync",
"(",
"self",
")",
":",
"phase",
"=",
"_get_phase",
"(",
"self",
".",
"_formula_instance",
")",
"self",
".",
"logger",
".",
"info",
"(",
"\"%s %s...\"",
"%",
"(",
"phase",
".",
"verb",
".",
"capitalize",
"(",
")",
",",
"self",
".",
"fea... | execute the steps required to have the
feature end with the desired state. | [
"execute",
"the",
"steps",
"required",
"to",
"have",
"the",
"feature",
"end",
"with",
"the",
"desired",
"state",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/feature/__init__.py#L33-L46 |
37,519 | satori-ng/hooker | hooker/hook_list.py | HookList.isloaded | def isloaded(self, name):
"""Checks if given hook module has been loaded
Args:
name (str): The name of the module to check
Returns:
bool. The return code::
True -- Loaded
False -- Not Loaded
"""
if name is None:
... | python | def isloaded(self, name):
"""Checks if given hook module has been loaded
Args:
name (str): The name of the module to check
Returns:
bool. The return code::
True -- Loaded
False -- Not Loaded
"""
if name is None:
... | [
"def",
"isloaded",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"is",
"None",
":",
"return",
"True",
"if",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"return",
"(",
"name",
"in",
"[",
"x",
".",
"__module__",
"for",
"x",
"in",
"self",
"... | Checks if given hook module has been loaded
Args:
name (str): The name of the module to check
Returns:
bool. The return code::
True -- Loaded
False -- Not Loaded | [
"Checks",
"if",
"given",
"hook",
"module",
"has",
"been",
"loaded"
] | 8ef1fffe1537f06313799d1e5e6f7acc4ab405b4 | https://github.com/satori-ng/hooker/blob/8ef1fffe1537f06313799d1e5e6f7acc4ab405b4/hooker/hook_list.py#L103-L124 |
37,520 | satori-ng/hooker | hooker/hook_list.py | HookList.hook | def hook(self, function, dependencies=None):
"""Tries to load a hook
Args:
function (func): Function that will be called when the event is called
Kwargs:
dependencies (str): String or Iterable with modules whose hooks should be called before this one
Raises:
... | python | def hook(self, function, dependencies=None):
"""Tries to load a hook
Args:
function (func): Function that will be called when the event is called
Kwargs:
dependencies (str): String or Iterable with modules whose hooks should be called before this one
Raises:
... | [
"def",
"hook",
"(",
"self",
",",
"function",
",",
"dependencies",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"dependencies",
",",
"(",
"Iterable",
",",
"type",
"(",
"None",
")",
",",
"str",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"Inv... | Tries to load a hook
Args:
function (func): Function that will be called when the event is called
Kwargs:
dependencies (str): String or Iterable with modules whose hooks should be called before this one
Raises:
:class:TypeError
Note that the depend... | [
"Tries",
"to",
"load",
"a",
"hook"
] | 8ef1fffe1537f06313799d1e5e6f7acc4ab405b4 | https://github.com/satori-ng/hooker/blob/8ef1fffe1537f06313799d1e5e6f7acc4ab405b4/hooker/hook_list.py#L126-L161 |
37,521 | gtaylor/EVE-Market-Data-Structures | emds/formats/unified/__init__.py | parse_from_json | def parse_from_json(json_str):
"""
Given a Unified Uploader message, parse the contents and return a
MarketOrderList or MarketHistoryList instance.
:param str json_str: A Unified Uploader message as a JSON string.
:rtype: MarketOrderList or MarketHistoryList
:raises: MalformedUploadError when i... | python | def parse_from_json(json_str):
"""
Given a Unified Uploader message, parse the contents and return a
MarketOrderList or MarketHistoryList instance.
:param str json_str: A Unified Uploader message as a JSON string.
:rtype: MarketOrderList or MarketHistoryList
:raises: MalformedUploadError when i... | [
"def",
"parse_from_json",
"(",
"json_str",
")",
":",
"try",
":",
"message_dict",
"=",
"json",
".",
"loads",
"(",
"json_str",
")",
"except",
"ValueError",
":",
"raise",
"ParseError",
"(",
"\"Mal-formed JSON input.\"",
")",
"upload_keys",
"=",
"message_dict",
".",... | Given a Unified Uploader message, parse the contents and return a
MarketOrderList or MarketHistoryList instance.
:param str json_str: A Unified Uploader message as a JSON string.
:rtype: MarketOrderList or MarketHistoryList
:raises: MalformedUploadError when invalid JSON is passed in. | [
"Given",
"a",
"Unified",
"Uploader",
"message",
"parse",
"the",
"contents",
"and",
"return",
"a",
"MarketOrderList",
"or",
"MarketHistoryList",
"instance",
"."
] | 77d69b24f2aada3aeff8fba3d75891bfba8fdcf3 | https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/formats/unified/__init__.py#L6-L43 |
37,522 | gtaylor/EVE-Market-Data-Structures | emds/formats/unified/__init__.py | encode_to_json | def encode_to_json(order_or_history):
"""
Given an order or history entry, encode it to JSON and return.
:type order_or_history: MarketOrderList or MarketHistoryList
:param order_or_history: A MarketOrderList or MarketHistoryList instance to
encode to JSON.
:rtype: str
:return: The enco... | python | def encode_to_json(order_or_history):
"""
Given an order or history entry, encode it to JSON and return.
:type order_or_history: MarketOrderList or MarketHistoryList
:param order_or_history: A MarketOrderList or MarketHistoryList instance to
encode to JSON.
:rtype: str
:return: The enco... | [
"def",
"encode_to_json",
"(",
"order_or_history",
")",
":",
"if",
"isinstance",
"(",
"order_or_history",
",",
"MarketOrderList",
")",
":",
"return",
"orders",
".",
"encode_to_json",
"(",
"order_or_history",
")",
"elif",
"isinstance",
"(",
"order_or_history",
",",
... | Given an order or history entry, encode it to JSON and return.
:type order_or_history: MarketOrderList or MarketHistoryList
:param order_or_history: A MarketOrderList or MarketHistoryList instance to
encode to JSON.
:rtype: str
:return: The encoded JSON string. | [
"Given",
"an",
"order",
"or",
"history",
"entry",
"encode",
"it",
"to",
"JSON",
"and",
"return",
"."
] | 77d69b24f2aada3aeff8fba3d75891bfba8fdcf3 | https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/formats/unified/__init__.py#L45-L60 |
37,523 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/detector/cascade.py | Cascade.add | def add(self, classifier, threshold, begin=None, end=None):
"""Adds a new strong classifier with the given threshold to the cascade.
**Parameters:**
classifier : :py:class:`bob.learn.boosting.BoostedMachine`
A strong classifier to add
``threshold`` : float
The classification threshold for... | python | def add(self, classifier, threshold, begin=None, end=None):
"""Adds a new strong classifier with the given threshold to the cascade.
**Parameters:**
classifier : :py:class:`bob.learn.boosting.BoostedMachine`
A strong classifier to add
``threshold`` : float
The classification threshold for... | [
"def",
"add",
"(",
"self",
",",
"classifier",
",",
"threshold",
",",
"begin",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"boosted_machine",
"=",
"bob",
".",
"learn",
".",
"boosting",
".",
"BoostedMachine",
"(",
")",
"if",
"begin",
"is",
"None",
... | Adds a new strong classifier with the given threshold to the cascade.
**Parameters:**
classifier : :py:class:`bob.learn.boosting.BoostedMachine`
A strong classifier to add
``threshold`` : float
The classification threshold for this cascade step
``begin``, ``end`` : int or ``None``
... | [
"Adds",
"a",
"new",
"strong",
"classifier",
"with",
"the",
"given",
"threshold",
"to",
"the",
"cascade",
"."
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/detector/cascade.py#L44-L65 |
37,524 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/detector/cascade.py | Cascade.create_from_boosted_machine | def create_from_boosted_machine(self, boosted_machine, classifiers_per_round, classification_thresholds=-5.):
"""Creates this cascade from the given boosted machine, by simply splitting off strong classifiers that have classifiers_per_round weak classifiers.
**Parameters:**
``boosted_machine`` : :py:class... | python | def create_from_boosted_machine(self, boosted_machine, classifiers_per_round, classification_thresholds=-5.):
"""Creates this cascade from the given boosted machine, by simply splitting off strong classifiers that have classifiers_per_round weak classifiers.
**Parameters:**
``boosted_machine`` : :py:class... | [
"def",
"create_from_boosted_machine",
"(",
"self",
",",
"boosted_machine",
",",
"classifiers_per_round",
",",
"classification_thresholds",
"=",
"-",
"5.",
")",
":",
"indices",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"len",
"(",
"boosted_machine",
".",
"weak_ma... | Creates this cascade from the given boosted machine, by simply splitting off strong classifiers that have classifiers_per_round weak classifiers.
**Parameters:**
``boosted_machine`` : :py:class:`bob.learn.boosting.BoostedMachine`
The strong classifier to split into a regular cascade.
``classifiers_... | [
"Creates",
"this",
"cascade",
"from",
"the",
"given",
"boosted",
"machine",
"by",
"simply",
"splitting",
"off",
"strong",
"classifiers",
"that",
"have",
"classifiers_per_round",
"weak",
"classifiers",
"."
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/detector/cascade.py#L68-L94 |
37,525 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/detector/cascade.py | Cascade.save | def save(self, hdf5):
"""Saves this cascade into the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for writing
"""
# write the cascade to file
hdf5.set("Thresholds", self.thresholds)
for i in range(len(self.cascade)):
hdf5.create... | python | def save(self, hdf5):
"""Saves this cascade into the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for writing
"""
# write the cascade to file
hdf5.set("Thresholds", self.thresholds)
for i in range(len(self.cascade)):
hdf5.create... | [
"def",
"save",
"(",
"self",
",",
"hdf5",
")",
":",
"# write the cascade to file",
"hdf5",
".",
"set",
"(",
"\"Thresholds\"",
",",
"self",
".",
"thresholds",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"cascade",
")",
")",
":",
"hdf5",... | Saves this cascade into the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for writing | [
"Saves",
"this",
"cascade",
"into",
"the",
"given",
"HDF5",
"file",
"."
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/detector/cascade.py#L174-L192 |
37,526 | bioidiap/bob.ip.facedetect | bob/ip/facedetect/detector/cascade.py | Cascade.load | def load(self, hdf5):
"""Loads this cascade from the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for reading
"""
# write the cascade to file
self.thresholds = hdf5.read("Thresholds")
self.cascade = []
for i in range(len(self.thre... | python | def load(self, hdf5):
"""Loads this cascade from the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for reading
"""
# write the cascade to file
self.thresholds = hdf5.read("Thresholds")
self.cascade = []
for i in range(len(self.thre... | [
"def",
"load",
"(",
"self",
",",
"hdf5",
")",
":",
"# write the cascade to file",
"self",
".",
"thresholds",
"=",
"hdf5",
".",
"read",
"(",
"\"Thresholds\"",
")",
"self",
".",
"cascade",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self"... | Loads this cascade from the given HDF5 file.
**Parameters:**
``hdf5`` : :py:class:`bob.io.base.HDF5File`
An HDF5 file open for reading | [
"Loads",
"this",
"cascade",
"from",
"the",
"given",
"HDF5",
"file",
"."
] | 601da5141ca7302ad36424d1421b33190ba46779 | https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/detector/cascade.py#L195-L213 |
37,527 | inveniosoftware/kwalitee | kwalitee/cli/check.py | check | def check(ctx, repository, config):
"""Check commits."""
ctx.obj = Repo(repository=repository, config=config) | python | def check(ctx, repository, config):
"""Check commits."""
ctx.obj = Repo(repository=repository, config=config) | [
"def",
"check",
"(",
"ctx",
",",
"repository",
",",
"config",
")",
":",
"ctx",
".",
"obj",
"=",
"Repo",
"(",
"repository",
"=",
"repository",
",",
"config",
"=",
"config",
")"
] | Check commits. | [
"Check",
"commits",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/cli/check.py#L64-L66 |
37,528 | inveniosoftware/kwalitee | kwalitee/cli/check.py | message | def message(obj, commit='HEAD', skip_merge_commits=False):
"""Check the messages of the commits."""
from ..kwalitee import check_message
options = obj.options
repository = obj.repository
if options.get('colors') is not False:
colorama.init(autoreset=True)
reset = colorama.Style.RESE... | python | def message(obj, commit='HEAD', skip_merge_commits=False):
"""Check the messages of the commits."""
from ..kwalitee import check_message
options = obj.options
repository = obj.repository
if options.get('colors') is not False:
colorama.init(autoreset=True)
reset = colorama.Style.RESE... | [
"def",
"message",
"(",
"obj",
",",
"commit",
"=",
"'HEAD'",
",",
"skip_merge_commits",
"=",
"False",
")",
":",
"from",
".",
".",
"kwalitee",
"import",
"check_message",
"options",
"=",
"obj",
".",
"options",
"repository",
"=",
"obj",
".",
"repository",
"if"... | Check the messages of the commits. | [
"Check",
"the",
"messages",
"of",
"the",
"commits",
"."
] | 9124f8f55b15547fef08c6c43cabced314e70674 | https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/cli/check.py#L117-L170 |
37,529 | 0k/kids.cmd | src/kids/cmd/cmd.py | get_obj_subcmds | def get_obj_subcmds(obj):
"""Fetch action in callable attributes which and commands
Callable must have their attribute 'command' set to True to
be recognised by this lookup.
Please consider using the decorator ``@cmd`` to declare your
subcommands in classes for instance.
"""
subcmds = []
... | python | def get_obj_subcmds(obj):
"""Fetch action in callable attributes which and commands
Callable must have their attribute 'command' set to True to
be recognised by this lookup.
Please consider using the decorator ``@cmd`` to declare your
subcommands in classes for instance.
"""
subcmds = []
... | [
"def",
"get_obj_subcmds",
"(",
"obj",
")",
":",
"subcmds",
"=",
"[",
"]",
"for",
"label",
"in",
"dir",
"(",
"obj",
".",
"__class__",
")",
":",
"if",
"label",
".",
"startswith",
"(",
"\"_\"",
")",
":",
"continue",
"if",
"isinstance",
"(",
"getattr",
"... | Fetch action in callable attributes which and commands
Callable must have their attribute 'command' set to True to
be recognised by this lookup.
Please consider using the decorator ``@cmd`` to declare your
subcommands in classes for instance. | [
"Fetch",
"action",
"in",
"callable",
"attributes",
"which",
"and",
"commands"
] | bbe958556bc72e6579d4007a28064e2f62109bcf | https://github.com/0k/kids.cmd/blob/bbe958556bc72e6579d4007a28064e2f62109bcf/src/kids/cmd/cmd.py#L68-L95 |
37,530 | 0k/kids.cmd | src/kids/cmd/cmd.py | get_module_resources | def get_module_resources(mod):
"""Return probed sub module names from given module"""
path = os.path.dirname(os.path.realpath(mod.__file__))
prefix = kf.basename(mod.__file__, (".py", ".pyc"))
if not os.path.exists(mod.__file__):
import pkg_resources
for resource_name in pkg_resources.... | python | def get_module_resources(mod):
"""Return probed sub module names from given module"""
path = os.path.dirname(os.path.realpath(mod.__file__))
prefix = kf.basename(mod.__file__, (".py", ".pyc"))
if not os.path.exists(mod.__file__):
import pkg_resources
for resource_name in pkg_resources.... | [
"def",
"get_module_resources",
"(",
"mod",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"mod",
".",
"__file__",
")",
")",
"prefix",
"=",
"kf",
".",
"basename",
"(",
"mod",
".",
"__file__",
... | Return probed sub module names from given module | [
"Return",
"probed",
"sub",
"module",
"names",
"from",
"given",
"module"
] | bbe958556bc72e6579d4007a28064e2f62109bcf | https://github.com/0k/kids.cmd/blob/bbe958556bc72e6579d4007a28064e2f62109bcf/src/kids/cmd/cmd.py#L98-L113 |
37,531 | 0k/kids.cmd | src/kids/cmd/cmd.py | get_mod_subcmds | def get_mod_subcmds(mod):
"""Fetch action in same directory in python module
python module loaded are of this form: '%s_*.py' % prefix
"""
## Look in modules attributes
subcmds = get_obj_subcmds(mod)
path = os.path.dirname(os.path.realpath(mod.__file__))
if mod.__package__ is None:
... | python | def get_mod_subcmds(mod):
"""Fetch action in same directory in python module
python module loaded are of this form: '%s_*.py' % prefix
"""
## Look in modules attributes
subcmds = get_obj_subcmds(mod)
path = os.path.dirname(os.path.realpath(mod.__file__))
if mod.__package__ is None:
... | [
"def",
"get_mod_subcmds",
"(",
"mod",
")",
":",
"## Look in modules attributes",
"subcmds",
"=",
"get_obj_subcmds",
"(",
"mod",
")",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"mod",
".",
"__file__",
")",
... | Fetch action in same directory in python module
python module loaded are of this form: '%s_*.py' % prefix | [
"Fetch",
"action",
"in",
"same",
"directory",
"in",
"python",
"module"
] | bbe958556bc72e6579d4007a28064e2f62109bcf | https://github.com/0k/kids.cmd/blob/bbe958556bc72e6579d4007a28064e2f62109bcf/src/kids/cmd/cmd.py#L116-L158 |
37,532 | 0k/kids.cmd | src/kids/cmd/cmd.py | get_help | def get_help(obj, env, subcmds):
"""Interpolate complete help doc of given object
Assumption that given object as a specific interface:
obj.__doc__ is the basic help object.
obj.get_actions_titles() returns the subcommand if any.
"""
doc = txt.dedent(obj.__doc__ or "")
env = env.copy() ... | python | def get_help(obj, env, subcmds):
"""Interpolate complete help doc of given object
Assumption that given object as a specific interface:
obj.__doc__ is the basic help object.
obj.get_actions_titles() returns the subcommand if any.
"""
doc = txt.dedent(obj.__doc__ or "")
env = env.copy() ... | [
"def",
"get_help",
"(",
"obj",
",",
"env",
",",
"subcmds",
")",
":",
"doc",
"=",
"txt",
".",
"dedent",
"(",
"obj",
".",
"__doc__",
"or",
"\"\"",
")",
"env",
"=",
"env",
".",
"copy",
"(",
")",
"## get a local copy",
"doc",
"=",
"doc",
".",
"strip",
... | Interpolate complete help doc of given object
Assumption that given object as a specific interface:
obj.__doc__ is the basic help object.
obj.get_actions_titles() returns the subcommand if any. | [
"Interpolate",
"complete",
"help",
"doc",
"of",
"given",
"object"
] | bbe958556bc72e6579d4007a28064e2f62109bcf | https://github.com/0k/kids.cmd/blob/bbe958556bc72e6579d4007a28064e2f62109bcf/src/kids/cmd/cmd.py#L195-L262 |
37,533 | 0k/kids.cmd | src/kids/cmd/cmd.py | get_calling_prototype | def get_calling_prototype(acallable):
"""Returns actual working calling prototype
This means that the prototype given can be used directly
in the same way by bound method, method, function, lambda::
>>> def f1(a, b, c=1): pass
>>> get_calling_prototype(f1)
(['a', 'b', 'c'], (1,))
... | python | def get_calling_prototype(acallable):
"""Returns actual working calling prototype
This means that the prototype given can be used directly
in the same way by bound method, method, function, lambda::
>>> def f1(a, b, c=1): pass
>>> get_calling_prototype(f1)
(['a', 'b', 'c'], (1,))
... | [
"def",
"get_calling_prototype",
"(",
"acallable",
")",
":",
"assert",
"callable",
"(",
"acallable",
")",
"if",
"inspect",
".",
"ismethod",
"(",
"acallable",
")",
"or",
"inspect",
".",
"isfunction",
"(",
"acallable",
")",
":",
"args",
",",
"vargs",
",",
"vk... | Returns actual working calling prototype
This means that the prototype given can be used directly
in the same way by bound method, method, function, lambda::
>>> def f1(a, b, c=1): pass
>>> get_calling_prototype(f1)
(['a', 'b', 'c'], (1,))
>>> get_calling_prototype(lambda a, b:... | [
"Returns",
"actual",
"working",
"calling",
"prototype"
] | bbe958556bc72e6579d4007a28064e2f62109bcf | https://github.com/0k/kids.cmd/blob/bbe958556bc72e6579d4007a28064e2f62109bcf/src/kids/cmd/cmd.py#L305-L369 |
37,534 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.initialize | def initialize(self):
""" Generate the root directory root if it doesn't already exist """
if not os.path.exists(self.root_dir):
os.makedirs(self.root_dir)
assert os.path.isdir(self.root_dir), "%s is not a directory! Please move or remove it." % self.root_dir
for d in ["bin",... | python | def initialize(self):
""" Generate the root directory root if it doesn't already exist """
if not os.path.exists(self.root_dir):
os.makedirs(self.root_dir)
assert os.path.isdir(self.root_dir), "%s is not a directory! Please move or remove it." % self.root_dir
for d in ["bin",... | [
"def",
"initialize",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"root_dir",
")",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"root_dir",
")",
"assert",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
"... | Generate the root directory root if it doesn't already exist | [
"Generate",
"the",
"root",
"directory",
"root",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L50-L61 |
37,535 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.finalize | def finalize(self):
""" finalize any open file handles """
if self.rc_file:
self.rc_file.close()
if self.env_file:
self.env_file.close() | python | def finalize(self):
""" finalize any open file handles """
if self.rc_file:
self.rc_file.close()
if self.env_file:
self.env_file.close() | [
"def",
"finalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"rc_file",
":",
"self",
".",
"rc_file",
".",
"close",
"(",
")",
"if",
"self",
".",
"env_file",
":",
"self",
".",
"env_file",
".",
"close",
"(",
")"
] | finalize any open file handles | [
"finalize",
"any",
"open",
"file",
"handles"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L63-L68 |
37,536 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.remove | def remove(self):
""" Removes the sprinter directory, if it exists """
if self.rc_file:
self.rc_file.close()
if self.env_file:
self.env_file.close()
shutil.rmtree(self.root_dir) | python | def remove(self):
""" Removes the sprinter directory, if it exists """
if self.rc_file:
self.rc_file.close()
if self.env_file:
self.env_file.close()
shutil.rmtree(self.root_dir) | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"self",
".",
"rc_file",
":",
"self",
".",
"rc_file",
".",
"close",
"(",
")",
"if",
"self",
".",
"env_file",
":",
"self",
".",
"env_file",
".",
"close",
"(",
")",
"shutil",
".",
"rmtree",
"(",
"self",
... | Removes the sprinter directory, if it exists | [
"Removes",
"the",
"sprinter",
"directory",
"if",
"it",
"exists"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L70-L76 |
37,537 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.symlink_to_bin | def symlink_to_bin(self, name, path):
""" Symlink an object at path to name in the bin folder. """
self.__symlink_dir("bin", name, path)
os.chmod(os.path.join(self.root_dir, "bin", name), os.stat(path).st_mode | stat.S_IXUSR | stat.S_IRUSR) | python | def symlink_to_bin(self, name, path):
""" Symlink an object at path to name in the bin folder. """
self.__symlink_dir("bin", name, path)
os.chmod(os.path.join(self.root_dir, "bin", name), os.stat(path).st_mode | stat.S_IXUSR | stat.S_IRUSR) | [
"def",
"symlink_to_bin",
"(",
"self",
",",
"name",
",",
"path",
")",
":",
"self",
".",
"__symlink_dir",
"(",
"\"bin\"",
",",
"name",
",",
"path",
")",
"os",
".",
"chmod",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"root_dir",
",",
"\"bi... | Symlink an object at path to name in the bin folder. | [
"Symlink",
"an",
"object",
"at",
"path",
"to",
"name",
"in",
"the",
"bin",
"folder",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L78-L81 |
37,538 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.remove_feature | def remove_feature(self, feature_name):
""" Remove an feature from the environment root folder. """
self.clear_feature_symlinks(feature_name)
if os.path.exists(self.install_directory(feature_name)):
self.__remove_path(self.install_directory(feature_name)) | python | def remove_feature(self, feature_name):
""" Remove an feature from the environment root folder. """
self.clear_feature_symlinks(feature_name)
if os.path.exists(self.install_directory(feature_name)):
self.__remove_path(self.install_directory(feature_name)) | [
"def",
"remove_feature",
"(",
"self",
",",
"feature_name",
")",
":",
"self",
".",
"clear_feature_symlinks",
"(",
"feature_name",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"install_directory",
"(",
"feature_name",
")",
")",
":",
"self",
... | Remove an feature from the environment root folder. | [
"Remove",
"an",
"feature",
"from",
"the",
"environment",
"root",
"folder",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L91-L95 |
37,539 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.clear_feature_symlinks | def clear_feature_symlinks(self, feature_name):
""" Clear the symlinks for a feature in the symlinked path """
logger.debug("Clearing feature symlinks for %s" % feature_name)
feature_path = self.install_directory(feature_name)
for d in ('bin', 'lib'):
if os.path.exists(os.pat... | python | def clear_feature_symlinks(self, feature_name):
""" Clear the symlinks for a feature in the symlinked path """
logger.debug("Clearing feature symlinks for %s" % feature_name)
feature_path = self.install_directory(feature_name)
for d in ('bin', 'lib'):
if os.path.exists(os.pat... | [
"def",
"clear_feature_symlinks",
"(",
"self",
",",
"feature_name",
")",
":",
"logger",
".",
"debug",
"(",
"\"Clearing feature symlinks for %s\"",
"%",
"feature_name",
")",
"feature_path",
"=",
"self",
".",
"install_directory",
"(",
"feature_name",
")",
"for",
"d",
... | Clear the symlinks for a feature in the symlinked path | [
"Clear",
"the",
"symlinks",
"for",
"a",
"feature",
"in",
"the",
"symlinked",
"path"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L117-L126 |
37,540 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.add_to_env | def add_to_env(self, content):
"""
add content to the env script.
"""
if not self.rewrite_config:
raise DirectoryException("Error! Directory was not intialized w/ rewrite_config.")
if not self.env_file:
self.env_path, self.env_file = self.__get_env_handle(... | python | def add_to_env(self, content):
"""
add content to the env script.
"""
if not self.rewrite_config:
raise DirectoryException("Error! Directory was not intialized w/ rewrite_config.")
if not self.env_file:
self.env_path, self.env_file = self.__get_env_handle(... | [
"def",
"add_to_env",
"(",
"self",
",",
"content",
")",
":",
"if",
"not",
"self",
".",
"rewrite_config",
":",
"raise",
"DirectoryException",
"(",
"\"Error! Directory was not intialized w/ rewrite_config.\"",
")",
"if",
"not",
"self",
".",
"env_file",
":",
"self",
"... | add content to the env script. | [
"add",
"content",
"to",
"the",
"env",
"script",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L134-L142 |
37,541 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.add_to_rc | def add_to_rc(self, content):
"""
add content to the rc script.
"""
if not self.rewrite_config:
raise DirectoryException("Error! Directory was not intialized w/ rewrite_config.")
if not self.rc_file:
self.rc_path, self.rc_file = self.__get_rc_handle(self.r... | python | def add_to_rc(self, content):
"""
add content to the rc script.
"""
if not self.rewrite_config:
raise DirectoryException("Error! Directory was not intialized w/ rewrite_config.")
if not self.rc_file:
self.rc_path, self.rc_file = self.__get_rc_handle(self.r... | [
"def",
"add_to_rc",
"(",
"self",
",",
"content",
")",
":",
"if",
"not",
"self",
".",
"rewrite_config",
":",
"raise",
"DirectoryException",
"(",
"\"Error! Directory was not intialized w/ rewrite_config.\"",
")",
"if",
"not",
"self",
".",
"rc_file",
":",
"self",
"."... | add content to the rc script. | [
"add",
"content",
"to",
"the",
"rc",
"script",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L144-L152 |
37,542 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.add_to_gui | def add_to_gui(self, content):
"""
add content to the gui script.
"""
if not self.rewrite_config:
raise DirectoryException("Error! Directory was not intialized w/ rewrite_config.")
if not self.gui_file:
self.gui_path, self.gui_file = self.__get_gui_handle(... | python | def add_to_gui(self, content):
"""
add content to the gui script.
"""
if not self.rewrite_config:
raise DirectoryException("Error! Directory was not intialized w/ rewrite_config.")
if not self.gui_file:
self.gui_path, self.gui_file = self.__get_gui_handle(... | [
"def",
"add_to_gui",
"(",
"self",
",",
"content",
")",
":",
"if",
"not",
"self",
".",
"rewrite_config",
":",
"raise",
"DirectoryException",
"(",
"\"Error! Directory was not intialized w/ rewrite_config.\"",
")",
"if",
"not",
"self",
".",
"gui_file",
":",
"self",
"... | add content to the gui script. | [
"add",
"content",
"to",
"the",
"gui",
"script",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L154-L162 |
37,543 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.__remove_path | def __remove_path(self, path):
""" Remove an object """
curpath = os.path.abspath(os.curdir)
if not os.path.exists(path):
logger.warn("Attempted to remove a non-existent path %s" % path)
return
try:
if os.path.islink(path):
os.unlink(pa... | python | def __remove_path(self, path):
""" Remove an object """
curpath = os.path.abspath(os.curdir)
if not os.path.exists(path):
logger.warn("Attempted to remove a non-existent path %s" % path)
return
try:
if os.path.islink(path):
os.unlink(pa... | [
"def",
"__remove_path",
"(",
"self",
",",
"path",
")",
":",
"curpath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"curdir",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"logger",
".",
"warn",
"(",
"\"Att... | Remove an object | [
"Remove",
"an",
"object"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L164-L185 |
37,544 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.__get_rc_handle | def __get_rc_handle(self, root_dir):
""" get the filepath and filehandle to the rc file for the environment """
rc_path = os.path.join(root_dir, '.rc')
env_path = os.path.join(root_dir, '.env')
fh = open(rc_path, "w+")
# .rc will always source .env
fh.write(source_templat... | python | def __get_rc_handle(self, root_dir):
""" get the filepath and filehandle to the rc file for the environment """
rc_path = os.path.join(root_dir, '.rc')
env_path = os.path.join(root_dir, '.env')
fh = open(rc_path, "w+")
# .rc will always source .env
fh.write(source_templat... | [
"def",
"__get_rc_handle",
"(",
"self",
",",
"root_dir",
")",
":",
"rc_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root_dir",
",",
"'.rc'",
")",
"env_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root_dir",
",",
"'.env'",
")",
"fh",
"=",
"... | get the filepath and filehandle to the rc file for the environment | [
"get",
"the",
"filepath",
"and",
"filehandle",
"to",
"the",
"rc",
"file",
"for",
"the",
"environment"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L198-L205 |
37,545 | toumorokoshi/sprinter | sprinter/core/directory.py | Directory.__symlink_dir | def __symlink_dir(self, dir_name, name, path):
"""
Symlink an object at path to name in the dir_name folder. remove it if it already exists.
"""
target_dir = os.path.join(self.root_dir, dir_name)
if not os.path.exists(target_dir):
os.makedirs(target_dir)
targe... | python | def __symlink_dir(self, dir_name, name, path):
"""
Symlink an object at path to name in the dir_name folder. remove it if it already exists.
"""
target_dir = os.path.join(self.root_dir, dir_name)
if not os.path.exists(target_dir):
os.makedirs(target_dir)
targe... | [
"def",
"__symlink_dir",
"(",
"self",
",",
"dir_name",
",",
"name",
",",
"path",
")",
":",
"target_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"root_dir",
",",
"dir_name",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"ta... | Symlink an object at path to name in the dir_name folder. remove it if it already exists. | [
"Symlink",
"an",
"object",
"at",
"path",
"to",
"name",
"in",
"the",
"dir_name",
"folder",
".",
"remove",
"it",
"if",
"it",
"already",
"exists",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/directory.py#L213-L228 |
37,546 | jkeyes/python-docraptor | docraptor/__init__.py | DocRaptor.list_docs | def list_docs(self, options=None):
"""Return list of previously created documents."""
if options is None:
raise ValueError("Please pass in an options dict")
default_options = {
"page": 1,
"per_page": 100,
"raise_exception_on_failure": False,
... | python | def list_docs(self, options=None):
"""Return list of previously created documents."""
if options is None:
raise ValueError("Please pass in an options dict")
default_options = {
"page": 1,
"per_page": 100,
"raise_exception_on_failure": False,
... | [
"def",
"list_docs",
"(",
"self",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Please pass in an options dict\"",
")",
"default_options",
"=",
"{",
"\"page\"",
":",
"1",
",",
"\"per_page\"",
":",
"1... | Return list of previously created documents. | [
"Return",
"list",
"of",
"previously",
"created",
"documents",
"."
] | 4be5b641f92820539b2c42165fec9251a6603dea | https://github.com/jkeyes/python-docraptor/blob/4be5b641f92820539b2c42165fec9251a6603dea/docraptor/__init__.py#L102-L122 |
37,547 | jkeyes/python-docraptor | docraptor/__init__.py | DocRaptor.status | def status(self, status_id, raise_exception_on_failure=False):
"""Return the status of the generation job."""
query = {"output": "json", "user_credentials": self.api_key}
resp = requests.get(
"%sstatus/%s" % (self._url, status_id), params=query, timeout=self._timeout
)
... | python | def status(self, status_id, raise_exception_on_failure=False):
"""Return the status of the generation job."""
query = {"output": "json", "user_credentials": self.api_key}
resp = requests.get(
"%sstatus/%s" % (self._url, status_id), params=query, timeout=self._timeout
)
... | [
"def",
"status",
"(",
"self",
",",
"status_id",
",",
"raise_exception_on_failure",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"output\"",
":",
"\"json\"",
",",
"\"user_credentials\"",
":",
"self",
".",
"api_key",
"}",
"resp",
"=",
"requests",
".",
"get",
... | Return the status of the generation job. | [
"Return",
"the",
"status",
"of",
"the",
"generation",
"job",
"."
] | 4be5b641f92820539b2c42165fec9251a6603dea | https://github.com/jkeyes/python-docraptor/blob/4be5b641f92820539b2c42165fec9251a6603dea/docraptor/__init__.py#L124-L140 |
37,548 | jkeyes/python-docraptor | docraptor/__init__.py | DocRaptor.download | def download(self, download_key, raise_exception_on_failure=False):
"""Download the file represented by the download_key."""
query = {"output": "json", "user_credentials": self.api_key}
resp = requests.get(
"%sdownload/%s" % (self._url, download_key),
params=query,
... | python | def download(self, download_key, raise_exception_on_failure=False):
"""Download the file represented by the download_key."""
query = {"output": "json", "user_credentials": self.api_key}
resp = requests.get(
"%sdownload/%s" % (self._url, download_key),
params=query,
... | [
"def",
"download",
"(",
"self",
",",
"download_key",
",",
"raise_exception_on_failure",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"output\"",
":",
"\"json\"",
",",
"\"user_credentials\"",
":",
"self",
".",
"api_key",
"}",
"resp",
"=",
"requests",
".",
"ge... | Download the file represented by the download_key. | [
"Download",
"the",
"file",
"represented",
"by",
"the",
"download_key",
"."
] | 4be5b641f92820539b2c42165fec9251a6603dea | https://github.com/jkeyes/python-docraptor/blob/4be5b641f92820539b2c42165fec9251a6603dea/docraptor/__init__.py#L142-L153 |
37,549 | smarie/python-parsyfiles | parsyfiles/plugins_base/support_for_collections.py | MultifileCollectionParser._get_parsing_plan_for_multifile_children | def _get_parsing_plan_for_multifile_children(self, obj_on_fs: PersistedObject, desired_type: Type[Any],
logger: Logger) -> Dict[str, Any]:
"""
Simply inspects the required type to find the base type expected for items of the collection,
and relies... | python | def _get_parsing_plan_for_multifile_children(self, obj_on_fs: PersistedObject, desired_type: Type[Any],
logger: Logger) -> Dict[str, Any]:
"""
Simply inspects the required type to find the base type expected for items of the collection,
and relies... | [
"def",
"_get_parsing_plan_for_multifile_children",
"(",
"self",
",",
"obj_on_fs",
":",
"PersistedObject",
",",
"desired_type",
":",
"Type",
"[",
"Any",
"]",
",",
"logger",
":",
"Logger",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"# nb of file childr... | Simply inspects the required type to find the base type expected for items of the collection,
and relies on the ParserFinder to find the parsing plan
:param obj_on_fs:
:param desired_type:
:param logger:
:return: | [
"Simply",
"inspects",
"the",
"required",
"type",
"to",
"find",
"the",
"base",
"type",
"expected",
"for",
"items",
"of",
"the",
"collection",
"and",
"relies",
"on",
"the",
"ParserFinder",
"to",
"find",
"the",
"parsing",
"plan"
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_base/support_for_collections.py#L269-L306 |
37,550 | wheeler-microfluidics/dmf-control-board-firmware | dmf_control_board_firmware/calibrate/impedance_benchmarks.py | plot_stat_summary | def plot_stat_summary(df, fig=None):
'''
Plot stats grouped by test capacitor load _and_ frequency.
In other words, we calculate the mean of all samples in the data
frame for each test capacitance and frequency pairing, plotting
the following stats:
- Root mean squared error
- Coefficien... | python | def plot_stat_summary(df, fig=None):
'''
Plot stats grouped by test capacitor load _and_ frequency.
In other words, we calculate the mean of all samples in the data
frame for each test capacitance and frequency pairing, plotting
the following stats:
- Root mean squared error
- Coefficien... | [
"def",
"plot_stat_summary",
"(",
"df",
",",
"fig",
"=",
"None",
")",
":",
"if",
"fig",
"is",
"None",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"8",
",",
"8",
")",
")",
"# Define a subplot layout, 3 rows, 2 columns",
"grid",
"=",
... | Plot stats grouped by test capacitor load _and_ frequency.
In other words, we calculate the mean of all samples in the data
frame for each test capacitance and frequency pairing, plotting
the following stats:
- Root mean squared error
- Coefficient of variation
- Bias
## [Coefficient o... | [
"Plot",
"stats",
"grouped",
"by",
"test",
"capacitor",
"load",
"_and_",
"frequency",
"."
] | 1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c | https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/dmf_control_board_firmware/calibrate/impedance_benchmarks.py#L207-L250 |
37,551 | toumorokoshi/sprinter | sprinter/core/manifest.py | load_manifest | def load_manifest(raw_manifest, namespace=None, **kwargs):
""" wrapper method which generates the manifest from various sources """
if isinstance(raw_manifest, configparser.RawConfigParser):
return Manifest(raw_manifest)
manifest = create_configparser()
if not manifest.has_section('config'):
... | python | def load_manifest(raw_manifest, namespace=None, **kwargs):
""" wrapper method which generates the manifest from various sources """
if isinstance(raw_manifest, configparser.RawConfigParser):
return Manifest(raw_manifest)
manifest = create_configparser()
if not manifest.has_section('config'):
... | [
"def",
"load_manifest",
"(",
"raw_manifest",
",",
"namespace",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"raw_manifest",
",",
"configparser",
".",
"RawConfigParser",
")",
":",
"return",
"Manifest",
"(",
"raw_manifest",
")",
"ma... | wrapper method which generates the manifest from various sources | [
"wrapper",
"method",
"which",
"generates",
"the",
"manifest",
"from",
"various",
"sources"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L36-L49 |
37,552 | toumorokoshi/sprinter | sprinter/core/manifest.py | _load_manifest_from_url | def _load_manifest_from_url(manifest, url, verify_certificate=True, username=None, password=None):
""" load a url body into a manifest """
try:
if username and password:
manifest_file_handler = StringIO(lib.authenticated_get(username, password, url,
... | python | def _load_manifest_from_url(manifest, url, verify_certificate=True, username=None, password=None):
""" load a url body into a manifest """
try:
if username and password:
manifest_file_handler = StringIO(lib.authenticated_get(username, password, url,
... | [
"def",
"_load_manifest_from_url",
"(",
"manifest",
",",
"url",
",",
"verify_certificate",
"=",
"True",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"try",
":",
"if",
"username",
"and",
"password",
":",
"manifest_file_handler",
"=",
"... | load a url body into a manifest | [
"load",
"a",
"url",
"body",
"into",
"a",
"manifest"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L86-L100 |
37,553 | toumorokoshi/sprinter | sprinter/core/manifest.py | _load_manifest_from_file | def _load_manifest_from_file(manifest, path):
""" load manifest from file """
path = os.path.abspath(os.path.expanduser(path))
if not os.path.exists(path):
raise ManifestException("Manifest does not exist at {0}!".format(path))
manifest.read(path)
if not manifest.has_option('config', 'source... | python | def _load_manifest_from_file(manifest, path):
""" load manifest from file """
path = os.path.abspath(os.path.expanduser(path))
if not os.path.exists(path):
raise ManifestException("Manifest does not exist at {0}!".format(path))
manifest.read(path)
if not manifest.has_option('config', 'source... | [
"def",
"_load_manifest_from_file",
"(",
"manifest",
",",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
... | load manifest from file | [
"load",
"manifest",
"from",
"file"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L103-L110 |
37,554 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.formula_sections | def formula_sections(self):
"""
Return all sections related to a formula, re-ordered according to the "depends" section.
"""
if self.dtree is not None:
return self.dtree.order
else:
return [s for s in self.manifest.sections() if s != "config"] | python | def formula_sections(self):
"""
Return all sections related to a formula, re-ordered according to the "depends" section.
"""
if self.dtree is not None:
return self.dtree.order
else:
return [s for s in self.manifest.sections() if s != "config"] | [
"def",
"formula_sections",
"(",
"self",
")",
":",
"if",
"self",
".",
"dtree",
"is",
"not",
"None",
":",
"return",
"self",
".",
"dtree",
".",
"order",
"else",
":",
"return",
"[",
"s",
"for",
"s",
"in",
"self",
".",
"manifest",
".",
"sections",
"(",
... | Return all sections related to a formula, re-ordered according to the "depends" section. | [
"Return",
"all",
"sections",
"related",
"to",
"a",
"formula",
"re",
"-",
"ordered",
"according",
"to",
"the",
"depends",
"section",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L149-L156 |
37,555 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.is_affirmative | def is_affirmative(self, section, option):
"""
Return true if the section option combo exists and it is set
to a truthy value.
"""
return self.has_option(section, option) and \
lib.is_affirmative(self.get(section, option)) | python | def is_affirmative(self, section, option):
"""
Return true if the section option combo exists and it is set
to a truthy value.
"""
return self.has_option(section, option) and \
lib.is_affirmative(self.get(section, option)) | [
"def",
"is_affirmative",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"return",
"self",
".",
"has_option",
"(",
"section",
",",
"option",
")",
"and",
"lib",
".",
"is_affirmative",
"(",
"self",
".",
"get",
"(",
"section",
",",
"option",
")",
")... | Return true if the section option combo exists and it is set
to a truthy value. | [
"Return",
"true",
"if",
"the",
"section",
"option",
"combo",
"exists",
"and",
"it",
"is",
"set",
"to",
"a",
"truthy",
"value",
"."
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L169-L175 |
37,556 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.write | def write(self, file_handle):
""" write the current state to a file manifest """
for k, v in self.inputs.write_values().items():
self.set('config', k, v)
self.set('config', 'namespace', self.namespace)
self.manifest.write(file_handle) | python | def write(self, file_handle):
""" write the current state to a file manifest """
for k, v in self.inputs.write_values().items():
self.set('config', k, v)
self.set('config', 'namespace', self.namespace)
self.manifest.write(file_handle) | [
"def",
"write",
"(",
"self",
",",
"file_handle",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"inputs",
".",
"write_values",
"(",
")",
".",
"items",
"(",
")",
":",
"self",
".",
"set",
"(",
"'config'",
",",
"k",
",",
"v",
")",
"self",
".",... | write the current state to a file manifest | [
"write",
"the",
"current",
"state",
"to",
"a",
"file",
"manifest"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L182-L187 |
37,557 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.get_context_dict | def get_context_dict(self):
""" return a context dict of the desired state """
context_dict = {}
for s in self.sections():
for k, v in self.manifest.items(s):
context_dict["%s:%s" % (s, k)] = v
for k, v in self.inputs.values().items():
context_dict... | python | def get_context_dict(self):
""" return a context dict of the desired state """
context_dict = {}
for s in self.sections():
for k, v in self.manifest.items(s):
context_dict["%s:%s" % (s, k)] = v
for k, v in self.inputs.values().items():
context_dict... | [
"def",
"get_context_dict",
"(",
"self",
")",
":",
"context_dict",
"=",
"{",
"}",
"for",
"s",
"in",
"self",
".",
"sections",
"(",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"manifest",
".",
"items",
"(",
"s",
")",
":",
"context_dict",
"[",
... | return a context dict of the desired state | [
"return",
"a",
"context",
"dict",
"of",
"the",
"desired",
"state"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L196-L206 |
37,558 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.get | def get(self, section, key, default=MANIFEST_NULL_KEY):
""" Returns the value if it exist, or default if default is set """
if not self.manifest.has_option(section, key) and default is not MANIFEST_NULL_KEY:
return default
return self.manifest.get(section, key) | python | def get(self, section, key, default=MANIFEST_NULL_KEY):
""" Returns the value if it exist, or default if default is set """
if not self.manifest.has_option(section, key) and default is not MANIFEST_NULL_KEY:
return default
return self.manifest.get(section, key) | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"key",
",",
"default",
"=",
"MANIFEST_NULL_KEY",
")",
":",
"if",
"not",
"self",
".",
"manifest",
".",
"has_option",
"(",
"section",
",",
"key",
")",
"and",
"default",
"is",
"not",
"MANIFEST_NULL_KEY",
":",
... | Returns the value if it exist, or default if default is set | [
"Returns",
"the",
"value",
"if",
"it",
"exist",
"or",
"default",
"if",
"default",
"is",
"set"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L212-L216 |
37,559 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.__parse_namespace | def __parse_namespace(self):
"""
Parse the namespace from various sources
"""
if self.manifest.has_option('config', 'namespace'):
return self.manifest.get('config', 'namespace')
elif self.manifest.has_option('config', 'source'):
return NAMESPACE_REGEX.sear... | python | def __parse_namespace(self):
"""
Parse the namespace from various sources
"""
if self.manifest.has_option('config', 'namespace'):
return self.manifest.get('config', 'namespace')
elif self.manifest.has_option('config', 'source'):
return NAMESPACE_REGEX.sear... | [
"def",
"__parse_namespace",
"(",
"self",
")",
":",
"if",
"self",
".",
"manifest",
".",
"has_option",
"(",
"'config'",
",",
"'namespace'",
")",
":",
"return",
"self",
".",
"manifest",
".",
"get",
"(",
"'config'",
",",
"'namespace'",
")",
"elif",
"self",
"... | Parse the namespace from various sources | [
"Parse",
"the",
"namespace",
"from",
"various",
"sources"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L218-L228 |
37,560 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.__generate_dependency_tree | def __generate_dependency_tree(self):
"""
Generate the dependency tree object
"""
dependency_dict = {}
for s in self.manifest.sections():
if s != "config":
if self.manifest.has_option(s, 'depends'):
dependency_list = [d.strip() for ... | python | def __generate_dependency_tree(self):
"""
Generate the dependency tree object
"""
dependency_dict = {}
for s in self.manifest.sections():
if s != "config":
if self.manifest.has_option(s, 'depends'):
dependency_list = [d.strip() for ... | [
"def",
"__generate_dependency_tree",
"(",
"self",
")",
":",
"dependency_dict",
"=",
"{",
"}",
"for",
"s",
"in",
"self",
".",
"manifest",
".",
"sections",
"(",
")",
":",
"if",
"s",
"!=",
"\"config\"",
":",
"if",
"self",
".",
"manifest",
".",
"has_option",... | Generate the dependency tree object | [
"Generate",
"the",
"dependency",
"tree",
"object"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L230-L246 |
37,561 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.__substitute_objects | def __substitute_objects(self, value, context_dict):
"""
recursively substitute value with the context_dict
"""
if type(value) == dict:
return dict([(k, self.__substitute_objects(v, context_dict)) for k, v in value.items()])
elif type(value) == str:
try:
... | python | def __substitute_objects(self, value, context_dict):
"""
recursively substitute value with the context_dict
"""
if type(value) == dict:
return dict([(k, self.__substitute_objects(v, context_dict)) for k, v in value.items()])
elif type(value) == str:
try:
... | [
"def",
"__substitute_objects",
"(",
"self",
",",
"value",
",",
"context_dict",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"dict",
":",
"return",
"dict",
"(",
"[",
"(",
"k",
",",
"self",
".",
"__substitute_objects",
"(",
"v",
",",
"context_dict",
... | recursively substitute value with the context_dict | [
"recursively",
"substitute",
"value",
"with",
"the",
"context_dict"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L248-L262 |
37,562 | toumorokoshi/sprinter | sprinter/core/manifest.py | Manifest.__setup_inputs | def __setup_inputs(self):
""" Setup the inputs object """
input_object = Inputs()
# populate input schemas
for s in self.manifest.sections():
if self.has_option(s, 'inputs'):
input_object.add_inputs_from_inputstring(self.get(s, 'inputs'))
# add in valu... | python | def __setup_inputs(self):
""" Setup the inputs object """
input_object = Inputs()
# populate input schemas
for s in self.manifest.sections():
if self.has_option(s, 'inputs'):
input_object.add_inputs_from_inputstring(self.get(s, 'inputs'))
# add in valu... | [
"def",
"__setup_inputs",
"(",
"self",
")",
":",
"input_object",
"=",
"Inputs",
"(",
")",
"# populate input schemas",
"for",
"s",
"in",
"self",
".",
"manifest",
".",
"sections",
"(",
")",
":",
"if",
"self",
".",
"has_option",
"(",
"s",
",",
"'inputs'",
")... | Setup the inputs object | [
"Setup",
"the",
"inputs",
"object"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/manifest.py#L264-L275 |
37,563 | toumorokoshi/sprinter | sprinter/formula/base.py | FormulaBase.should_run | def should_run(self):
""" Returns true if the feature should run """
should_run = True
config = self.target or self.source
if config.has('systems'):
should_run = False
valid_systems = [s.lower() for s in config.get('systems').split(",")]
for system_typ... | python | def should_run(self):
""" Returns true if the feature should run """
should_run = True
config = self.target or self.source
if config.has('systems'):
should_run = False
valid_systems = [s.lower() for s in config.get('systems').split(",")]
for system_typ... | [
"def",
"should_run",
"(",
"self",
")",
":",
"should_run",
"=",
"True",
"config",
"=",
"self",
".",
"target",
"or",
"self",
".",
"source",
"if",
"config",
".",
"has",
"(",
"'systems'",
")",
":",
"should_run",
"=",
"False",
"valid_systems",
"=",
"[",
"s"... | Returns true if the feature should run | [
"Returns",
"true",
"if",
"the",
"feature",
"should",
"run"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/formula/base.py#L166-L177 |
37,564 | toumorokoshi/sprinter | sprinter/formula/base.py | FormulaBase.resolve | def resolve(self):
""" Resolve differences between the target and the source configuration """
if self.source and self.target:
for key in self.source.keys():
if (key not in self.dont_carry_over_options
and not self.target.has(key)):
... | python | def resolve(self):
""" Resolve differences between the target and the source configuration """
if self.source and self.target:
for key in self.source.keys():
if (key not in self.dont_carry_over_options
and not self.target.has(key)):
... | [
"def",
"resolve",
"(",
"self",
")",
":",
"if",
"self",
".",
"source",
"and",
"self",
".",
"target",
":",
"for",
"key",
"in",
"self",
".",
"source",
".",
"keys",
"(",
")",
":",
"if",
"(",
"key",
"not",
"in",
"self",
".",
"dont_carry_over_options",
"... | Resolve differences between the target and the source configuration | [
"Resolve",
"differences",
"between",
"the",
"target",
"and",
"the",
"source",
"configuration"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/formula/base.py#L179-L185 |
37,565 | toumorokoshi/sprinter | sprinter/formula/base.py | FormulaBase._log_error | def _log_error(self, message):
""" Log an error for the feature """
key = (self.feature_name, self.target.get('formula'))
self.environment.log_feature_error(key, "ERROR: " + message) | python | def _log_error(self, message):
""" Log an error for the feature """
key = (self.feature_name, self.target.get('formula'))
self.environment.log_feature_error(key, "ERROR: " + message) | [
"def",
"_log_error",
"(",
"self",
",",
"message",
")",
":",
"key",
"=",
"(",
"self",
".",
"feature_name",
",",
"self",
".",
"target",
".",
"get",
"(",
"'formula'",
")",
")",
"self",
".",
"environment",
".",
"log_feature_error",
"(",
"key",
",",
"\"ERRO... | Log an error for the feature | [
"Log",
"an",
"error",
"for",
"the",
"feature"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/formula/base.py#L187-L190 |
37,566 | frascoweb/frasco | frasco/templating/extensions.py | jinja_fragment_extension | def jinja_fragment_extension(tag, endtag=None, name=None, tag_only=False, allow_args=True, callblock_args=None):
"""Decorator to easily create a jinja extension which acts as a fragment.
"""
if endtag is None:
endtag = "end" + tag
def decorator(f):
def parse(self, parser):
l... | python | def jinja_fragment_extension(tag, endtag=None, name=None, tag_only=False, allow_args=True, callblock_args=None):
"""Decorator to easily create a jinja extension which acts as a fragment.
"""
if endtag is None:
endtag = "end" + tag
def decorator(f):
def parse(self, parser):
l... | [
"def",
"jinja_fragment_extension",
"(",
"tag",
",",
"endtag",
"=",
"None",
",",
"name",
"=",
"None",
",",
"tag_only",
"=",
"False",
",",
"allow_args",
"=",
"True",
",",
"callblock_args",
"=",
"None",
")",
":",
"if",
"endtag",
"is",
"None",
":",
"endtag",... | Decorator to easily create a jinja extension which acts as a fragment. | [
"Decorator",
"to",
"easily",
"create",
"a",
"jinja",
"extension",
"which",
"acts",
"as",
"a",
"fragment",
"."
] | ea519d69dd5ca6deaf3650175692ee4a1a02518f | https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/templating/extensions.py#L36-L68 |
37,567 | frascoweb/frasco | frasco/templating/extensions.py | jinja_block_as_fragment_extension | def jinja_block_as_fragment_extension(name, tagname=None, classname=None):
"""Creates a fragment extension which will just act as a replacement of the
block statement.
"""
if tagname is None:
tagname = name
if classname is None:
classname = "%sBlockFragmentExtension" % name.capitaliz... | python | def jinja_block_as_fragment_extension(name, tagname=None, classname=None):
"""Creates a fragment extension which will just act as a replacement of the
block statement.
"""
if tagname is None:
tagname = name
if classname is None:
classname = "%sBlockFragmentExtension" % name.capitaliz... | [
"def",
"jinja_block_as_fragment_extension",
"(",
"name",
",",
"tagname",
"=",
"None",
",",
"classname",
"=",
"None",
")",
":",
"if",
"tagname",
"is",
"None",
":",
"tagname",
"=",
"name",
"if",
"classname",
"is",
"None",
":",
"classname",
"=",
"\"%sBlockFragm... | Creates a fragment extension which will just act as a replacement of the
block statement. | [
"Creates",
"a",
"fragment",
"extension",
"which",
"will",
"just",
"act",
"as",
"a",
"replacement",
"of",
"the",
"block",
"statement",
"."
] | ea519d69dd5ca6deaf3650175692ee4a1a02518f | https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/templating/extensions.py#L78-L87 |
37,568 | evansde77/dockerstache | src/dockerstache/templates.py | find_copies | def find_copies(input_dir, exclude_list):
"""
find files that are not templates and not
in the exclude_list for copying from template to image
"""
copies = []
def copy_finder(copies, dirname):
for obj in os.listdir(dirname):
pathname = os.path.join(dirname, obj)
... | python | def find_copies(input_dir, exclude_list):
"""
find files that are not templates and not
in the exclude_list for copying from template to image
"""
copies = []
def copy_finder(copies, dirname):
for obj in os.listdir(dirname):
pathname = os.path.join(dirname, obj)
... | [
"def",
"find_copies",
"(",
"input_dir",
",",
"exclude_list",
")",
":",
"copies",
"=",
"[",
"]",
"def",
"copy_finder",
"(",
"copies",
",",
"dirname",
")",
":",
"for",
"obj",
"in",
"os",
".",
"listdir",
"(",
"dirname",
")",
":",
"pathname",
"=",
"os",
... | find files that are not templates and not
in the exclude_list for copying from template to image | [
"find",
"files",
"that",
"are",
"not",
"templates",
"and",
"not",
"in",
"the",
"exclude_list",
"for",
"copying",
"from",
"template",
"to",
"image"
] | 929c102e9fffde322dbf17f8e69533a00976aacb | https://github.com/evansde77/dockerstache/blob/929c102e9fffde322dbf17f8e69533a00976aacb/src/dockerstache/templates.py#L84-L107 |
37,569 | majuss/lupupy | lupupy/__init__.py | Lupusec.get_devices | def get_devices(self, refresh=False, generic_type=None):
"""Get all devices from Lupusec."""
_LOGGER.info("Updating all devices...")
if refresh or self._devices is None:
if self._devices is None:
self._devices = {}
responseObject = self.get_sensors()
... | python | def get_devices(self, refresh=False, generic_type=None):
"""Get all devices from Lupusec."""
_LOGGER.info("Updating all devices...")
if refresh or self._devices is None:
if self._devices is None:
self._devices = {}
responseObject = self.get_sensors()
... | [
"def",
"get_devices",
"(",
"self",
",",
"refresh",
"=",
"False",
",",
"generic_type",
"=",
"None",
")",
":",
"_LOGGER",
".",
"info",
"(",
"\"Updating all devices...\"",
")",
"if",
"refresh",
"or",
"self",
".",
"_devices",
"is",
"None",
":",
"if",
"self",
... | Get all devices from Lupusec. | [
"Get",
"all",
"devices",
"from",
"Lupusec",
"."
] | 71af6c397837ffc393c7b8122be175602638d3c6 | https://github.com/majuss/lupupy/blob/71af6c397837ffc393c7b8122be175602638d3c6/lupupy/__init__.py#L142-L211 |
37,570 | gtaylor/EVE-Market-Data-Structures | emds/formats/unified/history.py | parse_from_dict | def parse_from_dict(json_dict):
"""
Given a Unified Uploader message, parse the contents and return a
MarketHistoryList instance.
:param dict json_dict: A Unified Uploader message as a dict.
:rtype: MarketOrderList
:returns: An instance of MarketOrderList, containing the orders
within.
... | python | def parse_from_dict(json_dict):
"""
Given a Unified Uploader message, parse the contents and return a
MarketHistoryList instance.
:param dict json_dict: A Unified Uploader message as a dict.
:rtype: MarketOrderList
:returns: An instance of MarketOrderList, containing the orders
within.
... | [
"def",
"parse_from_dict",
"(",
"json_dict",
")",
":",
"history_columns",
"=",
"json_dict",
"[",
"'columns'",
"]",
"history_list",
"=",
"MarketHistoryList",
"(",
"upload_keys",
"=",
"json_dict",
"[",
"'uploadKeys'",
"]",
",",
"history_generator",
"=",
"json_dict",
... | Given a Unified Uploader message, parse the contents and return a
MarketHistoryList instance.
:param dict json_dict: A Unified Uploader message as a dict.
:rtype: MarketOrderList
:returns: An instance of MarketOrderList, containing the orders
within. | [
"Given",
"a",
"Unified",
"Uploader",
"message",
"parse",
"the",
"contents",
"and",
"return",
"a",
"MarketHistoryList",
"instance",
"."
] | 77d69b24f2aada3aeff8fba3d75891bfba8fdcf3 | https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/formats/unified/history.py#L30-L67 |
37,571 | gtaylor/EVE-Market-Data-Structures | emds/formats/unified/history.py | encode_to_json | def encode_to_json(history_list):
"""
Encodes this MarketHistoryList instance to a JSON string.
:param MarketHistoryList history_list: The history instance to serialize.
:rtype: str
"""
rowsets = []
for items_in_region_list in history_list._history.values():
region_id = items_in_reg... | python | def encode_to_json(history_list):
"""
Encodes this MarketHistoryList instance to a JSON string.
:param MarketHistoryList history_list: The history instance to serialize.
:rtype: str
"""
rowsets = []
for items_in_region_list in history_list._history.values():
region_id = items_in_reg... | [
"def",
"encode_to_json",
"(",
"history_list",
")",
":",
"rowsets",
"=",
"[",
"]",
"for",
"items_in_region_list",
"in",
"history_list",
".",
"_history",
".",
"values",
"(",
")",
":",
"region_id",
"=",
"items_in_region_list",
".",
"region_id",
"type_id",
"=",
"i... | Encodes this MarketHistoryList instance to a JSON string.
:param MarketHistoryList history_list: The history instance to serialize.
:rtype: str | [
"Encodes",
"this",
"MarketHistoryList",
"instance",
"to",
"a",
"JSON",
"string",
"."
] | 77d69b24f2aada3aeff8fba3d75891bfba8fdcf3 | https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/formats/unified/history.py#L69-L116 |
37,572 | KvasirSecurity/kvasirapi-python | KvasirAPI/config.py | Configuration.load | def load(self, configuration):
"""
Load a YAML configuration file.
:param configuration: Configuration filename or YAML string
"""
try:
self.config = yaml.load(open(configuration, "rb"))
except IOError:
try:
self.config = yaml.load... | python | def load(self, configuration):
"""
Load a YAML configuration file.
:param configuration: Configuration filename or YAML string
"""
try:
self.config = yaml.load(open(configuration, "rb"))
except IOError:
try:
self.config = yaml.load... | [
"def",
"load",
"(",
"self",
",",
"configuration",
")",
":",
"try",
":",
"self",
".",
"config",
"=",
"yaml",
".",
"load",
"(",
"open",
"(",
"configuration",
",",
"\"rb\"",
")",
")",
"except",
"IOError",
":",
"try",
":",
"self",
".",
"config",
"=",
"... | Load a YAML configuration file.
:param configuration: Configuration filename or YAML string | [
"Load",
"a",
"YAML",
"configuration",
"file",
"."
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/config.py#L51-L76 |
37,573 | KvasirSecurity/kvasirapi-python | KvasirAPI/config.py | Configuration.instances | def instances(self, test_type=".*"):
"""
Returns a dict of all instances defined using a regex
:param test_type: Regular expression to match for self.instance['test_type'] value names
"""
import re
data = {}
for k, v in self.instances_dict.iteritems():
... | python | def instances(self, test_type=".*"):
"""
Returns a dict of all instances defined using a regex
:param test_type: Regular expression to match for self.instance['test_type'] value names
"""
import re
data = {}
for k, v in self.instances_dict.iteritems():
... | [
"def",
"instances",
"(",
"self",
",",
"test_type",
"=",
"\".*\"",
")",
":",
"import",
"re",
"data",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"instances_dict",
".",
"iteritems",
"(",
")",
":",
"if",
"re",
".",
"match",
"(",
"test_type... | Returns a dict of all instances defined using a regex
:param test_type: Regular expression to match for self.instance['test_type'] value names | [
"Returns",
"a",
"dict",
"of",
"all",
"instances",
"defined",
"using",
"a",
"regex"
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/config.py#L78-L103 |
37,574 | KvasirSecurity/kvasirapi-python | KvasirAPI/utils.py | none_to_blank | def none_to_blank(s, exchange=''):
"""Replaces NoneType with ''
>>> none_to_blank(None, '')
''
>>> none_to_blank(None)
''
>>> none_to_blank('something', '')
u'something'
>>> none_to_blank(['1', None])
[u'1', '']
:param s: String to replace
:para exchange: Character to retur... | python | def none_to_blank(s, exchange=''):
"""Replaces NoneType with ''
>>> none_to_blank(None, '')
''
>>> none_to_blank(None)
''
>>> none_to_blank('something', '')
u'something'
>>> none_to_blank(['1', None])
[u'1', '']
:param s: String to replace
:para exchange: Character to retur... | [
"def",
"none_to_blank",
"(",
"s",
",",
"exchange",
"=",
"''",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"list",
")",
":",
"return",
"[",
"none_to_blank",
"(",
"z",
")",
"for",
"y",
",",
"z",
"in",
"enumerate",
"(",
"s",
")",
"]",
"return",
"ex... | Replaces NoneType with ''
>>> none_to_blank(None, '')
''
>>> none_to_blank(None)
''
>>> none_to_blank('something', '')
u'something'
>>> none_to_blank(['1', None])
[u'1', '']
:param s: String to replace
:para exchange: Character to return for None, default is blank ('')
:ret... | [
"Replaces",
"NoneType",
"with"
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/utils.py#L24-L42 |
37,575 | KvasirSecurity/kvasirapi-python | KvasirAPI/utils.py | make_good_url | def make_good_url(url=None, addition="/"):
"""Appends addition to url, ensuring the right number of slashes
exist and the path doesn't get clobbered.
>>> make_good_url('http://www.server.com/anywhere', 'else')
'http://www.server.com/anywhere/else'
>>> make_good_url('http://test.com/', '/somewhere/o... | python | def make_good_url(url=None, addition="/"):
"""Appends addition to url, ensuring the right number of slashes
exist and the path doesn't get clobbered.
>>> make_good_url('http://www.server.com/anywhere', 'else')
'http://www.server.com/anywhere/else'
>>> make_good_url('http://test.com/', '/somewhere/o... | [
"def",
"make_good_url",
"(",
"url",
"=",
"None",
",",
"addition",
"=",
"\"/\"",
")",
":",
"if",
"url",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"url",
",",
"str",
")",
"and",
"isinstance",
"(",
"addition",
",",
"str",
")",
":",
... | Appends addition to url, ensuring the right number of slashes
exist and the path doesn't get clobbered.
>>> make_good_url('http://www.server.com/anywhere', 'else')
'http://www.server.com/anywhere/else'
>>> make_good_url('http://test.com/', '/somewhere/over/the/rainbow/')
'http://test.com/somewhere/... | [
"Appends",
"addition",
"to",
"url",
"ensuring",
"the",
"right",
"number",
"of",
"slashes",
"exist",
"and",
"the",
"path",
"doesn",
"t",
"get",
"clobbered",
"."
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/utils.py#L47-L71 |
37,576 | KvasirSecurity/kvasirapi-python | KvasirAPI/utils.py | build_kvasir_url | def build_kvasir_url(
proto="https", server="localhost", port="8443",
base="Kvasir", user="test", password="test",
path=KVASIR_JSONRPC_PATH):
"""
Creates a full URL to reach Kvasir given specific data
>>> build_kvasir_url('https', 'localhost', '8443', 'Kvasir', 'test', 'test')
'... | python | def build_kvasir_url(
proto="https", server="localhost", port="8443",
base="Kvasir", user="test", password="test",
path=KVASIR_JSONRPC_PATH):
"""
Creates a full URL to reach Kvasir given specific data
>>> build_kvasir_url('https', 'localhost', '8443', 'Kvasir', 'test', 'test')
'... | [
"def",
"build_kvasir_url",
"(",
"proto",
"=",
"\"https\"",
",",
"server",
"=",
"\"localhost\"",
",",
"port",
"=",
"\"8443\"",
",",
"base",
"=",
"\"Kvasir\"",
",",
"user",
"=",
"\"test\"",
",",
"password",
"=",
"\"test\"",
",",
"path",
"=",
"KVASIR_JSONRPC_PA... | Creates a full URL to reach Kvasir given specific data
>>> build_kvasir_url('https', 'localhost', '8443', 'Kvasir', 'test', 'test')
'https://test@test/localhost:8443/Kvasir/api/call/jsonrpc'
>>> build_kvasir_url()
'https://test@test/localhost:8443/Kvasir/api/call/jsonrpc'
>>> build_kvasir_url(serve... | [
"Creates",
"a",
"full",
"URL",
"to",
"reach",
"Kvasir",
"given",
"specific",
"data"
] | ec8c5818bd5913f3afd150f25eaec6e7cc732f4c | https://github.com/KvasirSecurity/kvasirapi-python/blob/ec8c5818bd5913f3afd150f25eaec6e7cc732f4c/KvasirAPI/utils.py#L76-L100 |
37,577 | evansde77/dockerstache | setup.py | get_default | def get_default(parser, section, option, default):
"""helper to get config settings with a default if not present"""
try:
result = parser.get(section, option)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
result = default
return result | python | def get_default(parser, section, option, default):
"""helper to get config settings with a default if not present"""
try:
result = parser.get(section, option)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
result = default
return result | [
"def",
"get_default",
"(",
"parser",
",",
"section",
",",
"option",
",",
"default",
")",
":",
"try",
":",
"result",
"=",
"parser",
".",
"get",
"(",
"section",
",",
"option",
")",
"except",
"(",
"ConfigParser",
".",
"NoSectionError",
",",
"ConfigParser",
... | helper to get config settings with a default if not present | [
"helper",
"to",
"get",
"config",
"settings",
"with",
"a",
"default",
"if",
"not",
"present"
] | 929c102e9fffde322dbf17f8e69533a00976aacb | https://github.com/evansde77/dockerstache/blob/929c102e9fffde322dbf17f8e69533a00976aacb/setup.py#L16-L22 |
37,578 | memphis-iis/GLUDB | gludb/config.py | set_db_application_prefix | def set_db_application_prefix(prefix, sep=None):
"""Set the global app prefix and separator."""
global _APPLICATION_PREFIX, _APPLICATION_SEP
_APPLICATION_PREFIX = prefix
if (sep is not None):
_APPLICATION_SEP = sep | python | def set_db_application_prefix(prefix, sep=None):
"""Set the global app prefix and separator."""
global _APPLICATION_PREFIX, _APPLICATION_SEP
_APPLICATION_PREFIX = prefix
if (sep is not None):
_APPLICATION_SEP = sep | [
"def",
"set_db_application_prefix",
"(",
"prefix",
",",
"sep",
"=",
"None",
")",
":",
"global",
"_APPLICATION_PREFIX",
",",
"_APPLICATION_SEP",
"_APPLICATION_PREFIX",
"=",
"prefix",
"if",
"(",
"sep",
"is",
"not",
"None",
")",
":",
"_APPLICATION_SEP",
"=",
"sep"
... | Set the global app prefix and separator. | [
"Set",
"the",
"global",
"app",
"prefix",
"and",
"separator",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/config.py#L173-L178 |
37,579 | memphis-iis/GLUDB | gludb/config.py | Database.find_by_index | def find_by_index(self, cls, index_name, value):
"""Find records matching index query - defer to backend."""
return self.backend.find_by_index(cls, index_name, value) | python | def find_by_index(self, cls, index_name, value):
"""Find records matching index query - defer to backend."""
return self.backend.find_by_index(cls, index_name, value) | [
"def",
"find_by_index",
"(",
"self",
",",
"cls",
",",
"index_name",
",",
"value",
")",
":",
"return",
"self",
".",
"backend",
".",
"find_by_index",
"(",
"cls",
",",
"index_name",
",",
"value",
")"
] | Find records matching index query - defer to backend. | [
"Find",
"records",
"matching",
"index",
"query",
"-",
"defer",
"to",
"backend",
"."
] | 25692528ff6fe8184a3570f61f31f1a90088a388 | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/config.py#L80-L82 |
37,580 | unixorn/logrus | logrus/time.py | humanTime | def humanTime(seconds):
'''
Convert seconds to something more human-friendly
'''
intervals = ['days', 'hours', 'minutes', 'seconds']
x = deltaTime(seconds=seconds)
return ' '.join('{} {}'.format(getattr(x, k), k) for k in intervals if getattr(x, k)) | python | def humanTime(seconds):
'''
Convert seconds to something more human-friendly
'''
intervals = ['days', 'hours', 'minutes', 'seconds']
x = deltaTime(seconds=seconds)
return ' '.join('{} {}'.format(getattr(x, k), k) for k in intervals if getattr(x, k)) | [
"def",
"humanTime",
"(",
"seconds",
")",
":",
"intervals",
"=",
"[",
"'days'",
",",
"'hours'",
",",
"'minutes'",
",",
"'seconds'",
"]",
"x",
"=",
"deltaTime",
"(",
"seconds",
"=",
"seconds",
")",
"return",
"' '",
".",
"join",
"(",
"'{} {}'",
".",
"form... | Convert seconds to something more human-friendly | [
"Convert",
"seconds",
"to",
"something",
"more",
"human",
"-",
"friendly"
] | d1af28639fd42968acc257476d526d9bbe57719f | https://github.com/unixorn/logrus/blob/d1af28639fd42968acc257476d526d9bbe57719f/logrus/time.py#L23-L29 |
37,581 | unixorn/logrus | logrus/time.py | humanTimeConverter | def humanTimeConverter():
'''
Cope whether we're passed a time in seconds on the command line or via stdin
'''
if len(sys.argv) == 2:
print humanFriendlyTime(seconds=int(sys.argv[1]))
else:
for line in sys.stdin:
print humanFriendlyTime(int(line))
sys.exit(0) | python | def humanTimeConverter():
'''
Cope whether we're passed a time in seconds on the command line or via stdin
'''
if len(sys.argv) == 2:
print humanFriendlyTime(seconds=int(sys.argv[1]))
else:
for line in sys.stdin:
print humanFriendlyTime(int(line))
sys.exit(0) | [
"def",
"humanTimeConverter",
"(",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
"==",
"2",
":",
"print",
"humanFriendlyTime",
"(",
"seconds",
"=",
"int",
"(",
"sys",
".",
"argv",
"[",
"1",
"]",
")",
")",
"else",
":",
"for",
"line",
"in",
"... | Cope whether we're passed a time in seconds on the command line or via stdin | [
"Cope",
"whether",
"we",
"re",
"passed",
"a",
"time",
"in",
"seconds",
"on",
"the",
"command",
"line",
"or",
"via",
"stdin"
] | d1af28639fd42968acc257476d526d9bbe57719f | https://github.com/unixorn/logrus/blob/d1af28639fd42968acc257476d526d9bbe57719f/logrus/time.py#L32-L41 |
37,582 | VikParuchuri/percept | percept/tasks/preprocess.py | Normalize.train | def train(self, data, **kwargs):
"""
Calculate the standard deviations and means in the training data
"""
self.data = data
for i in xrange(0,data.shape[1]):
column_mean = np.mean(data.icol(i))
column_stdev = np.std(data.icol(i))
#Have to do +=... | python | def train(self, data, **kwargs):
"""
Calculate the standard deviations and means in the training data
"""
self.data = data
for i in xrange(0,data.shape[1]):
column_mean = np.mean(data.icol(i))
column_stdev = np.std(data.icol(i))
#Have to do +=... | [
"def",
"train",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"data",
"=",
"data",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"data",
".",
"shape",
"[",
"1",
"]",
")",
":",
"column_mean",
"=",
"np",
".",
"mean",
"(... | Calculate the standard deviations and means in the training data | [
"Calculate",
"the",
"standard",
"deviations",
"and",
"means",
"in",
"the",
"training",
"data"
] | 90304ba82053e2a9ad2bacaab3479403d3923bcf | https://github.com/VikParuchuri/percept/blob/90304ba82053e2a9ad2bacaab3479403d3923bcf/percept/tasks/preprocess.py#L31-L44 |
37,583 | VikParuchuri/percept | percept/tasks/preprocess.py | Normalize.predict | def predict(self, test_data, **kwargs):
"""
Adjust new input by the values in the training data
"""
if test_data.shape[1]!=self.data.shape[1]:
raise Exception("Test data has different number of columns than training data.")
for i in xrange(0,test_data.shape[1]):
... | python | def predict(self, test_data, **kwargs):
"""
Adjust new input by the values in the training data
"""
if test_data.shape[1]!=self.data.shape[1]:
raise Exception("Test data has different number of columns than training data.")
for i in xrange(0,test_data.shape[1]):
... | [
"def",
"predict",
"(",
"self",
",",
"test_data",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"test_data",
".",
"shape",
"[",
"1",
"]",
"!=",
"self",
".",
"data",
".",
"shape",
"[",
"1",
"]",
":",
"raise",
"Exception",
"(",
"\"Test data has different numbe... | Adjust new input by the values in the training data | [
"Adjust",
"new",
"input",
"by",
"the",
"values",
"in",
"the",
"training",
"data"
] | 90304ba82053e2a9ad2bacaab3479403d3923bcf | https://github.com/VikParuchuri/percept/blob/90304ba82053e2a9ad2bacaab3479403d3923bcf/percept/tasks/preprocess.py#L46-L56 |
37,584 | frascoweb/frasco | frasco/actions/decorators.py | action_decorator | def action_decorator(name):
"""Decorator to register an action decorator
"""
def decorator(cls):
action_decorators.append((name, cls))
return cls
return decorator | python | def action_decorator(name):
"""Decorator to register an action decorator
"""
def decorator(cls):
action_decorators.append((name, cls))
return cls
return decorator | [
"def",
"action_decorator",
"(",
"name",
")",
":",
"def",
"decorator",
"(",
"cls",
")",
":",
"action_decorators",
".",
"append",
"(",
"(",
"name",
",",
"cls",
")",
")",
"return",
"cls",
"return",
"decorator"
] | Decorator to register an action decorator | [
"Decorator",
"to",
"register",
"an",
"action",
"decorator"
] | ea519d69dd5ca6deaf3650175692ee4a1a02518f | https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/actions/decorators.py#L10-L16 |
37,585 | toumorokoshi/sprinter | sprinter/core/globals.py | load_global_config | def load_global_config(config_path):
""" Load a global configuration object, and query for any required variables along the way """
config = configparser.RawConfigParser()
if os.path.exists(config_path):
logger.debug("Checking and setting global parameters...")
config.read(config_path)
e... | python | def load_global_config(config_path):
""" Load a global configuration object, and query for any required variables along the way """
config = configparser.RawConfigParser()
if os.path.exists(config_path):
logger.debug("Checking and setting global parameters...")
config.read(config_path)
e... | [
"def",
"load_global_config",
"(",
"config_path",
")",
":",
"config",
"=",
"configparser",
".",
"RawConfigParser",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"config_path",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking and setting global paramete... | Load a global configuration object, and query for any required variables along the way | [
"Load",
"a",
"global",
"configuration",
"object",
"and",
"query",
"for",
"any",
"required",
"variables",
"along",
"the",
"way"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L34-L53 |
37,586 | toumorokoshi/sprinter | sprinter/core/globals.py | print_global_config | def print_global_config(global_config):
""" print the global configuration """
if global_config.has_section('shell'):
print("\nShell configurations:")
for shell_type, set_value in global_config.items('shell'):
print("{0}: {1}".format(shell_type, set_value))
if global_config.has_... | python | def print_global_config(global_config):
""" print the global configuration """
if global_config.has_section('shell'):
print("\nShell configurations:")
for shell_type, set_value in global_config.items('shell'):
print("{0}: {1}".format(shell_type, set_value))
if global_config.has_... | [
"def",
"print_global_config",
"(",
"global_config",
")",
":",
"if",
"global_config",
".",
"has_section",
"(",
"'shell'",
")",
":",
"print",
"(",
"\"\\nShell configurations:\"",
")",
"for",
"shell_type",
",",
"set_value",
"in",
"global_config",
".",
"items",
"(",
... | print the global configuration | [
"print",
"the",
"global",
"configuration"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L73-L82 |
37,587 | toumorokoshi/sprinter | sprinter/core/globals.py | create_default_config | def create_default_config():
""" Create a default configuration object, with all parameters filled """
config = configparser.RawConfigParser()
config.add_section('global')
config.set('global', 'env_source_rc', False)
config.add_section('shell')
config.set('shell', 'bash', "true")
config.set(... | python | def create_default_config():
""" Create a default configuration object, with all parameters filled """
config = configparser.RawConfigParser()
config.add_section('global')
config.set('global', 'env_source_rc', False)
config.add_section('shell')
config.set('shell', 'bash', "true")
config.set(... | [
"def",
"create_default_config",
"(",
")",
":",
"config",
"=",
"configparser",
".",
"RawConfigParser",
"(",
")",
"config",
".",
"add_section",
"(",
"'global'",
")",
"config",
".",
"set",
"(",
"'global'",
",",
"'env_source_rc'",
",",
"False",
")",
"config",
".... | Create a default configuration object, with all parameters filled | [
"Create",
"a",
"default",
"configuration",
"object",
"with",
"all",
"parameters",
"filled"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L85-L94 |
37,588 | toumorokoshi/sprinter | sprinter/core/globals.py | _initial_run | def _initial_run():
""" Check things during the initial setting of sprinter's global config """
if not system.is_officially_supported():
logger.warn(warning_template
+ "===========================================================\n"
+ "Sprinter is not officially su... | python | def _initial_run():
""" Check things during the initial setting of sprinter's global config """
if not system.is_officially_supported():
logger.warn(warning_template
+ "===========================================================\n"
+ "Sprinter is not officially su... | [
"def",
"_initial_run",
"(",
")",
":",
"if",
"not",
"system",
".",
"is_officially_supported",
"(",
")",
":",
"logger",
".",
"warn",
"(",
"warning_template",
"+",
"\"===========================================================\\n\"",
"+",
"\"Sprinter is not officially supporte... | Check things during the initial setting of sprinter's global config | [
"Check",
"things",
"during",
"the",
"initial",
"setting",
"of",
"sprinter",
"s",
"global",
"config"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L97-L114 |
37,589 | toumorokoshi/sprinter | sprinter/core/globals.py | _configure_shell | def _configure_shell(config):
""" Checks and queries values for the shell """
config.has_section('shell') or config.add_section('shell')
logger.info(
"What shells or environments would you like sprinter to work with?\n"
"(Sprinter will not try to inject into environments not specified here.)... | python | def _configure_shell(config):
""" Checks and queries values for the shell """
config.has_section('shell') or config.add_section('shell')
logger.info(
"What shells or environments would you like sprinter to work with?\n"
"(Sprinter will not try to inject into environments not specified here.)... | [
"def",
"_configure_shell",
"(",
"config",
")",
":",
"config",
".",
"has_section",
"(",
"'shell'",
")",
"or",
"config",
".",
"add_section",
"(",
"'shell'",
")",
"logger",
".",
"info",
"(",
"\"What shells or environments would you like sprinter to work with?\\n\"",
"\"(... | Checks and queries values for the shell | [
"Checks",
"and",
"queries",
"values",
"for",
"the",
"shell"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L117-L135 |
37,590 | toumorokoshi/sprinter | sprinter/core/globals.py | _configure_env_source_rc | def _configure_env_source_rc(config):
""" Configures wether to have .env source .rc """
config.set('global', 'env_source_rc', False)
if system.is_osx():
logger.info("On OSX, login shells are default, which only source sprinter's 'env' configuration.")
logger.info("I.E. environment variables ... | python | def _configure_env_source_rc(config):
""" Configures wether to have .env source .rc """
config.set('global', 'env_source_rc', False)
if system.is_osx():
logger.info("On OSX, login shells are default, which only source sprinter's 'env' configuration.")
logger.info("I.E. environment variables ... | [
"def",
"_configure_env_source_rc",
"(",
"config",
")",
":",
"config",
".",
"set",
"(",
"'global'",
",",
"'env_source_rc'",
",",
"False",
")",
"if",
"system",
".",
"is_osx",
"(",
")",
":",
"logger",
".",
"info",
"(",
"\"On OSX, login shells are default, which onl... | Configures wether to have .env source .rc | [
"Configures",
"wether",
"to",
"have",
".",
"env",
"source",
".",
"rc"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/core/globals.py#L138-L149 |
37,591 | liam-middlebrook/csh_ldap | csh_ldap/group.py | CSHGroup.get_members | def get_members(self):
"""Return all members in the group as CSHMember objects"""
res = self.__con__.search_s(
self.__ldap_base_dn__,
ldap.SCOPE_SUBTREE,
"(memberof=%s)" % self.__dn__,
['uid'])
ret = []
for val in res:
... | python | def get_members(self):
"""Return all members in the group as CSHMember objects"""
res = self.__con__.search_s(
self.__ldap_base_dn__,
ldap.SCOPE_SUBTREE,
"(memberof=%s)" % self.__dn__,
['uid'])
ret = []
for val in res:
... | [
"def",
"get_members",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"__con__",
".",
"search_s",
"(",
"self",
".",
"__ldap_base_dn__",
",",
"ldap",
".",
"SCOPE_SUBTREE",
",",
"\"(memberof=%s)\"",
"%",
"self",
".",
"__dn__",
",",
"[",
"'uid'",
"]",
")",
... | Return all members in the group as CSHMember objects | [
"Return",
"all",
"members",
"in",
"the",
"group",
"as",
"CSHMember",
"objects"
] | 90bd334a20e13c03af07bce4f104ad96baf620e4 | https://github.com/liam-middlebrook/csh_ldap/blob/90bd334a20e13c03af07bce4f104ad96baf620e4/csh_ldap/group.py#L30-L51 |
37,592 | liam-middlebrook/csh_ldap | csh_ldap/group.py | CSHGroup.check_member | def check_member(self, member, dn=False):
"""Check if a Member is in the bound group.
Arguments:
member -- the CSHMember object (or distinguished name) of the member to
check against
Keyword arguments:
dn -- whether or not member is a distinguished name
... | python | def check_member(self, member, dn=False):
"""Check if a Member is in the bound group.
Arguments:
member -- the CSHMember object (or distinguished name) of the member to
check against
Keyword arguments:
dn -- whether or not member is a distinguished name
... | [
"def",
"check_member",
"(",
"self",
",",
"member",
",",
"dn",
"=",
"False",
")",
":",
"if",
"dn",
":",
"res",
"=",
"self",
".",
"__con__",
".",
"search_s",
"(",
"self",
".",
"__dn__",
",",
"ldap",
".",
"SCOPE_BASE",
",",
"\"(member=%s)\"",
"%",
"dn",... | Check if a Member is in the bound group.
Arguments:
member -- the CSHMember object (or distinguished name) of the member to
check against
Keyword arguments:
dn -- whether or not member is a distinguished name | [
"Check",
"if",
"a",
"Member",
"is",
"in",
"the",
"bound",
"group",
"."
] | 90bd334a20e13c03af07bce4f104ad96baf620e4 | https://github.com/liam-middlebrook/csh_ldap/blob/90bd334a20e13c03af07bce4f104ad96baf620e4/csh_ldap/group.py#L53-L76 |
37,593 | liam-middlebrook/csh_ldap | csh_ldap/group.py | CSHGroup.add_member | def add_member(self, member, dn=False):
"""Add a member to the bound group
Arguments:
member -- the CSHMember object (or distinguished name) of the member
Keyword arguments:
dn -- whether or not member is a distinguished name
"""
if dn:
if self.chec... | python | def add_member(self, member, dn=False):
"""Add a member to the bound group
Arguments:
member -- the CSHMember object (or distinguished name) of the member
Keyword arguments:
dn -- whether or not member is a distinguished name
"""
if dn:
if self.chec... | [
"def",
"add_member",
"(",
"self",
",",
"member",
",",
"dn",
"=",
"False",
")",
":",
"if",
"dn",
":",
"if",
"self",
".",
"check_member",
"(",
"member",
",",
"dn",
"=",
"True",
")",
":",
"return",
"mod",
"=",
"(",
"ldap",
".",
"MOD_ADD",
",",
"'mem... | Add a member to the bound group
Arguments:
member -- the CSHMember object (or distinguished name) of the member
Keyword arguments:
dn -- whether or not member is a distinguished name | [
"Add",
"a",
"member",
"to",
"the",
"bound",
"group"
] | 90bd334a20e13c03af07bce4f104ad96baf620e4 | https://github.com/liam-middlebrook/csh_ldap/blob/90bd334a20e13c03af07bce4f104ad96baf620e4/csh_ldap/group.py#L78-L103 |
37,594 | smarie/python-parsyfiles | parsyfiles/plugins_optional/support_for_yaml.py | read_object_from_yaml | def read_object_from_yaml(desired_type: Type[Any], file_object: TextIOBase, logger: Logger,
fix_imports: bool = True, errors: str = 'strict', *args, **kwargs) -> Any:
"""
Parses a yaml file.
:param desired_type:
:param file_object:
:param logger:
:param fix_imports:
... | python | def read_object_from_yaml(desired_type: Type[Any], file_object: TextIOBase, logger: Logger,
fix_imports: bool = True, errors: str = 'strict', *args, **kwargs) -> Any:
"""
Parses a yaml file.
:param desired_type:
:param file_object:
:param logger:
:param fix_imports:
... | [
"def",
"read_object_from_yaml",
"(",
"desired_type",
":",
"Type",
"[",
"Any",
"]",
",",
"file_object",
":",
"TextIOBase",
",",
"logger",
":",
"Logger",
",",
"fix_imports",
":",
"bool",
"=",
"True",
",",
"errors",
":",
"str",
"=",
"'strict'",
",",
"*",
"a... | Parses a yaml file.
:param desired_type:
:param file_object:
:param logger:
:param fix_imports:
:param errors:
:param args:
:param kwargs:
:return: | [
"Parses",
"a",
"yaml",
"file",
"."
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_yaml.py#L12-L26 |
37,595 | smarie/python-parsyfiles | parsyfiles/plugins_optional/support_for_yaml.py | read_collection_from_yaml | def read_collection_from_yaml(desired_type: Type[Any], file_object: TextIOBase, logger: Logger,
conversion_finder: ConversionFinder, fix_imports: bool = True, errors: str = 'strict',
**kwargs) -> Any:
"""
Parses a collection from a yaml file.
:par... | python | def read_collection_from_yaml(desired_type: Type[Any], file_object: TextIOBase, logger: Logger,
conversion_finder: ConversionFinder, fix_imports: bool = True, errors: str = 'strict',
**kwargs) -> Any:
"""
Parses a collection from a yaml file.
:par... | [
"def",
"read_collection_from_yaml",
"(",
"desired_type",
":",
"Type",
"[",
"Any",
"]",
",",
"file_object",
":",
"TextIOBase",
",",
"logger",
":",
"Logger",
",",
"conversion_finder",
":",
"ConversionFinder",
",",
"fix_imports",
":",
"bool",
"=",
"True",
",",
"e... | Parses a collection from a yaml file.
:param desired_type:
:param file_object:
:param logger:
:param fix_imports:
:param errors:
:param args:
:param kwargs:
:return: | [
"Parses",
"a",
"collection",
"from",
"a",
"yaml",
"file",
"."
] | 344b37e1151e8d4e7c2ee49ae09d6568715ae64e | https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_yaml.py#L29-L48 |
37,596 | frascoweb/frasco | frasco/features.py | pass_feature | def pass_feature(*feature_names):
"""Injects a feature instance into the kwargs
"""
def decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
for name in feature_names:
kwargs[name] = feature_proxy(name)
return f(*args, **kwargs)
retu... | python | def pass_feature(*feature_names):
"""Injects a feature instance into the kwargs
"""
def decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
for name in feature_names:
kwargs[name] = feature_proxy(name)
return f(*args, **kwargs)
retu... | [
"def",
"pass_feature",
"(",
"*",
"feature_names",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
"in",
"feature_... | Injects a feature instance into the kwargs | [
"Injects",
"a",
"feature",
"instance",
"into",
"the",
"kwargs"
] | ea519d69dd5ca6deaf3650175692ee4a1a02518f | https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/features.py#L205-L215 |
37,597 | toumorokoshi/sprinter | sprinter/lib/extract.py | extract_tar | def extract_tar(url, target_dir, additional_compression="", remove_common_prefix=False, overwrite=False):
""" extract a targz and install to the target directory """
try:
if not os.path.exists(target_dir):
os.makedirs(target_dir)
tf = tarfile.TarFile.open(fileobj=download_to_bytesio(... | python | def extract_tar(url, target_dir, additional_compression="", remove_common_prefix=False, overwrite=False):
""" extract a targz and install to the target directory """
try:
if not os.path.exists(target_dir):
os.makedirs(target_dir)
tf = tarfile.TarFile.open(fileobj=download_to_bytesio(... | [
"def",
"extract_tar",
"(",
"url",
",",
"target_dir",
",",
"additional_compression",
"=",
"\"\"",
",",
"remove_common_prefix",
"=",
"False",
",",
"overwrite",
"=",
"False",
")",
":",
"try",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"target_di... | extract a targz and install to the target directory | [
"extract",
"a",
"targz",
"and",
"install",
"to",
"the",
"target",
"directory"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/extract.py#L23-L50 |
37,598 | toumorokoshi/sprinter | sprinter/lib/extract.py | remove_path | def remove_path(target_path):
""" Delete the target path """
if os.path.isdir(target_path):
shutil.rmtree(target_path)
else:
os.unlink(target_path) | python | def remove_path(target_path):
""" Delete the target path """
if os.path.isdir(target_path):
shutil.rmtree(target_path)
else:
os.unlink(target_path) | [
"def",
"remove_path",
"(",
"target_path",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"target_path",
")",
":",
"shutil",
".",
"rmtree",
"(",
"target_path",
")",
"else",
":",
"os",
".",
"unlink",
"(",
"target_path",
")"
] | Delete the target path | [
"Delete",
"the",
"target",
"path"
] | 846697a7a087e69c61d075232e754d6975a64152 | https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/lib/extract.py#L112-L117 |
37,599 | VikParuchuri/percept | percept/workflows/datastores.py | BaseStore.save | def save(self, obj, id_code):
"""
Save an object, and use id_code in the filename
obj - any object
id_code - unique identifier
"""
filestream = open('{0}/{1}'.format(self.data_path, id_code), 'w+')
pickle.dump(obj, filestream)
filestream.close() | python | def save(self, obj, id_code):
"""
Save an object, and use id_code in the filename
obj - any object
id_code - unique identifier
"""
filestream = open('{0}/{1}'.format(self.data_path, id_code), 'w+')
pickle.dump(obj, filestream)
filestream.close() | [
"def",
"save",
"(",
"self",
",",
"obj",
",",
"id_code",
")",
":",
"filestream",
"=",
"open",
"(",
"'{0}/{1}'",
".",
"format",
"(",
"self",
".",
"data_path",
",",
"id_code",
")",
",",
"'w+'",
")",
"pickle",
".",
"dump",
"(",
"obj",
",",
"filestream",
... | Save an object, and use id_code in the filename
obj - any object
id_code - unique identifier | [
"Save",
"an",
"object",
"and",
"use",
"id_code",
"in",
"the",
"filename",
"obj",
"-",
"any",
"object",
"id_code",
"-",
"unique",
"identifier"
] | 90304ba82053e2a9ad2bacaab3479403d3923bcf | https://github.com/VikParuchuri/percept/blob/90304ba82053e2a9ad2bacaab3479403d3923bcf/percept/workflows/datastores.py#L19-L27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.