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
spyder-ide/spyder
spyder/utils/vcs.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L100-L116
def get_hg_revision(repopath): """Return Mercurial revision for the repository located at repopath Result is a tuple (global, local, branch), with None values on error For example: >>> get_hg_revision(".") ('eba7273c69df+', '2015+', 'default') """ try: ass...
[ "def", "get_hg_revision", "(", "repopath", ")", ":", "try", ":", "assert", "osp", ".", "isdir", "(", "osp", ".", "join", "(", "repopath", ",", "'.hg'", ")", ")", "proc", "=", "programs", ".", "run_program", "(", "'hg'", ",", "[", "'id'", ",", "'-nib'...
Return Mercurial revision for the repository located at repopath Result is a tuple (global, local, branch), with None values on error For example: >>> get_hg_revision(".") ('eba7273c69df+', '2015+', 'default')
[ "Return", "Mercurial", "revision", "for", "the", "repository", "located", "at", "repopath", "Result", "is", "a", "tuple", "(", "global", "local", "branch", ")", "with", "None", "values", "on", "error", "For", "example", ":", ">>>", "get_hg_revision", "(", "....
python
train
PythonCharmers/python-future
src/future/backports/urllib/parse.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/parse.py#L292-L306
def urlparse(url, scheme='', allow_fragments=True): """Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> Return a 6-tuple: (scheme, netloc, path, params, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) ...
[ "def", "urlparse", "(", "url", ",", "scheme", "=", "''", ",", "allow_fragments", "=", "True", ")", ":", "url", ",", "scheme", ",", "_coerce_result", "=", "_coerce_args", "(", "url", ",", "scheme", ")", "splitresult", "=", "urlsplit", "(", "url", ",", "...
Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> Return a 6-tuple: (scheme, netloc, path, params, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.
[ "Parse", "a", "URL", "into", "6", "components", ":", "<scheme", ">", ":", "//", "<netloc", ">", "/", "<path", ">", ";", "<params", ">", "?<query", ">", "#<fragment", ">", "Return", "a", "6", "-", "tuple", ":", "(", "scheme", "netloc", "path", "params...
python
train
obriencj/python-javatools
javatools/__init__.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/__init__.py#L2294-L2309
def is_class(data): """ checks that the data (which is a string, buffer, or a stream supporting the read method) has the magic numbers indicating it is a Java class file. Returns False if the magic numbers do not match, or for any errors. """ try: with unpack(data) as up: ...
[ "def", "is_class", "(", "data", ")", ":", "try", ":", "with", "unpack", "(", "data", ")", "as", "up", ":", "magic", "=", "up", ".", "unpack_struct", "(", "_BBBB", ")", "return", "magic", "==", "JAVA_CLASS_MAGIC", "except", "UnpackException", ":", "return...
checks that the data (which is a string, buffer, or a stream supporting the read method) has the magic numbers indicating it is a Java class file. Returns False if the magic numbers do not match, or for any errors.
[ "checks", "that", "the", "data", "(", "which", "is", "a", "string", "buffer", "or", "a", "stream", "supporting", "the", "read", "method", ")", "has", "the", "magic", "numbers", "indicating", "it", "is", "a", "Java", "class", "file", ".", "Returns", "Fals...
python
train
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L4180-L4231
def path(self, which=None): """Extend ``nailgun.entity_mixins.Entity.path``. The format of the returned path depends on the value of ``which``: bulk/install_content /api/hosts/:host_id/bulk/install_content errata /api/hosts/:host_id/errata power ...
[ "def", "path", "(", "self", ",", "which", "=", "None", ")", ":", "if", "which", "in", "(", "'enc'", ",", "'errata'", ",", "'errata/apply'", ",", "'errata/applicability'", ",", "'facts'", ",", "'packages'", ",", "'power'", ",", "'puppetclass_ids'", ",", "'s...
Extend ``nailgun.entity_mixins.Entity.path``. The format of the returned path depends on the value of ``which``: bulk/install_content /api/hosts/:host_id/bulk/install_content errata /api/hosts/:host_id/errata power /api/hosts/:host_id/power er...
[ "Extend", "nailgun", ".", "entity_mixins", ".", "Entity", ".", "path", ".", "The", "format", "of", "the", "returned", "path", "depends", "on", "the", "value", "of", "which", ":" ]
python
train
wdecoster/nanogui
nanogui/nanoguis.py
https://github.com/wdecoster/nanogui/blob/78e4f8ca511c5ca9fd7ccd6ff03e8edd1a5db54d/nanogui/nanoguis.py#L454-L471
def validate_integer(self, action, index, value_if_allowed, prior_value, text, validation_type, trigger_type, widget_name): """Check if text Entry is valid (number). I have no idea what all these arguments are doing here but took this from https://stackoverflow.com/ques...
[ "def", "validate_integer", "(", "self", ",", "action", ",", "index", ",", "value_if_allowed", ",", "prior_value", ",", "text", ",", "validation_type", ",", "trigger_type", ",", "widget_name", ")", ":", "if", "(", "action", "==", "'1'", ")", ":", "if", "tex...
Check if text Entry is valid (number). I have no idea what all these arguments are doing here but took this from https://stackoverflow.com/questions/8959815/restricting-the-value-in-tkinter-entry-widget
[ "Check", "if", "text", "Entry", "is", "valid", "(", "number", ")", "." ]
python
test
tumblr/pytumblr
pytumblr/request.py
https://github.com/tumblr/pytumblr/blob/4a5cd7c4b8ae78d12811d9fd52620afa1692a415/pytumblr/request.py#L35-L53
def get(self, url, params): """ Issues a GET request against the API, properly formatting the params :param url: a string, the url you are requesting :param params: a dict, the key-value of all the paramaters needed in the request :returns: a dict parsed o...
[ "def", "get", "(", "self", ",", "url", ",", "params", ")", ":", "url", "=", "self", ".", "host", "+", "url", "if", "params", ":", "url", "=", "url", "+", "\"?\"", "+", "urllib", ".", "parse", ".", "urlencode", "(", "params", ")", "try", ":", "r...
Issues a GET request against the API, properly formatting the params :param url: a string, the url you are requesting :param params: a dict, the key-value of all the paramaters needed in the request :returns: a dict parsed of the JSON response
[ "Issues", "a", "GET", "request", "against", "the", "API", "properly", "formatting", "the", "params" ]
python
train
ctuning/ck
ck/repo/module/repo/module.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/repo/module/repo/module.py#L1792-L1972
def deps(i): """ Input: { (data_uoa) - repo UOA or (path) - path to .cmr.json (current_repos) - list of repos being updated (to avoid infinite recursion) (how) - 'pull' (default) or 'add' (version...
[ "def", "deps", "(", "i", ")", ":", "import", "os", "o", "=", "i", ".", "get", "(", "'out'", ",", "''", ")", "duoa", "=", "i", ".", "get", "(", "'data_uoa'", ",", "''", ")", "cr", "=", "i", ".", "get", "(", "'current_repos'", ",", "[", "]", ...
Input: { (data_uoa) - repo UOA or (path) - path to .cmr.json (current_repos) - list of repos being updated (to avoid infinite recursion) (how) - 'pull' (default) or 'add' (version) - checkout versio...
[ "Input", ":", "{", "(", "data_uoa", ")", "-", "repo", "UOA", "or", "(", "path", ")", "-", "path", "to", ".", "cmr", ".", "json" ]
python
train
rosenbrockc/fortpy
fortpy/interop/ftypes.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L290-L312
def _check_dir(self): """Makes sure that the working directory for the wrapper modules exists. """ from os import path, mkdir if not path.isdir(self.dirpath): mkdir(self.dirpath) #Copy the ftypes.py module shipped with fortpy to the local directory. ft...
[ "def", "_check_dir", "(", "self", ")", ":", "from", "os", "import", "path", ",", "mkdir", "if", "not", "path", ".", "isdir", "(", "self", ".", "dirpath", ")", ":", "mkdir", "(", "self", ".", "dirpath", ")", "#Copy the ftypes.py module shipped with fortpy to ...
Makes sure that the working directory for the wrapper modules exists.
[ "Makes", "sure", "that", "the", "working", "directory", "for", "the", "wrapper", "modules", "exists", "." ]
python
train
blue-yonder/tsfresh
tsfresh/feature_extraction/feature_calculators.py
https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L1135-L1148
def number_cwt_peaks(x, n): """ This feature calculator searches for different peaks in x. To do so, x is smoothed by a ricker wavelet and for widths ranging from 1 to n. This feature calculator returns the number of peaks that occur at enough width scales and with sufficiently high Signal-to-Noise-Rati...
[ "def", "number_cwt_peaks", "(", "x", ",", "n", ")", ":", "return", "len", "(", "find_peaks_cwt", "(", "vector", "=", "x", ",", "widths", "=", "np", ".", "array", "(", "list", "(", "range", "(", "1", ",", "n", "+", "1", ")", ")", ")", ",", "wave...
This feature calculator searches for different peaks in x. To do so, x is smoothed by a ricker wavelet and for widths ranging from 1 to n. This feature calculator returns the number of peaks that occur at enough width scales and with sufficiently high Signal-to-Noise-Ratio (SNR) :param x: the time series t...
[ "This", "feature", "calculator", "searches", "for", "different", "peaks", "in", "x", ".", "To", "do", "so", "x", "is", "smoothed", "by", "a", "ricker", "wavelet", "and", "for", "widths", "ranging", "from", "1", "to", "n", ".", "This", "feature", "calcula...
python
train
SavinaRoja/OpenAccess_EPUB
src/openaccess_epub/utils/inputs.py
https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/inputs.py#L69-L88
def url_input(url_string, download=True): """ This method expects a direct URL link to an xml file. It will apply no modifications to the received URL string, so ensure good input. """ log.debug('URL Input - {0}'.format(url_string)) try: open_xml = urllib.request.urlopen(url_string) ...
[ "def", "url_input", "(", "url_string", ",", "download", "=", "True", ")", ":", "log", ".", "debug", "(", "'URL Input - {0}'", ".", "format", "(", "url_string", ")", ")", "try", ":", "open_xml", "=", "urllib", ".", "request", ".", "urlopen", "(", "url_str...
This method expects a direct URL link to an xml file. It will apply no modifications to the received URL string, so ensure good input.
[ "This", "method", "expects", "a", "direct", "URL", "link", "to", "an", "xml", "file", ".", "It", "will", "apply", "no", "modifications", "to", "the", "received", "URL", "string", "so", "ensure", "good", "input", "." ]
python
train
Microsoft/knack
knack/cli.py
https://github.com/Microsoft/knack/blob/5f1a480a33f103e2688c46eef59fb2d9eaf2baad/knack/cli.py#L164-L170
def exception_handler(self, ex): # pylint: disable=no-self-use """ The default exception handler """ if isinstance(ex, CLIError): logger.error(ex) else: logger.exception(ex) return 1
[ "def", "exception_handler", "(", "self", ",", "ex", ")", ":", "# pylint: disable=no-self-use", "if", "isinstance", "(", "ex", ",", "CLIError", ")", ":", "logger", ".", "error", "(", "ex", ")", "else", ":", "logger", ".", "exception", "(", "ex", ")", "ret...
The default exception handler
[ "The", "default", "exception", "handler" ]
python
train
basho/riak-python-client
riak/codecs/http.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/codecs/http.py#L264-L277
def _parse_content_type(self, value): """ Split the content-type header into two parts: 1) Actual main/sub encoding type 2) charset :param value: Complete MIME content-type string """ content_type, params = parse_header(value) if 'charset' in params: ...
[ "def", "_parse_content_type", "(", "self", ",", "value", ")", ":", "content_type", ",", "params", "=", "parse_header", "(", "value", ")", "if", "'charset'", "in", "params", ":", "charset", "=", "params", "[", "'charset'", "]", "else", ":", "charset", "=", ...
Split the content-type header into two parts: 1) Actual main/sub encoding type 2) charset :param value: Complete MIME content-type string
[ "Split", "the", "content", "-", "type", "header", "into", "two", "parts", ":", "1", ")", "Actual", "main", "/", "sub", "encoding", "type", "2", ")", "charset" ]
python
train
pydot/pydot
pydot.py
https://github.com/pydot/pydot/blob/48ba231b36012c5e13611807c9aac7d8ae8c15c4/pydot.py#L654-L686
def to_string(self): """Return string representation of node in DOT language.""" # RMF: special case defaults for node, edge and graph properties. # node = quote_if_necessary(self.obj_dict['name']) node_attr = list() for attr in sorted(self.obj_dict['attributes']): ...
[ "def", "to_string", "(", "self", ")", ":", "# RMF: special case defaults for node, edge and graph properties.", "#", "node", "=", "quote_if_necessary", "(", "self", ".", "obj_dict", "[", "'name'", "]", ")", "node_attr", "=", "list", "(", ")", "for", "attr", "in", ...
Return string representation of node in DOT language.
[ "Return", "string", "representation", "of", "node", "in", "DOT", "language", "." ]
python
train
edx/edx-enterprise
enterprise/utils.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L570-L600
def ungettext_min_max(singular, plural, range_text, min_val, max_val): """ Return grammatically correct, translated text based off of a minimum and maximum value. Example: min = 1, max = 1, singular = '{} hour required for this course', plural = '{} hours required for this course' output = ...
[ "def", "ungettext_min_max", "(", "singular", ",", "plural", ",", "range_text", ",", "min_val", ",", "max_val", ")", ":", "if", "min_val", "is", "None", "and", "max_val", "is", "None", ":", "return", "None", "if", "min_val", "==", "max_val", "or", "min_val"...
Return grammatically correct, translated text based off of a minimum and maximum value. Example: min = 1, max = 1, singular = '{} hour required for this course', plural = '{} hours required for this course' output = '1 hour required for this course' min = 2, max = 2, singular = '{} hour re...
[ "Return", "grammatically", "correct", "translated", "text", "based", "off", "of", "a", "minimum", "and", "maximum", "value", "." ]
python
valid
seibert-media/Highton
highton/models/company.py
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/models/company.py#L79-L92
def people(self): """ Retrieve all people of the company :return: list of people objects :rtype: list """ return fields.ListField(name=HightonConstants.PEOPLE, init_class=Person).decode( self.element_from_string( self._get_request( ...
[ "def", "people", "(", "self", ")", ":", "return", "fields", ".", "ListField", "(", "name", "=", "HightonConstants", ".", "PEOPLE", ",", "init_class", "=", "Person", ")", ".", "decode", "(", "self", ".", "element_from_string", "(", "self", ".", "_get_reques...
Retrieve all people of the company :return: list of people objects :rtype: list
[ "Retrieve", "all", "people", "of", "the", "company" ]
python
train
klmitch/framer
framer/framers.py
https://github.com/klmitch/framer/blob/bd34cee9737793dab61d1d8973930b64bd08acb4/framer/framers.py#L700-L743
def to_frame(self, data, state): """ Extract a single frame from the data buffer. The consumed data should be removed from the buffer. If no complete frame can be read, must raise a ``NoFrames`` exception. :param data: A ``bytearray`` instance containing the data so ...
[ "def", "to_frame", "(", "self", ",", "data", ",", "state", ")", ":", "# Find the next packet start", "if", "not", "state", ".", "frame_start", ":", "# Find the begin sequence", "idx", "=", "data", ".", "find", "(", "self", ".", "begin", ")", "if", "idx", "...
Extract a single frame from the data buffer. The consumed data should be removed from the buffer. If no complete frame can be read, must raise a ``NoFrames`` exception. :param data: A ``bytearray`` instance containing the data so far read. :param state: An instanc...
[ "Extract", "a", "single", "frame", "from", "the", "data", "buffer", ".", "The", "consumed", "data", "should", "be", "removed", "from", "the", "buffer", ".", "If", "no", "complete", "frame", "can", "be", "read", "must", "raise", "a", "NoFrames", "exception"...
python
train
mieubrisse/wunderpy2
wunderpy2/wunderclient.py
https://github.com/mieubrisse/wunderpy2/blob/7106b6c13ca45ef4d56f805753c93258d5b822c2/wunderpy2/wunderclient.py#L67-L69
def get_tasks(self, list_id, completed=False): ''' Gets tasks for the list with the given ID, filtered by the given completion flag ''' return tasks_endpoint.get_tasks(self, list_id, completed=completed)
[ "def", "get_tasks", "(", "self", ",", "list_id", ",", "completed", "=", "False", ")", ":", "return", "tasks_endpoint", ".", "get_tasks", "(", "self", ",", "list_id", ",", "completed", "=", "completed", ")" ]
Gets tasks for the list with the given ID, filtered by the given completion flag
[ "Gets", "tasks", "for", "the", "list", "with", "the", "given", "ID", "filtered", "by", "the", "given", "completion", "flag" ]
python
train
bretth/woven
woven/linux.py
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/linux.py#L186-L242
def install_packages(): """ Install a set of baseline packages and configure where necessary """ if env.verbosity: print env.host, "INSTALLING & CONFIGURING NODE PACKAGES:" #Get a list of installed packages p = run("dpkg -l | awk '/ii/ {print $2}'").split('\n') #Remove apparmor...
[ "def", "install_packages", "(", ")", ":", "if", "env", ".", "verbosity", ":", "print", "env", ".", "host", ",", "\"INSTALLING & CONFIGURING NODE PACKAGES:\"", "#Get a list of installed packages", "p", "=", "run", "(", "\"dpkg -l | awk '/ii/ {print $2}'\"", ")", ".", "...
Install a set of baseline packages and configure where necessary
[ "Install", "a", "set", "of", "baseline", "packages", "and", "configure", "where", "necessary" ]
python
train
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L516-L545
def _init_read_gz(self): """Initialize for reading a gzip compressed fileobj. """ self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS) self.dbuf = b"" # taken from gzip.GzipFile with some alterations if self.__read(2) != b"\037\213": raise ReadError("not ...
[ "def", "_init_read_gz", "(", "self", ")", ":", "self", ".", "cmp", "=", "self", ".", "zlib", ".", "decompressobj", "(", "-", "self", ".", "zlib", ".", "MAX_WBITS", ")", "self", ".", "dbuf", "=", "b\"\"", "# taken from gzip.GzipFile with some alterations", "i...
Initialize for reading a gzip compressed fileobj.
[ "Initialize", "for", "reading", "a", "gzip", "compressed", "fileobj", "." ]
python
train
contains-io/typet
typet/validation.py
https://github.com/contains-io/typet/blob/ad5087c567af84db299eca186776e1cee228e442/typet/validation.py#L462-L478
def _get_args(cls, args): # type: (tuple) -> Tuple[type, slice, Callable] """Return the parameters necessary to check type boundaries. Args: args: A slice representing the minimum and maximum lengths allowed for values of that string. Returns: A ...
[ "def", "_get_args", "(", "cls", ",", "args", ")", ":", "# type: (tuple) -> Tuple[type, slice, Callable]", "if", "isinstance", "(", "args", ",", "tuple", ")", ":", "raise", "TypeError", "(", "\"{}[...] takes exactly one argument.\"", ".", "format", "(", "cls", ".", ...
Return the parameters necessary to check type boundaries. Args: args: A slice representing the minimum and maximum lengths allowed for values of that string. Returns: A tuple with three parameters: a type, a slice, and the len function.
[ "Return", "the", "parameters", "necessary", "to", "check", "type", "boundaries", "." ]
python
train
carlthome/python-audio-effects
pysndfx/dsp.py
https://github.com/carlthome/python-audio-effects/blob/b2d85c166720c549c6ef3c382b561edd09229722/pysndfx/dsp.py#L278-L282
def gain(self, db): """gain takes one paramter: gain in dB.""" self.command.append('gain') self.command.append(db) return self
[ "def", "gain", "(", "self", ",", "db", ")", ":", "self", ".", "command", ".", "append", "(", "'gain'", ")", "self", ".", "command", ".", "append", "(", "db", ")", "return", "self" ]
gain takes one paramter: gain in dB.
[ "gain", "takes", "one", "paramter", ":", "gain", "in", "dB", "." ]
python
train
opennode/waldur-core
waldur_core/core/tasks.py
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/tasks.py#L402-L413
def apply_async(self, args=None, kwargs=None, **options): """ Checks whether task must be skipped and decreases the counter in that case. """ key = self._get_cache_key(args, kwargs) counter, penalty = cache.get(key, (0, 0)) if not counter: return super(Penaliz...
[ "def", "apply_async", "(", "self", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "*", "*", "options", ")", ":", "key", "=", "self", ".", "_get_cache_key", "(", "args", ",", "kwargs", ")", "counter", ",", "penalty", "=", "cache", ".", "...
Checks whether task must be skipped and decreases the counter in that case.
[ "Checks", "whether", "task", "must", "be", "skipped", "and", "decreases", "the", "counter", "in", "that", "case", "." ]
python
train
CellProfiler/centrosome
centrosome/neighmovetrack.py
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/neighmovetrack.py#L363-L386
def solve_assignement(self, costs): """ Solves assignment problem using Hungarian implementation by Brian M. Clapper. @param costs: square cost matrix @return: assignment function @rtype: int->int """ if costs is None or len(costs) == 0: return dict...
[ "def", "solve_assignement", "(", "self", ",", "costs", ")", ":", "if", "costs", "is", "None", "or", "len", "(", "costs", ")", "==", "0", ":", "return", "dict", "(", ")", "n", "=", "costs", ".", "shape", "[", "0", "]", "pairs", "=", "[", "(", "i...
Solves assignment problem using Hungarian implementation by Brian M. Clapper. @param costs: square cost matrix @return: assignment function @rtype: int->int
[ "Solves", "assignment", "problem", "using", "Hungarian", "implementation", "by", "Brian", "M", ".", "Clapper", "." ]
python
train
mikusjelly/apkutils
apkutils/apkfile.py
https://github.com/mikusjelly/apkutils/blob/2db1ed0cdb610dfc55bfd77266e9a91e4764bba4/apkutils/apkfile.py#L1588-L1603
def close(self): """Close the file, and for mode 'w', 'x' and 'a' write the ending records.""" if self.fp is None: return try: if self.mode in ('w', 'x', 'a') and self._didModify: # write ending records with self._lock: if sel...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "fp", "is", "None", ":", "return", "try", ":", "if", "self", ".", "mode", "in", "(", "'w'", ",", "'x'", ",", "'a'", ")", "and", "self", ".", "_didModify", ":", "# write ending records", "wit...
Close the file, and for mode 'w', 'x' and 'a' write the ending records.
[ "Close", "the", "file", "and", "for", "mode", "w", "x", "and", "a", "write", "the", "ending", "records", "." ]
python
train
pypa/pipenv
pipenv/vendor/pyparsing.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pyparsing.py#L2253-L2275
def ignore( self, other ): """ Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('abl...
[ "def", "ignore", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "Suppress", "(", "other", ")", "if", "isinstance", "(", "other", ",", "Suppress", ")", ":", "if", "other", "not", "in",...
Define expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. Example:: patt = OneOrMore(Word(alphas)) patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj'] ...
[ "Define", "expression", "to", "be", "ignored", "(", "e", ".", "g", ".", "comments", ")", "while", "doing", "pattern", "matching", ";", "may", "be", "called", "repeatedly", "to", "define", "multiple", "comment", "or", "other", "ignorable", "patterns", "." ]
python
train
Asana/python-asana
asana/resources/gen/tasks.py
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/gen/tasks.py#L167-L176
def dependents(self, task, params={}, **options): """Returns the compact representations of all of the dependents of a task. Parameters ---------- task : {Id} The task to get dependents on. [params] : {Object} Parameters for the request """ path = "/tasks/%s/dep...
[ "def", "dependents", "(", "self", ",", "task", ",", "params", "=", "{", "}", ",", "*", "*", "options", ")", ":", "path", "=", "\"/tasks/%s/dependents\"", "%", "(", "task", ")", "return", "self", ".", "client", ".", "get", "(", "path", ",", "params", ...
Returns the compact representations of all of the dependents of a task. Parameters ---------- task : {Id} The task to get dependents on. [params] : {Object} Parameters for the request
[ "Returns", "the", "compact", "representations", "of", "all", "of", "the", "dependents", "of", "a", "task", "." ]
python
train
barryp/py-amqplib
amqplib/client_0_8/method_framing.py
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/method_framing.py#L156-L171
def _process_method_frame(self, channel, payload): """ Process Method frames """ method_sig = unpack('>HH', payload[:4]) args = AMQPReader(payload[4:]) if method_sig in _CONTENT_METHODS: # # Save what we've got so far and wait for the content-hea...
[ "def", "_process_method_frame", "(", "self", ",", "channel", ",", "payload", ")", ":", "method_sig", "=", "unpack", "(", "'>HH'", ",", "payload", "[", ":", "4", "]", ")", "args", "=", "AMQPReader", "(", "payload", "[", "4", ":", "]", ")", "if", "meth...
Process Method frames
[ "Process", "Method", "frames" ]
python
train
mikedh/trimesh
trimesh/util.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/util.py#L731-L748
def distance_to_end(file_obj): """ For an open file object how far is it to the end Parameters ---------- file_obj: open file- like object Returns ---------- distance: int, bytes to end of file """ position_current = file_obj.tell() file_obj.seek(0, 2) position_end = fi...
[ "def", "distance_to_end", "(", "file_obj", ")", ":", "position_current", "=", "file_obj", ".", "tell", "(", ")", "file_obj", ".", "seek", "(", "0", ",", "2", ")", "position_end", "=", "file_obj", ".", "tell", "(", ")", "file_obj", ".", "seek", "(", "po...
For an open file object how far is it to the end Parameters ---------- file_obj: open file- like object Returns ---------- distance: int, bytes to end of file
[ "For", "an", "open", "file", "object", "how", "far", "is", "it", "to", "the", "end" ]
python
train
OpenKMIP/PyKMIP
kmip/pie/factory.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/factory.py#L36-L72
def convert(self, obj): """ Convert a Pie object into a core secret object and vice versa. Args: obj (various): A Pie or core secret object to convert into the opposite object space. Required. Raises: TypeError: if the object type is unrecognized...
[ "def", "convert", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "pobjects", ".", "SymmetricKey", ")", ":", "return", "self", ".", "_build_core_key", "(", "obj", ",", "secrets", ".", "SymmetricKey", ")", "elif", "isinstance", "("...
Convert a Pie object into a core secret object and vice versa. Args: obj (various): A Pie or core secret object to convert into the opposite object space. Required. Raises: TypeError: if the object type is unrecognized or unsupported.
[ "Convert", "a", "Pie", "object", "into", "a", "core", "secret", "object", "and", "vice", "versa", "." ]
python
test
baruwa-enterprise/BaruwaAPI
BaruwaAPI/resource.py
https://github.com/baruwa-enterprise/BaruwaAPI/blob/53335b377ccfd388e42f4f240f181eed72f51180/BaruwaAPI/resource.py#L94-L99
def set_user_passwd(self, userid, data): """Set user password""" return self.api_call( ENDPOINTS['users']['password'], dict(userid=userid), body=data)
[ "def", "set_user_passwd", "(", "self", ",", "userid", ",", "data", ")", ":", "return", "self", ".", "api_call", "(", "ENDPOINTS", "[", "'users'", "]", "[", "'password'", "]", ",", "dict", "(", "userid", "=", "userid", ")", ",", "body", "=", "data", "...
Set user password
[ "Set", "user", "password" ]
python
train
iotile/typedargs
typedargs/shell.py
https://github.com/iotile/typedargs/blob/0a5091a664b9b4d836e091e9ba583e944f438fd8/typedargs/shell.py#L308-L380
def process_arguments(self, func, args): """Process arguments from the command line into positional and kw args. Arguments are consumed until the argument spec for the function is filled or a -- is found or there are no more arguments. Keyword arguments can be specified using --field=v...
[ "def", "process_arguments", "(", "self", ",", "func", ",", "args", ")", ":", "pos_args", "=", "[", "]", "kw_args", "=", "{", "}", "while", "len", "(", "args", ")", ">", "0", ":", "if", "func", ".", "metadata", ".", "spec_filled", "(", "pos_args", "...
Process arguments from the command line into positional and kw args. Arguments are consumed until the argument spec for the function is filled or a -- is found or there are no more arguments. Keyword arguments can be specified using --field=value, -f value or --field value. Positional ...
[ "Process", "arguments", "from", "the", "command", "line", "into", "positional", "and", "kw", "args", "." ]
python
test
mbedmicro/pyOCD
pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py#L168-L188
def get_all_connected_interfaces(): """! @brief Returns all the connected devices with a CMSIS-DAPv2 interface.""" # find all cmsis-dap devices try: all_devices = usb.core.find(find_all=True, custom_match=HasCmsisDapv2Interface()) except usb.core.NoBackendError: c...
[ "def", "get_all_connected_interfaces", "(", ")", ":", "# find all cmsis-dap devices", "try", ":", "all_devices", "=", "usb", ".", "core", ".", "find", "(", "find_all", "=", "True", ",", "custom_match", "=", "HasCmsisDapv2Interface", "(", ")", ")", "except", "usb...
! @brief Returns all the connected devices with a CMSIS-DAPv2 interface.
[ "!" ]
python
train
tanghaibao/jcvi
jcvi/variation/deconvolute.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/variation/deconvolute.py#L131-L216
def split(args): """ %prog split barcodefile fastqfile1 .. Deconvolute fastq files into subsets of fastq reads, based on the barcodes in the barcodefile, which is a two-column file like: ID01 AGTCCAG Input fastqfiles can be several files. Output files are ID01.fastq, ID02.fastq, one file p...
[ "def", "split", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "split", ".", "__doc__", ")", "p", ".", "set_outdir", "(", "outdir", "=", "\"deconv\"", ")", "p", ".", "add_option", "(", "\"--nocheckprefix\"", ",", "default", "=", "False", ",", "a...
%prog split barcodefile fastqfile1 .. Deconvolute fastq files into subsets of fastq reads, based on the barcodes in the barcodefile, which is a two-column file like: ID01 AGTCCAG Input fastqfiles can be several files. Output files are ID01.fastq, ID02.fastq, one file per line in barcodefile. ...
[ "%prog", "split", "barcodefile", "fastqfile1", ".." ]
python
train
DataONEorg/d1_python
gmn/src/d1_gmn/app/middleware/session_cert.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/gmn/src/d1_gmn/app/middleware/session_cert.py#L59-L67
def get_authenticated_subjects(cert_pem): """Return primary subject and set of equivalents authenticated by certificate. - ``cert_pem`` can be str or bytes """ if isinstance(cert_pem, str): cert_pem = cert_pem.encode('utf-8') return d1_common.cert.subjects.extract_subjects(cert_pem)
[ "def", "get_authenticated_subjects", "(", "cert_pem", ")", ":", "if", "isinstance", "(", "cert_pem", ",", "str", ")", ":", "cert_pem", "=", "cert_pem", ".", "encode", "(", "'utf-8'", ")", "return", "d1_common", ".", "cert", ".", "subjects", ".", "extract_sub...
Return primary subject and set of equivalents authenticated by certificate. - ``cert_pem`` can be str or bytes
[ "Return", "primary", "subject", "and", "set", "of", "equivalents", "authenticated", "by", "certificate", "." ]
python
train
alkivi-sas/python-alkivi-logger
alkivi/logger/logger.py
https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L98-L101
def error(self, message, *args, **kwargs): """Should not happen ... """ self._log(logging.ERROR, message, *args, **kwargs)
[ "def", "error", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_log", "(", "logging", ".", "ERROR", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Should not happen ...
[ "Should", "not", "happen", "..." ]
python
train
OCHA-DAP/hdx-python-api
src/hdx/data/resource.py
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource.py#L295-L314
def get_all_resource_ids_in_datastore(configuration=None): # type: (Optional[Configuration]) -> List[str] """Get list of resources that have a datastore returning their ids. Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. ...
[ "def", "get_all_resource_ids_in_datastore", "(", "configuration", "=", "None", ")", ":", "# type: (Optional[Configuration]) -> List[str]", "resource", "=", "Resource", "(", "configuration", "=", "configuration", ")", "success", ",", "result", "=", "resource", ".", "_rea...
Get list of resources that have a datastore returning their ids. Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: List[str]: List of resource ids that are in the datastore
[ "Get", "list", "of", "resources", "that", "have", "a", "datastore", "returning", "their", "ids", "." ]
python
train
googleapis/dialogflow-python-client-v2
samples/knowledge_base_management.py
https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/samples/knowledge_base_management.py#L94-L107
def delete_knowledge_base(project_id, knowledge_base_id): """Deletes a specific Knowledge base. Args: project_id: The GCP project linked with the agent. knowledge_base_id: Id of the Knowledge base.""" import dialogflow_v2beta1 as dialogflow client = dialogflow.KnowledgeBasesClient() ...
[ "def", "delete_knowledge_base", "(", "project_id", ",", "knowledge_base_id", ")", ":", "import", "dialogflow_v2beta1", "as", "dialogflow", "client", "=", "dialogflow", ".", "KnowledgeBasesClient", "(", ")", "knowledge_base_path", "=", "client", ".", "knowledge_base_path...
Deletes a specific Knowledge base. Args: project_id: The GCP project linked with the agent. knowledge_base_id: Id of the Knowledge base.
[ "Deletes", "a", "specific", "Knowledge", "base", "." ]
python
train
obriencj/python-javatools
javatools/opcodes.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/opcodes.py#L105-L127
def __op(name, val, fmt=None, const=False, consume=0, produce=0): """ provides sensible defaults for a code, and registers it with the __OPTABLE for lookup. """ name = name.lower() # fmt can either be a str representing the struct to unpack, or a # callable to do more complex unpacking. If...
[ "def", "__op", "(", "name", ",", "val", ",", "fmt", "=", "None", ",", "const", "=", "False", ",", "consume", "=", "0", ",", "produce", "=", "0", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "# fmt can either be a str representing the struct to ...
provides sensible defaults for a code, and registers it with the __OPTABLE for lookup.
[ "provides", "sensible", "defaults", "for", "a", "code", "and", "registers", "it", "with", "the", "__OPTABLE", "for", "lookup", "." ]
python
train
brocade/pynos
pynos/versions/base/yang/brocade_ras.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/brocade_ras.py#L217-L227
def system_switch_attributes_chassis_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") system = ET.SubElement(config, "system", xmlns="urn:brocade.com:mgmt:brocade-ras") switch_attributes = ET.SubElement(system, "switch-attributes") chassis_na...
[ "def", "system_switch_attributes_chassis_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "system", "=", "ET", ".", "SubElement", "(", "config", ",", "\"system\"", ",", "xmlns", "=", "\"urn...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
minio/minio-py
minio/api.py
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/api.py#L573-L645
def fget_object(self, bucket_name, object_name, file_path, request_headers=None, sse=None): """ Retrieves an object from a bucket and writes at file_path. Examples: minio.fget_object('foo', 'bar', 'localfile') :param bucket_name: Bucket to read object from. :param o...
[ "def", "fget_object", "(", "self", ",", "bucket_name", ",", "object_name", ",", "file_path", ",", "request_headers", "=", "None", ",", "sse", "=", "None", ")", ":", "is_valid_bucket_name", "(", "bucket_name", ")", "is_non_empty_string", "(", "object_name", ")", ...
Retrieves an object from a bucket and writes at file_path. Examples: minio.fget_object('foo', 'bar', 'localfile') :param bucket_name: Bucket to read object from. :param object_name: Name of the object to read. :param file_path: Local file path to save the object. :p...
[ "Retrieves", "an", "object", "from", "a", "bucket", "and", "writes", "at", "file_path", "." ]
python
train
ClimateImpactLab/DataFS
datafs/datafs.py
https://github.com/ClimateImpactLab/DataFS/blob/0d32c2b4e18d300a11b748a552f6adbc3dd8f59d/datafs/datafs.py#L544-L554
def search(ctx, tags, prefix=None): ''' List all archives matching tag search criteria ''' _generate_api(ctx) for i, match in enumerate(ctx.obj.api.search(*tags, prefix=prefix)): click.echo(match, nl=False) print('')
[ "def", "search", "(", "ctx", ",", "tags", ",", "prefix", "=", "None", ")", ":", "_generate_api", "(", "ctx", ")", "for", "i", ",", "match", "in", "enumerate", "(", "ctx", ".", "obj", ".", "api", ".", "search", "(", "*", "tags", ",", "prefix", "="...
List all archives matching tag search criteria
[ "List", "all", "archives", "matching", "tag", "search", "criteria" ]
python
train
openstax/cnx-publishing
cnxpublishing/publish.py
https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/publish.py#L255-L285
def _insert_resource_file(cursor, module_ident, resource): """Insert a resource into the modules_files table. This will create a new file entry or associates an existing one. """ with resource.open() as file: fileid, _ = _insert_file(cursor, file, resource.media_type) # Is this file legitim...
[ "def", "_insert_resource_file", "(", "cursor", ",", "module_ident", ",", "resource", ")", ":", "with", "resource", ".", "open", "(", ")", "as", "file", ":", "fileid", ",", "_", "=", "_insert_file", "(", "cursor", ",", "file", ",", "resource", ".", "media...
Insert a resource into the modules_files table. This will create a new file entry or associates an existing one.
[ "Insert", "a", "resource", "into", "the", "modules_files", "table", ".", "This", "will", "create", "a", "new", "file", "entry", "or", "associates", "an", "existing", "one", "." ]
python
valid
fjwCode/cerium
cerium/androiddriver.py
https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/androiddriver.py#L548-L551
def send_keyevents(self, keyevent: int) -> None: '''Simulates typing keyevents.''' self._execute('-s', self.device_sn, 'shell', 'input', 'keyevent', str(keyevent))
[ "def", "send_keyevents", "(", "self", ",", "keyevent", ":", "int", ")", "->", "None", ":", "self", ".", "_execute", "(", "'-s'", ",", "self", ".", "device_sn", ",", "'shell'", ",", "'input'", ",", "'keyevent'", ",", "str", "(", "keyevent", ")", ")" ]
Simulates typing keyevents.
[ "Simulates", "typing", "keyevents", "." ]
python
train
google/grr
grr/server/grr_response_server/export.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L870-L884
def _SeparateTypes(self, metadata_value_pairs): """Separate files, registry keys, grep matches.""" registry_pairs = [] file_pairs = [] match_pairs = [] for metadata, result in metadata_value_pairs: if (result.stat_entry.pathspec.pathtype == rdf_paths.PathSpec.PathType.REGISTRY): ...
[ "def", "_SeparateTypes", "(", "self", ",", "metadata_value_pairs", ")", ":", "registry_pairs", "=", "[", "]", "file_pairs", "=", "[", "]", "match_pairs", "=", "[", "]", "for", "metadata", ",", "result", "in", "metadata_value_pairs", ":", "if", "(", "result",...
Separate files, registry keys, grep matches.
[ "Separate", "files", "registry", "keys", "grep", "matches", "." ]
python
train
seung-lab/cloud-volume
cloudvolume/storage.py
https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/storage.py#L287-L311
def put_files(self, files, content_type=None, compress=None, cache_control=None, block=True): """ Put lots of files at once and get a nice progress bar. It'll also wait for the upload to complete, just like get_files. Required: files: [ (filepath, content), .... ] """ def base_uploadfn(pa...
[ "def", "put_files", "(", "self", ",", "files", ",", "content_type", "=", "None", ",", "compress", "=", "None", ",", "cache_control", "=", "None", ",", "block", "=", "True", ")", ":", "def", "base_uploadfn", "(", "path", ",", "content", ",", "interface", ...
Put lots of files at once and get a nice progress bar. It'll also wait for the upload to complete, just like get_files. Required: files: [ (filepath, content), .... ]
[ "Put", "lots", "of", "files", "at", "once", "and", "get", "a", "nice", "progress", "bar", ".", "It", "ll", "also", "wait", "for", "the", "upload", "to", "complete", "just", "like", "get_files", "." ]
python
train
cackharot/suds-py3
suds/xsd/sxbase.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/xsd/sxbase.py#L149-L160
def get_child(self, name): """ Get (find) a I{non-attribute} child by name. @param name: A child name. @type name: str @return: A tuple: the requested (child, ancestry). @rtype: (L{SchemaObject}, [L{SchemaObject},..]) """ for child, ancestry in self.childr...
[ "def", "get_child", "(", "self", ",", "name", ")", ":", "for", "child", ",", "ancestry", "in", "self", ".", "children", "(", ")", ":", "if", "child", ".", "any", "(", ")", "or", "child", ".", "name", "==", "name", ":", "return", "(", "child", ","...
Get (find) a I{non-attribute} child by name. @param name: A child name. @type name: str @return: A tuple: the requested (child, ancestry). @rtype: (L{SchemaObject}, [L{SchemaObject},..])
[ "Get", "(", "find", ")", "a", "I", "{", "non", "-", "attribute", "}", "child", "by", "name", "." ]
python
train
benvanwerkhoven/kernel_tuner
kernel_tuner/core.py
https://github.com/benvanwerkhoven/kernel_tuner/blob/cfcb5da5e510db494f8219c22566ab65d5fcbd9f/kernel_tuner/core.py#L180-L200
def compile_kernel(self, instance, verbose): """compile the kernel for this specific instance""" logging.debug('compile_kernel ' + instance.name) #compile kernel_string into device func func = None try: func = self.dev.compile(instance.name, instance.kernel_string) ...
[ "def", "compile_kernel", "(", "self", ",", "instance", ",", "verbose", ")", ":", "logging", ".", "debug", "(", "'compile_kernel '", "+", "instance", ".", "name", ")", "#compile kernel_string into device func", "func", "=", "None", "try", ":", "func", "=", "sel...
compile the kernel for this specific instance
[ "compile", "the", "kernel", "for", "this", "specific", "instance" ]
python
train
nicolargo/glances
glances/plugins/glances_ip.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_ip.py#L161-L176
def get(self): """Get the first public IP address returned by one of the online services.""" q = queue.Queue() for u, j, k in urls: t = threading.Thread(target=self._get_ip_public, args=(q, u, j, k)) t.daemon = True t.start() timer = Timer(self.timeo...
[ "def", "get", "(", "self", ")", ":", "q", "=", "queue", ".", "Queue", "(", ")", "for", "u", ",", "j", ",", "k", "in", "urls", ":", "t", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_get_ip_public", ",", "args", "=", "(", ...
Get the first public IP address returned by one of the online services.
[ "Get", "the", "first", "public", "IP", "address", "returned", "by", "one", "of", "the", "online", "services", "." ]
python
train
inveniosoftware-attic/invenio-utils
invenio_utils/datastructures.py
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/datastructures.py#L418-L421
def flatten_multidict(multidict): """Return flattened dictionary from ``MultiDict``.""" return dict([(key, value if len(value) > 1 else value[0]) for (key, value) in multidict.iterlists()])
[ "def", "flatten_multidict", "(", "multidict", ")", ":", "return", "dict", "(", "[", "(", "key", ",", "value", "if", "len", "(", "value", ")", ">", "1", "else", "value", "[", "0", "]", ")", "for", "(", "key", ",", "value", ")", "in", "multidict", ...
Return flattened dictionary from ``MultiDict``.
[ "Return", "flattened", "dictionary", "from", "MultiDict", "." ]
python
train
tamasgal/km3pipe
km3pipe/logger.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/logger.py#L33-L35
def deprecation(self, message, *args, **kws): """Show a deprecation warning.""" self._log(DEPRECATION, message, args, **kws)
[ "def", "deprecation", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kws", ")", ":", "self", ".", "_log", "(", "DEPRECATION", ",", "message", ",", "args", ",", "*", "*", "kws", ")" ]
Show a deprecation warning.
[ "Show", "a", "deprecation", "warning", "." ]
python
train
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L598-L608
def importNode(self, document, node, deep=0): """Implements (well enough for our purposes) DOM node import.""" nodetype = node.nodeType if nodetype in (node.DOCUMENT_NODE, node.DOCUMENT_TYPE_NODE): raise DOMException('Illegal node type for importNode') if nodetype == node.ENT...
[ "def", "importNode", "(", "self", ",", "document", ",", "node", ",", "deep", "=", "0", ")", ":", "nodetype", "=", "node", ".", "nodeType", "if", "nodetype", "in", "(", "node", ".", "DOCUMENT_NODE", ",", "node", ".", "DOCUMENT_TYPE_NODE", ")", ":", "rai...
Implements (well enough for our purposes) DOM node import.
[ "Implements", "(", "well", "enough", "for", "our", "purposes", ")", "DOM", "node", "import", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L318-L330
def set_condition(self, condition = True): """ Sets a new condition callback for the breakpoint. @see: L{__init__} @type condition: function @param condition: (Optional) Condition callback function. """ if condition is None: self.__condition = True ...
[ "def", "set_condition", "(", "self", ",", "condition", "=", "True", ")", ":", "if", "condition", "is", "None", ":", "self", ".", "__condition", "=", "True", "else", ":", "self", ".", "__condition", "=", "condition" ]
Sets a new condition callback for the breakpoint. @see: L{__init__} @type condition: function @param condition: (Optional) Condition callback function.
[ "Sets", "a", "new", "condition", "callback", "for", "the", "breakpoint", "." ]
python
train
OnroerendErfgoed/crabpy
crabpy/gateway/crab.py
https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L38-L56
def crab_gateway_request(client, method, *args): ''' Utility function that helps making requests to the CRAB service. This is a specialised version of :func:`crabpy.client.crab_request` that allows adding extra functionality for the calls made by the gateway. :param client: A :class:`suds.client.C...
[ "def", "crab_gateway_request", "(", "client", ",", "method", ",", "*", "args", ")", ":", "try", ":", "return", "crab_request", "(", "client", ",", "method", ",", "*", "args", ")", "except", "WebFault", "as", "wf", ":", "err", "=", "GatewayRuntimeException"...
Utility function that helps making requests to the CRAB service. This is a specialised version of :func:`crabpy.client.crab_request` that allows adding extra functionality for the calls made by the gateway. :param client: A :class:`suds.client.Client` for the CRAB service. :param string action: Which ...
[ "Utility", "function", "that", "helps", "making", "requests", "to", "the", "CRAB", "service", "." ]
python
train
rbarrois/mpdlcd
mpdlcd/display_pattern.py
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L42-L59
def parse(self): """Parse the lines, and fill self.line_fields accordingly.""" for line in self.lines: # Parse the line field_defs = self.parse_line(line) fields = [] # Convert field parameters into Field objects for (kind, options) in field_d...
[ "def", "parse", "(", "self", ")", ":", "for", "line", "in", "self", ".", "lines", ":", "# Parse the line", "field_defs", "=", "self", ".", "parse_line", "(", "line", ")", "fields", "=", "[", "]", "# Convert field parameters into Field objects", "for", "(", "...
Parse the lines, and fill self.line_fields accordingly.
[ "Parse", "the", "lines", "and", "fill", "self", ".", "line_fields", "accordingly", "." ]
python
train
PhracturedBlue/asterisk_mbox
asterisk_mbox/__init__.py
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/__init__.py#L73-L85
def start(self): """Start thread.""" if not self._thread: logging.info("Starting asterisk mbox thread") # Ensure signal queue is empty try: while True: self.signal.get(False) except queue.Empty: pass ...
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "_thread", ":", "logging", ".", "info", "(", "\"Starting asterisk mbox thread\"", ")", "# Ensure signal queue is empty", "try", ":", "while", "True", ":", "self", ".", "signal", ".", "get", "("...
Start thread.
[ "Start", "thread", "." ]
python
train
linkhub-sdk/popbill.py
popbill/messageService.py
https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/messageService.py#L210-L261
def sendMMS_Multi(self, CorpNum, Sender, Subject, Contents, Messages, FilePath, reserveDT, adsYN=False, UserID=None, RequestNum=None): """ 멀티 문자메시지 다량 전송 args CorpNum : 팝빌회원 사업자번호 Sender : 발신자번호 (동보전송용) Subject : 장문 메시지 제목 (...
[ "def", "sendMMS_Multi", "(", "self", ",", "CorpNum", ",", "Sender", ",", "Subject", ",", "Contents", ",", "Messages", ",", "FilePath", ",", "reserveDT", ",", "adsYN", "=", "False", ",", "UserID", "=", "None", ",", "RequestNum", "=", "None", ")", ":", "...
멀티 문자메시지 다량 전송 args CorpNum : 팝빌회원 사업자번호 Sender : 발신자번호 (동보전송용) Subject : 장문 메시지 제목 (동보전송용) Contents : 장문 문자 내용 (동보전송용) Messages : 개별전송정보 배열 FilePath : 전송하고자 하는 파일 경로 reserveDT : 예약전송시간 (형...
[ "멀티", "문자메시지", "다량", "전송", "args", "CorpNum", ":", "팝빌회원", "사업자번호", "Sender", ":", "발신자번호", "(", "동보전송용", ")", "Subject", ":", "장문", "메시지", "제목", "(", "동보전송용", ")", "Contents", ":", "장문", "문자", "내용", "(", "동보전송용", ")", "Messages", ":", "개별전송정보", "배...
python
train
aws/sagemaker-containers
src/sagemaker_containers/_modules.py
https://github.com/aws/sagemaker-containers/blob/0030f07abbaf22a55d986d97274d7a8d1aa1f10c/src/sagemaker_containers/_modules.py#L96-L110
def install(path, capture_error=False): # type: (str, bool) -> None """Install a Python module in the executing Python environment. Args: path (str): Real path location of the Python module. capture_error (bool): Default false. If True, the running process captures the stderr, and ...
[ "def", "install", "(", "path", ",", "capture_error", "=", "False", ")", ":", "# type: (str, bool) -> None", "cmd", "=", "'%s -m pip install -U . '", "%", "_process", ".", "python_executable", "(", ")", "if", "has_requirements", "(", "path", ")", ":", "cmd", "+="...
Install a Python module in the executing Python environment. Args: path (str): Real path location of the Python module. capture_error (bool): Default false. If True, the running process captures the stderr, and appends it to the returned Exception message in case of errors.
[ "Install", "a", "Python", "module", "in", "the", "executing", "Python", "environment", ".", "Args", ":", "path", "(", "str", ")", ":", "Real", "path", "location", "of", "the", "Python", "module", ".", "capture_error", "(", "bool", ")", ":", "Default", "f...
python
train
wummel/linkchecker
linkcheck/htmlutil/linkparse.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/htmlutil/linkparse.py#L164-L174
def is_meta_url (attr, attrs): """Check if the meta attributes contain a URL.""" res = False if attr == "content": equiv = attrs.get_true('http-equiv', u'').lower() scheme = attrs.get_true('scheme', u'').lower() res = equiv in (u'refresh',) or scheme in (u'dcterms.uri',) if attr ...
[ "def", "is_meta_url", "(", "attr", ",", "attrs", ")", ":", "res", "=", "False", "if", "attr", "==", "\"content\"", ":", "equiv", "=", "attrs", ".", "get_true", "(", "'http-equiv'", ",", "u''", ")", ".", "lower", "(", ")", "scheme", "=", "attrs", ".",...
Check if the meta attributes contain a URL.
[ "Check", "if", "the", "meta", "attributes", "contain", "a", "URL", "." ]
python
train
annoviko/pyclustering
pyclustering/cluster/optics.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/optics.py#L143-L182
def calculate_connvectivity_radius(self, amount_clusters, maximum_iterations = 100): """! @brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram. @details Parameter 'maxi...
[ "def", "calculate_connvectivity_radius", "(", "self", ",", "amount_clusters", ",", "maximum_iterations", "=", "100", ")", ":", "maximum_distance", "=", "max", "(", "self", ".", "__ordering", ")", "upper_distance", "=", "maximum_distance", "lower_distance", "=", "0.0...
! @brief Calculates connectivity radius of allocation specified amount of clusters using ordering diagram and marks borders of clusters using indexes of values of ordering diagram. @details Parameter 'maximum_iterations' is used to protect from hanging when it is impossible to allocate specified numbe...
[ "!" ]
python
valid
IDSIA/sacred
sacred/ingredient.py
https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L193-L211
def add_config(self, cfg_or_file=None, **kw_conf): """ Add a configuration entry to this ingredient/experiment. Can be called with a filename, a dictionary xor with keyword arguments. Supported formats for the config-file so far are: ``json``, ``pickle`` and ``yaml``. T...
[ "def", "add_config", "(", "self", ",", "cfg_or_file", "=", "None", ",", "*", "*", "kw_conf", ")", ":", "self", ".", "configurations", ".", "append", "(", "self", ".", "_create_config_dict", "(", "cfg_or_file", ",", "kw_conf", ")", ")" ]
Add a configuration entry to this ingredient/experiment. Can be called with a filename, a dictionary xor with keyword arguments. Supported formats for the config-file so far are: ``json``, ``pickle`` and ``yaml``. The resulting dictionary will be converted into a :class:`~sacr...
[ "Add", "a", "configuration", "entry", "to", "this", "ingredient", "/", "experiment", "." ]
python
train
ibis-project/ibis
ibis/pandas/udf.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/pandas/udf.py#L219-L237
def parameter_count(funcsig): """Get the number of positional-or-keyword or position-only parameters in a function signature. Parameters ---------- funcsig : inspect.Signature A UDF signature Returns ------- int The number of parameters """ return sum( p...
[ "def", "parameter_count", "(", "funcsig", ")", ":", "return", "sum", "(", "param", ".", "kind", "in", "{", "param", ".", "POSITIONAL_OR_KEYWORD", ",", "param", ".", "POSITIONAL_ONLY", "}", "for", "param", "in", "funcsig", ".", "parameters", ".", "values", ...
Get the number of positional-or-keyword or position-only parameters in a function signature. Parameters ---------- funcsig : inspect.Signature A UDF signature Returns ------- int The number of parameters
[ "Get", "the", "number", "of", "positional", "-", "or", "-", "keyword", "or", "position", "-", "only", "parameters", "in", "a", "function", "signature", "." ]
python
train
manicmaniac/headlessvim
headlessvim/arguments.py
https://github.com/manicmaniac/headlessvim/blob/3e4657f95d981ddf21fd285b7e1b9da2154f9cb9/headlessvim/arguments.py#L24-L35
def parse(self, args): """ :param args: arguments :type args: None or string or list of string :return: formatted arguments if specified else ``self.default_args`` :rtype: list of string """ if args is None: args = self._default_args if isinsta...
[ "def", "parse", "(", "self", ",", "args", ")", ":", "if", "args", "is", "None", ":", "args", "=", "self", ".", "_default_args", "if", "isinstance", "(", "args", ",", "six", ".", "string_types", ")", ":", "args", "=", "shlex", ".", "split", "(", "ar...
:param args: arguments :type args: None or string or list of string :return: formatted arguments if specified else ``self.default_args`` :rtype: list of string
[ ":", "param", "args", ":", "arguments", ":", "type", "args", ":", "None", "or", "string", "or", "list", "of", "string", ":", "return", ":", "formatted", "arguments", "if", "specified", "else", "self", ".", "default_args", ":", "rtype", ":", "list", "of",...
python
valid
NiklasRosenstein-Python/nr-deprecated
nr/py/bytecode.py
https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/py/bytecode.py#L175-L233
def get_assigned_name(frame): """ Checks the bytecode of *frame* to find the name of the variable a result is being assigned to and returns that name. Returns the full left operand of the assignment. Raises a #ValueError if the variable name could not be retrieved from the bytecode (eg. if an unpack sequence ...
[ "def", "get_assigned_name", "(", "frame", ")", ":", "SEARCHING", ",", "MATCHED", "=", "1", ",", "2", "state", "=", "SEARCHING", "result", "=", "''", "stacksize", "=", "0", "for", "op", "in", "dis", ".", "get_instructions", "(", "frame", ".", "f_code", ...
Checks the bytecode of *frame* to find the name of the variable a result is being assigned to and returns that name. Returns the full left operand of the assignment. Raises a #ValueError if the variable name could not be retrieved from the bytecode (eg. if an unpack sequence is on the left side of the assignmen...
[ "Checks", "the", "bytecode", "of", "*", "frame", "*", "to", "find", "the", "name", "of", "the", "variable", "a", "result", "is", "being", "assigned", "to", "and", "returns", "that", "name", ".", "Returns", "the", "full", "left", "operand", "of", "the", ...
python
train
rodluger/everest
everest/missions/k2/k2.py
https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/k2.py#L715-L881
def GetNeighbors(EPIC, season=None, model=None, neighbors=10, mag_range=(11., 13.), cdpp_range=None, aperture_name='k2sff_15', cadence='lc', **kwargs): ''' Return `neighbors` random bright stars on the same module as `EPIC`. :param int EPIC: The EPIC ID nu...
[ "def", "GetNeighbors", "(", "EPIC", ",", "season", "=", "None", ",", "model", "=", "None", ",", "neighbors", "=", "10", ",", "mag_range", "=", "(", "11.", ",", "13.", ")", ",", "cdpp_range", "=", "None", ",", "aperture_name", "=", "'k2sff_15'", ",", ...
Return `neighbors` random bright stars on the same module as `EPIC`. :param int EPIC: The EPIC ID number :param str model: The :py:obj:`everest` model name. Only used when \ imposing CDPP bounds. Default :py:obj:`None` :param int neighbors: Number of neighbors to return. Default 10 :param st...
[ "Return", "neighbors", "random", "bright", "stars", "on", "the", "same", "module", "as", "EPIC", "." ]
python
train
KennethWilke/PingdomLib
pingdomlib/reports.py
https://github.com/KennethWilke/PingdomLib/blob/3ed1e481f9c9d16b032558d62fb05c2166e162ed/pingdomlib/reports.py#L101-L106
def delete(self): """Delete this email report""" response = self.pingdom.request('DELETE', 'reports.shared/%s' % self.id) return response.json()['message']
[ "def", "delete", "(", "self", ")", ":", "response", "=", "self", ".", "pingdom", ".", "request", "(", "'DELETE'", ",", "'reports.shared/%s'", "%", "self", ".", "id", ")", "return", "response", ".", "json", "(", ")", "[", "'message'", "]" ]
Delete this email report
[ "Delete", "this", "email", "report" ]
python
train
kennethreitz/maya
maya/core.py
https://github.com/kennethreitz/maya/blob/774b141d91a83a5d77cb5351db3d02bf50564b21/maya/core.py#L22-L43
def validate_class_type_arguments(operator): """ Decorator to validate all the arguments to function are of the type of calling class for passed operator """ def inner(function): def wrapper(self, *args, **kwargs): for arg in args + tuple(kwargs.values()): if no...
[ "def", "validate_class_type_arguments", "(", "operator", ")", ":", "def", "inner", "(", "function", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "arg", "in", "args", "+", "tuple", "(", "kwargs", ...
Decorator to validate all the arguments to function are of the type of calling class for passed operator
[ "Decorator", "to", "validate", "all", "the", "arguments", "to", "function", "are", "of", "the", "type", "of", "calling", "class", "for", "passed", "operator" ]
python
train
saltstack/salt
salt/modules/mac_portspkg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_portspkg.py#L243-L355
def install(name=None, refresh=False, pkgs=None, **kwargs): ''' Install the passed package(s) with ``port install`` name The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed. CLI Example: .. code-block:: bash salt '*...
[ "def", "install", "(", "name", "=", "None", ",", "refresh", "=", "False", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pkg_params", ",", "pkg_type", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ",", "pkgs", "...
Install the passed package(s) with ``port install`` name The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed. CLI Example: .. code-block:: bash salt '*' pkg.install <package name> version Specify a version to p...
[ "Install", "the", "passed", "package", "(", "s", ")", "with", "port", "install" ]
python
train
BD2KGenomics/toil-scripts
src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L180-L238
def alignment(job, ids, input_args, sample): """ Runs BWA and then Bamsort on the supplied fastqs for this sample Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample """ uuid, urls = sa...
[ "def", "alignment", "(", "job", ",", "ids", ",", "input_args", ",", "sample", ")", ":", "uuid", ",", "urls", "=", "sample", "# ids['bam'] = job.fileStore.getEmptyFileStoreID()", "work_dir", "=", "job", ".", "fileStore", ".", "getLocalTempDir", "(", ")", "output_...
Runs BWA and then Bamsort on the supplied fastqs for this sample Input1: Toil Job instance Input2: jobstore id dictionary Input3: Input arguments dictionary Input4: Sample tuple -- contains uuid and urls for the sample
[ "Runs", "BWA", "and", "then", "Bamsort", "on", "the", "supplied", "fastqs", "for", "this", "sample" ]
python
train
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/plugging_drivers/vif_hotplug_plugging_driver.py#L164-L189
def setup_logical_port_connectivity(self, context, port_db, hosting_device_id): """Establishes connectivity for a logical port. This is done by hot plugging the interface(VIF) corresponding to the port from the VM. """ hosting_port = port_...
[ "def", "setup_logical_port_connectivity", "(", "self", ",", "context", ",", "port_db", ",", "hosting_device_id", ")", ":", "hosting_port", "=", "port_db", ".", "hosting_info", ".", "hosting_port", "if", "hosting_port", ":", "try", ":", "self", ".", "_dev_mgr", "...
Establishes connectivity for a logical port. This is done by hot plugging the interface(VIF) corresponding to the port from the VM.
[ "Establishes", "connectivity", "for", "a", "logical", "port", "." ]
python
train
openergy/oplus
oplus/epm/record.py
https://github.com/openergy/oplus/blob/f095868d1990c1d126e906ada6acbab26348b3d3/oplus/epm/record.py#L85-L130
def _update_value_inert(self, index, value): """ is only called by _update_inert """ # get field descriptor field_descriptor = self._table._dev_descriptor.get_field_descriptor(index) # prepare value value = field_descriptor.deserialize(value, index) # un...
[ "def", "_update_value_inert", "(", "self", ",", "index", ",", "value", ")", ":", "# get field descriptor", "field_descriptor", "=", "self", ".", "_table", ".", "_dev_descriptor", ".", "get_field_descriptor", "(", "index", ")", "# prepare value", "value", "=", "fie...
is only called by _update_inert
[ "is", "only", "called", "by", "_update_inert" ]
python
test
awslabs/serverless-application-model
samtranslator/model/__init__.py
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/model/__init__.py#L230-L255
def validate_properties(self): """Validates that the required properties for this Resource have been populated, and that all properties have valid values. :returns: True if all properties are valid :rtype: bool :raises TypeError: if any properties are invalid """ ...
[ "def", "validate_properties", "(", "self", ")", ":", "for", "name", ",", "property_type", "in", "self", ".", "property_types", ".", "items", "(", ")", ":", "value", "=", "getattr", "(", "self", ",", "name", ")", "# If the property value is an intrinsic function,...
Validates that the required properties for this Resource have been populated, and that all properties have valid values. :returns: True if all properties are valid :rtype: bool :raises TypeError: if any properties are invalid
[ "Validates", "that", "the", "required", "properties", "for", "this", "Resource", "have", "been", "populated", "and", "that", "all", "properties", "have", "valid", "values", "." ]
python
train
zhammer/faaspact-verifier
faaspact_verifier/definitions.py
https://github.com/zhammer/faaspact-verifier/blob/f2b7accb869bcadbe4aecbce1ca8e89d47843b44/faaspact_verifier/definitions.py#L101-L112
def _pluck_provider_state(raw_provider_state: Dict) -> ProviderState: """ >>> _pluck_provider_state({'name': 'there is an egg'}) ProviderState(descriptor='there is an egg', params=None) >>> _pluck_provider_state({'name': 'there is an egg called', 'params': {'name': 'humpty'}}) ProviderState(descrip...
[ "def", "_pluck_provider_state", "(", "raw_provider_state", ":", "Dict", ")", "->", "ProviderState", ":", "return", "ProviderState", "(", "descriptor", "=", "raw_provider_state", "[", "'name'", "]", ",", "params", "=", "raw_provider_state", ".", "get", "(", "'param...
>>> _pluck_provider_state({'name': 'there is an egg'}) ProviderState(descriptor='there is an egg', params=None) >>> _pluck_provider_state({'name': 'there is an egg called', 'params': {'name': 'humpty'}}) ProviderState(descriptor='there is an egg called', params={'name': 'humpty'})
[ ">>>", "_pluck_provider_state", "(", "{", "name", ":", "there", "is", "an", "egg", "}", ")", "ProviderState", "(", "descriptor", "=", "there", "is", "an", "egg", "params", "=", "None", ")" ]
python
train
numenta/nupic
src/nupic/swarming/ModelRunner.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/ModelRunner.py#L292-L391
def __runTaskMainLoop(self, numIters, learningOffAt=None): """ Main loop of the OPF Model Runner. Parameters: ----------------------------------------------------------------------- recordIterator: Iterator for counting number of records (see _runTask) learningOffAt: If not None, learning i...
[ "def", "__runTaskMainLoop", "(", "self", ",", "numIters", ",", "learningOffAt", "=", "None", ")", ":", "## Reset sequence states in the model, so it starts looking for a new", "## sequence", "self", ".", "_model", ".", "resetSequenceStates", "(", ")", "self", ".", "_cur...
Main loop of the OPF Model Runner. Parameters: ----------------------------------------------------------------------- recordIterator: Iterator for counting number of records (see _runTask) learningOffAt: If not None, learning is turned off when we reach this iteration n...
[ "Main", "loop", "of", "the", "OPF", "Model", "Runner", "." ]
python
valid
molmod/molmod
molmod/molecules.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/molecules.py#L278-L292
def compute_rotsym(self, threshold=1e-3*angstrom): """Compute the rotational symmetry number. Optional argument: | ``threshold`` -- only when a rotation results in an rmsd below the given threshold, the rotation is considered to transform the ...
[ "def", "compute_rotsym", "(", "self", ",", "threshold", "=", "1e-3", "*", "angstrom", ")", ":", "# Generate a graph with a more permissive threshold for bond lengths:", "# (is convenient in case of transition state geometries)", "graph", "=", "MolecularGraph", ".", "from_geometry...
Compute the rotational symmetry number. Optional argument: | ``threshold`` -- only when a rotation results in an rmsd below the given threshold, the rotation is considered to transform the molecule onto itself.
[ "Compute", "the", "rotational", "symmetry", "number", "." ]
python
train
NuGrid/NuGridPy
nugridpy/data_plot.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1463-L1466
def _xlimrev(self): ''' reverse xrange''' xmax,xmin=pyl.xlim() pyl.xlim(xmin,xmax)
[ "def", "_xlimrev", "(", "self", ")", ":", "xmax", ",", "xmin", "=", "pyl", ".", "xlim", "(", ")", "pyl", ".", "xlim", "(", "xmin", ",", "xmax", ")" ]
reverse xrange
[ "reverse", "xrange" ]
python
train
unbservices/clams
clams/__init__.py
https://github.com/unbservices/clams/blob/2ae0a36eb8f82a153d27f74ef37688f976952789/clams/__init__.py#L414-L438
def parse_args(self, args=None, namespace=None): """Parse the command-line arguments and call the associated handler. The signature is the same as `argparse.ArgumentParser.parse_args <https://docs.python.org/2/library/argparse.html#argparse.ArgumentParser.parse_args>`_. Args --...
[ "def", "parse_args", "(", "self", ",", "args", "=", "None", ",", "namespace", "=", "None", ")", ":", "assert", "self", ".", "initialized", ",", "'`init` must be called before `parse_args`.'", "namespace", "=", "self", ".", "parser", ".", "parse_args", "(", "ar...
Parse the command-line arguments and call the associated handler. The signature is the same as `argparse.ArgumentParser.parse_args <https://docs.python.org/2/library/argparse.html#argparse.ArgumentParser.parse_args>`_. Args ---- args : list A list of argument string...
[ "Parse", "the", "command", "-", "line", "arguments", "and", "call", "the", "associated", "handler", "." ]
python
train
cs01/pygdbmi
pygdbmi/gdbcontroller.py
https://github.com/cs01/pygdbmi/blob/709c781794d3c3b903891f83da011d2d995895d1/pygdbmi/gdbcontroller.py#L180-L246
def write( self, mi_cmd_to_write, timeout_sec=DEFAULT_GDB_TIMEOUT_SEC, raise_error_on_timeout=True, read_response=True, ): """Write to gdb process. Block while parsing responses from gdb for a maximum of timeout_sec. Args: mi_cmd_to_write (str or ...
[ "def", "write", "(", "self", ",", "mi_cmd_to_write", ",", "timeout_sec", "=", "DEFAULT_GDB_TIMEOUT_SEC", ",", "raise_error_on_timeout", "=", "True", ",", "read_response", "=", "True", ",", ")", ":", "self", ".", "verify_valid_gdb_subprocess", "(", ")", "if", "ti...
Write to gdb process. Block while parsing responses from gdb for a maximum of timeout_sec. Args: mi_cmd_to_write (str or list): String to write to gdb. If list, it is joined by newlines. timeout_sec (float): Maximum number of seconds to wait for response before exiting. Must be >= 0. ...
[ "Write", "to", "gdb", "process", ".", "Block", "while", "parsing", "responses", "from", "gdb", "for", "a", "maximum", "of", "timeout_sec", "." ]
python
valid
pycontribs/pyrax
pyrax/object_storage.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/object_storage.py#L2389-L2396
def list(self, limit=None, marker=None, end_marker=None, prefix=None): """ List the containers in this account, using the parameters to control the pagination of containers, since by default only the first 10,000 containers are returned. """ return self._manager.list(limi...
[ "def", "list", "(", "self", ",", "limit", "=", "None", ",", "marker", "=", "None", ",", "end_marker", "=", "None", ",", "prefix", "=", "None", ")", ":", "return", "self", ".", "_manager", ".", "list", "(", "limit", "=", "limit", ",", "marker", "=",...
List the containers in this account, using the parameters to control the pagination of containers, since by default only the first 10,000 containers are returned.
[ "List", "the", "containers", "in", "this", "account", "using", "the", "parameters", "to", "control", "the", "pagination", "of", "containers", "since", "by", "default", "only", "the", "first", "10", "000", "containers", "are", "returned", "." ]
python
train
mozilla/configman
configman/def_sources/for_argparse.py
https://github.com/mozilla/configman/blob/83159fed61cc4cbbe5a4a6a00d3acad8a0c39c96/configman/def_sources/for_argparse.py#L618-L640
def parse_known_args(self, args=None, namespace=None): """this method hijacks the normal argparse Namespace generation, shimming configman into the process. The return value will be a configman DotDict rather than an argparse Namespace.""" # load the config_manager within the scope of th...
[ "def", "parse_known_args", "(", "self", ",", "args", "=", "None", ",", "namespace", "=", "None", ")", ":", "# load the config_manager within the scope of the method that uses it", "# so that we avoid circular references in the outer scope", "from", "configman", ".", "config_man...
this method hijacks the normal argparse Namespace generation, shimming configman into the process. The return value will be a configman DotDict rather than an argparse Namespace.
[ "this", "method", "hijacks", "the", "normal", "argparse", "Namespace", "generation", "shimming", "configman", "into", "the", "process", ".", "The", "return", "value", "will", "be", "a", "configman", "DotDict", "rather", "than", "an", "argparse", "Namespace", "."...
python
train
ibelie/typy
typy/google/protobuf/text_format.py
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/text_format.py#L566-L611
def _MergeMessageField(self, tokenizer, message, field): """Merges a single scalar field into a message. Args: tokenizer: A tokenizer to parse the field value. message: The message of which field is a member. field: The descriptor of the field to be merged. Raises: ParseError: In c...
[ "def", "_MergeMessageField", "(", "self", ",", "tokenizer", ",", "message", ",", "field", ")", ":", "is_map_entry", "=", "_IsMapEntry", "(", "field", ")", "if", "tokenizer", ".", "TryConsume", "(", "'<'", ")", ":", "end_token", "=", "'>'", "else", ":", "...
Merges a single scalar field into a message. Args: tokenizer: A tokenizer to parse the field value. message: The message of which field is a member. field: The descriptor of the field to be merged. Raises: ParseError: In case of text parsing problems.
[ "Merges", "a", "single", "scalar", "field", "into", "a", "message", "." ]
python
valid
minhhoit/yacms
yacms/blog/management/commands/import_tumblr.py
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/blog/management/commands/import_tumblr.py#L25-L33
def title_from_content(content): """ Try and extract the first sentence from a block of test to use as a title. """ for end in (". ", "?", "!", "<br />", "\n", "</p>"): if end in content: content = content.split(end)[0] + end break return strip_tags(content)
[ "def", "title_from_content", "(", "content", ")", ":", "for", "end", "in", "(", "\". \"", ",", "\"?\"", ",", "\"!\"", ",", "\"<br />\"", ",", "\"\\n\"", ",", "\"</p>\"", ")", ":", "if", "end", "in", "content", ":", "content", "=", "content", ".", "spli...
Try and extract the first sentence from a block of test to use as a title.
[ "Try", "and", "extract", "the", "first", "sentence", "from", "a", "block", "of", "test", "to", "use", "as", "a", "title", "." ]
python
train
creare-com/pydem
pydem/dem_processing.py
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2100-L2235
def _mk_connectivity_flats(self, i12, j1, j2, mat_data, flats, elev, mag): """ Helper function for _mk_adjacency_matrix. This calcualtes the connectivity for flat regions. Every pixel in the flat will drain to a random pixel in the flat. This accumulates all the area in the flat ...
[ "def", "_mk_connectivity_flats", "(", "self", ",", "i12", ",", "j1", ",", "j2", ",", "mat_data", ",", "flats", ",", "elev", ",", "mag", ")", ":", "nn", ",", "mm", "=", "flats", ".", "shape", "NN", "=", "np", ".", "prod", "(", "flats", ".", "shape...
Helper function for _mk_adjacency_matrix. This calcualtes the connectivity for flat regions. Every pixel in the flat will drain to a random pixel in the flat. This accumulates all the area in the flat region to a single pixel. All that area is then drained from that pixel to the surround...
[ "Helper", "function", "for", "_mk_adjacency_matrix", ".", "This", "calcualtes", "the", "connectivity", "for", "flat", "regions", ".", "Every", "pixel", "in", "the", "flat", "will", "drain", "to", "a", "random", "pixel", "in", "the", "flat", ".", "This", "acc...
python
train
rocky/python-spark
example/gdb-loc/gdbloc/scanner.py
https://github.com/rocky/python-spark/blob/8899954bcf0e166726841a43e87c23790eb3441f/example/gdb-loc/gdbloc/scanner.py#L57-L79
def t_file_or_func(self, s): r'(?:[^*-+,\d\'"\t \n:][^\'"\t \n:,]*)|(?:^""".+""")|(?:\'\'\'.+\'\'\')' maybe_funcname = True if s == 'if': self.add_token('IF', s) return if s[0] in frozenset(('"', "'")): # Pick out text inside of triple-quoted string ...
[ "def", "t_file_or_func", "(", "self", ",", "s", ")", ":", "maybe_funcname", "=", "True", "if", "s", "==", "'if'", ":", "self", ".", "add_token", "(", "'IF'", ",", "s", ")", "return", "if", "s", "[", "0", "]", "in", "frozenset", "(", "(", "'\"'", ...
r'(?:[^*-+,\d\'"\t \n:][^\'"\t \n:,]*)|(?:^""".+""")|(?:\'\'\'.+\'\'\')
[ "r", "(", "?", ":", "[", "^", "*", "-", "+", "\\", "d", "\\", "\\", "t", "\\", "n", ":", "]", "[", "^", "\\", "\\", "t", "\\", "n", ":", "]", "*", ")", "|", "(", "?", ":", "^", ".", "+", ")", "|", "(", "?", ":", "\\", "\\", "\\", ...
python
train
boppreh/keyboard
keyboard/__init__.py
https://github.com/boppreh/keyboard/blob/dbb73dfff484f733d5fed8dbc53301af5b6c7f50/keyboard/__init__.py#L1067-L1121
def add_word_listener(word, callback, triggers=['space'], match_suffix=False, timeout=2): """ Invokes a callback every time a sequence of characters is typed (e.g. 'pet') and followed by a trigger key (e.g. space). Modifiers (e.g. alt, ctrl, shift) are ignored. - `word` the typed text to be matched...
[ "def", "add_word_listener", "(", "word", ",", "callback", ",", "triggers", "=", "[", "'space'", "]", ",", "match_suffix", "=", "False", ",", "timeout", "=", "2", ")", ":", "state", "=", "_State", "(", ")", "state", ".", "current", "=", "''", "state", ...
Invokes a callback every time a sequence of characters is typed (e.g. 'pet') and followed by a trigger key (e.g. space). Modifiers (e.g. alt, ctrl, shift) are ignored. - `word` the typed text to be matched. E.g. 'pet'. - `callback` is an argument-less function to be invoked each time the word is ty...
[ "Invokes", "a", "callback", "every", "time", "a", "sequence", "of", "characters", "is", "typed", "(", "e", ".", "g", ".", "pet", ")", "and", "followed", "by", "a", "trigger", "key", "(", "e", ".", "g", ".", "space", ")", ".", "Modifiers", "(", "e",...
python
train
dmwm/DBS
Server/Python/src/dbs/utils/dbsUtils.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/utils/dbsUtils.py#L69-L82
def jsonstreamer(func): """JSON streamer decorator""" def wrapper (self, *args, **kwds): gen = func (self, *args, **kwds) yield "[" firstItem = True for item in gen: if not firstItem: yield "," else: firstItem = False ...
[ "def", "jsonstreamer", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "gen", "=", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", "yield", "\"[\"", "firstItem", "=", "...
JSON streamer decorator
[ "JSON", "streamer", "decorator" ]
python
train
ethereum/py_ecc
py_ecc/bls/utils.py
https://github.com/ethereum/py_ecc/blob/2088796c59574b256dc8e18f8c9351bc3688ca71/py_ecc/bls/utils.py#L118-L140
def decompress_G1(z: G1Compressed) -> G1Uncompressed: """ Recovers x and y coordinates from the compressed point. """ # b_flag == 1 indicates the infinity point b_flag = (z % POW_2_383) // POW_2_382 if b_flag == 1: return Z1 x = z % POW_2_381 # Try solving y coordinate from the ...
[ "def", "decompress_G1", "(", "z", ":", "G1Compressed", ")", "->", "G1Uncompressed", ":", "# b_flag == 1 indicates the infinity point", "b_flag", "=", "(", "z", "%", "POW_2_383", ")", "//", "POW_2_382", "if", "b_flag", "==", "1", ":", "return", "Z1", "x", "=", ...
Recovers x and y coordinates from the compressed point.
[ "Recovers", "x", "and", "y", "coordinates", "from", "the", "compressed", "point", "." ]
python
test
josuebrunel/myql
myql/contrib/table/table.py
https://github.com/josuebrunel/myql/blob/891bad29cc83a81b3f5ebc4d0401d6f2c22f119e/myql/contrib/table/table.py#L33-L38
def _xml_pretty_print(self, data): """Pretty print xml data """ raw_string = xtree.tostring(data, 'utf-8') parsed_string = minidom.parseString(raw_string) return parsed_string.toprettyxml(indent='\t')
[ "def", "_xml_pretty_print", "(", "self", ",", "data", ")", ":", "raw_string", "=", "xtree", ".", "tostring", "(", "data", ",", "'utf-8'", ")", "parsed_string", "=", "minidom", ".", "parseString", "(", "raw_string", ")", "return", "parsed_string", ".", "topre...
Pretty print xml data
[ "Pretty", "print", "xml", "data" ]
python
train
smdabdoub/phylotoast
phylotoast/util.py
https://github.com/smdabdoub/phylotoast/blob/0b74ef171e6a84761710548501dfac71285a58a3/phylotoast/util.py#L37-L73
def parseFASTA(fastaFNH): """ Parse the records in a FASTA-format file keeping the file open, and reading through one line at a time. :type source: path to FAST file or open file handle :param source: The data source from which to parse the FASTA records. Expects the input to res...
[ "def", "parseFASTA", "(", "fastaFNH", ")", ":", "recs", "=", "[", "]", "seq", "=", "[", "]", "seqID", "=", "\"\"", "descr", "=", "\"\"", "for", "line", "in", "file_handle", "(", "fastaFNH", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "...
Parse the records in a FASTA-format file keeping the file open, and reading through one line at a time. :type source: path to FAST file or open file handle :param source: The data source from which to parse the FASTA records. Expects the input to resolve to a collection that can be itera...
[ "Parse", "the", "records", "in", "a", "FASTA", "-", "format", "file", "keeping", "the", "file", "open", "and", "reading", "through", "one", "line", "at", "a", "time", "." ]
python
train
AlecAivazis/graphql-over-kafka
nautilus/api/util/graphql_mutation_from_summary.py
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/graphql_mutation_from_summary.py#L6-L38
def graphql_mutation_from_summary(summary): """ This function returns a graphql mutation corresponding to the provided summary. """ # get the name of the mutation from the summary mutation_name = summary['name'] # print(summary) # the treat the "type" string as a gra input_...
[ "def", "graphql_mutation_from_summary", "(", "summary", ")", ":", "# get the name of the mutation from the summary", "mutation_name", "=", "summary", "[", "'name'", "]", "# print(summary)", "# the treat the \"type\" string as a gra", "input_name", "=", "mutation_name", "+", "\"...
This function returns a graphql mutation corresponding to the provided summary.
[ "This", "function", "returns", "a", "graphql", "mutation", "corresponding", "to", "the", "provided", "summary", "." ]
python
train
Neurita/boyle
boyle/nifti/mask.py
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/mask.py#L65-L86
def load_mask_data(image, allow_empty=True): """Load a Nifti mask volume and return its data matrix as boolean and affine. Parameters ---------- image: img-like object or boyle.nifti.NeuroImage or str Can either be: - a file path to a Nifti image - any object with get_data() and...
[ "def", "load_mask_data", "(", "image", ",", "allow_empty", "=", "True", ")", ":", "mask", "=", "load_mask", "(", "image", ",", "allow_empty", "=", "allow_empty", ")", "return", "get_img_data", "(", "mask", ")", ",", "mask", ".", "get_affine", "(", ")" ]
Load a Nifti mask volume and return its data matrix as boolean and affine. Parameters ---------- image: img-like object or boyle.nifti.NeuroImage or str Can either be: - a file path to a Nifti image - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image. ...
[ "Load", "a", "Nifti", "mask", "volume", "and", "return", "its", "data", "matrix", "as", "boolean", "and", "affine", "." ]
python
valid
robotools/fontParts
Lib/fontParts/base/info.py
https://github.com/robotools/fontParts/blob/d2ff106fe95f9d566161d936a645157626568712/Lib/fontParts/base/info.py#L288-L301
def _interpolate(self, factor, minInfo, maxInfo, round=True, suppressError=True): """ Subclasses may override this method. """ minInfo = minInfo._toMathInfo() maxInfo = maxInfo._toMathInfo() result = interpolate(minInfo, maxInfo, factor) if result is None and not ...
[ "def", "_interpolate", "(", "self", ",", "factor", ",", "minInfo", ",", "maxInfo", ",", "round", "=", "True", ",", "suppressError", "=", "True", ")", ":", "minInfo", "=", "minInfo", ".", "_toMathInfo", "(", ")", "maxInfo", "=", "maxInfo", ".", "_toMathIn...
Subclasses may override this method.
[ "Subclasses", "may", "override", "this", "method", "." ]
python
train
orbingol/NURBS-Python
geomdl/linalg.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L223-L234
def vector_magnitude(vector_in): """ Computes the magnitude of the input vector. :param vector_in: input vector :type vector_in: list, tuple :return: magnitude of the vector :rtype: float """ sq_sum = 0.0 for vin in vector_in: sq_sum += vin**2 return math.sqrt(sq_sum)
[ "def", "vector_magnitude", "(", "vector_in", ")", ":", "sq_sum", "=", "0.0", "for", "vin", "in", "vector_in", ":", "sq_sum", "+=", "vin", "**", "2", "return", "math", ".", "sqrt", "(", "sq_sum", ")" ]
Computes the magnitude of the input vector. :param vector_in: input vector :type vector_in: list, tuple :return: magnitude of the vector :rtype: float
[ "Computes", "the", "magnitude", "of", "the", "input", "vector", "." ]
python
train
PSPC-SPAC-buyandsell/von_anchor
von_anchor/a2a/docutil.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/a2a/docutil.py#L24-L32
def resource(ref: str, delimiter: str = None) -> str: """ Given a (URI) reference, return up to its delimiter (exclusively), or all of it if there is none. :param ref: reference :param delimiter: delimiter character (default None maps to '#', or ';' introduces identifiers) """ return ref.split...
[ "def", "resource", "(", "ref", ":", "str", ",", "delimiter", ":", "str", "=", "None", ")", "->", "str", ":", "return", "ref", ".", "split", "(", "delimiter", "if", "delimiter", "else", "'#'", ")", "[", "0", "]" ]
Given a (URI) reference, return up to its delimiter (exclusively), or all of it if there is none. :param ref: reference :param delimiter: delimiter character (default None maps to '#', or ';' introduces identifiers)
[ "Given", "a", "(", "URI", ")", "reference", "return", "up", "to", "its", "delimiter", "(", "exclusively", ")", "or", "all", "of", "it", "if", "there", "is", "none", "." ]
python
train
pybel/pybel-tools
src/pybel_tools/definition_utils/summary_independent.py
https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/definition_utils/summary_independent.py#L22-L51
def get_merged_namespace_names(locations, check_keywords=True): """Loads many namespaces and combines their names. :param iter[str] locations: An iterable of URLs or file paths pointing to BEL namespaces. :param bool check_keywords: Should all the keywords be the same? Defaults to ``True`` :return: A d...
[ "def", "get_merged_namespace_names", "(", "locations", ",", "check_keywords", "=", "True", ")", ":", "resources", "=", "{", "location", ":", "get_bel_resource", "(", "location", ")", "for", "location", "in", "locations", "}", "if", "check_keywords", ":", "resour...
Loads many namespaces and combines their names. :param iter[str] locations: An iterable of URLs or file paths pointing to BEL namespaces. :param bool check_keywords: Should all the keywords be the same? Defaults to ``True`` :return: A dictionary of {names: labels} :rtype: dict[str, str] Example Us...
[ "Loads", "many", "namespaces", "and", "combines", "their", "names", "." ]
python
valid
stain/forgetSQL
lib/forgetSQL.py
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L451-L604
def _prepareSQL(cls, operation="SELECT", where=None, selectfields=None, orderBy=None): """Return a sql for the given operation. Possible operations: SELECT read data for this id SELECTALL read data for all ids INSERT insert data, create new id ...
[ "def", "_prepareSQL", "(", "cls", ",", "operation", "=", "\"SELECT\"", ",", "where", "=", "None", ",", "selectfields", "=", "None", ",", "orderBy", "=", "None", ")", ":", "# Normalize parameter for later comparissions", "operation", "=", "operation", ".", "upper...
Return a sql for the given operation. Possible operations: SELECT read data for this id SELECTALL read data for all ids INSERT insert data, create new id UPDATE update data for this id DELETE remove data for this id ...
[ "Return", "a", "sql", "for", "the", "given", "operation", "." ]
python
train
gwpy/gwpy
gwpy/detector/channel.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/detector/channel.py#L785-L808
def query(cls, name, use_kerberos=None, debug=False): """Query the LIGO Channel Information System a `ChannelList`. Parameters ---------- name : `str` name of channel, or part of it. use_kerberos : `bool`, optional use an existing Kerberos ticket as the ...
[ "def", "query", "(", "cls", ",", "name", ",", "use_kerberos", "=", "None", ",", "debug", "=", "False", ")", ":", "from", ".", "io", "import", "cis", "return", "cis", ".", "query", "(", "name", ",", "use_kerberos", "=", "use_kerberos", ",", "debug", "...
Query the LIGO Channel Information System a `ChannelList`. Parameters ---------- name : `str` name of channel, or part of it. use_kerberos : `bool`, optional use an existing Kerberos ticket as the authentication credential, default behaviour will che...
[ "Query", "the", "LIGO", "Channel", "Information", "System", "a", "ChannelList", "." ]
python
train
pandas-dev/pandas
pandas/core/arrays/period.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/period.py#L211-L226
def _from_datetime64(cls, data, freq, tz=None): """ Construct a PeriodArray from a datetime64 array Parameters ---------- data : ndarray[datetime64[ns], datetime64[ns, tz]] freq : str or Tick tz : tzinfo, optional Returns ------- PeriodAr...
[ "def", "_from_datetime64", "(", "cls", ",", "data", ",", "freq", ",", "tz", "=", "None", ")", ":", "data", ",", "freq", "=", "dt64arr_to_periodarr", "(", "data", ",", "freq", ",", "tz", ")", "return", "cls", "(", "data", ",", "freq", "=", "freq", "...
Construct a PeriodArray from a datetime64 array Parameters ---------- data : ndarray[datetime64[ns], datetime64[ns, tz]] freq : str or Tick tz : tzinfo, optional Returns ------- PeriodArray[freq]
[ "Construct", "a", "PeriodArray", "from", "a", "datetime64", "array" ]
python
train
hadrianl/huobi
huobitrade/service.py
https://github.com/hadrianl/huobi/blob/bbfa2036703ee84a76d5d8e9f89c25fc8a55f2c7/huobitrade/service.py#L512-L521
def repay_loan(self, order_id, amount, _async=False): """ 归还借贷 :param order_id: :param amount: :return: """ params = {'order-id': order_id, 'amount': amount} path = f'/v1/margin/orders/{order_id}/repay' return api_key_post(params, path, _async=_asy...
[ "def", "repay_loan", "(", "self", ",", "order_id", ",", "amount", ",", "_async", "=", "False", ")", ":", "params", "=", "{", "'order-id'", ":", "order_id", ",", "'amount'", ":", "amount", "}", "path", "=", "f'/v1/margin/orders/{order_id}/repay'", "return", "...
归还借贷 :param order_id: :param amount: :return:
[ "归还借贷", ":", "param", "order_id", ":", ":", "param", "amount", ":", ":", "return", ":" ]
python
train
Chilipp/psyplot
psyplot/data.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L795-L815
def _check_triangular_bounds(self, var, coords=None, axis='x', nans=None): """ Checks whether the bounds in the variable attribute are triangular Parameters ---------- %(CFDecoder.get_cell_node_coord.parameters)s Returns ------- bool or None ...
[ "def", "_check_triangular_bounds", "(", "self", ",", "var", ",", "coords", "=", "None", ",", "axis", "=", "'x'", ",", "nans", "=", "None", ")", ":", "# !!! WILL BE REMOVED IN THE NEAR FUTURE! !!!", "bounds", "=", "self", ".", "get_cell_node_coord", "(", "var", ...
Checks whether the bounds in the variable attribute are triangular Parameters ---------- %(CFDecoder.get_cell_node_coord.parameters)s Returns ------- bool or None True, if unstructered, None if it could not be determined xarray.Coordinate or None ...
[ "Checks", "whether", "the", "bounds", "in", "the", "variable", "attribute", "are", "triangular" ]
python
train
benedictpaten/sonLib
misc.py
https://github.com/benedictpaten/sonLib/blob/1decb75bb439b70721ec776f685ce98e25217d26/misc.py#L38-L42
def close(i, j, tolerance): """ check two float values are within a bound of one another """ return i <= j + tolerance and i >= j - tolerance
[ "def", "close", "(", "i", ",", "j", ",", "tolerance", ")", ":", "return", "i", "<=", "j", "+", "tolerance", "and", "i", ">=", "j", "-", "tolerance" ]
check two float values are within a bound of one another
[ "check", "two", "float", "values", "are", "within", "a", "bound", "of", "one", "another" ]
python
train