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
user-cont/conu
conu/backend/docker/backend.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/docker/backend.py#L85-L106
def list_containers(self): """ List all available docker containers. Container objects returned from this methods will contain a limited amount of metadata in property `short_metadata`. These are just a subset of `.inspect()`, but don't require an API call against dockerd. ...
[ "def", "list_containers", "(", "self", ")", ":", "result", "=", "[", "]", "for", "c", "in", "self", ".", "d", ".", "containers", "(", "all", "=", "True", ")", ":", "name", "=", "None", "names", "=", "c", ".", "get", "(", "\"Names\"", ",", "None",...
List all available docker containers. Container objects returned from this methods will contain a limited amount of metadata in property `short_metadata`. These are just a subset of `.inspect()`, but don't require an API call against dockerd. :return: collection of instances of :class:...
[ "List", "all", "available", "docker", "containers", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe.py#L119-L131
def fcoe_fcoe_fabric_map_fcoe_fip_keep_alive_fcoe_fip_keep_alive_timeout(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe") fcoe_fabric_map = ET.SubElement(fcoe, "fcoe-fabric-ma...
[ "def", "fcoe_fcoe_fabric_map_fcoe_fip_keep_alive_fcoe_fip_keep_alive_timeout", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "fcoe", "=", "ET", ".", "SubElement", "(", "config", ",", "\"fcoe\"", ",",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
mozilla/socorrolib
socorrolib/lib/transform_rules.py
https://github.com/mozilla/socorrolib/blob/4ec08c6a4ee2c8a69150268afdd324f5f22b90c8/socorrolib/lib/transform_rules.py#L241-L251
def function_invocation_proxy(fn, proxy_args, proxy_kwargs): """execute the fuction if it is one, else evaluate the fn as a boolean and return that value. Sometimes rather than providing a predicate, we just give the value of True. This is shorthand for writing a predicate that always ...
[ "def", "function_invocation_proxy", "(", "fn", ",", "proxy_args", ",", "proxy_kwargs", ")", ":", "try", ":", "return", "fn", "(", "*", "proxy_args", ",", "*", "*", "proxy_kwargs", ")", "except", "TypeError", ":", "return", "bool", "(", "fn", ")" ]
execute the fuction if it is one, else evaluate the fn as a boolean and return that value. Sometimes rather than providing a predicate, we just give the value of True. This is shorthand for writing a predicate that always returns true.
[ "execute", "the", "fuction", "if", "it", "is", "one", "else", "evaluate", "the", "fn", "as", "a", "boolean", "and", "return", "that", "value", "." ]
python
train
apache/spark
python/pyspark/context.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/context.py#L482-L529
def parallelize(self, c, numSlices=None): """ Distribute a local Python collection to form an RDD. Using xrange is recommended if the input represents a range for performance. >>> sc.parallelize([0, 2, 3, 4, 6], 5).glom().collect() [[0], [2], [3], [4], [6]] >>> sc.parall...
[ "def", "parallelize", "(", "self", ",", "c", ",", "numSlices", "=", "None", ")", ":", "numSlices", "=", "int", "(", "numSlices", ")", "if", "numSlices", "is", "not", "None", "else", "self", ".", "defaultParallelism", "if", "isinstance", "(", "c", ",", ...
Distribute a local Python collection to form an RDD. Using xrange is recommended if the input represents a range for performance. >>> sc.parallelize([0, 2, 3, 4, 6], 5).glom().collect() [[0], [2], [3], [4], [6]] >>> sc.parallelize(xrange(0, 6, 2), 5).glom().collect() [[], [0], [...
[ "Distribute", "a", "local", "Python", "collection", "to", "form", "an", "RDD", ".", "Using", "xrange", "is", "recommended", "if", "the", "input", "represents", "a", "range", "for", "performance", "." ]
python
train
chrisspen/burlap
burlap/apache.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/apache.py#L366-L400
def install_auth_basic_user_file(self, site=None): """ Installs users for basic httpd auth. """ r = self.local_renderer hostname = self.current_hostname target_sites = self.genv.available_sites_by_host.get(hostname, None) for _site, site_data in self.iter_sites...
[ "def", "install_auth_basic_user_file", "(", "self", ",", "site", "=", "None", ")", ":", "r", "=", "self", ".", "local_renderer", "hostname", "=", "self", ".", "current_hostname", "target_sites", "=", "self", ".", "genv", ".", "available_sites_by_host", ".", "g...
Installs users for basic httpd auth.
[ "Installs", "users", "for", "basic", "httpd", "auth", "." ]
python
valid
gccxml/pygccxml
pygccxml/declarations/namespace.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/namespace.py#L109-L122
def namespace(self, name=None, function=None, recursive=None): """ Returns reference to namespace declaration that matches a defined criteria. """ return ( self._find_single( scopedef.scopedef_t._impl_matchers[namespace_t.namespace], ...
[ "def", "namespace", "(", "self", ",", "name", "=", "None", ",", "function", "=", "None", ",", "recursive", "=", "None", ")", ":", "return", "(", "self", ".", "_find_single", "(", "scopedef", ".", "scopedef_t", ".", "_impl_matchers", "[", "namespace_t", "...
Returns reference to namespace declaration that matches a defined criteria.
[ "Returns", "reference", "to", "namespace", "declaration", "that", "matches", "a", "defined", "criteria", "." ]
python
train
jtpaasch/simplygithub
simplygithub/files.py
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/files.py#L9-L16
def prepare(data): """Restructure/prepare data about a blob for output.""" result = {} result["mode"] = data.get("mode") result["path"] = data.get("path") result["type"] = data.get("type") result["sha"] = data.get("sha") return result
[ "def", "prepare", "(", "data", ")", ":", "result", "=", "{", "}", "result", "[", "\"mode\"", "]", "=", "data", ".", "get", "(", "\"mode\"", ")", "result", "[", "\"path\"", "]", "=", "data", ".", "get", "(", "\"path\"", ")", "result", "[", "\"type\"...
Restructure/prepare data about a blob for output.
[ "Restructure", "/", "prepare", "data", "about", "a", "blob", "for", "output", "." ]
python
train
shoebot/shoebot
lib/graph/__init__.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/graph/__init__.py#L672-L700
def load(self, id): """ Rebuilds the graph around the given node id. """ self.clear() # Root node. self.add_node(id, root=True) # Directly connected nodes have priority. for w, id2 in self.get_links(id): self.add_edge(id, id...
[ "def", "load", "(", "self", ",", "id", ")", ":", "self", ".", "clear", "(", ")", "# Root node.", "self", ".", "add_node", "(", "id", ",", "root", "=", "True", ")", "# Directly connected nodes have priority.", "for", "w", ",", "id2", "in", "self", ".", ...
Rebuilds the graph around the given node id.
[ "Rebuilds", "the", "graph", "around", "the", "given", "node", "id", "." ]
python
valid
dswah/pyGAM
pygam/utils.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/utils.py#L307-L322
def check_X_y(X, y): """ tool to ensure input and output data have the same number of samples Parameters ---------- X : array-like y : array-like Returns ------- None """ if len(X) != len(y): raise ValueError('Inconsistent input and output data shapes. '\ ...
[ "def", "check_X_y", "(", "X", ",", "y", ")", ":", "if", "len", "(", "X", ")", "!=", "len", "(", "y", ")", ":", "raise", "ValueError", "(", "'Inconsistent input and output data shapes. '", "'found X: {} and y: {}'", ".", "format", "(", "X", ".", "shape", ",...
tool to ensure input and output data have the same number of samples Parameters ---------- X : array-like y : array-like Returns ------- None
[ "tool", "to", "ensure", "input", "and", "output", "data", "have", "the", "same", "number", "of", "samples" ]
python
train
pyroscope/pyrocore
src/pyrocore/daemon/webapp.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/daemon/webapp.py#L112-L121
def guarded(self, func, *args, **kwargs): """ Call a function, return None on errors. """ try: return func(*args, **kwargs) except (EnvironmentError, error.LoggableError, xmlrpc.ERRORS) as g_exc: if func.__name__ not in self.ERRORS_LOGGED: self.LOG...
[ "def", "guarded", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "(", "EnvironmentError", ",", "error", ".", "LoggableError", ",...
Call a function, return None on errors.
[ "Call", "a", "function", "return", "None", "on", "errors", "." ]
python
train
midasplatform/pydas
pydas/drivers.py
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/drivers.py#L684-L711
def download_item(self, item_id, token=None, revision=None): """ Download an item to disk. :param item_id: The id of the item to be downloaded. :type item_id: int | long :param token: (optional) The authentication token of the user requesting the download. :t...
[ "def", "download_item", "(", "self", ",", "item_id", ",", "token", "=", "None", ",", "revision", "=", "None", ")", ":", "parameters", "=", "dict", "(", ")", "parameters", "[", "'id'", "]", "=", "item_id", "if", "token", ":", "parameters", "[", "'token'...
Download an item to disk. :param item_id: The id of the item to be downloaded. :type item_id: int | long :param token: (optional) The authentication token of the user requesting the download. :type token: None | string :param revision: (optional) The revision of the ...
[ "Download", "an", "item", "to", "disk", "." ]
python
valid
PyMySQL/PyMySQL
pymysql/cursors.py
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L47-L58
def close(self): """ Closing a cursor just exhausts all remaining data. """ conn = self.connection if conn is None: return try: while self.nextset(): pass finally: self.connection = None
[ "def", "close", "(", "self", ")", ":", "conn", "=", "self", ".", "connection", "if", "conn", "is", "None", ":", "return", "try", ":", "while", "self", ".", "nextset", "(", ")", ":", "pass", "finally", ":", "self", ".", "connection", "=", "None" ]
Closing a cursor just exhausts all remaining data.
[ "Closing", "a", "cursor", "just", "exhausts", "all", "remaining", "data", "." ]
python
train
pywbem/pywbem
pywbem/mof_compiler.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/mof_compiler.py#L2507-L2536
def find_mof(self, classname): """ Find the MOF file that defines a particular CIM class, in the search path of the MOF compiler. The MOF file is found based on its file name: It is assumed that the base part of the file name is the CIM class name. Example: The class "C...
[ "def", "find_mof", "(", "self", ",", "classname", ")", ":", "classname", "=", "classname", ".", "lower", "(", ")", "for", "search", "in", "self", ".", "parser", ".", "search_paths", ":", "for", "root", ",", "dummy_dirs", ",", "files", "in", "os", ".", ...
Find the MOF file that defines a particular CIM class, in the search path of the MOF compiler. The MOF file is found based on its file name: It is assumed that the base part of the file name is the CIM class name. Example: The class "CIM_ComputerSystem" is expected to be in a file ...
[ "Find", "the", "MOF", "file", "that", "defines", "a", "particular", "CIM", "class", "in", "the", "search", "path", "of", "the", "MOF", "compiler", "." ]
python
train
plandes/actioncli
src/python/zensols/actioncli/factory.py
https://github.com/plandes/actioncli/blob/d1c4ea27e6f3394b30a1652ddd4b916160662773/src/python/zensols/actioncli/factory.py#L33-L41
def parse_module_class(self): """Parse the module and class name part of the fully qualifed class name. """ cname = self.class_name match = re.match(self.CLASS_REGEX, cname) if not match: raise ValueError(f'not a fully qualified class name: {cname}') return m...
[ "def", "parse_module_class", "(", "self", ")", ":", "cname", "=", "self", ".", "class_name", "match", "=", "re", ".", "match", "(", "self", ".", "CLASS_REGEX", ",", "cname", ")", "if", "not", "match", ":", "raise", "ValueError", "(", "f'not a fully qualifi...
Parse the module and class name part of the fully qualifed class name.
[ "Parse", "the", "module", "and", "class", "name", "part", "of", "the", "fully", "qualifed", "class", "name", "." ]
python
train
push-things/django-th
th_trello/my_trello.py
https://github.com/push-things/django-th/blob/86c999d16bcf30b6224206e5b40824309834ac8c/th_trello/my_trello.py#L89-L153
def save_data(self, trigger_id, **data): """ let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the sa...
[ "def", "save_data", "(", "self", ",", "trigger_id", ",", "*", "*", "data", ")", ":", "data", "[", "'output_format'", "]", "=", "'md'", "title", ",", "content", "=", "super", "(", "ServiceTrello", ",", "self", ")", ".", "save_data", "(", "trigger_id", "...
let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the save statement :rtype: boolean
[ "let", "s", "save", "the", "data" ]
python
train
gpoulter/fablib
fablib.py
https://github.com/gpoulter/fablib/blob/5d14c4d998f79dd1aa3207063c3d06e30e3e2bf9/fablib.py#L178-L189
def install_deb(pkgname, url): """Install package from custom deb hosted on S3. Return true if package was installed by this invocation.""" status = run("dpkg-query -W -f='${{Status}}' {p}; true".format(p=pkgname)) if ('installed' not in status) or ('not-installed' in status): deb = url.rpartiti...
[ "def", "install_deb", "(", "pkgname", ",", "url", ")", ":", "status", "=", "run", "(", "\"dpkg-query -W -f='${{Status}}' {p}; true\"", ".", "format", "(", "p", "=", "pkgname", ")", ")", "if", "(", "'installed'", "not", "in", "status", ")", "or", "(", "'not...
Install package from custom deb hosted on S3. Return true if package was installed by this invocation.
[ "Install", "package", "from", "custom", "deb", "hosted", "on", "S3", ".", "Return", "true", "if", "package", "was", "installed", "by", "this", "invocation", "." ]
python
train
LogicalDash/LiSE
allegedb/allegedb/__init__.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/__init__.py#L655-L672
def is_parent_of(self, parent, child): """Return whether ``child`` is a branch descended from ``parent`` at any remove. """ if parent == 'trunk': return True if child == 'trunk': return False if child not in self._branches: raise Value...
[ "def", "is_parent_of", "(", "self", ",", "parent", ",", "child", ")", ":", "if", "parent", "==", "'trunk'", ":", "return", "True", "if", "child", "==", "'trunk'", ":", "return", "False", "if", "child", "not", "in", "self", ".", "_branches", ":", "raise...
Return whether ``child`` is a branch descended from ``parent`` at any remove.
[ "Return", "whether", "child", "is", "a", "branch", "descended", "from", "parent", "at", "any", "remove", "." ]
python
train
buildbot/buildbot
master/buildbot/scripts/runner.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/scripts/runner.py#L38-L54
def validateMasterOption(master): """ Validate master (-m, --master) command line option. Checks that option is a string of the 'hostname:port' form, otherwise raises an UsageError exception. @type master: string @param master: master option @raise usage.UsageError: on invalid master opt...
[ "def", "validateMasterOption", "(", "master", ")", ":", "try", ":", "hostname", ",", "port", "=", "master", ".", "split", "(", "\":\"", ")", "port", "=", "int", "(", "port", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "raise", "usage"...
Validate master (-m, --master) command line option. Checks that option is a string of the 'hostname:port' form, otherwise raises an UsageError exception. @type master: string @param master: master option @raise usage.UsageError: on invalid master option
[ "Validate", "master", "(", "-", "m", "--", "master", ")", "command", "line", "option", "." ]
python
train
timkpaine/pyEX
pyEX/common.py
https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L133-L139
def _strOrDate(st): '''internal''' if isinstance(st, string_types): return st elif isinstance(st, datetime): return st.strftime('%Y%m%d') raise PyEXception('Not a date: %s', str(st))
[ "def", "_strOrDate", "(", "st", ")", ":", "if", "isinstance", "(", "st", ",", "string_types", ")", ":", "return", "st", "elif", "isinstance", "(", "st", ",", "datetime", ")", ":", "return", "st", ".", "strftime", "(", "'%Y%m%d'", ")", "raise", "PyEXcep...
internal
[ "internal" ]
python
valid
gwpy/gwpy
gwpy/signal/filter_design.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/signal/filter_design.py#L102-L132
def num_taps(sample_rate, transitionwidth, gpass, gstop): """Returns the number of taps for an FIR filter with the given shape Parameters ---------- sample_rate : `float` sampling rate of target data transitionwidth : `float` the width (in the same units as `sample_rate` of the tra...
[ "def", "num_taps", "(", "sample_rate", ",", "transitionwidth", ",", "gpass", ",", "gstop", ")", ":", "gpass", "=", "10", "**", "(", "-", "gpass", "/", "10.", ")", "gstop", "=", "10", "**", "(", "-", "gstop", "/", "10.", ")", "return", "int", "(", ...
Returns the number of taps for an FIR filter with the given shape Parameters ---------- sample_rate : `float` sampling rate of target data transitionwidth : `float` the width (in the same units as `sample_rate` of the transition from stop-band to pass-band gpass : `float` ...
[ "Returns", "the", "number", "of", "taps", "for", "an", "FIR", "filter", "with", "the", "given", "shape" ]
python
train
saltstack/salt
salt/thorium/calc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/calc.py#L273-L293
def mode(name, num, minimum=0, maximum=0, ref=None): ''' Calculates the mode of the ``num`` most recent values. Requires a list. USAGE: .. code-block:: yaml foo: calc.mode: - name: myregentry - num: 5 ''' return calc( name=name, num=nu...
[ "def", "mode", "(", "name", ",", "num", ",", "minimum", "=", "0", ",", "maximum", "=", "0", ",", "ref", "=", "None", ")", ":", "return", "calc", "(", "name", "=", "name", ",", "num", "=", "num", ",", "oper", "=", "'mode'", ",", "minimum", "=", ...
Calculates the mode of the ``num`` most recent values. Requires a list. USAGE: .. code-block:: yaml foo: calc.mode: - name: myregentry - num: 5
[ "Calculates", "the", "mode", "of", "the", "num", "most", "recent", "values", ".", "Requires", "a", "list", "." ]
python
train
idlesign/uwsgiconf
uwsgiconf/contrib/django/uwsgify/toolbox.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/contrib/django/uwsgify/toolbox.py#L201-L231
def mutate(self): """Mutates current section.""" section = self.section project_name = self.project_name section.project_name = project_name self.contribute_runtime_dir() main = section.main_process main.set_naming_params(prefix='[%s] ' % project_name) ...
[ "def", "mutate", "(", "self", ")", ":", "section", "=", "self", ".", "section", "project_name", "=", "self", ".", "project_name", "section", ".", "project_name", "=", "project_name", "self", ".", "contribute_runtime_dir", "(", ")", "main", "=", "section", "....
Mutates current section.
[ "Mutates", "current", "section", "." ]
python
train
gwastro/pycbc
pycbc/workflow/coincidence.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/coincidence.py#L549-L592
def setup_interval_coinc(workflow, hdfbank, trig_files, stat_files, veto_files, veto_names, out_dir, tags=None): """ This function sets up exact match coincidence and background estimation using a folded interval technique. """ if tags is None: tags = [] make_an...
[ "def", "setup_interval_coinc", "(", "workflow", ",", "hdfbank", ",", "trig_files", ",", "stat_files", ",", "veto_files", ",", "veto_names", ",", "out_dir", ",", "tags", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "make_...
This function sets up exact match coincidence and background estimation using a folded interval technique.
[ "This", "function", "sets", "up", "exact", "match", "coincidence", "and", "background", "estimation" ]
python
train
waqasbhatti/astrobase
astrobase/services/lccs.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/services/lccs.py#L492-L715
def retrieve_dataset_files(searchresult, getpickle=False, outdir=None, apikey=None): '''This retrieves a search result dataset's CSV and any LC zip files. Takes the output from the `submit_post_searchquery` function above or a ...
[ "def", "retrieve_dataset_files", "(", "searchresult", ",", "getpickle", "=", "False", ",", "outdir", "=", "None", ",", "apikey", "=", "None", ")", ":", "# this handles the direct result case from submit_*_query functions", "if", "isinstance", "(", "searchresult", ",", ...
This retrieves a search result dataset's CSV and any LC zip files. Takes the output from the `submit_post_searchquery` function above or a pickle file generated from that function's output if the query timed out. Parameters ---------- searchresult : str or tuple If provided as a str, poin...
[ "This", "retrieves", "a", "search", "result", "dataset", "s", "CSV", "and", "any", "LC", "zip", "files", "." ]
python
valid
south-coast-science/scs_core
src/scs_core/gas/pid_datum.py
https://github.com/south-coast-science/scs_core/blob/a4152b0bbed6acbbf257e1bba6a912f6ebe578e5/src/scs_core/gas/pid_datum.py#L62-L74
def __cnc(cls, calib, we_c): """ Compute cnc from weC """ if we_c is None: return None offset_v = calib.pid_elc_mv / 1000.0 response_c = we_c - offset_v # remove electronic zero cnc = response_c / calib.pid_sens_mv # pid_sens_mv...
[ "def", "__cnc", "(", "cls", ",", "calib", ",", "we_c", ")", ":", "if", "we_c", "is", "None", ":", "return", "None", "offset_v", "=", "calib", ".", "pid_elc_mv", "/", "1000.0", "response_c", "=", "we_c", "-", "offset_v", "# remove electronic zero", "cnc", ...
Compute cnc from weC
[ "Compute", "cnc", "from", "weC" ]
python
train
emirozer/bowshock
bowshock/techport.py
https://github.com/emirozer/bowshock/blob/9f5e053f1d54995b833b83616f37c67178c3e840/bowshock/techport.py#L19-L47
def techport(Id): ''' In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values r...
[ "def", "techport", "(", "Id", ")", ":", "base_url", "=", "'http://techport.nasa.gov/xml-api/'", "if", "not", "isinstance", "(", "Id", ",", "str", ")", ":", "raise", "ValueError", "(", "\"The Id arg you provided is not the type of str\"", ")", "else", ":", "base_url"...
In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values range from 0-20000. Not all...
[ "In", "order", "to", "use", "this", "capability", "queries", "can", "be", "issued", "to", "the", "system", "with", "the", "following", "URI", "format", ":", "GET", "/", "xml", "-", "api", "/", "id_parameter", "Parameter", "Required?", "Value", "Description",...
python
train
gitpython-developers/GitPython
git/refs/head.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/refs/head.py#L190-L223
def checkout(self, force=False, **kwargs): """Checkout this head by setting the HEAD to this reference, by updating the index to reflect the tree we point to and by updating the working tree to reflect the latest index. The command will fail if changed working tree files would be overwr...
[ "def", "checkout", "(", "self", ",", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'f'", "]", "=", "force", "if", "kwargs", "[", "'f'", "]", "is", "False", ":", "kwargs", ".", "pop", "(", "'f'", ")", "self", ".", "re...
Checkout this head by setting the HEAD to this reference, by updating the index to reflect the tree we point to and by updating the working tree to reflect the latest index. The command will fail if changed working tree files would be overwritten. :param force: If True, cha...
[ "Checkout", "this", "head", "by", "setting", "the", "HEAD", "to", "this", "reference", "by", "updating", "the", "index", "to", "reflect", "the", "tree", "we", "point", "to", "and", "by", "updating", "the", "working", "tree", "to", "reflect", "the", "latest...
python
train
ergoithz/browsepy
browsepy/file.py
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/file.py#L767-L778
def abspath_to_urlpath(path, base, os_sep=os.sep): ''' Make filesystem absolute path uri relative using given absolute base path. :param path: absolute path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: relative uri :rtype...
[ "def", "abspath_to_urlpath", "(", "path", ",", "base", ",", "os_sep", "=", "os", ".", "sep", ")", ":", "return", "relativize_path", "(", "path", ",", "base", ",", "os_sep", ")", ".", "replace", "(", "os_sep", ",", "'/'", ")" ]
Make filesystem absolute path uri relative using given absolute base path. :param path: absolute path :param base: absolute base path :param os_sep: path component separator, defaults to current OS separator :return: relative uri :rtype: str or unicode :raises OutsideDirectoryBase: if resulting...
[ "Make", "filesystem", "absolute", "path", "uri", "relative", "using", "given", "absolute", "base", "path", "." ]
python
train
nickmckay/LiPD-utilities
Python/lipd/lpd_noaa.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/lpd_noaa.py#L296-L321
def __generate_study_name(self): """ When a study name is not given, generate one with the format of " author - site name - year " :return str study_name: generated study name """ study_name = "" _exist = False try: if self.noaa_data_sorted["Top"]["Stu...
[ "def", "__generate_study_name", "(", "self", ")", ":", "study_name", "=", "\"\"", "_exist", "=", "False", "try", ":", "if", "self", ".", "noaa_data_sorted", "[", "\"Top\"", "]", "[", "\"Study_Name\"", "]", ":", "_exist", "=", "True", "except", "KeyError", ...
When a study name is not given, generate one with the format of " author - site name - year " :return str study_name: generated study name
[ "When", "a", "study", "name", "is", "not", "given", "generate", "one", "with", "the", "format", "of", "author", "-", "site", "name", "-", "year", ":", "return", "str", "study_name", ":", "generated", "study", "name" ]
python
train
krukas/Trionyx
trionyx/navigation.py
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/navigation.py#L359-L371
def get_layout(self, object): """Get complete layout for given object""" layout = self.create_layout(object) if isinstance(layout, Component): layout = Layout(layout) if isinstance(layout, list): layout = Layout(*layout) for update_layout in self.layout_...
[ "def", "get_layout", "(", "self", ",", "object", ")", ":", "layout", "=", "self", ".", "create_layout", "(", "object", ")", "if", "isinstance", "(", "layout", ",", "Component", ")", ":", "layout", "=", "Layout", "(", "layout", ")", "if", "isinstance", ...
Get complete layout for given object
[ "Get", "complete", "layout", "for", "given", "object" ]
python
train
scanny/python-pptx
pptx/oxml/chart/datalabel.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/oxml/chart/datalabel.py#L157-L165
def get_or_add_dLbl_for_point(self, idx): """ Return the `c:dLbl` element representing the label of the point at index *idx*. """ matches = self.xpath('c:dLbl[c:idx[@val="%d"]]' % idx) if matches: return matches[0] return self._insert_dLbl_in_sequence(...
[ "def", "get_or_add_dLbl_for_point", "(", "self", ",", "idx", ")", ":", "matches", "=", "self", ".", "xpath", "(", "'c:dLbl[c:idx[@val=\"%d\"]]'", "%", "idx", ")", "if", "matches", ":", "return", "matches", "[", "0", "]", "return", "self", ".", "_insert_dLbl_...
Return the `c:dLbl` element representing the label of the point at index *idx*.
[ "Return", "the", "c", ":", "dLbl", "element", "representing", "the", "label", "of", "the", "point", "at", "index", "*", "idx", "*", "." ]
python
train
ssalentin/plip
plip/modules/preparation.py
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/preparation.py#L503-L512
def find_hba(self, all_atoms): """Find all possible hydrogen bond acceptors""" data = namedtuple('hbondacceptor', 'a a_orig_atom a_orig_idx type') a_set = [] for atom in filter(lambda at: at.OBAtom.IsHbondAcceptor(), all_atoms): if atom.atomicnum not in [9, 17, 35, 53] and at...
[ "def", "find_hba", "(", "self", ",", "all_atoms", ")", ":", "data", "=", "namedtuple", "(", "'hbondacceptor'", ",", "'a a_orig_atom a_orig_idx type'", ")", "a_set", "=", "[", "]", "for", "atom", "in", "filter", "(", "lambda", "at", ":", "at", ".", "OBAtom"...
Find all possible hydrogen bond acceptors
[ "Find", "all", "possible", "hydrogen", "bond", "acceptors" ]
python
train
dsoprea/PySchedules
pyschedules/examples/read.py
https://github.com/dsoprea/PySchedules/blob/e5aae988fad90217f72db45f93bf69839f4d75e7/pyschedules/examples/read.py#L98-L106
def new_crew_member(self, program, role, fullname, givenname, surname): """Callback run for each new crew member entry. 'fullname' is a derived full-name, based on the presence of 'givenname' and/or 'surname'. """ if self.__v_crew_member: # [Crew: EP000036710112, Ac...
[ "def", "new_crew_member", "(", "self", ",", "program", ",", "role", ",", "fullname", ",", "givenname", ",", "surname", ")", ":", "if", "self", ".", "__v_crew_member", ":", "# [Crew: EP000036710112, Actor, Estelle Parsons]", "print", "(", "\"[Crew: %s, %s, %s]\"", "%...
Callback run for each new crew member entry. 'fullname' is a derived full-name, based on the presence of 'givenname' and/or 'surname'.
[ "Callback", "run", "for", "each", "new", "crew", "member", "entry", ".", "fullname", "is", "a", "derived", "full", "-", "name", "based", "on", "the", "presence", "of", "givenname", "and", "/", "or", "surname", "." ]
python
train
cloud9ers/pylxc
lxc/__init__.py
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L184-L192
def kill(name, signal): ''' sends a kill signal to process 1 of ths container <name> :param signal: numeric signal ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-kill', '--name=%s' % name, signal] subprocess.check_ca...
[ "def", "kill", "(", "name", ",", "signal", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-kill'", ",", "'--name=%s'", "%", "name",...
sends a kill signal to process 1 of ths container <name> :param signal: numeric signal
[ "sends", "a", "kill", "signal", "to", "process", "1", "of", "ths", "container", "<name", ">", ":", "param", "signal", ":", "numeric", "signal" ]
python
train
OpenTreeOfLife/peyotl
peyotl/collections_store/git_actions.py
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/collections_store/git_actions.py#L92-L107
def remove_collection(self, first_arg, sec_arg, third_arg, fourth_arg=None, commit_msg=None): """Remove a collection Given a collection_id, branch and optionally an author, remove a collection on the given branch and attribute the commit to author. Returns the SHA of the commit o...
[ "def", "remove_collection", "(", "self", ",", "first_arg", ",", "sec_arg", ",", "third_arg", ",", "fourth_arg", "=", "None", ",", "commit_msg", "=", "None", ")", ":", "if", "fourth_arg", "is", "None", ":", "collection_id", ",", "branch_name", ",", "author", ...
Remove a collection Given a collection_id, branch and optionally an author, remove a collection on the given branch and attribute the commit to author. Returns the SHA of the commit on branch.
[ "Remove", "a", "collection", "Given", "a", "collection_id", "branch", "and", "optionally", "an", "author", "remove", "a", "collection", "on", "the", "given", "branch", "and", "attribute", "the", "commit", "to", "author", ".", "Returns", "the", "SHA", "of", "...
python
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L216-L219
def controller_info(self): """Get the controller UUID, app tag and os tag.""" return [self._device.iotile_id, _pack_version(*self.os_info), _pack_version(*self.app_info)]
[ "def", "controller_info", "(", "self", ")", ":", "return", "[", "self", ".", "_device", ".", "iotile_id", ",", "_pack_version", "(", "*", "self", ".", "os_info", ")", ",", "_pack_version", "(", "*", "self", ".", "app_info", ")", "]" ]
Get the controller UUID, app tag and os tag.
[ "Get", "the", "controller", "UUID", "app", "tag", "and", "os", "tag", "." ]
python
train
jbloomlab/phydms
phydmslib/models.py
https://github.com/jbloomlab/phydms/blob/9cdebc10bafbe543c552d79486c7f950780ed3c0/phydmslib/models.py#L319-L329
def PARAMLIMITS(self, value): """Set new `PARAMLIMITS` dictionary.""" assert set(value.keys()) == set(self.PARAMLIMITS.keys()), "The \ new parameter limits are not defined for the same set \ of parameters as before." for param in value.keys(): assert v...
[ "def", "PARAMLIMITS", "(", "self", ",", "value", ")", ":", "assert", "set", "(", "value", ".", "keys", "(", ")", ")", "==", "set", "(", "self", ".", "PARAMLIMITS", ".", "keys", "(", ")", ")", ",", "\"The \\\n new parameter limits are not defin...
Set new `PARAMLIMITS` dictionary.
[ "Set", "new", "PARAMLIMITS", "dictionary", "." ]
python
train
seibert-media/Highton
highton/models/task.py
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/models/task.py#L71-L83
def list_upcoming(cls): """ Returns a collection of upcoming tasks (tasks that have not yet been completed, regardless of whether they’re overdue) for the authenticated user :return: :rtype: list """ return fields.ListField(name=cls.ENDPOINT, init_class=cls).deco...
[ "def", "list_upcoming", "(", "cls", ")", ":", "return", "fields", ".", "ListField", "(", "name", "=", "cls", ".", "ENDPOINT", ",", "init_class", "=", "cls", ")", ".", "decode", "(", "cls", ".", "element_from_string", "(", "cls", ".", "_get_request", "(",...
Returns a collection of upcoming tasks (tasks that have not yet been completed, regardless of whether they’re overdue) for the authenticated user :return: :rtype: list
[ "Returns", "a", "collection", "of", "upcoming", "tasks", "(", "tasks", "that", "have", "not", "yet", "been", "completed", "regardless", "of", "whether", "they’re", "overdue", ")", "for", "the", "authenticated", "user" ]
python
train
zimeon/iiif
iiif/manipulator.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif/manipulator.py#L245-L313
def size_to_apply(self): """Calculate size of image scaled using size parameters. Assumes current image width and height are available in self.width and self.height, and self.request is IIIFRequest object. Formats are: w, ,h w,h pct:p !w,h full max Returns (None,None) if no sc...
[ "def", "size_to_apply", "(", "self", ")", ":", "if", "(", "self", ".", "request", ".", "size_full", "or", "self", ".", "request", ".", "size_pct", "==", "100.0", ")", ":", "# full size", "return", "(", "None", ",", "None", ")", "# Not trivially full size, ...
Calculate size of image scaled using size parameters. Assumes current image width and height are available in self.width and self.height, and self.request is IIIFRequest object. Formats are: w, ,h w,h pct:p !w,h full max Returns (None,None) if no scaling is required. If max i...
[ "Calculate", "size", "of", "image", "scaled", "using", "size", "parameters", "." ]
python
train
six8/corona-cipr
src/cipr/commands/core.py
https://github.com/six8/corona-cipr/blob/a2f45761080c874afa39bf95fd5c4467c8eae272/src/cipr/commands/core.py#L161-L170
def packages(ciprcfg, env, opts, console): """ List installed packages for this project """ for name, source in ciprcfg.packages.items(): console.normal('- %s' % name) if opts.long_details: console.normal(' - directory: %s' % path.join(env.package_dir, name)) co...
[ "def", "packages", "(", "ciprcfg", ",", "env", ",", "opts", ",", "console", ")", ":", "for", "name", ",", "source", "in", "ciprcfg", ".", "packages", ".", "items", "(", ")", ":", "console", ".", "normal", "(", "'- %s'", "%", "name", ")", "if", "opt...
List installed packages for this project
[ "List", "installed", "packages", "for", "this", "project" ]
python
train
PyProphet/pyprophet
pyprophet/pyprophet.py
https://github.com/PyProphet/pyprophet/blob/f546ad171750cd7685afbde6785fe71f82cadb35/pyprophet/pyprophet.py#L49-L58
def unwrap_self_for_multiprocessing(arg): """ You can not call methods with multiprocessing, but free functions, If you want to call inst.method(arg0, arg1), unwrap_self_for_multiprocessing(inst, "method", (arg0, arg1)) does the trick. """ (inst, method_name, args) = arg r...
[ "def", "unwrap_self_for_multiprocessing", "(", "arg", ")", ":", "(", "inst", ",", "method_name", ",", "args", ")", "=", "arg", "return", "getattr", "(", "inst", ",", "method_name", ")", "(", "*", "args", ")" ]
You can not call methods with multiprocessing, but free functions, If you want to call inst.method(arg0, arg1), unwrap_self_for_multiprocessing(inst, "method", (arg0, arg1)) does the trick.
[ "You", "can", "not", "call", "methods", "with", "multiprocessing", "but", "free", "functions", "If", "you", "want", "to", "call", "inst", ".", "method", "(", "arg0", "arg1", ")" ]
python
test
PyCQA/astroid
astroid/as_string.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/as_string.py#L155-L174
def visit_classdef(self, node): """return an astroid.ClassDef node as string""" decorate = node.decorators.accept(self) if node.decorators else "" bases = ", ".join(n.accept(self) for n in node.bases) metaclass = node.metaclass() if metaclass and not node.has_metaclass_hack(): ...
[ "def", "visit_classdef", "(", "self", ",", "node", ")", ":", "decorate", "=", "node", ".", "decorators", ".", "accept", "(", "self", ")", "if", "node", ".", "decorators", "else", "\"\"", "bases", "=", "\", \"", ".", "join", "(", "n", ".", "accept", "...
return an astroid.ClassDef node as string
[ "return", "an", "astroid", ".", "ClassDef", "node", "as", "string" ]
python
train
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L619-L622
def _readline_echo(self, char, echo): """Echo a recieved character, move cursor etc...""" if self._readline_do_echo(echo): self.write(char)
[ "def", "_readline_echo", "(", "self", ",", "char", ",", "echo", ")", ":", "if", "self", ".", "_readline_do_echo", "(", "echo", ")", ":", "self", ".", "write", "(", "char", ")" ]
Echo a recieved character, move cursor etc...
[ "Echo", "a", "recieved", "character", "move", "cursor", "etc", "..." ]
python
train
O365/python-o365
O365/sharepoint.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L429-L445
def get_subsites(self): """ Returns a list of subsites defined for this site :rtype: list[Site] """ url = self.build_url( self._endpoints.get('get_subsites').format(id=self.object_id)) response = self.con.get(url) if not response: return [] ...
[ "def", "get_subsites", "(", "self", ")", ":", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", "'get_subsites'", ")", ".", "format", "(", "id", "=", "self", ".", "object_id", ")", ")", "response", "=", "self", "....
Returns a list of subsites defined for this site :rtype: list[Site]
[ "Returns", "a", "list", "of", "subsites", "defined", "for", "this", "site" ]
python
train
usc-isi-i2/etk
etk/ontology_api.py
https://github.com/usc-isi-i2/etk/blob/aab077c984ea20f5e8ae33af622fe11d3c4df866/etk/ontology_api.py#L599-L606
def get_entity(self, uri: str) -> OntologyClass: """ Find an ontology entity based on URI :param uri: URIRef or str :return: the OntologyEntity having the specified uri, or None """ return self.entities.get(str(uri), None)
[ "def", "get_entity", "(", "self", ",", "uri", ":", "str", ")", "->", "OntologyClass", ":", "return", "self", ".", "entities", ".", "get", "(", "str", "(", "uri", ")", ",", "None", ")" ]
Find an ontology entity based on URI :param uri: URIRef or str :return: the OntologyEntity having the specified uri, or None
[ "Find", "an", "ontology", "entity", "based", "on", "URI" ]
python
train
pmacosta/peng
peng/wave_functions.py
https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1351-L1390
def integral(wave, indep_min=None, indep_max=None): r""" Return the running integral of a waveform's dependent variable vector. The method used is the `trapezoidal <https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method :param wave: Waveform :type wave: :py:class:`peng.eng.Waveform` :p...
[ "def", "integral", "(", "wave", ",", "indep_min", "=", "None", ",", "indep_max", "=", "None", ")", ":", "ret", "=", "copy", ".", "copy", "(", "wave", ")", "_bound_waveform", "(", "ret", ",", "indep_min", ",", "indep_max", ")", "ret", ".", "_dep_vector"...
r""" Return the running integral of a waveform's dependent variable vector. The method used is the `trapezoidal <https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ method :param wave: Waveform :type wave: :py:class:`peng.eng.Waveform` :param indep_min: Independent vector start point of comput...
[ "r", "Return", "the", "running", "integral", "of", "a", "waveform", "s", "dependent", "variable", "vector", "." ]
python
test
saltstack/salt
salt/modules/parted_partition.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parted_partition.py#L366-L384
def system_types(): ''' List the system types that are supported by the installed version of sfdisk CLI Example: .. code-block:: bash salt '*' partition.system_types ''' ret = {} for line in __salt__['cmd.run']('sfdisk -T').splitlines(): if not line: continue ...
[ "def", "system_types", "(", ")", ":", "ret", "=", "{", "}", "for", "line", "in", "__salt__", "[", "'cmd.run'", "]", "(", "'sfdisk -T'", ")", ".", "splitlines", "(", ")", ":", "if", "not", "line", ":", "continue", "if", "line", ".", "startswith", "(",...
List the system types that are supported by the installed version of sfdisk CLI Example: .. code-block:: bash salt '*' partition.system_types
[ "List", "the", "system", "types", "that", "are", "supported", "by", "the", "installed", "version", "of", "sfdisk" ]
python
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L205-L225
def write(self, items): """Upload items to ElasticSearch. :param items: items to be uploaded. """ if self._read_only: raise IOError("Cannot write, Connector created as Read Only") # Uploading info to the new ES docs = [] for item in items: ...
[ "def", "write", "(", "self", ",", "items", ")", ":", "if", "self", ".", "_read_only", ":", "raise", "IOError", "(", "\"Cannot write, Connector created as Read Only\"", ")", "# Uploading info to the new ES", "docs", "=", "[", "]", "for", "item", "in", "items", ":...
Upload items to ElasticSearch. :param items: items to be uploaded.
[ "Upload", "items", "to", "ElasticSearch", "." ]
python
train
fedora-infra/fedora-messaging
fedora_messaging/twisted/consumer.py
https://github.com/fedora-infra/fedora-messaging/blob/be3e88534e2b15d579bcd24f9c4b7e795cb7e0b7/fedora_messaging/twisted/consumer.py#L70-L106
def cancel(self): """ Cancel the consumer and clean up resources associated with it. Consumers that are canceled are allowed to finish processing any messages before halting. Returns: defer.Deferred: A deferred that fires when the consumer has finished pr...
[ "def", "cancel", "(", "self", ")", ":", "# Remove it from protocol and factory so it doesn't restart later.", "try", ":", "del", "self", ".", "_protocol", ".", "_consumers", "[", "self", ".", "queue", "]", "except", "(", "KeyError", ",", "AttributeError", ")", ":"...
Cancel the consumer and clean up resources associated with it. Consumers that are canceled are allowed to finish processing any messages before halting. Returns: defer.Deferred: A deferred that fires when the consumer has finished processing any message it was in the mid...
[ "Cancel", "the", "consumer", "and", "clean", "up", "resources", "associated", "with", "it", ".", "Consumers", "that", "are", "canceled", "are", "allowed", "to", "finish", "processing", "any", "messages", "before", "halting", "." ]
python
train
inveniosoftware/kwalitee
kwalitee/cli/check.py
https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/cli/check.py#L179-L278
def files(obj, commit='HEAD', skip_merge_commits=False): """Check the files of the commits.""" from ..kwalitee import check_file, SUPPORTED_FILES from ..hooks import run options = obj.options repository = obj.repository if options.get('colors') is not False: colorama.init(autoreset=True...
[ "def", "files", "(", "obj", ",", "commit", "=", "'HEAD'", ",", "skip_merge_commits", "=", "False", ")", ":", "from", ".", ".", "kwalitee", "import", "check_file", ",", "SUPPORTED_FILES", "from", ".", ".", "hooks", "import", "run", "options", "=", "obj", ...
Check the files of the commits.
[ "Check", "the", "files", "of", "the", "commits", "." ]
python
train
priestc/moneywagon
moneywagon/__init__.py
https://github.com/priestc/moneywagon/blob/00518f1f557dcca8b3031f46d3564c2baa0227a3/moneywagon/__init__.py#L637-L661
def service_table(format='simple', authenticated=False): """ Returns a string depicting all services currently installed. """ if authenticated: all_services = ExchangeUniverse.get_authenticated_services() else: all_services = ALL_SERVICES if format == 'html': linkify = l...
[ "def", "service_table", "(", "format", "=", "'simple'", ",", "authenticated", "=", "False", ")", ":", "if", "authenticated", ":", "all_services", "=", "ExchangeUniverse", ".", "get_authenticated_services", "(", ")", "else", ":", "all_services", "=", "ALL_SERVICES"...
Returns a string depicting all services currently installed.
[ "Returns", "a", "string", "depicting", "all", "services", "currently", "installed", "." ]
python
train
sibirrer/lenstronomy
lenstronomy/LensModel/Profiles/tnfw.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L170-L185
def nfwPot(self, R, Rs, rho0, r_trunc): """ lensing potential of NFW profile :param R: radius of interest :type R: float/numpy array :param Rs: scale radius :type Rs: float :param rho0: density normalization (characteristic density) :type rho0: float ...
[ "def", "nfwPot", "(", "self", ",", "R", ",", "Rs", ",", "rho0", ",", "r_trunc", ")", ":", "x", "=", "R", "/", "Rs", "tau", "=", "float", "(", "r_trunc", ")", "/", "Rs", "hx", "=", "self", ".", "_h", "(", "x", ",", "tau", ")", "return", "2",...
lensing potential of NFW profile :param R: radius of interest :type R: float/numpy array :param Rs: scale radius :type Rs: float :param rho0: density normalization (characteristic density) :type rho0: float :return: Epsilon(R) projected density at radius R
[ "lensing", "potential", "of", "NFW", "profile" ]
python
train
soimort/you-get
src/you_get/util/fs.py
https://github.com/soimort/you-get/blob/b746ac01c9f39de94cac2d56f665285b0523b974/src/you_get/util/fs.py#L5-L47
def legitimize(text, os=detect_os()): """Converts a string to a valid filename. """ # POSIX systems text = text.translate({ 0: None, ord('/'): '-', ord('|'): '-', }) # FIXME: do some filesystem detection if os == 'windows' or os == 'cygwin' or os == 'wsl': #...
[ "def", "legitimize", "(", "text", ",", "os", "=", "detect_os", "(", ")", ")", ":", "# POSIX systems", "text", "=", "text", ".", "translate", "(", "{", "0", ":", "None", ",", "ord", "(", "'/'", ")", ":", "'-'", ",", "ord", "(", "'|'", ")", ":", ...
Converts a string to a valid filename.
[ "Converts", "a", "string", "to", "a", "valid", "filename", "." ]
python
test
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/checks/prometheus/mixins.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/prometheus/mixins.py#L239-L253
def _text_filter_input(self, input_gen): """ Filters out the text input line by line to avoid parsing and processing metrics we know we don't want to process. This only works on `text/plain` payloads, and is an INTERNAL FEATURE implemented for the kubelet check :param input_get: ...
[ "def", "_text_filter_input", "(", "self", ",", "input_gen", ")", ":", "for", "line", "in", "input_gen", ":", "for", "item", "in", "self", ".", "_text_filter_blacklist", ":", "if", "item", "in", "line", ":", "break", "else", ":", "# No blacklist matches, passin...
Filters out the text input line by line to avoid parsing and processing metrics we know we don't want to process. This only works on `text/plain` payloads, and is an INTERNAL FEATURE implemented for the kubelet check :param input_get: line generator :output: generator of filtered lines
[ "Filters", "out", "the", "text", "input", "line", "by", "line", "to", "avoid", "parsing", "and", "processing", "metrics", "we", "know", "we", "don", "t", "want", "to", "process", ".", "This", "only", "works", "on", "text", "/", "plain", "payloads", "and"...
python
train
Ezhil-Language-Foundation/open-tamil
tamil/numeral.py
https://github.com/Ezhil-Language-Foundation/open-tamil/blob/b7556e88878d29bbc6c944ee17cdd3f75b8ea9f0/tamil/numeral.py#L216-L317
def num2tamilstr_american( *args ): number = args[0] """ work till 1000 trillion - 1 - i.e = 1e12*1e3 - 1. turn number into a numeral, American style. Fractions upto 1e-30. """ if not any( filter( lambda T: isinstance( number, T), [int, str, unicode, long, float]) ) or isinstance(number,complex):...
[ "def", "num2tamilstr_american", "(", "*", "args", ")", ":", "number", "=", "args", "[", "0", "]", "if", "not", "any", "(", "filter", "(", "lambda", "T", ":", "isinstance", "(", "number", ",", "T", ")", ",", "[", "int", ",", "str", ",", "unicode", ...
work till 1000 trillion - 1 - i.e = 1e12*1e3 - 1. turn number into a numeral, American style. Fractions upto 1e-30.
[ "work", "till", "1000", "trillion", "-", "1", "-", "i", ".", "e", "=", "1e12", "*", "1e3", "-", "1", ".", "turn", "number", "into", "a", "numeral", "American", "style", ".", "Fractions", "upto", "1e", "-", "30", "." ]
python
train
aio-libs/aiomcache
aiomcache/client.py
https://github.com/aio-libs/aiomcache/blob/75d44b201aea91bc2856b10940922d5ebfbfcd7b/aiomcache/client.py#L240-L253
def set(self, conn, key, value, exptime=0): """Sets a key to a value on the server with an optional exptime (0 means don't auto-expire) :param key: ``bytes``, is the key of the item. :param value: ``bytes``, data to store. :param exptime: ``int``, is expiration time. If it's 0, ...
[ "def", "set", "(", "self", ",", "conn", ",", "key", ",", "value", ",", "exptime", "=", "0", ")", ":", "flags", "=", "0", "# TODO: fix when exception removed", "resp", "=", "yield", "from", "self", ".", "_storage_command", "(", "conn", ",", "b'set'", ",",...
Sets a key to a value on the server with an optional exptime (0 means don't auto-expire) :param key: ``bytes``, is the key of the item. :param value: ``bytes``, data to store. :param exptime: ``int``, is expiration time. If it's 0, the item never expires. :return: ``bool...
[ "Sets", "a", "key", "to", "a", "value", "on", "the", "server", "with", "an", "optional", "exptime", "(", "0", "means", "don", "t", "auto", "-", "expire", ")" ]
python
train
bmihelac/django-cruds
cruds/urls.py
https://github.com/bmihelac/django-cruds/blob/7828aac3eb2b4c02e5f3843c4cbff654d57cf1e7/cruds/urls.py#L112-L122
def crud_for_app(app_label, urlprefix=None): """ Returns list of ``url`` items to CRUD an app. """ if urlprefix is None: urlprefix = app_label + '/' app = apps.get_app_config(app_label) urls = [] for model in app.get_models(): urls += crud_for_model(model, urlprefix) retu...
[ "def", "crud_for_app", "(", "app_label", ",", "urlprefix", "=", "None", ")", ":", "if", "urlprefix", "is", "None", ":", "urlprefix", "=", "app_label", "+", "'/'", "app", "=", "apps", ".", "get_app_config", "(", "app_label", ")", "urls", "=", "[", "]", ...
Returns list of ``url`` items to CRUD an app.
[ "Returns", "list", "of", "url", "items", "to", "CRUD", "an", "app", "." ]
python
train
Kronuz/pyScss
scss/extension/compass/helpers.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/compass/helpers.py#L87-L96
def reject(lst, *values): """Removes the given values from the list""" lst = List.from_maybe(lst) values = frozenset(List.from_maybe_starargs(values)) ret = [] for item in lst: if item not in values: ret.append(item) return List(ret, use_comma=lst.use_comma)
[ "def", "reject", "(", "lst", ",", "*", "values", ")", ":", "lst", "=", "List", ".", "from_maybe", "(", "lst", ")", "values", "=", "frozenset", "(", "List", ".", "from_maybe_starargs", "(", "values", ")", ")", "ret", "=", "[", "]", "for", "item", "i...
Removes the given values from the list
[ "Removes", "the", "given", "values", "from", "the", "list" ]
python
train
timothydmorton/isochrones
isochrones/mist/grid.py
https://github.com/timothydmorton/isochrones/blob/d84495573044c66db2fd6b959fe69e370757ea14/isochrones/mist/grid.py#L92-L147
def get_band(cls, b, **kwargs): """Defines what a "shortcut" band name refers to. Returns phot_system, band """ phot = None # Default to SDSS for these if b in ['u','g','r','i','z']: phot = 'SDSS' band = 'SDSS_{}'.format(b) elif b in ['U','B','V...
[ "def", "get_band", "(", "cls", ",", "b", ",", "*", "*", "kwargs", ")", ":", "phot", "=", "None", "# Default to SDSS for these", "if", "b", "in", "[", "'u'", ",", "'g'", ",", "'r'", ",", "'i'", ",", "'z'", "]", ":", "phot", "=", "'SDSS'", "band", ...
Defines what a "shortcut" band name refers to. Returns phot_system, band
[ "Defines", "what", "a", "shortcut", "band", "name", "refers", "to", ".", "Returns", "phot_system", "band" ]
python
train
senaite/senaite.core
bika/lims/exportimport/instruments/panalytical/omnia/__init__.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/panalytical/omnia/__init__.py#L61-L118
def parse_headerline(self, line): #Process incoming header line """11/03/2014 14:46:46 PANalytical Results quantitative - Omnian 2013, Selected archive:,Omnian 2013 Number of results selected:,4 """ # Save each header field (that we know) and its...
[ "def", "parse_headerline", "(", "self", ",", "line", ")", ":", "#Process incoming header line", "# Save each header field (that we know) and its own value in the dict ", "if", "line", ".", "startswith", "(", "'Results quantitative'", ")", ":", "line", "=", "to_unicode"...
11/03/2014 14:46:46 PANalytical Results quantitative - Omnian 2013, Selected archive:,Omnian 2013 Number of results selected:,4
[ "11", "/", "03", "/", "2014", "14", ":", "46", ":", "46", "PANalytical", "Results", "quantitative", "-", "Omnian", "2013" ]
python
train
101Loop/drf-addons
drfaddons/utils.py
https://github.com/101Loop/drf-addons/blob/62392c72e8bce237f4140a2b7171e89984cb15c5/drfaddons/utils.py#L105-L123
def get_mobile_number(mobile): """ Returns a mobile number after removing blanks Author: Himanshu Shankar (https://himanshus.com) Parameters ---------- mobile: str Returns ------- str """ blanks = [' ', '.', ',', '(', ')', '-'] for b in blanks: mobile = mobile....
[ "def", "get_mobile_number", "(", "mobile", ")", ":", "blanks", "=", "[", "' '", ",", "'.'", ",", "','", ",", "'('", ",", "')'", ",", "'-'", "]", "for", "b", "in", "blanks", ":", "mobile", "=", "mobile", ".", "replace", "(", "b", ",", "''", ")", ...
Returns a mobile number after removing blanks Author: Himanshu Shankar (https://himanshus.com) Parameters ---------- mobile: str Returns ------- str
[ "Returns", "a", "mobile", "number", "after", "removing", "blanks" ]
python
train
fy0/slim
slim_cli/template/model/user.py
https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim_cli/template/model/user.py#L91-L96
def set_password(self, new_password): """ 设置密码 """ info = self.gen_password_and_salt(new_password) self.password = info['password'] self.salt = info['salt'] self.save()
[ "def", "set_password", "(", "self", ",", "new_password", ")", ":", "info", "=", "self", ".", "gen_password_and_salt", "(", "new_password", ")", "self", ".", "password", "=", "info", "[", "'password'", "]", "self", ".", "salt", "=", "info", "[", "'salt'", ...
设置密码
[ "设置密码" ]
python
valid
h2oai/h2o-3
h2o-py/h2o/assembly.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/assembly.py#L131-L142
def fit(self, fr): """ To perform the munging operations on a frame specified in steps on the frame fr. :param fr: H2OFrame where munging operations are to be performed on. :return: H2OFrame after munging operations are completed. """ assert_is_type(fr, H2OFrame) ...
[ "def", "fit", "(", "self", ",", "fr", ")", ":", "assert_is_type", "(", "fr", ",", "H2OFrame", ")", "steps", "=", "\"[%s]\"", "%", "\",\"", ".", "join", "(", "quoted", "(", "step", "[", "1", "]", ".", "to_rest", "(", "step", "[", "0", "]", ")", ...
To perform the munging operations on a frame specified in steps on the frame fr. :param fr: H2OFrame where munging operations are to be performed on. :return: H2OFrame after munging operations are completed.
[ "To", "perform", "the", "munging", "operations", "on", "a", "frame", "specified", "in", "steps", "on", "the", "frame", "fr", "." ]
python
test
synw/dataswim
dataswim/maps/__init__.py
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/maps/__init__.py#L13-L22
def tmarker(self, lat, long, text, color=None, icon=None, style=None): """ Returns the map with a text marker to the default map """ try: self.dsmap = self._marker( lat, long, text, self.dsmap, color, icon, True, style) return self.dsmap ex...
[ "def", "tmarker", "(", "self", ",", "lat", ",", "long", ",", "text", ",", "color", "=", "None", ",", "icon", "=", "None", ",", "style", "=", "None", ")", ":", "try", ":", "self", ".", "dsmap", "=", "self", ".", "_marker", "(", "lat", ",", "long...
Returns the map with a text marker to the default map
[ "Returns", "the", "map", "with", "a", "text", "marker", "to", "the", "default", "map" ]
python
train
mosdef-hub/mbuild
mbuild/compound.py
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/compound.py#L1806-L1821
def spin(self, theta, around): """Rotate Compound in place around an arbitrary vector. Parameters ---------- theta : float The angle by which to rotate the Compound, in radians. around : np.ndarray, shape=(3,), dtype=float The axis about which to spin the...
[ "def", "spin", "(", "self", ",", "theta", ",", "around", ")", ":", "around", "=", "np", ".", "asarray", "(", "around", ")", ".", "reshape", "(", "3", ")", "center_pos", "=", "self", ".", "center", "self", ".", "translate", "(", "-", "center_pos", "...
Rotate Compound in place around an arbitrary vector. Parameters ---------- theta : float The angle by which to rotate the Compound, in radians. around : np.ndarray, shape=(3,), dtype=float The axis about which to spin the Compound.
[ "Rotate", "Compound", "in", "place", "around", "an", "arbitrary", "vector", "." ]
python
train
zhmcclient/python-zhmcclient
zhmcclient_mock/_urihandler.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient_mock/_urihandler.py#L888-L903
def get(method, hmc, uri, uri_parms, logon_required): """Operation: List LDAP Server Definitions.""" query_str = uri_parms[0] try: console = hmc.consoles.lookup_by_oid(None) except KeyError: raise InvalidResourceError(method, uri) result_ldap_srv_defs = []...
[ "def", "get", "(", "method", ",", "hmc", ",", "uri", ",", "uri_parms", ",", "logon_required", ")", ":", "query_str", "=", "uri_parms", "[", "0", "]", "try", ":", "console", "=", "hmc", ".", "consoles", ".", "lookup_by_oid", "(", "None", ")", "except", ...
Operation: List LDAP Server Definitions.
[ "Operation", ":", "List", "LDAP", "Server", "Definitions", "." ]
python
train
wadda/gps3
gps3/gps3.py
https://github.com/wadda/gps3/blob/91adcd7073b891b135b2a46d039ce2125cf09a09/gps3/gps3.py#L50-L64
def connect(self, host=HOST, port=GPSD_PORT): """Connect to a host on a given port. Arguments: host: default host='127.0.0.1' port: default port=2947 """ for alotta_stuff in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): family, socktype, proto...
[ "def", "connect", "(", "self", ",", "host", "=", "HOST", ",", "port", "=", "GPSD_PORT", ")", ":", "for", "alotta_stuff", "in", "socket", ".", "getaddrinfo", "(", "host", ",", "port", ",", "0", ",", "socket", ".", "SOCK_STREAM", ")", ":", "family", ",...
Connect to a host on a given port. Arguments: host: default host='127.0.0.1' port: default port=2947
[ "Connect", "to", "a", "host", "on", "a", "given", "port", ".", "Arguments", ":", "host", ":", "default", "host", "=", "127", ".", "0", ".", "0", ".", "1", "port", ":", "default", "port", "=", "2947" ]
python
train
xtuml/pyxtuml
xtuml/meta.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/meta.py#L1053-L1061
def delete(instance, disconnect=True): ''' Delete an *instance* from its metaclass instance pool and optionally *disconnect* it from any links it might be connected to. ''' if not isinstance(instance, Class): raise DeleteException("the provided argument is not an xtuml instance") ...
[ "def", "delete", "(", "instance", ",", "disconnect", "=", "True", ")", ":", "if", "not", "isinstance", "(", "instance", ",", "Class", ")", ":", "raise", "DeleteException", "(", "\"the provided argument is not an xtuml instance\"", ")", "return", "get_metaclass", "...
Delete an *instance* from its metaclass instance pool and optionally *disconnect* it from any links it might be connected to.
[ "Delete", "an", "*", "instance", "*", "from", "its", "metaclass", "instance", "pool", "and", "optionally", "*", "disconnect", "*", "it", "from", "any", "links", "it", "might", "be", "connected", "to", "." ]
python
test
bitesofcode/projexui
projexui/widgets/xorbbrowserwidget/xorbquerywidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbbrowserwidget/xorbquerywidget.py#L267-L279
def columnType( self ): """ Returns the column type for this item based on the current column. :return <orb.ColumnType> """ schema = self.treeWidget().parent().schema() if ( not schema ): return 0 column = schema.column(self.text(...
[ "def", "columnType", "(", "self", ")", ":", "schema", "=", "self", ".", "treeWidget", "(", ")", ".", "parent", "(", ")", ".", "schema", "(", ")", "if", "(", "not", "schema", ")", ":", "return", "0", "column", "=", "schema", ".", "column", "(", "s...
Returns the column type for this item based on the current column. :return <orb.ColumnType>
[ "Returns", "the", "column", "type", "for", "this", "item", "based", "on", "the", "current", "column", ".", ":", "return", "<orb", ".", "ColumnType", ">" ]
python
train
tensorflow/tensorboard
tensorboard/plugins/custom_scalar/custom_scalars_plugin.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/custom_scalar/custom_scalars_plugin.py#L244-L258
def layout_route(self, request): r"""Fetches the custom layout specified by the config file in the logdir. If more than 1 run contains a layout, this method merges the layouts by merging charts within individual categories. If 2 categories with the same name are found, the charts within are merged. The...
[ "def", "layout_route", "(", "self", ",", "request", ")", ":", "body", "=", "self", ".", "layout_impl", "(", ")", "return", "http_util", ".", "Respond", "(", "request", ",", "body", ",", "'application/json'", ")" ]
r"""Fetches the custom layout specified by the config file in the logdir. If more than 1 run contains a layout, this method merges the layouts by merging charts within individual categories. If 2 categories with the same name are found, the charts within are merged. The merging is based on the order of...
[ "r", "Fetches", "the", "custom", "layout", "specified", "by", "the", "config", "file", "in", "the", "logdir", "." ]
python
train
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/client.py#L878-L888
def revoke_admin_privileges(self, username): """Revoke cluster administration privileges from a user. :param username: the username to revoke privileges from :type username: str .. note:: Only a cluster administrator can create/ drop databases and manage users. """ ...
[ "def", "revoke_admin_privileges", "(", "self", ",", "username", ")", ":", "text", "=", "\"REVOKE ALL PRIVILEGES FROM {0}\"", ".", "format", "(", "quote_ident", "(", "username", ")", ")", "self", ".", "query", "(", "text", ",", "method", "=", "\"POST\"", ")" ]
Revoke cluster administration privileges from a user. :param username: the username to revoke privileges from :type username: str .. note:: Only a cluster administrator can create/ drop databases and manage users.
[ "Revoke", "cluster", "administration", "privileges", "from", "a", "user", "." ]
python
train
rochacbruno/python-pagseguro
pagseguro/__init__.py
https://github.com/rochacbruno/python-pagseguro/blob/18a9ca3301783cb323e838574b59f9ddffa9a593/pagseguro/__init__.py#L255-L258
def check_transaction(self, code): """ check a transaction by its code """ response = self.get(url=self.config.TRANSACTION_URL % code) return PagSeguroNotificationResponse(response.content, self.config)
[ "def", "check_transaction", "(", "self", ",", "code", ")", ":", "response", "=", "self", ".", "get", "(", "url", "=", "self", ".", "config", ".", "TRANSACTION_URL", "%", "code", ")", "return", "PagSeguroNotificationResponse", "(", "response", ".", "content",...
check a transaction by its code
[ "check", "a", "transaction", "by", "its", "code" ]
python
train
juju/python-libjuju
juju/client/_client3.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/_client3.py#L5690-L5707
async def CreatePool(self, attrs, name, provider): ''' attrs : typing.Mapping[str, typing.Any] name : str provider : str Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Storage', request='Create...
[ "async", "def", "CreatePool", "(", "self", ",", "attrs", ",", "name", ",", "provider", ")", ":", "# map input types to rpc msg", "_params", "=", "dict", "(", ")", "msg", "=", "dict", "(", "type", "=", "'Storage'", ",", "request", "=", "'CreatePool'", ",", ...
attrs : typing.Mapping[str, typing.Any] name : str provider : str Returns -> None
[ "attrs", ":", "typing", ".", "Mapping", "[", "str", "typing", ".", "Any", "]", "name", ":", "str", "provider", ":", "str", "Returns", "-", ">", "None" ]
python
train
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_watcher.py
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_watcher.py#L155-L183
def _HandleMetadataUpdate( self, metadata_key='', recursive=True, wait=True, timeout=None, retry=True): """Wait for a successful metadata response. Args: metadata_key: string, the metadata key to watch for changes. recursive: bool, True if we should recursively watch for metadata change...
[ "def", "_HandleMetadataUpdate", "(", "self", ",", "metadata_key", "=", "''", ",", "recursive", "=", "True", ",", "wait", "=", "True", ",", "timeout", "=", "None", ",", "retry", "=", "True", ")", ":", "exception", "=", "None", "while", "True", ":", "try...
Wait for a successful metadata response. Args: metadata_key: string, the metadata key to watch for changes. recursive: bool, True if we should recursively watch for metadata changes. wait: bool, True if we should wait for a metadata change. timeout: int, timeout in seconds for returning met...
[ "Wait", "for", "a", "successful", "metadata", "response", "." ]
python
train
inspirehep/harvesting-kit
harvestingkit/etree_utils.py
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/etree_utils.py#L60-L81
def element_tree_collection_to_records(tree): """Take an ElementTree and converts the nodes into BibRecord records. This function is for a tree root of collection as such: <collection> <record> <!-- MARCXML --> </record> <record> ... </record> </collection> """ ...
[ "def", "element_tree_collection_to_records", "(", "tree", ")", ":", "from", ".", "bibrecord", "import", "create_record", "records", "=", "[", "]", "collection", "=", "tree", ".", "getroot", "(", ")", "for", "record_element", "in", "collection", ".", "getchildren...
Take an ElementTree and converts the nodes into BibRecord records. This function is for a tree root of collection as such: <collection> <record> <!-- MARCXML --> </record> <record> ... </record> </collection>
[ "Take", "an", "ElementTree", "and", "converts", "the", "nodes", "into", "BibRecord", "records", "." ]
python
valid
astrorafael/twisted-mqtt
mqtt/client/base.py
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/client/base.py#L138-L143
def handleCONNACK(self, response): ''' Handles CONNACK packet from the server ''' state = self.__class__.__name__ log.error("Unexpected {packet:7} packet received in {log_source}", packet="CONNACK")
[ "def", "handleCONNACK", "(", "self", ",", "response", ")", ":", "state", "=", "self", ".", "__class__", ".", "__name__", "log", ".", "error", "(", "\"Unexpected {packet:7} packet received in {log_source}\"", ",", "packet", "=", "\"CONNACK\"", ")" ]
Handles CONNACK packet from the server
[ "Handles", "CONNACK", "packet", "from", "the", "server" ]
python
test
ubccr/pinky
pinky/perception/aromaticity.py
https://github.com/ubccr/pinky/blob/e9d6e8ff72aa7f670b591e3bd3629cb879db1a93/pinky/perception/aromaticity.py#L78-L88
def getPyroleLikeAtoms(cycle): """cycle->return a dictionary of pyrole nitrogen-like atoms in a cycle or a molecule The dictionary is keyed on the atom.handle""" result = {} # the outgoing bonds might need to be single or aromatic for atom in cycle.atoms: lookup = (atom.symbol, atom.cha...
[ "def", "getPyroleLikeAtoms", "(", "cycle", ")", ":", "result", "=", "{", "}", "# the outgoing bonds might need to be single or aromatic", "for", "atom", "in", "cycle", ".", "atoms", ":", "lookup", "=", "(", "atom", ".", "symbol", ",", "atom", ".", "charge", ",...
cycle->return a dictionary of pyrole nitrogen-like atoms in a cycle or a molecule The dictionary is keyed on the atom.handle
[ "cycle", "-", ">", "return", "a", "dictionary", "of", "pyrole", "nitrogen", "-", "like", "atoms", "in", "a", "cycle", "or", "a", "molecule", "The", "dictionary", "is", "keyed", "on", "the", "atom", ".", "handle" ]
python
train
gmr/rejected
rejected/statsd.py
https://github.com/gmr/rejected/blob/610a3e1401122ecb98d891b6795cca0255e5b044/rejected/statsd.py#L109-L117
def _build_payload(self, key, value, metric_type): """Return the """ if self._setting('include_hostname', True): return self.PAYLOAD_HOSTNAME.format( self._prefix, self._hostname, self._consumer_name, key, value, metric_type) return self.PAYLOAD_NO_HOS...
[ "def", "_build_payload", "(", "self", ",", "key", ",", "value", ",", "metric_type", ")", ":", "if", "self", ".", "_setting", "(", "'include_hostname'", ",", "True", ")", ":", "return", "self", ".", "PAYLOAD_HOSTNAME", ".", "format", "(", "self", ".", "_p...
Return the
[ "Return", "the" ]
python
train
SavinaRoja/PyUserInput
pykeyboard/base.py
https://github.com/SavinaRoja/PyUserInput/blob/153c1d39b1a41b467b235fd182392d6dcbf07947/pykeyboard/base.py#L47-L52
def press_keys(self,characters=[]): """Press a given character key.""" for character in characters: self.press_key(character) for character in characters: self.release_key(character)
[ "def", "press_keys", "(", "self", ",", "characters", "=", "[", "]", ")", ":", "for", "character", "in", "characters", ":", "self", ".", "press_key", "(", "character", ")", "for", "character", "in", "characters", ":", "self", ".", "release_key", "(", "cha...
Press a given character key.
[ "Press", "a", "given", "character", "key", "." ]
python
train
aestrivex/bctpy
bct/algorithms/similarity.py
https://github.com/aestrivex/bctpy/blob/4cb0e759eb4a038750b07e23bd29958c400684b8/bct/algorithms/similarity.py#L167-L245
def matching_ind(CIJ): ''' For any two nodes u and v, the matching index computes the amount of overlap in the connection patterns of u and v. Self-connections and u-v connections are ignored. The matching index is a symmetric quantity, similar to a correlation or a dot product. Parameters ...
[ "def", "matching_ind", "(", "CIJ", ")", ":", "n", "=", "len", "(", "CIJ", ")", "Min", "=", "np", ".", "zeros", "(", "(", "n", ",", "n", ")", ")", "Mout", "=", "np", ".", "zeros", "(", "(", "n", ",", "n", ")", ")", "Mall", "=", "np", ".", ...
For any two nodes u and v, the matching index computes the amount of overlap in the connection patterns of u and v. Self-connections and u-v connections are ignored. The matching index is a symmetric quantity, similar to a correlation or a dot product. Parameters ---------- CIJ : NxN np.ndarray...
[ "For", "any", "two", "nodes", "u", "and", "v", "the", "matching", "index", "computes", "the", "amount", "of", "overlap", "in", "the", "connection", "patterns", "of", "u", "and", "v", ".", "Self", "-", "connections", "and", "u", "-", "v", "connections", ...
python
train
KelSolaar/Foundations
foundations/namespace.py
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/namespace.py#L146-L163
def get_leaf(attribute, namespace_splitter=NAMESPACE_SPLITTER): """ Returns given attribute leaf. Usage:: >>> get_leaf("grandParent|parent|child") u'child' :param attribute: Attribute. :type attribute: unicode :param namespace_splitter: Namespace splitter character. :type ...
[ "def", "get_leaf", "(", "attribute", ",", "namespace_splitter", "=", "NAMESPACE_SPLITTER", ")", ":", "return", "foundations", ".", "common", ".", "get_last_item", "(", "attribute", ".", "split", "(", "namespace_splitter", ")", ")" ]
Returns given attribute leaf. Usage:: >>> get_leaf("grandParent|parent|child") u'child' :param attribute: Attribute. :type attribute: unicode :param namespace_splitter: Namespace splitter character. :type namespace_splitter: unicode :return: Attribute foundations.namespace. ...
[ "Returns", "given", "attribute", "leaf", "." ]
python
train
apache/incubator-mxnet
example/rnn/large_word_lm/custom_module.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/rnn/large_word_lm/custom_module.py#L176-L183
def rescale_grad(self, scale=None, param_name=None): """ Rescale the gradient of provided parameters by a certain scale """ if scale is None or param_name is None: return param_idx = self._exec_group.param_names.index(param_name) grad_vals = self._exec_group.grad_arrays[param...
[ "def", "rescale_grad", "(", "self", ",", "scale", "=", "None", ",", "param_name", "=", "None", ")", ":", "if", "scale", "is", "None", "or", "param_name", "is", "None", ":", "return", "param_idx", "=", "self", ".", "_exec_group", ".", "param_names", ".", ...
Rescale the gradient of provided parameters by a certain scale
[ "Rescale", "the", "gradient", "of", "provided", "parameters", "by", "a", "certain", "scale" ]
python
train
squaresLab/BugZoo
bugzoo/mgr/container.py
https://github.com/squaresLab/BugZoo/blob/68664f1977e85b37a78604f7c570382ffae1fa3b/bugzoo/mgr/container.py#L296-L338
def patch(self, container: Container, p: Patch) -> bool: """ Attempts to apply a given patch to the source code for a program inside a given container. All patch applications are guaranteed to be atomic; if the patch fails to apply, no changes will be made to the relevant source ...
[ "def", "patch", "(", "self", ",", "container", ":", "Container", ",", "p", ":", "Patch", ")", "->", "bool", ":", "assert", "isinstance", "(", "p", ",", "Patch", ")", "file_container", "=", "None", "dockerc", "=", "self", ".", "__dockerc", "[", "contain...
Attempts to apply a given patch to the source code for a program inside a given container. All patch applications are guaranteed to be atomic; if the patch fails to apply, no changes will be made to the relevant source code files. Returns true if the patch application was successful, an...
[ "Attempts", "to", "apply", "a", "given", "patch", "to", "the", "source", "code", "for", "a", "program", "inside", "a", "given", "container", ".", "All", "patch", "applications", "are", "guaranteed", "to", "be", "atomic", ";", "if", "the", "patch", "fails",...
python
train
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L68-L77
def add(self, pubkey): """ add a public key. :param pubkey: the filename to the public key :return: """ f = get_fingerprint_from_public_key(pubkey) if f not in self._keys: self._order[len(self._keys)] = f self._keys[f] = pubkey
[ "def", "add", "(", "self", ",", "pubkey", ")", ":", "f", "=", "get_fingerprint_from_public_key", "(", "pubkey", ")", "if", "f", "not", "in", "self", ".", "_keys", ":", "self", ".", "_order", "[", "len", "(", "self", ".", "_keys", ")", "]", "=", "f"...
add a public key. :param pubkey: the filename to the public key :return:
[ "add", "a", "public", "key", ".", ":", "param", "pubkey", ":", "the", "filename", "to", "the", "public", "key", ":", "return", ":" ]
python
train
pygobject/pgi
pgi/module.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/module.py#L100-L135
def get_introspection_module(namespace): """Raises ImportError""" if namespace in _introspection_modules: return _introspection_modules[namespace] from . import get_required_version repository = GIRepository() version = get_required_version(namespace) try: repository.require(...
[ "def", "get_introspection_module", "(", "namespace", ")", ":", "if", "namespace", "in", "_introspection_modules", ":", "return", "_introspection_modules", "[", "namespace", "]", "from", ".", "import", "get_required_version", "repository", "=", "GIRepository", "(", ")"...
Raises ImportError
[ "Raises", "ImportError" ]
python
train
scot-dev/scot
scot/connectivity_statistics.py
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity_statistics.py#L252-L295
def significance_fdr(p, alpha): """Calculate significance by controlling for the false discovery rate. This function determines which of the p-values in `p` can be considered significant. Correction for multiple comparisons is performed by controlling the false discovery rate (FDR). The FDR is the maxi...
[ "def", "significance_fdr", "(", "p", ",", "alpha", ")", ":", "i", "=", "np", ".", "argsort", "(", "p", ",", "axis", "=", "None", ")", "m", "=", "i", ".", "size", "-", "np", ".", "sum", "(", "np", ".", "isnan", "(", "p", ")", ")", "j", "=", ...
Calculate significance by controlling for the false discovery rate. This function determines which of the p-values in `p` can be considered significant. Correction for multiple comparisons is performed by controlling the false discovery rate (FDR). The FDR is the maximum fraction of p-values that are w...
[ "Calculate", "significance", "by", "controlling", "for", "the", "false", "discovery", "rate", "." ]
python
train
Netflix-Skunkworks/historical
historical/common/cloudwatch.py
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/cloudwatch.py#L14-L33
def filter_request_parameters(field_name, msg, look_in_response=False): """ From an event, extract the field name from the message. Different API calls put this information in different places, so check a few places. """ val = msg['detail'].get(field_name, None) try: if not val: ...
[ "def", "filter_request_parameters", "(", "field_name", ",", "msg", ",", "look_in_response", "=", "False", ")", ":", "val", "=", "msg", "[", "'detail'", "]", ".", "get", "(", "field_name", ",", "None", ")", "try", ":", "if", "not", "val", ":", "val", "=...
From an event, extract the field name from the message. Different API calls put this information in different places, so check a few places.
[ "From", "an", "event", "extract", "the", "field", "name", "from", "the", "message", ".", "Different", "API", "calls", "put", "this", "information", "in", "different", "places", "so", "check", "a", "few", "places", "." ]
python
train
limpyd/redis-limpyd-jobs
limpyd_jobs/workers.py
https://github.com/limpyd/redis-limpyd-jobs/blob/264c71029bad4377d6132bf8bb9c55c44f3b03a2/limpyd_jobs/workers.py#L254-L274
def catch_end_signal(self, signum, frame): """ When a SIGINT/SIGTERM signal is caught, this method is called, asking for the worker to terminate as soon as possible. """ if self.end_signal_caught: self.log('Previous signal caught, will end soon') return ...
[ "def", "catch_end_signal", "(", "self", ",", "signum", ",", "frame", ")", ":", "if", "self", ".", "end_signal_caught", ":", "self", ".", "log", "(", "'Previous signal caught, will end soon'", ")", "return", "signal_name", "=", "dict", "(", "(", "getattr", "(",...
When a SIGINT/SIGTERM signal is caught, this method is called, asking for the worker to terminate as soon as possible.
[ "When", "a", "SIGINT", "/", "SIGTERM", "signal", "is", "caught", "this", "method", "is", "called", "asking", "for", "the", "worker", "to", "terminate", "as", "soon", "as", "possible", "." ]
python
train
inspirehep/harvesting-kit
harvestingkit/inspire_cds_package/base.py
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/inspire_cds_package/base.py#L194-L198
def add_control_number(self, tag, value): """Add a control-number 00x for given tag with value.""" record_add_field(self.record, tag, controlfield_value=value)
[ "def", "add_control_number", "(", "self", ",", "tag", ",", "value", ")", ":", "record_add_field", "(", "self", ".", "record", ",", "tag", ",", "controlfield_value", "=", "value", ")" ]
Add a control-number 00x for given tag with value.
[ "Add", "a", "control", "-", "number", "00x", "for", "given", "tag", "with", "value", "." ]
python
valid
numenta/htmresearch
htmresearch/algorithms/TM.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/algorithms/TM.py#L1672-L1680
def getSegmentActivityLevel(self, seg, activeState, connectedSynapsesOnly =False): """This routine computes the activity level of a segment given activeState. It can tally up only connected synapses (permanence >= connectedPerm), or all the synapses of the segment, at either t or t-1. """ # todo: C...
[ "def", "getSegmentActivityLevel", "(", "self", ",", "seg", ",", "activeState", ",", "connectedSynapsesOnly", "=", "False", ")", ":", "# todo: Computing in C, use function getSegmentActivityLevel", "return", "getSegmentActivityLevel", "(", "seg", ".", "syns", ",", "activeS...
This routine computes the activity level of a segment given activeState. It can tally up only connected synapses (permanence >= connectedPerm), or all the synapses of the segment, at either t or t-1.
[ "This", "routine", "computes", "the", "activity", "level", "of", "a", "segment", "given", "activeState", ".", "It", "can", "tally", "up", "only", "connected", "synapses", "(", "permanence", ">", "=", "connectedPerm", ")", "or", "all", "the", "synapses", "of"...
python
train
drkjam/pydba
pydba/postgres.py
https://github.com/drkjam/pydba/blob/986c4b1315d6b128947c3bc3494513d8e5380ff0/pydba/postgres.py#L243-L256
def connection_dsn(self, name=None): """ Provides a connection string for database. Parameters ---------- name: str, optional an override database name for the connection string. Returns ------- str: the connection string (e.g. 'dbname=db1 us...
[ "def", "connection_dsn", "(", "self", ",", "name", "=", "None", ")", ":", "return", "' '", ".", "join", "(", "\"%s=%s\"", "%", "(", "param", ",", "value", ")", "for", "param", ",", "value", "in", "self", ".", "_connect_options", "(", "name", ")", ")"...
Provides a connection string for database. Parameters ---------- name: str, optional an override database name for the connection string. Returns ------- str: the connection string (e.g. 'dbname=db1 user=user1 host=localhost port=5432')
[ "Provides", "a", "connection", "string", "for", "database", "." ]
python
valid
fake-name/ChromeController
ChromeController/manager.py
https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L527-L546
def get_unpacked_response_body(self, requestId, mimetype="application/unknown"): ''' Return a unpacked, decoded resposne body from Network_getResponseBody() ''' content = self.Network_getResponseBody(requestId) assert 'result' in content result = content['result'] assert 'base64Encoded' in result asse...
[ "def", "get_unpacked_response_body", "(", "self", ",", "requestId", ",", "mimetype", "=", "\"application/unknown\"", ")", ":", "content", "=", "self", ".", "Network_getResponseBody", "(", "requestId", ")", "assert", "'result'", "in", "content", "result", "=", "con...
Return a unpacked, decoded resposne body from Network_getResponseBody()
[ "Return", "a", "unpacked", "decoded", "resposne", "body", "from", "Network_getResponseBody", "()" ]
python
train
ninuxorg/nodeshot
nodeshot/interop/sync/models/node_external.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/interop/sync/models/node_external.py#L36-L44
def save_external_nodes(sender, **kwargs): """ sync by creating nodes in external layers when needed """ node = kwargs['instance'] operation = 'add' if kwargs['created'] is True else 'change' if node.layer.is_external is False or not hasattr(node.layer, 'external') or node.layer.external.synchronizer_p...
[ "def", "save_external_nodes", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "node", "=", "kwargs", "[", "'instance'", "]", "operation", "=", "'add'", "if", "kwargs", "[", "'created'", "]", "is", "True", "else", "'change'", "if", "node", ".", "layer",...
sync by creating nodes in external layers when needed
[ "sync", "by", "creating", "nodes", "in", "external", "layers", "when", "needed" ]
python
train
StackStorm/pybind
pybind/slxos/v17r_1_01a/cpu_state/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/cpu_state/__init__.py#L252-L275
def _set_process_list(self, v, load=False): """ Setter method for process_list, mapped from YANG variable /cpu_state/process_list (container) If this variable is read-only (config: false) in the source YANG file, then _set_process_list is considered as a private method. Backends looking to populate ...
[ "def", "_set_process_list", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "b...
Setter method for process_list, mapped from YANG variable /cpu_state/process_list (container) If this variable is read-only (config: false) in the source YANG file, then _set_process_list is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_...
[ "Setter", "method", "for", "process_list", "mapped", "from", "YANG", "variable", "/", "cpu_state", "/", "process_list", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YA...
python
train
slimkrazy/python-google-places
googleplaces/__init__.py
https://github.com/slimkrazy/python-google-places/blob/d4b7363e1655cdc091a6253379f6d2a95b827881/googleplaces/__init__.py#L893-L897
def icon(self): """Returns the URL of a recommended icon for display.""" if self._icon == '' and self.details != None and 'icon' in self.details: self._icon = self.details['icon'] return self._icon
[ "def", "icon", "(", "self", ")", ":", "if", "self", ".", "_icon", "==", "''", "and", "self", ".", "details", "!=", "None", "and", "'icon'", "in", "self", ".", "details", ":", "self", ".", "_icon", "=", "self", ".", "details", "[", "'icon'", "]", ...
Returns the URL of a recommended icon for display.
[ "Returns", "the", "URL", "of", "a", "recommended", "icon", "for", "display", "." ]
python
train
e7dal/bubble3
bubble3/commands/cmd_init.py
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_init.py#L28-L92
def cli(ctx, given_name, demo): """Initializes a bubble.""" path = None if path is None: path = ctx.home bubble_file_name = path + '/.bubble' config_file = path + '/config/config.yaml' if os.path.exists(bubble_file_name) and os.path.isfile(bubble_file_name): ctx....
[ "def", "cli", "(", "ctx", ",", "given_name", ",", "demo", ")", ":", "path", "=", "None", "if", "path", "is", "None", ":", "path", "=", "ctx", ".", "home", "bubble_file_name", "=", "path", "+", "'/.bubble'", "config_file", "=", "path", "+", "'/config/co...
Initializes a bubble.
[ "Initializes", "a", "bubble", "." ]
python
train
noxdafox/clipspy
clips/agenda.py
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/agenda.py#L366-L368
def salience(self, salience): """Activation salience value.""" lib.EnvSetActivationSalience(self._env, self._act, salience)
[ "def", "salience", "(", "self", ",", "salience", ")", ":", "lib", ".", "EnvSetActivationSalience", "(", "self", ".", "_env", ",", "self", ".", "_act", ",", "salience", ")" ]
Activation salience value.
[ "Activation", "salience", "value", "." ]
python
train
bunq/sdk_python
bunq/sdk/model/core.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/core.py#L507-L521
def get_referenced_user(self): """ :rtype: BunqModel """ if self._user_person is not None: return self._user_person if self._user_company is not None: return self._user_company if self._user_api_key is not None: return self._user_api...
[ "def", "get_referenced_user", "(", "self", ")", ":", "if", "self", ".", "_user_person", "is", "not", "None", ":", "return", "self", ".", "_user_person", "if", "self", ".", "_user_company", "is", "not", "None", ":", "return", "self", ".", "_user_company", "...
:rtype: BunqModel
[ ":", "rtype", ":", "BunqModel" ]
python
train
cloudify-cosmo/wagon
wagon.py
https://github.com/cloudify-cosmo/wagon/blob/9876d33a0aece01df2421a87e3b398d13f660fe6/wagon.py#L247-L282
def install_package(package, wheels_path, venv=None, requirement_files=None, upgrade=False, install_args=None): """Install a Python package. Can specify a specific version. Can specify a prerelease. Can ...
[ "def", "install_package", "(", "package", ",", "wheels_path", ",", "venv", "=", "None", ",", "requirement_files", "=", "None", ",", "upgrade", "=", "False", ",", "install_args", "=", "None", ")", ":", "requirement_files", "=", "requirement_files", "or", "[", ...
Install a Python package. Can specify a specific version. Can specify a prerelease. Can specify a venv to install in. Can specify a list of paths or urls to requirement txt files. Can specify a local wheels_path to use for offline installation. Can request an upgrade.
[ "Install", "a", "Python", "package", "." ]
python
train
consbio/ncdjango
ncdjango/geoprocessing/params.py
https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/geoprocessing/params.py#L394-L443
def clean(self, value): """Cleans and returns the given value, or raises a ParameterNotValidError exception""" if not isinstance(value, six.string_types): raise ParameterNotValidError try: source, value = value.split('://', 1) except ValueError: rais...
[ "def", "clean", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "raise", "ParameterNotValidError", "try", ":", "source", ",", "value", "=", "value", ".", "split", "(", "'://'", ",...
Cleans and returns the given value, or raises a ParameterNotValidError exception
[ "Cleans", "and", "returns", "the", "given", "value", "or", "raises", "a", "ParameterNotValidError", "exception" ]
python
train