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
ContextLab/quail
quail/plot.py
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/plot.py#L12-L288
def plot(results, subjgroup=None, subjname='Subject Group', listgroup=None, listname='List', subjconds=None, listconds=None, plot_type=None, plot_style=None, title=None, legend=True, xlim=None, ylim=None, save_path=None, show=True, ax=None, **kwargs): """ General plot function that gr...
[ "def", "plot", "(", "results", ",", "subjgroup", "=", "None", ",", "subjname", "=", "'Subject Group'", ",", "listgroup", "=", "None", ",", "listname", "=", "'List'", ",", "subjconds", "=", "None", ",", "listconds", "=", "None", ",", "plot_type", "=", "No...
General plot function that groups data by subject/list number and performs analysis. Parameters ---------- results : quail.FriedEgg Object containing results subjgroup : list of strings or ints String/int variables indicating how to group over subjects. Must be the length of t...
[ "General", "plot", "function", "that", "groups", "data", "by", "subject", "/", "list", "number", "and", "performs", "analysis", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/parallel/util.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/util.py#L136-L166
def validate_url(url): """validate a url for zeromq""" if not isinstance(url, basestring): raise TypeError("url must be a string, not %r"%type(url)) url = url.lower() proto_addr = url.split('://') assert len(proto_addr) == 2, 'Invalid url: %r'%url proto, addr = proto_addr assert...
[ "def", "validate_url", "(", "url", ")", ":", "if", "not", "isinstance", "(", "url", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"url must be a string, not %r\"", "%", "type", "(", "url", ")", ")", "url", "=", "url", ".", "lower", "(", ")", ...
validate a url for zeromq
[ "validate", "a", "url", "for", "zeromq" ]
python
test
uber/doubles
doubles/space.py
https://github.com/uber/doubles/blob/15e68dcf98f709b19a581915fa6af5ef49ebdd8a/doubles/space.py#L55-L61
def clear(self, obj): """Clear allowances/expectations set on an object. :param object obj: The object to clear. """ self.proxy_for(obj).restore_original_object() del self._proxies[id(obj)]
[ "def", "clear", "(", "self", ",", "obj", ")", ":", "self", ".", "proxy_for", "(", "obj", ")", ".", "restore_original_object", "(", ")", "del", "self", ".", "_proxies", "[", "id", "(", "obj", ")", "]" ]
Clear allowances/expectations set on an object. :param object obj: The object to clear.
[ "Clear", "allowances", "/", "expectations", "set", "on", "an", "object", "." ]
python
train
knipknap/SpiffWorkflow
SpiffWorkflow/util/weakmethod.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/weakmethod.py#L117-L132
def ref(function, callback=None): """ Returns a weak reference to the given method or function. If the callback argument is not None, it is called as soon as the referenced function is garbage deleted. :type function: callable :param function: The function to reference. :type callback: ca...
[ "def", "ref", "(", "function", ",", "callback", "=", "None", ")", ":", "try", ":", "function", ".", "__func__", "except", "AttributeError", ":", "return", "_WeakMethodFree", "(", "function", ",", "callback", ")", "return", "_WeakMethodBound", "(", "function", ...
Returns a weak reference to the given method or function. If the callback argument is not None, it is called as soon as the referenced function is garbage deleted. :type function: callable :param function: The function to reference. :type callback: callable :param callback: Called when the fu...
[ "Returns", "a", "weak", "reference", "to", "the", "given", "method", "or", "function", ".", "If", "the", "callback", "argument", "is", "not", "None", "it", "is", "called", "as", "soon", "as", "the", "referenced", "function", "is", "garbage", "deleted", "."...
python
valid
exekias/droplet
droplet/files.py
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/files.py#L77-L95
def _write_log(self): """ Write log info """ logger.info("Writing config file %s" % self.path) if settings.DEBUG: try: old_content = open(self.path, 'r').readlines() except IOError: old_content = '' new_content...
[ "def", "_write_log", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Writing config file %s\"", "%", "self", ".", "path", ")", "if", "settings", ".", "DEBUG", ":", "try", ":", "old_content", "=", "open", "(", "self", ".", "path", ",", "'r'", ")",...
Write log info
[ "Write", "log", "info" ]
python
train
networks-lab/metaknowledge
metaknowledge/recordCollection.py
https://github.com/networks-lab/metaknowledge/blob/8162bf95e66bb6f9916081338e6e2a6132faff75/metaknowledge/recordCollection.py#L436-L553
def forBurst(self, tag, outputFile = None, dropList = None, lower = True, removeNumbers = True, removeNonWords = True, removeWhitespace = True, stemmer = None): """Creates a pandas friendly dictionary with 2 columns one `'year'` and the other `'word'`. Each row is a word that occurred in the field given by _tag...
[ "def", "forBurst", "(", "self", ",", "tag", ",", "outputFile", "=", "None", ",", "dropList", "=", "None", ",", "lower", "=", "True", ",", "removeNumbers", "=", "True", ",", "removeNonWords", "=", "True", ",", "removeWhitespace", "=", "True", ",", "stemme...
Creates a pandas friendly dictionary with 2 columns one `'year'` and the other `'word'`. Each row is a word that occurred in the field given by _tag_ in a `Record` and the year of the record. Unfortunately getting the month or day with any type of accuracy has proved to be impossible so year is the only option. ...
[ "Creates", "a", "pandas", "friendly", "dictionary", "with", "2", "columns", "one", "year", "and", "the", "other", "word", ".", "Each", "row", "is", "a", "word", "that", "occurred", "in", "the", "field", "given", "by", "_tag_", "in", "a", "Record", "and",...
python
train
cdeboever3/cdpybio
cdpybio/mutect.py
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/mutect.py#L4-L77
def read_variants(fns, remove=['DBSNP'], keep_only=True, min_tumor_f=0.1, min_tumor_cov=14, min_normal_cov=8): """Read muTect results from the list of files fns Parameters ---------- fns : list List of MuTect output files. Returns ------- variant...
[ "def", "read_variants", "(", "fns", ",", "remove", "=", "[", "'DBSNP'", "]", ",", "keep_only", "=", "True", ",", "min_tumor_f", "=", "0.1", ",", "min_tumor_cov", "=", "14", ",", "min_normal_cov", "=", "8", ")", ":", "variants", "=", "[", "]", "for", ...
Read muTect results from the list of files fns Parameters ---------- fns : list List of MuTect output files. Returns ------- variants : pandas.DataFrame Pandas DataFrame summarizing variant calling results. remove : list List of site types for column "dbsnp_site" t...
[ "Read", "muTect", "results", "from", "the", "list", "of", "files", "fns" ]
python
train
xoolive/traffic
traffic/data/adsb/opensky_impala.py
https://github.com/xoolive/traffic/blob/d1a8878098f16759f6b6e0e8d8b8f32e34a680a8/traffic/data/adsb/opensky_impala.py#L125-L159
def _format_dataframe( df: pd.DataFrame, nautical_units=True ) -> pd.DataFrame: """ This function converts types, strips spaces after callsigns and sorts the DataFrame by timestamp. For some reason, all data arriving from OpenSky are converted to units in metric syst...
[ "def", "_format_dataframe", "(", "df", ":", "pd", ".", "DataFrame", ",", "nautical_units", "=", "True", ")", "->", "pd", ".", "DataFrame", ":", "if", "\"callsign\"", "in", "df", ".", "columns", "and", "df", ".", "callsign", ".", "dtype", "==", "object", ...
This function converts types, strips spaces after callsigns and sorts the DataFrame by timestamp. For some reason, all data arriving from OpenSky are converted to units in metric system. Optionally, you may convert the units back to nautical miles, feet and feet/min.
[ "This", "function", "converts", "types", "strips", "spaces", "after", "callsigns", "and", "sorts", "the", "DataFrame", "by", "timestamp", "." ]
python
train
liip/taxi
taxi/commands/plugin.py
https://github.com/liip/taxi/blob/269423c1f1ab571bd01a522819afe3e325bfbff6/taxi/commands/plugin.py#L97-L105
def list_(ctx): """ Lists installed plugins. """ plugins = plugins_registry.get_plugins() click.echo("\n".join( ["%s (%s)" % p for p in plugins.items()] ))
[ "def", "list_", "(", "ctx", ")", ":", "plugins", "=", "plugins_registry", ".", "get_plugins", "(", ")", "click", ".", "echo", "(", "\"\\n\"", ".", "join", "(", "[", "\"%s (%s)\"", "%", "p", "for", "p", "in", "plugins", ".", "items", "(", ")", "]", ...
Lists installed plugins.
[ "Lists", "installed", "plugins", "." ]
python
train
openmeteo/pd2hts
pd2hts/__init__.py
https://github.com/openmeteo/pd2hts/blob/b8f982046e2b99680445298b63a488dd76f6e104/pd2hts/__init__.py#L247-L265
def read_meta_line(self, f): """Read one line from a file format header and return a (name, value) tuple, where name is lowercased. Returns ('', '') if the next line is blank. Raises ParsingError if next line in f is not a valid header line.""" line = f.readline() if isin...
[ "def", "read_meta_line", "(", "self", ",", "f", ")", ":", "line", "=", "f", ".", "readline", "(", ")", "if", "isinstance", "(", "line", ",", "bytes", ")", ":", "line", "=", "line", ".", "decode", "(", "'utf-8-sig'", ")", "name", ",", "value", "=", ...
Read one line from a file format header and return a (name, value) tuple, where name is lowercased. Returns ('', '') if the next line is blank. Raises ParsingError if next line in f is not a valid header line.
[ "Read", "one", "line", "from", "a", "file", "format", "header", "and", "return", "a", "(", "name", "value", ")", "tuple", "where", "name", "is", "lowercased", ".", "Returns", "(", ")", "if", "the", "next", "line", "is", "blank", ".", "Raises", "Parsing...
python
train
googleapis/google-cloud-python
dns/google/cloud/dns/changes.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/changes.py#L42-L56
def from_api_repr(cls, resource, zone): """Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds...
[ "def", "from_api_repr", "(", "cls", ",", "resource", ",", "zone", ")", ":", "changes", "=", "cls", "(", "zone", "=", "zone", ")", "changes", ".", "_set_properties", "(", "resource", ")", "return", "changes" ]
Factory: construct a change set given its API representation :type resource: dict :param resource: change set representation returned from the API. :type zone: :class:`google.cloud.dns.zone.ManagedZone` :param zone: A zone which holds zero or more change sets. :rtype: :class:...
[ "Factory", ":", "construct", "a", "change", "set", "given", "its", "API", "representation" ]
python
train
brean/python-pathfinding
pathfinding/core/grid.py
https://github.com/brean/python-pathfinding/blob/b857bf85e514a1712b40e29ccb5a473cd7fd5c80/pathfinding/core/grid.py#L70-L74
def walkable(self, x, y): """ check, if the tile is inside grid and if it is set as walkable """ return self.inside(x, y) and self.nodes[y][x].walkable
[ "def", "walkable", "(", "self", ",", "x", ",", "y", ")", ":", "return", "self", ".", "inside", "(", "x", ",", "y", ")", "and", "self", ".", "nodes", "[", "y", "]", "[", "x", "]", ".", "walkable" ]
check, if the tile is inside grid and if it is set as walkable
[ "check", "if", "the", "tile", "is", "inside", "grid", "and", "if", "it", "is", "set", "as", "walkable" ]
python
train
andreasjansson/head-in-the-clouds
headintheclouds/dependencies/PyDbLite/SQLite.py
https://github.com/andreasjansson/head-in-the-clouds/blob/32c1d00d01036834dc94368e7f38b0afd3f7a82f/headintheclouds/dependencies/PyDbLite/SQLite.py#L307-L323
def insert(self,*args,**kw): """Insert a record in the database Parameters can be positional or keyword arguments. If positional they must be in the same order as in the create() method If some of the fields are missing the value is set to None Returns the record identifier ...
[ "def", "insert", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "args", ":", "kw", "=", "dict", "(", "[", "(", "f", ",", "arg", ")", "for", "f", ",", "arg", "in", "zip", "(", "self", ".", "fields", ",", "args", ")", "...
Insert a record in the database Parameters can be positional or keyword arguments. If positional they must be in the same order as in the create() method If some of the fields are missing the value is set to None Returns the record identifier
[ "Insert", "a", "record", "in", "the", "database", "Parameters", "can", "be", "positional", "or", "keyword", "arguments", ".", "If", "positional", "they", "must", "be", "in", "the", "same", "order", "as", "in", "the", "create", "()", "method", "If", "some",...
python
train
by46/simplekit
simplekit/docker/docker.py
https://github.com/by46/simplekit/blob/33f3ce6de33accc185e1057f096af41859db5976/simplekit/docker/docker.py#L143-L168
def delete_container_2(self, name): """ :param name: `class`:`str`, container name :return: `class`:`bool`, return True if delete success, otherwise return False """ code, container = self.get_container(name) if code == httplib.NOT_FOUND: return True ...
[ "def", "delete_container_2", "(", "self", ",", "name", ")", ":", "code", ",", "container", "=", "self", ".", "get_container", "(", "name", ")", "if", "code", "==", "httplib", ".", "NOT_FOUND", ":", "return", "True", "elif", "code", "!=", "httplib", ".", ...
:param name: `class`:`str`, container name :return: `class`:`bool`, return True if delete success, otherwise return False
[ ":", "param", "name", ":", "class", ":", "str", "container", "name", ":", "return", ":", "class", ":", "bool", "return", "True", "if", "delete", "success", "otherwise", "return", "False" ]
python
train
dw/mitogen
mitogen/select.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/select.py#L249-L262
def close(self): """ Remove the select's notifier function from each registered receiver, mark the associated latch as closed, and cause any thread currently sleeping in :meth:`get` to be woken with :class:`mitogen.core.LatchError`. This is necessary to prevent memory le...
[ "def", "close", "(", "self", ")", ":", "for", "recv", "in", "self", ".", "_receivers", "[", ":", "]", ":", "self", ".", "remove", "(", "recv", ")", "self", ".", "_latch", ".", "close", "(", ")" ]
Remove the select's notifier function from each registered receiver, mark the associated latch as closed, and cause any thread currently sleeping in :meth:`get` to be woken with :class:`mitogen.core.LatchError`. This is necessary to prevent memory leaks in long-running receivers. It ...
[ "Remove", "the", "select", "s", "notifier", "function", "from", "each", "registered", "receiver", "mark", "the", "associated", "latch", "as", "closed", "and", "cause", "any", "thread", "currently", "sleeping", "in", ":", "meth", ":", "get", "to", "be", "woke...
python
train
tcalmant/ipopo
pelix/http/basic.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L419-L432
def server_bind(self): """ Override server_bind to store the server name, even in IronPython. See https://ironpython.codeplex.com/workitem/29477 """ TCPServer.server_bind(self) host, port = self.socket.getsockname()[:2] self.server_port = port try: ...
[ "def", "server_bind", "(", "self", ")", ":", "TCPServer", ".", "server_bind", "(", "self", ")", "host", ",", "port", "=", "self", ".", "socket", ".", "getsockname", "(", ")", "[", ":", "2", "]", "self", ".", "server_port", "=", "port", "try", ":", ...
Override server_bind to store the server name, even in IronPython. See https://ironpython.codeplex.com/workitem/29477
[ "Override", "server_bind", "to", "store", "the", "server", "name", "even", "in", "IronPython", "." ]
python
train
ranaroussi/qtpylib
qtpylib/tools.py
https://github.com/ranaroussi/qtpylib/blob/0dbbc465fafd9cb9b0f4d10e1e07fae4e15032dd/qtpylib/tools.py#L375-L414
def backdate(res, date=None, as_datetime=False, fmt='%Y-%m-%d'): """ get past date based on currect date """ if res is None: return None if date is None: date = datetime.datetime.now() else: try: date = parse_date(date) except Exception as e: pass...
[ "def", "backdate", "(", "res", ",", "date", "=", "None", ",", "as_datetime", "=", "False", ",", "fmt", "=", "'%Y-%m-%d'", ")", ":", "if", "res", "is", "None", ":", "return", "None", "if", "date", "is", "None", ":", "date", "=", "datetime", ".", "da...
get past date based on currect date
[ "get", "past", "date", "based", "on", "currect", "date" ]
python
train
studionow/pybrightcove
pybrightcove/playlist.py
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L93-L108
def _find_playlist(self): """ Internal method to populate the object given the ``id`` or ``reference_id`` that has been set in the constructor. """ data = None if self.id: data = self.connection.get_item( 'find_playlist_by_id', playlist_id=self...
[ "def", "_find_playlist", "(", "self", ")", ":", "data", "=", "None", "if", "self", ".", "id", ":", "data", "=", "self", ".", "connection", ".", "get_item", "(", "'find_playlist_by_id'", ",", "playlist_id", "=", "self", ".", "id", ")", "elif", "self", "...
Internal method to populate the object given the ``id`` or ``reference_id`` that has been set in the constructor.
[ "Internal", "method", "to", "populate", "the", "object", "given", "the", "id", "or", "reference_id", "that", "has", "been", "set", "in", "the", "constructor", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/interface/ethernet/switchport/trunk/allowed/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/interface/ethernet/switchport/trunk/allowed/__init__.py#L138-L163
def _set_vlanoper(self, v, load=False): """ Setter method for vlanoper, mapped from YANG variable /interface/ethernet/switchport/trunk/allowed/vlanoper (container) If this variable is read-only (config: false) in the source YANG file, then _set_vlanoper is considered as a private method. Backends lo...
[ "def", "_set_vlanoper", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base"...
Setter method for vlanoper, mapped from YANG variable /interface/ethernet/switchport/trunk/allowed/vlanoper (container) If this variable is read-only (config: false) in the source YANG file, then _set_vlanoper is considered as a private method. Backends looking to populate this variable should do so via...
[ "Setter", "method", "for", "vlanoper", "mapped", "from", "YANG", "variable", "/", "interface", "/", "ethernet", "/", "switchport", "/", "trunk", "/", "allowed", "/", "vlanoper", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(...
python
train
saltstack/salt
salt/states/pip_state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L300-L961
def installed(name, pkgs=None, pip_bin=None, requirements=None, bin_env=None, use_wheel=False, no_use_wheel=False, log=None, proxy=None, timeout=None, repo=None, edit...
[ "def", "installed", "(", "name", ",", "pkgs", "=", "None", ",", "pip_bin", "=", "None", ",", "requirements", "=", "None", ",", "bin_env", "=", "None", ",", "use_wheel", "=", "False", ",", "no_use_wheel", "=", "False", ",", "log", "=", "None", ",", "p...
Make sure the package is installed name The name of the python package to install. You can also specify version numbers here using the standard operators ``==, >=, <=``. If ``requirements`` is given, this parameter will be ignored. Example: .. code-block:: yaml django: ...
[ "Make", "sure", "the", "package", "is", "installed" ]
python
train
NLeSC/noodles
noodles/lib/coroutine.py
https://github.com/NLeSC/noodles/blob/3759e24e6e54a3a1a364431309dbb1061f617c04/noodles/lib/coroutine.py#L4-L16
def coroutine(f): """ A sink should be send `None` first, so that the coroutine arrives at the `yield` position. This wrapper takes care that this is done automatically when the coroutine is started. """ @wraps(f) def g(*args, **kwargs): sink = f(*args, **kwargs) sink.send(No...
[ "def", "coroutine", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "g", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sink", "=", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "sink", ".", "send", "(", "None", ")", ...
A sink should be send `None` first, so that the coroutine arrives at the `yield` position. This wrapper takes care that this is done automatically when the coroutine is started.
[ "A", "sink", "should", "be", "send", "None", "first", "so", "that", "the", "coroutine", "arrives", "at", "the", "yield", "position", ".", "This", "wrapper", "takes", "care", "that", "this", "is", "done", "automatically", "when", "the", "coroutine", "is", "...
python
train
openpermissions/perch
perch/model.py
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/model.py#L358-L381
def delete(self, user): """Delete a resource""" if user: can_delete = yield self.can_delete(user) else: can_delete = False if not can_delete: raise exceptions.Unauthorized('User may not delete the resource') doc = { '_id': self.id...
[ "def", "delete", "(", "self", ",", "user", ")", ":", "if", "user", ":", "can_delete", "=", "yield", "self", ".", "can_delete", "(", "user", ")", "else", ":", "can_delete", "=", "False", "if", "not", "can_delete", ":", "raise", "exceptions", ".", "Unaut...
Delete a resource
[ "Delete", "a", "resource" ]
python
train
gem/oq-engine
openquake/hazardlib/near_fault.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/near_fault.py#L111-L144
def projection_pp(site, normal, dist_to_plane, reference): ''' This method finds the projection of the site onto the plane containing the slipped area, defined as the Pp(i.e. 'perpendicular projection of site location onto the fault plane' Spudich et al. (2013) - page 88) given a site. :param s...
[ "def", "projection_pp", "(", "site", ",", "normal", ",", "dist_to_plane", ",", "reference", ")", ":", "# Transform to xyz coordinate", "[", "site_x", ",", "site_y", ",", "site_z", "]", "=", "get_xyz_from_ll", "(", "site", ",", "reference", ")", "a", "=", "np...
This method finds the projection of the site onto the plane containing the slipped area, defined as the Pp(i.e. 'perpendicular projection of site location onto the fault plane' Spudich et al. (2013) - page 88) given a site. :param site: Location of the site, [lon, lat, dep] :param normal: ...
[ "This", "method", "finds", "the", "projection", "of", "the", "site", "onto", "the", "plane", "containing", "the", "slipped", "area", "defined", "as", "the", "Pp", "(", "i", ".", "e", ".", "perpendicular", "projection", "of", "site", "location", "onto", "th...
python
train
usc-isi-i2/etk
etk/extractors/html_content_extractor.py
https://github.com/usc-isi-i2/etk/blob/aab077c984ea20f5e8ae33af622fe11d3c4df866/etk/extractors/html_content_extractor.py#L41-L69
def extract(self, html_text: str, strategy: Strategy=Strategy.ALL_TEXT) \ -> List[Extraction]: """ Extracts text from an HTML page using a variety of strategies Args: html_text (str): html page in string strategy (enum[Strategy.ALL_TEXT, Strategy.MAIN_CONTENT...
[ "def", "extract", "(", "self", ",", "html_text", ":", "str", ",", "strategy", ":", "Strategy", "=", "Strategy", ".", "ALL_TEXT", ")", "->", "List", "[", "Extraction", "]", ":", "if", "html_text", ":", "if", "strategy", "==", "Strategy", ".", "ALL_TEXT", ...
Extracts text from an HTML page using a variety of strategies Args: html_text (str): html page in string strategy (enum[Strategy.ALL_TEXT, Strategy.MAIN_CONTENT_RELAXED, Strategy.MAIN_CONTENT_STRICT]): one of Strategy.ALL_TEXT, Strategy.MAIN_CONTENT_STRICT and Strategy.MAIN_...
[ "Extracts", "text", "from", "an", "HTML", "page", "using", "a", "variety", "of", "strategies" ]
python
train
angr/angr
angr/knowledge_plugins/cfg/cfg_model.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/knowledge_plugins/cfg/cfg_model.py#L307-L340
def get_predecessors(self, cfgnode, excluding_fakeret=True, jumpkind=None): """ Get predecessors of a node in the control flow graph. :param CFGNode cfgnode: The node. :param bool excluding_fakeret: True if you want to exclude all predecessors that is connected to the n...
[ "def", "get_predecessors", "(", "self", ",", "cfgnode", ",", "excluding_fakeret", "=", "True", ",", "jumpkind", "=", "None", ")", ":", "if", "excluding_fakeret", "and", "jumpkind", "==", "'Ijk_FakeRet'", ":", "return", "[", "]", "if", "not", "excluding_fakeret...
Get predecessors of a node in the control flow graph. :param CFGNode cfgnode: The node. :param bool excluding_fakeret: True if you want to exclude all predecessors that is connected to the node with a fakeret edge. :param str or None ...
[ "Get", "predecessors", "of", "a", "node", "in", "the", "control", "flow", "graph", "." ]
python
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/common.py
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/common.py#L346-L369
def cree_widgets(self): """Create widgets and store them in self.widgets""" for t in self.FIELDS: if type(t) is str: attr, kwargs = t, {} else: attr, kwargs = t[0], t[1].copy() self.champs.append(attr) is_editable = kwargs.p...
[ "def", "cree_widgets", "(", "self", ")", ":", "for", "t", "in", "self", ".", "FIELDS", ":", "if", "type", "(", "t", ")", "is", "str", ":", "attr", ",", "kwargs", "=", "t", ",", "{", "}", "else", ":", "attr", ",", "kwargs", "=", "t", "[", "0",...
Create widgets and store them in self.widgets
[ "Create", "widgets", "and", "store", "them", "in", "self", ".", "widgets" ]
python
train
dnanexus/dx-toolkit
src/python/dxpy/utils/resolver.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L357-L402
def resolve_container_id_or_name(raw_string, is_error=False, multi=False): ''' :param raw_string: A potential project or container ID or name :type raw_string: string :param is_error: Whether to raise an exception if the project or container ID cannot be resolved :type is_error: boolean ...
[ "def", "resolve_container_id_or_name", "(", "raw_string", ",", "is_error", "=", "False", ",", "multi", "=", "False", ")", ":", "string", "=", "unescape_name_str", "(", "raw_string", ")", "if", "is_container_id", "(", "string", ")", ":", "return", "(", "[", "...
:param raw_string: A potential project or container ID or name :type raw_string: string :param is_error: Whether to raise an exception if the project or container ID cannot be resolved :type is_error: boolean :returns: Project or container ID if found or else None :rtype: string or None ...
[ ":", "param", "raw_string", ":", "A", "potential", "project", "or", "container", "ID", "or", "name", ":", "type", "raw_string", ":", "string", ":", "param", "is_error", ":", "Whether", "to", "raise", "an", "exception", "if", "the", "project", "or", "contai...
python
train
exxeleron/qPython
qpython/qconnection.py
https://github.com/exxeleron/qPython/blob/7e64a28b1e8814a8d6b9217ce79bb8de546e62f3/qpython/qconnection.py#L248-L309
def sendSync(self, query, *parameters, **options): '''Performs a synchronous query against a q service and returns parsed data. In typical use case, `query` is the name of the function to call and `parameters` are its parameters. When `parameters` list is empty, the q...
[ "def", "sendSync", "(", "self", ",", "query", ",", "*", "parameters", ",", "*", "*", "options", ")", ":", "self", ".", "query", "(", "MessageType", ".", "SYNC", ",", "query", ",", "*", "parameters", ",", "*", "*", "options", ")", "response", "=", "...
Performs a synchronous query against a q service and returns parsed data. In typical use case, `query` is the name of the function to call and `parameters` are its parameters. When `parameters` list is empty, the query can be an arbitrary q expression (e.g. ``0 +/ til 100``)....
[ "Performs", "a", "synchronous", "query", "against", "a", "q", "service", "and", "returns", "parsed", "data", ".", "In", "typical", "use", "case", "query", "is", "the", "name", "of", "the", "function", "to", "call", "and", "parameters", "are", "its", "param...
python
train
materialsproject/pymatgen
pymatgen/io/abinit/abiobjects.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1185-L1204
def to_abivars(self): """Returns a dictionary with the abinit variables""" abivars = { "ecuteps" : self.ecuteps, "ecutwfn" : self.ecutwfn, "inclvkb" : self.inclvkb, "gwpara" : self.gwpara, "awtr" : self.awtr, "symchi" ...
[ "def", "to_abivars", "(", "self", ")", ":", "abivars", "=", "{", "\"ecuteps\"", ":", "self", ".", "ecuteps", ",", "\"ecutwfn\"", ":", "self", ".", "ecutwfn", ",", "\"inclvkb\"", ":", "self", ".", "inclvkb", ",", "\"gwpara\"", ":", "self", ".", "gwpara", ...
Returns a dictionary with the abinit variables
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables" ]
python
train
collectiveacuity/labPack
labpack/databases/sql.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/sql.py#L501-L557
def _rebuild_table(self, new_name, old_name, new_columns, old_columns): ''' a helper method for rebuilding table (by renaming & migrating) ''' # verbosity print('Rebuilding %s table in %s database' % (self.table_name, self.database_name), end='', flush=True) from sqla...
[ "def", "_rebuild_table", "(", "self", ",", "new_name", ",", "old_name", ",", "new_columns", ",", "old_columns", ")", ":", "# verbosity", "print", "(", "'Rebuilding %s table in %s database'", "%", "(", "self", ".", "table_name", ",", "self", ".", "database_name", ...
a helper method for rebuilding table (by renaming & migrating)
[ "a", "helper", "method", "for", "rebuilding", "table", "(", "by", "renaming", "&", "migrating", ")" ]
python
train
pulumi/pulumi
sdk/python/lib/pulumi/runtime/config.py
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/runtime/config.py#L34-L41
def get_config_env() -> Dict[str, Any]: """ Returns the environment map that will be used for config checking when variables aren't set. """ if 'PULUMI_CONFIG' in os.environ: env_config = os.environ['PULUMI_CONFIG'] return json.loads(env_config) return dict()
[ "def", "get_config_env", "(", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "'PULUMI_CONFIG'", "in", "os", ".", "environ", ":", "env_config", "=", "os", ".", "environ", "[", "'PULUMI_CONFIG'", "]", "return", "json", ".", "loads", "(", "env...
Returns the environment map that will be used for config checking when variables aren't set.
[ "Returns", "the", "environment", "map", "that", "will", "be", "used", "for", "config", "checking", "when", "variables", "aren", "t", "set", "." ]
python
train
jaraco/irc
irc/client_aio.py
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/client_aio.py#L160-L173
def process_data(self, new_data): """ handles incoming data from the `IrcProtocol` connection. Main data processing/routing is handled by the _process_line method, inherited from `ServerConnection` """ self.buffer.feed(new_data) # process each non-empty line afte...
[ "def", "process_data", "(", "self", ",", "new_data", ")", ":", "self", ".", "buffer", ".", "feed", "(", "new_data", ")", "# process each non-empty line after logging all lines", "for", "line", "in", "self", ".", "buffer", ":", "log", ".", "debug", "(", "\"FROM...
handles incoming data from the `IrcProtocol` connection. Main data processing/routing is handled by the _process_line method, inherited from `ServerConnection`
[ "handles", "incoming", "data", "from", "the", "IrcProtocol", "connection", ".", "Main", "data", "processing", "/", "routing", "is", "handled", "by", "the", "_process_line", "method", "inherited", "from", "ServerConnection" ]
python
train
Pylons/pyramid_retry
src/pyramid_retry/__init__.py
https://github.com/Pylons/pyramid_retry/blob/4518d0655159fcf5cf79c0d7d4c86e8315f16082/src/pyramid_retry/__init__.py#L164-L179
def is_error_retryable(request, exc): """ Return ``True`` if the exception is recognized as :term:`retryable error`. This will return ``False`` if the request is on its last attempt. This will return ``False`` if ``pyramid_retry`` is inactive for the request. """ if is_last_attempt(request...
[ "def", "is_error_retryable", "(", "request", ",", "exc", ")", ":", "if", "is_last_attempt", "(", "request", ")", ":", "return", "False", "return", "(", "isinstance", "(", "exc", ",", "RetryableException", ")", "or", "IRetryableError", ".", "providedBy", "(", ...
Return ``True`` if the exception is recognized as :term:`retryable error`. This will return ``False`` if the request is on its last attempt. This will return ``False`` if ``pyramid_retry`` is inactive for the request.
[ "Return", "True", "if", "the", "exception", "is", "recognized", "as", ":", "term", ":", "retryable", "error", "." ]
python
train
hanguokai/youku
youku/youku_comments.py
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_comments.py#L148-L159
def destroy_comment(self, access_token, comment_id): """doc: http://open.youku.com/docs/doc?id=42 """ url = 'https://openapi.youku.com/v2/comments/destroy.json' data = { 'client_id': self.client_id, 'access_token': access_token, 'comment_id': comment_i...
[ "def", "destroy_comment", "(", "self", ",", "access_token", ",", "comment_id", ")", ":", "url", "=", "'https://openapi.youku.com/v2/comments/destroy.json'", "data", "=", "{", "'client_id'", ":", "self", ".", "client_id", ",", "'access_token'", ":", "access_token", "...
doc: http://open.youku.com/docs/doc?id=42
[ "doc", ":", "http", ":", "//", "open", ".", "youku", ".", "com", "/", "docs", "/", "doc?id", "=", "42" ]
python
train
Yipit/eventlib
eventlib/util.py
https://github.com/Yipit/eventlib/blob/0cf29e5251a59fcbfc727af5f5157a3bb03832e2/eventlib/util.py#L54-L83
def get_connection(self): """Return a valid redis connection based on the following settings * `REDIS_CONNECTIONS` * `EVENTLIB_REDIS_CONFIG_NAME` The first one is a dictionary in the following format: >>> { ... 'server1': {'HOST': 'redis-server-1', 'POST': 90...
[ "def", "get_connection", "(", "self", ")", ":", "if", "self", ".", "conn", ":", "return", "self", ".", "conn", "redis_configs", "=", "getsetting", "(", "'REDIS_CONNECTIONS'", ")", "if", "redis_configs", ":", "config_name", "=", "getsetting", "(", "'EVENTLIB_RE...
Return a valid redis connection based on the following settings * `REDIS_CONNECTIONS` * `EVENTLIB_REDIS_CONFIG_NAME` The first one is a dictionary in the following format: >>> { ... 'server1': {'HOST': 'redis-server-1', 'POST': 9001}, ... 'server2': {'HOS...
[ "Return", "a", "valid", "redis", "connection", "based", "on", "the", "following", "settings" ]
python
train
secdev/scapy
scapy/packet.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L531-L546
def do_build(self): """ Create the default version of the layer :return: a string of the packet with the payload """ if not self.explicit: self = next(iter(self)) pkt = self.self_build() for t in self.post_transforms: pkt = t(pkt) ...
[ "def", "do_build", "(", "self", ")", ":", "if", "not", "self", ".", "explicit", ":", "self", "=", "next", "(", "iter", "(", "self", ")", ")", "pkt", "=", "self", ".", "self_build", "(", ")", "for", "t", "in", "self", ".", "post_transforms", ":", ...
Create the default version of the layer :return: a string of the packet with the payload
[ "Create", "the", "default", "version", "of", "the", "layer" ]
python
train
urinieto/msaf
msaf/run.py
https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/run.py#L170-L217
def run_algorithms(file_struct, boundaries_id, labels_id, config, annotator_id=0): """Runs the algorithms with the specified identifiers on the audio_file. Parameters ---------- file_struct: `msaf.io.FileStruct` Object with the file paths. boundaries_id: str Ident...
[ "def", "run_algorithms", "(", "file_struct", ",", "boundaries_id", ",", "labels_id", ",", "config", ",", "annotator_id", "=", "0", ")", ":", "# Check that there are enough audio frames", "if", "config", "[", "\"features\"", "]", ".", "features", ".", "shape", "[",...
Runs the algorithms with the specified identifiers on the audio_file. Parameters ---------- file_struct: `msaf.io.FileStruct` Object with the file paths. boundaries_id: str Identifier of the boundaries algorithm to use ("gt" for ground truth). labels_id: str Identifier of th...
[ "Runs", "the", "algorithms", "with", "the", "specified", "identifiers", "on", "the", "audio_file", "." ]
python
test
neherlab/treetime
treetime/treeanc.py
https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeanc.py#L1464-L1596
def _ml_anc_joint(self, store_compressed=True, final=True, sample_from_profile=False, debug=False, **kwargs): """ Perform joint ML reconstruction of the ancestral states. In contrast to marginal reconstructions, this only needs to compare and multiply LH and ...
[ "def", "_ml_anc_joint", "(", "self", ",", "store_compressed", "=", "True", ",", "final", "=", "True", ",", "sample_from_profile", "=", "False", ",", "debug", "=", "False", ",", "*", "*", "kwargs", ")", ":", "N_diff", "=", "0", "# number of sites differ from ...
Perform joint ML reconstruction of the ancestral states. In contrast to marginal reconstructions, this only needs to compare and multiply LH and can hence operate in log space. Parameters ---------- store_compressed : bool, default True attach a reduced representat...
[ "Perform", "joint", "ML", "reconstruction", "of", "the", "ancestral", "states", ".", "In", "contrast", "to", "marginal", "reconstructions", "this", "only", "needs", "to", "compare", "and", "multiply", "LH", "and", "can", "hence", "operate", "in", "log", "space...
python
test
DsixTools/python-smeftrunner
smeftrunner/classes.py
https://github.com/DsixTools/python-smeftrunner/blob/4c9130e53ad4f7bbb526657a82150ca9d57c4b37/smeftrunner/classes.py#L49-L103
def set_initial_wcxf(self, wc, scale_high=None, get_smpar=False): """Load the initial values for Wilson coefficients from a wcxf.WC instance. Parameters: - `scale_high`: since Wilson coefficients are dimensionless in smeftrunner but not in WCxf, the high scale in GeV has to b...
[ "def", "set_initial_wcxf", "(", "self", ",", "wc", ",", "scale_high", "=", "None", ",", "get_smpar", "=", "False", ")", ":", "import", "wcxf", "if", "wc", ".", "eft", "!=", "'SMEFT'", ":", "raise", "ValueError", "(", "\"Wilson coefficients use wrong EFT.\"", ...
Load the initial values for Wilson coefficients from a wcxf.WC instance. Parameters: - `scale_high`: since Wilson coefficients are dimensionless in smeftrunner but not in WCxf, the high scale in GeV has to be provided. If this parameter is None (default), either a previousl...
[ "Load", "the", "initial", "values", "for", "Wilson", "coefficients", "from", "a", "wcxf", ".", "WC", "instance", "." ]
python
train
keon/algorithms
algorithms/sort/bogo_sort.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/sort/bogo_sort.py#L3-L32
def bogo_sort(arr, simulation=False): """Bogo Sort Best Case Complexity: O(n) Worst Case Complexity: O(∞) Average Case Complexity: O(n(n-1)!) """ iteration = 0 if simulation: print("iteration",iteration,":",*arr) def is_sorted(arr): #check the array ...
[ "def", "bogo_sort", "(", "arr", ",", "simulation", "=", "False", ")", ":", "iteration", "=", "0", "if", "simulation", ":", "print", "(", "\"iteration\"", ",", "iteration", ",", "\":\"", ",", "*", "arr", ")", "def", "is_sorted", "(", "arr", ")", ":", ...
Bogo Sort Best Case Complexity: O(n) Worst Case Complexity: O(∞) Average Case Complexity: O(n(n-1)!)
[ "Bogo", "Sort", "Best", "Case", "Complexity", ":", "O", "(", "n", ")", "Worst", "Case", "Complexity", ":", "O", "(", "∞", ")", "Average", "Case", "Complexity", ":", "O", "(", "n", "(", "n", "-", "1", ")", "!", ")" ]
python
train
jjjake/internetarchive
internetarchive/api.py
https://github.com/jjjake/internetarchive/blob/7c0c71bfe52490927a37ade15bd09b2733fea660/internetarchive/api.py#L41-L75
def get_session(config=None, config_file=None, debug=None, http_adapter_kwargs=None): """Return a new :class:`ArchiveSession` object. The :class:`ArchiveSession` object is the main interface to the ``internetarchive`` lib. It allows you to persist certain parameters across tasks. :type config: dict ...
[ "def", "get_session", "(", "config", "=", "None", ",", "config_file", "=", "None", ",", "debug", "=", "None", ",", "http_adapter_kwargs", "=", "None", ")", ":", "return", "session", ".", "ArchiveSession", "(", "config", ",", "config_file", ",", "debug", ",...
Return a new :class:`ArchiveSession` object. The :class:`ArchiveSession` object is the main interface to the ``internetarchive`` lib. It allows you to persist certain parameters across tasks. :type config: dict :param config: (optional) A dictionary used to configure your session. :type config_fil...
[ "Return", "a", "new", ":", "class", ":", "ArchiveSession", "object", ".", "The", ":", "class", ":", "ArchiveSession", "object", "is", "the", "main", "interface", "to", "the", "internetarchive", "lib", ".", "It", "allows", "you", "to", "persist", "certain", ...
python
train
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4093-L4105
def update_email_template(self, template_id, template_dict): """ Updates a emailtemplate :param template_id: the template id :param template_dict: dict :return: dict """ return self._create_put_request( resource=EMAIL_TEMPLATES, billomat_i...
[ "def", "update_email_template", "(", "self", ",", "template_id", ",", "template_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "EMAIL_TEMPLATES", ",", "billomat_id", "=", "template_id", ",", "send_data", "=", "template_dict", ...
Updates a emailtemplate :param template_id: the template id :param template_dict: dict :return: dict
[ "Updates", "a", "emailtemplate" ]
python
train
neuropsychology/NeuroKit.py
neurokit/bio/bio_ecg.py
https://github.com/neuropsychology/NeuroKit.py/blob/c9589348fbbde0fa7e986048c48f38e6b488adfe/neurokit/bio/bio_ecg.py#L695-L775
def ecg_hrv_assessment(hrv, age=None, sex=None, position=None): """ Correct HRV features based on normative data from Voss et al. (2015). Parameters ---------- hrv : dict HRV features obtained by :function:`neurokit.ecg_hrv`. age : float Subject's age. sex : str Subj...
[ "def", "ecg_hrv_assessment", "(", "hrv", ",", "age", "=", "None", ",", "sex", "=", "None", ",", "position", "=", "None", ")", ":", "hrv_adjusted", "=", "{", "}", "if", "position", "==", "\"supine\"", ":", "if", "sex", "==", "\"m\"", ":", "if", "age",...
Correct HRV features based on normative data from Voss et al. (2015). Parameters ---------- hrv : dict HRV features obtained by :function:`neurokit.ecg_hrv`. age : float Subject's age. sex : str Subject's gender ("m" or "f"). position : str Recording position. To...
[ "Correct", "HRV", "features", "based", "on", "normative", "data", "from", "Voss", "et", "al", ".", "(", "2015", ")", "." ]
python
train
orb-framework/orb
orb/core/connection_types/sql/sqlconnection.py
https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L412-L441
def open(self, writeAccess=False): """ Returns the sqlite database for the current thread. :return <variant> || None """ host = self.database().writeHost() if writeAccess else self.database().host() pool = self.__pool[host] if self.__poolSize[host] >= self._...
[ "def", "open", "(", "self", ",", "writeAccess", "=", "False", ")", ":", "host", "=", "self", ".", "database", "(", ")", ".", "writeHost", "(", ")", "if", "writeAccess", "else", "self", ".", "database", "(", ")", ".", "host", "(", ")", "pool", "=", ...
Returns the sqlite database for the current thread. :return <variant> || None
[ "Returns", "the", "sqlite", "database", "for", "the", "current", "thread", "." ]
python
train
fastai/fastai
fastai/callbacks/tensorboard.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callbacks/tensorboard.py#L399-L402
def write(self, learn:Learner, trn_batch:Tuple, val_batch:Tuple, iteration:int, tbwriter:SummaryWriter)->None: "Writes training and validation batch images to Tensorboard." self._write_for_dstype(learn=learn, batch=val_batch, iteration=iteration, tbwriter=tbwriter, ds_type=DatasetType.Valid) sel...
[ "def", "write", "(", "self", ",", "learn", ":", "Learner", ",", "trn_batch", ":", "Tuple", ",", "val_batch", ":", "Tuple", ",", "iteration", ":", "int", ",", "tbwriter", ":", "SummaryWriter", ")", "->", "None", ":", "self", ".", "_write_for_dstype", "(",...
Writes training and validation batch images to Tensorboard.
[ "Writes", "training", "and", "validation", "batch", "images", "to", "Tensorboard", "." ]
python
train
aliyun/aliyun-odps-python-sdk
odps/df/expr/strings.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/df/expr/strings.py#L344-L354
def _startswith(expr, pat): """ Return boolean sequence or scalar indicating whether each string in the sequence or scalar starts with passed pattern. Equivalent to str.startswith(). :param expr: :param pat: Character sequence :return: sequence or scalar """ return _string_op(expr, Sta...
[ "def", "_startswith", "(", "expr", ",", "pat", ")", ":", "return", "_string_op", "(", "expr", ",", "Startswith", ",", "output_type", "=", "types", ".", "boolean", ",", "_pat", "=", "pat", ")" ]
Return boolean sequence or scalar indicating whether each string in the sequence or scalar starts with passed pattern. Equivalent to str.startswith(). :param expr: :param pat: Character sequence :return: sequence or scalar
[ "Return", "boolean", "sequence", "or", "scalar", "indicating", "whether", "each", "string", "in", "the", "sequence", "or", "scalar", "starts", "with", "passed", "pattern", ".", "Equivalent", "to", "str", ".", "startswith", "()", "." ]
python
train
RediSearch/redisearch-py
redisearch/query.py
https://github.com/RediSearch/redisearch-py/blob/f65d1dd078713cbe9b83584e86655a254d0531ab/redisearch/query.py#L189-L198
def paging(self, offset, num): """ Set the paging for the query (defaults to 0..10). - **offset**: Paging offset for the results. Defaults to 0 - **num**: How many results do we want """ self._offset = offset self._num = num return self
[ "def", "paging", "(", "self", ",", "offset", ",", "num", ")", ":", "self", ".", "_offset", "=", "offset", "self", ".", "_num", "=", "num", "return", "self" ]
Set the paging for the query (defaults to 0..10). - **offset**: Paging offset for the results. Defaults to 0 - **num**: How many results do we want
[ "Set", "the", "paging", "for", "the", "query", "(", "defaults", "to", "0", "..", "10", ")", "." ]
python
valid
Phyks/libbmc
libbmc/citations/pdf.py
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/citations/pdf.py#L90-L140
def cermine_dois(pdf_file, force_api=False, override_local=None): """ Run `CERMINE <https://github.com/CeON/CERMINE>`_ to extract DOIs of cited \ papers from a PDF file. .. note:: Try to use a local CERMINE JAR file, and falls back to using the API. \ JAR file is expect...
[ "def", "cermine_dois", "(", "pdf_file", ",", "force_api", "=", "False", ",", "override_local", "=", "None", ")", ":", "# TODO:", "# * Do not convert to plain text, but use the extra metadata from", "# CERMINE", "# Call CERMINE on the PDF file", "cermine_output", "=", ...
Run `CERMINE <https://github.com/CeON/CERMINE>`_ to extract DOIs of cited \ papers from a PDF file. .. note:: Try to use a local CERMINE JAR file, and falls back to using the API. \ JAR file is expected to be found in \ ``libbmc/external/cermine.jar``. You can o...
[ "Run", "CERMINE", "<https", ":", "//", "github", ".", "com", "/", "CeON", "/", "CERMINE", ">", "_", "to", "extract", "DOIs", "of", "cited", "\\", "papers", "from", "a", "PDF", "file", "." ]
python
train
Esri/ArcREST
src/arcrest/ags/_geocodeservice.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_geocodeservice.py#L422-L491
def geocodeAddresses(self, addresses, outSR=4326, sourceCountry=None, category=None): """ The geocodeAddresses operation is performed on a Geocode Service resource. The result of this operation is...
[ "def", "geocodeAddresses", "(", "self", ",", "addresses", ",", "outSR", "=", "4326", ",", "sourceCountry", "=", "None", ",", "category", "=", "None", ")", ":", "params", "=", "{", "\"f\"", ":", "\"json\"", "}", "url", "=", "self", ".", "_url", "+", "...
The geocodeAddresses operation is performed on a Geocode Service resource. The result of this operation is a resource representing the list of geocoded addresses. This resource provides information about the addresses including the address, location, score, and other geocode service-spec...
[ "The", "geocodeAddresses", "operation", "is", "performed", "on", "a", "Geocode", "Service", "resource", ".", "The", "result", "of", "this", "operation", "is", "a", "resource", "representing", "the", "list", "of", "geocoded", "addresses", ".", "This", "resource",...
python
train
intuition-io/insights
insights/plugins/mobile.py
https://github.com/intuition-io/insights/blob/a4eae53a1886164db96751d2b0964aa2acb7c2d7/insights/plugins/mobile.py#L89-L95
def _watchdog(self): ''' Notifications are stopped if * The last one was too close * We reach a rated limit ''' too_early = (time.time() - self._last_time < self._min_interval) too_much = (self._count >= self._rate_limit) return (False if (too_early or too_much) else ...
[ "def", "_watchdog", "(", "self", ")", ":", "too_early", "=", "(", "time", ".", "time", "(", ")", "-", "self", ".", "_last_time", "<", "self", ".", "_min_interval", ")", "too_much", "=", "(", "self", ".", "_count", ">=", "self", ".", "_rate_limit", ")...
Notifications are stopped if * The last one was too close * We reach a rated limit
[ "Notifications", "are", "stopped", "if", "*", "The", "last", "one", "was", "too", "close", "*", "We", "reach", "a", "rated", "limit" ]
python
train
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7409-L7413
def xpointerEval(self, str): """Evaluate the XPath Location Path in the given context. """ ret = libxml2mod.xmlXPtrEval(str, self._o) if ret is None:raise treeError('xmlXPtrEval() failed') return xpathObjectRet(ret)
[ "def", "xpointerEval", "(", "self", ",", "str", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPtrEval", "(", "str", ",", "self", ".", "_o", ")", "if", "ret", "is", "None", ":", "raise", "treeError", "(", "'xmlXPtrEval() failed'", ")", "return", "xpathObj...
Evaluate the XPath Location Path in the given context.
[ "Evaluate", "the", "XPath", "Location", "Path", "in", "the", "given", "context", "." ]
python
train
ministryofjustice/django-form-error-reporting
form_error_reporting.py
https://github.com/ministryofjustice/django-form-error-reporting/blob/2d08dd5cc4321e1abf49241c515ccd7050d9f828/form_error_reporting.py#L44-L54
def is_valid(self): """ Error reporting is triggered when a form is checked for validity """ is_valid = super(GAErrorReportingMixin, self).is_valid() if self.is_bound and not is_valid: try: self.report_errors_to_ga(self.errors) except: # n...
[ "def", "is_valid", "(", "self", ")", ":", "is_valid", "=", "super", "(", "GAErrorReportingMixin", ",", "self", ")", ".", "is_valid", "(", ")", "if", "self", ".", "is_bound", "and", "not", "is_valid", ":", "try", ":", "self", ".", "report_errors_to_ga", "...
Error reporting is triggered when a form is checked for validity
[ "Error", "reporting", "is", "triggered", "when", "a", "form", "is", "checked", "for", "validity" ]
python
train
gwastro/pycbc
pycbc/events/triggers.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/events/triggers.py#L112-L235
def loudest_triggers_from_cli(opts, coinc_parameters=None, sngl_parameters=None, bank_parameters=None): """ Parses the CLI options related to find the loudest coincident or single detector triggers. Parameters ---------- opts : object Result of parsing the CLI ...
[ "def", "loudest_triggers_from_cli", "(", "opts", ",", "coinc_parameters", "=", "None", ",", "sngl_parameters", "=", "None", ",", "bank_parameters", "=", "None", ")", ":", "# list to hold trigger data", "bin_results", "=", "[", "]", "# list of IFOs", "ifos", "=", "...
Parses the CLI options related to find the loudest coincident or single detector triggers. Parameters ---------- opts : object Result of parsing the CLI with OptionParser. coinc_parameters : list List of datasets in statmap file to retrieve. sngl_parameters : list List o...
[ "Parses", "the", "CLI", "options", "related", "to", "find", "the", "loudest", "coincident", "or", "single", "detector", "triggers", "." ]
python
train
tobami/littlechef
littlechef/lib.py
https://github.com/tobami/littlechef/blob/aab8c94081b38100a69cc100bc4278ae7419c58e/littlechef/lib.py#L467-L479
def get_plugins(): """Gets available plugins by looking into the plugins/ directory""" if os.path.exists('plugins'): for filename in sorted([f for f in os.listdir('plugins') if not os.path.isdir(f) and f.endswith(".py")]): plugin_name = filename[:-3] try: ...
[ "def", "get_plugins", "(", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "'plugins'", ")", ":", "for", "filename", "in", "sorted", "(", "[", "f", "for", "f", "in", "os", ".", "listdir", "(", "'plugins'", ")", "if", "not", "os", ".", "pat...
Gets available plugins by looking into the plugins/ directory
[ "Gets", "available", "plugins", "by", "looking", "into", "the", "plugins", "/", "directory" ]
python
train
marshmallow-code/apispec
src/apispec/core.py
https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/core.py#L113-L147
def schema(self, name, component=None, **kwargs): """Add a new schema to the spec. :param str name: identifier by which schema may be referenced. :param dict component: schema definition. .. note:: If you are using `apispec.ext.marshmallow`, you can pass fields' metadata a...
[ "def", "schema", "(", "self", ",", "name", ",", "component", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "name", "in", "self", ".", "_schemas", ":", "raise", "DuplicateComponentNameError", "(", "'Another schema with name \"{}\" is already registered.'", ...
Add a new schema to the spec. :param str name: identifier by which schema may be referenced. :param dict component: schema definition. .. note:: If you are using `apispec.ext.marshmallow`, you can pass fields' metadata as additional keyword arguments. For ...
[ "Add", "a", "new", "schema", "to", "the", "spec", "." ]
python
train
honzamach/pynspect
pynspect/rules.py
https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/rules.py#L583-L598
def traverse(self, traverser, **kwargs): """ Implementation of mandatory interface for traversing the whole rule tree. This method will call the implementation of :py:func:`pynspect.rules.RuleTreeTraverser.function` method with reference to ``self`` instance as first argument and with th...
[ "def", "traverse", "(", "self", ",", "traverser", ",", "*", "*", "kwargs", ")", ":", "atr", "=", "[", "]", "for", "arg", "in", "self", ".", "args", ":", "atr", ".", "append", "(", "arg", ".", "traverse", "(", "traverser", ",", "*", "*", "kwargs",...
Implementation of mandatory interface for traversing the whole rule tree. This method will call the implementation of :py:func:`pynspect.rules.RuleTreeTraverser.function` method with reference to ``self`` instance as first argument and with the result of traversing left subtree as second argumen...
[ "Implementation", "of", "mandatory", "interface", "for", "traversing", "the", "whole", "rule", "tree", ".", "This", "method", "will", "call", "the", "implementation", "of", ":", "py", ":", "func", ":", "pynspect", ".", "rules", ".", "RuleTreeTraverser", ".", ...
python
train
weld-project/weld
python/grizzly/grizzly/groupbyweld.py
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L100-L129
def sort_values(self, by, ascending=True): """Summary Returns: TYPE: Description """ if len(self.column_types) == 1: vec_type = [WeldVec(self.column_types[0])] else: vec_type = [WeldVec(WeldStruct(self.column_types))] if len(self.colu...
[ "def", "sort_values", "(", "self", ",", "by", ",", "ascending", "=", "True", ")", ":", "if", "len", "(", "self", ".", "column_types", ")", "==", "1", ":", "vec_type", "=", "[", "WeldVec", "(", "self", ".", "column_types", "[", "0", "]", ")", "]", ...
Summary Returns: TYPE: Description
[ "Summary" ]
python
train
Gorialis/jishaku
jishaku/cog.py
https://github.com/Gorialis/jishaku/blob/fc7c479b9d510ede189a929c8aa6f7c8ef7f9a6e/jishaku/cog.py#L334-L344
async def jsk_in(self, ctx: commands.Context, channel: discord.TextChannel, *, command_string: str): """ Run a command as if it were in a different channel. """ alt_ctx = await copy_context_with(ctx, channel=channel, content=ctx.prefix + command_string) if alt_ctx.command is No...
[ "async", "def", "jsk_in", "(", "self", ",", "ctx", ":", "commands", ".", "Context", ",", "channel", ":", "discord", ".", "TextChannel", ",", "*", ",", "command_string", ":", "str", ")", ":", "alt_ctx", "=", "await", "copy_context_with", "(", "ctx", ",", ...
Run a command as if it were in a different channel.
[ "Run", "a", "command", "as", "if", "it", "were", "in", "a", "different", "channel", "." ]
python
train
OSSOS/MOP
src/ossos/core/ossos/daophot.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/daophot.py#L19-L158
def phot(fits_filename, x_in, y_in, aperture=15, sky=20, swidth=10, apcor=0.3, maxcount=30000.0, exptime=1.0, zmag=None, extno=0, centroid=True): """ Compute the centroids and magnitudes of a bunch sources on fits image. :rtype : astropy.table.Table :param fits_filename: Name of fits image to...
[ "def", "phot", "(", "fits_filename", ",", "x_in", ",", "y_in", ",", "aperture", "=", "15", ",", "sky", "=", "20", ",", "swidth", "=", "10", ",", "apcor", "=", "0.3", ",", "maxcount", "=", "30000.0", ",", "exptime", "=", "1.0", ",", "zmag", "=", "...
Compute the centroids and magnitudes of a bunch sources on fits image. :rtype : astropy.table.Table :param fits_filename: Name of fits image to measure source photometry on. :type fits_filename: str :param x_in: x location of source to measure :type x_in: float, numpy.array :param y_in: y loca...
[ "Compute", "the", "centroids", "and", "magnitudes", "of", "a", "bunch", "sources", "on", "fits", "image", "." ]
python
train
gebn/nibble
nibble/__main__.py
https://github.com/gebn/nibble/blob/e82a2c43509ed38f3d039040591cc630fa676cb0/nibble/__main__.py#L14-L38
def _parse_args(args): """ Interpret command line arguments. :param args: `sys.argv` :return: The populated argparse namespace. """ parser = argparse.ArgumentParser(prog='nibble', description='Speed, distance and time ' ...
[ "def", "_parse_args", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'nibble'", ",", "description", "=", "'Speed, distance and time '", "'calculations around '", "'quantities of digital '", "'information.'", ")", "parser", ...
Interpret command line arguments. :param args: `sys.argv` :return: The populated argparse namespace.
[ "Interpret", "command", "line", "arguments", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvc.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvc.py#L99-L121
def object_emitter(target, source, env, parent_emitter): """Sets up the PCH dependencies for an object file.""" validate_vars(env) parent_emitter(target, source, env) # Add a dependency, but only if the target (e.g. 'Source1.obj') # doesn't correspond to the pre-compiled header ('Source1.pch'). ...
[ "def", "object_emitter", "(", "target", ",", "source", ",", "env", ",", "parent_emitter", ")", ":", "validate_vars", "(", "env", ")", "parent_emitter", "(", "target", ",", "source", ",", "env", ")", "# Add a dependency, but only if the target (e.g. 'Source1.obj')", ...
Sets up the PCH dependencies for an object file.
[ "Sets", "up", "the", "PCH", "dependencies", "for", "an", "object", "file", "." ]
python
train
hydpy-dev/hydpy
hydpy/core/filetools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/filetools.py#L234-L270
def availabledirs(self) -> Folder2Path: """Names and paths of the available working directories. Available working directories are those beeing stored in the base directory of the respective |FileManager| subclass. Folders with names starting with an underscore are ignored (use ...
[ "def", "availabledirs", "(", "self", ")", "->", "Folder2Path", ":", "directories", "=", "Folder2Path", "(", ")", "for", "directory", "in", "os", ".", "listdir", "(", "self", ".", "basepath", ")", ":", "if", "not", "directory", ".", "startswith", "(", "'_...
Names and paths of the available working directories. Available working directories are those beeing stored in the base directory of the respective |FileManager| subclass. Folders with names starting with an underscore are ignored (use this for directories handling additional data files...
[ "Names", "and", "paths", "of", "the", "available", "working", "directories", "." ]
python
train
Opentrons/opentrons
api/src/opentrons/protocol_api/labware.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/protocol_api/labware.py#L294-L302
def well(self, idx) -> Well: """Deprecated---use result of `wells` or `wells_by_index`""" if isinstance(idx, int): res = self._wells[idx] elif isinstance(idx, str): res = self.wells_by_index()[idx] else: res = NotImplemented return res
[ "def", "well", "(", "self", ",", "idx", ")", "->", "Well", ":", "if", "isinstance", "(", "idx", ",", "int", ")", ":", "res", "=", "self", ".", "_wells", "[", "idx", "]", "elif", "isinstance", "(", "idx", ",", "str", ")", ":", "res", "=", "self"...
Deprecated---use result of `wells` or `wells_by_index`
[ "Deprecated", "---", "use", "result", "of", "wells", "or", "wells_by_index" ]
python
train
bookieio/breadability
breadability/readable.py
https://github.com/bookieio/breadability/blob/95a364c43b00baf6664bea1997a7310827fb1ee9/breadability/readable.py#L410-L437
def _readable(self): """The readable parsed article""" if not self.candidates: logger.info("No candidates found in document.") return self._handle_no_candidates() # right now we return the highest scoring candidate content best_candidates = sorted( (c...
[ "def", "_readable", "(", "self", ")", ":", "if", "not", "self", ".", "candidates", ":", "logger", ".", "info", "(", "\"No candidates found in document.\"", ")", "return", "self", ".", "_handle_no_candidates", "(", ")", "# right now we return the highest scoring candid...
The readable parsed article
[ "The", "readable", "parsed", "article" ]
python
train
RLBot/RLBot
src/main/python/rlbot/gui/qt_root.py
https://github.com/RLBot/RLBot/blob/3f9b6bec8b9baf4dcfff0f6cf3103c8744ac6234/src/main/python/rlbot/gui/qt_root.py#L537-L547
def enable_disable_on_bot_select_deselect(self): """ Disables the botconfig groupbox and minus buttons when no bot is selected :return: """ if not self.blue_listwidget.selectedItems() and not self.orange_listwidget.selectedItems(): self.bot_config_groupbox.setDisabled...
[ "def", "enable_disable_on_bot_select_deselect", "(", "self", ")", ":", "if", "not", "self", ".", "blue_listwidget", ".", "selectedItems", "(", ")", "and", "not", "self", ".", "orange_listwidget", ".", "selectedItems", "(", ")", ":", "self", ".", "bot_config_grou...
Disables the botconfig groupbox and minus buttons when no bot is selected :return:
[ "Disables", "the", "botconfig", "groupbox", "and", "minus", "buttons", "when", "no", "bot", "is", "selected", ":", "return", ":" ]
python
train
urbn/Caesium
caesium/document.py
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/document.py#L89-L118
def publish_for_collection(self, collection_name): """ Run the publishing operations for a given collection :param str collection_name: """ self.revisions = BaseAsyncMotorDocument("%s_revisions" % collection_name, self.settings) changes = yield self.__get_pending_revisi...
[ "def", "publish_for_collection", "(", "self", ",", "collection_name", ")", ":", "self", ".", "revisions", "=", "BaseAsyncMotorDocument", "(", "\"%s_revisions\"", "%", "collection_name", ",", "self", ".", "settings", ")", "changes", "=", "yield", "self", ".", "__...
Run the publishing operations for a given collection :param str collection_name:
[ "Run", "the", "publishing", "operations", "for", "a", "given", "collection" ]
python
train
blockstack/blockstack-core
blockstack/lib/config.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/config.py#L930-L946
def get_epoch_number( block_height ): """ Which epoch are we in? Return integer (>=0) on success """ global EPOCHS if block_height <= EPOCHS[0]['end_block']: return 0 for i in xrange(1, len(EPOCHS)): if EPOCHS[i-1]['end_block'] < block_height and (block_height <= EPOCHS[i][...
[ "def", "get_epoch_number", "(", "block_height", ")", ":", "global", "EPOCHS", "if", "block_height", "<=", "EPOCHS", "[", "0", "]", "[", "'end_block'", "]", ":", "return", "0", "for", "i", "in", "xrange", "(", "1", ",", "len", "(", "EPOCHS", ")", ")", ...
Which epoch are we in? Return integer (>=0) on success
[ "Which", "epoch", "are", "we", "in?", "Return", "integer", "(", ">", "=", "0", ")", "on", "success" ]
python
train
mbedmicro/pyOCD
pyocd/coresight/cortex_m.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/coresight/cortex_m.py#L794-L824
def _get_actual_reset_type(self, reset_type): """! @brief Determine the reset type to use given defaults and passed in type.""" # Default to reset_type session option if reset_type parameter is None. If the session # option isn't set, then use the core's default reset type. if r...
[ "def", "_get_actual_reset_type", "(", "self", ",", "reset_type", ")", ":", "# Default to reset_type session option if reset_type parameter is None. If the session", "# option isn't set, then use the core's default reset type.", "if", "reset_type", "is", "None", ":", "if", "'reset_typ...
! @brief Determine the reset type to use given defaults and passed in type.
[ "!" ]
python
train
blockstack/blockstack-core
blockstack/lib/nameset/namedb.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L417-L447
def load_import_keychain( cls, working_dir, namespace_id ): """ Get an import keychain from disk. Return None if it doesn't exist. """ # do we have a cached one on disk? cached_keychain = os.path.join(working_dir, "%s.keychain" % namespace_id) if os.path.ex...
[ "def", "load_import_keychain", "(", "cls", ",", "working_dir", ",", "namespace_id", ")", ":", "# do we have a cached one on disk?", "cached_keychain", "=", "os", ".", "path", ".", "join", "(", "working_dir", ",", "\"%s.keychain\"", "%", "namespace_id", ")", "if", ...
Get an import keychain from disk. Return None if it doesn't exist.
[ "Get", "an", "import", "keychain", "from", "disk", ".", "Return", "None", "if", "it", "doesn", "t", "exist", "." ]
python
train
project-rig/rig
rig/place_and_route/utils.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/place_and_route/utils.py#L18-L116
def build_machine(system_info, core_resource=Cores, sdram_resource=SDRAM, sram_resource=SRAM): """Build a :py:class:`~rig.place_and_route.Machine` object from a :py:class:`~rig.machine_control.machine_controller.SystemInfo` object. .. note:: Lin...
[ "def", "build_machine", "(", "system_info", ",", "core_resource", "=", "Cores", ",", "sdram_resource", "=", "SDRAM", ",", "sram_resource", "=", "SRAM", ")", ":", "try", ":", "max_cores", "=", "max", "(", "c", ".", "num_cores", "for", "c", "in", "itervalues...
Build a :py:class:`~rig.place_and_route.Machine` object from a :py:class:`~rig.machine_control.machine_controller.SystemInfo` object. .. note:: Links are tested by sending a 'PEEK' command down the link which checks to see if the remote device responds correctly. If the link is dead, no...
[ "Build", "a", ":", "py", ":", "class", ":", "~rig", ".", "place_and_route", ".", "Machine", "object", "from", "a", ":", "py", ":", "class", ":", "~rig", ".", "machine_control", ".", "machine_controller", ".", "SystemInfo", "object", "." ]
python
train
phoebe-project/phoebe2
phoebe/constraints/builtin.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/constraints/builtin.py#L145-L163
def requiv_to_pot_contact(requiv, q, sma, compno=1): """ :param requiv: user-provided equivalent radius :param q: mass ratio :param sma: semi-major axis (d = sma because we explicitly assume circular orbits for contacts) :param compno: 1 for primary, 2 for secondary :return: potential and fillou...
[ "def", "requiv_to_pot_contact", "(", "requiv", ",", "q", ",", "sma", ",", "compno", "=", "1", ")", ":", "logger", ".", "debug", "(", "\"requiv_to_pot_contact(requiv={}, q={}, sma={}, compno={})\"", ".", "format", "(", "requiv", ",", "q", ",", "sma", ",", "comp...
:param requiv: user-provided equivalent radius :param q: mass ratio :param sma: semi-major axis (d = sma because we explicitly assume circular orbits for contacts) :param compno: 1 for primary, 2 for secondary :return: potential and fillout factor
[ ":", "param", "requiv", ":", "user", "-", "provided", "equivalent", "radius", ":", "param", "q", ":", "mass", "ratio", ":", "param", "sma", ":", "semi", "-", "major", "axis", "(", "d", "=", "sma", "because", "we", "explicitly", "assume", "circular", "o...
python
train
yamcs/yamcs-python
yamcs-client/yamcs/tmtc/client.py
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L526-L552
def list_alarms(self, start=None, stop=None): """ Lists the active alarms. Remark that this does not query the archive. Only active alarms on the current processor are returned. :param ~datetime.datetime start: Minimum trigger time of the returned alarms (inclusive) :pa...
[ "def", "list_alarms", "(", "self", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "# TODO implement continuation token on server", "params", "=", "{", "'order'", ":", "'asc'", "}", "if", "start", "is", "not", "None", ":", "params", "[", "'s...
Lists the active alarms. Remark that this does not query the archive. Only active alarms on the current processor are returned. :param ~datetime.datetime start: Minimum trigger time of the returned alarms (inclusive) :param ~datetime.datetime stop: Maximum trigger time of the returned ...
[ "Lists", "the", "active", "alarms", "." ]
python
train
spyder-ide/spyder
spyder/widgets/calltip.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L144-L176
def eventFilter(self, obj, event): """ Reimplemented to hide on certain key presses and on text edit focus changes. """ if obj == self._text_edit: etype = event.type() if etype == QEvent.KeyPress: key = event.key() cursor = sel...
[ "def", "eventFilter", "(", "self", ",", "obj", ",", "event", ")", ":", "if", "obj", "==", "self", ".", "_text_edit", ":", "etype", "=", "event", ".", "type", "(", ")", "if", "etype", "==", "QEvent", ".", "KeyPress", ":", "key", "=", "event", ".", ...
Reimplemented to hide on certain key presses and on text edit focus changes.
[ "Reimplemented", "to", "hide", "on", "certain", "key", "presses", "and", "on", "text", "edit", "focus", "changes", "." ]
python
train
mattja/distob
distob/arrays.py
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L673-L720
def _tosubslices(self, sl): """Maps a slice object for whole array to slice objects for subarrays. Returns pair (ss, ms) where ss is a list of subarrays and ms is a list giving the slice object that should be applied to each subarray. """ N = self.shape[self._distaxis] st...
[ "def", "_tosubslices", "(", "self", ",", "sl", ")", ":", "N", "=", "self", ".", "shape", "[", "self", ".", "_distaxis", "]", "start", ",", "stop", ",", "step", "=", "sl", ".", "start", ",", "sl", ".", "stop", ",", "sl", ".", "step", "if", "step...
Maps a slice object for whole array to slice objects for subarrays. Returns pair (ss, ms) where ss is a list of subarrays and ms is a list giving the slice object that should be applied to each subarray.
[ "Maps", "a", "slice", "object", "for", "whole", "array", "to", "slice", "objects", "for", "subarrays", ".", "Returns", "pair", "(", "ss", "ms", ")", "where", "ss", "is", "a", "list", "of", "subarrays", "and", "ms", "is", "a", "list", "giving", "the", ...
python
valid
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L550-L563
def _audio_segment_extractor(self, audio_abs_path, segment_abs_path, starting_second, duration): """ Parameters ----------- audio_abs_path : str segment_abs_path : str starting_second : int duration : int """ subpr...
[ "def", "_audio_segment_extractor", "(", "self", ",", "audio_abs_path", ",", "segment_abs_path", ",", "starting_second", ",", "duration", ")", ":", "subprocess", ".", "Popen", "(", "[", "\"sox\"", ",", "str", "(", "audio_abs_path", ")", ",", "str", "(", "segmen...
Parameters ----------- audio_abs_path : str segment_abs_path : str starting_second : int duration : int
[ "Parameters", "-----------", "audio_abs_path", ":", "str", "segment_abs_path", ":", "str", "starting_second", ":", "int", "duration", ":", "int" ]
python
train
sernst/cauldron
cauldron/cli/threads.py
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/cli/threads.py#L85-L102
def abort_running(self) -> bool: """ Executes a hard abort by shutting down the event loop in this thread in which the running command was operating. This is carried out using the asyncio library to prevent the stopped execution from destabilizing the Python environment. ...
[ "def", "abort_running", "(", "self", ")", "->", "bool", ":", "if", "not", "self", ".", "_loop", ":", "return", "False", "try", ":", "self", ".", "_loop", ".", "stop", "(", ")", "return", "True", "except", "Exception", ":", "return", "False", "finally",...
Executes a hard abort by shutting down the event loop in this thread in which the running command was operating. This is carried out using the asyncio library to prevent the stopped execution from destabilizing the Python environment.
[ "Executes", "a", "hard", "abort", "by", "shutting", "down", "the", "event", "loop", "in", "this", "thread", "in", "which", "the", "running", "command", "was", "operating", ".", "This", "is", "carried", "out", "using", "the", "asyncio", "library", "to", "pr...
python
train
kipe/enocean
enocean/protocol/packet.py
https://github.com/kipe/enocean/blob/99fa03f47004eef74c7987545c33ecd01af0de07/enocean/protocol/packet.py#L256-L262
def select_eep(self, rorg_func, rorg_type, direction=None, command=None): ''' Set EEP based on FUNC and TYPE ''' # set EEP profile self.rorg_func = rorg_func self.rorg_type = rorg_type self._profile = self.eep.find_profile(self._bit_data, self.rorg, rorg_func, rorg_type, directio...
[ "def", "select_eep", "(", "self", ",", "rorg_func", ",", "rorg_type", ",", "direction", "=", "None", ",", "command", "=", "None", ")", ":", "# set EEP profile", "self", ".", "rorg_func", "=", "rorg_func", "self", ".", "rorg_type", "=", "rorg_type", "self", ...
Set EEP based on FUNC and TYPE
[ "Set", "EEP", "based", "on", "FUNC", "and", "TYPE" ]
python
train
ekmmetering/ekmmeters
ekmmeters.py
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2576-L2653
def setHolidayDates(self, cmd_dict=None, password="00000000"): """ Serial call to set holiday list. If a buffer dictionary is not supplied, the method will use the class object buffer populated with assignHolidayDate. Args: cmd_dict (dict): Optional dictionary of holidays. ...
[ "def", "setHolidayDates", "(", "self", ",", "cmd_dict", "=", "None", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "self", ".", "setContext", "(", "\"setHolidayDates\"", ")", "if", "not", "cmd_dict", ":", "cmd_dict", "=", "self", ...
Serial call to set holiday list. If a buffer dictionary is not supplied, the method will use the class object buffer populated with assignHolidayDate. Args: cmd_dict (dict): Optional dictionary of holidays. password (str): Optional password. Returns: ...
[ "Serial", "call", "to", "set", "holiday", "list", "." ]
python
test
ladybug-tools/ladybug
ladybug/sunpath.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L615-L666
def _analemma_suns(self): """Calculate times that should be used for drawing analemma_curves. Returns: A list of list of analemma suns. """ for h in xrange(0, 24): if self._analemma_position(h) < 0: continue elif self._analemma_positio...
[ "def", "_analemma_suns", "(", "self", ")", ":", "for", "h", "in", "xrange", "(", "0", ",", "24", ")", ":", "if", "self", ".", "_analemma_position", "(", "h", ")", "<", "0", ":", "continue", "elif", "self", ".", "_analemma_position", "(", "h", ")", ...
Calculate times that should be used for drawing analemma_curves. Returns: A list of list of analemma suns.
[ "Calculate", "times", "that", "should", "be", "used", "for", "drawing", "analemma_curves", "." ]
python
train
basho/riak-python-client
commands.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/commands.py#L372-L405
def _format_python2_or_3(self): """ Change the PB files to use full pathnames for Python 3.x and modify the metaclasses to be version agnostic """ pb_files = set() with open(self.source, 'r', buffering=1) as csvfile: reader = csv.reader(csvfile) fo...
[ "def", "_format_python2_or_3", "(", "self", ")", ":", "pb_files", "=", "set", "(", ")", "with", "open", "(", "self", ".", "source", ",", "'r'", ",", "buffering", "=", "1", ")", "as", "csvfile", ":", "reader", "=", "csv", ".", "reader", "(", "csvfile"...
Change the PB files to use full pathnames for Python 3.x and modify the metaclasses to be version agnostic
[ "Change", "the", "PB", "files", "to", "use", "full", "pathnames", "for", "Python", "3", ".", "x", "and", "modify", "the", "metaclasses", "to", "be", "version", "agnostic" ]
python
train
3DLIRIOUS/MeshLabXML
meshlabxml/create.py
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L63-L131
def cylinder(script, up='z', height=1.0, radius=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, center=False, cir_segments=32, color=None): """Create a cylinder or cone primitive. Usage is based on OpenSCAD. # height = height of the cylinder # radiu...
[ "def", "cylinder", "(", "script", ",", "up", "=", "'z'", ",", "height", "=", "1.0", ",", "radius", "=", "None", ",", "radius1", "=", "None", ",", "radius2", "=", "None", ",", "diameter", "=", "None", ",", "diameter1", "=", "None", ",", "diameter2", ...
Create a cylinder or cone primitive. Usage is based on OpenSCAD. # height = height of the cylinder # radius1 = radius of the cone on bottom end # radius2 = radius of the cone on top end # center = If true will center the height of the cone/cylinder around # the origin. Default is false, placing the ...
[ "Create", "a", "cylinder", "or", "cone", "primitive", ".", "Usage", "is", "based", "on", "OpenSCAD", ".", "#", "height", "=", "height", "of", "the", "cylinder", "#", "radius1", "=", "radius", "of", "the", "cone", "on", "bottom", "end", "#", "radius2", ...
python
test
DarkEnergySurvey/ugali
ugali/utils/fileio.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/fileio.py#L70-L85
def add_column(filename,column,formula,force=False): """ Add a column to a FITS file. ADW: Could this be replaced by a ftool? """ columns = parse_formula(formula) logger.info("Running file: %s"%filename) logger.debug(" Reading columns: %s"%columns) data = fitsio.read(filename,columns=colum...
[ "def", "add_column", "(", "filename", ",", "column", ",", "formula", ",", "force", "=", "False", ")", ":", "columns", "=", "parse_formula", "(", "formula", ")", "logger", ".", "info", "(", "\"Running file: %s\"", "%", "filename", ")", "logger", ".", "debug...
Add a column to a FITS file. ADW: Could this be replaced by a ftool?
[ "Add", "a", "column", "to", "a", "FITS", "file", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/rl/dopamine_connector.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L257-L265
def add(self, observation, action, reward, terminal, *args): """Append artificial_done to *args and run parent method.""" # If this will be a problem for maintenance, we could probably override # DQNAgent.add() method instead. artificial_done = self._artificial_done and terminal args = list(args) ...
[ "def", "add", "(", "self", ",", "observation", ",", "action", ",", "reward", ",", "terminal", ",", "*", "args", ")", ":", "# If this will be a problem for maintenance, we could probably override", "# DQNAgent.add() method instead.", "artificial_done", "=", "self", ".", ...
Append artificial_done to *args and run parent method.
[ "Append", "artificial_done", "to", "*", "args", "and", "run", "parent", "method", "." ]
python
train
saltstack/salt
salt/proxy/napalm.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/napalm.py#L202-L208
def init(opts): ''' Opens the connection with the network device. ''' NETWORK_DEVICE.update(salt.utils.napalm.get_device(opts)) DETAILS['initialized'] = True return True
[ "def", "init", "(", "opts", ")", ":", "NETWORK_DEVICE", ".", "update", "(", "salt", ".", "utils", ".", "napalm", ".", "get_device", "(", "opts", ")", ")", "DETAILS", "[", "'initialized'", "]", "=", "True", "return", "True" ]
Opens the connection with the network device.
[ "Opens", "the", "connection", "with", "the", "network", "device", "." ]
python
train
kennethreitz/requests-html
requests_html.py
https://github.com/kennethreitz/requests-html/blob/b59a9f2fb9333d7d467154a0fd82978efdb9d23b/requests_html.py#L144-L151
def pq(self) -> PyQuery: """`PyQuery <https://pythonhosted.org/pyquery/>`_ representation of the :class:`Element <Element>` or :class:`HTML <HTML>`. """ if self._pq is None: self._pq = PyQuery(self.lxml) return self._pq
[ "def", "pq", "(", "self", ")", "->", "PyQuery", ":", "if", "self", ".", "_pq", "is", "None", ":", "self", ".", "_pq", "=", "PyQuery", "(", "self", ".", "lxml", ")", "return", "self", ".", "_pq" ]
`PyQuery <https://pythonhosted.org/pyquery/>`_ representation of the :class:`Element <Element>` or :class:`HTML <HTML>`.
[ "PyQuery", "<https", ":", "//", "pythonhosted", ".", "org", "/", "pyquery", "/", ">", "_", "representation", "of", "the", ":", "class", ":", "Element", "<Element", ">", "or", ":", "class", ":", "HTML", "<HTML", ">", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/billing/apis/default_api.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/billing/apis/default_api.py#L519-L538
def get_service_packages(self, **kwargs): # noqa: E501 """Get all service packages. # noqa: E501 Get information of all service packages for the currently authenticated commercial account. The response is returned in descending order by service package created timestamp, listing first the pending ser...
[ "def", "get_service_packages", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'asynchronous'", ")", ":", "return", "self", ".", "get_service_package...
Get all service packages. # noqa: E501 Get information of all service packages for the currently authenticated commercial account. The response is returned in descending order by service package created timestamp, listing first the pending service package, then the active service package and finally the previ...
[ "Get", "all", "service", "packages", ".", "#", "noqa", ":", "E501" ]
python
train
mar10/wsgidav
wsgidav/wsgidav_app.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/wsgidav_app.py#L344-L365
def resolve_provider(self, path): """Get the registered DAVProvider for a given path. Returns: tuple: (share, provider) """ # Find DAV provider that matches the share share = None lower_path = path.lower() for r in self.sorted_share_list: ...
[ "def", "resolve_provider", "(", "self", ",", "path", ")", ":", "# Find DAV provider that matches the share", "share", "=", "None", "lower_path", "=", "path", ".", "lower", "(", ")", "for", "r", "in", "self", ".", "sorted_share_list", ":", "# @@: Case sensitivity s...
Get the registered DAVProvider for a given path. Returns: tuple: (share, provider)
[ "Get", "the", "registered", "DAVProvider", "for", "a", "given", "path", "." ]
python
valid
edx/ease
ease/feature_extractor.py
https://github.com/edx/ease/blob/a7890ed403da94d03726b0639cd8ebda45af6bbb/ease/feature_extractor.py#L161-L174
def gen_bag_feats(self, e_set): """ Generates bag of words features from an input essay set and trained FeatureExtractor Generally called by gen_feats Returns an array of features e_set - EssaySet object """ if(hasattr(self, '_stem_dict')): sfeats = se...
[ "def", "gen_bag_feats", "(", "self", ",", "e_set", ")", ":", "if", "(", "hasattr", "(", "self", ",", "'_stem_dict'", ")", ")", ":", "sfeats", "=", "self", ".", "_stem_dict", ".", "transform", "(", "e_set", ".", "_clean_stem_text", ")", "nfeats", "=", "...
Generates bag of words features from an input essay set and trained FeatureExtractor Generally called by gen_feats Returns an array of features e_set - EssaySet object
[ "Generates", "bag", "of", "words", "features", "from", "an", "input", "essay", "set", "and", "trained", "FeatureExtractor", "Generally", "called", "by", "gen_feats", "Returns", "an", "array", "of", "features", "e_set", "-", "EssaySet", "object" ]
python
valid
robromano/django-adminrestrict
adminrestrict/middleware.py
https://github.com/robromano/django-adminrestrict/blob/f05fd21e49677731e3d291da956b84bcac9a5c69/adminrestrict/middleware.py#L87-L116
def process_request(self, request): """ Check if the request is made form an allowed IP """ # Section adjusted to restrict login to ?edit # (sing cms-toolbar-login)into DjangoCMS login. restricted_request_uri = request.path.startswith( reverse('admin:index') o...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "# Section adjusted to restrict login to ?edit", "# (sing cms-toolbar-login)into DjangoCMS login.", "restricted_request_uri", "=", "request", ".", "path", ".", "startswith", "(", "reverse", "(", "'admin:index'",...
Check if the request is made form an allowed IP
[ "Check", "if", "the", "request", "is", "made", "form", "an", "allowed", "IP" ]
python
train
openstax/cnx-easybake
cnxeasybake/oven.py
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L1250-L1283
def do_group_by(self, element, decl, pseudo): """Implement group-by declaration - pre-match.""" sort_css = groupby_css = flags = '' if ',' in decl.value: if decl.value.count(',') == 2: sort_css, groupby_css, flags = \ map(serialize, split(decl....
[ "def", "do_group_by", "(", "self", ",", "element", ",", "decl", ",", "pseudo", ")", ":", "sort_css", "=", "groupby_css", "=", "flags", "=", "''", "if", "','", "in", "decl", ".", "value", ":", "if", "decl", ".", "value", ".", "count", "(", "','", ")...
Implement group-by declaration - pre-match.
[ "Implement", "group", "-", "by", "declaration", "-", "pre", "-", "match", "." ]
python
train
apache/spark
python/pyspark/rdd.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/rdd.py#L1915-L1958
def groupByKey(self, numPartitions=None, partitionFunc=portable_hash): """ Group the values for each key in the RDD into a single sequence. Hash-partitions the resulting RDD with numPartitions partitions. .. note:: If you are grouping in order to perform an aggregation (such as a ...
[ "def", "groupByKey", "(", "self", ",", "numPartitions", "=", "None", ",", "partitionFunc", "=", "portable_hash", ")", ":", "def", "createCombiner", "(", "x", ")", ":", "return", "[", "x", "]", "def", "mergeValue", "(", "xs", ",", "x", ")", ":", "xs", ...
Group the values for each key in the RDD into a single sequence. Hash-partitions the resulting RDD with numPartitions partitions. .. note:: If you are grouping in order to perform an aggregation (such as a sum or average) over each key, using reduceByKey or aggregateByKey will p...
[ "Group", "the", "values", "for", "each", "key", "in", "the", "RDD", "into", "a", "single", "sequence", ".", "Hash", "-", "partitions", "the", "resulting", "RDD", "with", "numPartitions", "partitions", "." ]
python
train
materialsproject/pymatgen
pymatgen/electronic_structure/boltztrap.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1478-L1588
def get_extreme(self, target_prop, maximize=True, min_temp=None, max_temp=None, min_doping=None, max_doping=None, isotropy_tolerance=0.05, use_average=True): """ This method takes in eigenvalues over a range of carriers, temperatures, and doping levels, a...
[ "def", "get_extreme", "(", "self", ",", "target_prop", ",", "maximize", "=", "True", ",", "min_temp", "=", "None", ",", "max_temp", "=", "None", ",", "min_doping", "=", "None", ",", "max_doping", "=", "None", ",", "isotropy_tolerance", "=", "0.05", ",", ...
This method takes in eigenvalues over a range of carriers, temperatures, and doping levels, and tells you what is the "best" value that can be achieved for the given target_property. Note that this method searches the doping dict only, not the full mu dict. Args: target_prop...
[ "This", "method", "takes", "in", "eigenvalues", "over", "a", "range", "of", "carriers", "temperatures", "and", "doping", "levels", "and", "tells", "you", "what", "is", "the", "best", "value", "that", "can", "be", "achieved", "for", "the", "given", "target_pr...
python
train
e7dal/bubble3
behave4cmd0/log/steps.py
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/log/steps.py#L350-L371
def step_use_log_record_configuration(context): """ Define log record configuration parameters. .. code-block: gherkin Given I use the log record configuration: | property | value | | format | | | datefmt | | """ assert context.table, "REQ...
[ "def", "step_use_log_record_configuration", "(", "context", ")", ":", "assert", "context", ".", "table", ",", "\"REQUIRE: context.table\"", "context", ".", "table", ".", "require_columns", "(", "[", "\"property\"", ",", "\"value\"", "]", ")", "for", "row", "in", ...
Define log record configuration parameters. .. code-block: gherkin Given I use the log record configuration: | property | value | | format | | | datefmt | |
[ "Define", "log", "record", "configuration", "parameters", "." ]
python
train
kodexlab/reliure
reliure/options.py
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/options.py#L24-L50
def FromType(name, otype): """ ValueOption subclasses factory, creates a convenient option to store data from a given Type. attribute precedence : * ``|attrs| > 0`` (``multi`` and ``uniq`` are implicit) => NotImplementedError * ``uniq`` (``multi`` is implicit) => NotImp...
[ "def", "FromType", "(", "name", ",", "otype", ")", ":", "if", "otype", ".", "attrs", "is", "not", "None", "and", "len", "(", "otype", ".", "attrs", ")", ":", "raise", "NotImplementedError", "(", "\"for otype, options can't have attributs\"", ")", "#return Vect...
ValueOption subclasses factory, creates a convenient option to store data from a given Type. attribute precedence : * ``|attrs| > 0`` (``multi`` and ``uniq`` are implicit) => NotImplementedError * ``uniq`` (``multi`` is implicit) => NotImplementedError * ``multi`` and `...
[ "ValueOption", "subclasses", "factory", "creates", "a", "convenient", "option", "to", "store", "data", "from", "a", "given", "Type", "." ]
python
train
gc3-uzh-ch/elasticluster
elasticluster/cluster.py
https://github.com/gc3-uzh-ch/elasticluster/blob/e6345633308c76de13b889417df572815aabe744/elasticluster/cluster.py#L1461-L1470
def update_ips(self): """Retrieves the public and private ip of the instance by using the cloud provider. In some cases the public ip assignment takes some time, but this method is non blocking. To check for a public ip, consider calling this method multiple times during a certain timeou...
[ "def", "update_ips", "(", "self", ")", ":", "self", ".", "ips", "=", "self", ".", "_cloud_provider", ".", "get_ips", "(", "self", ".", "instance_id", ")", "if", "self", ".", "preferred_ip", "not", "in", "self", ".", "ips", ":", "self", ".", "preferred_...
Retrieves the public and private ip of the instance by using the cloud provider. In some cases the public ip assignment takes some time, but this method is non blocking. To check for a public ip, consider calling this method multiple times during a certain timeout.
[ "Retrieves", "the", "public", "and", "private", "ip", "of", "the", "instance", "by", "using", "the", "cloud", "provider", ".", "In", "some", "cases", "the", "public", "ip", "assignment", "takes", "some", "time", "but", "this", "method", "is", "non", "block...
python
train
saltstack/salt
salt/tokens/rediscluster.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L102-L122
def get_token(opts, tok): ''' Fetch the token data from the store. :param opts: Salt master config options :param tok: Token value to get :returns: Token data if successful. Empty dict if failed. ''' redis_client = _redis_client(opts) if not redis_client: return {} serial = ...
[ "def", "get_token", "(", "opts", ",", "tok", ")", ":", "redis_client", "=", "_redis_client", "(", "opts", ")", "if", "not", "redis_client", ":", "return", "{", "}", "serial", "=", "salt", ".", "payload", ".", "Serial", "(", "opts", ")", "try", ":", "...
Fetch the token data from the store. :param opts: Salt master config options :param tok: Token value to get :returns: Token data if successful. Empty dict if failed.
[ "Fetch", "the", "token", "data", "from", "the", "store", "." ]
python
train
Vagrants/blackbird
blackbird/utils/configread.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L424-L452
def _create_specs(self): """ Create configspec instances based "conf/defaults.cfg". This function takes as arguments to the required section and module. Take them out from self.config, _create_specs pass the _config_factory. """ raw_specs = self._get_raw_specs(self.confi...
[ "def", "_create_specs", "(", "self", ")", ":", "raw_specs", "=", "self", ".", "_get_raw_specs", "(", "self", ".", "config", ")", "spec", "=", "self", ".", "_configobj_factory", "(", "infile", "=", "None", ",", "_inspec", "=", "True", ")", "for", "section...
Create configspec instances based "conf/defaults.cfg". This function takes as arguments to the required section and module. Take them out from self.config, _create_specs pass the _config_factory.
[ "Create", "configspec", "instances", "based", "conf", "/", "defaults", ".", "cfg", ".", "This", "function", "takes", "as", "arguments", "to", "the", "required", "section", "and", "module", ".", "Take", "them", "out", "from", "self", ".", "config", "_create_s...
python
train
GNS3/gns3-server
gns3server/controller/project.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/project.py#L663-L682
def _cleanPictures(self): """ Delete unused images """ # Project have been deleted if not os.path.exists(self.path): return try: pictures = set(os.listdir(self.pictures_directory)) for drawing in self._drawings.values(): ...
[ "def", "_cleanPictures", "(", "self", ")", ":", "# Project have been deleted", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "path", ")", ":", "return", "try", ":", "pictures", "=", "set", "(", "os", ".", "listdir", "(", "self", ".",...
Delete unused images
[ "Delete", "unused", "images" ]
python
train
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L10152-L10172
def astype(value, types=None): """Return argument as one of types if possible. >>> astype('42') 42 >>> astype('3.14') 3.14 >>> astype('True') True >>> astype(b'Neee-Wom') 'Neee-Wom' """ if types is None: types = int, float, asbool, bytes2str for typ in types: ...
[ "def", "astype", "(", "value", ",", "types", "=", "None", ")", ":", "if", "types", "is", "None", ":", "types", "=", "int", ",", "float", ",", "asbool", ",", "bytes2str", "for", "typ", "in", "types", ":", "try", ":", "return", "typ", "(", "value", ...
Return argument as one of types if possible. >>> astype('42') 42 >>> astype('3.14') 3.14 >>> astype('True') True >>> astype(b'Neee-Wom') 'Neee-Wom'
[ "Return", "argument", "as", "one", "of", "types", "if", "possible", "." ]
python
train
quintusdias/glymur
glymur/jp2k.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2k.py#L584-L590
def _validate_j2k_colorspace(self, cparams, colorspace): """ Cannot specify a colorspace with J2K. """ if cparams.codec_fmt == opj2.CODEC_J2K and colorspace is not None: msg = 'Do not specify a colorspace when writing a raw codestream.' raise IOError(msg)
[ "def", "_validate_j2k_colorspace", "(", "self", ",", "cparams", ",", "colorspace", ")", ":", "if", "cparams", ".", "codec_fmt", "==", "opj2", ".", "CODEC_J2K", "and", "colorspace", "is", "not", "None", ":", "msg", "=", "'Do not specify a colorspace when writing a ...
Cannot specify a colorspace with J2K.
[ "Cannot", "specify", "a", "colorspace", "with", "J2K", "." ]
python
train