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
mojaie/chorus
chorus/v2000reader.py
atoms
def atoms(lines): """Parse atom block into atom objects Returns: dict: networkx nodes """ # Convert sdf style charge to actual charge conv_charge_table = {0: 0, 1: 3, 2: 2, 3: 1, 4: 0, 5: -1, 6: -2, 7: -3} results = {} for i, line in enumerate(lines): symbol = line[31:34].rs...
python
def atoms(lines): """Parse atom block into atom objects Returns: dict: networkx nodes """ # Convert sdf style charge to actual charge conv_charge_table = {0: 0, 1: 3, 2: 2, 3: 1, 4: 0, 5: -1, 6: -2, 7: -3} results = {} for i, line in enumerate(lines): symbol = line[31:34].rs...
[ "def", "atoms", "(", "lines", ")", ":", "conv_charge_table", "=", "{", "0", ":", "0", ",", "1", ":", "3", ",", "2", ":", "2", ",", "3", ":", "1", ",", "4", ":", "0", ",", "5", ":", "-", "1", ",", "6", ":", "-", "2", ",", "7", ":", "-"...
Parse atom block into atom objects Returns: dict: networkx nodes
[ "Parse", "atom", "block", "into", "atom", "objects" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L71-L100
train
mojaie/chorus
chorus/v2000reader.py
bonds
def bonds(lines, atoms): """Parse bond block into bond objects Returns: dict: networkx adjacency dict """ # Convert sdf style stereobond (see chem.model.bond.Bond) conv_stereo_table = {0: 0, 1: 1, 3: 3, 4: 3, 6: 2} results = {a: {} for a in atoms} for line in lines: bond = B...
python
def bonds(lines, atoms): """Parse bond block into bond objects Returns: dict: networkx adjacency dict """ # Convert sdf style stereobond (see chem.model.bond.Bond) conv_stereo_table = {0: 0, 1: 1, 3: 3, 4: 3, 6: 2} results = {a: {} for a in atoms} for line in lines: bond = B...
[ "def", "bonds", "(", "lines", ",", "atoms", ")", ":", "conv_stereo_table", "=", "{", "0", ":", "0", ",", "1", ":", "1", ",", "3", ":", "3", ",", "4", ":", "3", ",", "6", ":", "2", "}", "results", "=", "{", "a", ":", "{", "}", "for", "a", ...
Parse bond block into bond objects Returns: dict: networkx adjacency dict
[ "Parse", "bond", "block", "into", "bond", "objects" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L103-L124
train
mojaie/chorus
chorus/v2000reader.py
properties
def properties(lines): """Parse properties block Returns: dict: {property_type: (atom_index, value)} """ results = {} for i, line in enumerate(lines): type_ = line[3:6] if type_ not in ["CHG", "RAD", "ISO"]: continue # Other properties are not supported yet ...
python
def properties(lines): """Parse properties block Returns: dict: {property_type: (atom_index, value)} """ results = {} for i, line in enumerate(lines): type_ = line[3:6] if type_ not in ["CHG", "RAD", "ISO"]: continue # Other properties are not supported yet ...
[ "def", "properties", "(", "lines", ")", ":", "results", "=", "{", "}", "for", "i", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "type_", "=", "line", "[", "3", ":", "6", "]", "if", "type_", "not", "in", "[", "\"CHG\"", ",", "\"RAD\"", ...
Parse properties block Returns: dict: {property_type: (atom_index, value)}
[ "Parse", "properties", "block" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L127-L144
train
mojaie/chorus
chorus/v2000reader.py
add_properties
def add_properties(props, mol): """apply properties to the molecule object Returns: None (alter molecule object directly) """ if not props: return # The properties supersedes all charge and radical values in the atom block for _, atom in mol.atoms_iter(): atom.charge = 0...
python
def add_properties(props, mol): """apply properties to the molecule object Returns: None (alter molecule object directly) """ if not props: return # The properties supersedes all charge and radical values in the atom block for _, atom in mol.atoms_iter(): atom.charge = 0...
[ "def", "add_properties", "(", "props", ",", "mol", ")", ":", "if", "not", "props", ":", "return", "for", "_", ",", "atom", "in", "mol", ".", "atoms_iter", "(", ")", ":", "atom", ".", "charge", "=", "0", "atom", ".", "multi", "=", "1", "atom", "."...
apply properties to the molecule object Returns: None (alter molecule object directly)
[ "apply", "properties", "to", "the", "molecule", "object" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L147-L165
train
mojaie/chorus
chorus/v2000reader.py
molecule
def molecule(lines): """Parse molfile part into molecule object Args: lines (list): lines of molfile part Raises: ValueError: Symbol not defined in periodictable.yaml (Polymer expression not supported yet) """ count_line = lines[3] num_atoms = int(count_line...
python
def molecule(lines): """Parse molfile part into molecule object Args: lines (list): lines of molfile part Raises: ValueError: Symbol not defined in periodictable.yaml (Polymer expression not supported yet) """ count_line = lines[3] num_atoms = int(count_line...
[ "def", "molecule", "(", "lines", ")", ":", "count_line", "=", "lines", "[", "3", "]", "num_atoms", "=", "int", "(", "count_line", "[", "0", ":", "3", "]", ")", "num_bonds", "=", "int", "(", "count_line", "[", "3", ":", "6", "]", ")", "compound", ...
Parse molfile part into molecule object Args: lines (list): lines of molfile part Raises: ValueError: Symbol not defined in periodictable.yaml (Polymer expression not supported yet)
[ "Parse", "molfile", "part", "into", "molecule", "object" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L168-L189
train
mojaie/chorus
chorus/v2000reader.py
mol_supplier
def mol_supplier(lines, no_halt, assign_descriptors): """Yields molecules generated from CTAB text Args: lines (iterable): CTAB text lines no_halt (boolean): True: shows warning messages for invalid format and go on. False: throws an exception for it and stop parsing. ...
python
def mol_supplier(lines, no_halt, assign_descriptors): """Yields molecules generated from CTAB text Args: lines (iterable): CTAB text lines no_halt (boolean): True: shows warning messages for invalid format and go on. False: throws an exception for it and stop parsing. ...
[ "def", "mol_supplier", "(", "lines", ",", "no_halt", ",", "assign_descriptors", ")", ":", "def", "sdf_block", "(", "lns", ")", ":", "mol", "=", "[", "]", "opt", "=", "[", "]", "is_mol", "=", "True", "for", "line", "in", "lns", ":", "if", "line", "....
Yields molecules generated from CTAB text Args: lines (iterable): CTAB text lines no_halt (boolean): True: shows warning messages for invalid format and go on. False: throws an exception for it and stop parsing. assign_descriptors (boolean): if True, defa...
[ "Yields", "molecules", "generated", "from", "CTAB", "text" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L192-L253
train
mojaie/chorus
chorus/v2000reader.py
mols_from_text
def mols_from_text(text, no_halt=True, assign_descriptors=True): """Returns molecules generated from sdfile text Throws: StopIteration: if the text does not have molecule ValueError: if Unsupported symbol is found """ if isinstance(text, bytes): t = tx.decode(text) else: ...
python
def mols_from_text(text, no_halt=True, assign_descriptors=True): """Returns molecules generated from sdfile text Throws: StopIteration: if the text does not have molecule ValueError: if Unsupported symbol is found """ if isinstance(text, bytes): t = tx.decode(text) else: ...
[ "def", "mols_from_text", "(", "text", ",", "no_halt", "=", "True", ",", "assign_descriptors", "=", "True", ")", ":", "if", "isinstance", "(", "text", ",", "bytes", ")", ":", "t", "=", "tx", ".", "decode", "(", "text", ")", "else", ":", "t", "=", "t...
Returns molecules generated from sdfile text Throws: StopIteration: if the text does not have molecule ValueError: if Unsupported symbol is found
[ "Returns", "molecules", "generated", "from", "sdfile", "text" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L256-L271
train
mojaie/chorus
chorus/v2000reader.py
mol_from_text
def mol_from_text(text, assign_descriptors=True): """Parse CTAB text and return first one as a Compound object. Throws: StopIteration: if the text does not have molecule ValueError: if Unsupported symbol is found """ cg = mols_from_text(text, False, assign_descriptors) return next(c...
python
def mol_from_text(text, assign_descriptors=True): """Parse CTAB text and return first one as a Compound object. Throws: StopIteration: if the text does not have molecule ValueError: if Unsupported symbol is found """ cg = mols_from_text(text, False, assign_descriptors) return next(c...
[ "def", "mol_from_text", "(", "text", ",", "assign_descriptors", "=", "True", ")", ":", "cg", "=", "mols_from_text", "(", "text", ",", "False", ",", "assign_descriptors", ")", "return", "next", "(", "cg", ")" ]
Parse CTAB text and return first one as a Compound object. Throws: StopIteration: if the text does not have molecule ValueError: if Unsupported symbol is found
[ "Parse", "CTAB", "text", "and", "return", "first", "one", "as", "a", "Compound", "object", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L274-L282
train
mojaie/chorus
chorus/v2000reader.py
mol_from_file
def mol_from_file(path, assign_descriptors=True): """Parse CTAB file and return first one as a Compound object.""" cs = mols_from_file(path, False, assign_descriptors) return next(cs)
python
def mol_from_file(path, assign_descriptors=True): """Parse CTAB file and return first one as a Compound object.""" cs = mols_from_file(path, False, assign_descriptors) return next(cs)
[ "def", "mol_from_file", "(", "path", ",", "assign_descriptors", "=", "True", ")", ":", "cs", "=", "mols_from_file", "(", "path", ",", "False", ",", "assign_descriptors", ")", "return", "next", "(", "cs", ")" ]
Parse CTAB file and return first one as a Compound object.
[ "Parse", "CTAB", "file", "and", "return", "first", "one", "as", "a", "Compound", "object", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000reader.py#L293-L296
train
brutus/wdiffhtml
wdiffhtml/settings.py
load_from_resource
def load_from_resource(name): """ Returns the contents of a file resource. If the resource exists in the users data directory, it is used instead of the default resource. """ filepath = Path(USER_DIR) / name if filepath.exists(): with filepath.open() as fh: return fh.read() else: return ...
python
def load_from_resource(name): """ Returns the contents of a file resource. If the resource exists in the users data directory, it is used instead of the default resource. """ filepath = Path(USER_DIR) / name if filepath.exists(): with filepath.open() as fh: return fh.read() else: return ...
[ "def", "load_from_resource", "(", "name", ")", ":", "filepath", "=", "Path", "(", "USER_DIR", ")", "/", "name", "if", "filepath", ".", "exists", "(", ")", ":", "with", "filepath", ".", "open", "(", ")", "as", "fh", ":", "return", "fh", ".", "read", ...
Returns the contents of a file resource. If the resource exists in the users data directory, it is used instead of the default resource.
[ "Returns", "the", "contents", "of", "a", "file", "resource", "." ]
e97b524a7945f7a626e33ec141343120c524d9fa
https://github.com/brutus/wdiffhtml/blob/e97b524a7945f7a626e33ec141343120c524d9fa/wdiffhtml/settings.py#L40-L53
train
micolous/python-slackrealtime
src/slackrealtime/__init__.py
connect
def connect(token, protocol=RtmProtocol, factory=WebSocketClientFactory, factory_kwargs=None, api_url=None, debug=False): """ Creates a new connection to the Slack Real-Time API. Returns (connection) which represents this connection to the API server. """ if factory_kwargs is None: factory_kwargs = dict() me...
python
def connect(token, protocol=RtmProtocol, factory=WebSocketClientFactory, factory_kwargs=None, api_url=None, debug=False): """ Creates a new connection to the Slack Real-Time API. Returns (connection) which represents this connection to the API server. """ if factory_kwargs is None: factory_kwargs = dict() me...
[ "def", "connect", "(", "token", ",", "protocol", "=", "RtmProtocol", ",", "factory", "=", "WebSocketClientFactory", ",", "factory_kwargs", "=", "None", ",", "api_url", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "factory_kwargs", "is", "None", ...
Creates a new connection to the Slack Real-Time API. Returns (connection) which represents this connection to the API server.
[ "Creates", "a", "new", "connection", "to", "the", "Slack", "Real", "-", "Time", "API", "." ]
e9c94416f979a6582110ebba09c147de2bfe20a1
https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/__init__.py#L26-L43
train
xlfe/reticul8
python/reticul8/block_compressor.py
block_compressor.next_block
def next_block(self): """ This could probably be improved; at the moment it starts by trying to overshoot the desired compressed block size, then it reduces the input bytes one by one until it has met the required block size """ assert self.pos <= self.input_len ...
python
def next_block(self): """ This could probably be improved; at the moment it starts by trying to overshoot the desired compressed block size, then it reduces the input bytes one by one until it has met the required block size """ assert self.pos <= self.input_len ...
[ "def", "next_block", "(", "self", ")", ":", "assert", "self", ".", "pos", "<=", "self", ".", "input_len", "if", "self", ".", "pos", "==", "self", ".", "input_len", ":", "return", "None", "i", "=", "self", ".", "START_OVERSHOOT", "while", "True", ":", ...
This could probably be improved; at the moment it starts by trying to overshoot the desired compressed block size, then it reduces the input bytes one by one until it has met the required block size
[ "This", "could", "probably", "be", "improved", ";", "at", "the", "moment", "it", "starts", "by", "trying", "to", "overshoot", "the", "desired", "compressed", "block", "size", "then", "it", "reduces", "the", "input", "bytes", "one", "by", "one", "until", "i...
0f9503f7a0731ae09adfe4c9af9b57327a7f9d84
https://github.com/xlfe/reticul8/blob/0f9503f7a0731ae09adfe4c9af9b57327a7f9d84/python/reticul8/block_compressor.py#L57-L101
train
mesbahamin/chronophore
chronophore/chronophore.py
set_up_logging
def set_up_logging(log_file, console_log_level): """Configure logging settings and return a logger object.""" logger = logging.getLogger() logger.setLevel(logging.DEBUG) fh = logging.FileHandler(str(log_file)) fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(console_log_le...
python
def set_up_logging(log_file, console_log_level): """Configure logging settings and return a logger object.""" logger = logging.getLogger() logger.setLevel(logging.DEBUG) fh = logging.FileHandler(str(log_file)) fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(console_log_le...
[ "def", "set_up_logging", "(", "log_file", ",", "console_log_level", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", ")", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "fh", "=", "logging", ".", "FileHandler", "(", "str", "(", "...
Configure logging settings and return a logger object.
[ "Configure", "logging", "settings", "and", "return", "a", "logger", "object", "." ]
ee140c61b4dfada966f078de8304bac737cec6f7
https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/chronophore.py#L48-L64
train
mesbahamin/chronophore
chronophore/chronophore.py
main
def main(): """Run Chronophore based on the command line arguments.""" args = get_args() # Make Chronophore's directories and files in $HOME DATA_DIR = pathlib.Path(appdirs.user_data_dir(__title__)) LOG_FILE = pathlib.Path(appdirs.user_log_dir(__title__), 'debug.log') os.makedirs(str(DATA_DIR),...
python
def main(): """Run Chronophore based on the command line arguments.""" args = get_args() # Make Chronophore's directories and files in $HOME DATA_DIR = pathlib.Path(appdirs.user_data_dir(__title__)) LOG_FILE = pathlib.Path(appdirs.user_log_dir(__title__), 'debug.log') os.makedirs(str(DATA_DIR),...
[ "def", "main", "(", ")", ":", "args", "=", "get_args", "(", ")", "DATA_DIR", "=", "pathlib", ".", "Path", "(", "appdirs", ".", "user_data_dir", "(", "__title__", ")", ")", "LOG_FILE", "=", "pathlib", ".", "Path", "(", "appdirs", ".", "user_log_dir", "(...
Run Chronophore based on the command line arguments.
[ "Run", "Chronophore", "based", "on", "the", "command", "line", "arguments", "." ]
ee140c61b4dfada966f078de8304bac737cec6f7
https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/chronophore.py#L67-L134
train
zsimic/runez
src/runez/logsetup.py
_ContextFilter.filter
def filter(self, record): """Determines if the record should be logged and injects context info into the record. Always returns True""" fmt = LogManager.spec.context_format if fmt: data = self.context.to_dict() if data: record.context = fmt % ",".join("%s=...
python
def filter(self, record): """Determines if the record should be logged and injects context info into the record. Always returns True""" fmt = LogManager.spec.context_format if fmt: data = self.context.to_dict() if data: record.context = fmt % ",".join("%s=...
[ "def", "filter", "(", "self", ",", "record", ")", ":", "fmt", "=", "LogManager", ".", "spec", ".", "context_format", "if", "fmt", ":", "data", "=", "self", ".", "context", ".", "to_dict", "(", ")", "if", "data", ":", "record", ".", "context", "=", ...
Determines if the record should be logged and injects context info into the record. Always returns True
[ "Determines", "if", "the", "record", "should", "be", "logged", "and", "injects", "context", "info", "into", "the", "record", ".", "Always", "returns", "True" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/logsetup.py#L142-L151
train
zsimic/runez
src/runez/logsetup.py
LogManager.enable_faulthandler
def enable_faulthandler(cls, signum=signal.SIGUSR1): """ Enable dumping thread stack traces when specified signals are received, similar to java's handling of SIGQUIT Note: this must be called from the surviving process in case of daemonization. Note that SIGQUIT does not work in all en...
python
def enable_faulthandler(cls, signum=signal.SIGUSR1): """ Enable dumping thread stack traces when specified signals are received, similar to java's handling of SIGQUIT Note: this must be called from the surviving process in case of daemonization. Note that SIGQUIT does not work in all en...
[ "def", "enable_faulthandler", "(", "cls", ",", "signum", "=", "signal", ".", "SIGUSR1", ")", ":", "with", "cls", ".", "_lock", ":", "if", "not", "signum", ":", "cls", ".", "_disable_faulthandler", "(", ")", "return", "if", "not", "cls", ".", "file_handle...
Enable dumping thread stack traces when specified signals are received, similar to java's handling of SIGQUIT Note: this must be called from the surviving process in case of daemonization. Note that SIGQUIT does not work in all environments with a python process. :param int|None signum: Signal...
[ "Enable", "dumping", "thread", "stack", "traces", "when", "specified", "signals", "are", "received", "similar", "to", "java", "s", "handling", "of", "SIGQUIT" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/logsetup.py#L383-L401
train
zsimic/runez
src/runez/logsetup.py
LogManager.override_spec
def override_spec(cls, **kwargs): """OVerride 'spec' and '_default_spec' with given values""" cls._default_spec.set(**kwargs) cls.spec.set(**kwargs)
python
def override_spec(cls, **kwargs): """OVerride 'spec' and '_default_spec' with given values""" cls._default_spec.set(**kwargs) cls.spec.set(**kwargs)
[ "def", "override_spec", "(", "cls", ",", "**", "kwargs", ")", ":", "cls", ".", "_default_spec", ".", "set", "(", "**", "kwargs", ")", "cls", ".", "spec", ".", "set", "(", "**", "kwargs", ")" ]
OVerride 'spec' and '_default_spec' with given values
[ "OVerride", "spec", "and", "_default_spec", "with", "given", "values" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/logsetup.py#L404-L407
train
zsimic/runez
src/runez/logsetup.py
LogManager._fix_logging_shortcuts
def _fix_logging_shortcuts(cls): """ Fix standard logging shortcuts to correctly report logging module. This is only useful if you: - actually use %(name) and care about it being correct - you would still like to use the logging.info() etc shortcuts So basically you'd l...
python
def _fix_logging_shortcuts(cls): """ Fix standard logging shortcuts to correctly report logging module. This is only useful if you: - actually use %(name) and care about it being correct - you would still like to use the logging.info() etc shortcuts So basically you'd l...
[ "def", "_fix_logging_shortcuts", "(", "cls", ")", ":", "if", "cls", ".", "is_using_format", "(", "\"%(pathname)s %(filename)s %(funcName)s %(module)s\"", ")", ":", "logging", ".", "_srcfile", "=", "cls", ".", "_logging_snapshot", ".", "_srcfile", "else", ":", "loggi...
Fix standard logging shortcuts to correctly report logging module. This is only useful if you: - actually use %(name) and care about it being correct - you would still like to use the logging.info() etc shortcuts So basically you'd like to write this: import logging ...
[ "Fix", "standard", "logging", "shortcuts", "to", "correctly", "report", "logging", "module", "." ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/logsetup.py#L439-L491
train
dfm/casjobs
casjobs.py
CasJobs._parse_single
def _parse_single(self, text, tagname): """ A hack to get the content of the XML responses from the CAS server. ## Arguments * `text` (str): The XML string to parse. * `tagname` (str): The tag that contains the info that we want. ## Returns * `content` (str): ...
python
def _parse_single(self, text, tagname): """ A hack to get the content of the XML responses from the CAS server. ## Arguments * `text` (str): The XML string to parse. * `tagname` (str): The tag that contains the info that we want. ## Returns * `content` (str): ...
[ "def", "_parse_single", "(", "self", ",", "text", ",", "tagname", ")", ":", "return", "minidom", ".", "parseString", "(", "text", ")", ".", "getElementsByTagName", "(", "tagname", ")", "[", "0", "]", ".", "firstChild", ".", "data" ]
A hack to get the content of the XML responses from the CAS server. ## Arguments * `text` (str): The XML string to parse. * `tagname` (str): The tag that contains the info that we want. ## Returns * `content` (str): The contents of the tag.
[ "A", "hack", "to", "get", "the", "content", "of", "the", "XML", "responses", "from", "the", "CAS", "server", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L93-L108
train
dfm/casjobs
casjobs.py
CasJobs.quick
def quick(self, q, context=None, task_name="quickie", system=False): """ Run a quick job. ## Arguments * `q` (str): The SQL query. ## Keyword Arguments * `context` (str): Casjobs context used for this query. * `task_name` (str): The task name. * `syste...
python
def quick(self, q, context=None, task_name="quickie", system=False): """ Run a quick job. ## Arguments * `q` (str): The SQL query. ## Keyword Arguments * `context` (str): Casjobs context used for this query. * `task_name` (str): The task name. * `syste...
[ "def", "quick", "(", "self", ",", "q", ",", "context", "=", "None", ",", "task_name", "=", "\"quickie\"", ",", "system", "=", "False", ")", ":", "if", "not", "context", ":", "context", "=", "self", ".", "context", "params", "=", "{", "\"qry\"", ":", ...
Run a quick job. ## Arguments * `q` (str): The SQL query. ## Keyword Arguments * `context` (str): Casjobs context used for this query. * `task_name` (str): The task name. * `system` (bool) : Whether or not to run this job as a system job (not visible in the ...
[ "Run", "a", "quick", "job", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L110-L135
train
dfm/casjobs
casjobs.py
CasJobs.submit
def submit(self, q, context=None, task_name="casjobs", estimate=30): """ Submit a job to CasJobs. ## Arguments * `q` (str): The SQL query. ## Keyword Arguments * `context` (str): Casjobs context used for this query. * `task_name` (str): The task name. ...
python
def submit(self, q, context=None, task_name="casjobs", estimate=30): """ Submit a job to CasJobs. ## Arguments * `q` (str): The SQL query. ## Keyword Arguments * `context` (str): Casjobs context used for this query. * `task_name` (str): The task name. ...
[ "def", "submit", "(", "self", ",", "q", ",", "context", "=", "None", ",", "task_name", "=", "\"casjobs\"", ",", "estimate", "=", "30", ")", ":", "if", "not", "context", ":", "context", "=", "self", ".", "context", "params", "=", "{", "\"qry\"", ":", ...
Submit a job to CasJobs. ## Arguments * `q` (str): The SQL query. ## Keyword Arguments * `context` (str): Casjobs context used for this query. * `task_name` (str): The task name. * `estimate` (int): Estimate of the time this job will take (in minutes). ## Ret...
[ "Submit", "a", "job", "to", "CasJobs", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L137-L162
train
dfm/casjobs
casjobs.py
CasJobs.status
def status(self, job_id): """ Check the status of a job. ## Arguments * `job_id` (int): The job to check. ## Returns * `code` (int): The status. * `status` (str): The human-readable name of the current status. """ params = {"jobid": job_id} ...
python
def status(self, job_id): """ Check the status of a job. ## Arguments * `job_id` (int): The job to check. ## Returns * `code` (int): The status. * `status` (str): The human-readable name of the current status. """ params = {"jobid": job_id} ...
[ "def", "status", "(", "self", ",", "job_id", ")", ":", "params", "=", "{", "\"jobid\"", ":", "job_id", "}", "r", "=", "self", ".", "_send_request", "(", "\"GetJobStatus\"", ",", "params", "=", "params", ")", "status", "=", "int", "(", "self", ".", "_...
Check the status of a job. ## Arguments * `job_id` (int): The job to check. ## Returns * `code` (int): The status. * `status` (str): The human-readable name of the current status.
[ "Check", "the", "status", "of", "a", "job", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L164-L181
train
dfm/casjobs
casjobs.py
CasJobs.monitor
def monitor(self, job_id, timeout=5): """ Monitor the status of a job. ## Arguments * `job_id` (int): The job to check. * `timeout` (float): The time to wait between checks (in sec). ## Returns * `code` (int): The status. * `status` (str): The human-re...
python
def monitor(self, job_id, timeout=5): """ Monitor the status of a job. ## Arguments * `job_id` (int): The job to check. * `timeout` (float): The time to wait between checks (in sec). ## Returns * `code` (int): The status. * `status` (str): The human-re...
[ "def", "monitor", "(", "self", ",", "job_id", ",", "timeout", "=", "5", ")", ":", "while", "True", ":", "status", "=", "self", ".", "status", "(", "job_id", ")", "logging", ".", "info", "(", "\"Monitoring job: %d - Status: %d, %s\"", "%", "(", "job_id", ...
Monitor the status of a job. ## Arguments * `job_id` (int): The job to check. * `timeout` (float): The time to wait between checks (in sec). ## Returns * `code` (int): The status. * `status` (str): The human-readable name of the current status.
[ "Monitor", "the", "status", "of", "a", "job", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L195-L216
train
dfm/casjobs
casjobs.py
CasJobs.request_output
def request_output(self, table, outtype): """ Request the output for a given table. ## Arguments * `table` (str): The name of the table to export. * `outtype` (str): The type of output. Must be one of: CSV - Comma Seperated Values DataSet - XML DataS...
python
def request_output(self, table, outtype): """ Request the output for a given table. ## Arguments * `table` (str): The name of the table to export. * `outtype` (str): The type of output. Must be one of: CSV - Comma Seperated Values DataSet - XML DataS...
[ "def", "request_output", "(", "self", ",", "table", ",", "outtype", ")", ":", "job_types", "=", "[", "\"CSV\"", ",", "\"DataSet\"", ",", "\"FITS\"", ",", "\"VOTable\"", "]", "assert", "outtype", "in", "job_types", "params", "=", "{", "\"tableName\"", ":", ...
Request the output for a given table. ## Arguments * `table` (str): The name of the table to export. * `outtype` (str): The type of output. Must be one of: CSV - Comma Seperated Values DataSet - XML DataSet FITS - Flexible Image Transfer System (FITS ...
[ "Request", "the", "output", "for", "a", "given", "table", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L238-L257
train
dfm/casjobs
casjobs.py
CasJobs.get_output
def get_output(self, job_id, outfn): """ Download an output file given the id of the output request job. ## Arguments * `job_id` (int): The id of the _output_ job. * `outfn` (str): The file where the output should be stored. May also be a file-like object with a 'wr...
python
def get_output(self, job_id, outfn): """ Download an output file given the id of the output request job. ## Arguments * `job_id` (int): The id of the _output_ job. * `outfn` (str): The file where the output should be stored. May also be a file-like object with a 'wr...
[ "def", "get_output", "(", "self", ",", "job_id", ",", "outfn", ")", ":", "job_info", "=", "self", ".", "job_info", "(", "jobid", "=", "job_id", ")", "[", "0", "]", "status", "=", "int", "(", "job_info", "[", "\"Status\"", "]", ")", "if", "status", ...
Download an output file given the id of the output request job. ## Arguments * `job_id` (int): The id of the _output_ job. * `outfn` (str): The file where the output should be stored. May also be a file-like object with a 'write' method.
[ "Download", "an", "output", "file", "given", "the", "id", "of", "the", "output", "request", "job", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L259-L294
train
dfm/casjobs
casjobs.py
CasJobs.request_and_get_output
def request_and_get_output(self, table, outtype, outfn): """ Shorthand for requesting an output file and then downloading it when ready. ## Arguments * `table` (str): The name of the table to export. * `outtype` (str): The type of output. Must be one of: CSV...
python
def request_and_get_output(self, table, outtype, outfn): """ Shorthand for requesting an output file and then downloading it when ready. ## Arguments * `table` (str): The name of the table to export. * `outtype` (str): The type of output. Must be one of: CSV...
[ "def", "request_and_get_output", "(", "self", ",", "table", ",", "outtype", ",", "outfn", ")", ":", "job_id", "=", "self", ".", "request_output", "(", "table", ",", "outtype", ")", "status", "=", "self", ".", "monitor", "(", "job_id", ")", "if", "status"...
Shorthand for requesting an output file and then downloading it when ready. ## Arguments * `table` (str): The name of the table to export. * `outtype` (str): The type of output. Must be one of: CSV - Comma Seperated Values DataSet - XML DataSet F...
[ "Shorthand", "for", "requesting", "an", "output", "file", "and", "then", "downloading", "it", "when", "ready", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L296-L317
train
dfm/casjobs
casjobs.py
CasJobs.drop_table
def drop_table(self, table): """ Drop a table from the MyDB context. ## Arguments * `table` (str): The name of the table to drop. """ job_id = self.submit("DROP TABLE %s"%table, context="MYDB") status = self.monitor(job_id) if status[0] != 5: ...
python
def drop_table(self, table): """ Drop a table from the MyDB context. ## Arguments * `table` (str): The name of the table to drop. """ job_id = self.submit("DROP TABLE %s"%table, context="MYDB") status = self.monitor(job_id) if status[0] != 5: ...
[ "def", "drop_table", "(", "self", ",", "table", ")", ":", "job_id", "=", "self", ".", "submit", "(", "\"DROP TABLE %s\"", "%", "table", ",", "context", "=", "\"MYDB\"", ")", "status", "=", "self", ".", "monitor", "(", "job_id", ")", "if", "status", "["...
Drop a table from the MyDB context. ## Arguments * `table` (str): The name of the table to drop.
[ "Drop", "a", "table", "from", "the", "MyDB", "context", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L319-L331
train
dfm/casjobs
casjobs.py
CasJobs.count
def count(self, q): """ Shorthand for counting the results of a specific query. ## Arguments * `q` (str): The query to count. This will be executed as: `"SELECT COUNT(*) %s" % q`. ## Returns * `count` (int): The resulting count. """ q = "SEL...
python
def count(self, q): """ Shorthand for counting the results of a specific query. ## Arguments * `q` (str): The query to count. This will be executed as: `"SELECT COUNT(*) %s" % q`. ## Returns * `count` (int): The resulting count. """ q = "SEL...
[ "def", "count", "(", "self", ",", "q", ")", ":", "q", "=", "\"SELECT COUNT(*) %s\"", "%", "q", "return", "int", "(", "self", ".", "quick", "(", "q", ")", ".", "split", "(", "\"\\n\"", ")", "[", "1", "]", ")" ]
Shorthand for counting the results of a specific query. ## Arguments * `q` (str): The query to count. This will be executed as: `"SELECT COUNT(*) %s" % q`. ## Returns * `count` (int): The resulting count.
[ "Shorthand", "for", "counting", "the", "results", "of", "a", "specific", "query", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L333-L348
train
dfm/casjobs
casjobs.py
CasJobs.list_tables
def list_tables(self): """ Lists the tables in mydb. ## Returns * `tables` (list): A list of strings with all the table names from mydb. """ q = 'SELECT Distinct TABLE_NAME FROM information_schema.TABLES' res = self.quick(q, context='MYDB', task_name='listtables...
python
def list_tables(self): """ Lists the tables in mydb. ## Returns * `tables` (list): A list of strings with all the table names from mydb. """ q = 'SELECT Distinct TABLE_NAME FROM information_schema.TABLES' res = self.quick(q, context='MYDB', task_name='listtables...
[ "def", "list_tables", "(", "self", ")", ":", "q", "=", "'SELECT Distinct TABLE_NAME FROM information_schema.TABLES'", "res", "=", "self", ".", "quick", "(", "q", ",", "context", "=", "'MYDB'", ",", "task_name", "=", "'listtables'", ",", "system", "=", "True", ...
Lists the tables in mydb. ## Returns * `tables` (list): A list of strings with all the table names from mydb.
[ "Lists", "the", "tables", "in", "mydb", "." ]
1cc3f5511cc254d776082909221787e3c037ac16
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L350-L362
train
ncraike/fang
examples/multiple_dependencies.py
multiply_and_add
def multiply_and_add(n): '''Multiply the given number n by some configured multiplier, and then add a configured offset.''' multiplier, offset = di.resolver.unpack(multiply_and_add) return (multiplier * n) + offset
python
def multiply_and_add(n): '''Multiply the given number n by some configured multiplier, and then add a configured offset.''' multiplier, offset = di.resolver.unpack(multiply_and_add) return (multiplier * n) + offset
[ "def", "multiply_and_add", "(", "n", ")", ":", "multiplier", ",", "offset", "=", "di", ".", "resolver", ".", "unpack", "(", "multiply_and_add", ")", "return", "(", "multiplier", "*", "n", ")", "+", "offset" ]
Multiply the given number n by some configured multiplier, and then add a configured offset.
[ "Multiply", "the", "given", "number", "n", "by", "some", "configured", "multiplier", "and", "then", "add", "a", "configured", "offset", "." ]
2d9e1216c866e450059017f83ab775f7716eda7a
https://github.com/ncraike/fang/blob/2d9e1216c866e450059017f83ab775f7716eda7a/examples/multiple_dependencies.py#L13-L17
train
mastro35/flows
flows/Actions/InputTailAction.py
TailAction.flush_buffer
def flush_buffer(self): ''' Flush the buffer of the tail ''' if len(self.buffer) > 0: return_value = ''.join(self.buffer) self.buffer.clear() self.send_message(return_value) self.last_flush_date = datetime.datetime.now()
python
def flush_buffer(self): ''' Flush the buffer of the tail ''' if len(self.buffer) > 0: return_value = ''.join(self.buffer) self.buffer.clear() self.send_message(return_value) self.last_flush_date = datetime.datetime.now()
[ "def", "flush_buffer", "(", "self", ")", ":", "if", "len", "(", "self", ".", "buffer", ")", ">", "0", ":", "return_value", "=", "''", ".", "join", "(", "self", ".", "buffer", ")", "self", ".", "buffer", ".", "clear", "(", ")", "self", ".", "send_...
Flush the buffer of the tail
[ "Flush", "the", "buffer", "of", "the", "tail" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputTailAction.py#L64-L70
train
zsimic/runez
src/runez/base.py
Slotted.set
def set(self, *args, **kwargs): """Conveniently set one or more fields at a time. Args: *args: Optionally set from other objects, available fields from the passed object are used in order **kwargs: Set from given key/value pairs (only names defined in __slots__ are used) ...
python
def set(self, *args, **kwargs): """Conveniently set one or more fields at a time. Args: *args: Optionally set from other objects, available fields from the passed object are used in order **kwargs: Set from given key/value pairs (only names defined in __slots__ are used) ...
[ "def", "set", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "args", ":", "for", "arg", "in", "args", ":", "if", "arg", "is", "not", "None", ":", "for", "name", "in", "self", ".", "__slots__", ":", "self", ".", "_set", "(",...
Conveniently set one or more fields at a time. Args: *args: Optionally set from other objects, available fields from the passed object are used in order **kwargs: Set from given key/value pairs (only names defined in __slots__ are used)
[ "Conveniently", "set", "one", "or", "more", "fields", "at", "a", "time", "." ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/base.py#L105-L118
train
zsimic/runez
src/runez/base.py
ThreadGlobalContext.enable
def enable(self): """Enable contextual logging""" with self._lock: if self.filter is None: self.filter = self._filter_type(self)
python
def enable(self): """Enable contextual logging""" with self._lock: if self.filter is None: self.filter = self._filter_type(self)
[ "def", "enable", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "filter", "is", "None", ":", "self", ".", "filter", "=", "self", ".", "_filter_type", "(", "self", ")" ]
Enable contextual logging
[ "Enable", "contextual", "logging" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/base.py#L161-L165
train
zsimic/runez
src/runez/base.py
ThreadGlobalContext.set_threadlocal
def set_threadlocal(self, **values): """Set current thread's logging context to specified `values`""" with self._lock: self._ensure_threadlocal() self._tpayload.context = values
python
def set_threadlocal(self, **values): """Set current thread's logging context to specified `values`""" with self._lock: self._ensure_threadlocal() self._tpayload.context = values
[ "def", "set_threadlocal", "(", "self", ",", "**", "values", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_ensure_threadlocal", "(", ")", "self", ".", "_tpayload", ".", "context", "=", "values" ]
Set current thread's logging context to specified `values`
[ "Set", "current", "thread", "s", "logging", "context", "to", "specified", "values" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/base.py#L175-L179
train
zsimic/runez
src/runez/base.py
ThreadGlobalContext.add_threadlocal
def add_threadlocal(self, **values): """Add `values` to current thread's logging context""" with self._lock: self._ensure_threadlocal() self._tpayload.context.update(**values)
python
def add_threadlocal(self, **values): """Add `values` to current thread's logging context""" with self._lock: self._ensure_threadlocal() self._tpayload.context.update(**values)
[ "def", "add_threadlocal", "(", "self", ",", "**", "values", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_ensure_threadlocal", "(", ")", "self", ".", "_tpayload", ".", "context", ".", "update", "(", "**", "values", ")" ]
Add `values` to current thread's logging context
[ "Add", "values", "to", "current", "thread", "s", "logging", "context" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/base.py#L181-L185
train
zsimic/runez
src/runez/base.py
ThreadGlobalContext.add_global
def add_global(self, **values): """Add `values` to global logging context""" with self._lock: self._ensure_global() self._gpayload.update(**values)
python
def add_global(self, **values): """Add `values` to global logging context""" with self._lock: self._ensure_global() self._gpayload.update(**values)
[ "def", "add_global", "(", "self", ",", "**", "values", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_ensure_global", "(", ")", "self", ".", "_gpayload", ".", "update", "(", "**", "values", ")" ]
Add `values` to global logging context
[ "Add", "values", "to", "global", "logging", "context" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/base.py#L209-L213
train
mojaie/chorus
chorus/draw/helper.py
display_terminal_carbon
def display_terminal_carbon(mol): """Set visible=True to the terminal carbon atoms. """ for i, a in mol.atoms_iter(): if mol.neighbor_count(i) == 1: a.visible = True
python
def display_terminal_carbon(mol): """Set visible=True to the terminal carbon atoms. """ for i, a in mol.atoms_iter(): if mol.neighbor_count(i) == 1: a.visible = True
[ "def", "display_terminal_carbon", "(", "mol", ")", ":", "for", "i", ",", "a", "in", "mol", ".", "atoms_iter", "(", ")", ":", "if", "mol", ".", "neighbor_count", "(", "i", ")", "==", "1", ":", "a", ".", "visible", "=", "True" ]
Set visible=True to the terminal carbon atoms.
[ "Set", "visible", "=", "True", "to", "the", "terminal", "carbon", "atoms", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/helper.py#L16-L21
train
mojaie/chorus
chorus/draw/helper.py
equalize_terminal_double_bond
def equalize_terminal_double_bond(mol): """Show equalized double bond if it is connected to terminal atom. """ for i, a in mol.atoms_iter(): if mol.neighbor_count(i) == 1: nb = list(mol.neighbors(i).values())[0] if nb.order == 2: nb.type = 2
python
def equalize_terminal_double_bond(mol): """Show equalized double bond if it is connected to terminal atom. """ for i, a in mol.atoms_iter(): if mol.neighbor_count(i) == 1: nb = list(mol.neighbors(i).values())[0] if nb.order == 2: nb.type = 2
[ "def", "equalize_terminal_double_bond", "(", "mol", ")", ":", "for", "i", ",", "a", "in", "mol", ".", "atoms_iter", "(", ")", ":", "if", "mol", ".", "neighbor_count", "(", "i", ")", "==", "1", ":", "nb", "=", "list", "(", "mol", ".", "neighbors", "...
Show equalized double bond if it is connected to terminal atom.
[ "Show", "equalized", "double", "bond", "if", "it", "is", "connected", "to", "terminal", "atom", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/helper.py#L24-L31
train
mojaie/chorus
chorus/draw/helper.py
spine_to_terminal_wedge
def spine_to_terminal_wedge(mol): """Arrange stereo wedge direction from spine to terminal atom """ for i, a in mol.atoms_iter(): if mol.neighbor_count(i) == 1: ni, nb = list(mol.neighbors(i).items())[0] if nb.order == 1 and nb.type in (1, 2) \ and ni > i ...
python
def spine_to_terminal_wedge(mol): """Arrange stereo wedge direction from spine to terminal atom """ for i, a in mol.atoms_iter(): if mol.neighbor_count(i) == 1: ni, nb = list(mol.neighbors(i).items())[0] if nb.order == 1 and nb.type in (1, 2) \ and ni > i ...
[ "def", "spine_to_terminal_wedge", "(", "mol", ")", ":", "for", "i", ",", "a", "in", "mol", ".", "atoms_iter", "(", ")", ":", "if", "mol", ".", "neighbor_count", "(", "i", ")", "==", "1", ":", "ni", ",", "nb", "=", "list", "(", "mol", ".", "neighb...
Arrange stereo wedge direction from spine to terminal atom
[ "Arrange", "stereo", "wedge", "direction", "from", "spine", "to", "terminal", "atom" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/helper.py#L34-L43
train
mojaie/chorus
chorus/draw/helper.py
format_ring_double_bond
def format_ring_double_bond(mol): """Set double bonds around the ring. """ mol.require("Topology") mol.require("ScaleAndCenter") for r in sorted(mol.rings, key=len, reverse=True): vertices = [mol.atom(n).coords for n in r] try: if geometry.is_clockwise(vertices): ...
python
def format_ring_double_bond(mol): """Set double bonds around the ring. """ mol.require("Topology") mol.require("ScaleAndCenter") for r in sorted(mol.rings, key=len, reverse=True): vertices = [mol.atom(n).coords for n in r] try: if geometry.is_clockwise(vertices): ...
[ "def", "format_ring_double_bond", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Topology\"", ")", "mol", ".", "require", "(", "\"ScaleAndCenter\"", ")", "for", "r", "in", "sorted", "(", "mol", ".", "rings", ",", "key", "=", "len", ",", "reverse", ...
Set double bonds around the ring.
[ "Set", "double", "bonds", "around", "the", "ring", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/helper.py#L46-L64
train
mojaie/chorus
chorus/draw/helper.py
ready_to_draw
def ready_to_draw(mol): """Shortcut function to prepare molecule to draw. Overwrite this function for customized appearance. It is recommended to clone the molecule before draw because all the methods above are destructive. """ copied = molutil.clone(mol) # display_terminal_carbon(mol) e...
python
def ready_to_draw(mol): """Shortcut function to prepare molecule to draw. Overwrite this function for customized appearance. It is recommended to clone the molecule before draw because all the methods above are destructive. """ copied = molutil.clone(mol) # display_terminal_carbon(mol) e...
[ "def", "ready_to_draw", "(", "mol", ")", ":", "copied", "=", "molutil", ".", "clone", "(", "mol", ")", "equalize_terminal_double_bond", "(", "copied", ")", "scale_and_center", "(", "copied", ")", "format_ring_double_bond", "(", "copied", ")", "return", "copied" ...
Shortcut function to prepare molecule to draw. Overwrite this function for customized appearance. It is recommended to clone the molecule before draw because all the methods above are destructive.
[ "Shortcut", "function", "to", "prepare", "molecule", "to", "draw", ".", "Overwrite", "this", "function", "for", "customized", "appearance", ".", "It", "is", "recommended", "to", "clone", "the", "molecule", "before", "draw", "because", "all", "the", "methods", ...
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/helper.py#L113-L125
train
adblair/configloader
configloader/__init__.py
ConfigLoader.update_from_object
def update_from_object(self, obj, criterion=lambda key: key.isupper()): """ Update dict from the attributes of a module, class or other object. By default only attributes with all-uppercase names will be retrieved. Use the ``criterion`` argument to modify that behaviour. :arg o...
python
def update_from_object(self, obj, criterion=lambda key: key.isupper()): """ Update dict from the attributes of a module, class or other object. By default only attributes with all-uppercase names will be retrieved. Use the ``criterion`` argument to modify that behaviour. :arg o...
[ "def", "update_from_object", "(", "self", ",", "obj", ",", "criterion", "=", "lambda", "key", ":", "key", ".", "isupper", "(", ")", ")", ":", "log", ".", "debug", "(", "'Loading config from {0}'", ".", "format", "(", "obj", ")", ")", "if", "isinstance", ...
Update dict from the attributes of a module, class or other object. By default only attributes with all-uppercase names will be retrieved. Use the ``criterion`` argument to modify that behaviour. :arg obj: Either the actual module/object, or its absolute name, e.g. 'my_app.settings...
[ "Update", "dict", "from", "the", "attributes", "of", "a", "module", "class", "or", "other", "object", "." ]
c56eb568a376243400bb72992ca927c35922c827
https://github.com/adblair/configloader/blob/c56eb568a376243400bb72992ca927c35922c827/configloader/__init__.py#L46-L73
train
adblair/configloader
configloader/__init__.py
ConfigLoader.update_from_env_namespace
def update_from_env_namespace(self, namespace): """ Update dict from any environment variables that have a given prefix. The common prefix is removed when converting the variable names to dictionary keys. For example, if the following environment variables were set:: ...
python
def update_from_env_namespace(self, namespace): """ Update dict from any environment variables that have a given prefix. The common prefix is removed when converting the variable names to dictionary keys. For example, if the following environment variables were set:: ...
[ "def", "update_from_env_namespace", "(", "self", ",", "namespace", ")", ":", "self", ".", "update", "(", "ConfigLoader", "(", "os", ".", "environ", ")", ".", "namespace", "(", "namespace", ")", ")" ]
Update dict from any environment variables that have a given prefix. The common prefix is removed when converting the variable names to dictionary keys. For example, if the following environment variables were set:: MY_APP_SETTING1=foo MY_APP_SETTING2=bar Then ...
[ "Update", "dict", "from", "any", "environment", "variables", "that", "have", "a", "given", "prefix", "." ]
c56eb568a376243400bb72992ca927c35922c827
https://github.com/adblair/configloader/blob/c56eb568a376243400bb72992ca927c35922c827/configloader/__init__.py#L119-L137
train
adblair/configloader
configloader/__init__.py
ConfigLoader.update_from
def update_from( self, obj=None, yaml_env=None, yaml_file=None, json_env=None, json_file=None, env_namespace=None, ): """ Update dict from several sources at once. This is simply a convenience method...
python
def update_from( self, obj=None, yaml_env=None, yaml_file=None, json_env=None, json_file=None, env_namespace=None, ): """ Update dict from several sources at once. This is simply a convenience method...
[ "def", "update_from", "(", "self", ",", "obj", "=", "None", ",", "yaml_env", "=", "None", ",", "yaml_file", "=", "None", ",", "json_env", "=", "None", ",", "json_file", "=", "None", ",", "env_namespace", "=", "None", ",", ")", ":", "if", "obj", ":", ...
Update dict from several sources at once. This is simply a convenience method that can be used as an alternative to making several calls to the various :meth:`~ConfigLoader.update_from_*` methods. Updates will be applied in the order that the parameters are listed below, with e...
[ "Update", "dict", "from", "several", "sources", "at", "once", "." ]
c56eb568a376243400bb72992ca927c35922c827
https://github.com/adblair/configloader/blob/c56eb568a376243400bb72992ca927c35922c827/configloader/__init__.py#L139-L179
train
adblair/configloader
configloader/__init__.py
ConfigLoader.namespace
def namespace(self, namespace, key_transform=lambda key: key): """ Return a copy with only the keys from a given namespace. The common prefix will be removed in the returned dict. Example:: >>> from configloader import ConfigLoader >>> config = ConfigLoader( ...
python
def namespace(self, namespace, key_transform=lambda key: key): """ Return a copy with only the keys from a given namespace. The common prefix will be removed in the returned dict. Example:: >>> from configloader import ConfigLoader >>> config = ConfigLoader( ...
[ "def", "namespace", "(", "self", ",", "namespace", ",", "key_transform", "=", "lambda", "key", ":", "key", ")", ":", "namespace", "=", "namespace", ".", "rstrip", "(", "'_'", ")", "+", "'_'", "return", "ConfigLoader", "(", "(", "key_transform", "(", "key...
Return a copy with only the keys from a given namespace. The common prefix will be removed in the returned dict. Example:: >>> from configloader import ConfigLoader >>> config = ConfigLoader( ... MY_APP_SETTING1='a', ... EXTERNAL_LIB_SETTING1='b', ...
[ "Return", "a", "copy", "with", "only", "the", "keys", "from", "a", "given", "namespace", "." ]
c56eb568a376243400bb72992ca927c35922c827
https://github.com/adblair/configloader/blob/c56eb568a376243400bb72992ca927c35922c827/configloader/__init__.py#L181-L208
train
adblair/configloader
configloader/__init__.py
ConfigLoader.namespace_lower
def namespace_lower(self, namespace): """ Return a copy with only the keys from a given namespace, lower-cased. The keys in the returned dict will be transformed to lower case after filtering, so they can be easily passed as keyword arguments to other functions. This is just syn...
python
def namespace_lower(self, namespace): """ Return a copy with only the keys from a given namespace, lower-cased. The keys in the returned dict will be transformed to lower case after filtering, so they can be easily passed as keyword arguments to other functions. This is just syn...
[ "def", "namespace_lower", "(", "self", ",", "namespace", ")", ":", "return", "self", ".", "namespace", "(", "namespace", ",", "key_transform", "=", "lambda", "key", ":", "key", ".", "lower", "(", ")", ")" ]
Return a copy with only the keys from a given namespace, lower-cased. The keys in the returned dict will be transformed to lower case after filtering, so they can be easily passed as keyword arguments to other functions. This is just syntactic sugar for calling :meth:`~ConfigLoader.name...
[ "Return", "a", "copy", "with", "only", "the", "keys", "from", "a", "given", "namespace", "lower", "-", "cased", "." ]
c56eb568a376243400bb72992ca927c35922c827
https://github.com/adblair/configloader/blob/c56eb568a376243400bb72992ca927c35922c827/configloader/__init__.py#L210-L236
train
ehansis/ozelot
ozelot/etl/util.py
render_diagram
def render_diagram(root_task, out_base, max_param_len=20, horizontal=False, colored=False): """Render a diagram of the ETL pipeline All upstream tasks (i.e. requirements) of :attr:`root_task` are rendered. Nodes are, by default, styled as simple rects. This style is augmented by any :attr:`diagram_sty...
python
def render_diagram(root_task, out_base, max_param_len=20, horizontal=False, colored=False): """Render a diagram of the ETL pipeline All upstream tasks (i.e. requirements) of :attr:`root_task` are rendered. Nodes are, by default, styled as simple rects. This style is augmented by any :attr:`diagram_sty...
[ "def", "render_diagram", "(", "root_task", ",", "out_base", ",", "max_param_len", "=", "20", ",", "horizontal", "=", "False", ",", "colored", "=", "False", ")", ":", "import", "re", "import", "codecs", "import", "subprocess", "from", "ozelot", "import", "con...
Render a diagram of the ETL pipeline All upstream tasks (i.e. requirements) of :attr:`root_task` are rendered. Nodes are, by default, styled as simple rects. This style is augmented by any :attr:`diagram_style` attributes of the tasks. .. note:: This function requires the 'dot' executable from the Gr...
[ "Render", "a", "diagram", "of", "the", "ETL", "pipeline" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/util.py#L12-L127
train
ehansis/ozelot
ozelot/etl/util.py
sanitize
def sanitize(s, normalize_whitespace=True, normalize_unicode=True, form='NFKC', enforce_encoding=True, encoding='utf-8'): """Normalize a string Args: s (unicode string): input unicode string normalize_whitespace (bool): if True, n...
python
def sanitize(s, normalize_whitespace=True, normalize_unicode=True, form='NFKC', enforce_encoding=True, encoding='utf-8'): """Normalize a string Args: s (unicode string): input unicode string normalize_whitespace (bool): if True, n...
[ "def", "sanitize", "(", "s", ",", "normalize_whitespace", "=", "True", ",", "normalize_unicode", "=", "True", ",", "form", "=", "'NFKC'", ",", "enforce_encoding", "=", "True", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "enforce_encoding", ":", "s", "...
Normalize a string Args: s (unicode string): input unicode string normalize_whitespace (bool): if True, normalize all whitespace to single spaces (including newlines), strip whitespace at start/end normalize_unicode (bool): if True, normalize unicode for...
[ "Normalize", "a", "string" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/util.py#L130-L161
train
gmdzy2010/dingtalk_sdk_gmdzy2010
dingtalk_sdk_gmdzy2010/authority_request.py
PersistentCodeRequest.get_ticket_for_sns_token
def get_ticket_for_sns_token(self): """This is a shortcut for getting the sns_token, as a post data of request body.""" self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return { "openid": self.get_openid(), "persistent_code": self.get_per...
python
def get_ticket_for_sns_token(self): """This is a shortcut for getting the sns_token, as a post data of request body.""" self.logger.info("%s\t%s" % (self.request_method, self.request_url)) return { "openid": self.get_openid(), "persistent_code": self.get_per...
[ "def", "get_ticket_for_sns_token", "(", "self", ")", ":", "self", ".", "logger", ".", "info", "(", "\"%s\\t%s\"", "%", "(", "self", ".", "request_method", ",", "self", ".", "request_url", ")", ")", "return", "{", "\"openid\"", ":", "self", ".", "get_openid...
This is a shortcut for getting the sns_token, as a post data of request body.
[ "This", "is", "a", "shortcut", "for", "getting", "the", "sns_token", "as", "a", "post", "data", "of", "request", "body", "." ]
b06cb1f78f89be9554dcb6101af8bc72718a9ecd
https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/authority_request.py#L86-L93
train
ehansis/ozelot
examples/superheroes/superheroes/models.py
reinitialize
def reinitialize(): """Drop all tables for all models, then re-create them """ from ozelot import client # import all additional models needed in this project # noinspection PyUnresolvedReferences from ozelot.orm.target import ORMTargetMarker client = client.get_client() base.Base.drop...
python
def reinitialize(): """Drop all tables for all models, then re-create them """ from ozelot import client # import all additional models needed in this project # noinspection PyUnresolvedReferences from ozelot.orm.target import ORMTargetMarker client = client.get_client() base.Base.drop...
[ "def", "reinitialize", "(", ")", ":", "from", "ozelot", "import", "client", "from", "ozelot", ".", "orm", ".", "target", "import", "ORMTargetMarker", "client", "=", "client", ".", "get_client", "(", ")", "base", ".", "Base", ".", "drop_all", "(", "client",...
Drop all tables for all models, then re-create them
[ "Drop", "all", "tables", "for", "all", "models", "then", "re", "-", "create", "them" ]
948675e02eb6fca940450f5cb814f53e97159e5b
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/superheroes/superheroes/models.py#L130-L141
train
ncraike/fang
fang/dependency_register.py
DependencyRegister._unwrap_func
def _unwrap_func(cls, decorated_func): ''' This unwraps a decorated func, returning the inner wrapped func. This may become unnecessary with Python 3.4's inspect.unwrap(). ''' if click is not None: # Workaround for click.command() decorator not setting # ...
python
def _unwrap_func(cls, decorated_func): ''' This unwraps a decorated func, returning the inner wrapped func. This may become unnecessary with Python 3.4's inspect.unwrap(). ''' if click is not None: # Workaround for click.command() decorator not setting # ...
[ "def", "_unwrap_func", "(", "cls", ",", "decorated_func", ")", ":", "if", "click", "is", "not", "None", ":", "if", "isinstance", "(", "decorated_func", ",", "click", ".", "Command", ")", ":", "return", "cls", ".", "_unwrap_func", "(", "decorated_func", "."...
This unwraps a decorated func, returning the inner wrapped func. This may become unnecessary with Python 3.4's inspect.unwrap().
[ "This", "unwraps", "a", "decorated", "func", "returning", "the", "inner", "wrapped", "func", "." ]
2d9e1216c866e450059017f83ab775f7716eda7a
https://github.com/ncraike/fang/blob/2d9e1216c866e450059017f83ab775f7716eda7a/fang/dependency_register.py#L21-L39
train
ncraike/fang
fang/dependency_register.py
DependencyRegister._register_dependent
def _register_dependent(self, dependent, resource_name): ''' Register a mapping of the dependent to resource name. After calling, dependency_register.dependents[dependent] should contain resource_name. ''' if dependent not in self.dependents: self.dependents[...
python
def _register_dependent(self, dependent, resource_name): ''' Register a mapping of the dependent to resource name. After calling, dependency_register.dependents[dependent] should contain resource_name. ''' if dependent not in self.dependents: self.dependents[...
[ "def", "_register_dependent", "(", "self", ",", "dependent", ",", "resource_name", ")", ":", "if", "dependent", "not", "in", "self", ".", "dependents", ":", "self", ".", "dependents", "[", "dependent", "]", "=", "[", "]", "self", ".", "dependents", "[", ...
Register a mapping of the dependent to resource name. After calling, dependency_register.dependents[dependent] should contain resource_name.
[ "Register", "a", "mapping", "of", "the", "dependent", "to", "resource", "name", "." ]
2d9e1216c866e450059017f83ab775f7716eda7a
https://github.com/ncraike/fang/blob/2d9e1216c866e450059017f83ab775f7716eda7a/fang/dependency_register.py#L50-L59
train
ncraike/fang
fang/dependency_register.py
DependencyRegister.register
def register(self, resource_name, dependent=None): ''' Register the given dependent as depending on the "resource" named by resource_name. ''' if dependent is None: # Give a partial usable as a decorator return partial(self.register, resource_name) ...
python
def register(self, resource_name, dependent=None): ''' Register the given dependent as depending on the "resource" named by resource_name. ''' if dependent is None: # Give a partial usable as a decorator return partial(self.register, resource_name) ...
[ "def", "register", "(", "self", ",", "resource_name", ",", "dependent", "=", "None", ")", ":", "if", "dependent", "is", "None", ":", "return", "partial", "(", "self", ".", "register", ",", "resource_name", ")", "dependent", "=", "self", ".", "_unwrap_depen...
Register the given dependent as depending on the "resource" named by resource_name.
[ "Register", "the", "given", "dependent", "as", "depending", "on", "the", "resource", "named", "by", "resource_name", "." ]
2d9e1216c866e450059017f83ab775f7716eda7a
https://github.com/ncraike/fang/blob/2d9e1216c866e450059017f83ab775f7716eda7a/fang/dependency_register.py#L66-L80
train
thorgate/django-esteid
esteid/middleware.py
BaseIdCardMiddleware.verify_ocsp
def verify_ocsp(cls, certificate, issuer): """ Runs OCSP verification and returns error code - 0 means success """ return OCSPVerifier(certificate, issuer, cls.get_ocsp_url(), cls.get_ocsp_responder_certificate_path()).verify()
python
def verify_ocsp(cls, certificate, issuer): """ Runs OCSP verification and returns error code - 0 means success """ return OCSPVerifier(certificate, issuer, cls.get_ocsp_url(), cls.get_ocsp_responder_certificate_path()).verify()
[ "def", "verify_ocsp", "(", "cls", ",", "certificate", ",", "issuer", ")", ":", "return", "OCSPVerifier", "(", "certificate", ",", "issuer", ",", "cls", ".", "get_ocsp_url", "(", ")", ",", "cls", ".", "get_ocsp_responder_certificate_path", "(", ")", ")", ".",...
Runs OCSP verification and returns error code - 0 means success
[ "Runs", "OCSP", "verification", "and", "returns", "error", "code", "-", "0", "means", "success" ]
407ae513e357fedea0e3e42198df8eb9d9ff0646
https://github.com/thorgate/django-esteid/blob/407ae513e357fedea0e3e42198df8eb9d9ff0646/esteid/middleware.py#L144-L150
train
lsst-sqre/documenteer
documenteer/requestsutils.py
requests_retry_session
def requests_retry_session( retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504), session=None): """Create a requests session that handles errors by retrying. Parameters ---------- retries : `int`, optional Number of retries to attempt. backoff_fac...
python
def requests_retry_session( retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504), session=None): """Create a requests session that handles errors by retrying. Parameters ---------- retries : `int`, optional Number of retries to attempt. backoff_fac...
[ "def", "requests_retry_session", "(", "retries", "=", "3", ",", "backoff_factor", "=", "0.3", ",", "status_forcelist", "=", "(", "500", ",", "502", ",", "504", ")", ",", "session", "=", "None", ")", ":", "session", "=", "session", "or", "requests", ".", ...
Create a requests session that handles errors by retrying. Parameters ---------- retries : `int`, optional Number of retries to attempt. backoff_factor : `float`, optional Backoff factor. status_forcelist : sequence of `str`, optional Status codes that must be retried. s...
[ "Create", "a", "requests", "session", "that", "handles", "errors", "by", "retrying", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/requestsutils.py#L11-L52
train
lsst-sqre/documenteer
documenteer/sphinxconfig/technoteconf.py
configure_technote
def configure_technote(meta_stream): """Builds a ``dict`` of Sphinx configuration variables given a central configuration for LSST Design Documents and a metadata YAML file. This function refactors the common Sphinx ``conf.py`` script so that basic configurations are managed centrally in this module, w...
python
def configure_technote(meta_stream): """Builds a ``dict`` of Sphinx configuration variables given a central configuration for LSST Design Documents and a metadata YAML file. This function refactors the common Sphinx ``conf.py`` script so that basic configurations are managed centrally in this module, w...
[ "def", "configure_technote", "(", "meta_stream", ")", ":", "_metadata", "=", "yaml", ".", "load", "(", "meta_stream", ")", "confs", "=", "_build_confs", "(", "_metadata", ")", "return", "confs" ]
Builds a ``dict`` of Sphinx configuration variables given a central configuration for LSST Design Documents and a metadata YAML file. This function refactors the common Sphinx ``conf.py`` script so that basic configurations are managed centrally in this module, while author-updatable metadata is stored...
[ "Builds", "a", "dict", "of", "Sphinx", "configuration", "variables", "given", "a", "central", "configuration", "for", "LSST", "Design", "Documents", "and", "a", "metadata", "YAML", "file", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/technoteconf.py#L17-L67
train
thorgate/django-esteid
esteid/config.py
ocsp_responder_certificate_path
def ocsp_responder_certificate_path(): """Get ocsp responder certificate path Test: TEST_of_SK_OCSP_RESPONDER_2011.pem Live: sk-ocsp-responder-certificates.pem Note: These files are distributed under esteid/certs :return: """ certificate_path = getattr(settings, 'ESTEID_OCSP_RESPONDER_CER...
python
def ocsp_responder_certificate_path(): """Get ocsp responder certificate path Test: TEST_of_SK_OCSP_RESPONDER_2011.pem Live: sk-ocsp-responder-certificates.pem Note: These files are distributed under esteid/certs :return: """ certificate_path = getattr(settings, 'ESTEID_OCSP_RESPONDER_CER...
[ "def", "ocsp_responder_certificate_path", "(", ")", ":", "certificate_path", "=", "getattr", "(", "settings", ",", "'ESTEID_OCSP_RESPONDER_CERTIFICATE_PATH'", ",", "'TEST_of_SK_OCSP_RESPONDER_2011.pem'", ")", "if", "certificate_path", "in", "[", "'TEST_of_SK_OCSP_RESPONDER_2011...
Get ocsp responder certificate path Test: TEST_of_SK_OCSP_RESPONDER_2011.pem Live: sk-ocsp-responder-certificates.pem Note: These files are distributed under esteid/certs :return:
[ "Get", "ocsp", "responder", "certificate", "path" ]
407ae513e357fedea0e3e42198df8eb9d9ff0646
https://github.com/thorgate/django-esteid/blob/407ae513e357fedea0e3e42198df8eb9d9ff0646/esteid/config.py#L40-L55
train
miguelgrinberg/Flask-MarrowMailer
flask_marrowmailer.py
Mailer.new
def new(self, **kwargs): '''Return a new ``Message`` instance. The arguments are passed to the ``marrow.mailer.Message`` constructor.''' app = self.app or current_app mailer = app.extensions['marrowmailer'] msg = mailer.new(**kwargs) msg.__class__ = Message retur...
python
def new(self, **kwargs): '''Return a new ``Message`` instance. The arguments are passed to the ``marrow.mailer.Message`` constructor.''' app = self.app or current_app mailer = app.extensions['marrowmailer'] msg = mailer.new(**kwargs) msg.__class__ = Message retur...
[ "def", "new", "(", "self", ",", "**", "kwargs", ")", ":", "app", "=", "self", ".", "app", "or", "current_app", "mailer", "=", "app", ".", "extensions", "[", "'marrowmailer'", "]", "msg", "=", "mailer", ".", "new", "(", "**", "kwargs", ")", "msg", "...
Return a new ``Message`` instance. The arguments are passed to the ``marrow.mailer.Message`` constructor.
[ "Return", "a", "new", "Message", "instance", ".", "The", "arguments", "are", "passed", "to", "the", "marrow", ".", "mailer", ".", "Message", "constructor", "." ]
daf1ac0745fb31db2f43f4f7dc24c6f50ae96764
https://github.com/miguelgrinberg/Flask-MarrowMailer/blob/daf1ac0745fb31db2f43f4f7dc24c6f50ae96764/flask_marrowmailer.py#L62-L69
train
miguelgrinberg/Flask-MarrowMailer
flask_marrowmailer.py
Mailer.send
def send(self, msg): '''Send the message. If message is an iterable, then send all the messages.''' app = self.app or current_app mailer = app.extensions['marrowmailer'] mailer.start() if not hasattr(msg, '__iter__'): result = mailer.send(msg) else: ...
python
def send(self, msg): '''Send the message. If message is an iterable, then send all the messages.''' app = self.app or current_app mailer = app.extensions['marrowmailer'] mailer.start() if not hasattr(msg, '__iter__'): result = mailer.send(msg) else: ...
[ "def", "send", "(", "self", ",", "msg", ")", ":", "app", "=", "self", ".", "app", "or", "current_app", "mailer", "=", "app", ".", "extensions", "[", "'marrowmailer'", "]", "mailer", ".", "start", "(", ")", "if", "not", "hasattr", "(", "msg", ",", "...
Send the message. If message is an iterable, then send all the messages.
[ "Send", "the", "message", ".", "If", "message", "is", "an", "iterable", "then", "send", "all", "the", "messages", "." ]
daf1ac0745fb31db2f43f4f7dc24c6f50ae96764
https://github.com/miguelgrinberg/Flask-MarrowMailer/blob/daf1ac0745fb31db2f43f4f7dc24c6f50ae96764/flask_marrowmailer.py#L71-L82
train
brutus/wdiffhtml
wdiffhtml/__init__.py
wdiff
def wdiff( settings, wrap_with_html=False, fold_breaks=False, hard_breaks=False ): """ Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<in...
python
def wdiff( settings, wrap_with_html=False, fold_breaks=False, hard_breaks=False ): """ Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<in...
[ "def", "wdiff", "(", "settings", ",", "wrap_with_html", "=", "False", ",", "fold_breaks", "=", "False", ",", "hard_breaks", "=", "False", ")", ":", "diff", "=", "generate_wdiff", "(", "settings", ".", "org_file", ",", "settings", ".", "new_file", ",", "fol...
Returns the results of `wdiff` in a HTML compatible format. Needs a :cls:`settings.Settings` object. If *wrap_with_html* is set, the *diff* is returned in a full HTML document structure. If *fold_breaks* is set, `<ins>` and `<del>` tags are allowed to span line breaks If *hard_breaks* is set, line break...
[ "Returns", "the", "results", "of", "wdiff", "in", "a", "HTML", "compatible", "format", "." ]
e97b524a7945f7a626e33ec141343120c524d9fa
https://github.com/brutus/wdiffhtml/blob/e97b524a7945f7a626e33ec141343120c524d9fa/wdiffhtml/__init__.py#L62-L83
train
mesbahamin/chronophore
chronophore/config.py
_load_config
def _load_config(config_file): """Load settings from config file and return them as a dict. If the config file is not found, or if it is invalid, create and use a default config file. :param config_file: `pathlib.Path` object. Path to config file. :return: Dictionary of config options. """ ...
python
def _load_config(config_file): """Load settings from config file and return them as a dict. If the config file is not found, or if it is invalid, create and use a default config file. :param config_file: `pathlib.Path` object. Path to config file. :return: Dictionary of config options. """ ...
[ "def", "_load_config", "(", "config_file", ")", ":", "logger", ".", "debug", "(", "'Config file: {}'", ".", "format", "(", "config_file", ")", ")", "parser", "=", "configparser", ".", "ConfigParser", "(", ")", "try", ":", "with", "config_file", ".", "open", ...
Load settings from config file and return them as a dict. If the config file is not found, or if it is invalid, create and use a default config file. :param config_file: `pathlib.Path` object. Path to config file. :return: Dictionary of config options.
[ "Load", "settings", "from", "config", "file", "and", "return", "them", "as", "a", "dict", ".", "If", "the", "config", "file", "is", "not", "found", "or", "if", "it", "is", "invalid", "create", "and", "use", "a", "default", "config", "file", "." ]
ee140c61b4dfada966f078de8304bac737cec6f7
https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/config.py#L13-L44
train
mesbahamin/chronophore
chronophore/config.py
_load_options
def _load_options(parser): """Load config options from parser and return them as a dict. :param parser: `ConfigParser` object with the values loaded. :return: Dictionary of config options. """ config = dict( MESSAGE_DURATION=parser.getint('gui', 'message_duration'), GUI_WELCOME_LABL...
python
def _load_options(parser): """Load config options from parser and return them as a dict. :param parser: `ConfigParser` object with the values loaded. :return: Dictionary of config options. """ config = dict( MESSAGE_DURATION=parser.getint('gui', 'message_duration'), GUI_WELCOME_LABL...
[ "def", "_load_options", "(", "parser", ")", ":", "config", "=", "dict", "(", "MESSAGE_DURATION", "=", "parser", ".", "getint", "(", "'gui'", ",", "'message_duration'", ")", ",", "GUI_WELCOME_LABLE", "=", "parser", ".", "get", "(", "'gui'", ",", "'gui_welcome...
Load config options from parser and return them as a dict. :param parser: `ConfigParser` object with the values loaded. :return: Dictionary of config options.
[ "Load", "config", "options", "from", "parser", "and", "return", "them", "as", "a", "dict", "." ]
ee140c61b4dfada966f078de8304bac737cec6f7
https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/config.py#L47-L63
train
mesbahamin/chronophore
chronophore/config.py
_use_default
def _use_default(config_file): """Write default values to a config file. If another config file already exists, back it up before replacing it with the new file. :param config_file: `pathlib.Path` object. Path to config file. :return: `ConfigParser` object with the values loaded. """ default_co...
python
def _use_default(config_file): """Write default values to a config file. If another config file already exists, back it up before replacing it with the new file. :param config_file: `pathlib.Path` object. Path to config file. :return: `ConfigParser` object with the values loaded. """ default_co...
[ "def", "_use_default", "(", "config_file", ")", ":", "default_config", "=", "OrderedDict", "(", "(", "(", "'gui'", ",", "OrderedDict", "(", "(", "(", "'message_duration'", ",", "5", ")", ",", "(", "'gui_welcome_label'", ",", "'Welcome to the STEM Learning Center!'...
Write default values to a config file. If another config file already exists, back it up before replacing it with the new file. :param config_file: `pathlib.Path` object. Path to config file. :return: `ConfigParser` object with the values loaded.
[ "Write", "default", "values", "to", "a", "config", "file", ".", "If", "another", "config", "file", "already", "exists", "back", "it", "up", "before", "replacing", "it", "with", "the", "new", "file", "." ]
ee140c61b4dfada966f078de8304bac737cec6f7
https://github.com/mesbahamin/chronophore/blob/ee140c61b4dfada966f078de8304bac737cec6f7/chronophore/config.py#L66-L104
train
mojaie/chorus
chorus/model/graphmol.py
Compound.add_atom
def add_atom(self, key, atom): """Set an atom. Existing atom will be overwritten.""" self.graph.add_node(key, atom=atom)
python
def add_atom(self, key, atom): """Set an atom. Existing atom will be overwritten.""" self.graph.add_node(key, atom=atom)
[ "def", "add_atom", "(", "self", ",", "key", ",", "atom", ")", ":", "self", ".", "graph", ".", "add_node", "(", "key", ",", "atom", "=", "atom", ")" ]
Set an atom. Existing atom will be overwritten.
[ "Set", "an", "atom", ".", "Existing", "atom", "will", "be", "overwritten", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L79-L81
train
mojaie/chorus
chorus/model/graphmol.py
Compound.atoms_iter
def atoms_iter(self): """Iterate over atoms.""" for n, atom in self.graph.nodes.data("atom"): yield n, atom
python
def atoms_iter(self): """Iterate over atoms.""" for n, atom in self.graph.nodes.data("atom"): yield n, atom
[ "def", "atoms_iter", "(", "self", ")", ":", "for", "n", ",", "atom", "in", "self", ".", "graph", ".", "nodes", ".", "data", "(", "\"atom\"", ")", ":", "yield", "n", ",", "atom" ]
Iterate over atoms.
[ "Iterate", "over", "atoms", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L87-L90
train
mojaie/chorus
chorus/model/graphmol.py
Compound.add_bond
def add_bond(self, key1, key2, bond): """Set a bond. Existing bond will be overwritten.""" self.graph.add_edge(key1, key2, bond=bond)
python
def add_bond(self, key1, key2, bond): """Set a bond. Existing bond will be overwritten.""" self.graph.add_edge(key1, key2, bond=bond)
[ "def", "add_bond", "(", "self", ",", "key1", ",", "key2", ",", "bond", ")", ":", "self", ".", "graph", ".", "add_edge", "(", "key1", ",", "key2", ",", "bond", "=", "bond", ")" ]
Set a bond. Existing bond will be overwritten.
[ "Set", "a", "bond", ".", "Existing", "bond", "will", "be", "overwritten", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L100-L102
train
mojaie/chorus
chorus/model/graphmol.py
Compound.bonds_iter
def bonds_iter(self): """Iterate over bonds.""" for u, v, bond in self.graph.edges.data("bond"): yield u, v, bond
python
def bonds_iter(self): """Iterate over bonds.""" for u, v, bond in self.graph.edges.data("bond"): yield u, v, bond
[ "def", "bonds_iter", "(", "self", ")", ":", "for", "u", ",", "v", ",", "bond", "in", "self", ".", "graph", ".", "edges", ".", "data", "(", "\"bond\"", ")", ":", "yield", "u", ",", "v", ",", "bond" ]
Iterate over bonds.
[ "Iterate", "over", "bonds", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L108-L111
train
mojaie/chorus
chorus/model/graphmol.py
Compound.neighbors
def neighbors(self, key): """Return dict of neighbor atom index and connecting bond.""" return {n: attr["bond"] for n, attr in self.graph[key].items()}
python
def neighbors(self, key): """Return dict of neighbor atom index and connecting bond.""" return {n: attr["bond"] for n, attr in self.graph[key].items()}
[ "def", "neighbors", "(", "self", ",", "key", ")", ":", "return", "{", "n", ":", "attr", "[", "\"bond\"", "]", "for", "n", ",", "attr", "in", "self", ".", "graph", "[", "key", "]", ".", "items", "(", ")", "}" ]
Return dict of neighbor atom index and connecting bond.
[ "Return", "dict", "of", "neighbor", "atom", "index", "and", "connecting", "bond", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L121-L123
train
mojaie/chorus
chorus/model/graphmol.py
Compound.neighbors_iter
def neighbors_iter(self): """Iterate over atoms and return its neighbors.""" for n, adj in self.graph.adj.items(): yield n, {n: attr["bond"] for n, attr in adj.items()}
python
def neighbors_iter(self): """Iterate over atoms and return its neighbors.""" for n, adj in self.graph.adj.items(): yield n, {n: attr["bond"] for n, attr in adj.items()}
[ "def", "neighbors_iter", "(", "self", ")", ":", "for", "n", ",", "adj", "in", "self", ".", "graph", ".", "adj", ".", "items", "(", ")", ":", "yield", "n", ",", "{", "n", ":", "attr", "[", "\"bond\"", "]", "for", "n", ",", "attr", "in", "adj", ...
Iterate over atoms and return its neighbors.
[ "Iterate", "over", "atoms", "and", "return", "its", "neighbors", "." ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L129-L132
train
mojaie/chorus
chorus/model/graphmol.py
Compound.clear
def clear(self): """Empty the instance """ # self.graph = nx.Graph() self.graph.clear() self.data.clear() self.descriptors.clear() self.size2d = None self.rings = None self.scaffolds = None self.isolated = None
python
def clear(self): """Empty the instance """ # self.graph = nx.Graph() self.graph.clear() self.data.clear() self.descriptors.clear() self.size2d = None self.rings = None self.scaffolds = None self.isolated = None
[ "def", "clear", "(", "self", ")", ":", "self", ".", "graph", ".", "clear", "(", ")", "self", ".", "data", ".", "clear", "(", ")", "self", ".", "descriptors", ".", "clear", "(", ")", "self", ".", "size2d", "=", "None", "self", ".", "rings", "=", ...
Empty the instance
[ "Empty", "the", "instance" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/model/graphmol.py#L134-L143
train
mojaie/chorus
chorus/draw/qt.py
Qt._convert
def _convert(self, pos): """ For QPainter coordinate system, reflect over X axis and translate from center to top-left """ px = pos[0] + self.logical_size.width() / 2 py = self.logical_size.height() / 2 - pos[1] return px, py
python
def _convert(self, pos): """ For QPainter coordinate system, reflect over X axis and translate from center to top-left """ px = pos[0] + self.logical_size.width() / 2 py = self.logical_size.height() / 2 - pos[1] return px, py
[ "def", "_convert", "(", "self", ",", "pos", ")", ":", "px", "=", "pos", "[", "0", "]", "+", "self", ".", "logical_size", ".", "width", "(", ")", "/", "2", "py", "=", "self", ".", "logical_size", ".", "height", "(", ")", "/", "2", "-", "pos", ...
For QPainter coordinate system, reflect over X axis and translate from center to top-left
[ "For", "QPainter", "coordinate", "system", "reflect", "over", "X", "axis", "and", "translate", "from", "center", "to", "top", "-", "left" ]
fc7fe23a0272554c67671645ab07830b315eeb1b
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/qt.py#L181-L187
train
lsst-sqre/documenteer
documenteer/sphinxrunner.py
run_sphinx
def run_sphinx(root_dir): """Run the Sphinx build process. Parameters ---------- root_dir : `str` Root directory of the Sphinx project and content source. This directory conatains both the root ``index.rst`` file and the ``conf.py`` configuration file. Returns ------- ...
python
def run_sphinx(root_dir): """Run the Sphinx build process. Parameters ---------- root_dir : `str` Root directory of the Sphinx project and content source. This directory conatains both the root ``index.rst`` file and the ``conf.py`` configuration file. Returns ------- ...
[ "def", "run_sphinx", "(", "root_dir", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "root_dir", "=", "os", ".", "path", ".", "abspath", "(", "root_dir", ")", "srcdir", "=", "root_dir", "confdir", "=", "root_dir", "outdir", "...
Run the Sphinx build process. Parameters ---------- root_dir : `str` Root directory of the Sphinx project and content source. This directory conatains both the root ``index.rst`` file and the ``conf.py`` configuration file. Returns ------- status : `int` Sphinx ...
[ "Run", "the", "Sphinx", "build", "process", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxrunner.py#L19-L90
train
Antojitos/guacamole-cli
src/guacamole_cli/__init__.py
get_settings
def get_settings(config_file): """Search and load a configuration file.""" default_settings = { 'general': { 'endpoint': 'http://guacamole.antojitos.io/files/', 'shortener': 'http://t.antojitos.io/api/v1/urls', } } settings = configparser.ConfigParser() try: ...
python
def get_settings(config_file): """Search and load a configuration file.""" default_settings = { 'general': { 'endpoint': 'http://guacamole.antojitos.io/files/', 'shortener': 'http://t.antojitos.io/api/v1/urls', } } settings = configparser.ConfigParser() try: ...
[ "def", "get_settings", "(", "config_file", ")", ":", "default_settings", "=", "{", "'general'", ":", "{", "'endpoint'", ":", "'http://guacamole.antojitos.io/files/'", ",", "'shortener'", ":", "'http://t.antojitos.io/api/v1/urls'", ",", "}", "}", "settings", "=", "conf...
Search and load a configuration file.
[ "Search", "and", "load", "a", "configuration", "file", "." ]
e3ae6b8eb08379ffb784978587bf24b168af73d0
https://github.com/Antojitos/guacamole-cli/blob/e3ae6b8eb08379ffb784978587bf24b168af73d0/src/guacamole_cli/__init__.py#L16-L41
train
ShadowBlip/Neteria
neteria/encryption.py
Encryption.encrypt
def encrypt(self, message, public_key): """Encrypts a string using a given rsa.PublicKey object. If the message is larger than the key, it will split it up into a list and encrypt each line in the list. Args: message (string): The string to encrypt. public_key (rsa.P...
python
def encrypt(self, message, public_key): """Encrypts a string using a given rsa.PublicKey object. If the message is larger than the key, it will split it up into a list and encrypt each line in the list. Args: message (string): The string to encrypt. public_key (rsa.P...
[ "def", "encrypt", "(", "self", ",", "message", ",", "public_key", ")", ":", "max_str_len", "=", "rsa", ".", "common", ".", "byte_size", "(", "public_key", ".", "n", ")", "-", "11", "if", "len", "(", "message", ")", ">", "max_str_len", ":", "message", ...
Encrypts a string using a given rsa.PublicKey object. If the message is larger than the key, it will split it up into a list and encrypt each line in the list. Args: message (string): The string to encrypt. public_key (rsa.PublicKey): The key object used to encrypt the ...
[ "Encrypts", "a", "string", "using", "a", "given", "rsa", ".", "PublicKey", "object", ".", "If", "the", "message", "is", "larger", "than", "the", "key", "it", "will", "split", "it", "up", "into", "a", "list", "and", "encrypt", "each", "line", "in", "the...
1a8c976eb2beeca0a5a272a34ac58b2c114495a4
https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/encryption.py#L43-L87
train
ShadowBlip/Neteria
neteria/encryption.py
Encryption.decrypt
def decrypt(self, message): """Decrypts a string using our own private key object. Args: message (string): The string of the message to decrypt. Returns: The unencrypted string. """ # Unserialize the encrypted message message = json.loads(message) ...
python
def decrypt(self, message): """Decrypts a string using our own private key object. Args: message (string): The string of the message to decrypt. Returns: The unencrypted string. """ # Unserialize the encrypted message message = json.loads(message) ...
[ "def", "decrypt", "(", "self", ",", "message", ")", ":", "message", "=", "json", ".", "loads", "(", "message", ")", "unencrypted_msg", "=", "[", "]", "for", "line", "in", "message", ":", "enc_line", "=", "binascii", ".", "a2b_base64", "(", "line", ")",...
Decrypts a string using our own private key object. Args: message (string): The string of the message to decrypt. Returns: The unencrypted string.
[ "Decrypts", "a", "string", "using", "our", "own", "private", "key", "object", "." ]
1a8c976eb2beeca0a5a272a34ac58b2c114495a4
https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/encryption.py#L90-L120
train
mastro35/flows
flows/Actions/InputWatchdogAction.py
DannyFileSystemEventHandler.on_any_event
def on_any_event(self, event): """On any event method""" for delegate in self.delegates: if hasattr(delegate, "on_any_event"): delegate.on_any_event(event)
python
def on_any_event(self, event): """On any event method""" for delegate in self.delegates: if hasattr(delegate, "on_any_event"): delegate.on_any_event(event)
[ "def", "on_any_event", "(", "self", ",", "event", ")", ":", "for", "delegate", "in", "self", ".", "delegates", ":", "if", "hasattr", "(", "delegate", ",", "\"on_any_event\"", ")", ":", "delegate", ".", "on_any_event", "(", "event", ")" ]
On any event method
[ "On", "any", "event", "method" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputWatchdogAction.py#L28-L32
train
mastro35/flows
flows/Actions/InputWatchdogAction.py
DannyFileSystemEventHandler.on_created
def on_created(self, event): """On created method""" for delegate in self.delegates: if hasattr(delegate, "on_created"): delegate.on_created(event)
python
def on_created(self, event): """On created method""" for delegate in self.delegates: if hasattr(delegate, "on_created"): delegate.on_created(event)
[ "def", "on_created", "(", "self", ",", "event", ")", ":", "for", "delegate", "in", "self", ".", "delegates", ":", "if", "hasattr", "(", "delegate", ",", "\"on_created\"", ")", ":", "delegate", ".", "on_created", "(", "event", ")" ]
On created method
[ "On", "created", "method" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputWatchdogAction.py#L34-L38
train
mastro35/flows
flows/Actions/InputWatchdogAction.py
DannyFileSystemEventHandler.on_deleted
def on_deleted(self, event): """On deleted method""" for delegate in self.delegates: if hasattr(delegate, "on_deleted"): delegate.on_deleted(event)
python
def on_deleted(self, event): """On deleted method""" for delegate in self.delegates: if hasattr(delegate, "on_deleted"): delegate.on_deleted(event)
[ "def", "on_deleted", "(", "self", ",", "event", ")", ":", "for", "delegate", "in", "self", ".", "delegates", ":", "if", "hasattr", "(", "delegate", ",", "\"on_deleted\"", ")", ":", "delegate", ".", "on_deleted", "(", "event", ")" ]
On deleted method
[ "On", "deleted", "method" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputWatchdogAction.py#L40-L44
train
mastro35/flows
flows/Actions/InputWatchdogAction.py
DannyFileSystemEventHandler.on_modified
def on_modified(self, event): """On modified method""" for delegate in self.delegates: if hasattr(delegate, "on_modified"): delegate.on_modified(event)
python
def on_modified(self, event): """On modified method""" for delegate in self.delegates: if hasattr(delegate, "on_modified"): delegate.on_modified(event)
[ "def", "on_modified", "(", "self", ",", "event", ")", ":", "for", "delegate", "in", "self", ".", "delegates", ":", "if", "hasattr", "(", "delegate", ",", "\"on_modified\"", ")", ":", "delegate", ".", "on_modified", "(", "event", ")" ]
On modified method
[ "On", "modified", "method" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputWatchdogAction.py#L46-L50
train
mastro35/flows
flows/Actions/InputWatchdogAction.py
DannyFileSystemEventHandler.on_moved
def on_moved(self, event): """On moved method""" for delegate in self.delegates: if hasattr(delegate, "on_moved"): delegate.on_moved(event)
python
def on_moved(self, event): """On moved method""" for delegate in self.delegates: if hasattr(delegate, "on_moved"): delegate.on_moved(event)
[ "def", "on_moved", "(", "self", ",", "event", ")", ":", "for", "delegate", "in", "self", ".", "delegates", ":", "if", "hasattr", "(", "delegate", ",", "\"on_moved\"", ")", ":", "delegate", ".", "on_moved", "(", "event", ")" ]
On moved method
[ "On", "moved", "method" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputWatchdogAction.py#L52-L56
train
mastro35/flows
flows/Actions/InputWatchdogAction.py
WatchdogAction.on_created
def on_created(self, event): '''Fired when something's been created''' if self.trigger != "create": return action_input = ActionInput(event, "", self.name) flows.Global.MESSAGE_DISPATCHER.send_message(action_input)
python
def on_created(self, event): '''Fired when something's been created''' if self.trigger != "create": return action_input = ActionInput(event, "", self.name) flows.Global.MESSAGE_DISPATCHER.send_message(action_input)
[ "def", "on_created", "(", "self", ",", "event", ")", ":", "if", "self", ".", "trigger", "!=", "\"create\"", ":", "return", "action_input", "=", "ActionInput", "(", "event", ",", "\"\"", ",", "self", ".", "name", ")", "flows", ".", "Global", ".", "MESSA...
Fired when something's been created
[ "Fired", "when", "something", "s", "been", "created" ]
05e488385673a69597b5b39c7728795aa4d5eb18
https://github.com/mastro35/flows/blob/05e488385673a69597b5b39c7728795aa4d5eb18/flows/Actions/InputWatchdogAction.py#L118-L123
train
zsimic/runez
src/runez/heartbeat.py
Heartbeat.start
def start(cls): """Start background thread if not already started""" if cls._thread is None: cls._thread = threading.Thread(target=cls._run, name="Heartbeat") cls._thread.daemon = True cls._thread.start()
python
def start(cls): """Start background thread if not already started""" if cls._thread is None: cls._thread = threading.Thread(target=cls._run, name="Heartbeat") cls._thread.daemon = True cls._thread.start()
[ "def", "start", "(", "cls", ")", ":", "if", "cls", ".", "_thread", "is", "None", ":", "cls", ".", "_thread", "=", "threading", ".", "Thread", "(", "target", "=", "cls", ".", "_run", ",", "name", "=", "\"Heartbeat\"", ")", "cls", ".", "_thread", "."...
Start background thread if not already started
[ "Start", "background", "thread", "if", "not", "already", "started" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/heartbeat.py#L82-L87
train
zsimic/runez
src/runez/heartbeat.py
Heartbeat.resolved_task
def resolved_task(cls, task): """Task instance representing 'task', if any""" for t in cls.tasks: if t is task or t.execute is task: return t
python
def resolved_task(cls, task): """Task instance representing 'task', if any""" for t in cls.tasks: if t is task or t.execute is task: return t
[ "def", "resolved_task", "(", "cls", ",", "task", ")", ":", "for", "t", "in", "cls", ".", "tasks", ":", "if", "t", "is", "task", "or", "t", ".", "execute", "is", "task", ":", "return", "t" ]
Task instance representing 'task', if any
[ "Task", "instance", "representing", "task", "if", "any" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/heartbeat.py#L118-L122
train
zsimic/runez
src/runez/heartbeat.py
Heartbeat._run
def _run(cls): """Background thread's main function, execute registered tasks accordingly to their frequencies""" if cls._thread: with cls._lock: # First run: execute each task once to get it started for task in cls.tasks: cls._execute_task...
python
def _run(cls): """Background thread's main function, execute registered tasks accordingly to their frequencies""" if cls._thread: with cls._lock: # First run: execute each task once to get it started for task in cls.tasks: cls._execute_task...
[ "def", "_run", "(", "cls", ")", ":", "if", "cls", ".", "_thread", ":", "with", "cls", ".", "_lock", ":", "for", "task", "in", "cls", ".", "tasks", ":", "cls", ".", "_execute_task", "(", "task", ")", "cls", ".", "tasks", ".", "sort", "(", ")", "...
Background thread's main function, execute registered tasks accordingly to their frequencies
[ "Background", "thread", "s", "main", "function", "execute", "registered", "tasks", "accordingly", "to", "their", "frequencies" ]
14363b719a1aae1528859a501a22d075ce0abfcc
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/heartbeat.py#L149-L177
train
wesleybeckner/salty
salty/visualization.py
parity_plot
def parity_plot(X, Y, model, devmodel, axes_labels=None): """ A standard method of creating parity plots between predicted and experimental values for trained models. Parameters ---------- X: array experimental input data Y: array experimental output data model: model ob...
python
def parity_plot(X, Y, model, devmodel, axes_labels=None): """ A standard method of creating parity plots between predicted and experimental values for trained models. Parameters ---------- X: array experimental input data Y: array experimental output data model: model ob...
[ "def", "parity_plot", "(", "X", ",", "Y", ",", "model", ",", "devmodel", ",", "axes_labels", "=", "None", ")", ":", "model_outputs", "=", "Y", ".", "shape", "[", "1", "]", "with", "plt", ".", "style", ".", "context", "(", "'seaborn-whitegrid'", ")", ...
A standard method of creating parity plots between predicted and experimental values for trained models. Parameters ---------- X: array experimental input data Y: array experimental output data model: model object either sklearn or keras ML model devmodel: dev_model ...
[ "A", "standard", "method", "of", "creating", "parity", "plots", "between", "predicted", "and", "experimental", "values", "for", "trained", "models", "." ]
ef17a97aea3e4f81fcd0359ce85b3438c0e6499b
https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/visualization.py#L6-L60
train
potash/drain
drain/data.py
expand_dates
def expand_dates(df, columns=[]): """ generate year, month, day features from specified date features """ columns = df.columns.intersection(columns) df2 = df.reindex(columns=set(df.columns).difference(columns)) for column in columns: df2[column + '_year'] = df[column].apply(lambda x: x.y...
python
def expand_dates(df, columns=[]): """ generate year, month, day features from specified date features """ columns = df.columns.intersection(columns) df2 = df.reindex(columns=set(df.columns).difference(columns)) for column in columns: df2[column + '_year'] = df[column].apply(lambda x: x.y...
[ "def", "expand_dates", "(", "df", ",", "columns", "=", "[", "]", ")", ":", "columns", "=", "df", ".", "columns", ".", "intersection", "(", "columns", ")", "df2", "=", "df", ".", "reindex", "(", "columns", "=", "set", "(", "df", ".", "columns", ")",...
generate year, month, day features from specified date features
[ "generate", "year", "month", "day", "features", "from", "specified", "date", "features" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L203-L213
train
potash/drain
drain/data.py
binarize
def binarize(df, category_classes, all_classes=True, drop=True, astype=None, inplace=True, min_freq=None): """ Binarize specified categoricals. Works inplace! Args: - df: the DataFrame whose columns to binarize - category_classes: either a dict of (column : [class1, class2, ......
python
def binarize(df, category_classes, all_classes=True, drop=True, astype=None, inplace=True, min_freq=None): """ Binarize specified categoricals. Works inplace! Args: - df: the DataFrame whose columns to binarize - category_classes: either a dict of (column : [class1, class2, ......
[ "def", "binarize", "(", "df", ",", "category_classes", ",", "all_classes", "=", "True", ",", "drop", "=", "True", ",", "astype", "=", "None", ",", "inplace", "=", "True", ",", "min_freq", "=", "None", ")", ":", "if", "type", "(", "category_classes", ")...
Binarize specified categoricals. Works inplace! Args: - df: the DataFrame whose columns to binarize - category_classes: either a dict of (column : [class1, class2, ...]) pairs or a collection of column names, in which case classes are given using df[column].unique() ...
[ "Binarize", "specified", "categoricals", ".", "Works", "inplace!" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L216-L255
train
potash/drain
drain/data.py
select_regexes
def select_regexes(strings, regexes): """ select subset of strings matching a regex treats strings as a set """ strings = set(strings) select = set() if isinstance(strings, collections.Iterable): for r in regexes: s = set(filter(re.compile('^' + r + '$').search, strings))...
python
def select_regexes(strings, regexes): """ select subset of strings matching a regex treats strings as a set """ strings = set(strings) select = set() if isinstance(strings, collections.Iterable): for r in regexes: s = set(filter(re.compile('^' + r + '$').search, strings))...
[ "def", "select_regexes", "(", "strings", ",", "regexes", ")", ":", "strings", "=", "set", "(", "strings", ")", "select", "=", "set", "(", ")", "if", "isinstance", "(", "strings", ",", "collections", ".", "Iterable", ")", ":", "for", "r", "in", "regexes...
select subset of strings matching a regex treats strings as a set
[ "select", "subset", "of", "strings", "matching", "a", "regex", "treats", "strings", "as", "a", "set" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L399-L413
train
potash/drain
drain/data.py
parse_delta
def parse_delta(s): """ parse a string to a delta 'all' is represented by None """ if s == 'all': return None else: ls = delta_regex.findall(s) if len(ls) == 1: return relativedelta(**{delta_chars[ls[0][1]]: int(ls[0][0])}) else: raise Valu...
python
def parse_delta(s): """ parse a string to a delta 'all' is represented by None """ if s == 'all': return None else: ls = delta_regex.findall(s) if len(ls) == 1: return relativedelta(**{delta_chars[ls[0][1]]: int(ls[0][0])}) else: raise Valu...
[ "def", "parse_delta", "(", "s", ")", ":", "if", "s", "==", "'all'", ":", "return", "None", "else", ":", "ls", "=", "delta_regex", ".", "findall", "(", "s", ")", "if", "len", "(", "ls", ")", "==", "1", ":", "return", "relativedelta", "(", "**", "{...
parse a string to a delta 'all' is represented by None
[ "parse", "a", "string", "to", "a", "delta", "all", "is", "represented", "by", "None" ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L623-L635
train
potash/drain
drain/data.py
Column.apply
def apply(self, df): """Takes a pd.DataFrame and returns the newly defined column, i.e. a pd.Series that has the same index as `df`. """ if hasattr(self.definition, '__call__'): r = self.definition(df) elif self.definition in df.columns: r = df[self.defini...
python
def apply(self, df): """Takes a pd.DataFrame and returns the newly defined column, i.e. a pd.Series that has the same index as `df`. """ if hasattr(self.definition, '__call__'): r = self.definition(df) elif self.definition in df.columns: r = df[self.defini...
[ "def", "apply", "(", "self", ",", "df", ")", ":", "if", "hasattr", "(", "self", ".", "definition", ",", "'__call__'", ")", ":", "r", "=", "self", ".", "definition", "(", "df", ")", "elif", "self", ".", "definition", "in", "df", ".", "columns", ":",...
Takes a pd.DataFrame and returns the newly defined column, i.e. a pd.Series that has the same index as `df`.
[ "Takes", "a", "pd", ".", "DataFrame", "and", "returns", "the", "newly", "defined", "column", "i", ".", "e", ".", "a", "pd", ".", "Series", "that", "has", "the", "same", "index", "as", "df", "." ]
ddd62081cb9317beb5d21f86c8b4bb196ca3d222
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L44-L56
train
untwisted/untwisted
untwisted/iputils.py
ip_to_long
def ip_to_long (ip): """ Convert ip address to a network byte order 32-bit integer. """ quad = ip.split('.') if len(quad) == 1: quad = quad + [0, 0, 0] elif len(quad) < 4: host = quad[-1:] quad = quad[:-1] + [0,] * (4 - len(quad)) + host lip = 0 for q in quad: ...
python
def ip_to_long (ip): """ Convert ip address to a network byte order 32-bit integer. """ quad = ip.split('.') if len(quad) == 1: quad = quad + [0, 0, 0] elif len(quad) < 4: host = quad[-1:] quad = quad[:-1] + [0,] * (4 - len(quad)) + host lip = 0 for q in quad: ...
[ "def", "ip_to_long", "(", "ip", ")", ":", "quad", "=", "ip", ".", "split", "(", "'.'", ")", "if", "len", "(", "quad", ")", "==", "1", ":", "quad", "=", "quad", "+", "[", "0", ",", "0", ",", "0", "]", "elif", "len", "(", "quad", ")", "<", ...
Convert ip address to a network byte order 32-bit integer.
[ "Convert", "ip", "address", "to", "a", "network", "byte", "order", "32", "-", "bit", "integer", "." ]
8a8d9c8a8d0f3452d5de67cd760297bb5759f637
https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iputils.py#L1-L15
train
lsst-sqre/documenteer
documenteer/sphinxext/lsstdocushare.py
lsst_doc_shortlink_role
def lsst_doc_shortlink_role(name, rawtext, text, lineno, inliner, options=None, content=None): """Link to LSST documents given their handle using LSST's ls.st link shortener. Example:: :ldm:`151` """ options = options or {} content = content or [] node =...
python
def lsst_doc_shortlink_role(name, rawtext, text, lineno, inliner, options=None, content=None): """Link to LSST documents given their handle using LSST's ls.st link shortener. Example:: :ldm:`151` """ options = options or {} content = content or [] node =...
[ "def", "lsst_doc_shortlink_role", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "content", "=", "content", "or", "...
Link to LSST documents given their handle using LSST's ls.st link shortener. Example:: :ldm:`151`
[ "Link", "to", "LSST", "documents", "given", "their", "handle", "using", "LSST", "s", "ls", ".", "st", "link", "shortener", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lsstdocushare.py#L6-L21
train
lsst-sqre/documenteer
documenteer/sphinxext/lsstdocushare.py
lsst_doc_shortlink_titlecase_display_role
def lsst_doc_shortlink_titlecase_display_role( name, rawtext, text, lineno, inliner, options=None, content=None): """Link to LSST documents given their handle using LSST's ls.st link shortener with the document handle displayed in title case. This role is useful for Document, Report, Minutes, and C...
python
def lsst_doc_shortlink_titlecase_display_role( name, rawtext, text, lineno, inliner, options=None, content=None): """Link to LSST documents given their handle using LSST's ls.st link shortener with the document handle displayed in title case. This role is useful for Document, Report, Minutes, and C...
[ "def", "lsst_doc_shortlink_titlecase_display_role", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "content", "=", "con...
Link to LSST documents given their handle using LSST's ls.st link shortener with the document handle displayed in title case. This role is useful for Document, Report, Minutes, and Collection DocuShare handles. Example:: :document:`1`
[ "Link", "to", "LSST", "documents", "given", "their", "handle", "using", "LSST", "s", "ls", ".", "st", "link", "shortener", "with", "the", "document", "handle", "displayed", "in", "title", "case", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lsstdocushare.py#L24-L42
train
lsst-sqre/documenteer
documenteer/bin/refreshlsstbib.py
run
def run(): """Command line entrypoint for the ``refresh-lsst-bib`` program. """ args = parse_args() if args.verbose: log_level = logging.DEBUG else: log_level = logging.INFO logging.basicConfig( level=log_level, format='%(asctime)s %(levelname)s %(name)s: %(messa...
python
def run(): """Command line entrypoint for the ``refresh-lsst-bib`` program. """ args = parse_args() if args.verbose: log_level = logging.DEBUG else: log_level = logging.INFO logging.basicConfig( level=log_level, format='%(asctime)s %(levelname)s %(name)s: %(messa...
[ "def", "run", "(", ")", ":", "args", "=", "parse_args", "(", ")", "if", "args", ".", "verbose", ":", "log_level", "=", "logging", ".", "DEBUG", "else", ":", "log_level", "=", "logging", ".", "INFO", "logging", ".", "basicConfig", "(", "level", "=", "...
Command line entrypoint for the ``refresh-lsst-bib`` program.
[ "Command", "line", "entrypoint", "for", "the", "refresh", "-", "lsst", "-", "bib", "program", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/bin/refreshlsstbib.py#L20-L43
train
lsst-sqre/documenteer
documenteer/stackdocs/build.py
run_build_cli
def run_build_cli(): """Command line entrypoint for the ``build-stack-docs`` program. """ args = parse_args() if args.verbose: log_level = logging.DEBUG else: log_level = logging.INFO logging.basicConfig( level=log_level, format='%(asctime)s %(levelname)s %(name)...
python
def run_build_cli(): """Command line entrypoint for the ``build-stack-docs`` program. """ args = parse_args() if args.verbose: log_level = logging.DEBUG else: log_level = logging.INFO logging.basicConfig( level=log_level, format='%(asctime)s %(levelname)s %(name)...
[ "def", "run_build_cli", "(", ")", ":", "args", "=", "parse_args", "(", ")", "if", "args", ".", "verbose", ":", "log_level", "=", "logging", ".", "DEBUG", "else", ":", "log_level", "=", "logging", ".", "INFO", "logging", ".", "basicConfig", "(", "level", ...
Command line entrypoint for the ``build-stack-docs`` program.
[ "Command", "line", "entrypoint", "for", "the", "build", "-", "stack", "-", "docs", "program", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L25-L48
train
lsst-sqre/documenteer
documenteer/stackdocs/build.py
parse_args
def parse_args(): """Create an argument parser for the ``build-stack-docs`` program. Returns ------- args : `argparse.Namespace` Parsed argument object. """ parser = argparse.ArgumentParser( description="Build a Sphinx documentation site for an EUPS stack, " ...
python
def parse_args(): """Create an argument parser for the ``build-stack-docs`` program. Returns ------- args : `argparse.Namespace` Parsed argument object. """ parser = argparse.ArgumentParser( description="Build a Sphinx documentation site for an EUPS stack, " ...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Build a Sphinx documentation site for an EUPS stack, \"", "\"such as pipelines.lsst.io.\"", ",", "epilog", "=", "\"Version {0}\"", ".", "format", "(", "__vers...
Create an argument parser for the ``build-stack-docs`` program. Returns ------- args : `argparse.Namespace` Parsed argument object.
[ "Create", "an", "argument", "parser", "for", "the", "build", "-", "stack", "-", "docs", "program", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L133-L156
train
lsst-sqre/documenteer
documenteer/stackdocs/build.py
discover_setup_packages
def discover_setup_packages(): """Summarize packages currently set up by EUPS, listing their set up directories and EUPS version names. Returns ------- packages : `dict` Dictionary with keys that are EUPS package names. Values are dictionaries with fields: - ``'dir'``: absolut...
python
def discover_setup_packages(): """Summarize packages currently set up by EUPS, listing their set up directories and EUPS version names. Returns ------- packages : `dict` Dictionary with keys that are EUPS package names. Values are dictionaries with fields: - ``'dir'``: absolut...
[ "def", "discover_setup_packages", "(", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "import", "eups", "eups_client", "=", "eups", ".", "Eups", "(", ")", "products", "=", "eups_client", ".", "getSetupProducts", "(", ")", "packag...
Summarize packages currently set up by EUPS, listing their set up directories and EUPS version names. Returns ------- packages : `dict` Dictionary with keys that are EUPS package names. Values are dictionaries with fields: - ``'dir'``: absolute directory path of the set up package...
[ "Summarize", "packages", "currently", "set", "up", "by", "EUPS", "listing", "their", "set", "up", "directories", "and", "EUPS", "version", "names", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L159-L198
train
lsst-sqre/documenteer
documenteer/stackdocs/build.py
find_table_file
def find_table_file(root_project_dir): """Find the EUPS table file for a project. Parameters ---------- root_project_dir : `str` Path to the root directory of the main documentation project. This is the directory containing the ``conf.py`` file and a ``ups`` directory. Retu...
python
def find_table_file(root_project_dir): """Find the EUPS table file for a project. Parameters ---------- root_project_dir : `str` Path to the root directory of the main documentation project. This is the directory containing the ``conf.py`` file and a ``ups`` directory. Retu...
[ "def", "find_table_file", "(", "root_project_dir", ")", ":", "ups_dir_path", "=", "os", ".", "path", ".", "join", "(", "root_project_dir", ",", "'ups'", ")", "table_path", "=", "None", "for", "name", "in", "os", ".", "listdir", "(", "ups_dir_path", ")", ":...
Find the EUPS table file for a project. Parameters ---------- root_project_dir : `str` Path to the root directory of the main documentation project. This is the directory containing the ``conf.py`` file and a ``ups`` directory. Returns ------- table_path : `str` ...
[ "Find", "the", "EUPS", "table", "file", "for", "a", "project", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L201-L225
train
lsst-sqre/documenteer
documenteer/stackdocs/build.py
list_packages_in_eups_table
def list_packages_in_eups_table(table_text): """List the names of packages that are required by an EUPS table file. Parameters ---------- table_text : `str` The text content of an EUPS table file. Returns ------- names : `list` [`str`] List of package names that are require...
python
def list_packages_in_eups_table(table_text): """List the names of packages that are required by an EUPS table file. Parameters ---------- table_text : `str` The text content of an EUPS table file. Returns ------- names : `list` [`str`] List of package names that are require...
[ "def", "list_packages_in_eups_table", "(", "table_text", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "pattern", "=", "re", ".", "compile", "(", "r'setupRequired\\((?P<name>\\w+)\\)'", ")", "listed_packages", "=", "[", "m", ".", "g...
List the names of packages that are required by an EUPS table file. Parameters ---------- table_text : `str` The text content of an EUPS table file. Returns ------- names : `list` [`str`] List of package names that are required byy the EUPS table file.
[ "List", "the", "names", "of", "packages", "that", "are", "required", "by", "an", "EUPS", "table", "file", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L228-L246
train
lsst-sqre/documenteer
documenteer/stackdocs/build.py
find_package_docs
def find_package_docs(package_dir, skippedNames=None): """Find documentation directories in a package using ``manifest.yaml``. Parameters ---------- package_dir : `str` Directory of an EUPS package. skippedNames : `list` of `str`, optional List of package or module names to skip whe...
python
def find_package_docs(package_dir, skippedNames=None): """Find documentation directories in a package using ``manifest.yaml``. Parameters ---------- package_dir : `str` Directory of an EUPS package. skippedNames : `list` of `str`, optional List of package or module names to skip whe...
[ "def", "find_package_docs", "(", "package_dir", ",", "skippedNames", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "if", "skippedNames", "is", "None", ":", "skippedNames", "=", "[", "]", "doc_dir", "=", "os", ".",...
Find documentation directories in a package using ``manifest.yaml``. Parameters ---------- package_dir : `str` Directory of an EUPS package. skippedNames : `list` of `str`, optional List of package or module names to skip when creating links. Returns ------- doc_dirs : name...
[ "Find", "documentation", "directories", "in", "a", "package", "using", "manifest", ".", "yaml", "." ]
75f02901a80042b28d074df1cc1dca32eb8e38c8
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/build.py#L249-L395
train