repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
lsst-sqre/documenteer
documenteer/sphinxext/utils.py
make_python_xref_nodes
def make_python_xref_nodes(py_typestr, state, hide_namespace=False): """Make docutils nodes containing a cross-reference to a Python object. Parameters ---------- py_typestr : `str` Name of the Python object. For example ``'mypackage.mymodule.MyClass'``. If you have the object itself, o...
python
def make_python_xref_nodes(py_typestr, state, hide_namespace=False): """Make docutils nodes containing a cross-reference to a Python object. Parameters ---------- py_typestr : `str` Name of the Python object. For example ``'mypackage.mymodule.MyClass'``. If you have the object itself, o...
[ "def", "make_python_xref_nodes", "(", "py_typestr", ",", "state", ",", "hide_namespace", "=", "False", ")", ":", "if", "hide_namespace", ":", "template", "=", "':py:obj:`~{}`\\n'", "else", ":", "template", "=", "':py:obj:`{}`\\n'", "xref_text", "=", "template", "....
Make docutils nodes containing a cross-reference to a Python object. Parameters ---------- py_typestr : `str` Name of the Python object. For example ``'mypackage.mymodule.MyClass'``. If you have the object itself, or its type, use the `make_python_xref_nodes_for_type` function inste...
[ "Make", "docutils", "nodes", "containing", "a", "cross", "-", "reference", "to", "a", "Python", "object", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/utils.py#L44-L83
train
lsst-sqre/documenteer
documenteer/sphinxext/utils.py
make_python_xref_nodes_for_type
def make_python_xref_nodes_for_type(py_type, state, hide_namespace=False): """Make docutils nodes containing a cross-reference to a Python object, given the object's type. Parameters ---------- py_type : `obj` Type of an object. For example ``mypackage.mymodule.MyClass``. If you hav...
python
def make_python_xref_nodes_for_type(py_type, state, hide_namespace=False): """Make docutils nodes containing a cross-reference to a Python object, given the object's type. Parameters ---------- py_type : `obj` Type of an object. For example ``mypackage.mymodule.MyClass``. If you hav...
[ "def", "make_python_xref_nodes_for_type", "(", "py_type", ",", "state", ",", "hide_namespace", "=", "False", ")", ":", "if", "py_type", ".", "__module__", "==", "'builtins'", ":", "typestr", "=", "py_type", ".", "__name__", "else", ":", "typestr", "=", "'.'", ...
Make docutils nodes containing a cross-reference to a Python object, given the object's type. Parameters ---------- py_type : `obj` Type of an object. For example ``mypackage.mymodule.MyClass``. If you have instance of the type, use ``type(myinstance)``. state : ``docutils.statemach...
[ "Make", "docutils", "nodes", "containing", "a", "cross", "-", "reference", "to", "a", "Python", "object", "given", "the", "object", "s", "type", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/utils.py#L86-L126
train
lsst-sqre/documenteer
documenteer/sphinxext/utils.py
make_section
def make_section(section_id=None, contents=None): """Make a docutils section node. Parameters ---------- section_id : `str` Section identifier, which is appended to both the ``ids`` and ``names`` attributes. contents : `list` of ``docutils.nodes`` List of docutils nodes that...
python
def make_section(section_id=None, contents=None): """Make a docutils section node. Parameters ---------- section_id : `str` Section identifier, which is appended to both the ``ids`` and ``names`` attributes. contents : `list` of ``docutils.nodes`` List of docutils nodes that...
[ "def", "make_section", "(", "section_id", "=", "None", ",", "contents", "=", "None", ")", ":", "section", "=", "nodes", ".", "section", "(", ")", "section", "[", "'ids'", "]", ".", "append", "(", "nodes", ".", "make_id", "(", "section_id", ")", ")", ...
Make a docutils section node. Parameters ---------- section_id : `str` Section identifier, which is appended to both the ``ids`` and ``names`` attributes. contents : `list` of ``docutils.nodes`` List of docutils nodes that are inserted into the section. Returns ------- ...
[ "Make", "a", "docutils", "section", "node", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/utils.py#L129-L150
train
lsst-sqre/documenteer
documenteer/sphinxext/utils.py
split_role_content
def split_role_content(role_rawsource): """Split the ``rawsource`` of a role into standard components. Parameters ---------- role_rawsource : `str` The content of the role: its ``rawsource`` attribute. Returns ------- parts : `dict` Dictionary with keys: ``last_com...
python
def split_role_content(role_rawsource): """Split the ``rawsource`` of a role into standard components. Parameters ---------- role_rawsource : `str` The content of the role: its ``rawsource`` attribute. Returns ------- parts : `dict` Dictionary with keys: ``last_com...
[ "def", "split_role_content", "(", "role_rawsource", ")", ":", "parts", "=", "{", "'last_component'", ":", "False", ",", "'display'", ":", "None", ",", "'ref'", ":", "None", "}", "if", "role_rawsource", ".", "startswith", "(", "'~'", ")", ":", "parts", "[",...
Split the ``rawsource`` of a role into standard components. Parameters ---------- role_rawsource : `str` The content of the role: its ``rawsource`` attribute. Returns ------- parts : `dict` Dictionary with keys: ``last_component`` (`bool`) If `True`, the dis...
[ "Split", "the", "rawsource", "of", "a", "role", "into", "standard", "components", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/utils.py#L156-L212
train
mojaie/chorus
chorus/molutil.py
largest_graph
def largest_graph(mol): """Return a molecule which has largest graph in the compound Passing single molecule object will results as same as molutil.clone """ mol.require("Valence") mol.require("Topology") m = clone(mol) # Avoid modification of original object if m.isolated: for k in...
python
def largest_graph(mol): """Return a molecule which has largest graph in the compound Passing single molecule object will results as same as molutil.clone """ mol.require("Valence") mol.require("Topology") m = clone(mol) # Avoid modification of original object if m.isolated: for k in...
[ "def", "largest_graph", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Valence\"", ")", "mol", ".", "require", "(", "\"Topology\"", ")", "m", "=", "clone", "(", "mol", ")", "if", "m", ".", "isolated", ":", "for", "k", "in", "itertools", ".", ...
Return a molecule which has largest graph in the compound Passing single molecule object will results as same as molutil.clone
[ "Return", "a", "molecule", "which", "has", "largest", "graph", "in", "the", "compound", "Passing", "single", "molecule", "object", "will", "results", "as", "same", "as", "molutil", ".", "clone" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L64-L74
train
mojaie/chorus
chorus/molutil.py
H_donor_count
def H_donor_count(mol): """Hydrogen bond donor count """ mol.require("Valence") return sum(1 for _, a in mol.atoms_iter() if a.H_donor)
python
def H_donor_count(mol): """Hydrogen bond donor count """ mol.require("Valence") return sum(1 for _, a in mol.atoms_iter() if a.H_donor)
[ "def", "H_donor_count", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Valence\"", ")", "return", "sum", "(", "1", "for", "_", ",", "a", "in", "mol", ".", "atoms_iter", "(", ")", "if", "a", ".", "H_donor", ")" ]
Hydrogen bond donor count
[ "Hydrogen", "bond", "donor", "count" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L105-L108
train
mojaie/chorus
chorus/molutil.py
H_acceptor_count
def H_acceptor_count(mol): """Hydrogen bond acceptor count """ mol.require("Valence") return sum(1 for _, a in mol.atoms_iter() if a.H_acceptor)
python
def H_acceptor_count(mol): """Hydrogen bond acceptor count """ mol.require("Valence") return sum(1 for _, a in mol.atoms_iter() if a.H_acceptor)
[ "def", "H_acceptor_count", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Valence\"", ")", "return", "sum", "(", "1", "for", "_", ",", "a", "in", "mol", ".", "atoms_iter", "(", ")", "if", "a", ".", "H_acceptor", ")" ]
Hydrogen bond acceptor count
[ "Hydrogen", "bond", "acceptor", "count" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L111-L114
train
mojaie/chorus
chorus/molutil.py
rotatable_count
def rotatable_count(mol): """Rotatable bond count """ mol.require("Rotatable") return sum(1 for _, _, b in mol.bonds_iter() if b.rotatable)
python
def rotatable_count(mol): """Rotatable bond count """ mol.require("Rotatable") return sum(1 for _, _, b in mol.bonds_iter() if b.rotatable)
[ "def", "rotatable_count", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Rotatable\"", ")", "return", "sum", "(", "1", "for", "_", ",", "_", ",", "b", "in", "mol", ".", "bonds_iter", "(", ")", "if", "b", ".", "rotatable", ")" ]
Rotatable bond count
[ "Rotatable", "bond", "count" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L117-L120
train
mojaie/chorus
chorus/molutil.py
rule_of_five_violation
def rule_of_five_violation(mol): """Lipinski's rule of five violation count """ v = 0 if mw(mol) > 500: v += 1 if H_donor_count(mol) > 5: v += 1 if H_acceptor_count(mol) > 10: v += 1 try: if wclogp.wclogp(mol) > 5: v += 1 except TypeError: # N/A ...
python
def rule_of_five_violation(mol): """Lipinski's rule of five violation count """ v = 0 if mw(mol) > 500: v += 1 if H_donor_count(mol) > 5: v += 1 if H_acceptor_count(mol) > 10: v += 1 try: if wclogp.wclogp(mol) > 5: v += 1 except TypeError: # N/A ...
[ "def", "rule_of_five_violation", "(", "mol", ")", ":", "v", "=", "0", "if", "mw", "(", "mol", ")", ">", "500", ":", "v", "+=", "1", "if", "H_donor_count", "(", "mol", ")", ">", "5", ":", "v", "+=", "1", "if", "H_acceptor_count", "(", "mol", ")", ...
Lipinski's rule of five violation count
[ "Lipinski", "s", "rule", "of", "five", "violation", "count" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L123-L137
train
mojaie/chorus
chorus/molutil.py
formula
def formula(mol): """Chemical formula. Atoms should be arranged in order of C, H and other atoms. Molecules should be arranged in order of length of formula text. """ mol.require("Valence") mol.require("Topology") total_cntr = Counter() for m in sorted(mols_iter(mol), key=len, reverse=Tr...
python
def formula(mol): """Chemical formula. Atoms should be arranged in order of C, H and other atoms. Molecules should be arranged in order of length of formula text. """ mol.require("Valence") mol.require("Topology") total_cntr = Counter() for m in sorted(mols_iter(mol), key=len, reverse=Tr...
[ "def", "formula", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Valence\"", ")", "mol", ".", "require", "(", "\"Topology\"", ")", "total_cntr", "=", "Counter", "(", ")", "for", "m", "in", "sorted", "(", "mols_iter", "(", "mol", ")", ",", "key"...
Chemical formula. Atoms should be arranged in order of C, H and other atoms. Molecules should be arranged in order of length of formula text.
[ "Chemical", "formula", ".", "Atoms", "should", "be", "arranged", "in", "order", "of", "C", "H", "and", "other", "atoms", ".", "Molecules", "should", "be", "arranged", "in", "order", "of", "length", "of", "formula", "text", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L164-L200
train
zsimic/runez
src/runez/click.py
debug
def debug(*args, **attrs): """Show debugging information.""" attrs.setdefault("is_flag", True) attrs.setdefault("default", None) return option(debug, *args, **attrs)
python
def debug(*args, **attrs): """Show debugging information.""" attrs.setdefault("is_flag", True) attrs.setdefault("default", None) return option(debug, *args, **attrs)
[ "def", "debug", "(", "*", "args", ",", "**", "attrs", ")", ":", "attrs", ".", "setdefault", "(", "\"is_flag\"", ",", "True", ")", "attrs", ".", "setdefault", "(", "\"default\"", ",", "None", ")", "return", "option", "(", "debug", ",", "*", "args", ",...
Show debugging information.
[ "Show", "debugging", "information", "." ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/click.py#L49-L53
train
zsimic/runez
src/runez/click.py
dryrun
def dryrun(*args, **attrs): """Perform a dryrun.""" attrs.setdefault("is_flag", True) attrs.setdefault("default", None) return option(dryrun, *args, **attrs)
python
def dryrun(*args, **attrs): """Perform a dryrun.""" attrs.setdefault("is_flag", True) attrs.setdefault("default", None) return option(dryrun, *args, **attrs)
[ "def", "dryrun", "(", "*", "args", ",", "**", "attrs", ")", ":", "attrs", ".", "setdefault", "(", "\"is_flag\"", ",", "True", ")", "attrs", ".", "setdefault", "(", "\"default\"", ",", "None", ")", "return", "option", "(", "dryrun", ",", "*", "args", ...
Perform a dryrun.
[ "Perform", "a", "dryrun", "." ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/click.py#L56-L60
train
zsimic/runez
src/runez/click.py
log
def log(*args, **attrs): """Override log file location.""" attrs.setdefault("metavar", "PATH") attrs.setdefault("show_default", False) return option(log, *args, **attrs)
python
def log(*args, **attrs): """Override log file location.""" attrs.setdefault("metavar", "PATH") attrs.setdefault("show_default", False) return option(log, *args, **attrs)
[ "def", "log", "(", "*", "args", ",", "**", "attrs", ")", ":", "attrs", ".", "setdefault", "(", "\"metavar\"", ",", "\"PATH\"", ")", "attrs", ".", "setdefault", "(", "\"show_default\"", ",", "False", ")", "return", "option", "(", "log", ",", "*", "args"...
Override log file location.
[ "Override", "log", "file", "location", "." ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/click.py#L63-L67
train
zsimic/runez
src/runez/click.py
version
def version(*args, **attrs): """Show the version and exit.""" if hasattr(sys, "_getframe"): package = attrs.pop("package", sys._getframe(1).f_globals.get("__package__")) if package: attrs.setdefault("version", get_version(package)) return click.version_option(*args, **attrs)
python
def version(*args, **attrs): """Show the version and exit.""" if hasattr(sys, "_getframe"): package = attrs.pop("package", sys._getframe(1).f_globals.get("__package__")) if package: attrs.setdefault("version", get_version(package)) return click.version_option(*args, **attrs)
[ "def", "version", "(", "*", "args", ",", "**", "attrs", ")", ":", "if", "hasattr", "(", "sys", ",", "\"_getframe\"", ")", ":", "package", "=", "attrs", ".", "pop", "(", "\"package\"", ",", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "...
Show the version and exit.
[ "Show", "the", "version", "and", "exit", "." ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/click.py#L70-L76
train
mojaie/chorus
chorus/rdkit.py
to_rdmol
def to_rdmol(mol): """Convert molecule to RDMol""" rwmol = Chem.RWMol(Chem.MolFromSmiles('')) key_to_idx = {} bond_type = {1: Chem.BondType.SINGLE, 2: Chem.BondType.DOUBLE, 3: Chem.BondType.TRIPLE} conf = Chem.Conformer(rwmol.GetNumAtoms()) for k, a in mol.atoms...
python
def to_rdmol(mol): """Convert molecule to RDMol""" rwmol = Chem.RWMol(Chem.MolFromSmiles('')) key_to_idx = {} bond_type = {1: Chem.BondType.SINGLE, 2: Chem.BondType.DOUBLE, 3: Chem.BondType.TRIPLE} conf = Chem.Conformer(rwmol.GetNumAtoms()) for k, a in mol.atoms...
[ "def", "to_rdmol", "(", "mol", ")", ":", "rwmol", "=", "Chem", ".", "RWMol", "(", "Chem", ".", "MolFromSmiles", "(", "''", ")", ")", "key_to_idx", "=", "{", "}", "bond_type", "=", "{", "1", ":", "Chem", ".", "BondType", ".", "SINGLE", ",", "2", "...
Convert molecule to RDMol
[ "Convert", "molecule", "to", "RDMol" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/rdkit.py#L20-L39
train
mojaie/chorus
chorus/rdkit.py
morgan_sim
def morgan_sim(mol1, mol2, radius=2, digit=3): """Calculate morgan fingerprint similarity by using RDKit radius=2 roughly equivalent to ECFP4 """ rdmol1 = to_rdmol(mol1) rdmol2 = to_rdmol(mol2) fp1 = AllChem.GetMorganFingerprint(rdmol1, radius) fp2 = AllChem.GetMorganFingerprint(rdmol2, radi...
python
def morgan_sim(mol1, mol2, radius=2, digit=3): """Calculate morgan fingerprint similarity by using RDKit radius=2 roughly equivalent to ECFP4 """ rdmol1 = to_rdmol(mol1) rdmol2 = to_rdmol(mol2) fp1 = AllChem.GetMorganFingerprint(rdmol1, radius) fp2 = AllChem.GetMorganFingerprint(rdmol2, radi...
[ "def", "morgan_sim", "(", "mol1", ",", "mol2", ",", "radius", "=", "2", ",", "digit", "=", "3", ")", ":", "rdmol1", "=", "to_rdmol", "(", "mol1", ")", "rdmol2", "=", "to_rdmol", "(", "mol2", ")", "fp1", "=", "AllChem", ".", "GetMorganFingerprint", "(...
Calculate morgan fingerprint similarity by using RDKit radius=2 roughly equivalent to ECFP4
[ "Calculate", "morgan", "fingerprint", "similarity", "by", "using", "RDKit", "radius", "=", "2", "roughly", "equivalent", "to", "ECFP4" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/rdkit.py#L63-L71
train
maljovec/topopy
topopy/MergeTree.py
MergeTree.build
def build(self, X, Y, w=None, edges=None): """ Assigns data to this object and builds the Merge Tree @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses corresponding to the m samples ...
python
def build(self, X, Y, w=None, edges=None): """ Assigns data to this object and builds the Merge Tree @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses corresponding to the m samples ...
[ "def", "build", "(", "self", ",", "X", ",", "Y", ",", "w", "=", "None", ",", "edges", "=", "None", ")", ":", "super", "(", "MergeTree", ",", "self", ")", ".", "build", "(", "X", ",", "Y", ",", "w", ",", "edges", ")", "if", "self", ".", "deb...
Assigns data to this object and builds the Merge Tree @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses corresponding to the m samples specified by X @ In, w, an optional m vecto...
[ "Assigns", "data", "to", "this", "object", "and", "builds", "the", "Merge", "Tree" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MergeTree.py#L103-L133
train
maljovec/topopy
topopy/MergeTree.py
MergeTree.build_for_contour_tree
def build_for_contour_tree(self, contour_tree, negate=False): """ A helper function that will reduce duplication of data by reusing the parent contour tree's parameters and data """ if self.debug: tree_type = "Join" if negate: tree_type = "Spli...
python
def build_for_contour_tree(self, contour_tree, negate=False): """ A helper function that will reduce duplication of data by reusing the parent contour tree's parameters and data """ if self.debug: tree_type = "Join" if negate: tree_type = "Spli...
[ "def", "build_for_contour_tree", "(", "self", ",", "contour_tree", ",", "negate", "=", "False", ")", ":", "if", "self", ".", "debug", ":", "tree_type", "=", "\"Join\"", "if", "negate", ":", "tree_type", "=", "\"Split\"", "sys", ".", "stdout", ".", "write",...
A helper function that will reduce duplication of data by reusing the parent contour tree's parameters and data
[ "A", "helper", "function", "that", "will", "reduce", "duplication", "of", "data", "by", "reusing", "the", "parent", "contour", "tree", "s", "parameters", "and", "data" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MergeTree.py#L135-L160
train
zsimic/runez
src/runez/context.py
verify_abort
def verify_abort(func, *args, **kwargs): """ Convenient wrapper around functions that should exit or raise an exception Example: assert "Can't create folder" in verify_abort(ensure_folder, "/dev/null/not-there") Args: func (callable): Function to execute *args: Args to pass to ...
python
def verify_abort(func, *args, **kwargs): """ Convenient wrapper around functions that should exit or raise an exception Example: assert "Can't create folder" in verify_abort(ensure_folder, "/dev/null/not-there") Args: func (callable): Function to execute *args: Args to pass to ...
[ "def", "verify_abort", "(", "func", ",", "*", "args", ",", "**", "kwargs", ")", ":", "expected_exception", "=", "kwargs", ".", "pop", "(", "\"expected_exception\"", ",", "runez", ".", "system", ".", "AbortException", ")", "with", "CaptureOutput", "(", ")", ...
Convenient wrapper around functions that should exit or raise an exception Example: assert "Can't create folder" in verify_abort(ensure_folder, "/dev/null/not-there") Args: func (callable): Function to execute *args: Args to pass to 'func' **kwargs: Named args to pass to 'func'...
[ "Convenient", "wrapper", "around", "functions", "that", "should", "exit", "or", "raise", "an", "exception" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/context.py#L248-L270
train
zsimic/runez
src/runez/context.py
CapturedStream.pop
def pop(self, strip=False): """Current content popped, useful for testing""" r = self.contents() self.clear() if r and strip: r = r.strip() return r
python
def pop(self, strip=False): """Current content popped, useful for testing""" r = self.contents() self.clear() if r and strip: r = r.strip() return r
[ "def", "pop", "(", "self", ",", "strip", "=", "False", ")", ":", "r", "=", "self", ".", "contents", "(", ")", "self", ".", "clear", "(", ")", "if", "r", "and", "strip", ":", "r", "=", "r", ".", "strip", "(", ")", "return", "r" ]
Current content popped, useful for testing
[ "Current", "content", "popped", "useful", "for", "testing" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/context.py#L72-L78
train
mojaie/chorus
chorus/draw/svg.py
SVG.contents
def contents(self): """Get svg string """ c = self._header[:] c.append(' font-weight="{}"'.format(self.font_weight)) c.append(' font-family="{}"'.format(self.font_family)) c.append(' width="{}" height="{}"'.format(*self.screen_size)) sclw = self.original_size[0] *...
python
def contents(self): """Get svg string """ c = self._header[:] c.append(' font-weight="{}"'.format(self.font_weight)) c.append(' font-family="{}"'.format(self.font_family)) c.append(' width="{}" height="{}"'.format(*self.screen_size)) sclw = self.original_size[0] *...
[ "def", "contents", "(", "self", ")", ":", "c", "=", "self", ".", "_header", "[", ":", "]", "c", ".", "append", "(", "' font-weight=\"{}\"'", ".", "format", "(", "self", ".", "font_weight", ")", ")", "c", ".", "append", "(", "' font-family=\"{}\"'", "."...
Get svg string
[ "Get", "svg", "string" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/svg.py#L49-L70
train
mojaie/chorus
chorus/draw/svg.py
SVG.data_url_scheme
def data_url_scheme(self): """Get svg in Data URL Scheme format. """ # TODO: move to web.app or make it function # remove #svg from dataframe encoded = base64.b64encode(self.contents().encode()) return "data:image/svg+xml;base64," + encoded.decode()
python
def data_url_scheme(self): """Get svg in Data URL Scheme format. """ # TODO: move to web.app or make it function # remove #svg from dataframe encoded = base64.b64encode(self.contents().encode()) return "data:image/svg+xml;base64," + encoded.decode()
[ "def", "data_url_scheme", "(", "self", ")", ":", "encoded", "=", "base64", ".", "b64encode", "(", "self", ".", "contents", "(", ")", ".", "encode", "(", ")", ")", "return", "\"data:image/svg+xml;base64,\"", "+", "encoded", ".", "decode", "(", ")" ]
Get svg in Data URL Scheme format.
[ "Get", "svg", "in", "Data", "URL", "Scheme", "format", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/svg.py#L72-L78
train
mojaie/chorus
chorus/draw/svg.py
SVG._coords_conv
def _coords_conv(self, pos): """For Svg coordinate system, reflect over X axis and translate from center to top-left """ px = (self.original_size[0] / 2 + pos[0]) * self.scale_factor py = (self.original_size[1] / 2 - pos[1]) * self.scale_factor return round(px, 2), round(...
python
def _coords_conv(self, pos): """For Svg coordinate system, reflect over X axis and translate from center to top-left """ px = (self.original_size[0] / 2 + pos[0]) * self.scale_factor py = (self.original_size[1] / 2 - pos[1]) * self.scale_factor return round(px, 2), round(...
[ "def", "_coords_conv", "(", "self", ",", "pos", ")", ":", "px", "=", "(", "self", ".", "original_size", "[", "0", "]", "/", "2", "+", "pos", "[", "0", "]", ")", "*", "self", ".", "scale_factor", "py", "=", "(", "self", ".", "original_size", "[", ...
For Svg coordinate system, reflect over X axis and translate from center to top-left
[ "For", "Svg", "coordinate", "system", "reflect", "over", "X", "axis", "and", "translate", "from", "center", "to", "top", "-", "left" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/svg.py#L89-L95
train
mastro35/flows
flows/FlowsLogger.py
FlowsLogger.get_logger
def get_logger(self): """ Returns the standard logger """ if Global.LOGGER: Global.LOGGER.debug('configuring a logger') if self._logger_instance is not None: return self._logger_instance self._logger_instance = logging.getLogger("flowsLogger") ...
python
def get_logger(self): """ Returns the standard logger """ if Global.LOGGER: Global.LOGGER.debug('configuring a logger') if self._logger_instance is not None: return self._logger_instance self._logger_instance = logging.getLogger("flowsLogger") ...
[ "def", "get_logger", "(", "self", ")", ":", "if", "Global", ".", "LOGGER", ":", "Global", ".", "LOGGER", ".", "debug", "(", "'configuring a logger'", ")", "if", "self", ".", "_logger_instance", "is", "not", "None", ":", "return", "self", ".", "_logger_inst...
Returns the standard logger
[ "Returns", "the", "standard", "logger" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsLogger.py#L39-L61
train
mastro35/flows
flows/FlowsLogger.py
FlowsLogger.reconfigure_log_level
def reconfigure_log_level(self): """ Returns a new standard logger instance """ if Global.LOGGER: Global.LOGGER.debug('reconfiguring logger level') stream_handlers = filter(lambda x: type(x) is logging.StreamHandler, self._logger_insta...
python
def reconfigure_log_level(self): """ Returns a new standard logger instance """ if Global.LOGGER: Global.LOGGER.debug('reconfiguring logger level') stream_handlers = filter(lambda x: type(x) is logging.StreamHandler, self._logger_insta...
[ "def", "reconfigure_log_level", "(", "self", ")", ":", "if", "Global", ".", "LOGGER", ":", "Global", ".", "LOGGER", ".", "debug", "(", "'reconfiguring logger level'", ")", "stream_handlers", "=", "filter", "(", "lambda", "x", ":", "type", "(", "x", ")", "i...
Returns a new standard logger instance
[ "Returns", "a", "new", "standard", "logger", "instance" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsLogger.py#L63-L75
train
lsst-sqre/documenteer
documenteer/sphinxext/packagetoctree.py
_build_toctree_node
def _build_toctree_node(parent=None, entries=None, includefiles=None, caption=None): """Factory for a toctree node. """ # Add the toctree's node itself subnode = sphinx.addnodes.toctree() subnode['parent'] = parent subnode['entries'] = entries subnode['includefiles'] ...
python
def _build_toctree_node(parent=None, entries=None, includefiles=None, caption=None): """Factory for a toctree node. """ # Add the toctree's node itself subnode = sphinx.addnodes.toctree() subnode['parent'] = parent subnode['entries'] = entries subnode['includefiles'] ...
[ "def", "_build_toctree_node", "(", "parent", "=", "None", ",", "entries", "=", "None", ",", "includefiles", "=", "None", ",", "caption", "=", "None", ")", ":", "subnode", "=", "sphinx", ".", "addnodes", ".", "toctree", "(", ")", "subnode", "[", "'parent'...
Factory for a toctree node.
[ "Factory", "for", "a", "toctree", "node", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/packagetoctree.py#L228-L247
train
lsst-sqre/documenteer
documenteer/sphinxext/packagetoctree.py
ModuleTocTree._parse_skip_option
def _parse_skip_option(self): """Parse the ``skip`` option of skipped module names. """ try: skip_text = self.options['skip'] except KeyError: return [] modules = [module.strip() for module in skip_text.split(',')] return modules
python
def _parse_skip_option(self): """Parse the ``skip`` option of skipped module names. """ try: skip_text = self.options['skip'] except KeyError: return [] modules = [module.strip() for module in skip_text.split(',')] return modules
[ "def", "_parse_skip_option", "(", "self", ")", ":", "try", ":", "skip_text", "=", "self", ".", "options", "[", "'skip'", "]", "except", "KeyError", ":", "return", "[", "]", "modules", "=", "[", "module", ".", "strip", "(", ")", "for", "module", "in", ...
Parse the ``skip`` option of skipped module names.
[ "Parse", "the", "skip", "option", "of", "skipped", "module", "names", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/packagetoctree.py#L94-L103
train
lsst-sqre/documenteer
documenteer/sphinxext/packagetoctree.py
PackageTocTree._parse_skip_option
def _parse_skip_option(self): """Parse the ``skip`` option of skipped package names. """ try: skip_text = self.options['skip'] except KeyError: return [] packages = [package.strip() for package in skip_text.split(',')] return packages
python
def _parse_skip_option(self): """Parse the ``skip`` option of skipped package names. """ try: skip_text = self.options['skip'] except KeyError: return [] packages = [package.strip() for package in skip_text.split(',')] return packages
[ "def", "_parse_skip_option", "(", "self", ")", ":", "try", ":", "skip_text", "=", "self", ".", "options", "[", "'skip'", "]", "except", "KeyError", ":", "return", "[", "]", "packages", "=", "[", "package", ".", "strip", "(", ")", "for", "package", "in"...
Parse the ``skip`` option of skipped package names.
[ "Parse", "the", "skip", "option", "of", "skipped", "package", "names", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/packagetoctree.py#L188-L197
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._set_command_line_arguments
def _set_command_line_arguments(self, args): """ Set internal configuration variables according to the input parameters """ Global.LOGGER.debug("setting command line arguments") if args.VERBOSE: Global.LOGGER.debug("verbose mode active") Global.C...
python
def _set_command_line_arguments(self, args): """ Set internal configuration variables according to the input parameters """ Global.LOGGER.debug("setting command line arguments") if args.VERBOSE: Global.LOGGER.debug("verbose mode active") Global.C...
[ "def", "_set_command_line_arguments", "(", "self", ",", "args", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "\"setting command line arguments\"", ")", "if", "args", ".", "VERBOSE", ":", "Global", ".", "LOGGER", ".", "debug", "(", "\"verbose mode active...
Set internal configuration variables according to the input parameters
[ "Set", "internal", "configuration", "variables", "according", "to", "the", "input", "parameters" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L66-L99
train
mastro35/flows
flows/FlowsManager.py
FlowsManager.start
def start(self): """ Start all the processes """ Global.LOGGER.info("starting the flow manager") self._start_actions() self._start_message_fetcher() Global.LOGGER.debug("flow manager started")
python
def start(self): """ Start all the processes """ Global.LOGGER.info("starting the flow manager") self._start_actions() self._start_message_fetcher() Global.LOGGER.debug("flow manager started")
[ "def", "start", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "info", "(", "\"starting the flow manager\"", ")", "self", ".", "_start_actions", "(", ")", "self", ".", "_start_message_fetcher", "(", ")", "Global", ".", "LOGGER", ".", "debug", "(", "\...
Start all the processes
[ "Start", "all", "the", "processes" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L102-L109
train
mastro35/flows
flows/FlowsManager.py
FlowsManager.stop
def stop(self): """ Stop all the processes """ Global.LOGGER.info("stopping the flow manager") self._stop_actions() self.isrunning = False Global.LOGGER.debug("flow manager stopped")
python
def stop(self): """ Stop all the processes """ Global.LOGGER.info("stopping the flow manager") self._stop_actions() self.isrunning = False Global.LOGGER.debug("flow manager stopped")
[ "def", "stop", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "info", "(", "\"stopping the flow manager\"", ")", "self", ".", "_stop_actions", "(", ")", "self", ".", "isrunning", "=", "False", "Global", ".", "LOGGER", ".", "debug", "(", "\"flow manag...
Stop all the processes
[ "Stop", "all", "the", "processes" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L111-L118
train
mastro35/flows
flows/FlowsManager.py
FlowsManager.restart
def restart(self): """ Restart all the processes """ Global.LOGGER.info("restarting the flow manager") self._stop_actions() # stop the old actions self.actions = [] # clear the action list self._start_actions() # start the configured actions Glo...
python
def restart(self): """ Restart all the processes """ Global.LOGGER.info("restarting the flow manager") self._stop_actions() # stop the old actions self.actions = [] # clear the action list self._start_actions() # start the configured actions Glo...
[ "def", "restart", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "info", "(", "\"restarting the flow manager\"", ")", "self", ".", "_stop_actions", "(", ")", "self", ".", "actions", "=", "[", "]", "self", ".", "_start_actions", "(", ")", "Global", ...
Restart all the processes
[ "Restart", "all", "the", "processes" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L120-L128
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._start_actions
def _start_actions(self): """ Start all the actions for the recipes """ Global.LOGGER.info("starting actions") for recipe in Global.CONFIG_MANAGER.recipes: Global.CONFIG_MANAGER.read_recipe(recipe) list(map(lambda section: self._start_action_for_section( ...
python
def _start_actions(self): """ Start all the actions for the recipes """ Global.LOGGER.info("starting actions") for recipe in Global.CONFIG_MANAGER.recipes: Global.CONFIG_MANAGER.read_recipe(recipe) list(map(lambda section: self._start_action_for_section( ...
[ "def", "_start_actions", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "info", "(", "\"starting actions\"", ")", "for", "recipe", "in", "Global", ".", "CONFIG_MANAGER", ".", "recipes", ":", "Global", ".", "CONFIG_MANAGER", ".", "read_recipe", "(", "re...
Start all the actions for the recipes
[ "Start", "all", "the", "actions", "for", "the", "recipes" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L130-L140
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._start_action_for_section
def _start_action_for_section(self, section): """ Start all the actions for a particular section """ if section == "configuration": return Global.LOGGER.debug("starting actions for section " + section) # read the configuration of the action action_co...
python
def _start_action_for_section(self, section): """ Start all the actions for a particular section """ if section == "configuration": return Global.LOGGER.debug("starting actions for section " + section) # read the configuration of the action action_co...
[ "def", "_start_action_for_section", "(", "self", ",", "section", ")", ":", "if", "section", "==", "\"configuration\"", ":", "return", "Global", ".", "LOGGER", ".", "debug", "(", "\"starting actions for section \"", "+", "section", ")", "action_configuration", "=", ...
Start all the actions for a particular section
[ "Start", "all", "the", "actions", "for", "a", "particular", "section" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L142-L185
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._stop_actions
def _stop_actions(self): """ Stop all the actions """ Global.LOGGER.info("stopping actions") list(map(lambda x: x.stop(), self.actions)) Global.LOGGER.info("actions stopped")
python
def _stop_actions(self): """ Stop all the actions """ Global.LOGGER.info("stopping actions") list(map(lambda x: x.stop(), self.actions)) Global.LOGGER.info("actions stopped")
[ "def", "_stop_actions", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "info", "(", "\"stopping actions\"", ")", "list", "(", "map", "(", "lambda", "x", ":", "x", ".", "stop", "(", ")", ",", "self", ".", "actions", ")", ")", "Global", ".", "L...
Stop all the actions
[ "Stop", "all", "the", "actions" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L187-L195
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._perform_system_check
def _perform_system_check(self): """ Perform a system check to define if we need to throttle to handle all the incoming messages """ if Global.CONFIG_MANAGER.tracing_mode: Global.LOGGER.debug("performing a system check") now = datetime.datetime.now() ...
python
def _perform_system_check(self): """ Perform a system check to define if we need to throttle to handle all the incoming messages """ if Global.CONFIG_MANAGER.tracing_mode: Global.LOGGER.debug("performing a system check") now = datetime.datetime.now() ...
[ "def", "_perform_system_check", "(", "self", ")", ":", "if", "Global", ".", "CONFIG_MANAGER", ".", "tracing_mode", ":", "Global", ".", "LOGGER", ".", "debug", "(", "\"performing a system check\"", ")", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ...
Perform a system check to define if we need to throttle to handle all the incoming messages
[ "Perform", "a", "system", "check", "to", "define", "if", "we", "need", "to", "throttle", "to", "handle", "all", "the", "incoming", "messages" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L197-L227
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._deliver_message
def _deliver_message(self, msg): """ Deliver the message to the subscripted actions """ my_subscribed_actions = self.subscriptions.get(msg.sender, []) for action in my_subscribed_actions: if Global.CONFIG_MANAGER.tracing_mode: Global.LOGGER.debug(f"del...
python
def _deliver_message(self, msg): """ Deliver the message to the subscripted actions """ my_subscribed_actions = self.subscriptions.get(msg.sender, []) for action in my_subscribed_actions: if Global.CONFIG_MANAGER.tracing_mode: Global.LOGGER.debug(f"del...
[ "def", "_deliver_message", "(", "self", ",", "msg", ")", ":", "my_subscribed_actions", "=", "self", ".", "subscriptions", ".", "get", "(", "msg", ".", "sender", ",", "[", "]", ")", "for", "action", "in", "my_subscribed_actions", ":", "if", "Global", ".", ...
Deliver the message to the subscripted actions
[ "Deliver", "the", "message", "to", "the", "subscripted", "actions" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L229-L237
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._fetch_messages
def _fetch_messages(self): """ Get an input message from the socket """ try: [_, msg] = self.socket.recv_multipart(flags=zmq.NOBLOCK) if Global.CONFIG_MANAGER.tracing_mode: Global.LOGGER.debug("fetched a new message") self.fetched = se...
python
def _fetch_messages(self): """ Get an input message from the socket """ try: [_, msg] = self.socket.recv_multipart(flags=zmq.NOBLOCK) if Global.CONFIG_MANAGER.tracing_mode: Global.LOGGER.debug("fetched a new message") self.fetched = se...
[ "def", "_fetch_messages", "(", "self", ")", ":", "try", ":", "[", "_", ",", "msg", "]", "=", "self", ".", "socket", ".", "recv_multipart", "(", "flags", "=", "zmq", ".", "NOBLOCK", ")", "if", "Global", ".", "CONFIG_MANAGER", ".", "tracing_mode", ":", ...
Get an input message from the socket
[ "Get", "an", "input", "message", "from", "the", "socket" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L239-L256
train
mastro35/flows
flows/FlowsManager.py
FlowsManager.message_fetcher_coroutine
async def message_fetcher_coroutine(self, loop): """ Register callback for message fetcher coroutines """ Global.LOGGER.debug('registering callbacks for message fetcher coroutine') self.isrunning = True while self.isrunning: loop.call_soon(self._fetch_messages...
python
async def message_fetcher_coroutine(self, loop): """ Register callback for message fetcher coroutines """ Global.LOGGER.debug('registering callbacks for message fetcher coroutine') self.isrunning = True while self.isrunning: loop.call_soon(self._fetch_messages...
[ "async", "def", "message_fetcher_coroutine", "(", "self", ",", "loop", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "'registering callbacks for message fetcher coroutine'", ")", "self", ".", "isrunning", "=", "True", "while", "self", ".", "isrunning", ":"...
Register callback for message fetcher coroutines
[ "Register", "callback", "for", "message", "fetcher", "coroutines" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L258-L269
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._adapt_sleep_interval
def _adapt_sleep_interval(self, sent, received, queue, now): """ Adapt sleep time based on the number of the messages in queue """ Global.LOGGER.debug("adjusting sleep interval") dispatched_since_last_check = sent - self.last_queue_check_count seconds_since_last_check = ...
python
def _adapt_sleep_interval(self, sent, received, queue, now): """ Adapt sleep time based on the number of the messages in queue """ Global.LOGGER.debug("adjusting sleep interval") dispatched_since_last_check = sent - self.last_queue_check_count seconds_since_last_check = ...
[ "def", "_adapt_sleep_interval", "(", "self", ",", "sent", ",", "received", ",", "queue", ",", "now", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "\"adjusting sleep interval\"", ")", "dispatched_since_last_check", "=", "sent", "-", "self", ".", "last_...
Adapt sleep time based on the number of the messages in queue
[ "Adapt", "sleep", "time", "based", "on", "the", "number", "of", "the", "messages", "in", "queue" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L284-L314
train
mastro35/flows
flows/FlowsManager.py
FlowsManager._parse_input_parameters
def _parse_input_parameters(self): """ Set the configuration for the Logger """ Global.LOGGER.debug("define and parsing command line arguments") parser = argparse.ArgumentParser( description='A workflow engine for Pythonistas', formatter_class=argparse.RawTextHelpForm...
python
def _parse_input_parameters(self): """ Set the configuration for the Logger """ Global.LOGGER.debug("define and parsing command line arguments") parser = argparse.ArgumentParser( description='A workflow engine for Pythonistas', formatter_class=argparse.RawTextHelpForm...
[ "def", "_parse_input_parameters", "(", "self", ")", ":", "Global", ".", "LOGGER", ".", "debug", "(", "\"define and parsing command line arguments\"", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'A workflow engine for Pythonistas'", "...
Set the configuration for the Logger
[ "Set", "the", "configuration", "for", "the", "Logger" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/FlowsManager.py#L316-L340
train
mesbahamin/chronophore
scripts/chronophore_migrate.py
migrate_050_to_051
def migrate_050_to_051(session): """Set time_out field of all flagged timesheet entries to Null. """ entries_to_update = session.query(Entry).filter( Entry.forgot_sign_out.is_(True)).filter( Entry.time_out.isnot(None)) for entry in entries_to_update: entry.time_out =...
python
def migrate_050_to_051(session): """Set time_out field of all flagged timesheet entries to Null. """ entries_to_update = session.query(Entry).filter( Entry.forgot_sign_out.is_(True)).filter( Entry.time_out.isnot(None)) for entry in entries_to_update: entry.time_out =...
[ "def", "migrate_050_to_051", "(", "session", ")", ":", "entries_to_update", "=", "session", ".", "query", "(", "Entry", ")", ".", "filter", "(", "Entry", ".", "forgot_sign_out", ".", "is_", "(", "True", ")", ")", ".", "filter", "(", "Entry", ".", "time_o...
Set time_out field of all flagged timesheet entries to Null.
[ "Set", "time_out", "field", "of", "all", "flagged", "timesheet", "entries", "to", "Null", "." ]
ee140c61b4dfada966f078de8304bac737cec6f7
https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/scripts/chronophore_migrate.py#L17-L29
train
ehansis/ozelot
ozelot/etl/tasks.py
get_task_param_string
def get_task_param_string(task): """Get all parameters of a task as one string Returns: str: task parameter string """ # get dict str -> str from luigi param_dict = task.to_str_params() # sort keys, serialize items = [] for key in sorted(param_dict.keys()): items.append...
python
def get_task_param_string(task): """Get all parameters of a task as one string Returns: str: task parameter string """ # get dict str -> str from luigi param_dict = task.to_str_params() # sort keys, serialize items = [] for key in sorted(param_dict.keys()): items.append...
[ "def", "get_task_param_string", "(", "task", ")", ":", "param_dict", "=", "task", ".", "to_str_params", "(", ")", "items", "=", "[", "]", "for", "key", "in", "sorted", "(", "param_dict", ".", "keys", "(", ")", ")", ":", "items", ".", "append", "(", "...
Get all parameters of a task as one string Returns: str: task parameter string
[ "Get", "all", "parameters", "of", "a", "task", "as", "one", "string" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/tasks.py#L18-L32
train
ehansis/ozelot
ozelot/etl/tasks.py
check_completion
def check_completion(task, mark_incomplete=False, clear=False, return_stats=False): """Recursively check if a task and all its requirements are complete Args: task (derived from luigi.Task): Task to check completion for; check everything 'downstream' from that task. mark_incomplete...
python
def check_completion(task, mark_incomplete=False, clear=False, return_stats=False): """Recursively check if a task and all its requirements are complete Args: task (derived from luigi.Task): Task to check completion for; check everything 'downstream' from that task. mark_incomplete...
[ "def", "check_completion", "(", "task", ",", "mark_incomplete", "=", "False", ",", "clear", "=", "False", ",", "return_stats", "=", "False", ")", ":", "to_clear", "=", "dict", "(", ")", "is_complete", ",", "stats", "=", "_check_completion", "(", "task", ",...
Recursively check if a task and all its requirements are complete Args: task (derived from luigi.Task): Task to check completion for; check everything 'downstream' from that task. mark_incomplete (bool): If ``True`` set any task as incomplete for which a requirement is foun...
[ "Recursively", "check", "if", "a", "task", "and", "all", "its", "requirements", "are", "complete" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/tasks.py#L191-L257
train
ehansis/ozelot
ozelot/etl/tasks.py
TaskBase.build
def build(cls, local_scheduler=True, **task_params): """Instantiate the task and build it with luigi Args: local_scheduler (bool): use a local scheduler (True, default) or a remote scheduler task_params: parameters to pass to task for instantiation """ luigi.buil...
python
def build(cls, local_scheduler=True, **task_params): """Instantiate the task and build it with luigi Args: local_scheduler (bool): use a local scheduler (True, default) or a remote scheduler task_params: parameters to pass to task for instantiation """ luigi.buil...
[ "def", "build", "(", "cls", ",", "local_scheduler", "=", "True", ",", "**", "task_params", ")", ":", "luigi", ".", "build", "(", "[", "cls", "(", "**", "task_params", ")", "]", ",", "local_scheduler", "=", "local_scheduler", ")" ]
Instantiate the task and build it with luigi Args: local_scheduler (bool): use a local scheduler (True, default) or a remote scheduler task_params: parameters to pass to task for instantiation
[ "Instantiate", "the", "task", "and", "build", "it", "with", "luigi" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/tasks.py#L63-L70
train
ehansis/ozelot
ozelot/etl/tasks.py
ORMObjectCreatorMixin.clear
def clear( self # type: ORMTask ): """Delete all objects created by this task. Iterate over `self.object_classes` and delete all objects of the listed classes. """ # mark this task as incomplete self.mark_incomplete() # delete objects for object...
python
def clear( self # type: ORMTask ): """Delete all objects created by this task. Iterate over `self.object_classes` and delete all objects of the listed classes. """ # mark this task as incomplete self.mark_incomplete() # delete objects for object...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "mark_incomplete", "(", ")", "for", "object_class", "in", "self", ".", "object_classes", ":", "self", ".", "session", ".", "query", "(", "object_class", ")", ".", "delete", "(", ")", "self", ".", "clo...
Delete all objects created by this task. Iterate over `self.object_classes` and delete all objects of the listed classes.
[ "Delete", "all", "objects", "created", "by", "this", "task", "." ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/tasks.py#L347-L361
train
ehansis/ozelot
ozelot/etl/tasks.py
ORMWrapperTask.complete
def complete(self): """Task is complete if completion marker is set and all requirements are complete """ is_complete = super(ORMWrapperTask, self).complete() for req in self.requires(): is_complete &= req.complete() return is_complete
python
def complete(self): """Task is complete if completion marker is set and all requirements are complete """ is_complete = super(ORMWrapperTask, self).complete() for req in self.requires(): is_complete &= req.complete() return is_complete
[ "def", "complete", "(", "self", ")", ":", "is_complete", "=", "super", "(", "ORMWrapperTask", ",", "self", ")", ".", "complete", "(", ")", "for", "req", "in", "self", ".", "requires", "(", ")", ":", "is_complete", "&=", "req", ".", "complete", "(", "...
Task is complete if completion marker is set and all requirements are complete
[ "Task", "is", "complete", "if", "completion", "marker", "is", "set", "and", "all", "requirements", "are", "complete" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/tasks.py#L390-L397
train
maljovec/topopy
topopy/MorseSmaleComplex.py
MorseSmaleComplex.save
def save(self, filename=None): """ Saves a constructed Morse-Smale Complex in json file @ In, filename, a filename for storing the hierarchical merging of features and the base level partitions of the data """ if filename is None: filename = "morse...
python
def save(self, filename=None): """ Saves a constructed Morse-Smale Complex in json file @ In, filename, a filename for storing the hierarchical merging of features and the base level partitions of the data """ if filename is None: filename = "morse...
[ "def", "save", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "\"morse_smale_complex.json\"", "with", "open", "(", "filename", ",", "\"w\"", ")", "as", "fp", ":", "fp", ".", "write", "(", "sel...
Saves a constructed Morse-Smale Complex in json file @ In, filename, a filename for storing the hierarchical merging of features and the base level partitions of the data
[ "Saves", "a", "constructed", "Morse", "-", "Smale", "Complex", "in", "json", "file" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MorseSmaleComplex.py#L159-L168
train
maljovec/topopy
topopy/MorseSmaleComplex.py
MorseSmaleComplex.get_label
def get_label(self, indices=None): """ Returns the label pair indices requested by the user @ In, indices, a list of non-negative integers specifying the row indices to return @ Out, a list of integer 2-tuples specifying the minimum and maximum index of the specif...
python
def get_label(self, indices=None): """ Returns the label pair indices requested by the user @ In, indices, a list of non-negative integers specifying the row indices to return @ Out, a list of integer 2-tuples specifying the minimum and maximum index of the specif...
[ "def", "get_label", "(", "self", ",", "indices", "=", "None", ")", ":", "if", "indices", "is", "None", ":", "indices", "=", "list", "(", "range", "(", "0", ",", "self", ".", "get_sample_size", "(", ")", ")", ")", "elif", "isinstance", "(", "indices",...
Returns the label pair indices requested by the user @ In, indices, a list of non-negative integers specifying the row indices to return @ Out, a list of integer 2-tuples specifying the minimum and maximum index of the specified rows.
[ "Returns", "the", "label", "pair", "indices", "requested", "by", "the", "user" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MorseSmaleComplex.py#L316-L341
train
maljovec/topopy
topopy/MorseSmaleComplex.py
MorseSmaleComplex.get_sample_size
def get_sample_size(self, key=None): """ Returns the number of samples in the input data @ In, key, an optional 2-tuple specifying a min-max id pair used for determining which partition size should be returned. If not specified then the size of the entire data set...
python
def get_sample_size(self, key=None): """ Returns the number of samples in the input data @ In, key, an optional 2-tuple specifying a min-max id pair used for determining which partition size should be returned. If not specified then the size of the entire data set...
[ "def", "get_sample_size", "(", "self", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "return", "len", "(", "self", ".", "Y", ")", "else", ":", "return", "len", "(", "self", ".", "get_partitions", "(", "self", ".", "persistence", ...
Returns the number of samples in the input data @ In, key, an optional 2-tuple specifying a min-max id pair used for determining which partition size should be returned. If not specified then the size of the entire data set will be returned. @ Out, an integer ...
[ "Returns", "the", "number", "of", "samples", "in", "the", "input", "data" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MorseSmaleComplex.py#L354-L365
train
maljovec/topopy
topopy/MorseSmaleComplex.py
MorseSmaleComplex.to_json
def to_json(self): """ Writes the complete Morse-Smale merge hierarchy to a string object. @ Out, a string object storing the entire merge hierarchy of all minima and maxima. """ capsule = {} capsule["Hierarchy"] = [] for ( dying, ...
python
def to_json(self): """ Writes the complete Morse-Smale merge hierarchy to a string object. @ Out, a string object storing the entire merge hierarchy of all minima and maxima. """ capsule = {} capsule["Hierarchy"] = [] for ( dying, ...
[ "def", "to_json", "(", "self", ")", ":", "capsule", "=", "{", "}", "capsule", "[", "\"Hierarchy\"", "]", "=", "[", "]", "for", "(", "dying", ",", "(", "persistence", ",", "surviving", ",", "saddle", ")", ",", ")", "in", "self", ".", "merge_sequence",...
Writes the complete Morse-Smale merge hierarchy to a string object. @ Out, a string object storing the entire merge hierarchy of all minima and maxima.
[ "Writes", "the", "complete", "Morse", "-", "Smale", "merge", "hierarchy", "to", "a", "string", "object", "." ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MorseSmaleComplex.py#L382-L408
train
yymao/generic-catalog-reader
GCR/utils.py
dict_to_numpy_array
def dict_to_numpy_array(d): """ Convert a dict of 1d array to a numpy recarray """ return fromarrays(d.values(), np.dtype([(str(k), v.dtype) for k, v in d.items()]))
python
def dict_to_numpy_array(d): """ Convert a dict of 1d array to a numpy recarray """ return fromarrays(d.values(), np.dtype([(str(k), v.dtype) for k, v in d.items()]))
[ "def", "dict_to_numpy_array", "(", "d", ")", ":", "return", "fromarrays", "(", "d", ".", "values", "(", ")", ",", "np", ".", "dtype", "(", "[", "(", "str", "(", "k", ")", ",", "v", ".", "dtype", ")", "for", "k", ",", "v", "in", "d", ".", "ite...
Convert a dict of 1d array to a numpy recarray
[ "Convert", "a", "dict", "of", "1d", "array", "to", "a", "numpy", "recarray" ]
bc6267ac41b9f68106ed6065184469ac13fdc0b6
https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/utils.py#L23-L27
train
yymao/generic-catalog-reader
GCR/utils.py
concatenate_1d
def concatenate_1d(arrays): """ Concatenate 1D numpy arrays. Similar to np.concatenate but work with empty input and masked arrays. """ if len(arrays) == 0: return np.array([]) if len(arrays) == 1: return np.asanyarray(arrays[0]) if any(map(np.ma.is_masked, arrays)): ...
python
def concatenate_1d(arrays): """ Concatenate 1D numpy arrays. Similar to np.concatenate but work with empty input and masked arrays. """ if len(arrays) == 0: return np.array([]) if len(arrays) == 1: return np.asanyarray(arrays[0]) if any(map(np.ma.is_masked, arrays)): ...
[ "def", "concatenate_1d", "(", "arrays", ")", ":", "if", "len", "(", "arrays", ")", "==", "0", ":", "return", "np", ".", "array", "(", "[", "]", ")", "if", "len", "(", "arrays", ")", "==", "1", ":", "return", "np", ".", "asanyarray", "(", "arrays"...
Concatenate 1D numpy arrays. Similar to np.concatenate but work with empty input and masked arrays.
[ "Concatenate", "1D", "numpy", "arrays", ".", "Similar", "to", "np", ".", "concatenate", "but", "work", "with", "empty", "input", "and", "masked", "arrays", "." ]
bc6267ac41b9f68106ed6065184469ac13fdc0b6
https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/utils.py#L29-L40
train
mojaie/chorus
chorus/model/atom.py
Atom.formula_html
def formula_html(self, reversed_=False): """Chemical formula HTML Args: reversed (bool): reversed text for leftmost atom groups """ if self.H_count == 1: text = "H" elif self.H_count > 1: text = "H<sub>{}</sub>".format(self.H_count) el...
python
def formula_html(self, reversed_=False): """Chemical formula HTML Args: reversed (bool): reversed text for leftmost atom groups """ if self.H_count == 1: text = "H" elif self.H_count > 1: text = "H<sub>{}</sub>".format(self.H_count) el...
[ "def", "formula_html", "(", "self", ",", "reversed_", "=", "False", ")", ":", "if", "self", ".", "H_count", "==", "1", ":", "text", "=", "\"H\"", "elif", "self", ".", "H_count", ">", "1", ":", "text", "=", "\"H<sub>{}</sub>\"", ".", "format", "(", "s...
Chemical formula HTML Args: reversed (bool): reversed text for leftmost atom groups
[ "Chemical", "formula", "HTML" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/atom.py#L123-L138
train
mojaie/chorus
chorus/model/atom.py
Atom.charge_sign
def charge_sign(self): """Charge sign text""" if self.charge > 0: sign = "+" elif self.charge < 0: sign = "–" # en dash, not hyphen-minus else: return "" ab = abs(self.charge) if ab > 1: return str(ab) + sign return...
python
def charge_sign(self): """Charge sign text""" if self.charge > 0: sign = "+" elif self.charge < 0: sign = "–" # en dash, not hyphen-minus else: return "" ab = abs(self.charge) if ab > 1: return str(ab) + sign return...
[ "def", "charge_sign", "(", "self", ")", ":", "if", "self", ".", "charge", ">", "0", ":", "sign", "=", "\"+\"", "elif", "self", ".", "charge", "<", "0", ":", "sign", "=", "\"–\" ", "else", ":", "return", "\"\"", "ab", "=", "abs", "(", "self", "."...
Charge sign text
[ "Charge", "sign", "text" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/atom.py#L154-L165
train
mastro35/flows
flows/MessageDispatcher.py
MessageDispatcher.send_message
def send_message(self, message): """ Dispatch a message using 0mq """ with self._instance_lock: if message is None: Global.LOGGER.error("can't deliver a null messages") return if message.sender is None: Global.LOGGE...
python
def send_message(self, message): """ Dispatch a message using 0mq """ with self._instance_lock: if message is None: Global.LOGGER.error("can't deliver a null messages") return if message.sender is None: Global.LOGGE...
[ "def", "send_message", "(", "self", ",", "message", ")", ":", "with", "self", ".", "_instance_lock", ":", "if", "message", "is", "None", ":", "Global", ".", "LOGGER", ".", "error", "(", "\"can't deliver a null messages\"", ")", "return", "if", "message", "."...
Dispatch a message using 0mq
[ "Dispatch", "a", "message", "using", "0mq" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/MessageDispatcher.py#L84-L118
train
auto-mat/django-webmap-corpus
webmap/models.py
update_properties_cache
def update_properties_cache(sender, instance, action, reverse, model, pk_set, **kwargs): "Property cache actualization at POI save. It will not work yet after property removal." if action == 'post_add': instance.save_properties_cache()
python
def update_properties_cache(sender, instance, action, reverse, model, pk_set, **kwargs): "Property cache actualization at POI save. It will not work yet after property removal." if action == 'post_add': instance.save_properties_cache()
[ "def", "update_properties_cache", "(", "sender", ",", "instance", ",", "action", ",", "reverse", ",", "model", ",", "pk_set", ",", "**", "kwargs", ")", ":", "\"Property cache actualization at POI save. It will not work yet after property removal.\"", "if", "action", "==",...
Property cache actualization at POI save. It will not work yet after property removal.
[ "Property", "cache", "actualization", "at", "POI", "save", ".", "It", "will", "not", "work", "yet", "after", "property", "removal", "." ]
1d8b7428d2bf3b1165985d767b19677bb6db9eae
https://github.com/auto-mat/django-webmap-corpus/blob/1d8b7428d2bf3b1165985d767b19677bb6db9eae/webmap/models.py#L236-L239
train
maljovec/topopy
topopy/MorseComplex.py
MorseComplex.to_json
def to_json(self): """ Writes the complete Morse complex merge hierarchy to a string object. @ Out, a string object storing the entire merge hierarchy of all maxima. """ capsule = {} capsule["Hierarchy"] = [] for ( dying, ...
python
def to_json(self): """ Writes the complete Morse complex merge hierarchy to a string object. @ Out, a string object storing the entire merge hierarchy of all maxima. """ capsule = {} capsule["Hierarchy"] = [] for ( dying, ...
[ "def", "to_json", "(", "self", ")", ":", "capsule", "=", "{", "}", "capsule", "[", "\"Hierarchy\"", "]", "=", "[", "]", "for", "(", "dying", ",", "(", "persistence", ",", "surviving", ",", "saddle", ")", ",", ")", "in", "self", ".", "merge_sequence",...
Writes the complete Morse complex merge hierarchy to a string object. @ Out, a string object storing the entire merge hierarchy of all maxima.
[ "Writes", "the", "complete", "Morse", "complex", "merge", "hierarchy", "to", "a", "string", "object", "." ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MorseComplex.py#L380-L406
train
redhat-cip/python-dciclient
dciclient/v1/api/jobs_events.py
iter
def iter(context, sequence, limit=10): """Iter to list all the jobs events.""" params = {'limit': limit, 'offset': 0} uri = '%s/%s/%s' % (context.dci_cs_api, RESOURCE, sequence) while True: j = context.session.get(uri, params=params).json() if len(j['jobs_events']): ...
python
def iter(context, sequence, limit=10): """Iter to list all the jobs events.""" params = {'limit': limit, 'offset': 0} uri = '%s/%s/%s' % (context.dci_cs_api, RESOURCE, sequence) while True: j = context.session.get(uri, params=params).json() if len(j['jobs_events']): ...
[ "def", "iter", "(", "context", ",", "sequence", ",", "limit", "=", "10", ")", ":", "params", "=", "{", "'limit'", ":", "limit", ",", "'offset'", ":", "0", "}", "uri", "=", "'%s/%s/%s'", "%", "(", "context", ".", "dci_cs_api", ",", "RESOURCE", ",", ...
Iter to list all the jobs events.
[ "Iter", "to", "list", "all", "the", "jobs", "events", "." ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/jobs_events.py#L30-L43
train
redhat-cip/python-dciclient
dciclient/v1/api/jobs_events.py
delete
def delete(context, sequence): """Delete jobs events from a given sequence""" uri = '%s/%s/%s' % (context.dci_cs_api, RESOURCE, sequence) return context.session.delete(uri)
python
def delete(context, sequence): """Delete jobs events from a given sequence""" uri = '%s/%s/%s' % (context.dci_cs_api, RESOURCE, sequence) return context.session.delete(uri)
[ "def", "delete", "(", "context", ",", "sequence", ")", ":", "uri", "=", "'%s/%s/%s'", "%", "(", "context", ".", "dci_cs_api", ",", "RESOURCE", ",", "sequence", ")", "return", "context", ".", "session", ".", "delete", "(", "uri", ")" ]
Delete jobs events from a given sequence
[ "Delete", "jobs", "events", "from", "a", "given", "sequence" ]
a4aa5899062802bbe4c30a075d8447f8d222d214
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/api/jobs_events.py#L46-L49
train
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/config.py
_LDAPConfig.get_ldap
def get_ldap(cls, global_options=None): """ Returns the ldap module. The unit test harness will assign a mock object to _LDAPConfig.ldap. It is imperative that the ldap module not be imported anywhere else so that the unit tests will pass in the absence of python-ldap. ""...
python
def get_ldap(cls, global_options=None): """ Returns the ldap module. The unit test harness will assign a mock object to _LDAPConfig.ldap. It is imperative that the ldap module not be imported anywhere else so that the unit tests will pass in the absence of python-ldap. ""...
[ "def", "get_ldap", "(", "cls", ",", "global_options", "=", "None", ")", ":", "if", "cls", ".", "ldap", "is", "None", ":", "import", "ldap", ".", "filter", "try", ":", "import", "ldap", ".", "dn", "except", "ImportError", ":", "from", "django_auth_ldap", ...
Returns the ldap module. The unit test harness will assign a mock object to _LDAPConfig.ldap. It is imperative that the ldap module not be imported anywhere else so that the unit tests will pass in the absence of python-ldap.
[ "Returns", "the", "ldap", "module", ".", "The", "unit", "test", "harness", "will", "assign", "a", "mock", "object", "to", "_LDAPConfig", ".", "ldap", ".", "It", "is", "imperative", "that", "the", "ldap", "module", "not", "be", "imported", "anywhere", "else...
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/config.py#L52-L78
train
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/config.py
LDAPSearch._begin
def _begin(self, connection, filterargs=(), escape=True): """ Begins an asynchronous search and returns the message id to retrieve the results. filterargs is an object that will be used for expansion of the filter string. If escape is True, values in filterargs will be escaped. ...
python
def _begin(self, connection, filterargs=(), escape=True): """ Begins an asynchronous search and returns the message id to retrieve the results. filterargs is an object that will be used for expansion of the filter string. If escape is True, values in filterargs will be escaped. ...
[ "def", "_begin", "(", "self", ",", "connection", ",", "filterargs", "=", "(", ")", ",", "escape", "=", "True", ")", ":", "if", "escape", ":", "filterargs", "=", "self", ".", "_escape_filterargs", "(", "filterargs", ")", "try", ":", "filterstr", "=", "s...
Begins an asynchronous search and returns the message id to retrieve the results. filterargs is an object that will be used for expansion of the filter string. If escape is True, values in filterargs will be escaped.
[ "Begins", "an", "asynchronous", "search", "and", "returns", "the", "message", "id", "to", "retrieve", "the", "results", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/config.py#L170-L191
train
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/config.py
LDAPSearch._results
def _results(self, connection, msgid): """ Returns the result of a previous asynchronous query. """ try: kind, results = connection.result(msgid) if kind != ldap.RES_SEARCH_RESULT: results = [] except ldap.LDAPError as e: result...
python
def _results(self, connection, msgid): """ Returns the result of a previous asynchronous query. """ try: kind, results = connection.result(msgid) if kind != ldap.RES_SEARCH_RESULT: results = [] except ldap.LDAPError as e: result...
[ "def", "_results", "(", "self", ",", "connection", ",", "msgid", ")", ":", "try", ":", "kind", ",", "results", "=", "connection", ".", "result", "(", "msgid", ")", "if", "kind", "!=", "ldap", ".", "RES_SEARCH_RESULT", ":", "results", "=", "[", "]", "...
Returns the result of a previous asynchronous query.
[ "Returns", "the", "result", "of", "a", "previous", "asynchronous", "query", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/config.py#L193-L205
train
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/config.py
LDAPSearch._escape_filterargs
def _escape_filterargs(self, filterargs): """ Escapes values in filterargs. filterargs is a value suitable for Django's string formatting operator (%), which means it's either a tuple or a dict. This return a new tuple or dict with all values escaped for use in filter strings. ...
python
def _escape_filterargs(self, filterargs): """ Escapes values in filterargs. filterargs is a value suitable for Django's string formatting operator (%), which means it's either a tuple or a dict. This return a new tuple or dict with all values escaped for use in filter strings. ...
[ "def", "_escape_filterargs", "(", "self", ",", "filterargs", ")", ":", "if", "isinstance", "(", "filterargs", ",", "tuple", ")", ":", "filterargs", "=", "tuple", "(", "self", ".", "ldap", ".", "filter", ".", "escape_filter_chars", "(", "value", ")", "for",...
Escapes values in filterargs. filterargs is a value suitable for Django's string formatting operator (%), which means it's either a tuple or a dict. This return a new tuple or dict with all values escaped for use in filter strings.
[ "Escapes", "values", "in", "filterargs", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/config.py#L207-L225
train
DheerendraRathor/django-auth-ldap-ng
django_auth_ldap/config.py
LDAPSearch._process_results
def _process_results(self, results): """ Returns a sanitized copy of raw LDAP results. This scrubs out references, decodes utf8, normalizes DNs, etc. """ results = [r for r in results if r[0] is not None] results = _DeepStringCoder('utf-8').decode(results) # The ...
python
def _process_results(self, results): """ Returns a sanitized copy of raw LDAP results. This scrubs out references, decodes utf8, normalizes DNs, etc. """ results = [r for r in results if r[0] is not None] results = _DeepStringCoder('utf-8').decode(results) # The ...
[ "def", "_process_results", "(", "self", ",", "results", ")", ":", "results", "=", "[", "r", "for", "r", "in", "results", "if", "r", "[", "0", "]", "is", "not", "None", "]", "results", "=", "_DeepStringCoder", "(", "'utf-8'", ")", ".", "decode", "(", ...
Returns a sanitized copy of raw LDAP results. This scrubs out references, decodes utf8, normalizes DNs, etc.
[ "Returns", "a", "sanitized", "copy", "of", "raw", "LDAP", "results", ".", "This", "scrubs", "out", "references", "decodes", "utf8", "normalizes", "DNs", "etc", "." ]
4d2458bd90c4539353c5bfd5ea793c1e59780ee8
https://github.com/DheerendraRathor/django-auth-ldap-ng/blob/4d2458bd90c4539353c5bfd5ea793c1e59780ee8/django_auth_ldap/config.py#L227-L243
train
ehansis/ozelot
ozelot/client.py
Client.get_connection_string
def get_connection_string(params, hide_password=True): """Get a database connection string Args: params (dict): database configuration, as defined in :mod:`ozelot.config` hide_password (bool): if True, the password is hidden in the returned string (use this for l...
python
def get_connection_string(params, hide_password=True): """Get a database connection string Args: params (dict): database configuration, as defined in :mod:`ozelot.config` hide_password (bool): if True, the password is hidden in the returned string (use this for l...
[ "def", "get_connection_string", "(", "params", ",", "hide_password", "=", "True", ")", ":", "connection_string", "=", "params", "[", "'driver'", "]", "+", "'://'", "user", "=", "params", ".", "get", "(", "'user'", ",", "None", ")", "password", "=", "params...
Get a database connection string Args: params (dict): database configuration, as defined in :mod:`ozelot.config` hide_password (bool): if True, the password is hidden in the returned string (use this for logging purposes). Returns: str: connection st...
[ "Get", "a", "database", "connection", "string" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/client.py#L133-L187
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.pubticker
def pubticker(self, symbol='btcusd'): """Send a request for latest ticker info, return the response.""" url = self.base_url + '/v1/pubticker/' + symbol return requests.get(url)
python
def pubticker(self, symbol='btcusd'): """Send a request for latest ticker info, return the response.""" url = self.base_url + '/v1/pubticker/' + symbol return requests.get(url)
[ "def", "pubticker", "(", "self", ",", "symbol", "=", "'btcusd'", ")", ":", "url", "=", "self", ".", "base_url", "+", "'/v1/pubticker/'", "+", "symbol", "return", "requests", ".", "get", "(", "url", ")" ]
Send a request for latest ticker info, return the response.
[ "Send", "a", "request", "for", "latest", "ticker", "info", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L50-L54
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.book
def book(self, symbol='btcusd', limit_bids=0, limit_asks=0): """ Send a request to get the public order book, return the response. Arguments: symbol -- currency symbol (default 'btcusd') limit_bids -- limit the number of bids returned (default 0) limit_asks -- limit the ...
python
def book(self, symbol='btcusd', limit_bids=0, limit_asks=0): """ Send a request to get the public order book, return the response. Arguments: symbol -- currency symbol (default 'btcusd') limit_bids -- limit the number of bids returned (default 0) limit_asks -- limit the ...
[ "def", "book", "(", "self", ",", "symbol", "=", "'btcusd'", ",", "limit_bids", "=", "0", ",", "limit_asks", "=", "0", ")", ":", "url", "=", "self", ".", "base_url", "+", "'/v1/book/'", "+", "symbol", "params", "=", "{", "'limit_bids'", ":", "limit_bids...
Send a request to get the public order book, return the response. Arguments: symbol -- currency symbol (default 'btcusd') limit_bids -- limit the number of bids returned (default 0) limit_asks -- limit the number of asks returned (default 0)
[ "Send", "a", "request", "to", "get", "the", "public", "order", "book", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L56-L71
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.trades
def trades(self, symbol='btcusd', since=0, limit_trades=50, include_breaks=0): """ Send a request to get all public trades, return the response. Arguments: symbol -- currency symbol (default 'btcusd') since -- only return trades after this unix timestamp (default ...
python
def trades(self, symbol='btcusd', since=0, limit_trades=50, include_breaks=0): """ Send a request to get all public trades, return the response. Arguments: symbol -- currency symbol (default 'btcusd') since -- only return trades after this unix timestamp (default ...
[ "def", "trades", "(", "self", ",", "symbol", "=", "'btcusd'", ",", "since", "=", "0", ",", "limit_trades", "=", "50", ",", "include_breaks", "=", "0", ")", ":", "url", "=", "self", ".", "base_url", "+", "'/v1/trades/'", "+", "symbol", "params", "=", ...
Send a request to get all public trades, return the response. Arguments: symbol -- currency symbol (default 'btcusd') since -- only return trades after this unix timestamp (default 0) limit_trades -- maximum number of trades to return (default 50). include_breaks -- whether to d...
[ "Send", "a", "request", "to", "get", "all", "public", "trades", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L73-L91
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.auction
def auction(self, symbol='btcusd'): """Send a request for latest auction info, return the response.""" url = self.base_url + '/v1/auction/' + symbol return requests.get(url)
python
def auction(self, symbol='btcusd'): """Send a request for latest auction info, return the response.""" url = self.base_url + '/v1/auction/' + symbol return requests.get(url)
[ "def", "auction", "(", "self", ",", "symbol", "=", "'btcusd'", ")", ":", "url", "=", "self", ".", "base_url", "+", "'/v1/auction/'", "+", "symbol", "return", "requests", ".", "get", "(", "url", ")" ]
Send a request for latest auction info, return the response.
[ "Send", "a", "request", "for", "latest", "auction", "info", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L93-L97
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.auction_history
def auction_history(self, symbol='btcusd', since=0, limit_auction_results=50, include_indicative=1): """ Send a request for auction history info, return the response. Arguments: symbol -- currency symbol (default 'btcusd') since -- only return auction eve...
python
def auction_history(self, symbol='btcusd', since=0, limit_auction_results=50, include_indicative=1): """ Send a request for auction history info, return the response. Arguments: symbol -- currency symbol (default 'btcusd') since -- only return auction eve...
[ "def", "auction_history", "(", "self", ",", "symbol", "=", "'btcusd'", ",", "since", "=", "0", ",", "limit_auction_results", "=", "50", ",", "include_indicative", "=", "1", ")", ":", "url", "=", "self", ".", "base_url", "+", "'/v1/auction/'", "+", "symbol"...
Send a request for auction history info, return the response. Arguments: symbol -- currency symbol (default 'btcusd') since -- only return auction events after this timestamp (default 0) limit_auction_results -- maximum number of auction events to return ...
[ "Send", "a", "request", "for", "auction", "history", "info", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L99-L119
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.new_order
def new_order(self, amount, price, side, client_order_id=None, symbol='btcusd', type='exchange limit', options=None): """ Send a request to place an order, return the response. Arguments: amount -- quoted decimal amount of BTC to purchase price -- quoted decima...
python
def new_order(self, amount, price, side, client_order_id=None, symbol='btcusd', type='exchange limit', options=None): """ Send a request to place an order, return the response. Arguments: amount -- quoted decimal amount of BTC to purchase price -- quoted decima...
[ "def", "new_order", "(", "self", ",", "amount", ",", "price", ",", "side", ",", "client_order_id", "=", "None", ",", "symbol", "=", "'btcusd'", ",", "type", "=", "'exchange limit'", ",", "options", "=", "None", ")", ":", "request", "=", "'/v1/order/new'", ...
Send a request to place an order, return the response. Arguments: amount -- quoted decimal amount of BTC to purchase price -- quoted decimal amount of USD to spend per BTC side -- 'buy' or 'sell' client_order_id -- an optional client-specified order id (default None) sym...
[ "Send", "a", "request", "to", "place", "an", "order", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L122-L153
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.cancel_order
def cancel_order(self, order_id): """ Send a request to cancel an order, return the response. Arguments: order_id - the order id to cancel """ request = '/v1/order/cancel' url = self.base_url + request params = { 'request': request, ...
python
def cancel_order(self, order_id): """ Send a request to cancel an order, return the response. Arguments: order_id - the order id to cancel """ request = '/v1/order/cancel' url = self.base_url + request params = { 'request': request, ...
[ "def", "cancel_order", "(", "self", ",", "order_id", ")", ":", "request", "=", "'/v1/order/cancel'", "url", "=", "self", ".", "base_url", "+", "request", "params", "=", "{", "'request'", ":", "request", ",", "'nonce'", ":", "self", ".", "get_nonce", "(", ...
Send a request to cancel an order, return the response. Arguments: order_id - the order id to cancel
[ "Send", "a", "request", "to", "cancel", "an", "order", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L155-L170
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.past_trades
def past_trades(self, symbol='btcusd', limit_trades=50, timestamp=0): """ Send a trade history request, return the response. Arguements: symbol -- currency symbol (default 'btcusd') limit_trades -- maximum number of trades to return (default 50) timestamp -- only return ...
python
def past_trades(self, symbol='btcusd', limit_trades=50, timestamp=0): """ Send a trade history request, return the response. Arguements: symbol -- currency symbol (default 'btcusd') limit_trades -- maximum number of trades to return (default 50) timestamp -- only return ...
[ "def", "past_trades", "(", "self", ",", "symbol", "=", "'btcusd'", ",", "limit_trades", "=", "50", ",", "timestamp", "=", "0", ")", ":", "request", "=", "'/v1/mytrades'", "url", "=", "self", ".", "base_url", "+", "request", "params", "=", "{", "'request'...
Send a trade history request, return the response. Arguements: symbol -- currency symbol (default 'btcusd') limit_trades -- maximum number of trades to return (default 50) timestamp -- only return trades after this unix timestamp (default 0)
[ "Send", "a", "trade", "history", "request", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L222-L241
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.tradevolume
def tradevolume(self): """Send a request to get your trade volume, return the response.""" request = '/v1/tradevolume' url = self.base_url + request params = { 'request': request, 'nonce': self.get_nonce() } return requests.post(url, headers=self....
python
def tradevolume(self): """Send a request to get your trade volume, return the response.""" request = '/v1/tradevolume' url = self.base_url + request params = { 'request': request, 'nonce': self.get_nonce() } return requests.post(url, headers=self....
[ "def", "tradevolume", "(", "self", ")", ":", "request", "=", "'/v1/tradevolume'", "url", "=", "self", ".", "base_url", "+", "request", "params", "=", "{", "'request'", ":", "request", ",", "'nonce'", ":", "self", ".", "get_nonce", "(", ")", "}", "return"...
Send a request to get your trade volume, return the response.
[ "Send", "a", "request", "to", "get", "your", "trade", "volume", "return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L243-L252
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.newAddress
def newAddress(self, currency='btc', label=''): """ Send a request for a new cryptocurrency deposit address with an optional label. Return the response. Arguements: currency -- a Gemini supported cryptocurrency (btc, eth) label -- optional label for the deposit address ...
python
def newAddress(self, currency='btc', label=''): """ Send a request for a new cryptocurrency deposit address with an optional label. Return the response. Arguements: currency -- a Gemini supported cryptocurrency (btc, eth) label -- optional label for the deposit address ...
[ "def", "newAddress", "(", "self", ",", "currency", "=", "'btc'", ",", "label", "=", "''", ")", ":", "request", "=", "'/v1/deposit/'", "+", "currency", "+", "'/newAddress'", "url", "=", "self", ".", "base_url", "+", "request", "params", "=", "{", "'reques...
Send a request for a new cryptocurrency deposit address with an optional label. Return the response. Arguements: currency -- a Gemini supported cryptocurrency (btc, eth) label -- optional label for the deposit address
[ "Send", "a", "request", "for", "a", "new", "cryptocurrency", "deposit", "address", "with", "an", "optional", "label", ".", "Return", "the", "response", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L265-L284
train
geminipy/geminipy
geminipy/__init__.py
Geminipy.prepare
def prepare(self, params): """ Prepare, return the required HTTP headers. Base 64 encode the parameters, sign it with the secret key, create the HTTP headers, return the whole payload. Arguments: params -- a dictionary of parameters """ jsonparams = json...
python
def prepare(self, params): """ Prepare, return the required HTTP headers. Base 64 encode the parameters, sign it with the secret key, create the HTTP headers, return the whole payload. Arguments: params -- a dictionary of parameters """ jsonparams = json...
[ "def", "prepare", "(", "self", ",", "params", ")", ":", "jsonparams", "=", "json", ".", "dumps", "(", "params", ")", "payload", "=", "base64", ".", "b64encode", "(", "jsonparams", ".", "encode", "(", ")", ")", "signature", "=", "hmac", ".", "new", "(...
Prepare, return the required HTTP headers. Base 64 encode the parameters, sign it with the secret key, create the HTTP headers, return the whole payload. Arguments: params -- a dictionary of parameters
[ "Prepare", "return", "the", "required", "HTTP", "headers", "." ]
0d83fe225b746ac4c8bb800aa6091e1b606231e8
https://github.com/geminipy/geminipy/blob/0d83fe225b746ac4c8bb800aa6091e1b606231e8/geminipy/__init__.py#L301-L318
train
kataev/flake8-rst
flake8_rst/sourceblock.py
SourceBlock.merge
def merge(cls, source_blocks): """Merge multiple SourceBlocks together""" if len(source_blocks) == 1: return source_blocks[0] source_blocks.sort(key=operator.attrgetter('start_line_number')) main_block = source_blocks[0] boot_lines = main_block.boot_lines so...
python
def merge(cls, source_blocks): """Merge multiple SourceBlocks together""" if len(source_blocks) == 1: return source_blocks[0] source_blocks.sort(key=operator.attrgetter('start_line_number')) main_block = source_blocks[0] boot_lines = main_block.boot_lines so...
[ "def", "merge", "(", "cls", ",", "source_blocks", ")", ":", "if", "len", "(", "source_blocks", ")", "==", "1", ":", "return", "source_blocks", "[", "0", "]", "source_blocks", ".", "sort", "(", "key", "=", "operator", ".", "attrgetter", "(", "'start_line_...
Merge multiple SourceBlocks together
[ "Merge", "multiple", "SourceBlocks", "together" ]
ca6d41c7a309b9e8cd4fa6f428b82db96b6a986f
https://github.com/kataev/flake8-rst/blob/ca6d41c7a309b9e8cd4fa6f428b82db96b6a986f/flake8_rst/sourceblock.py#L72-L84
train
ehansis/ozelot
examples/superheroes/superheroes/analysis.py
character_summary_table
def character_summary_table(): """Export a table listing all characters and their data Output is a CSV file and an Excel file, saved as 'characters.csv/.xlsx' in the output directory. """ # a database client/session to run queries in cl = client.get_client() session = cl.create_session() #...
python
def character_summary_table(): """Export a table listing all characters and their data Output is a CSV file and an Excel file, saved as 'characters.csv/.xlsx' in the output directory. """ # a database client/session to run queries in cl = client.get_client() session = cl.create_session() #...
[ "def", "character_summary_table", "(", ")", ":", "cl", "=", "client", ".", "get_client", "(", ")", "session", "=", "cl", ".", "create_session", "(", ")", "query", "=", "session", ".", "query", "(", "models", ".", "Character", ",", "models", ".", "Univers...
Export a table listing all characters and their data Output is a CSV file and an Excel file, saved as 'characters.csv/.xlsx' in the output directory.
[ "Export", "a", "table", "listing", "all", "characters", "and", "their", "data" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/analysis.py#L24-L63
train
ehansis/ozelot
examples/superheroes/superheroes/analysis.py
fig_to_svg
def fig_to_svg(fig): """Helper function to convert matplotlib figure to SVG string Returns: str: figure as SVG string """ buf = io.StringIO() fig.savefig(buf, format='svg') buf.seek(0) return buf.getvalue()
python
def fig_to_svg(fig): """Helper function to convert matplotlib figure to SVG string Returns: str: figure as SVG string """ buf = io.StringIO() fig.savefig(buf, format='svg') buf.seek(0) return buf.getvalue()
[ "def", "fig_to_svg", "(", "fig", ")", ":", "buf", "=", "io", ".", "StringIO", "(", ")", "fig", ".", "savefig", "(", "buf", ",", "format", "=", "'svg'", ")", "buf", ".", "seek", "(", "0", ")", "return", "buf", ".", "getvalue", "(", ")" ]
Helper function to convert matplotlib figure to SVG string Returns: str: figure as SVG string
[ "Helper", "function", "to", "convert", "matplotlib", "figure", "to", "SVG", "string" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/analysis.py#L66-L75
train
ehansis/ozelot
examples/superheroes/superheroes/analysis.py
movie_network
def movie_network(): """Generate interactive network graph of movie appearances Output is an html page, rendered to 'movie_network.html' in the output directory. """ # page template template = jenv.get_template("movie_network.html") # container for template context context = dict() # ...
python
def movie_network(): """Generate interactive network graph of movie appearances Output is an html page, rendered to 'movie_network.html' in the output directory. """ # page template template = jenv.get_template("movie_network.html") # container for template context context = dict() # ...
[ "def", "movie_network", "(", ")", ":", "template", "=", "jenv", ".", "get_template", "(", "\"movie_network.html\"", ")", "context", "=", "dict", "(", ")", "cl", "=", "client", ".", "get_client", "(", ")", "session", "=", "cl", ".", "create_session", "(", ...
Generate interactive network graph of movie appearances Output is an html page, rendered to 'movie_network.html' in the output directory.
[ "Generate", "interactive", "network", "graph", "of", "movie", "appearances" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/analysis.py#L204-L298
train
maljovec/topopy
docs/_static/logo_generator.py
unpack2D
def unpack2D(_x): """ Helper function for splitting 2D data into x and y component to make equations simpler """ _x = np.atleast_2d(_x) x = _x[:, 0] y = _x[:, 1] return x, y
python
def unpack2D(_x): """ Helper function for splitting 2D data into x and y component to make equations simpler """ _x = np.atleast_2d(_x) x = _x[:, 0] y = _x[:, 1] return x, y
[ "def", "unpack2D", "(", "_x", ")", ":", "_x", "=", "np", ".", "atleast_2d", "(", "_x", ")", "x", "=", "_x", "[", ":", ",", "0", "]", "y", "=", "_x", "[", ":", ",", "1", "]", "return", "x", ",", "y" ]
Helper function for splitting 2D data into x and y component to make equations simpler
[ "Helper", "function", "for", "splitting", "2D", "data", "into", "x", "and", "y", "component", "to", "make", "equations", "simpler" ]
4be598d51c4e4043b73d4ad44beed6d289e2f088
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/docs/_static/logo_generator.py#L48-L56
train
albertz/py_better_exchook
better_exchook.py
is_at_exit
def is_at_exit(): """ Some heuristics to figure out whether this is called at a stage where the Python interpreter is shutting down. :return: whether the Python interpreter is currently in the process of shutting down :rtype: bool """ if _threading_main_thread is not None: if not hasatt...
python
def is_at_exit(): """ Some heuristics to figure out whether this is called at a stage where the Python interpreter is shutting down. :return: whether the Python interpreter is currently in the process of shutting down :rtype: bool """ if _threading_main_thread is not None: if not hasatt...
[ "def", "is_at_exit", "(", ")", ":", "if", "_threading_main_thread", "is", "not", "None", ":", "if", "not", "hasattr", "(", "threading", ",", "\"main_thread\"", ")", ":", "return", "True", "if", "threading", ".", "main_thread", "(", ")", "!=", "_threading_mai...
Some heuristics to figure out whether this is called at a stage where the Python interpreter is shutting down. :return: whether the Python interpreter is currently in the process of shutting down :rtype: bool
[ "Some", "heuristics", "to", "figure", "out", "whether", "this", "is", "called", "at", "a", "stage", "where", "the", "Python", "interpreter", "is", "shutting", "down", "." ]
3d524a027d7fc4e83e47e39a1978849561da69b3
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L836-L850
train
albertz/py_better_exchook
better_exchook.py
better_exchook
def better_exchook(etype, value, tb, debugshell=False, autodebugshell=True, file=None, with_color=None): """ Replacement for sys.excepthook. :param etype: exception type :param value: exception value :param tb: traceback :param bool debugshell: spawn a debug shell at the context of the exceptio...
python
def better_exchook(etype, value, tb, debugshell=False, autodebugshell=True, file=None, with_color=None): """ Replacement for sys.excepthook. :param etype: exception type :param value: exception value :param tb: traceback :param bool debugshell: spawn a debug shell at the context of the exceptio...
[ "def", "better_exchook", "(", "etype", ",", "value", ",", "tb", ",", "debugshell", "=", "False", ",", "autodebugshell", "=", "True", ",", "file", "=", "None", ",", "with_color", "=", "None", ")", ":", "if", "file", "is", "None", ":", "file", "=", "sy...
Replacement for sys.excepthook. :param etype: exception type :param value: exception value :param tb: traceback :param bool debugshell: spawn a debug shell at the context of the exception :param bool autodebugshell: if env DEBUG is an integer != 0, it will spawn a debug shell :param io.TextIOBa...
[ "Replacement", "for", "sys", ".", "excepthook", "." ]
3d524a027d7fc4e83e47e39a1978849561da69b3
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L1173-L1244
train
albertz/py_better_exchook
better_exchook.py
dump_all_thread_tracebacks
def dump_all_thread_tracebacks(exclude_thread_ids=None, file=None): """ Prints the traceback of all threads. :param set[int]|list[int]|None exclude_thread_ids: threads to exclude :param io.TextIOBase|io.StringIO file: output stream """ if exclude_thread_ids is None: exclude_thread_ids =...
python
def dump_all_thread_tracebacks(exclude_thread_ids=None, file=None): """ Prints the traceback of all threads. :param set[int]|list[int]|None exclude_thread_ids: threads to exclude :param io.TextIOBase|io.StringIO file: output stream """ if exclude_thread_ids is None: exclude_thread_ids =...
[ "def", "dump_all_thread_tracebacks", "(", "exclude_thread_ids", "=", "None", ",", "file", "=", "None", ")", ":", "if", "exclude_thread_ids", "is", "None", ":", "exclude_thread_ids", "=", "[", "]", "if", "not", "file", ":", "file", "=", "sys", ".", "stdout", ...
Prints the traceback of all threads. :param set[int]|list[int]|None exclude_thread_ids: threads to exclude :param io.TextIOBase|io.StringIO file: output stream
[ "Prints", "the", "traceback", "of", "all", "threads", "." ]
3d524a027d7fc4e83e47e39a1978849561da69b3
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L1247-L1289
train
albertz/py_better_exchook
better_exchook.py
_main
def _main(): """ Some demo. """ if sys.argv[1:] == ["test"]: for k, v in sorted(globals().items()): if not k.startswith("test_"): continue print("running: %s()" % k) v() print("ok.") sys.exit() elif sys.argv[1:] == ["debug...
python
def _main(): """ Some demo. """ if sys.argv[1:] == ["test"]: for k, v in sorted(globals().items()): if not k.startswith("test_"): continue print("running: %s()" % k) v() print("ok.") sys.exit() elif sys.argv[1:] == ["debug...
[ "def", "_main", "(", ")", ":", "if", "sys", ".", "argv", "[", "1", ":", "]", "==", "[", "\"test\"", "]", ":", "for", "k", ",", "v", "in", "sorted", "(", "globals", "(", ")", ".", "items", "(", ")", ")", ":", "if", "not", "k", ".", "startswi...
Some demo.
[ "Some", "demo", "." ]
3d524a027d7fc4e83e47e39a1978849561da69b3
https://github.com/albertz/py_better_exchook/blob/3d524a027d7fc4e83e47e39a1978849561da69b3/better_exchook.py#L1502-L1586
train
thorgate/django-esteid
esteid/signature.py
verify_mid_signature
def verify_mid_signature(certificate_data, sp_challenge, response_challenge, signature): """ Verify mobile id Authentication signature is valid :param certificate_data: binary certificate data, from 'CertificateData' field :param sp_challenge: binary challenge sent via 'SPChallenge' field :param respon...
python
def verify_mid_signature(certificate_data, sp_challenge, response_challenge, signature): """ Verify mobile id Authentication signature is valid :param certificate_data: binary certificate data, from 'CertificateData' field :param sp_challenge: binary challenge sent via 'SPChallenge' field :param respon...
[ "def", "verify_mid_signature", "(", "certificate_data", ",", "sp_challenge", ",", "response_challenge", ",", "signature", ")", ":", "if", "not", "response_challenge", ".", "startswith", "(", "sp_challenge", ")", ":", "return", "False", "try", ":", "key", "=", "R...
Verify mobile id Authentication signature is valid :param certificate_data: binary certificate data, from 'CertificateData' field :param sp_challenge: binary challenge sent via 'SPChallenge' field :param response_challenge: response challenge, from 'Challenge' field :param signature: response signature...
[ "Verify", "mobile", "id", "Authentication", "signature", "is", "valid" ]
407ae513e357fedea0e3e42198df8eb9d9ff0646
https://github.com/thorgate/django-esteid/blob/407ae513e357fedea0e3e42198df8eb9d9ff0646/esteid/signature.py#L23-L52
train
untwisted/untwisted
untwisted/dispatcher.py
Dispatcher.drive
def drive(self, event, *args): """ Used to dispatch events. """ maps = self.base.get(event, self.step) for handle, data in maps[:]: params = args + data try: handle(self, *params) except Stop: break ...
python
def drive(self, event, *args): """ Used to dispatch events. """ maps = self.base.get(event, self.step) for handle, data in maps[:]: params = args + data try: handle(self, *params) except Stop: break ...
[ "def", "drive", "(", "self", ",", "event", ",", "*", "args", ")", ":", "maps", "=", "self", ".", "base", ".", "get", "(", "event", ",", "self", ".", "step", ")", "for", "handle", ",", "data", "in", "maps", "[", ":", "]", ":", "params", "=", "...
Used to dispatch events.
[ "Used", "to", "dispatch", "events", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/dispatcher.py#L16-L38
train
untwisted/untwisted
untwisted/expect.py
Expect.send
def send(self, data): """ Send data to the child process through. """ self.stdin.write(data) self.stdin.flush()
python
def send(self, data): """ Send data to the child process through. """ self.stdin.write(data) self.stdin.flush()
[ "def", "send", "(", "self", ",", "data", ")", ":", "self", ".", "stdin", ".", "write", "(", "data", ")", "self", ".", "stdin", ".", "flush", "(", ")" ]
Send data to the child process through.
[ "Send", "data", "to", "the", "child", "process", "through", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/expect.py#L43-L48
train
potash/drain
drain/step.py
_simplify_arguments
def _simplify_arguments(arguments): """ If positional or keyword arguments are empty return only one or the other. """ if len(arguments.args) == 0: return arguments.kwargs elif len(arguments.kwargs) == 0: return arguments.args else: return arguments
python
def _simplify_arguments(arguments): """ If positional or keyword arguments are empty return only one or the other. """ if len(arguments.args) == 0: return arguments.kwargs elif len(arguments.kwargs) == 0: return arguments.args else: return arguments
[ "def", "_simplify_arguments", "(", "arguments", ")", ":", "if", "len", "(", "arguments", ".", "args", ")", "==", "0", ":", "return", "arguments", ".", "kwargs", "elif", "len", "(", "arguments", ".", "kwargs", ")", "==", "0", ":", "return", "arguments", ...
If positional or keyword arguments are empty return only one or the other.
[ "If", "positional", "or", "keyword", "arguments", "are", "empty", "return", "only", "one", "or", "the", "other", "." ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/step.py#L310-L319
train
potash/drain
drain/step.py
Step.load
def load(self): """ Load this step's result from its dump directory """ hdf_filename = os.path.join(self._dump_dirname, 'result.h5') if os.path.isfile(hdf_filename): store = pd.HDFStore(hdf_filename, mode='r') keys = store.keys() if keys == ['/...
python
def load(self): """ Load this step's result from its dump directory """ hdf_filename = os.path.join(self._dump_dirname, 'result.h5') if os.path.isfile(hdf_filename): store = pd.HDFStore(hdf_filename, mode='r') keys = store.keys() if keys == ['/...
[ "def", "load", "(", "self", ")", ":", "hdf_filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_dump_dirname", ",", "'result.h5'", ")", "if", "os", ".", "path", ".", "isfile", "(", "hdf_filename", ")", ":", "store", "=", "pd", ".", "...
Load this step's result from its dump directory
[ "Load", "this", "step", "s", "result", "from", "its", "dump", "directory" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/step.py#L211-L230
train
potash/drain
drain/step.py
Step.setup_dump
def setup_dump(self): """ Set up dump, creating directories and writing step.yaml file containing yaml dump of this step. {drain.PATH}/{self._digest}/ step.yaml dump/ """ dumpdir = self._dump_dirname if not os.path.isdir(dumpdir): ...
python
def setup_dump(self): """ Set up dump, creating directories and writing step.yaml file containing yaml dump of this step. {drain.PATH}/{self._digest}/ step.yaml dump/ """ dumpdir = self._dump_dirname if not os.path.isdir(dumpdir): ...
[ "def", "setup_dump", "(", "self", ")", ":", "dumpdir", "=", "self", ".", "_dump_dirname", "if", "not", "os", ".", "path", ".", "isdir", "(", "dumpdir", ")", ":", "os", ".", "makedirs", "(", "dumpdir", ")", "dump", "=", "False", "yaml_filename", "=", ...
Set up dump, creating directories and writing step.yaml file containing yaml dump of this step. {drain.PATH}/{self._digest}/ step.yaml dump/
[ "Set", "up", "dump", "creating", "directories", "and", "writing", "step", ".", "yaml", "file", "containing", "yaml", "dump", "of", "this", "step", "." ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/step.py#L232-L258
train
lsst-sqre/documenteer
documenteer/stackdocs/packagecli.py
main
def main(ctx, root_dir, verbose): """package-docs is a CLI for building single-package previews of documentation in the LSST Stack. Use package-docs during development to quickly preview your documentation and docstrings. .. warning:: Using package-docs to compile standalone documentation ...
python
def main(ctx, root_dir, verbose): """package-docs is a CLI for building single-package previews of documentation in the LSST Stack. Use package-docs during development to quickly preview your documentation and docstrings. .. warning:: Using package-docs to compile standalone documentation ...
[ "def", "main", "(", "ctx", ",", "root_dir", ",", "verbose", ")", ":", "root_dir", "=", "discover_package_doc_dir", "(", "root_dir", ")", "ctx", ".", "obj", "=", "{", "'root_dir'", ":", "root_dir", ",", "'verbose'", ":", "verbose", "}", "if", "verbose", "...
package-docs is a CLI for building single-package previews of documentation in the LSST Stack. Use package-docs during development to quickly preview your documentation and docstrings. .. warning:: Using package-docs to compile standalone documentation for a single package will generate...
[ "package", "-", "docs", "is", "a", "CLI", "for", "building", "single", "-", "package", "previews", "of", "documentation", "in", "the", "LSST", "Stack", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/packagecli.py#L41-L78
train
potash/drain
drain/aggregate.py
ColumnFunction.apply_and_name
def apply_and_name(self, aggregator): """Fetches the row-aggregated input columns for this ColumnFunction. Args: aggregator (Aggregator) Returns: pd.DataFrame: The dataframe has columns with names self.names that were created by this ColumnFunction, ...
python
def apply_and_name(self, aggregator): """Fetches the row-aggregated input columns for this ColumnFunction. Args: aggregator (Aggregator) Returns: pd.DataFrame: The dataframe has columns with names self.names that were created by this ColumnFunction, ...
[ "def", "apply_and_name", "(", "self", ",", "aggregator", ")", ":", "reduced_df", "=", "self", ".", "_apply", "(", "aggregator", ")", "if", "len", "(", "self", ".", "names", ")", "!=", "len", "(", "reduced_df", ".", "columns", ")", ":", "raise", "IndexE...
Fetches the row-aggregated input columns for this ColumnFunction. Args: aggregator (Aggregator) Returns: pd.DataFrame: The dataframe has columns with names self.names that were created by this ColumnFunction, and is indexed by the index that was ...
[ "Fetches", "the", "row", "-", "aggregated", "input", "columns", "for", "this", "ColumnFunction", "." ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/aggregate.py#L106-L122
train
potash/drain
drain/aggregate.py
Aggregator.aggregate
def aggregate(self, index): """Performs a groupby of the unique Columns by index, as constructed from self.df. Args: index (str, or pd.Index): Index or column name of self.df. Returns: pd.DataFrame: A dataframe, aggregated by index, that contains the result ...
python
def aggregate(self, index): """Performs a groupby of the unique Columns by index, as constructed from self.df. Args: index (str, or pd.Index): Index or column name of self.df. Returns: pd.DataFrame: A dataframe, aggregated by index, that contains the result ...
[ "def", "aggregate", "(", "self", ",", "index", ")", ":", "if", "isinstance", "(", "index", ",", "string_types", ")", ":", "col_df_grouped", "=", "self", ".", "col_df", ".", "groupby", "(", "self", ".", "df", "[", "index", "]", ")", "else", ":", "self...
Performs a groupby of the unique Columns by index, as constructed from self.df. Args: index (str, or pd.Index): Index or column name of self.df. Returns: pd.DataFrame: A dataframe, aggregated by index, that contains the result of the various ColumnFunctions, and...
[ "Performs", "a", "groupby", "of", "the", "unique", "Columns", "by", "index", "as", "constructed", "from", "self", ".", "df", "." ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/aggregate.py#L260-L291
train
potash/drain
drain/aggregate.py
Fraction._apply
def _apply(self, aggregator): """Returns a dataframe with the requested ColumnReductions. """ reduced_dfs = [] if self.include_fraction: n_df = self.numerator.apply_and_name(aggregator) d_df = self.denominator.apply_and_name(aggregator) reduced_dfs.ex...
python
def _apply(self, aggregator): """Returns a dataframe with the requested ColumnReductions. """ reduced_dfs = [] if self.include_fraction: n_df = self.numerator.apply_and_name(aggregator) d_df = self.denominator.apply_and_name(aggregator) reduced_dfs.ex...
[ "def", "_apply", "(", "self", ",", "aggregator", ")", ":", "reduced_dfs", "=", "[", "]", "if", "self", ".", "include_fraction", ":", "n_df", "=", "self", ".", "numerator", ".", "apply_and_name", "(", "aggregator", ")", "d_df", "=", "self", ".", "denomina...
Returns a dataframe with the requested ColumnReductions.
[ "Returns", "a", "dataframe", "with", "the", "requested", "ColumnReductions", "." ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/aggregate.py#L350-L367
train
fkarb/xltable
xltable/table.py
Table.clone
def clone(self, **kwargs): """Create a clone of the Table, optionally with some properties changed""" init_kwargs = { "name": self.__name, "dataframe": self.__df, "include_columns": self.__include_columns, "include_index": self.__include_index, ...
python
def clone(self, **kwargs): """Create a clone of the Table, optionally with some properties changed""" init_kwargs = { "name": self.__name, "dataframe": self.__df, "include_columns": self.__include_columns, "include_index": self.__include_index, ...
[ "def", "clone", "(", "self", ",", "**", "kwargs", ")", ":", "init_kwargs", "=", "{", "\"name\"", ":", "self", ".", "__name", ",", "\"dataframe\"", ":", "self", ".", "__df", ",", "\"include_columns\"", ":", "self", ".", "__include_columns", ",", "\"include_...
Create a clone of the Table, optionally with some properties changed
[ "Create", "a", "clone", "of", "the", "Table", "optionally", "with", "some", "properties", "changed" ]
7a592642d27ad5ee90d2aa8c26338abaa9d84bea
https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/table.py#L105-L120
train
mojaie/chorus
chorus/v2000reader.py
inspect
def inspect(lines): """Inspect SDFile list of string Returns: tuple: (data label list, number of records) """ labels = set() count = 0 exp = re.compile(r">.*?<([\w ]+)>") # Space should be accepted valid = False for line in lines: if line.startswith("M END\n"): ...
python
def inspect(lines): """Inspect SDFile list of string Returns: tuple: (data label list, number of records) """ labels = set() count = 0 exp = re.compile(r">.*?<([\w ]+)>") # Space should be accepted valid = False for line in lines: if line.startswith("M END\n"): ...
[ "def", "inspect", "(", "lines", ")", ":", "labels", "=", "set", "(", ")", "count", "=", "0", "exp", "=", "re", ".", "compile", "(", "r\">.*?<([\\w ]+)>\"", ")", "valid", "=", "False", "for", "line", "in", "lines", ":", "if", "line", ".", "startswith"...
Inspect SDFile list of string Returns: tuple: (data label list, number of records)
[ "Inspect", "SDFile", "list", "of", "string" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L17-L39
train
mojaie/chorus
chorus/v2000reader.py
inspect_file
def inspect_file(path): """Inspect SDFile structure Returns: tuple: (data label list, number of records) """ with open(path, 'rb') as f: labels, count = inspect(tx.decode(line) for line in f) return labels, count
python
def inspect_file(path): """Inspect SDFile structure Returns: tuple: (data label list, number of records) """ with open(path, 'rb') as f: labels, count = inspect(tx.decode(line) for line in f) return labels, count
[ "def", "inspect_file", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "labels", ",", "count", "=", "inspect", "(", "tx", ".", "decode", "(", "line", ")", "for", "line", "in", "f", ")", "return", "labels", ",...
Inspect SDFile structure Returns: tuple: (data label list, number of records)
[ "Inspect", "SDFile", "structure" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L49-L57
train
mojaie/chorus
chorus/v2000reader.py
optional_data
def optional_data(lines): """Parse SDFile data part into dict""" data = {} exp = re.compile(r">.*?<([\w ]+)>") # Space should be accepted for i, line in enumerate(lines): result = exp.match(line) if result: data[result.group(1)] = lines[i + 1] return data
python
def optional_data(lines): """Parse SDFile data part into dict""" data = {} exp = re.compile(r">.*?<([\w ]+)>") # Space should be accepted for i, line in enumerate(lines): result = exp.match(line) if result: data[result.group(1)] = lines[i + 1] return data
[ "def", "optional_data", "(", "lines", ")", ":", "data", "=", "{", "}", "exp", "=", "re", ".", "compile", "(", "r\">.*?<([\\w ]+)>\"", ")", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "result", "=", "exp", ".", "match", "(", ...
Parse SDFile data part into dict
[ "Parse", "SDFile", "data", "part", "into", "dict" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L60-L68
train