repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
DLR-RM/RAFCON
source/rafcon/gui/mygaphas/utils/gap_draw_helper.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/gap_draw_helper.py#L416-L445
def draw_label_path(context, width, height, arrow_height, distance_to_port, port_offset): """Draws the path for an upright label :param context: The Cairo context :param float width: Width of the label :param float height: Height of the label :param float distance_to_port: Distance to the port rela...
[ "def", "draw_label_path", "(", "context", ",", "width", ",", "height", ",", "arrow_height", ",", "distance_to_port", ",", "port_offset", ")", ":", "c", "=", "context", "# The current point is the port position", "# Mover to outer border of state", "c", ".", "rel_move_to...
Draws the path for an upright label :param context: The Cairo context :param float width: Width of the label :param float height: Height of the label :param float distance_to_port: Distance to the port related to the label :param float port_offset: Distance from the port center to its border :p...
[ "Draws", "the", "path", "for", "an", "upright", "label" ]
python
train
spyder-ide/spyder
spyder/plugins/projects/projecttypes/python.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/projecttypes/python.py#L51-L60
def remove_from_pythonpath(self, path): """Remove path from project's PYTHONPATH Return True if path was removed, False if it was not found""" pathlist = self.get_pythonpath() if path in pathlist: pathlist.pop(pathlist.index(path)) self.set_pythonpath(pathli...
[ "def", "remove_from_pythonpath", "(", "self", ",", "path", ")", ":", "pathlist", "=", "self", ".", "get_pythonpath", "(", ")", "if", "path", "in", "pathlist", ":", "pathlist", ".", "pop", "(", "pathlist", ".", "index", "(", "path", ")", ")", "self", "....
Remove path from project's PYTHONPATH Return True if path was removed, False if it was not found
[ "Remove", "path", "from", "project", "s", "PYTHONPATH", "Return", "True", "if", "path", "was", "removed", "False", "if", "it", "was", "not", "found" ]
python
train
OLC-LOC-Bioinformatics/GenomeQAML
genomeqaml/extract_features.py
https://github.com/OLC-LOC-Bioinformatics/GenomeQAML/blob/2953e574c185afab23075641da4ce5392bc003e9/genomeqaml/extract_features.py#L313-L334
def find_l50(contig_lengths_dict, genome_length_dict): """ Calculate the L50 for each strain. L50 is defined as the number of contigs required to achieve the N50 :param contig_lengths_dict: dictionary of strain name: reverse-sorted list of all contig lengths :param genome_length_dict: dictionary of stra...
[ "def", "find_l50", "(", "contig_lengths_dict", ",", "genome_length_dict", ")", ":", "# Initialise the dictionary", "l50_dict", "=", "dict", "(", ")", "for", "file_name", ",", "contig_lengths", "in", "contig_lengths_dict", ".", "items", "(", ")", ":", "currentlength"...
Calculate the L50 for each strain. L50 is defined as the number of contigs required to achieve the N50 :param contig_lengths_dict: dictionary of strain name: reverse-sorted list of all contig lengths :param genome_length_dict: dictionary of strain name: total genome length :return: l50_dict: dictionary of s...
[ "Calculate", "the", "L50", "for", "each", "strain", ".", "L50", "is", "defined", "as", "the", "number", "of", "contigs", "required", "to", "achieve", "the", "N50", ":", "param", "contig_lengths_dict", ":", "dictionary", "of", "strain", "name", ":", "reverse"...
python
train
pixelogik/NearPy
nearpy/storage/storage_mongo.py
https://github.com/pixelogik/NearPy/blob/1b534b864d320d875508e95cd2b76b6d8c07a90b/nearpy/storage/storage_mongo.py#L182-L190
def load_hash_configuration(self, hash_name): """ Loads and returns hash configuration """ conf = self.mongo_object.find_one( {'hash_conf_name': hash_name + '_conf'} ) return pickle.loads(conf['hash_configuration']) if conf is not None\ else None
[ "def", "load_hash_configuration", "(", "self", ",", "hash_name", ")", ":", "conf", "=", "self", ".", "mongo_object", ".", "find_one", "(", "{", "'hash_conf_name'", ":", "hash_name", "+", "'_conf'", "}", ")", "return", "pickle", ".", "loads", "(", "conf", "...
Loads and returns hash configuration
[ "Loads", "and", "returns", "hash", "configuration" ]
python
train
igorcoding/asynctnt-queue
asynctnt_queue/queue.py
https://github.com/igorcoding/asynctnt-queue/blob/75719b2dd27e8314ae924aea6a7a85be8f48ecc5/asynctnt_queue/queue.py#L58-L72
def tube(self, name): """ Returns tube by its name :param name: Tube name :returns: ``self.tube_cls`` instance (by default :class:`asynctnt_queue.Tube`) """ if name in self._tubes: return self._tubes[name] assert name, 'Tu...
[ "def", "tube", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "_tubes", ":", "return", "self", ".", "_tubes", "[", "name", "]", "assert", "name", ",", "'Tube name must be specified'", "t", "=", "self", ".", "_tube_cls", "(", "self...
Returns tube by its name :param name: Tube name :returns: ``self.tube_cls`` instance (by default :class:`asynctnt_queue.Tube`)
[ "Returns", "tube", "by", "its", "name" ]
python
train
mlperf/training
object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py#L123-L150
def forward(self, anchors, objectness, box_regression, targets=None): """ Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after ...
[ "def", "forward", "(", "self", ",", "anchors", ",", "objectness", ",", "box_regression", ",", "targets", "=", "None", ")", ":", "sampled_boxes", "=", "[", "]", "num_levels", "=", "len", "(", "objectness", ")", "anchors", "=", "list", "(", "zip", "(", "...
Arguments: anchors: list[list[BoxList]] objectness: list[tensor] box_regression: list[tensor] Returns: boxlists (list[BoxList]): the post-processed anchors, after applying box decoding and NMS
[ "Arguments", ":", "anchors", ":", "list", "[", "list", "[", "BoxList", "]]", "objectness", ":", "list", "[", "tensor", "]", "box_regression", ":", "list", "[", "tensor", "]" ]
python
train
VisTrails/tej
tej/submission.py
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L52-L62
def escape_queue(s): """Escapes the path to a queue, e.g. preserves ~ at the begining. """ if isinstance(s, PosixPath): s = unicode_(s) elif isinstance(s, bytes): s = s.decode('utf-8') if s.startswith('~/'): return '~/' + shell_escape(s[2:]) else: return shell_esc...
[ "def", "escape_queue", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "PosixPath", ")", ":", "s", "=", "unicode_", "(", "s", ")", "elif", "isinstance", "(", "s", ",", "bytes", ")", ":", "s", "=", "s", ".", "decode", "(", "'utf-8'", ")", ...
Escapes the path to a queue, e.g. preserves ~ at the begining.
[ "Escapes", "the", "path", "to", "a", "queue", "e", ".", "g", ".", "preserves", "~", "at", "the", "begining", "." ]
python
train
xflr6/graphviz
graphviz/backend.py
https://github.com/xflr6/graphviz/blob/7376095ef1e47abad7e0b0361b6c9720b706e7a0/graphviz/backend.py#L164-L184
def render(engine, format, filepath, renderer=None, formatter=None, quiet=False): """Render file with Graphviz ``engine`` into ``format``, return result filename. Args: engine: The layout commmand used for rendering (``'dot'``, ``'neato'``, ...). format: The output format used for rendering (`...
[ "def", "render", "(", "engine", ",", "format", ",", "filepath", ",", "renderer", "=", "None", ",", "formatter", "=", "None", ",", "quiet", "=", "False", ")", ":", "cmd", ",", "rendered", "=", "command", "(", "engine", ",", "format", ",", "filepath", ...
Render file with Graphviz ``engine`` into ``format``, return result filename. Args: engine: The layout commmand used for rendering (``'dot'``, ``'neato'``, ...). format: The output format used for rendering (``'pdf'``, ``'png'``, ...). filepath: Path to the DOT source file to render. ...
[ "Render", "file", "with", "Graphviz", "engine", "into", "format", "return", "result", "filename", "." ]
python
train
sony/nnabla
python/src/nnabla/experimental/graph_converters/fixed_point_weight.py
https://github.com/sony/nnabla/blob/aaf3d33b7cbb38f2a03aa754178ba8f7c8481320/python/src/nnabla/experimental/graph_converters/fixed_point_weight.py#L44-L69
def convert(self, vroot, entry_variables): """ All functions are replaced with the same `new` function. Args: vroot (:obj:`Variable`): NNabla Variable entry_variables (:obj:`Variable`): Entry variable from which the conversion starts. """ self.graph_info ...
[ "def", "convert", "(", "self", ",", "vroot", ",", "entry_variables", ")", ":", "self", ".", "graph_info", "=", "GraphInfo", "(", "vroot", ")", "self", ".", "entry_variables", "=", "entry_variables", "with", "nn", ".", "parameter_scope", "(", "self", ".", "...
All functions are replaced with the same `new` function. Args: vroot (:obj:`Variable`): NNabla Variable entry_variables (:obj:`Variable`): Entry variable from which the conversion starts.
[ "All", "functions", "are", "replaced", "with", "the", "same", "new", "function", "." ]
python
train
ScottDuckworth/python-anyvcs
anyvcs/svn.py
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/svn.py#L778-L811
def load( self, stream, progress=None, ignore_uuid=False, force_uuid=False, use_pre_commit_hook=False, use_post_commit_hook=False, parent_dir=None ): """Load a dumpfile stream into the repository. :param stream: A file stream from which the dumpfile is read :param progress: ...
[ "def", "load", "(", "self", ",", "stream", ",", "progress", "=", "None", ",", "ignore_uuid", "=", "False", ",", "force_uuid", "=", "False", ",", "use_pre_commit_hook", "=", "False", ",", "use_post_commit_hook", "=", "False", ",", "parent_dir", "=", "None", ...
Load a dumpfile stream into the repository. :param stream: A file stream from which the dumpfile is read :param progress: A file stream to which progress is written See ``svnadmin help load`` for details on the other arguments.
[ "Load", "a", "dumpfile", "stream", "into", "the", "repository", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/core/states/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L407-L420
def remove_input_data_port(self, data_port_id, force=False, destroy=True): """Remove an input data port from the state :param int data_port_id: the id or the output data port to remove :param bool force: if the removal should be forced without checking constraints :raises exceptions.Att...
[ "def", "remove_input_data_port", "(", "self", ",", "data_port_id", ",", "force", "=", "False", ",", "destroy", "=", "True", ")", ":", "if", "data_port_id", "in", "self", ".", "_input_data_ports", ":", "if", "destroy", ":", "self", ".", "remove_data_flows_with_...
Remove an input data port from the state :param int data_port_id: the id or the output data port to remove :param bool force: if the removal should be forced without checking constraints :raises exceptions.AttributeError: if the specified input data port does not exist
[ "Remove", "an", "input", "data", "port", "from", "the", "state" ]
python
train
cggh/scikit-allel
allel/io/vcf_read.py
https://github.com/cggh/scikit-allel/blob/3c979a57a100240ba959dd13f98839349530f215/allel/io/vcf_read.py#L74-L100
def _chunk_iter_progress(it, log, prefix): """Wrap a chunk iterator for progress logging.""" n_variants = 0 before_all = time.time() before_chunk = before_all for chunk, chunk_length, chrom, pos in it: after_chunk = time.time() elapsed_chunk = after_chunk - before_chunk elaps...
[ "def", "_chunk_iter_progress", "(", "it", ",", "log", ",", "prefix", ")", ":", "n_variants", "=", "0", "before_all", "=", "time", ".", "time", "(", ")", "before_chunk", "=", "before_all", "for", "chunk", ",", "chunk_length", ",", "chrom", ",", "pos", "in...
Wrap a chunk iterator for progress logging.
[ "Wrap", "a", "chunk", "iterator", "for", "progress", "logging", "." ]
python
train
materialsproject/pymatgen
pymatgen/apps/borg/queen.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L64-L83
def parallel_assimilate(self, rootpath): """ Assimilate the entire subdirectory structure in rootpath. """ logger.info('Scanning for valid paths...') valid_paths = [] for (parent, subdirs, files) in os.walk(rootpath): valid_paths.extend(self._drone.get_valid_p...
[ "def", "parallel_assimilate", "(", "self", ",", "rootpath", ")", ":", "logger", ".", "info", "(", "'Scanning for valid paths...'", ")", "valid_paths", "=", "[", "]", "for", "(", "parent", ",", "subdirs", ",", "files", ")", "in", "os", ".", "walk", "(", "...
Assimilate the entire subdirectory structure in rootpath.
[ "Assimilate", "the", "entire", "subdirectory", "structure", "in", "rootpath", "." ]
python
train
deployed/django-emailtemplates
emailtemplates/email.py
https://github.com/deployed/django-emailtemplates/blob/0e95139989dbcf7e624153ddcd7b5b66b48eb6eb/emailtemplates/email.py#L150-L164
def send(self, to, attachment_paths=None, *args, **kwargs): """This function does all the operations on eft object, that are necessary to send email. Usually one would use eft object like this: eft = EmailFromTemplate(name='sth/sth.html') eft.get_object() ...
[ "def", "send", "(", "self", ",", "to", ",", "attachment_paths", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "get_object", "(", ")", "self", ".", "render_message", "(", ")", "self", ".", "send_email", "(", "to", ",...
This function does all the operations on eft object, that are necessary to send email. Usually one would use eft object like this: eft = EmailFromTemplate(name='sth/sth.html') eft.get_object() eft.render_message() eft.send_email(['email@example....
[ "This", "function", "does", "all", "the", "operations", "on", "eft", "object", "that", "are", "necessary", "to", "send", "email", ".", "Usually", "one", "would", "use", "eft", "object", "like", "this", ":", "eft", "=", "EmailFromTemplate", "(", "name", "="...
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/completer.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/completer.py#L626-L640
def alias_matches(self, text): """Match internal system aliases""" #print 'Completer->alias_matches:',text,'lb',self.text_until_cursor # dbg # if we are not in the first 'item', alias matching # doesn't make sense - unless we are starting with 'sudo' command. main_text = self.te...
[ "def", "alias_matches", "(", "self", ",", "text", ")", ":", "#print 'Completer->alias_matches:',text,'lb',self.text_until_cursor # dbg", "# if we are not in the first 'item', alias matching", "# doesn't make sense - unless we are starting with 'sudo' command.", "main_text", "=", "self", ...
Match internal system aliases
[ "Match", "internal", "system", "aliases" ]
python
test
tornadoweb/tornado
tornado/iostream.py
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/iostream.py#L1148-L1219
def connect( self: _IOStreamType, address: tuple, server_hostname: str = None ) -> "Future[_IOStreamType]": """Connects the socket to a remote address without blocking. May only be called if the socket passed to the constructor was not previously connected. The address parameter is...
[ "def", "connect", "(", "self", ":", "_IOStreamType", ",", "address", ":", "tuple", ",", "server_hostname", ":", "str", "=", "None", ")", "->", "\"Future[_IOStreamType]\"", ":", "self", ".", "_connecting", "=", "True", "future", "=", "Future", "(", ")", "# ...
Connects the socket to a remote address without blocking. May only be called if the socket passed to the constructor was not previously connected. The address parameter is in the same format as for `socket.connect <socket.socket.connect>` for the type of socket passed to the IOStream c...
[ "Connects", "the", "socket", "to", "a", "remote", "address", "without", "blocking", "." ]
python
train
gwastro/pycbc
pycbc/io/record.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/io/record.py#L1828-L1831
def spin_sy(self): """Returns the y-component of the spin of the secondary mass.""" return conversions.secondary_spin(self.mass1, self.mass2, self.spin1y, self.spin2y)
[ "def", "spin_sy", "(", "self", ")", ":", "return", "conversions", ".", "secondary_spin", "(", "self", ".", "mass1", ",", "self", ".", "mass2", ",", "self", ".", "spin1y", ",", "self", ".", "spin2y", ")" ]
Returns the y-component of the spin of the secondary mass.
[ "Returns", "the", "y", "-", "component", "of", "the", "spin", "of", "the", "secondary", "mass", "." ]
python
train
gawel/aiocron
aiocron/__init__.py
https://github.com/gawel/aiocron/blob/949870b2f7fe1e10e4220f3243c9d4237255d203/aiocron/__init__.py#L63-L69
def initialize(self): """Initialize croniter and related times""" if self.croniter is None: self.time = time.time() self.datetime = datetime.now(self.tz) self.loop_time = self.loop.time() self.croniter = croniter(self.spec, start_time=self.datetime)
[ "def", "initialize", "(", "self", ")", ":", "if", "self", ".", "croniter", "is", "None", ":", "self", ".", "time", "=", "time", ".", "time", "(", ")", "self", ".", "datetime", "=", "datetime", ".", "now", "(", "self", ".", "tz", ")", "self", ".",...
Initialize croniter and related times
[ "Initialize", "croniter", "and", "related", "times" ]
python
train
manahl/arctic
arctic/chunkstore/chunkstore.py
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L614-L630
def write_metadata(self, symbol, metadata): ''' writes user defined metadata for the given symbol Parameters ---------- symbol: str symbol for the given item in the DB metadata: ? metadata to write ''' sym = self._get_symbol_info(s...
[ "def", "write_metadata", "(", "self", ",", "symbol", ",", "metadata", ")", ":", "sym", "=", "self", ".", "_get_symbol_info", "(", "symbol", ")", "if", "not", "sym", ":", "raise", "NoDataFoundException", "(", "\"Symbol does not exist.\"", ")", "sym", "[", "US...
writes user defined metadata for the given symbol Parameters ---------- symbol: str symbol for the given item in the DB metadata: ? metadata to write
[ "writes", "user", "defined", "metadata", "for", "the", "given", "symbol" ]
python
train
jeremylow/pyshk
pyshk/api.py
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/api.py#L384-L402
def save_shared_file(self, sharekey=None): """ Save a SharedFile to your Shake. Args: sharekey (str): Sharekey for the file to save. Returns: SharedFile saved to your shake. """ endpoint = '/api/sharedfile/{sharekey}/save'.format(sharekey=shareke...
[ "def", "save_shared_file", "(", "self", ",", "sharekey", "=", "None", ")", ":", "endpoint", "=", "'/api/sharedfile/{sharekey}/save'", ".", "format", "(", "sharekey", "=", "sharekey", ")", "data", "=", "self", ".", "_make_request", "(", "\"POST\"", ",", "endpoi...
Save a SharedFile to your Shake. Args: sharekey (str): Sharekey for the file to save. Returns: SharedFile saved to your shake.
[ "Save", "a", "SharedFile", "to", "your", "Shake", "." ]
python
train
danielholmstrom/dictalchemy
dictalchemy/utils.py
https://github.com/danielholmstrom/dictalchemy/blob/038b8822b0ed66feef78a80b3af8f3a09f795b5a/dictalchemy/utils.py#L44-L183
def asdict(model, exclude=None, exclude_underscore=None, exclude_pk=None, follow=None, include=None, only=None, method='asdict', **kwargs): """Get a dict from a model Using the `method` parameter makes it possible to have multiple methods that formats the result. Additional keyword argument...
[ "def", "asdict", "(", "model", ",", "exclude", "=", "None", ",", "exclude_underscore", "=", "None", ",", "exclude_pk", "=", "None", ",", "follow", "=", "None", ",", "include", "=", "None", ",", "only", "=", "None", ",", "method", "=", "'asdict'", ",", ...
Get a dict from a model Using the `method` parameter makes it possible to have multiple methods that formats the result. Additional keyword arguments will be passed to all relationships that are followed. This can be used to pass on things like request or context. :param follow: List or dict of r...
[ "Get", "a", "dict", "from", "a", "model" ]
python
train
saltstack/salt
salt/modules/chocolatey.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chocolatey.py#L51-L57
def _clear_context(context): ''' Clear variables stored in __context__. Run this function when a new version of chocolatey is installed. ''' for var in (x for x in __context__ if x.startswith('chocolatey.')): context.pop(var)
[ "def", "_clear_context", "(", "context", ")", ":", "for", "var", "in", "(", "x", "for", "x", "in", "__context__", "if", "x", ".", "startswith", "(", "'chocolatey.'", ")", ")", ":", "context", ".", "pop", "(", "var", ")" ]
Clear variables stored in __context__. Run this function when a new version of chocolatey is installed.
[ "Clear", "variables", "stored", "in", "__context__", ".", "Run", "this", "function", "when", "a", "new", "version", "of", "chocolatey", "is", "installed", "." ]
python
train
alex-kostirin/pyatomac
atomac/ldtpd/table.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/table.py#L250-L275
def selectlastrow(self, window_name, object_name): """ Select last row @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LD...
[ "def", "selectlastrow", "(", "self", ",", "window_name", ",", "object_name", ")", ":", "object_handle", "=", "self", ".", "_get_object_handle", "(", "window_name", ",", "object_name", ")", "if", "not", "object_handle", ".", "AXEnabled", ":", "raise", "LdtpServer...
Select last row @param window_name: Window name to type in, either full name, LDTP's name convention, or a Unix glob. @type window_name: string @param object_name: Object name to type in, either full name, LDTP's name convention, or a Unix glob. @type object_name: strin...
[ "Select", "last", "row" ]
python
valid
jwodder/javaproperties
javaproperties/xmlprops.py
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/xmlprops.py#L43-L77
def loads_xml(s, object_pairs_hook=dict): r""" Parse the contents of the string ``s`` as an XML properties document and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `loads_xml` only checks that the root element is named "``properties``" and that all of its ``<entry>`` c...
[ "def", "loads_xml", "(", "s", ",", "object_pairs_hook", "=", "dict", ")", ":", "elem", "=", "ET", ".", "fromstring", "(", "s", ")", "return", "object_pairs_hook", "(", "_fromXML", "(", "elem", ")", ")" ]
r""" Parse the contents of the string ``s`` as an XML properties document and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `loads_xml` only checks that the root element is named "``properties``" and that all of its ``<entry>`` children have ``key`` attributes. No furth...
[ "r", "Parse", "the", "contents", "of", "the", "string", "s", "as", "an", "XML", "properties", "document", "and", "return", "a", "dict", "of", "the", "key", "-", "value", "pairs", "." ]
python
train
jupyterhub/kubespawner
kubespawner/spawner.py
https://github.com/jupyterhub/kubespawner/blob/46a4b109c5e657a4c3d5bfa8ea4731ec6564ea13/kubespawner/spawner.py#L1303-L1376
def get_pod_manifest(self): """ Make a pod manifest that will spawn current user's notebook pod. """ if callable(self.uid): uid = yield gen.maybe_future(self.uid(self)) else: uid = self.uid if callable(self.gid): gid = yield gen.maybe_...
[ "def", "get_pod_manifest", "(", "self", ")", ":", "if", "callable", "(", "self", ".", "uid", ")", ":", "uid", "=", "yield", "gen", ".", "maybe_future", "(", "self", ".", "uid", "(", "self", ")", ")", "else", ":", "uid", "=", "self", ".", "uid", "...
Make a pod manifest that will spawn current user's notebook pod.
[ "Make", "a", "pod", "manifest", "that", "will", "spawn", "current", "user", "s", "notebook", "pod", "." ]
python
train
haifengat/hf_ctp_py_proxy
py_ctp/quote.py
https://github.com/haifengat/hf_ctp_py_proxy/blob/c2dc6dbde45aa6b097f75380474e91510d3f5d12/py_ctp/quote.py#L62-L69
def ReqUserLogout(self): """退出接口(正常退出,不会触发OnFrontDisconnected)""" self.q.Release() # 确保隔夜或重新登录时的第1个tick不被发送到客户端 self.inst_tick.clear() self.logined = False threading.Thread(target=self.OnDisConnected, args=(self, 0)).start()
[ "def", "ReqUserLogout", "(", "self", ")", ":", "self", ".", "q", ".", "Release", "(", ")", "# 确保隔夜或重新登录时的第1个tick不被发送到客户端", "self", ".", "inst_tick", ".", "clear", "(", ")", "self", ".", "logined", "=", "False", "threading", ".", "Thread", "(", "target", ...
退出接口(正常退出,不会触发OnFrontDisconnected)
[ "退出接口", "(", "正常退出", "不会触发OnFrontDisconnected", ")" ]
python
train
pudo/googlesheets
googlesheets/sheet.py
https://github.com/pudo/googlesheets/blob/c38725d79bfe048c0519a674019ba313dfc5bfb0/googlesheets/sheet.py#L75-L81
def insert(self, row): """ Insert a new row. The row will be added to the end of the spreadsheet. Before inserting, the field names in the given row will be normalized and values with empty field names removed. """ data = self._convert_value(row) self._service.InsertRow...
[ "def", "insert", "(", "self", ",", "row", ")", ":", "data", "=", "self", ".", "_convert_value", "(", "row", ")", "self", ".", "_service", ".", "InsertRow", "(", "data", ",", "self", ".", "_ss", ".", "id", ",", "self", ".", "id", ")" ]
Insert a new row. The row will be added to the end of the spreadsheet. Before inserting, the field names in the given row will be normalized and values with empty field names removed.
[ "Insert", "a", "new", "row", ".", "The", "row", "will", "be", "added", "to", "the", "end", "of", "the", "spreadsheet", ".", "Before", "inserting", "the", "field", "names", "in", "the", "given", "row", "will", "be", "normalized", "and", "values", "with", ...
python
train
thanethomson/statik
setup.py
https://github.com/thanethomson/statik/blob/56b1b5a2cb05a97afa81f428bfcefc833e935b8d/setup.py#L22-L49
def read_requirements(filename): """ Parse a requirements file. Accepts vcs+ links, and places the URL into `DEPENDENCY_LINKS`. :return: list of str for each package """ data = [] for line in read_file(filename): line = line.strip() if not line or line.startswith('#'): ...
[ "def", "read_requirements", "(", "filename", ")", ":", "data", "=", "[", "]", "for", "line", "in", "read_file", "(", "filename", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "not", "line", "or", "line", ".", "startswith", "(", "'#'", ...
Parse a requirements file. Accepts vcs+ links, and places the URL into `DEPENDENCY_LINKS`. :return: list of str for each package
[ "Parse", "a", "requirements", "file", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_threshold_monitor.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_threshold_monitor.py#L539-L550
def threshold_monitor_hidden_threshold_monitor_Memory_actions(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") threshold_monitor_hidden = ET.SubElement(config, "threshold-monitor-hidden", xmlns="urn:brocade.com:mgmt:brocade-threshold-monitor") threshold_m...
[ "def", "threshold_monitor_hidden_threshold_monitor_Memory_actions", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "threshold_monitor_hidden", "=", "ET", ".", "SubElement", "(", "config", ",", "\"thresh...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
brocade/pynos
pynos/versions/base/yang/brocade_fcoe.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/brocade_fcoe.py#L161-L171
def fcoe_fcoe_fcf_map_fcf_map_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe") fcoe_fcf_map = ET.SubElement(fcoe, "fcoe-fcf-map") fcf_map_name = ET.SubElement(fco...
[ "def", "fcoe_fcoe_fcf_map_fcf_map_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "fcoe", "=", "ET", ".", "SubElement", "(", "config", ",", "\"fcoe\"", ",", "xmlns", "=", "\"urn:brocade.co...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
pyviz/param
param/version.py
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/param/version.py#L743-L764
def verify(self, string_version=None): """ Check that the version information is consistent with the VCS before doing a release. If supplied with a string version, this is also checked against the current version. Should be called from setup.py with the declared package version b...
[ "def", "verify", "(", "self", ",", "string_version", "=", "None", ")", ":", "if", "string_version", "and", "string_version", "!=", "str", "(", "self", ")", ":", "raise", "Exception", "(", "\"Supplied string version does not match current version.\"", ")", "if", "s...
Check that the version information is consistent with the VCS before doing a release. If supplied with a string version, this is also checked against the current version. Should be called from setup.py with the declared package version before releasing to PyPI.
[ "Check", "that", "the", "version", "information", "is", "consistent", "with", "the", "VCS", "before", "doing", "a", "release", ".", "If", "supplied", "with", "a", "string", "version", "this", "is", "also", "checked", "against", "the", "current", "version", "...
python
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2414-L2458
def next(self): """Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. """ self._check("ra") if self.firstmember is not None: m = self.firstmember self.firs...
[ "def", "next", "(", "self", ")", ":", "self", ".", "_check", "(", "\"ra\"", ")", "if", "self", ".", "firstmember", "is", "not", "None", ":", "m", "=", "self", ".", "firstmember", "self", ".", "firstmember", "=", "None", "return", "m", "# Read the next ...
Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available.
[ "Return", "the", "next", "member", "of", "the", "archive", "as", "a", "TarInfo", "object", "when", "TarFile", "is", "opened", "for", "reading", ".", "Return", "None", "if", "there", "is", "no", "more", "available", "." ]
python
train
clach04/python-tuya
pytuya/__init__.py
https://github.com/clach04/python-tuya/blob/7b89d38c56f6e25700e2a333000d25bc8d923622/pytuya/__init__.py#L316-L336
def set_timer(self, num_secs): """ Set a timer. Args: num_secs(int): Number of seconds """ # FIXME / TODO support schemas? Accept timer id number as parameter? # Dumb heuristic; Query status, pick last device id as that is probably the timer ...
[ "def", "set_timer", "(", "self", ",", "num_secs", ")", ":", "# FIXME / TODO support schemas? Accept timer id number as parameter?", "# Dumb heuristic; Query status, pick last device id as that is probably the timer", "status", "=", "self", ".", "status", "(", ")", "devices", "=",...
Set a timer. Args: num_secs(int): Number of seconds
[ "Set", "a", "timer", ".", "Args", ":", "num_secs", "(", "int", ")", ":", "Number", "of", "seconds" ]
python
train
ic-labs/django-icekit
icekit_events/forms.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/icekit_events/forms.py#L99-L125
def render(self, name, value, attrs=None): """ Render the ``icekit_events/recurrence_rule_widget/render.html`` template with the following context: rendered_widgets The rendered widgets. id The ``id`` attribute from the ``attrs`` keyword a...
[ "def", "render", "(", "self", ",", "name", ",", "value", ",", "attrs", "=", "None", ")", ":", "rendered_widgets", "=", "super", "(", "RecurrenceRuleWidget", ",", "self", ")", ".", "render", "(", "name", ",", "value", ",", "attrs", ")", "template", "=",...
Render the ``icekit_events/recurrence_rule_widget/render.html`` template with the following context: rendered_widgets The rendered widgets. id The ``id`` attribute from the ``attrs`` keyword argument. recurrence_rules A JSON ob...
[ "Render", "the", "icekit_events", "/", "recurrence_rule_widget", "/", "render", ".", "html", "template", "with", "the", "following", "context", ":" ]
python
train
tomduck/pandoc-fignos
pandoc_fignos.py
https://github.com/tomduck/pandoc-fignos/blob/44776d885b8101d9d6aeb6845b17ad1625e88e6f/pandoc_fignos.py#L121-L201
def _process_figure(value, fmt): """Processes the figure. Returns a dict containing figure properties.""" # pylint: disable=global-statement global Nreferences # Global references counter global has_unnumbered_figures # Flags unnumbered figures were found global cursec ...
[ "def", "_process_figure", "(", "value", ",", "fmt", ")", ":", "# pylint: disable=global-statement", "global", "Nreferences", "# Global references counter", "global", "has_unnumbered_figures", "# Flags unnumbered figures were found", "global", "cursec", "# Current section", "# Par...
Processes the figure. Returns a dict containing figure properties.
[ "Processes", "the", "figure", ".", "Returns", "a", "dict", "containing", "figure", "properties", "." ]
python
train
pytorch/text
torchtext/utils.py
https://github.com/pytorch/text/blob/26bfce6869dc704f1d86792f9a681d453d7e7bb8/torchtext/utils.py#L60-L72
def unicode_csv_reader(unicode_csv_data, **kwargs): """Since the standard csv library does not handle unicode in Python 2, we need a wrapper. Borrowed and slightly modified from the Python docs: https://docs.python.org/2/library/csv.html#csv-examples""" if six.PY2: # csv.py doesn't do Unicode; e...
[ "def", "unicode_csv_reader", "(", "unicode_csv_data", ",", "*", "*", "kwargs", ")", ":", "if", "six", ".", "PY2", ":", "# csv.py doesn't do Unicode; encode temporarily as UTF-8:", "csv_reader", "=", "csv", ".", "reader", "(", "utf_8_encoder", "(", "unicode_csv_data", ...
Since the standard csv library does not handle unicode in Python 2, we need a wrapper. Borrowed and slightly modified from the Python docs: https://docs.python.org/2/library/csv.html#csv-examples
[ "Since", "the", "standard", "csv", "library", "does", "not", "handle", "unicode", "in", "Python", "2", "we", "need", "a", "wrapper", ".", "Borrowed", "and", "slightly", "modified", "from", "the", "Python", "docs", ":", "https", ":", "//", "docs", ".", "p...
python
train
ozgurgunes/django-manifest
manifest/accounts/utils.py
https://github.com/ozgurgunes/django-manifest/blob/9873bbf2a475b76284ad7e36b2b26c92131e72dd/manifest/accounts/utils.py#L54-L77
def login_redirect(redirect=None, user=None): """ Redirect user after successful sign in. First looks for a ``requested_redirect``. If not supplied will fall-back to the user specific account page. If all fails, will fall-back to the standard Django ``LOGIN_REDIRECT_URL`` setting. Returns a strin...
[ "def", "login_redirect", "(", "redirect", "=", "None", ",", "user", "=", "None", ")", ":", "if", "redirect", ":", "return", "redirect", "elif", "user", "is", "not", "None", ":", "return", "defaults", ".", "ACCOUNTS_LOGIN_REDIRECT_URL", "%", "{", "'username'"...
Redirect user after successful sign in. First looks for a ``requested_redirect``. If not supplied will fall-back to the user specific account page. If all fails, will fall-back to the standard Django ``LOGIN_REDIRECT_URL`` setting. Returns a string defining the URI to go next. :param redirect: ...
[ "Redirect", "user", "after", "successful", "sign", "in", "." ]
python
train
tensorflow/tensorboard
tensorboard/plugins/graph/keras_util.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/keras_util.py#L180-L239
def keras_model_to_graph_def(keras_layer): """Returns a GraphDef representation of the Keras model in a dict form. Note that it only supports models that implemented to_json(). Args: keras_layer: A dict from Keras model.to_json(). Returns: A GraphDef representation of the layers in the model. """ ...
[ "def", "keras_model_to_graph_def", "(", "keras_layer", ")", ":", "input_to_layer", "=", "{", "}", "model_name_to_output", "=", "{", "}", "g", "=", "GraphDef", "(", ")", "# Sequential model layers do not have a field \"inbound_nodes\" but", "# instead are defined implicitly vi...
Returns a GraphDef representation of the Keras model in a dict form. Note that it only supports models that implemented to_json(). Args: keras_layer: A dict from Keras model.to_json(). Returns: A GraphDef representation of the layers in the model.
[ "Returns", "a", "GraphDef", "representation", "of", "the", "Keras", "model", "in", "a", "dict", "form", "." ]
python
train
Erotemic/utool
utool/util_dev.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dev.py#L2926-L2932
def map_column(self, keys, func): """ Args: keys (list or str): the column name(s) to apply the `func` to func (callable): applied to each element in the specified columns """ return [[func(v) for v in self[key]] for key in keys]
[ "def", "map_column", "(", "self", ",", "keys", ",", "func", ")", ":", "return", "[", "[", "func", "(", "v", ")", "for", "v", "in", "self", "[", "key", "]", "]", "for", "key", "in", "keys", "]" ]
Args: keys (list or str): the column name(s) to apply the `func` to func (callable): applied to each element in the specified columns
[ "Args", ":", "keys", "(", "list", "or", "str", ")", ":", "the", "column", "name", "(", "s", ")", "to", "apply", "the", "func", "to", "func", "(", "callable", ")", ":", "applied", "to", "each", "element", "in", "the", "specified", "columns" ]
python
train
fossasia/knittingpattern
knittingpattern/Mesh.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Mesh.py#L304-L316
def connect_to(self, other_mesh): """Create a connection to an other mesh. .. warning:: Both meshes need to be disconnected and one needs to be a consumed and the other a produced mesh. You can check if a connection is possible using :meth:`can_connect_to`. .. seealso:: :me...
[ "def", "connect_to", "(", "self", ",", "other_mesh", ")", ":", "other_mesh", ".", "disconnect", "(", ")", "self", ".", "disconnect", "(", ")", "self", ".", "_connect_to", "(", "other_mesh", ")" ]
Create a connection to an other mesh. .. warning:: Both meshes need to be disconnected and one needs to be a consumed and the other a produced mesh. You can check if a connection is possible using :meth:`can_connect_to`. .. seealso:: :meth:`is_consumed`, :meth:`is_produced`, ...
[ "Create", "a", "connection", "to", "an", "other", "mesh", "." ]
python
valid
pypa/pipenv
pipenv/vendor/distlib/util.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/util.py#L988-L1006
def add(self, event, subscriber, append=True): """ Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend th...
[ "def", "add", "(", "self", ",", "event", ",", "subscriber", ",", "append", "=", "True", ")", ":", "subs", "=", "self", ".", "_subscribers", "if", "event", "not", "in", "subs", ":", "subs", "[", "event", "]", "=", "deque", "(", "[", "subscriber", "]...
Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list ...
[ "Add", "a", "subscriber", "for", "an", "event", "." ]
python
train
hvac/hvac
hvac/api/secrets_engines/transit.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/api/secrets_engines/transit.py#L334-L374
def decrypt_data(self, name, ciphertext, context="", nonce="", batch_input=None, mount_point=DEFAULT_MOUNT_POINT): """Decrypt the provided ciphertext using the named key. Supported methods: POST: /{mount_point}/decrypt/{name}. Produces: 200 application/json :param name: Specifies t...
[ "def", "decrypt_data", "(", "self", ",", "name", ",", "ciphertext", ",", "context", "=", "\"\"", ",", "nonce", "=", "\"\"", ",", "batch_input", "=", "None", ",", "mount_point", "=", "DEFAULT_MOUNT_POINT", ")", ":", "params", "=", "{", "'ciphertext'", ":", ...
Decrypt the provided ciphertext using the named key. Supported methods: POST: /{mount_point}/decrypt/{name}. Produces: 200 application/json :param name: Specifies the name of the encryption key to decrypt against. This is specified as part of the URL. :type name: str | unicode ...
[ "Decrypt", "the", "provided", "ciphertext", "using", "the", "named", "key", "." ]
python
train
nitmir/django-cas-server
cas_server/views.py
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L606-L617
def get(self, request, *args, **kwargs): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object """ # initialize class parameters self.init_get(request) # process the GET request self.proce...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# initialize class parameters", "self", ".", "init_get", "(", "request", ")", "# process the GET request", "self", ".", "process_get", "(", ")", "# call the GET/PO...
method called on GET request on this view :param django.http.HttpRequest request: The current request object
[ "method", "called", "on", "GET", "request", "on", "this", "view" ]
python
train
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/client.py#L1716-L1798
def insert_rows_json( self, table, json_rows, row_ids=None, skip_invalid_rows=None, ignore_unknown_values=None, template_suffix=None, retry=DEFAULT_RETRY, ): """Insert rows into a table without applying local type conversions. See ...
[ "def", "insert_rows_json", "(", "self", ",", "table", ",", "json_rows", ",", "row_ids", "=", "None", ",", "skip_invalid_rows", "=", "None", ",", "ignore_unknown_values", "=", "None", ",", "template_suffix", "=", "None", ",", "retry", "=", "DEFAULT_RETRY", ",",...
Insert rows into a table without applying local type conversions. See https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll table (Union[ \ :class:`~google.cloud.bigquery.table.Table` \ :class:`~google.cloud.bigquery.table.TableReference`, \ ...
[ "Insert", "rows", "into", "a", "table", "without", "applying", "local", "type", "conversions", "." ]
python
train
elastic/elasticsearch-py
elasticsearch/client/xpack/rollup.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/xpack/rollup.py#L19-L28
def get_jobs(self, id=None, params=None): """ `<>`_ :arg id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs """ return self.transport.perform_request( "GET", _make_path("_rollup", "job", id), params=params )
[ "def", "get_jobs", "(", "self", ",", "id", "=", "None", ",", "params", "=", "None", ")", ":", "return", "self", ".", "transport", ".", "perform_request", "(", "\"GET\"", ",", "_make_path", "(", "\"_rollup\"", ",", "\"job\"", ",", "id", ")", ",", "param...
`<>`_ :arg id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs
[ "<", ">", "_" ]
python
train
IceflowRE/unidown
unidown/core/manager.py
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L163-L178
def check_update(): """ Check for app updates and print/log them. """ logging.info('Check for app updates.') try: update = updater.check_for_app_updates() except Exception: logging.exception('Check for updates failed.') return if update: print("!!! UPDATE AVAI...
[ "def", "check_update", "(", ")", ":", "logging", ".", "info", "(", "'Check for app updates.'", ")", "try", ":", "update", "=", "updater", ".", "check_for_app_updates", "(", ")", "except", "Exception", ":", "logging", ".", "exception", "(", "'Check for updates fa...
Check for app updates and print/log them.
[ "Check", "for", "app", "updates", "and", "print", "/", "log", "them", "." ]
python
train
sibirrer/lenstronomy
lenstronomy/ImSim/image_model.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/image_model.py#L163-L175
def linear_response_matrix(self, kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None): """ computes the linear response matrix (m x n), with n beeing the data size and m being the coefficients :param kwargs_lens: :param kwargs_source: :param kwargs_lens_...
[ "def", "linear_response_matrix", "(", "self", ",", "kwargs_lens", "=", "None", ",", "kwargs_source", "=", "None", ",", "kwargs_lens_light", "=", "None", ",", "kwargs_ps", "=", "None", ")", ":", "A", "=", "self", ".", "_response_matrix", "(", "self", ".", "...
computes the linear response matrix (m x n), with n beeing the data size and m being the coefficients :param kwargs_lens: :param kwargs_source: :param kwargs_lens_light: :param kwargs_ps: :return:
[ "computes", "the", "linear", "response", "matrix", "(", "m", "x", "n", ")", "with", "n", "beeing", "the", "data", "size", "and", "m", "being", "the", "coefficients" ]
python
train
BD2KGenomics/toil-scripts
src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py#L46-L57
def reference_preprocessing(job, samples, config): """ Spawn the jobs that create index and dict file for reference :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Argparse Namespace object containing argument inputs :param list[list] samples: A nested list ...
[ "def", "reference_preprocessing", "(", "job", ",", "samples", ",", "config", ")", ":", "job", ".", "fileStore", ".", "logToMaster", "(", "'Processed reference files'", ")", "config", ".", "fai", "=", "job", ".", "addChildJobFn", "(", "run_samtools_faidx", ",", ...
Spawn the jobs that create index and dict file for reference :param JobFunctionWrappingJob job: passed automatically by Toil :param Namespace config: Argparse Namespace object containing argument inputs :param list[list] samples: A nested list of samples containing sample information
[ "Spawn", "the", "jobs", "that", "create", "index", "and", "dict", "file", "for", "reference" ]
python
train
sosreport/sos
sos/plugins/foreman.py
https://github.com/sosreport/sos/blob/2ebc04da53dc871c8dd5243567afa4f8592dca29/sos/plugins/foreman.py#L163-L177
def build_query_cmd(self, query, csv=False): """ Builds the command needed to invoke the pgsql query as the postgres user. The query requires significant quoting work to satisfy both the shell and postgres parsing requirements. Note that this will generate a large amount ...
[ "def", "build_query_cmd", "(", "self", ",", "query", ",", "csv", "=", "False", ")", ":", "_cmd", "=", "\"su postgres -c %s\"", "if", "not", "csv", ":", "_dbcmd", "=", "\"psql foreman -c %s\"", "else", ":", "_dbcmd", "=", "\"psql foreman -A -F , -X -c %s\"", "dbq...
Builds the command needed to invoke the pgsql query as the postgres user. The query requires significant quoting work to satisfy both the shell and postgres parsing requirements. Note that this will generate a large amount of quoting in sos logs referencing the command being run
[ "Builds", "the", "command", "needed", "to", "invoke", "the", "pgsql", "query", "as", "the", "postgres", "user", ".", "The", "query", "requires", "significant", "quoting", "work", "to", "satisfy", "both", "the", "shell", "and", "postgres", "parsing", "requireme...
python
train
titusjan/argos
argos/qt/registry.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L296-L305
def removeItem(self, regItem): """ Removes a ClassRegItem object to the registry. Will raise a KeyError if the regItem is not registered. """ check_class(regItem, ClassRegItem) logger.info("Removing {!r} containing {}".format(regItem.identifier, regItem.fullClassName)) ...
[ "def", "removeItem", "(", "self", ",", "regItem", ")", ":", "check_class", "(", "regItem", ",", "ClassRegItem", ")", "logger", ".", "info", "(", "\"Removing {!r} containing {}\"", ".", "format", "(", "regItem", ".", "identifier", ",", "regItem", ".", "fullClas...
Removes a ClassRegItem object to the registry. Will raise a KeyError if the regItem is not registered.
[ "Removes", "a", "ClassRegItem", "object", "to", "the", "registry", ".", "Will", "raise", "a", "KeyError", "if", "the", "regItem", "is", "not", "registered", "." ]
python
train
maartenbreddels/ipyvolume
ipyvolume/pylab.py
https://github.com/maartenbreddels/ipyvolume/blob/e68b72852b61276f8e6793bc8811f5b2432a155f/ipyvolume/pylab.py#L1206-L1263
def use(style): """Set the style of the current figure/visualization. :param style: matplotlib style name, or dict with values, or a sequence of these, where the last value overrides previous :return: """ def valid(value): # checks if json'able return isinstance(val...
[ "def", "use", "(", "style", ")", ":", "def", "valid", "(", "value", ")", ":", "# checks if json'able", "return", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", "def", "translate", "(", "mplstyle", ")", ":", "style", "=", "{", "}", "m...
Set the style of the current figure/visualization. :param style: matplotlib style name, or dict with values, or a sequence of these, where the last value overrides previous :return:
[ "Set", "the", "style", "of", "the", "current", "figure", "/", "visualization", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_widget.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/frontend/qt/console/completion_widget.py#L83-L101
def show_items(self, cursor, items): """ Shows the completion widget with 'items' at the position specified by 'cursor'. """ text_edit = self._text_edit point = text_edit.cursorRect(cursor).bottomRight() point = text_edit.mapToGlobal(point) height = self.sizeH...
[ "def", "show_items", "(", "self", ",", "cursor", ",", "items", ")", ":", "text_edit", "=", "self", ".", "_text_edit", "point", "=", "text_edit", ".", "cursorRect", "(", "cursor", ")", ".", "bottomRight", "(", ")", "point", "=", "text_edit", ".", "mapToGl...
Shows the completion widget with 'items' at the position specified by 'cursor'.
[ "Shows", "the", "completion", "widget", "with", "items", "at", "the", "position", "specified", "by", "cursor", "." ]
python
test
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/data_flows.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/data_flows.py#L833-L859
def register_view(self, view): """Called when the View was registered Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application """ super(StateDataFlowsEditorController, self).register_view(view) view['add_d_button'].connect('clicked', s...
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "super", "(", "StateDataFlowsEditorController", ",", "self", ")", ".", "register_view", "(", "view", ")", "view", "[", "'add_d_button'", "]", ".", "connect", "(", "'clicked'", ",", "self", ".", "d...
Called when the View was registered Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application
[ "Called", "when", "the", "View", "was", "registered" ]
python
train
saltstack/salt
salt/modules/zabbix.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zabbix.py#L1226-L1273
def host_get(host=None, name=None, hostids=None, **kwargs): ''' .. versionadded:: 2016.3.0 Retrieve hosts according to the given parameters .. note:: This function accepts all optional host.get parameters: keyword argument names differ depending on your zabbix version, see here__. ...
[ "def", "host_get", "(", "host", "=", "None", ",", "name", "=", "None", ",", "hostids", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn_args", "=", "_login", "(", "*", "*", "kwargs", ")", "ret", "=", "{", "}", "try", ":", "if", "conn_args", ...
.. versionadded:: 2016.3.0 Retrieve hosts according to the given parameters .. note:: This function accepts all optional host.get parameters: keyword argument names differ depending on your zabbix version, see here__. .. __: https://www.zabbix.com/documentation/2.4/manual/api/referenc...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
python
train
numenta/nupic
src/nupic/data/file_record_stream.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/file_record_stream.py#L609-L659
def _updateSequenceInfo(self, r): """Keep track of sequence and make sure time goes forward Check if the current record is the beginning of a new sequence A new sequence starts in 2 cases: 1. The sequence id changed (if there is a sequence id field) 2. The reset field is 1 (if there is a reset fie...
[ "def", "_updateSequenceInfo", "(", "self", ",", "r", ")", ":", "# Get current sequence id (if any)", "newSequence", "=", "False", "sequenceId", "=", "(", "r", "[", "self", ".", "_sequenceIdIdx", "]", "if", "self", ".", "_sequenceIdIdx", "is", "not", "None", "e...
Keep track of sequence and make sure time goes forward Check if the current record is the beginning of a new sequence A new sequence starts in 2 cases: 1. The sequence id changed (if there is a sequence id field) 2. The reset field is 1 (if there is a reset field) Note that if there is no sequenc...
[ "Keep", "track", "of", "sequence", "and", "make", "sure", "time", "goes", "forward" ]
python
valid
awslabs/mxboard
python/mxboard/event_file_writer.py
https://github.com/awslabs/mxboard/blob/36057ff0f05325c9dc2fe046521325bf9d563a88/python/mxboard/event_file_writer.py#L102-L107
def close(self): """Flushes the pending events and closes the writer after it is done.""" self.flush() if self._recordio_writer is not None: self._recordio_writer.close() self._recordio_writer = None
[ "def", "close", "(", "self", ")", ":", "self", ".", "flush", "(", ")", "if", "self", ".", "_recordio_writer", "is", "not", "None", ":", "self", ".", "_recordio_writer", ".", "close", "(", ")", "self", ".", "_recordio_writer", "=", "None" ]
Flushes the pending events and closes the writer after it is done.
[ "Flushes", "the", "pending", "events", "and", "closes", "the", "writer", "after", "it", "is", "done", "." ]
python
train
inveniosoftware-attic/invenio-comments
invenio_comments/views.py
https://github.com/inveniosoftware-attic/invenio-comments/blob/62bb6e07c146baf75bf8de80b5896ab2a01a8423/invenio_comments/views.py#L189-L213
def comments(recid): """Display comments.""" from invenio_access.local_config import VIEWRESTRCOLL from invenio_access.mailcookie import \ mail_cookie_create_authorize_action from .api import check_user_can_view_comments auth_code, auth_msg = check_user_can_view_comments(current_user, recid)...
[ "def", "comments", "(", "recid", ")", ":", "from", "invenio_access", ".", "local_config", "import", "VIEWRESTRCOLL", "from", "invenio_access", ".", "mailcookie", "import", "mail_cookie_create_authorize_action", "from", ".", "api", "import", "check_user_can_view_comments",...
Display comments.
[ "Display", "comments", "." ]
python
train
ejeschke/ginga
ginga/doc/download_doc.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/doc/download_doc.py#L15-L52
def _find_rtd_version(): """Find closest RTD doc version.""" vstr = 'latest' try: import ginga from bs4 import BeautifulSoup except ImportError: return vstr # No active doc build before this release, just use latest. if not minversion(ginga, '2.6.0'): return vstr...
[ "def", "_find_rtd_version", "(", ")", ":", "vstr", "=", "'latest'", "try", ":", "import", "ginga", "from", "bs4", "import", "BeautifulSoup", "except", "ImportError", ":", "return", "vstr", "# No active doc build before this release, just use latest.", "if", "not", "mi...
Find closest RTD doc version.
[ "Find", "closest", "RTD", "doc", "version", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/git/git_client_base.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/git/git_client_base.py#L886-L930
def get_items(self, repository_id, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, include_links=None, version_descriptor=None): """GetItems. [Preview API] Get Item Metadata and/or Content for a collection of items. The dow...
[ "def", "get_items", "(", "self", ",", "repository_id", ",", "project", "=", "None", ",", "scope_path", "=", "None", ",", "recursion_level", "=", "None", ",", "include_content_metadata", "=", "None", ",", "latest_processed_change", "=", "None", ",", "download", ...
GetItems. [Preview API] Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. :param str rep...
[ "GetItems", ".", "[", "Preview", "API", "]", "Get", "Item", "Metadata", "and", "/", "or", "Content", "for", "a", "collection", "of", "items", ".", "The", "download", "parameter", "is", "to", "indicate", "whether", "the", "content", "should", "be", "availab...
python
train
adobe-apiplatform/umapi-client.py
umapi_client/functional.py
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L182-L205
def add_to_groups(self, groups=None, all_groups=False, group_type=None): """ Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect is simply to do an "add to organization Everybody group", so we let that be done. :param groups: list of group names the u...
[ "def", "add_to_groups", "(", "self", ",", "groups", "=", "None", ",", "all_groups", "=", "False", ",", "group_type", "=", "None", ")", ":", "if", "all_groups", ":", "if", "groups", "or", "group_type", ":", "raise", "ArgumentError", "(", "\"When adding to all...
Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect is simply to do an "add to organization Everybody group", so we let that be done. :param groups: list of group names the user should be added to :param all_groups: a boolean meaning add to all (don't specify...
[ "Add", "user", "to", "some", "(", "typically", "PLC", ")", "groups", ".", "Note", "that", "if", "you", "add", "to", "no", "groups", "the", "effect", "is", "simply", "to", "do", "an", "add", "to", "organization", "Everybody", "group", "so", "we", "let",...
python
train
hardbyte/python-can
can/interfaces/usb2can/usb2canInterface.py
https://github.com/hardbyte/python-can/blob/cdc5254d96072df7739263623f3e920628a7d214/can/interfaces/usb2can/usb2canInterface.py#L162-L174
def _detect_available_configs(serial_matcher=None): """ Uses the Windows Management Instrumentation to identify serial devices. :param str serial_matcher (optional): search string for automatic detection of the device serial """ if serial_matcher: channel...
[ "def", "_detect_available_configs", "(", "serial_matcher", "=", "None", ")", ":", "if", "serial_matcher", ":", "channels", "=", "find_serial_devices", "(", "serial_matcher", ")", "else", ":", "channels", "=", "find_serial_devices", "(", ")", "return", "[", "{", ...
Uses the Windows Management Instrumentation to identify serial devices. :param str serial_matcher (optional): search string for automatic detection of the device serial
[ "Uses", "the", "Windows", "Management", "Instrumentation", "to", "identify", "serial", "devices", "." ]
python
train
tadashi-aikawa/owlmixin
owlmixin/__init__.py
https://github.com/tadashi-aikawa/owlmixin/blob/7c4a042c3008abddc56a8e8e55ae930d276071f5/owlmixin/__init__.py#L605-L619
def from_csvf(cls, fpath: str, fieldnames: Optional[Sequence[str]]=None, encoding: str='utf8', force_snake_case: bool=True, restrict: bool=True) -> TList[T]: """From csv file path to list of instance :param fpath: Csv file path :param fieldnames: Specify csv header names if no...
[ "def", "from_csvf", "(", "cls", ",", "fpath", ":", "str", ",", "fieldnames", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None", ",", "encoding", ":", "str", "=", "'utf8'", ",", "force_snake_case", ":", "bool", "=", "True", ",", "res...
From csv file path to list of instance :param fpath: Csv file path :param fieldnames: Specify csv header names if not included in the file :param encoding: Csv file encoding :param force_snake_case: Keys are transformed to snake case in order to compliant PEP8 if True :param res...
[ "From", "csv", "file", "path", "to", "list", "of", "instance" ]
python
train
inveniosoftware/invenio-files-rest
invenio_files_rest/serializer.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/serializer.py#L69-L97
def dump_links(self, o): """Dump links.""" params = {'versionId': o.version_id} data = { 'self': url_for( '.object_api', bucket_id=o.bucket_id, key=o.key, _external=True, **(params if not o.is_head or o.d...
[ "def", "dump_links", "(", "self", ",", "o", ")", ":", "params", "=", "{", "'versionId'", ":", "o", ".", "version_id", "}", "data", "=", "{", "'self'", ":", "url_for", "(", "'.object_api'", ",", "bucket_id", "=", "o", ".", "bucket_id", ",", "key", "="...
Dump links.
[ "Dump", "links", "." ]
python
train
lacava/few
few/variation.py
https://github.com/lacava/few/blob/5c72044425e9a5d73b8dc2cbb9b96e873dcb5b4a/few/variation.py#L206-L223
def is_valid_program(self,p): """checks whether program p makes a syntactically valid tree. checks that the accumulated program length is always greater than the accumulated arities, indicating that the appropriate number of arguments is alway present for functions. It then checks that ...
[ "def", "is_valid_program", "(", "self", ",", "p", ")", ":", "# print(\"p:\",p)", "arities", "=", "list", "(", "a", ".", "arity", "[", "a", ".", "in_type", "]", "for", "a", "in", "p", ")", "accu_arities", "=", "list", "(", "accumulate", "(", "arities", ...
checks whether program p makes a syntactically valid tree. checks that the accumulated program length is always greater than the accumulated arities, indicating that the appropriate number of arguments is alway present for functions. It then checks that the sum of arties +1 exactly equa...
[ "checks", "whether", "program", "p", "makes", "a", "syntactically", "valid", "tree", "." ]
python
train
marcotcr/lime
lime/lime_text.py
https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_text.py#L420-L469
def __data_labels_distances(self, indexed_string, classifier_fn, num_samples, distance_metric='cosine'): """Generates a neighborhood around a prediction. Generates neighborhoo...
[ "def", "__data_labels_distances", "(", "self", ",", "indexed_string", ",", "classifier_fn", ",", "num_samples", ",", "distance_metric", "=", "'cosine'", ")", ":", "def", "distance_fn", "(", "x", ")", ":", "return", "sklearn", ".", "metrics", ".", "pairwise", "...
Generates a neighborhood around a prediction. Generates neighborhood data by randomly removing words from the instance, and predicting with the classifier. Uses cosine distance to compute distances between original and perturbed instances. Args: indexed_string: document (Ind...
[ "Generates", "a", "neighborhood", "around", "a", "prediction", "." ]
python
train
kubernetes-client/python
kubernetes/client/apis/coordination_v1_api.py
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/coordination_v1_api.py#L153-L180
def delete_collection_namespaced_lease(self, namespace, **kwargs): """ delete collection of Lease This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_lease(namespac...
[ "def", "delete_collection_namespaced_lease", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "dele...
delete collection of Lease This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_lease(namespace, async_req=True) >>> result = thread.get() :param async_req bool ...
[ "delete", "collection", "of", "Lease", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", "."...
python
train
Valassis-Digital-Media/spylon
spylon/spark/launcher.py
https://github.com/Valassis-Digital-Media/spylon/blob/ac00e285fa1c790674606b793819c3e5baee0d48/spylon/spark/launcher.py#L552-L580
def with_spark_context(application_name, conf=None): """Context manager for a spark context Parameters ---------- application_name : string conf : string, optional Returns ------- sc : SparkContext Examples -------- Used within a context manager >>> with with_spark_con...
[ "def", "with_spark_context", "(", "application_name", ",", "conf", "=", "None", ")", ":", "if", "conf", "is", "None", ":", "conf", "=", "default_configuration", "assert", "isinstance", "(", "conf", ",", "SparkConfiguration", ")", "sc", "=", "conf", ".", "spa...
Context manager for a spark context Parameters ---------- application_name : string conf : string, optional Returns ------- sc : SparkContext Examples -------- Used within a context manager >>> with with_spark_context("MyApplication") as sc: ... # Your Code here ...
[ "Context", "manager", "for", "a", "spark", "context" ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/rnc_db.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/rnc_db.py#L2126-L2159
def insert_record_by_dict(self, table: str, valuedict: Dict[str, Any]) -> Optional[int]: """Inserts a record into database, table "table", using a dictionary containing field/value mappings. Returns the new PK (or None).""" if not value...
[ "def", "insert_record_by_dict", "(", "self", ",", "table", ":", "str", ",", "valuedict", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Optional", "[", "int", "]", ":", "if", "not", "valuedict", ":", "return", "None", "n", "=", "len", "(", "...
Inserts a record into database, table "table", using a dictionary containing field/value mappings. Returns the new PK (or None).
[ "Inserts", "a", "record", "into", "database", "table", "table", "using", "a", "dictionary", "containing", "field", "/", "value", "mappings", ".", "Returns", "the", "new", "PK", "(", "or", "None", ")", "." ]
python
train
andymccurdy/redis-py
redis/sentinel.py
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L109-L125
def rotate_slaves(self): "Round-robin slave balancer" slaves = self.sentinel_manager.discover_slaves(self.service_name) if slaves: if self.slave_rr_counter is None: self.slave_rr_counter = random.randint(0, len(slaves) - 1) for _ in xrange(len(slaves)): ...
[ "def", "rotate_slaves", "(", "self", ")", ":", "slaves", "=", "self", ".", "sentinel_manager", ".", "discover_slaves", "(", "self", ".", "service_name", ")", "if", "slaves", ":", "if", "self", ".", "slave_rr_counter", "is", "None", ":", "self", ".", "slave...
Round-robin slave balancer
[ "Round", "-", "robin", "slave", "balancer" ]
python
train
cpenv/cpenv
cpenv/cli.py
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cli.py#L144-L205
def activate(paths, skip_local, skip_shared): '''Activate an environment''' if not paths: ctx = click.get_current_context() if cpenv.get_active_env(): ctx.invoke(info) return click.echo(ctx.get_help()) examples = ( '\nExamples: \n' ...
[ "def", "activate", "(", "paths", ",", "skip_local", ",", "skip_shared", ")", ":", "if", "not", "paths", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "if", "cpenv", ".", "get_active_env", "(", ")", ":", "ctx", ".", "invoke", "(", "inf...
Activate an environment
[ "Activate", "an", "environment" ]
python
valid
fermiPy/fermipy
fermipy/jobs/job_archive.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L690-L705
def main_browse(): """Entry point for command line use for browsing a JobArchive """ parser = argparse.ArgumentParser(usage="job_archive.py [options]", description="Browse a job archive") parser.add_argument('--jobs', action='store', dest='job_archive_table', ...
[ "def", "main_browse", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "usage", "=", "\"job_archive.py [options]\"", ",", "description", "=", "\"Browse a job archive\"", ")", "parser", ".", "add_argument", "(", "'--jobs'", ",", "action", "=", ...
Entry point for command line use for browsing a JobArchive
[ "Entry", "point", "for", "command", "line", "use", "for", "browsing", "a", "JobArchive" ]
python
train
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthroughgraphics.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthroughgraphics.py#L179-L196
def load(self, graphic): """ Loads information for this item from the xml data. :param graphic | <XWalkthroughItem> """ for prop in graphic.properties(): key = prop.name() value = prop.value() if key == 'cap...
[ "def", "load", "(", "self", ",", "graphic", ")", ":", "for", "prop", "in", "graphic", ".", "properties", "(", ")", ":", "key", "=", "prop", ".", "name", "(", ")", "value", "=", "prop", ".", "value", "(", ")", "if", "key", "==", "'caption'", ":", ...
Loads information for this item from the xml data. :param graphic | <XWalkthroughItem>
[ "Loads", "information", "for", "this", "item", "from", "the", "xml", "data", ".", ":", "param", "graphic", "|", "<XWalkthroughItem", ">" ]
python
train
lablup/backend.ai-client-py
src/ai/backend/client/cli/files.py
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/files.py#L43-L62
def download(sess_id_or_alias, files, dest): """ Download files from a running container. \b SESSID: Session ID or its alias given when creating the session. FILES: Paths inside container. """ if len(files) < 1: return with Session() as session: try: print_wa...
[ "def", "download", "(", "sess_id_or_alias", ",", "files", ",", "dest", ")", ":", "if", "len", "(", "files", ")", "<", "1", ":", "return", "with", "Session", "(", ")", "as", "session", ":", "try", ":", "print_wait", "(", "'Downloading file(s) from {}...'", ...
Download files from a running container. \b SESSID: Session ID or its alias given when creating the session. FILES: Paths inside container.
[ "Download", "files", "from", "a", "running", "container", "." ]
python
train
ministryofjustice/money-to-prisoners-common
mtp_common/build_tasks/tasks.py
https://github.com/ministryofjustice/money-to-prisoners-common/blob/33c43a2912cb990d9148da7c8718f480f07d90a1/mtp_common/build_tasks/tasks.py#L317-L323
def additional_assets(context: Context): """ Collects assets from GOV.UK frontend toolkit """ rsync_flags = '-avz' if context.verbosity == 2 else '-az' for path in context.app.additional_asset_paths: context.shell('rsync %s %s %s/' % (rsync_flags, path, context.app.asset_build_path))
[ "def", "additional_assets", "(", "context", ":", "Context", ")", ":", "rsync_flags", "=", "'-avz'", "if", "context", ".", "verbosity", "==", "2", "else", "'-az'", "for", "path", "in", "context", ".", "app", ".", "additional_asset_paths", ":", "context", ".",...
Collects assets from GOV.UK frontend toolkit
[ "Collects", "assets", "from", "GOV", ".", "UK", "frontend", "toolkit" ]
python
train
jtwhite79/pyemu
pyemu/utils/helpers.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/helpers.py#L2901-L2920
def write_forward_run(self): """ write the forward run script forward_run.py """ with open(os.path.join(self.m.model_ws,self.forward_run_file),'w') as f: f.write("import os\nimport numpy as np\nimport pandas as pd\nimport flopy\n") f.write("import pyemu\n") f...
[ "def", "write_forward_run", "(", "self", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "m", ".", "model_ws", ",", "self", ".", "forward_run_file", ")", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "\...
write the forward run script forward_run.py
[ "write", "the", "forward", "run", "script", "forward_run", ".", "py" ]
python
train
RRZE-HPC/kerncraft
kerncraft/kernel.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L84-L107
def transform_multidim_to_1d_ref(aref, dimension_dict): """ Transform ast of multidimensional reference to a single dimension reference. In-place operation! """ dims = [] name = aref while type(name) is c_ast.ArrayRef: dims.append(name.subscript) name = name.name subscr...
[ "def", "transform_multidim_to_1d_ref", "(", "aref", ",", "dimension_dict", ")", ":", "dims", "=", "[", "]", "name", "=", "aref", "while", "type", "(", "name", ")", "is", "c_ast", ".", "ArrayRef", ":", "dims", ".", "append", "(", "name", ".", "subscript",...
Transform ast of multidimensional reference to a single dimension reference. In-place operation!
[ "Transform", "ast", "of", "multidimensional", "reference", "to", "a", "single", "dimension", "reference", "." ]
python
test
nats-io/asyncio-nats
nats/aio/client.py
https://github.com/nats-io/asyncio-nats/blob/39e840be0b12ce326edac0bba69aeb1be930dcb8/nats/aio/client.py#L735-L763
def timed_request(self, subject, payload, timeout=0.5): """ Implements the request/response pattern via pub/sub using an ephemeral subscription which will be published with a limited interest of 1 reply returning the response or raising a Timeout error. ->> SUB _INBOX....
[ "def", "timed_request", "(", "self", ",", "subject", ",", "payload", ",", "timeout", "=", "0.5", ")", ":", "next_inbox", "=", "INBOX_PREFIX", "[", ":", "]", "next_inbox", ".", "extend", "(", "self", ".", "_nuid", ".", "next", "(", ")", ")", "inbox", ...
Implements the request/response pattern via pub/sub using an ephemeral subscription which will be published with a limited interest of 1 reply returning the response or raising a Timeout error. ->> SUB _INBOX.2007314fe0fcb2cdc2a2914c1 90 ->> UNSUB 90 1 ->> PUB hell...
[ "Implements", "the", "request", "/", "response", "pattern", "via", "pub", "/", "sub", "using", "an", "ephemeral", "subscription", "which", "will", "be", "published", "with", "a", "limited", "interest", "of", "1", "reply", "returning", "the", "response", "or", ...
python
test
Kortemme-Lab/klab
klab/bio/pdb.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L2340-L2347
def getAtomLinesForResidueInRosettaStructure(self, resid): '''We assume a Rosetta-generated structure where residues are uniquely identified by number.''' lines = [line for line in self.lines if line[0:4] == "ATOM" and resid == int(line[22:27])] if not lines: #print('Failed searching...
[ "def", "getAtomLinesForResidueInRosettaStructure", "(", "self", ",", "resid", ")", ":", "lines", "=", "[", "line", "for", "line", "in", "self", ".", "lines", "if", "line", "[", "0", ":", "4", "]", "==", "\"ATOM\"", "and", "resid", "==", "int", "(", "li...
We assume a Rosetta-generated structure where residues are uniquely identified by number.
[ "We", "assume", "a", "Rosetta", "-", "generated", "structure", "where", "residues", "are", "uniquely", "identified", "by", "number", "." ]
python
train
duniter/duniter-python-api
duniterpy/api/endpoint.py
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/api/endpoint.py#L506-L513
def inline(self) -> str: """ Return endpoint string :return: """ inlined = [str(info) for info in (self.server, self.port) if info] return ESSubscribtionEndpoint.API + " " + " ".join(inlined)
[ "def", "inline", "(", "self", ")", "->", "str", ":", "inlined", "=", "[", "str", "(", "info", ")", "for", "info", "in", "(", "self", ".", "server", ",", "self", ".", "port", ")", "if", "info", "]", "return", "ESSubscribtionEndpoint", ".", "API", "+...
Return endpoint string :return:
[ "Return", "endpoint", "string" ]
python
train
brean/python-pathfinding
pathfinding/finder/bi_a_star.py
https://github.com/brean/python-pathfinding/blob/b857bf85e514a1712b40e29ccb5a473cd7fd5c80/pathfinding/finder/bi_a_star.py#L38-L77
def find_path(self, start, end, grid): """ find a path from start to end node on grid using the A* algorithm :param start: start node :param end: end node :param grid: grid that stores all possible steps/tiles as 2D-list :return: """ self.start_time = time...
[ "def", "find_path", "(", "self", ",", "start", ",", "end", ",", "grid", ")", ":", "self", ".", "start_time", "=", "time", ".", "time", "(", ")", "# execution time limitation", "self", ".", "runs", "=", "0", "# count number of iterations", "start_open_list", ...
find a path from start to end node on grid using the A* algorithm :param start: start node :param end: end node :param grid: grid that stores all possible steps/tiles as 2D-list :return:
[ "find", "a", "path", "from", "start", "to", "end", "node", "on", "grid", "using", "the", "A", "*", "algorithm", ":", "param", "start", ":", "start", "node", ":", "param", "end", ":", "end", "node", ":", "param", "grid", ":", "grid", "that", "stores",...
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/link.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/link.py#L180-L221
def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func): """Generate link names that should be created for a versioned shared lirbrary. Returns a dictionary in the form { linkname : linktarget } """ Verbose = False if Verbose: print("_versioned_lib_syml...
[ "def", "_versioned_lib_symlinks", "(", "env", ",", "libnode", ",", "version", ",", "prefix", ",", "suffix", ",", "name_func", ",", "soname_func", ")", ":", "Verbose", "=", "False", "if", "Verbose", ":", "print", "(", "\"_versioned_lib_symlinks: libnode={:r}\"", ...
Generate link names that should be created for a versioned shared lirbrary. Returns a dictionary in the form { linkname : linktarget }
[ "Generate", "link", "names", "that", "should", "be", "created", "for", "a", "versioned", "shared", "lirbrary", ".", "Returns", "a", "dictionary", "in", "the", "form", "{", "linkname", ":", "linktarget", "}" ]
python
train
ransford/sllurp
sllurp/llrp.py
https://github.com/ransford/sllurp/blob/d744b7e17d7ba64a24d9a31bde6cba65d91ad9b1/sllurp/llrp.py#L1201-L1220
def setTxPower(self, tx_power): """Set the transmission power for one or more antennas. @param tx_power: index into self.tx_power_table """ tx_pow_validated = self.get_tx_power(tx_power) logger.debug('tx_pow_validated: %s', tx_pow_validated) needs_update = False ...
[ "def", "setTxPower", "(", "self", ",", "tx_power", ")", ":", "tx_pow_validated", "=", "self", ".", "get_tx_power", "(", "tx_power", ")", "logger", ".", "debug", "(", "'tx_pow_validated: %s'", ",", "tx_pow_validated", ")", "needs_update", "=", "False", "for", "...
Set the transmission power for one or more antennas. @param tx_power: index into self.tx_power_table
[ "Set", "the", "transmission", "power", "for", "one", "or", "more", "antennas", "." ]
python
train
spyder-ide/spyder-kernels
spyder_kernels/customize/spydercustomize.py
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/customize/spydercustomize.py#L731-L758
def post_mortem_excepthook(type, value, tb): """ For post mortem exception handling, print a banner and enable post mortem debugging. """ clear_post_mortem() ipython_shell = get_ipython() ipython_shell.showtraceback((type, value, tb)) p = pdb.Pdb(ipython_shell.colors) if not type ==...
[ "def", "post_mortem_excepthook", "(", "type", ",", "value", ",", "tb", ")", ":", "clear_post_mortem", "(", ")", "ipython_shell", "=", "get_ipython", "(", ")", "ipython_shell", ".", "showtraceback", "(", "(", "type", ",", "value", ",", "tb", ")", ")", "p", ...
For post mortem exception handling, print a banner and enable post mortem debugging.
[ "For", "post", "mortem", "exception", "handling", "print", "a", "banner", "and", "enable", "post", "mortem", "debugging", "." ]
python
train
IdentityPython/oidcendpoint
src/oidcendpoint/oidc/token.py
https://github.com/IdentityPython/oidcendpoint/blob/6c1d729d51bfb6332816117fe476073df7a1d823/src/oidcendpoint/oidc/token.py#L137-L164
def _post_parse_request(self, request, client_id='', **kwargs): """ This is where clients come to get their access tokens :param request: The request :param authn: Authentication info, comes from HTTP header :returns: """ if 'state' in request: try: ...
[ "def", "_post_parse_request", "(", "self", ",", "request", ",", "client_id", "=", "''", ",", "*", "*", "kwargs", ")", ":", "if", "'state'", "in", "request", ":", "try", ":", "sinfo", "=", "self", ".", "endpoint_context", ".", "sdb", "[", "request", "["...
This is where clients come to get their access tokens :param request: The request :param authn: Authentication info, comes from HTTP header :returns:
[ "This", "is", "where", "clients", "come", "to", "get", "their", "access", "tokens" ]
python
train
benhoff/pluginmanager
pluginmanager/module_manager.py
https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L122-L131
def add_module_plugin_filters(self, module_plugin_filters): """ Adds `module_plugin_filters` to the internal module filters. May be a single object or an iterable. Every module filters must be a callable and take in a list of plugins and their associated names. """ ...
[ "def", "add_module_plugin_filters", "(", "self", ",", "module_plugin_filters", ")", ":", "module_plugin_filters", "=", "util", ".", "return_list", "(", "module_plugin_filters", ")", "self", ".", "module_plugin_filters", ".", "extend", "(", "module_plugin_filters", ")" ]
Adds `module_plugin_filters` to the internal module filters. May be a single object or an iterable. Every module filters must be a callable and take in a list of plugins and their associated names.
[ "Adds", "module_plugin_filters", "to", "the", "internal", "module", "filters", ".", "May", "be", "a", "single", "object", "or", "an", "iterable", "." ]
python
train
saltstack/salt
salt/modules/boto3_sns.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L99-L127
def describe_topic(name, region=None, key=None, keyid=None, profile=None): ''' Returns details about a specific SNS topic, specified by name or ARN. CLI example:: salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice ''' topics = list_topics(region=region, key=key, keyi...
[ "def", "describe_topic", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "topics", "=", "list_topics", "(", "region", "=", "region", ",", "key", "=", "key", ",", "k...
Returns details about a specific SNS topic, specified by name or ARN. CLI example:: salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice
[ "Returns", "details", "about", "a", "specific", "SNS", "topic", "specified", "by", "name", "or", "ARN", "." ]
python
train
rodricios/eatiht
eatiht/etv2.py
https://github.com/rodricios/eatiht/blob/7341c46327cfe7e0c9f226ef5e9808975c4d43da/eatiht/etv2.py#L209-L235
def get_textnode_subtrees(html_tree, xpath_to_text=TEXT_FINDER_XPATH): """A modification of get_sentence_xpath_tuples: some code was refactored-out, variable names are slightly different. This function does wrap the ltml.tree construction, so a file path, file-like structu...
[ "def", "get_textnode_subtrees", "(", "html_tree", ",", "xpath_to_text", "=", "TEXT_FINDER_XPATH", ")", ":", "try", ":", "xpath_finder", "=", "html_tree", ".", "getroot", "(", ")", ".", "getroottree", "(", ")", ".", "getpath", "except", "(", "AttributeError", "...
A modification of get_sentence_xpath_tuples: some code was refactored-out, variable names are slightly different. This function does wrap the ltml.tree construction, so a file path, file-like structure, or URL is required.
[ "A", "modification", "of", "get_sentence_xpath_tuples", ":", "some", "code", "was", "refactored", "-", "out", "variable", "names", "are", "slightly", "different", ".", "This", "function", "does", "wrap", "the", "ltml", ".", "tree", "construction", "so", "a", "...
python
train
saltstack/salt
salt/cloud/clouds/opennebula.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/opennebula.py#L4301-L4384
def vn_release(call=None, kwargs=None): ''' Releases a virtual network lease that was previously on hold. .. versionadded:: 2016.3.0 vn_id The ID of the virtual network from which to release the lease. Can be used instead of ``vn_name``. vn_name The name of the virtual net...
[ "def", "vn_release", "(", "call", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The vn_reserve function must be called with -f or --function.'", ")", "if", "kwargs", "is", "None", "...
Releases a virtual network lease that was previously on hold. .. versionadded:: 2016.3.0 vn_id The ID of the virtual network from which to release the lease. Can be used instead of ``vn_name``. vn_name The name of the virtual network from which to release the lease. Can be...
[ "Releases", "a", "virtual", "network", "lease", "that", "was", "previously", "on", "hold", "." ]
python
train
buildbot/buildbot
master/buildbot/www/service.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/service.py#L122-L134
def uid(self): """uid is now generated automatically according to the claims. This should actually only be used for cookie generation """ exp = datetime.datetime.utcnow() + self.expDelay claims = { 'user_info': self.user_info, # Note that we use JWT stand...
[ "def", "uid", "(", "self", ")", ":", "exp", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "+", "self", ".", "expDelay", "claims", "=", "{", "'user_info'", ":", "self", ".", "user_info", ",", "# Note that we use JWT standard 'exp' field to implemen...
uid is now generated automatically according to the claims. This should actually only be used for cookie generation
[ "uid", "is", "now", "generated", "automatically", "according", "to", "the", "claims", "." ]
python
train
juju/charm-helpers
charmhelpers/contrib/openstack/utils.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/utils.py#L1255-L1296
def check_actually_paused(services=None, ports=None): """Check that services listed in the services object and ports are actually closed (not listened to), to verify that the unit is properly paused. @param services: See _extract_services_list_helper @returns status, : string for status (None if ok...
[ "def", "check_actually_paused", "(", "services", "=", "None", ",", "ports", "=", "None", ")", ":", "state", "=", "None", "message", "=", "None", "messages", "=", "[", "]", "if", "services", "is", "not", "None", ":", "services", "=", "_extract_services_list...
Check that services listed in the services object and ports are actually closed (not listened to), to verify that the unit is properly paused. @param services: See _extract_services_list_helper @returns status, : string for status (None if okay) message : string for problem for status_set
[ "Check", "that", "services", "listed", "in", "the", "services", "object", "and", "ports", "are", "actually", "closed", "(", "not", "listened", "to", ")", "to", "verify", "that", "the", "unit", "is", "properly", "paused", "." ]
python
train
apache/incubator-heron
heron/instance/src/python/utils/tuple.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/tuple.py#L62-L74
def make_tuple(stream, tuple_key, values, roots=None): """Creates a HeronTuple :param stream: protobuf message ``StreamId`` :param tuple_key: tuple id :param values: a list of values :param roots: a list of protobuf message ``RootId`` """ component_name = stream.component_name stream_id...
[ "def", "make_tuple", "(", "stream", ",", "tuple_key", ",", "values", ",", "roots", "=", "None", ")", ":", "component_name", "=", "stream", ".", "component_name", "stream_id", "=", "stream", ".", "id", "gen_task", "=", "roots", "[", "0", "]", ".", "taskid...
Creates a HeronTuple :param stream: protobuf message ``StreamId`` :param tuple_key: tuple id :param values: a list of values :param roots: a list of protobuf message ``RootId``
[ "Creates", "a", "HeronTuple" ]
python
valid
juju/python-libjuju
juju/application.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/application.py#L332-L342
async def set_config(self, config): """Set configuration options for this application. :param config: Dict of configuration to set """ app_facade = client.ApplicationFacade.from_connection(self.connection) log.debug( 'Setting config for %s: %s', self.name, config) ...
[ "async", "def", "set_config", "(", "self", ",", "config", ")", ":", "app_facade", "=", "client", ".", "ApplicationFacade", ".", "from_connection", "(", "self", ".", "connection", ")", "log", ".", "debug", "(", "'Setting config for %s: %s'", ",", "self", ".", ...
Set configuration options for this application. :param config: Dict of configuration to set
[ "Set", "configuration", "options", "for", "this", "application", "." ]
python
train
IdentityPython/pysaml2
src/saml2/mdstore.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/mdstore.py#L388-L428
def certs(self, entity_id, descriptor, use="signing"): ''' Returns certificates for the given Entity ''' ent = self[entity_id] def extract_certs(srvs): res = [] for srv in srvs: if "key_descriptor" in srv: for key in sr...
[ "def", "certs", "(", "self", ",", "entity_id", ",", "descriptor", ",", "use", "=", "\"signing\"", ")", ":", "ent", "=", "self", "[", "entity_id", "]", "def", "extract_certs", "(", "srvs", ")", ":", "res", "=", "[", "]", "for", "srv", "in", "srvs", ...
Returns certificates for the given Entity
[ "Returns", "certificates", "for", "the", "given", "Entity" ]
python
train
dmcc/PyStanfordDependencies
StanfordDependencies/StanfordDependencies.py
https://github.com/dmcc/PyStanfordDependencies/blob/43d8f38a19e40087f273330087918c87df6d4d8f/StanfordDependencies/StanfordDependencies.py#L92-L116
def convert_trees(self, ptb_trees, representation='basic', universal=True, include_punct=True, include_erased=False, **kwargs): """Convert a list of Penn Treebank formatted strings (ptb_trees) into Stanford Dependencies. The dependencies are represented as a list of sentenc...
[ "def", "convert_trees", "(", "self", ",", "ptb_trees", ",", "representation", "=", "'basic'", ",", "universal", "=", "True", ",", "include_punct", "=", "True", ",", "include_erased", "=", "False", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update",...
Convert a list of Penn Treebank formatted strings (ptb_trees) into Stanford Dependencies. The dependencies are represented as a list of sentences (CoNLL.Corpus), where each sentence (CoNLL.Sentence) is itself a list of CoNLL.Token objects. Currently supported representations are 'basic'...
[ "Convert", "a", "list", "of", "Penn", "Treebank", "formatted", "strings", "(", "ptb_trees", ")", "into", "Stanford", "Dependencies", ".", "The", "dependencies", "are", "represented", "as", "a", "list", "of", "sentences", "(", "CoNLL", ".", "Corpus", ")", "wh...
python
train
NICTA/revrand
revrand/slm.py
https://github.com/NICTA/revrand/blob/4c1881b6c1772d2b988518e49dde954f165acfb6/revrand/slm.py#L219-L244
def predict_moments(self, X): """ Full predictive distribution from Bayesian linear regression. Parameters ---------- X : ndarray (N*,d) array query input dataset (N* samples, d dimensions). Returns ------- Ey : ndarray The expect...
[ "def", "predict_moments", "(", "self", ",", "X", ")", ":", "check_is_fitted", "(", "self", ",", "[", "'var_'", ",", "'regularizer_'", ",", "'weights_'", ",", "'covariance_'", ",", "'hypers_'", "]", ")", "X", "=", "check_array", "(", "X", ")", "Phi", "=",...
Full predictive distribution from Bayesian linear regression. Parameters ---------- X : ndarray (N*,d) array query input dataset (N* samples, d dimensions). Returns ------- Ey : ndarray The expected value of y* for the query inputs, X* of shape (...
[ "Full", "predictive", "distribution", "from", "Bayesian", "linear", "regression", "." ]
python
train
numenta/htmresearch
htmresearch/regions/RawSensor.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/regions/RawSensor.py#L104-L126
def compute(self, inputs, outputs): """ Get the next record from the queue and encode it. The fields for inputs and outputs are as defined in the spec above. """ if len(self.queue) > 0: # Take the top element of the data queue data = self.queue.pop() else: raise Exception("Raw...
[ "def", "compute", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "if", "len", "(", "self", ".", "queue", ")", ">", "0", ":", "# Take the top element of the data queue", "data", "=", "self", ".", "queue", ".", "pop", "(", ")", "else", ":", "raise...
Get the next record from the queue and encode it. The fields for inputs and outputs are as defined in the spec above.
[ "Get", "the", "next", "record", "from", "the", "queue", "and", "encode", "it", ".", "The", "fields", "for", "inputs", "and", "outputs", "are", "as", "defined", "in", "the", "spec", "above", "." ]
python
train
jepegit/cellpy
cellpy/utils/batch_tools/batch_plotters.py
https://github.com/jepegit/cellpy/blob/9f4a84cdd11f72cfa02cda8c2d7b5174abbb7370/cellpy/utils/batch_tools/batch_plotters.py#L464-L483
def run_dumper(self, dumper): """run dumber (once pr. engine) Args: dumper: dumper to run (function or method). The dumper takes the attributes experiments, farms, and barn as input. It does not return anything. But can, if the dumper designer feels in a bad and nas...
[ "def", "run_dumper", "(", "self", ",", "dumper", ")", ":", "logging", ".", "debug", "(", "\"start dumper::\"", ")", "dumper", "(", "experiments", "=", "self", ".", "experiments", ",", "farms", "=", "self", ".", "farms", ",", "barn", "=", "self", ".", "...
run dumber (once pr. engine) Args: dumper: dumper to run (function or method). The dumper takes the attributes experiments, farms, and barn as input. It does not return anything. But can, if the dumper designer feels in a bad and nasty mood, modify the input objects ...
[ "run", "dumber", "(", "once", "pr", ".", "engine", ")" ]
python
train
kovacsbalu/WazeRouteCalculator
WazeRouteCalculator/WazeRouteCalculator.py
https://github.com/kovacsbalu/WazeRouteCalculator/blob/13ddb064571bb2bc0ceec51b5b317640b2bc3fb2/WazeRouteCalculator/WazeRouteCalculator.py#L88-L113
def address_to_coords(self, address): """Convert address to coordinates""" base_coords = self.BASE_COORDS[self.region] get_cord = self.COORD_SERVERS[self.region] url_options = { "q": address, "lang": "eng", "origin": "livemap", "lat": base...
[ "def", "address_to_coords", "(", "self", ",", "address", ")", ":", "base_coords", "=", "self", ".", "BASE_COORDS", "[", "self", ".", "region", "]", "get_cord", "=", "self", ".", "COORD_SERVERS", "[", "self", ".", "region", "]", "url_options", "=", "{", "...
Convert address to coordinates
[ "Convert", "address", "to", "coordinates" ]
python
train
bhmm/bhmm
bhmm/output_models/discrete.py
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/discrete.py#L130-L157
def p_obs(self, obs, out=None): """ Returns the output probabilities for an entire trajectory and all hidden states Parameters ---------- obs : ndarray((T), dtype=int) a discrete trajectory of length T Return ------ p_o : ndarray (T,N) ...
[ "def", "p_obs", "(", "self", ",", "obs", ",", "out", "=", "None", ")", ":", "if", "out", "is", "None", ":", "out", "=", "self", ".", "_output_probabilities", "[", ":", ",", "obs", "]", ".", "T", "# out /= np.sum(out, axis=1)[:,None]", "return", "self", ...
Returns the output probabilities for an entire trajectory and all hidden states Parameters ---------- obs : ndarray((T), dtype=int) a discrete trajectory of length T Return ------ p_o : ndarray (T,N) the probability of generating the symbol at ti...
[ "Returns", "the", "output", "probabilities", "for", "an", "entire", "trajectory", "and", "all", "hidden", "states" ]
python
train
LonamiWebs/Telethon
telethon/tl/custom/chatgetter.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/chatgetter.py#L27-L40
async def get_chat(self): """ Returns `chat`, but will make an API call to find the chat unless it's already cached. """ # See `get_sender` for information about 'min'. if (self._chat is None or getattr(self._chat, 'min', None))\ and await self.get_input_c...
[ "async", "def", "get_chat", "(", "self", ")", ":", "# See `get_sender` for information about 'min'.", "if", "(", "self", ".", "_chat", "is", "None", "or", "getattr", "(", "self", ".", "_chat", ",", "'min'", ",", "None", ")", ")", "and", "await", "self", "....
Returns `chat`, but will make an API call to find the chat unless it's already cached.
[ "Returns", "chat", "but", "will", "make", "an", "API", "call", "to", "find", "the", "chat", "unless", "it", "s", "already", "cached", "." ]
python
train