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
nathankw/pulsarpy
pulsarpy/models.py
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L500-L511
def index(cls): """Fetches all records. Returns: `dict`. The JSON formatted response. Raises: `requests.exceptions.HTTPError`: The status code is not ok. """ res = requests.get(cls.URL, headers=HEADERS, verify=False) res.raise_for_status() ...
[ "def", "index", "(", "cls", ")", ":", "res", "=", "requests", ".", "get", "(", "cls", ".", "URL", ",", "headers", "=", "HEADERS", ",", "verify", "=", "False", ")", "res", ".", "raise_for_status", "(", ")", "return", "res", ".", "json", "(", ")" ]
Fetches all records. Returns: `dict`. The JSON formatted response. Raises: `requests.exceptions.HTTPError`: The status code is not ok.
[ "Fetches", "all", "records", "." ]
python
train
apache/spark
python/pyspark/sql/readwriter.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/readwriter.py#L78-L89
def format(self, source): """Specifies the input data source format. :param source: string, name of the data source, e.g. 'json', 'parquet'. >>> df = spark.read.format('json').load('python/test_support/sql/people.json') >>> df.dtypes [('age', 'bigint'), ('name', 'string')] ...
[ "def", "format", "(", "self", ",", "source", ")", ":", "self", ".", "_jreader", "=", "self", ".", "_jreader", ".", "format", "(", "source", ")", "return", "self" ]
Specifies the input data source format. :param source: string, name of the data source, e.g. 'json', 'parquet'. >>> df = spark.read.format('json').load('python/test_support/sql/people.json') >>> df.dtypes [('age', 'bigint'), ('name', 'string')]
[ "Specifies", "the", "input", "data", "source", "format", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xsplitter.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xsplitter.py#L130-L155
def collapseBefore( self, handle ): """ Collapses the splitter before the inputed handle. :param handle | <XSplitterHandle> """ self.setUpdatesEnabled(False) # collapse all items after the current handle if ( handle.isCollapsed() ): ...
[ "def", "collapseBefore", "(", "self", ",", "handle", ")", ":", "self", ".", "setUpdatesEnabled", "(", "False", ")", "# collapse all items after the current handle", "if", "(", "handle", ".", "isCollapsed", "(", ")", ")", ":", "self", ".", "setSizes", "(", "han...
Collapses the splitter before the inputed handle. :param handle | <XSplitterHandle>
[ "Collapses", "the", "splitter", "before", "the", "inputed", "handle", ".", ":", "param", "handle", "|", "<XSplitterHandle", ">" ]
python
train
MozillaSecurity/laniakea
laniakea/core/providers/packet/manager.py
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/packet/manager.py#L312-L320
def reboot(self, devices): """Reboot one or more devices. """ for device in devices: self.logger.info('Rebooting: %s', device.id) try: device.reboot() except packet.baseapi.Error: raise PacketManagerException('Unable to reboot i...
[ "def", "reboot", "(", "self", ",", "devices", ")", ":", "for", "device", "in", "devices", ":", "self", ".", "logger", ".", "info", "(", "'Rebooting: %s'", ",", "device", ".", "id", ")", "try", ":", "device", ".", "reboot", "(", ")", "except", "packet...
Reboot one or more devices.
[ "Reboot", "one", "or", "more", "devices", "." ]
python
train
jonathf/chaospy
chaospy/distributions/evaluation/inverse.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/distributions/evaluation/inverse.py#L42-L88
def evaluate_inverse( distribution, u_data, cache=None, parameters=None ): """ Evaluate inverse Rosenblatt transformation. Args: distribution (Dist): Distribution to evaluate. u_data (numpy.ndarray): Locations for where evaluate invers...
[ "def", "evaluate_inverse", "(", "distribution", ",", "u_data", ",", "cache", "=", "None", ",", "parameters", "=", "None", ")", ":", "if", "cache", "is", "None", ":", "cache", "=", "{", "}", "out", "=", "numpy", ".", "zeros", "(", "u_data", ".", "shap...
Evaluate inverse Rosenblatt transformation. Args: distribution (Dist): Distribution to evaluate. u_data (numpy.ndarray): Locations for where evaluate inverse transformation distribution at. parameters (:py:data:typing.Any): Collection of parameters to ove...
[ "Evaluate", "inverse", "Rosenblatt", "transformation", "." ]
python
train
Erotemic/utool
utool/util_gridsearch.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_gridsearch.py#L1837-L1882
def grid_search_generator(grid_basis=[], *args, **kwargs): r""" Iteratively yeilds individual configuration points inside a defined basis. Args: grid_basis (list): a list of 2-component tuple. The named tuple looks like this: CommandLine: python -m utool.util_gridsearch...
[ "def", "grid_search_generator", "(", "grid_basis", "=", "[", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "grid_basis_", "=", "grid_basis", "+", "list", "(", "args", ")", "+", "list", "(", "kwargs", ".", "items", "(", ")", ")", "grid_bas...
r""" Iteratively yeilds individual configuration points inside a defined basis. Args: grid_basis (list): a list of 2-component tuple. The named tuple looks like this: CommandLine: python -m utool.util_gridsearch --test-grid_search_generator Example: >>> # ENABL...
[ "r", "Iteratively", "yeilds", "individual", "configuration", "points", "inside", "a", "defined", "basis", "." ]
python
train
HazyResearch/fonduer
src/fonduer/utils/data_model_utils/visual.py
https://github.com/HazyResearch/fonduer/blob/4520f86a716f03dcca458a9f4bddac75b4e7068f/src/fonduer/utils/data_model_utils/visual.py#L168-L189
def get_horz_ngrams( mention, attrib="words", n_min=1, n_max=1, lower=True, from_sentence=True ): """Return all ngrams which are visually horizontally aligned with the Mention. Note that if a candidate is passed in, all of its Mentions will be searched. :param mention: The Mention to evaluate :par...
[ "def", "get_horz_ngrams", "(", "mention", ",", "attrib", "=", "\"words\"", ",", "n_min", "=", "1", ",", "n_max", "=", "1", ",", "lower", "=", "True", ",", "from_sentence", "=", "True", ")", ":", "spans", "=", "_to_spans", "(", "mention", ")", "for", ...
Return all ngrams which are visually horizontally aligned with the Mention. Note that if a candidate is passed in, all of its Mentions will be searched. :param mention: The Mention to evaluate :param attrib: The token attribute type (e.g. words, lemmas, poses) :param n_min: The minimum n of the ngrams...
[ "Return", "all", "ngrams", "which", "are", "visually", "horizontally", "aligned", "with", "the", "Mention", "." ]
python
train
Gandi/pyramid_kvs
pyramid_kvs/perlsess.py
https://github.com/Gandi/pyramid_kvs/blob/36285f2e50d8181428f383f6fc1d79a34ea9ac3c/pyramid_kvs/perlsess.py#L31-L38
def connect(cls, settings): """ Call that method in the pyramid configuration phase. """ server = serializer('json').loads(settings['kvs.perlsess']) server.setdefault('key_prefix', 'perlsess::') server.setdefault('codec', 'storable') cls.cookie_name = server.pop('cookie_n...
[ "def", "connect", "(", "cls", ",", "settings", ")", ":", "server", "=", "serializer", "(", "'json'", ")", ".", "loads", "(", "settings", "[", "'kvs.perlsess'", "]", ")", "server", ".", "setdefault", "(", "'key_prefix'", ",", "'perlsess::'", ")", "server", ...
Call that method in the pyramid configuration phase.
[ "Call", "that", "method", "in", "the", "pyramid", "configuration", "phase", "." ]
python
test
resync/resync
resync/list_base_with_index.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/list_base_with_index.py#L242-L270
def as_xml_part(self, basename="/tmp/sitemap.xml", part_number=0): """Return a string of component sitemap number part_number. Used in the case of a large list that is split into component sitemaps. basename is used to create "index" links to the sitemapindex Q - what timestam...
[ "def", "as_xml_part", "(", "self", ",", "basename", "=", "\"/tmp/sitemap.xml\"", ",", "part_number", "=", "0", ")", ":", "if", "(", "not", "self", ".", "requires_multifile", "(", ")", ")", ":", "raise", "ListBaseIndexError", "(", "\"Request for component sitemap...
Return a string of component sitemap number part_number. Used in the case of a large list that is split into component sitemaps. basename is used to create "index" links to the sitemapindex Q - what timestamp should be used?
[ "Return", "a", "string", "of", "component", "sitemap", "number", "part_number", "." ]
python
train
devassistant/devassistant
devassistant/assistant_base.py
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/assistant_base.py#L33-L49
def get_subassistants(self): """Return list of instantiated subassistants. Usually, this needs not be overriden in subclasses, you should just override get_subassistant_classes Returns: list of instantiated subassistants """ if not hasattr(self, '_subassista...
[ "def", "get_subassistants", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_subassistants'", ")", ":", "self", ".", "_subassistants", "=", "[", "]", "# we want to know, if type(self) defines 'get_subassistant_classes',", "# we don't want to inherit it ...
Return list of instantiated subassistants. Usually, this needs not be overriden in subclasses, you should just override get_subassistant_classes Returns: list of instantiated subassistants
[ "Return", "list", "of", "instantiated", "subassistants", "." ]
python
train
PyCQA/pylint
pylint/checkers/base.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/base.py#L2214-L2233
def _check_type_x_is_y(self, node, left, operator, right): """Check for expressions like type(x) == Y.""" left_func = utils.safe_infer(left.func) if not ( isinstance(left_func, astroid.ClassDef) and left_func.qname() == TYPE_QNAME ): return if operator in...
[ "def", "_check_type_x_is_y", "(", "self", ",", "node", ",", "left", ",", "operator", ",", "right", ")", ":", "left_func", "=", "utils", ".", "safe_infer", "(", "left", ".", "func", ")", "if", "not", "(", "isinstance", "(", "left_func", ",", "astroid", ...
Check for expressions like type(x) == Y.
[ "Check", "for", "expressions", "like", "type", "(", "x", ")", "==", "Y", "." ]
python
test
underworldcode/stripy
stripy-src/stripy/cartesian.py
https://github.com/underworldcode/stripy/blob/d4c3480c3e58c88489ded695eadbe7cd5bf94b48/stripy-src/stripy/cartesian.py#L1082-L1117
def nearest_vertices(self, x, y, k=1, max_distance=np.inf ): """ Query the cKDtree for the nearest neighbours and Euclidean distance from x,y points. Returns 0, 0 if a cKDtree has not been constructed (switch tree=True if you need this routine) Parameters ------...
[ "def", "nearest_vertices", "(", "self", ",", "x", ",", "y", ",", "k", "=", "1", ",", "max_distance", "=", "np", ".", "inf", ")", ":", "if", "self", ".", "tree", "==", "False", "or", "self", ".", "tree", "==", "None", ":", "return", "0", ",", "0...
Query the cKDtree for the nearest neighbours and Euclidean distance from x,y points. Returns 0, 0 if a cKDtree has not been constructed (switch tree=True if you need this routine) Parameters ---------- x : 1D array of Cartesian x coordinates y : 1D array of Ca...
[ "Query", "the", "cKDtree", "for", "the", "nearest", "neighbours", "and", "Euclidean", "distance", "from", "x", "y", "points", "." ]
python
train
saulpw/visidata
visidata/vdtui.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/vdtui.py#L1306-L1310
def column(self, colregex): 'Return first column whose Column.name matches colregex.' for c in self.columns: if re.search(colregex, c.name, regex_flags()): return c
[ "def", "column", "(", "self", ",", "colregex", ")", ":", "for", "c", "in", "self", ".", "columns", ":", "if", "re", ".", "search", "(", "colregex", ",", "c", ".", "name", ",", "regex_flags", "(", ")", ")", ":", "return", "c" ]
Return first column whose Column.name matches colregex.
[ "Return", "first", "column", "whose", "Column", ".", "name", "matches", "colregex", "." ]
python
train
GPflow/GPflow
gpflow/training/scipy_optimizer.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/scipy_optimizer.py#L54-L91
def minimize(self, model, session=None, var_list=None, feed_dict=None, maxiter=1000, disp=False, initialize=False, anchor=True, step_callback=None, **kwargs): """ Minimizes objective function of the model. :param model: GPflow model with objective tensor. :param session...
[ "def", "minimize", "(", "self", ",", "model", ",", "session", "=", "None", ",", "var_list", "=", "None", ",", "feed_dict", "=", "None", ",", "maxiter", "=", "1000", ",", "disp", "=", "False", ",", "initialize", "=", "False", ",", "anchor", "=", "True...
Minimizes objective function of the model. :param model: GPflow model with objective tensor. :param session: Session where optimization will be run. :param var_list: List of extra variables which should be trained during optimization. :param feed_dict: Feed dictionary of tensors passed ...
[ "Minimizes", "objective", "function", "of", "the", "model", "." ]
python
train
google/grumpy
third_party/stdlib/threading.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/threading.py#L373-L398
def notify(self, n=1): """Wake up one or more threads waiting on this condition, if any. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the threads waiting for the condition variable; it is...
[ "def", "notify", "(", "self", ",", "n", "=", "1", ")", ":", "if", "not", "self", ".", "_is_owned", "(", ")", ":", "raise", "RuntimeError", "(", "\"cannot notify on un-acquired lock\"", ")", "__waiters", "=", "self", ".", "__waiters", "waiters", "=", "__wai...
Wake up one or more threads waiting on this condition, if any. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the threads waiting for the condition variable; it is a no-op if no threads are waiting...
[ "Wake", "up", "one", "or", "more", "threads", "waiting", "on", "this", "condition", "if", "any", "." ]
python
valid
Opentrons/opentrons
update-server/otupdate/buildroot/ssh_key_management.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/update-server/otupdate/buildroot/ssh_key_management.py#L18-L45
def require_linklocal(handler): """ Ensure the decorated is only called if the request is linklocal. The host ip address should be in the X-Host-IP header (provided by nginx) """ @functools.wraps(handler) async def decorated(request: web.Request) -> web.Response: ipaddr_str = request.header...
[ "def", "require_linklocal", "(", "handler", ")", ":", "@", "functools", ".", "wraps", "(", "handler", ")", "async", "def", "decorated", "(", "request", ":", "web", ".", "Request", ")", "->", "web", ".", "Response", ":", "ipaddr_str", "=", "request", ".",...
Ensure the decorated is only called if the request is linklocal. The host ip address should be in the X-Host-IP header (provided by nginx)
[ "Ensure", "the", "decorated", "is", "only", "called", "if", "the", "request", "is", "linklocal", "." ]
python
train
nephila/djangocms-installer
djangocms_installer/config/__init__.py
https://github.com/nephila/djangocms-installer/blob/9fec66d5f8b1e9a0f3c0ec66dd777db578fab07e/djangocms_installer/config/__init__.py#L20-L337
def parse(args): """ Define the available arguments """ from tzlocal import get_localzone try: timezone = get_localzone() if isinstance(timezone, pytz.BaseTzInfo): timezone = timezone.zone except Exception: # pragma: no cover timezone = 'UTC' if timezone...
[ "def", "parse", "(", "args", ")", ":", "from", "tzlocal", "import", "get_localzone", "try", ":", "timezone", "=", "get_localzone", "(", ")", "if", "isinstance", "(", "timezone", ",", "pytz", ".", "BaseTzInfo", ")", ":", "timezone", "=", "timezone", ".", ...
Define the available arguments
[ "Define", "the", "available", "arguments" ]
python
valid
MrYsLab/PyMata
PyMata/pymata.py
https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L223-L233
def analog_read(self, pin): """ Retrieve the last analog data value received for the specified pin. :param pin: Selected pin :return: The last value entered into the analog response table. """ with self.data_lock: data = self._command_handler.analog_response...
[ "def", "analog_read", "(", "self", ",", "pin", ")", ":", "with", "self", ".", "data_lock", ":", "data", "=", "self", ".", "_command_handler", ".", "analog_response_table", "[", "pin", "]", "[", "self", ".", "_command_handler", ".", "RESPONSE_TABLE_PIN_DATA_VAL...
Retrieve the last analog data value received for the specified pin. :param pin: Selected pin :return: The last value entered into the analog response table.
[ "Retrieve", "the", "last", "analog", "data", "value", "received", "for", "the", "specified", "pin", "." ]
python
valid
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/pytree.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/pytree.py#L183-L197
def next_sibling(self): """ The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None """ if self.parent is None: return None # Can't use index(); we need to test by identity ...
[ "def", "next_sibling", "(", "self", ")", ":", "if", "self", ".", "parent", "is", "None", ":", "return", "None", "# Can't use index(); we need to test by identity", "for", "i", ",", "child", "in", "enumerate", "(", "self", ".", "parent", ".", "children", ")", ...
The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None
[ "The", "node", "immediately", "following", "the", "invocant", "in", "their", "parent", "s", "children", "list", ".", "If", "the", "invocant", "does", "not", "have", "a", "next", "sibling", "it", "is", "None" ]
python
train
zsimic/runez
src/runez/serialize.py
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L51-L60
def from_json(cls, path, fatal=True, logger=None): """ :param str path: Path to json file :param bool|None fatal: Abort execution on failure if True :param callable|None logger: Logger to use :return: Deserialized object """ result = cls() result.load(path...
[ "def", "from_json", "(", "cls", ",", "path", ",", "fatal", "=", "True", ",", "logger", "=", "None", ")", ":", "result", "=", "cls", "(", ")", "result", ".", "load", "(", "path", ",", "fatal", "=", "fatal", ",", "logger", "=", "logger", ")", "retu...
:param str path: Path to json file :param bool|None fatal: Abort execution on failure if True :param callable|None logger: Logger to use :return: Deserialized object
[ ":", "param", "str", "path", ":", "Path", "to", "json", "file", ":", "param", "bool|None", "fatal", ":", "Abort", "execution", "on", "failure", "if", "True", ":", "param", "callable|None", "logger", ":", "Logger", "to", "use", ":", "return", ":", "Deseri...
python
train
totalgood/nlpia
src/nlpia/transcoders.py
https://github.com/totalgood/nlpia/blob/efa01126275e9cd3c3a5151a644f1c798a9ec53f/src/nlpia/transcoders.py#L62-L71
def delimit_slug(slug, sep=' '): """ Return a str of separated tokens found within a slugLike_This => 'slug Like This' >>> delimit_slug("slugLike_ThisW/aTLA's") 'slug Like This W a TLA s' >>> delimit_slug('slugLike_ThisW/aTLA', '|') 'slug|Like|This|W|a|TLA' """ hyphenated_slug = re.sub(CRE_...
[ "def", "delimit_slug", "(", "slug", ",", "sep", "=", "' '", ")", ":", "hyphenated_slug", "=", "re", ".", "sub", "(", "CRE_SLUG_DELIMITTER", ",", "sep", ",", "slug", ")", "return", "hyphenated_slug" ]
Return a str of separated tokens found within a slugLike_This => 'slug Like This' >>> delimit_slug("slugLike_ThisW/aTLA's") 'slug Like This W a TLA s' >>> delimit_slug('slugLike_ThisW/aTLA', '|') 'slug|Like|This|W|a|TLA'
[ "Return", "a", "str", "of", "separated", "tokens", "found", "within", "a", "slugLike_This", "=", ">", "slug", "Like", "This" ]
python
train
Garee/pytodoist
pytodoist/api.py
https://github.com/Garee/pytodoist/blob/3359cbff485ebdbbb4ffbd58d71e21a817874dd7/pytodoist/api.py#L415-L427
def _get(self, end_point, params=None, **kwargs): """Send a HTTP GET request to a Todoist API end-point. :param end_point: The Todoist API end-point. :type end_point: str :param params: The required request parameters. :type params: dict :param kwargs: Any optional param...
[ "def", "_get", "(", "self", ",", "end_point", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "requests", ".", "get", ",", "end_point", ",", "params", ",", "*", "*", "kwargs", ")" ]
Send a HTTP GET request to a Todoist API end-point. :param end_point: The Todoist API end-point. :type end_point: str :param params: The required request parameters. :type params: dict :param kwargs: Any optional parameters. :type kwargs: dict :return: The HTTP r...
[ "Send", "a", "HTTP", "GET", "request", "to", "a", "Todoist", "API", "end", "-", "point", "." ]
python
train
mcs07/ChemDataExtractor
chemdataextractor/cli/dict.py
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/cli/dict.py#L277-L290
def prepare_jochem(ctx, jochem, output, csoutput): """Process and filter jochem file to produce list of names for dictionary.""" click.echo('chemdataextractor.dict.prepare_jochem') for i, line in enumerate(jochem): print('JC%s' % i) if line.startswith('TM '): if line.endswith(' @...
[ "def", "prepare_jochem", "(", "ctx", ",", "jochem", ",", "output", ",", "csoutput", ")", ":", "click", ".", "echo", "(", "'chemdataextractor.dict.prepare_jochem'", ")", "for", "i", ",", "line", "in", "enumerate", "(", "jochem", ")", ":", "print", "(", "'JC...
Process and filter jochem file to produce list of names for dictionary.
[ "Process", "and", "filter", "jochem", "file", "to", "produce", "list", "of", "names", "for", "dictionary", "." ]
python
train
AndrewIngram/django-extra-views
extra_views/advanced.py
https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/advanced.py#L61-L68
def forms_valid(self, form, inlines): """ If the form and formsets are valid, save the associated models. """ response = self.form_valid(form) for formset in inlines: formset.save() return response
[ "def", "forms_valid", "(", "self", ",", "form", ",", "inlines", ")", ":", "response", "=", "self", ".", "form_valid", "(", "form", ")", "for", "formset", "in", "inlines", ":", "formset", ".", "save", "(", ")", "return", "response" ]
If the form and formsets are valid, save the associated models.
[ "If", "the", "form", "and", "formsets", "are", "valid", "save", "the", "associated", "models", "." ]
python
valid
titusz/epubcheck
src/epubcheck/utils.py
https://github.com/titusz/epubcheck/blob/7adde81543d3ae7385ab7062adb76e1414d49c2e/src/epubcheck/utils.py#L13-L22
def java_version(): """Call java and return version information. :return unicode: Java version string """ result = subprocess.check_output( [c.JAVA, '-version'], stderr=subprocess.STDOUT ) first_line = result.splitlines()[0] return first_line.decode()
[ "def", "java_version", "(", ")", ":", "result", "=", "subprocess", ".", "check_output", "(", "[", "c", ".", "JAVA", ",", "'-version'", "]", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "first_line", "=", "result", ".", "splitlines", "(", ")", ...
Call java and return version information. :return unicode: Java version string
[ "Call", "java", "and", "return", "version", "information", "." ]
python
train
admiralobvious/vyper
vyper/vyper.py
https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L235-L237
def unmarshall_key(self, key, cls): """Takes a single key and unmarshalls it into a class.""" return setattr(cls, key, self.get(key))
[ "def", "unmarshall_key", "(", "self", ",", "key", ",", "cls", ")", ":", "return", "setattr", "(", "cls", ",", "key", ",", "self", ".", "get", "(", "key", ")", ")" ]
Takes a single key and unmarshalls it into a class.
[ "Takes", "a", "single", "key", "and", "unmarshalls", "it", "into", "a", "class", "." ]
python
train
Opentrons/opentrons
api/src/opentrons/legacy_api/containers/placeable.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/legacy_api/containers/placeable.py#L556-L566
def transpose(self, rows): """ Transposes the grid to allow for cols """ res = OrderedDict() for row, cols in rows.items(): for col, cell in cols.items(): if col not in res: res[col] = OrderedDict() res[col][row] = c...
[ "def", "transpose", "(", "self", ",", "rows", ")", ":", "res", "=", "OrderedDict", "(", ")", "for", "row", ",", "cols", "in", "rows", ".", "items", "(", ")", ":", "for", "col", ",", "cell", "in", "cols", ".", "items", "(", ")", ":", "if", "col"...
Transposes the grid to allow for cols
[ "Transposes", "the", "grid", "to", "allow", "for", "cols" ]
python
train
rootpy/rootpy
rootpy/extern/byteplay2/__init__.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/byteplay2/__init__.py#L439-L643
def _compute_stacksize(self): """Get a code list, compute its maximal stack usage.""" # This is done by scanning the code, and computing for each opcode # the stack state at the opcode. code = self.code # A mapping from labels to their positions in the code list label_po...
[ "def", "_compute_stacksize", "(", "self", ")", ":", "# This is done by scanning the code, and computing for each opcode", "# the stack state at the opcode.", "code", "=", "self", ".", "code", "# A mapping from labels to their positions in the code list", "label_pos", "=", "dict", "...
Get a code list, compute its maximal stack usage.
[ "Get", "a", "code", "list", "compute", "its", "maximal", "stack", "usage", "." ]
python
train
sentinel-hub/eo-learn
core/eolearn/core/utilities.py
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/utilities.py#L204-L212
def _parse_names_set(feature_names): """Helping function of `_parse_feature_names` that parses a set of feature names.""" feature_collection = OrderedDict() for feature_name in feature_names: if isinstance(feature_name, str): feature_collection[feature_name] = .....
[ "def", "_parse_names_set", "(", "feature_names", ")", ":", "feature_collection", "=", "OrderedDict", "(", ")", "for", "feature_name", "in", "feature_names", ":", "if", "isinstance", "(", "feature_name", ",", "str", ")", ":", "feature_collection", "[", "feature_nam...
Helping function of `_parse_feature_names` that parses a set of feature names.
[ "Helping", "function", "of", "_parse_feature_names", "that", "parses", "a", "set", "of", "feature", "names", "." ]
python
train
fastai/fastai
fastai/datasets.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L199-L204
def datapath4file(filename, ext:str='.tgz', archive=True): "Return data path to `filename`, checking locally first then in the config file." local_path = URLs.LOCAL_PATH/'data'/filename if local_path.exists() or local_path.with_suffix(ext).exists(): return local_path elif archive: return Config.data_arc...
[ "def", "datapath4file", "(", "filename", ",", "ext", ":", "str", "=", "'.tgz'", ",", "archive", "=", "True", ")", ":", "local_path", "=", "URLs", ".", "LOCAL_PATH", "/", "'data'", "/", "filename", "if", "local_path", ".", "exists", "(", ")", "or", "loc...
Return data path to `filename`, checking locally first then in the config file.
[ "Return", "data", "path", "to", "filename", "checking", "locally", "first", "then", "in", "the", "config", "file", "." ]
python
train
KE-works/pykechain
pykechain/client.py
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1208-L1277
def create_property(self, model, name, description=None, property_type=PropertyType.CHAR_VALUE, default_value=None, unit=None, options=None): """Create a new property model under a given model. Use the :class:`enums.PropertyType` to select which property type to create to ensure...
[ "def", "create_property", "(", "self", ",", "model", ",", "name", ",", "description", "=", "None", ",", "property_type", "=", "PropertyType", ".", "CHAR_VALUE", ",", "default_value", "=", "None", ",", "unit", "=", "None", ",", "options", "=", "None", ")", ...
Create a new property model under a given model. Use the :class:`enums.PropertyType` to select which property type to create to ensure that you provide the correct values to the KE-chain backend. The default is a `PropertyType.CHAR_VALUE` which is a single line text in KE-chain. :param...
[ "Create", "a", "new", "property", "model", "under", "a", "given", "model", "." ]
python
train
clalancette/pycdlib
pycdlib/dr.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/dr.py#L584-L607
def new_dotdot(self, vd, parent, seqnum, rock_ridge, log_block_size, rr_relocated_parent, xa, file_mode): # type: (headervd.PrimaryOrSupplementaryVD, DirectoryRecord, int, str, int, bool, bool, int) -> None ''' Create a new 'dotdot' Directory Record. Parameters: ...
[ "def", "new_dotdot", "(", "self", ",", "vd", ",", "parent", ",", "seqnum", ",", "rock_ridge", ",", "log_block_size", ",", "rr_relocated_parent", ",", "xa", ",", "file_mode", ")", ":", "# type: (headervd.PrimaryOrSupplementaryVD, DirectoryRecord, int, str, int, bool, bool,...
Create a new 'dotdot' Directory Record. Parameters: vd - The Volume Descriptor this record is part of. parent - The parent of this directory record. seqnum - The sequence number for this directory record. rock_ridge - Whether to make this a Rock Ridge directory record. ...
[ "Create", "a", "new", "dotdot", "Directory", "Record", "." ]
python
train
kervi/kervi-devices
kervi/devices/gpio/MCP230XX.py
https://github.com/kervi/kervi-devices/blob/c6aaddc6da1d0bce0ea2b0c6eb8393ba10aefa56/kervi/devices/gpio/MCP230XX.py#L106-L114
def _input_pins(self, pins): """Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low. """ [self._validate_channel(pin) for pin in pins] # Get GPIO state. gpio = self.i2c.read...
[ "def", "_input_pins", "(", "self", ",", "pins", ")", ":", "[", "self", ".", "_validate_channel", "(", "pin", ")", "for", "pin", "in", "pins", "]", "# Get GPIO state.", "gpio", "=", "self", ".", "i2c", ".", "read_list", "(", "self", ".", "GPIO", ",", ...
Read multiple pins specified in the given list and return list of pin values GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.
[ "Read", "multiple", "pins", "specified", "in", "the", "given", "list", "and", "return", "list", "of", "pin", "values", "GPIO", ".", "HIGH", "/", "True", "if", "the", "pin", "is", "pulled", "high", "or", "GPIO", ".", "LOW", "/", "False", "if", "pulled",...
python
train
f3at/feat
src/feat/common/manhole.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/common/manhole.py#L85-L91
def help(self): '''Prints exposed methods and their docstrings.''' cmds = self.get_exposed_cmds() t = text_helper.Table(fields=['command', 'doc'], lengths=[50, 85]) return t.render((reflect.formatted_function_name(x), x.__doc__, ) for...
[ "def", "help", "(", "self", ")", ":", "cmds", "=", "self", ".", "get_exposed_cmds", "(", ")", "t", "=", "text_helper", ".", "Table", "(", "fields", "=", "[", "'command'", ",", "'doc'", "]", ",", "lengths", "=", "[", "50", ",", "85", "]", ")", "re...
Prints exposed methods and their docstrings.
[ "Prints", "exposed", "methods", "and", "their", "docstrings", "." ]
python
train
fhamborg/news-please
newsplease/helper_classes/heuristics.py
https://github.com/fhamborg/news-please/blob/731837c2a6c223cfb3e1d7f5fdc4f4eced2310f9/newsplease/helper_classes/heuristics.py#L36-L52
def meta_contains_article_keyword(self, response, site_dict): """ Determines wether the response's meta data contains the keyword 'article' :param obj response: The scrapy response :param dict site_dict: The site object from the JSON-File :return bool: Determines wether...
[ "def", "meta_contains_article_keyword", "(", "self", ",", "response", ",", "site_dict", ")", ":", "contains_meta", "=", "response", ".", "xpath", "(", "'//meta'", ")", ".", "re", "(", "'(= ?[\"\\'][^\"\\']*article[^\"\\']*[\"\\'])'", ")", "if", "not", "contains_meta...
Determines wether the response's meta data contains the keyword 'article' :param obj response: The scrapy response :param dict site_dict: The site object from the JSON-File :return bool: Determines wether the reponse's meta data contains the keyword 'article'
[ "Determines", "wether", "the", "response", "s", "meta", "data", "contains", "the", "keyword", "article" ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pycallgraph.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pycallgraph.py#L372-L397
def get_gdf(stop=True): """Returns a string containing a GDF file. Setting stop to True will cause the trace to stop. """ ret = ['nodedef>name VARCHAR, label VARCHAR, hits INTEGER, ' + \ 'calls_frac DOUBLE, total_time_frac DOUBLE, ' + \ 'total_time DOUBLE, color VARCHAR, width DO...
[ "def", "get_gdf", "(", "stop", "=", "True", ")", ":", "ret", "=", "[", "'nodedef>name VARCHAR, label VARCHAR, hits INTEGER, '", "+", "'calls_frac DOUBLE, total_time_frac DOUBLE, '", "+", "'total_time DOUBLE, color VARCHAR, width DOUBLE'", "]", "for", "func", ",", "hits", "i...
Returns a string containing a GDF file. Setting stop to True will cause the trace to stop.
[ "Returns", "a", "string", "containing", "a", "GDF", "file", ".", "Setting", "stop", "to", "True", "will", "cause", "the", "trace", "to", "stop", "." ]
python
train
panosl/django-currencies
currencies/management/commands/_yahoofinance.py
https://github.com/panosl/django-currencies/blob/8d4c6c202ad7c4cc06263ab2c1b1f969bbe99acd/currencies/management/commands/_yahoofinance.py#L102-L109
def get_bulkrates(self): """Get & format the rates dict""" try: resp = get(self.bulk_url) resp.raise_for_status() except exceptions.RequestException as e: raise RuntimeError(e) return resp.json()
[ "def", "get_bulkrates", "(", "self", ")", ":", "try", ":", "resp", "=", "get", "(", "self", ".", "bulk_url", ")", "resp", ".", "raise_for_status", "(", ")", "except", "exceptions", ".", "RequestException", "as", "e", ":", "raise", "RuntimeError", "(", "e...
Get & format the rates dict
[ "Get", "&", "format", "the", "rates", "dict" ]
python
train
Diviyan-Kalainathan/CausalDiscoveryToolbox
cdt/causality/pairwise/RCC.py
https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/causality/pairwise/RCC.py#L97-L114
def fit(self, x, y): """Train the model. Args: x_tr (pd.DataFrame): CEPC format dataframe containing the pairs y_tr (pd.DataFrame or np.ndarray): labels associated to the pairs """ train = np.vstack((np.array([self.featurize_row(row.iloc[0], ...
[ "def", "fit", "(", "self", ",", "x", ",", "y", ")", ":", "train", "=", "np", ".", "vstack", "(", "(", "np", ".", "array", "(", "[", "self", ".", "featurize_row", "(", "row", ".", "iloc", "[", "0", "]", ",", "row", ".", "iloc", "[", "1", "]"...
Train the model. Args: x_tr (pd.DataFrame): CEPC format dataframe containing the pairs y_tr (pd.DataFrame or np.ndarray): labels associated to the pairs
[ "Train", "the", "model", "." ]
python
valid
agoragames/chai
chai/stub.py
https://github.com/agoragames/chai/blob/8148d7b7754226b0d1cabfc2af10cd912612abdc/chai/stub.py#L271-L277
def spy(self): ''' Add a spy to this stub. Return the spy. ''' spy = Spy(self) self._expectations.append(spy) return spy
[ "def", "spy", "(", "self", ")", ":", "spy", "=", "Spy", "(", "self", ")", "self", ".", "_expectations", ".", "append", "(", "spy", ")", "return", "spy" ]
Add a spy to this stub. Return the spy.
[ "Add", "a", "spy", "to", "this", "stub", ".", "Return", "the", "spy", "." ]
python
train
google/grr
grr/server/grr_response_server/aff4.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L3010-L3025
def Read(self, length): """Read a block of data from the file.""" result = b"" # The total available size in the file length = int(length) length = min(length, self.size - self.offset) while length > 0: data = self._ReadPartial(length) if not data: break length -= le...
[ "def", "Read", "(", "self", ",", "length", ")", ":", "result", "=", "b\"\"", "# The total available size in the file", "length", "=", "int", "(", "length", ")", "length", "=", "min", "(", "length", ",", "self", ".", "size", "-", "self", ".", "offset", ")...
Read a block of data from the file.
[ "Read", "a", "block", "of", "data", "from", "the", "file", "." ]
python
train
swevm/scaleio-py
scaleiopy/api/scaleio/provisioning/volume.py
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/provisioning/volume.py#L49-L61
def is_valid_volsize(self,volsize): """ Convenience method that round input to valid ScaleIO Volume size (8GB increments) :param volsize: Size in MB :rtype int: Valid ScaleIO Volume size rounded to nearest 8GB increment above or equal to volsize """ if type(volsi...
[ "def", "is_valid_volsize", "(", "self", ",", "volsize", ")", ":", "if", "type", "(", "volsize", ")", "is", "int", ":", "size_temp", "=", "divmod", "(", "volsize", ",", "8192", ")", "if", "size_temp", "[", "1", "]", ">", "0", ":", "# If not on 8GB bound...
Convenience method that round input to valid ScaleIO Volume size (8GB increments) :param volsize: Size in MB :rtype int: Valid ScaleIO Volume size rounded to nearest 8GB increment above or equal to volsize
[ "Convenience", "method", "that", "round", "input", "to", "valid", "ScaleIO", "Volume", "size", "(", "8GB", "increments", ")", ":", "param", "volsize", ":", "Size", "in", "MB", ":", "rtype", "int", ":", "Valid", "ScaleIO", "Volume", "size", "rounded", "to",...
python
train
a1ezzz/wasp-general
wasp_general/command/template_command.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/template_command.py#L84-L97
def result_template(self, *command_tokens, **command_env): """ Generate template result. command_tokens and command_env arguments are used for template detailing :param command_tokens: same as command_tokens in :meth:`.WCommandProto.match` and \ :meth:`.WCommandProto.exec` methods (so as :meth:`.WCommand._exec...
[ "def", "result_template", "(", "self", ",", "*", "command_tokens", ",", "*", "*", "command_env", ")", ":", "result", "=", "WCommandResultTemplate", "(", "self", ".", "template", "(", ")", ")", "result", ".", "update_context", "(", "*", "*", "self", ".", ...
Generate template result. command_tokens and command_env arguments are used for template detailing :param command_tokens: same as command_tokens in :meth:`.WCommandProto.match` and \ :meth:`.WCommandProto.exec` methods (so as :meth:`.WCommand._exec`) :param command_env: same as command_env in :meth:`.WCommandP...
[ "Generate", "template", "result", ".", "command_tokens", "and", "command_env", "arguments", "are", "used", "for", "template", "detailing" ]
python
train
teepark/junction
junction/hub.py
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L265-L302
def send_rpc(self, service, routing_id, method, args=None, kwargs=None, broadcast=False): '''Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the r...
[ "def", "send_rpc", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "broadcast", "=", "False", ")", ":", "rpc", "=", "self", ".", "_dispatcher", ".", "send_rpc", "(", "service", ...
Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registered handlers of the service. :type routing_id: int :param method: the method na...
[ "Send", "out", "an", "RPC", "request" ]
python
train
codemaniac/graphgit
graphgit/core.py
https://github.com/codemaniac/graphgit/blob/fd25d990ea1a32f328db07e4f57feafe03bd20a1/graphgit/core.py#L18-L96
def graph_repo(repo_url, output_loc, format='graphml'): """ generates a graph for a git repository """ log = logging.getLogger("graphgit") # repo type local_repo = os.path.isabs(repo_url) # repo name repo_name = repo_url[repo_url.rfind('/')+1:repo_url.rfind('.git')] \ if not local_repo else repo_url[r...
[ "def", "graph_repo", "(", "repo_url", ",", "output_loc", ",", "format", "=", "'graphml'", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "\"graphgit\"", ")", "# repo type", "local_repo", "=", "os", ".", "path", ".", "isabs", "(", "repo_url", ")", ...
generates a graph for a git repository
[ "generates", "a", "graph", "for", "a", "git", "repository" ]
python
train
saltstack/salt
salt/modules/status.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/status.py#L1254-L1431
def netdev(): ''' .. versionchanged:: 2016.3.2 Return the network device stats for this minion .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' status.netdev ''' def linux_netdev(): ''' linux specific i...
[ "def", "netdev", "(", ")", ":", "def", "linux_netdev", "(", ")", ":", "'''\n linux specific implementation of netdev\n '''", "ret", "=", "{", "}", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "'/proc/net/dev'", ",", ...
.. versionchanged:: 2016.3.2 Return the network device stats for this minion .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' status.netdev
[ "..", "versionchanged", "::", "2016", ".", "3", ".", "2", "Return", "the", "network", "device", "stats", "for", "this", "minion" ]
python
train
openstates/billy
billy/models/bills.py
https://github.com/openstates/billy/blob/5fc795347f12a949e410a8cfad0c911ea6bced67/billy/models/bills.py#L291-L300
def is_probably_a_voice_vote(self): '''Guess whether this vote is a "voice vote".''' if '+voice_vote' in self: return True if '+vote_type' in self: if self['+vote_type'] == 'Voice': return True if 'voice vote' in self['motion'].lower(): ...
[ "def", "is_probably_a_voice_vote", "(", "self", ")", ":", "if", "'+voice_vote'", "in", "self", ":", "return", "True", "if", "'+vote_type'", "in", "self", ":", "if", "self", "[", "'+vote_type'", "]", "==", "'Voice'", ":", "return", "True", "if", "'voice vote'...
Guess whether this vote is a "voice vote".
[ "Guess", "whether", "this", "vote", "is", "a", "voice", "vote", "." ]
python
train
xiaocong/uiautomator
uiautomator/__init__.py
https://github.com/xiaocong/uiautomator/blob/9a0c892ffd056713f91aa2153d1533c5b0553a1c/uiautomator/__init__.py#L767-L788
def press(self): ''' press key via name or key code. Supported key name includes: home, back, left, right, up, down, center, menu, search, enter, delete(or del), recent(recent apps), volume_up, volume_down, volume_mute, camera, power. Usage: d.press.back() # pres...
[ "def", "press", "(", "self", ")", ":", "@", "param_to_property", "(", "key", "=", "[", "\"home\"", ",", "\"back\"", ",", "\"left\"", ",", "\"right\"", ",", "\"up\"", ",", "\"down\"", ",", "\"center\"", ",", "\"menu\"", ",", "\"search\"", ",", "\"enter\"", ...
press key via name or key code. Supported key name includes: home, back, left, right, up, down, center, menu, search, enter, delete(or del), recent(recent apps), volume_up, volume_down, volume_mute, camera, power. Usage: d.press.back() # press back key d.press.menu() # ...
[ "press", "key", "via", "name", "or", "key", "code", ".", "Supported", "key", "name", "includes", ":", "home", "back", "left", "right", "up", "down", "center", "menu", "search", "enter", "delete", "(", "or", "del", ")", "recent", "(", "recent", "apps", ...
python
train
alfred82santa/dirty-loader
dirty_loader/__init__.py
https://github.com/alfred82santa/dirty-loader/blob/0d7895e3c84a0c197d804ce31305c5cba4c512e4/dirty_loader/__init__.py#L81-L99
def load_class(self, classname): """ Loads a class looking for it in each module registered. :param classname: Class name you want to load. :type classname: str :return: Class object :rtype: type """ module_list = self._get_module_list() for mod...
[ "def", "load_class", "(", "self", ",", "classname", ")", ":", "module_list", "=", "self", ".", "_get_module_list", "(", ")", "for", "module", "in", "module_list", ":", "try", ":", "return", "import_class", "(", "classname", ",", "module", ".", "__name__", ...
Loads a class looking for it in each module registered. :param classname: Class name you want to load. :type classname: str :return: Class object :rtype: type
[ "Loads", "a", "class", "looking", "for", "it", "in", "each", "module", "registered", "." ]
python
train
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L36-L47
async def listWorkerTypes(self, *args, **kwargs): """ See the list of worker types which are known to be managed This method is only for debugging the ec2-manager This method gives output: ``v1/list-worker-types.json#`` This method is ``experimental`` """ retu...
[ "async", "def", "listWorkerTypes", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"listWorkerTypes\"", "]", ",", "*", "args", ",", "*", "*", "kwargs...
See the list of worker types which are known to be managed This method is only for debugging the ec2-manager This method gives output: ``v1/list-worker-types.json#`` This method is ``experimental``
[ "See", "the", "list", "of", "worker", "types", "which", "are", "known", "to", "be", "managed" ]
python
train
sbg/sevenbridges-python
sevenbridges/meta/transformer.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/meta/transformer.py#L38-L51
def to_task(task): """Serializes task to id string :param task: object to serialize :return: string id """ from sevenbridges.models.task import Task if not task: raise SbgError('Task is required!') elif isinstance(task, Task): return task.i...
[ "def", "to_task", "(", "task", ")", ":", "from", "sevenbridges", ".", "models", ".", "task", "import", "Task", "if", "not", "task", ":", "raise", "SbgError", "(", "'Task is required!'", ")", "elif", "isinstance", "(", "task", ",", "Task", ")", ":", "retu...
Serializes task to id string :param task: object to serialize :return: string id
[ "Serializes", "task", "to", "id", "string", ":", "param", "task", ":", "object", "to", "serialize", ":", "return", ":", "string", "id" ]
python
train
rwl/pylon
pylon/solver.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/solver.py#L726-L732
def _consfcn(self, x): """ Evaluates nonlinear constraints and their Jacobian for OPF. """ h, g = self._gh(x) dh, dg = self._dgh(x) return h, g, dh, dg
[ "def", "_consfcn", "(", "self", ",", "x", ")", ":", "h", ",", "g", "=", "self", ".", "_gh", "(", "x", ")", "dh", ",", "dg", "=", "self", ".", "_dgh", "(", "x", ")", "return", "h", ",", "g", ",", "dh", ",", "dg" ]
Evaluates nonlinear constraints and their Jacobian for OPF.
[ "Evaluates", "nonlinear", "constraints", "and", "their", "Jacobian", "for", "OPF", "." ]
python
train
aholkner/bacon
native/Vendor/FreeType/src/tools/docmaker/tohtml.py
https://github.com/aholkner/bacon/blob/edf3810dcb211942d392a8637945871399b0650d/native/Vendor/FreeType/src/tools/docmaker/tohtml.py#L311-L320
def make_html_items( self, items ): """ convert a field's content into some valid HTML """ lines = [] for item in items: if item.lines: lines.append( self.make_html_code( item.lines ) ) else: lines.append( self.make_html_para( item.words )...
[ "def", "make_html_items", "(", "self", ",", "items", ")", ":", "lines", "=", "[", "]", "for", "item", "in", "items", ":", "if", "item", ".", "lines", ":", "lines", ".", "append", "(", "self", ".", "make_html_code", "(", "item", ".", "lines", ")", "...
convert a field's content into some valid HTML
[ "convert", "a", "field", "s", "content", "into", "some", "valid", "HTML" ]
python
test
hermanschaaf/mafan
mafan/hanzidentifier/hanzidentifier.py
https://github.com/hermanschaaf/mafan/blob/373ddf299aeb2bd8413bf921c71768af7a8170ea/mafan/hanzidentifier/hanzidentifier.py#L38-L60
def identify(text): """Identify whether a string is simplified or traditional Chinese. Returns: None: if there are no recognizd Chinese characters. EITHER: if the test is inconclusive. TRAD: if the text is traditional. SIMP: if the text is simplified. BOTH: the text has ...
[ "def", "identify", "(", "text", ")", ":", "filtered_text", "=", "set", "(", "list", "(", "text", ")", ")", ".", "intersection", "(", "ALL_CHARS", ")", "if", "len", "(", "filtered_text", ")", "is", "0", ":", "return", "None", "if", "filtered_text", ".",...
Identify whether a string is simplified or traditional Chinese. Returns: None: if there are no recognizd Chinese characters. EITHER: if the test is inconclusive. TRAD: if the text is traditional. SIMP: if the text is simplified. BOTH: the text has characters recognized as be...
[ "Identify", "whether", "a", "string", "is", "simplified", "or", "traditional", "Chinese", "." ]
python
train
exa-analytics/exa
exa/core/container.py
https://github.com/exa-analytics/exa/blob/40fb3c22b531d460dbc51e603de75b856cc28f0d/exa/core/container.py#L183-L213
def info(self): """ Display information about the container's data objects (note that info on metadata and visualization objects is also provided). Note: Sizes are reported in bytes. """ names = [] types = [] sizes = [] names.append('W...
[ "def", "info", "(", "self", ")", ":", "names", "=", "[", "]", "types", "=", "[", "]", "sizes", "=", "[", "]", "names", ".", "append", "(", "'WIDGET'", ")", "types", ".", "append", "(", "'-'", ")", "s", "=", "0", "sizes", ".", "append", "(", "...
Display information about the container's data objects (note that info on metadata and visualization objects is also provided). Note: Sizes are reported in bytes.
[ "Display", "information", "about", "the", "container", "s", "data", "objects", "(", "note", "that", "info", "on", "metadata", "and", "visualization", "objects", "is", "also", "provided", ")", "." ]
python
train
Kozea/cairocffi
cairocffi/surfaces.py
https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/surfaces.py#L525-L536
def supports_mime_type(self, mime_type): """ Return whether surface supports :obj:`mime_type`. :param mime_type: The MIME type of the image data. :type mime_type: ASCII string *New in cairo 1.12.* """ mime_type = ffi.new('char[]', mime_type.encode('utf8')) retu...
[ "def", "supports_mime_type", "(", "self", ",", "mime_type", ")", ":", "mime_type", "=", "ffi", ".", "new", "(", "'char[]'", ",", "mime_type", ".", "encode", "(", "'utf8'", ")", ")", "return", "bool", "(", "cairo", ".", "cairo_surface_supports_mime_type", "("...
Return whether surface supports :obj:`mime_type`. :param mime_type: The MIME type of the image data. :type mime_type: ASCII string *New in cairo 1.12.*
[ "Return", "whether", "surface", "supports", ":", "obj", ":", "mime_type", "." ]
python
train
googleapis/google-cloud-python
api_core/google/api_core/operation.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/operation.py#L116-L146
def _set_result_from_operation(self): """Set the result or exception from the operation if it is complete.""" # This must be done in a lock to prevent the polling thread # and main thread from both executing the completion logic # at the same time. with self._completion_lock: ...
[ "def", "_set_result_from_operation", "(", "self", ")", ":", "# This must be done in a lock to prevent the polling thread", "# and main thread from both executing the completion logic", "# at the same time.", "with", "self", ".", "_completion_lock", ":", "# If the operation isn't complete...
Set the result or exception from the operation if it is complete.
[ "Set", "the", "result", "or", "exception", "from", "the", "operation", "if", "it", "is", "complete", "." ]
python
train
mdgoldberg/sportsref
sportsref/nfl/teams.py
https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/teams.py#L322-L334
def off_scheme(self, year): """Returns the name of the offensive scheme the team ran in the given year. :year: Int representing the season year. :returns: A string representing the offensive scheme. """ scheme_text = self._year_info_pq(year, 'Offensive Scheme').text() ...
[ "def", "off_scheme", "(", "self", ",", "year", ")", ":", "scheme_text", "=", "self", ".", "_year_info_pq", "(", "year", ",", "'Offensive Scheme'", ")", ".", "text", "(", ")", "m", "=", "re", ".", "search", "(", "r'Offensive Scheme[:\\s]*(.+)\\s*'", ",", "s...
Returns the name of the offensive scheme the team ran in the given year. :year: Int representing the season year. :returns: A string representing the offensive scheme.
[ "Returns", "the", "name", "of", "the", "offensive", "scheme", "the", "team", "ran", "in", "the", "given", "year", "." ]
python
test
fracpete/python-weka-wrapper3
python/weka/datagenerators.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/datagenerators.py#L167-L177
def make_copy(cls, generator): """ Creates a copy of the generator. :param generator: the generator to copy :type generator: DataGenerator :return: the copy of the generator :rtype: DataGenerator """ return from_commandline( to_commandline(gen...
[ "def", "make_copy", "(", "cls", ",", "generator", ")", ":", "return", "from_commandline", "(", "to_commandline", "(", "generator", ")", ",", "classname", "=", "classes", ".", "get_classname", "(", "DataGenerator", "(", ")", ")", ")" ]
Creates a copy of the generator. :param generator: the generator to copy :type generator: DataGenerator :return: the copy of the generator :rtype: DataGenerator
[ "Creates", "a", "copy", "of", "the", "generator", "." ]
python
train
sdispater/poetry
poetry/repositories/pypi_repository.py
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/repositories/pypi_repository.py#L230-L242
def get_package_info(self, name): # type: (str) -> dict """ Return the package information given its name. The information is returned from the cache if it exists or retrieved from the remote server. """ if self._disable_cache: return self._get_package_info(...
[ "def", "get_package_info", "(", "self", ",", "name", ")", ":", "# type: (str) -> dict", "if", "self", ".", "_disable_cache", ":", "return", "self", ".", "_get_package_info", "(", "name", ")", "return", "self", ".", "_cache", ".", "store", "(", "\"packages\"", ...
Return the package information given its name. The information is returned from the cache if it exists or retrieved from the remote server.
[ "Return", "the", "package", "information", "given", "its", "name", "." ]
python
train
horazont/aioxmpp
aioxmpp/disco/service.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L644-L746
def query_info(self, jid, *, node=None, require_fresh=False, timeout=None, no_cache=False): """ Query the features and identities of the specified entity. :param jid: The entity to query. :type jid: :class:`aioxmpp.JID` :param node: The node...
[ "def", "query_info", "(", "self", ",", "jid", ",", "*", ",", "node", "=", "None", ",", "require_fresh", "=", "False", ",", "timeout", "=", "None", ",", "no_cache", "=", "False", ")", ":", "key", "=", "jid", ",", "node", "if", "not", "require_fresh", ...
Query the features and identities of the specified entity. :param jid: The entity to query. :type jid: :class:`aioxmpp.JID` :param node: The node to query. :type node: :class:`str` or :data:`None` :param require_fresh: Boolean flag to discard previous caches. :type requi...
[ "Query", "the", "features", "and", "identities", "of", "the", "specified", "entity", "." ]
python
train
twisted/vertex
vertex/q2q.py
https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/q2q.py#L754-L903
def verifyCertificateAllowed(self, ourAddress, theirAddress): """ Check that the cert currently in use by this transport is valid to claim that the connection offers authorization for this host speaking for C{ourAddress}, ...
[ "def", "verifyCertificateAllowed", "(", "self", ",", "ourAddress", ",", "theirAddress", ")", ":", "# XXX TODO: Somehow, it's got to be possible for a single cluster to", "# internally claim to be agents of any other host when issuing a", "# CONNECT; in other words, we always implicitly trust...
Check that the cert currently in use by this transport is valid to claim that the connection offers authorization for this host speaking for C{ourAddress}, to a host speaking for C{theirAddress}. The remote host (the one claiming to use theirAddress) may have a certificate which is issu...
[ "Check", "that", "the", "cert", "currently", "in", "use", "by", "this", "transport", "is", "valid", "to", "claim", "that", "the", "connection", "offers", "authorization", "for", "this", "host", "speaking", "for", "C", "{", "ourAddress", "}", "to", "a", "ho...
python
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/remo.py
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/remo.py#L70-L82
def get_identities(self, item): """Return the identities from an item""" item = item['data'] if 'owner' in item: owner = self.get_sh_identity(item['owner']) yield owner if 'user' in item: user = self.get_sh_identity(item['user']) yield use...
[ "def", "get_identities", "(", "self", ",", "item", ")", ":", "item", "=", "item", "[", "'data'", "]", "if", "'owner'", "in", "item", ":", "owner", "=", "self", ".", "get_sh_identity", "(", "item", "[", "'owner'", "]", ")", "yield", "owner", "if", "'u...
Return the identities from an item
[ "Return", "the", "identities", "from", "an", "item" ]
python
train
coyo8/parinx
parinx/parser.py
https://github.com/coyo8/parinx/blob/6493798ceba8089345d970f71be4a896eb6b081d/parinx/parser.py#L48-L59
def parse_request_headers(headers): """ convert headers in human readable format :param headers: :return: """ request_header_keys = set(headers.keys(lower=True)) request_meta_keys = set(XHEADERS_TO_ARGS_DICT.keys()) data_header_keys = request_header_keys.intersection(request_meta_keys) ...
[ "def", "parse_request_headers", "(", "headers", ")", ":", "request_header_keys", "=", "set", "(", "headers", ".", "keys", "(", "lower", "=", "True", ")", ")", "request_meta_keys", "=", "set", "(", "XHEADERS_TO_ARGS_DICT", ".", "keys", "(", ")", ")", "data_he...
convert headers in human readable format :param headers: :return:
[ "convert", "headers", "in", "human", "readable", "format" ]
python
train
emory-libraries/eulxml
eulxml/forms/xmlobject.py
https://github.com/emory-libraries/eulxml/blob/17d71c7d98c0cebda9932b7f13e72093805e1fe2/eulxml/forms/xmlobject.py#L44-L57
def _parse_field_list(fieldnames, include_parents=False): """ Parse a list of field names, possibly including dot-separated subform fields, into an internal ParsedFieldList object representing the base fields and subform listed. :param fieldnames: a list of field names as strings. dot-separated nam...
[ "def", "_parse_field_list", "(", "fieldnames", ",", "include_parents", "=", "False", ")", ":", "field_parts", "=", "(", "name", ".", "split", "(", "'.'", ")", "for", "name", "in", "fieldnames", ")", "return", "_collect_fields", "(", "field_parts", ",", "incl...
Parse a list of field names, possibly including dot-separated subform fields, into an internal ParsedFieldList object representing the base fields and subform listed. :param fieldnames: a list of field names as strings. dot-separated names are interpreted as subform fields. :param include_paren...
[ "Parse", "a", "list", "of", "field", "names", "possibly", "including", "dot", "-", "separated", "subform", "fields", "into", "an", "internal", "ParsedFieldList", "object", "representing", "the", "base", "fields", "and", "subform", "listed", "." ]
python
train
coursera-dl/coursera-dl
coursera/credentials.py
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/credentials.py#L37-L110
def get_config_paths(config_name): # pragma: no test """ Return a list of config files paths to try in order, given config file name and possibly a user-specified path. For Windows platforms, there are several paths that can be tried to retrieve the netrc file. There is, however, no "standard way"...
[ "def", "get_config_paths", "(", "config_name", ")", ":", "# pragma: no test", "if", "platform", ".", "system", "(", ")", "!=", "'Windows'", ":", "return", "[", "None", "]", "# Now, we only treat the case of Windows", "env_vars", "=", "[", "[", "\"HOME\"", "]", "...
Return a list of config files paths to try in order, given config file name and possibly a user-specified path. For Windows platforms, there are several paths that can be tried to retrieve the netrc file. There is, however, no "standard way" of doing things. A brief recap of the situation (all fil...
[ "Return", "a", "list", "of", "config", "files", "paths", "to", "try", "in", "order", "given", "config", "file", "name", "and", "possibly", "a", "user", "-", "specified", "path", "." ]
python
train
MacHu-GWU/single_file_module-project
sfm/fingerprint.py
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/fingerprint.py#L161-L171
def of_text(self, text, encoding="utf-8"): """ Use default hash method to return hash value of a piece of string default setting use 'utf-8' encoding. :type text: text_type :param text: a text object """ m = self.hash_algo() m.update(text.encode(encoding)...
[ "def", "of_text", "(", "self", ",", "text", ",", "encoding", "=", "\"utf-8\"", ")", ":", "m", "=", "self", ".", "hash_algo", "(", ")", "m", ".", "update", "(", "text", ".", "encode", "(", "encoding", ")", ")", "return", "self", ".", "digest", "(", ...
Use default hash method to return hash value of a piece of string default setting use 'utf-8' encoding. :type text: text_type :param text: a text object
[ "Use", "default", "hash", "method", "to", "return", "hash", "value", "of", "a", "piece", "of", "string", "default", "setting", "use", "utf", "-", "8", "encoding", "." ]
python
train
ArtoLabs/SimpleSteem
simplesteem/simplesteem.py
https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L625-L638
def unvote_witness(self, witness, account=None): ''' Uses the steem_instance method to unvote a witness. ''' if not account: account = self.mainaccount try: self.steem_instance().disapprove_witness(witness, account=account) except Exception as e: ...
[ "def", "unvote_witness", "(", "self", ",", "witness", ",", "account", "=", "None", ")", ":", "if", "not", "account", ":", "account", "=", "self", ".", "mainaccount", "try", ":", "self", ".", "steem_instance", "(", ")", ".", "disapprove_witness", "(", "wi...
Uses the steem_instance method to unvote a witness.
[ "Uses", "the", "steem_instance", "method", "to", "unvote", "a", "witness", "." ]
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_fc05_functions2.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc05_functions2.py#L100-L122
def on_tblFunctions2_itemSelectionChanged(self): """Choose selected hazard x exposure constraints combination. .. note:: This is an automatic Qt slot executed when the category selection changes. """ functions = self.selected_functions_2() if not functions: ...
[ "def", "on_tblFunctions2_itemSelectionChanged", "(", "self", ")", ":", "functions", "=", "self", ".", "selected_functions_2", "(", ")", "if", "not", "functions", ":", "self", ".", "lblAvailableFunctions2", ".", "clear", "(", ")", "else", ":", "text", "=", "sel...
Choose selected hazard x exposure constraints combination. .. note:: This is an automatic Qt slot executed when the category selection changes.
[ "Choose", "selected", "hazard", "x", "exposure", "constraints", "combination", "." ]
python
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/vlanm.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vlanm.py#L455-L502
def create_dev_vlan(vlanid, vlan_name, auth, url, devid=None, devip=None): """ function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the specified VLAN from the target device. VLAN Name MUST be valid on target device. :param vlanid:int or ...
[ "def", "create_dev_vlan", "(", "vlanid", ",", "vlan_name", ",", "auth", ",", "url", ",", "devid", "=", "None", ",", "devip", "=", "None", ")", ":", "if", "devip", "is", "not", "None", ":", "devid", "=", "get_dev_details", "(", "devip", ",", "auth", "...
function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the specified VLAN from the target device. VLAN Name MUST be valid on target device. :param vlanid:int or str value of target 802.1q VLAN :param vlan_name: str value of the target 802.1q V...
[ "function", "takes", "devid", "and", "vlanid", "vlan_name", "of", "specific", "device", "and", "802", ".", "1q", "VLAN", "tag", "and", "issues", "a", "RESTFUL", "call", "to", "add", "the", "specified", "VLAN", "from", "the", "target", "device", ".", "VLAN"...
python
train
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L1134-L1282
def _expandVerbChainsBySubcat( clauseTokens, clauseID, foundChains, verbSubcat, \ skipQuestionable=False, \ breakOnPunctuation=True ): ''' Meetod, mis proovib laiendada (mitte-'olema') verbid...
[ "def", "_expandVerbChainsBySubcat", "(", "clauseTokens", ",", "clauseID", ",", "foundChains", ",", "verbSubcat", ",", "skipQuestionable", "=", "False", ",", "breakOnPunctuation", "=", "True", ")", ":", "global", "_breakerJaNingEgaVoi", ",", "_breakerKomaLopus", ",", ...
Meetod, mis proovib laiendada (mitte-'olema') verbidega l6ppevaid predikaadifraase, lisades nende lõppu rektsiooniseoste järgi uusi infiniitverbe, nt "kutsub" + "langetama" "püütakse" + "keelustada" "või" "takistada" "ei julgenud" + "arvata", "ei hakka" + "tülita...
[ "Meetod", "mis", "proovib", "laiendada", "(", "mitte", "-", "olema", ")", "verbidega", "l6ppevaid", "predikaadifraase", "lisades", "nende", "lõppu", "rektsiooniseoste", "järgi", "uusi", "infiniitverbe", "nt", "kutsub", "+", "langetama", "püütakse", "+", "keelustada"...
python
train
ray-project/ray
python/ray/tune/ray_trial_executor.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/ray_trial_executor.py#L499-L514
def _checkpoint_and_erase(self, trial): """Checkpoints the model and erases old checkpoints if needed. Parameters ---------- trial : trial to save """ with warn_if_slow("save_to_disk"): trial._checkpoint.value = ray.get(trial.runner.save.remot...
[ "def", "_checkpoint_and_erase", "(", "self", ",", "trial", ")", ":", "with", "warn_if_slow", "(", "\"save_to_disk\"", ")", ":", "trial", ".", "_checkpoint", ".", "value", "=", "ray", ".", "get", "(", "trial", ".", "runner", ".", "save", ".", "remote", "(...
Checkpoints the model and erases old checkpoints if needed. Parameters ---------- trial : trial to save
[ "Checkpoints", "the", "model", "and", "erases", "old", "checkpoints", "if", "needed", ".", "Parameters", "----------", "trial", ":", "trial", "to", "save" ]
python
train
alephdata/memorious
memorious/operations/extract.py
https://github.com/alephdata/memorious/blob/b4033c5064447ed5f696f9c2bbbc6c12062d2fa4/memorious/operations/extract.py#L78-L102
def extract(context, data): """Extract a compressed file""" with context.http.rehash(data) as result: file_path = result.file_path content_type = result.content_type extract_dir = random_filename(context.work_path) if content_type in ZIP_MIME_TYPES: extracted_files = ...
[ "def", "extract", "(", "context", ",", "data", ")", ":", "with", "context", ".", "http", ".", "rehash", "(", "data", ")", "as", "result", ":", "file_path", "=", "result", ".", "file_path", "content_type", "=", "result", ".", "content_type", "extract_dir", ...
Extract a compressed file
[ "Extract", "a", "compressed", "file" ]
python
train
mongodb/mongo-python-driver
pymongo/message.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/message.py#L311-L349
def get_message(self, set_slave_ok, sock_info, use_cmd=False): """Get a query message, possibly setting the slaveOk bit.""" if set_slave_ok: # Set the slaveOk bit. flags = self.flags | 4 else: flags = self.flags ns = self.namespace() spec = se...
[ "def", "get_message", "(", "self", ",", "set_slave_ok", ",", "sock_info", ",", "use_cmd", "=", "False", ")", ":", "if", "set_slave_ok", ":", "# Set the slaveOk bit.", "flags", "=", "self", ".", "flags", "|", "4", "else", ":", "flags", "=", "self", ".", "...
Get a query message, possibly setting the slaveOk bit.
[ "Get", "a", "query", "message", "possibly", "setting", "the", "slaveOk", "bit", "." ]
python
train
chrislit/abydos
abydos/phonetic/_soundex.py
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_soundex.py#L190-L255
def soundex(word, max_length=4, var='American', reverse=False, zero_pad=True): """Return the Soundex code for a word. This is a wrapper for :py:meth:`Soundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaul...
[ "def", "soundex", "(", "word", ",", "max_length", "=", "4", ",", "var", "=", "'American'", ",", "reverse", "=", "False", ",", "zero_pad", "=", "True", ")", ":", "return", "Soundex", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "var",...
Return the Soundex code for a word. This is a wrapper for :py:meth:`Soundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) var : str The variant of the algorithm to employ (defaults to ``A...
[ "Return", "the", "Soundex", "code", "for", "a", "word", "." ]
python
valid
zhmcclient/python-zhmcclient
zhmcclient/_metrics.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient/_metrics.py#L307-L333
def get_metrics(self): """ Retrieve the current metric values for this :term:`Metrics Context` resource from the HMC. The metric values are returned by this method as a string in the `MetricsResponse` format described with the 'Get Metrics' operation in the :term:`HMC AP...
[ "def", "get_metrics", "(", "self", ")", ":", "metrics_response", "=", "self", ".", "manager", ".", "session", ".", "get", "(", "self", ".", "uri", ")", "return", "metrics_response" ]
Retrieve the current metric values for this :term:`Metrics Context` resource from the HMC. The metric values are returned by this method as a string in the `MetricsResponse` format described with the 'Get Metrics' operation in the :term:`HMC API` book. The :class:`~zhmcclient.M...
[ "Retrieve", "the", "current", "metric", "values", "for", "this", ":", "term", ":", "Metrics", "Context", "resource", "from", "the", "HMC", "." ]
python
train
saltstack/salt
salt/states/rsync.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rsync.py#L56-L77
def _get_changes(rsync_out): ''' Get changes from the rsync successful output. ''' copied = list() deleted = list() for line in rsync_out.split("\n\n")[0].split("\n")[1:]: if line.startswith("deleting "): deleted.append(line.split(" ", 1)[-1]) else: copie...
[ "def", "_get_changes", "(", "rsync_out", ")", ":", "copied", "=", "list", "(", ")", "deleted", "=", "list", "(", ")", "for", "line", "in", "rsync_out", ".", "split", "(", "\"\\n\\n\"", ")", "[", "0", "]", ".", "split", "(", "\"\\n\"", ")", "[", "1"...
Get changes from the rsync successful output.
[ "Get", "changes", "from", "the", "rsync", "successful", "output", "." ]
python
train
jaredLunde/vital-tools
vital/debug/__init__.py
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/__init__.py#L879-L882
def randtld(self): """ -> a random #str tld via :mod:tlds """ self.tlds = tuple(tlds.tlds) if not self.tlds else self.tlds return self.random.choice(self.tlds)
[ "def", "randtld", "(", "self", ")", ":", "self", ".", "tlds", "=", "tuple", "(", "tlds", ".", "tlds", ")", "if", "not", "self", ".", "tlds", "else", "self", ".", "tlds", "return", "self", ".", "random", ".", "choice", "(", "self", ".", "tlds", ")...
-> a random #str tld via :mod:tlds
[ "-", ">", "a", "random", "#str", "tld", "via", ":", "mod", ":", "tlds" ]
python
train
sendgrid/sendgrid-python
sendgrid/helpers/mail/mail.py
https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/mail.py#L627-L645
def dynamic_template_data(self, value): """Data for a transactional template :param value: Data for a transactional template :type value: DynamicTemplateData, a JSON-serializeable structure """ if not isinstance(value, DynamicTemplateData): value = DynamicTemplateDat...
[ "def", "dynamic_template_data", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "DynamicTemplateData", ")", ":", "value", "=", "DynamicTemplateData", "(", "value", ")", "try", ":", "personalization", "=", "self", ".", "_per...
Data for a transactional template :param value: Data for a transactional template :type value: DynamicTemplateData, a JSON-serializeable structure
[ "Data", "for", "a", "transactional", "template" ]
python
train
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L403-L409
def abs_unit(self): """Return unit vector of a point with positive coordinates.""" s = self.x * self.x + self.y * self.y if s < 1e-5: return Point(0,0) s = math.sqrt(s) return Point(abs(self.x) / s, abs(self.y) / s)
[ "def", "abs_unit", "(", "self", ")", ":", "s", "=", "self", ".", "x", "*", "self", ".", "x", "+", "self", ".", "y", "*", "self", ".", "y", "if", "s", "<", "1e-5", ":", "return", "Point", "(", "0", ",", "0", ")", "s", "=", "math", ".", "sq...
Return unit vector of a point with positive coordinates.
[ "Return", "unit", "vector", "of", "a", "point", "with", "positive", "coordinates", "." ]
python
train
klahnakoski/pyLibrary
mo_math/vendor/strangman/stats.py
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/mo_math/vendor/strangman/stats.py#L1509-L1542
def F_oneway(*lists): """ Performs a 1-way ANOVA, returning an F-value and probability given any number of groups. From Heiman, pp.394-7. Usage: F_oneway(*lists) where *lists is any number of lists, one per treatment group Returns: F value, one-tailed p-value """ a = len...
[ "def", "F_oneway", "(", "*", "lists", ")", ":", "a", "=", "len", "(", "lists", ")", "# ANOVA on 'a' groups, each in it's own list", "means", "=", "[", "0", "]", "*", "a", "vars", "=", "[", "0", "]", "*", "a", "ns", "=", "[", "0", "]", "*", "a", "...
Performs a 1-way ANOVA, returning an F-value and probability given any number of groups. From Heiman, pp.394-7. Usage: F_oneway(*lists) where *lists is any number of lists, one per treatment group Returns: F value, one-tailed p-value
[ "Performs", "a", "1", "-", "way", "ANOVA", "returning", "an", "F", "-", "value", "and", "probability", "given", "any", "number", "of", "groups", ".", "From", "Heiman", "pp", ".", "394", "-", "7", "." ]
python
train
pypa/pipenv
pipenv/vendor/plette/models/scripts.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/plette/models/scripts.py#L48-L79
def cmdify(self, extra_args=None): """Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes be...
[ "def", "cmdify", "(", "self", ",", "extra_args", "=", "None", ")", ":", "parts", "=", "list", "(", "self", ".", "_parts", ")", "if", "extra_args", ":", "parts", ".", "extend", "(", "extra_args", ")", "return", "\" \"", ".", "join", "(", "arg", "if", ...
Encode into a cmd-executable string. This re-implements CreateProcess's quoting logic to turn a list of arguments into one single string for the shell to interpret. * All double quotes are escaped with a backslash. * Existing backslashes before a quote are doubled, so they are all ...
[ "Encode", "into", "a", "cmd", "-", "executable", "string", "." ]
python
train
gabstopper/smc-python
smc/api/session.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L572-L603
def logout(self): """ Logout session from SMC :return: None """ if not self.session: self.manager._deregister(self) return try: r = self.session.put(self.entry_points.get('logout')) if r.status_code == 204: ...
[ "def", "logout", "(", "self", ")", ":", "if", "not", "self", ".", "session", ":", "self", ".", "manager", ".", "_deregister", "(", "self", ")", "return", "try", ":", "r", "=", "self", ".", "session", ".", "put", "(", "self", ".", "entry_points", "....
Logout session from SMC :return: None
[ "Logout", "session", "from", "SMC", ":", "return", ":", "None" ]
python
train
robertdfrench/psychic-disco
psychic_disco/api_gateway_config.py
https://github.com/robertdfrench/psychic-disco/blob/3cf167b44c64d64606691fc186be7d9ef8e8e938/psychic_disco/api_gateway_config.py#L27-L32
def fetch_method(api_id, resource_id, verb): """ Fetch extra metadata for this particular method """ return console.get_method( restApiId=api_id, resourceId=resource_id, httpMethod=verb)
[ "def", "fetch_method", "(", "api_id", ",", "resource_id", ",", "verb", ")", ":", "return", "console", ".", "get_method", "(", "restApiId", "=", "api_id", ",", "resourceId", "=", "resource_id", ",", "httpMethod", "=", "verb", ")" ]
Fetch extra metadata for this particular method
[ "Fetch", "extra", "metadata", "for", "this", "particular", "method" ]
python
train
bcbio/bcbio-nextgen
bcbio/ngsalign/hisat2.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/hisat2.py#L127-L146
def get_splicejunction_file(align_dir, data): """ locate the splice junction file from hisat2. hisat2 outputs a novel splicesites file to go along with the provided file, if available. this combines the two together and outputs a combined file of all of the known and novel splice junctions """ ...
[ "def", "get_splicejunction_file", "(", "align_dir", ",", "data", ")", ":", "samplename", "=", "dd", ".", "get_sample_name", "(", "data", ")", "align_dir", "=", "os", ".", "path", ".", "dirname", "(", "dd", ".", "get_work_bam", "(", "data", ")", ")", "kno...
locate the splice junction file from hisat2. hisat2 outputs a novel splicesites file to go along with the provided file, if available. this combines the two together and outputs a combined file of all of the known and novel splice junctions
[ "locate", "the", "splice", "junction", "file", "from", "hisat2", ".", "hisat2", "outputs", "a", "novel", "splicesites", "file", "to", "go", "along", "with", "the", "provided", "file", "if", "available", ".", "this", "combines", "the", "two", "together", "and...
python
train
Erotemic/ubelt
setup.py
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/setup.py#L125-L182
def parse_requirements(fname='requirements.txt'): """ Parse the package dependencies listed in a requirements file but strips specific versioning information. TODO: perhaps use https://github.com/davidfischer/requirements-parser instead CommandLine: python -c "import setup; print(s...
[ "def", "parse_requirements", "(", "fname", "=", "'requirements.txt'", ")", ":", "from", "os", ".", "path", "import", "dirname", ",", "join", ",", "exists", "import", "re", "require_fpath", "=", "join", "(", "dirname", "(", "__file__", ")", ",", "fname", ")...
Parse the package dependencies listed in a requirements file but strips specific versioning information. TODO: perhaps use https://github.com/davidfischer/requirements-parser instead CommandLine: python -c "import setup; print(setup.parse_requirements())"
[ "Parse", "the", "package", "dependencies", "listed", "in", "a", "requirements", "file", "but", "strips", "specific", "versioning", "information", "." ]
python
valid
bheinzerling/pyrouge
pyrouge/Rouge155.py
https://github.com/bheinzerling/pyrouge/blob/afeb37dd2608f1399e2fb24a4ee2fe10a2a18603/pyrouge/Rouge155.py#L536-L553
def __create_dir_property(self, dir_name, docstring): """ Generate getter and setter for a directory property. """ property_name = "{}_dir".format(dir_name) private_name = "_" + property_name setattr(self, private_name, None) def fget(self): return g...
[ "def", "__create_dir_property", "(", "self", ",", "dir_name", ",", "docstring", ")", ":", "property_name", "=", "\"{}_dir\"", ".", "format", "(", "dir_name", ")", "private_name", "=", "\"_\"", "+", "property_name", "setattr", "(", "self", ",", "private_name", ...
Generate getter and setter for a directory property.
[ "Generate", "getter", "and", "setter", "for", "a", "directory", "property", "." ]
python
train
Falkonry/falkonry-python-client
falkonryclient/helper/utils.py
https://github.com/Falkonry/falkonry-python-client/blob/0aeb2b00293ee94944f1634e9667401b03da29c1/falkonryclient/helper/utils.py#L18-L66
def exception_handler(exceptionObj): """Function that takes exception Object(<Byte>,<str>) as a parameter and returns the error message<str>""" try: if isinstance(exceptionObj, Exception) and hasattr(exceptionObj, 'args'): if not (hasattr(exceptionObj, 'message' or hasattr(exceptionObj, 'msg...
[ "def", "exception_handler", "(", "exceptionObj", ")", ":", "try", ":", "if", "isinstance", "(", "exceptionObj", ",", "Exception", ")", "and", "hasattr", "(", "exceptionObj", ",", "'args'", ")", ":", "if", "not", "(", "hasattr", "(", "exceptionObj", ",", "'...
Function that takes exception Object(<Byte>,<str>) as a parameter and returns the error message<str>
[ "Function", "that", "takes", "exception", "Object", "(", "<Byte", ">", "<str", ">", ")", "as", "a", "parameter", "and", "returns", "the", "error", "message<str", ">" ]
python
train
ThePlasmaRailgun/py-rolldice
rolldice/rolldice.py
https://github.com/ThePlasmaRailgun/py-rolldice/blob/dc46d1d3e765592e76c52fd812b4f3b7425db552/rolldice/rolldice.py#L179-L187
def _eval_unaryop(self, node): """ Evaluate a unary operator node (ie. -2, +3) Currently just supports positive and negative :param node: Node to eval :return: Result of node """ return self.operators[type(node.op)](self._eval(node.operand))
[ "def", "_eval_unaryop", "(", "self", ",", "node", ")", ":", "return", "self", ".", "operators", "[", "type", "(", "node", ".", "op", ")", "]", "(", "self", ".", "_eval", "(", "node", ".", "operand", ")", ")" ]
Evaluate a unary operator node (ie. -2, +3) Currently just supports positive and negative :param node: Node to eval :return: Result of node
[ "Evaluate", "a", "unary", "operator", "node", "(", "ie", ".", "-", "2", "+", "3", ")", "Currently", "just", "supports", "positive", "and", "negative" ]
python
train
lepture/flask-oauthlib
flask_oauthlib/provider/oauth2.py
https://github.com/lepture/flask-oauthlib/blob/9e6f152a5bb360e7496210da21561c3e6d41b0e1/flask_oauthlib/provider/oauth2.py#L479-L515
def confirm_authorization_request(self): """When consumer confirm the authorization.""" server = self.server scope = request.values.get('scope') or '' scopes = scope.split() credentials = dict( client_id=request.values.get('client_id'), redirect_uri=reques...
[ "def", "confirm_authorization_request", "(", "self", ")", ":", "server", "=", "self", ".", "server", "scope", "=", "request", ".", "values", ".", "get", "(", "'scope'", ")", "or", "''", "scopes", "=", "scope", ".", "split", "(", ")", "credentials", "=", ...
When consumer confirm the authorization.
[ "When", "consumer", "confirm", "the", "authorization", "." ]
python
test
NuGrid/NuGridPy
nugridpy/ascii_table.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ascii_table.py#L248-L346
def _readFile(self, sldir, fileName, sep): ''' Private method that reads in the header and column data. ''' if sldir.endswith(os.sep): fileName = str(sldir)+str(fileName) else: fileName = str(sldir)+os.sep+str(fileName) fileLines=[] #list of li...
[ "def", "_readFile", "(", "self", ",", "sldir", ",", "fileName", ",", "sep", ")", ":", "if", "sldir", ".", "endswith", "(", "os", ".", "sep", ")", ":", "fileName", "=", "str", "(", "sldir", ")", "+", "str", "(", "fileName", ")", "else", ":", "file...
Private method that reads in the header and column data.
[ "Private", "method", "that", "reads", "in", "the", "header", "and", "column", "data", "." ]
python
train
JnyJny/Geometry
Geometry/ellipse.py
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L209-L220
def b(self): ''' Positive antipodal point on the minor axis, Point class. ''' b = Point(self.center) if self.xAxisIsMinor: b.x += self.minorRadius else: b.y += self.minorRadius return b
[ "def", "b", "(", "self", ")", ":", "b", "=", "Point", "(", "self", ".", "center", ")", "if", "self", ".", "xAxisIsMinor", ":", "b", ".", "x", "+=", "self", ".", "minorRadius", "else", ":", "b", ".", "y", "+=", "self", ".", "minorRadius", "return"...
Positive antipodal point on the minor axis, Point class.
[ "Positive", "antipodal", "point", "on", "the", "minor", "axis", "Point", "class", "." ]
python
train
postmanlabs/httpbin
httpbin/core.py
https://github.com/postmanlabs/httpbin/blob/f8ec666b4d1b654e4ff6aedd356f510dcac09f83/httpbin/core.py#L1423-L1450
def random_bytes(n): """Returns n random bytes generated with given seed --- tags: - Dynamic data parameters: - in: path name: n type: int produces: - application/octet-stream responses: 200: description: Bytes. """ n = min(n, 100 * 1024) ...
[ "def", "random_bytes", "(", "n", ")", ":", "n", "=", "min", "(", "n", ",", "100", "*", "1024", ")", "# set 100KB limit", "params", "=", "CaseInsensitiveDict", "(", "request", ".", "args", ".", "items", "(", ")", ")", "if", "\"seed\"", "in", "params", ...
Returns n random bytes generated with given seed --- tags: - Dynamic data parameters: - in: path name: n type: int produces: - application/octet-stream responses: 200: description: Bytes.
[ "Returns", "n", "random", "bytes", "generated", "with", "given", "seed", "---", "tags", ":", "-", "Dynamic", "data", "parameters", ":", "-", "in", ":", "path", "name", ":", "n", "type", ":", "int", "produces", ":", "-", "application", "/", "octet", "-"...
python
train
Neurita/boyle
boyle/databuffer.py
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/databuffer.py#L364-L449
def put_df_as_ndarray(self, key, df, range_values, loop_multiindex=False, unstack=False, fill_value=0, fill_method=None): """Returns a PyTables HDF Array from df in the shape given by its index columns range values. :param key: string object :param df: pandas DataFram...
[ "def", "put_df_as_ndarray", "(", "self", ",", "key", ",", "df", ",", "range_values", ",", "loop_multiindex", "=", "False", ",", "unstack", "=", "False", ",", "fill_value", "=", "0", ",", "fill_method", "=", "None", ")", ":", "idx_colnames", "=", "df", "....
Returns a PyTables HDF Array from df in the shape given by its index columns range values. :param key: string object :param df: pandas DataFrame :param range_values: dict or array-like Must contain for each index column of df an entry with all the values within the range of th...
[ "Returns", "a", "PyTables", "HDF", "Array", "from", "df", "in", "the", "shape", "given", "by", "its", "index", "columns", "range", "values", "." ]
python
valid
daler/metaseq
metaseq/results_table.py
https://github.com/daler/metaseq/blob/fa875d1f72317aa7ef95cb128b739956b16eef9f/metaseq/results_table.py#L690-L758
def genes_with_peak(self, peaks, transform_func=None, split=False, intersect_kwargs=None, id_attribute='ID', *args, **kwargs): """ Returns a boolean index of genes that have a peak nearby. Parameters ---------- peaks : string or py...
[ "def", "genes_with_peak", "(", "self", ",", "peaks", ",", "transform_func", "=", "None", ",", "split", "=", "False", ",", "intersect_kwargs", "=", "None", ",", "id_attribute", "=", "'ID'", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "_t...
Returns a boolean index of genes that have a peak nearby. Parameters ---------- peaks : string or pybedtools.BedTool If string, then assume it's a filename to a BED/GFF/GTF file of intervals; otherwise use the pybedtools.BedTool object directly. transform_func :...
[ "Returns", "a", "boolean", "index", "of", "genes", "that", "have", "a", "peak", "nearby", "." ]
python
train
Kronuz/pyScss
scss/compiler.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/compiler.py#L490-L542
def _at_option(self, calculator, rule, scope, block): """ Implements @option """ # TODO This only actually supports "style" (which only really makes # sense as the first thing in a single input file) or "warn_unused" # (which only makes sense at file level /at best/). Ex...
[ "def", "_at_option", "(", "self", ",", "calculator", ",", "rule", ",", "scope", ",", "block", ")", ":", "# TODO This only actually supports \"style\" (which only really makes", "# sense as the first thing in a single input file) or \"warn_unused\"", "# (which only makes sense at file...
Implements @option
[ "Implements" ]
python
train
spacetelescope/drizzlepac
drizzlepac/processInput.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L639-L648
def buildFileList(input, output=None, ivmlist=None, wcskey=None, updatewcs=True, **workinplace): """ Builds a file list which has undergone various instrument-specific checks for input to MultiDrizzle, including splitting STIS associations. """ newfilelist, ivmlist, output, oldasndic...
[ "def", "buildFileList", "(", "input", ",", "output", "=", "None", ",", "ivmlist", "=", "None", ",", "wcskey", "=", "None", ",", "updatewcs", "=", "True", ",", "*", "*", "workinplace", ")", ":", "newfilelist", ",", "ivmlist", ",", "output", ",", "oldasn...
Builds a file list which has undergone various instrument-specific checks for input to MultiDrizzle, including splitting STIS associations.
[ "Builds", "a", "file", "list", "which", "has", "undergone", "various", "instrument", "-", "specific", "checks", "for", "input", "to", "MultiDrizzle", "including", "splitting", "STIS", "associations", "." ]
python
train
andy-z/ged4py
ged4py/model.py
https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/model.py#L69-L95
def sub_tag(self, path, follow=True): """Returns direct sub-record with given tag name or None. Path can be a simple tag name, in which case the first direct sub-record of this record with the matching tag is returned. Path can also consist of several tags separated by slashes, in that ...
[ "def", "sub_tag", "(", "self", ",", "path", ",", "follow", "=", "True", ")", ":", "tags", "=", "path", ".", "split", "(", "'/'", ")", "rec", "=", "self", "for", "tag", "in", "tags", ":", "recs", "=", "[", "x", "for", "x", "in", "(", "rec", "....
Returns direct sub-record with given tag name or None. Path can be a simple tag name, in which case the first direct sub-record of this record with the matching tag is returned. Path can also consist of several tags separated by slashes, in that case sub-records are searched recursively...
[ "Returns", "direct", "sub", "-", "record", "with", "given", "tag", "name", "or", "None", "." ]
python
train
Alignak-monitoring/alignak
alignak/external_command.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L1773-L1785
def del_all_svc_downtimes(self, service): """Delete all service downtime Format of the line that triggers function call:: DEL_ALL_SVC_DOWNTIMES;<host_name>;<service_description> :param service: service to edit :type service: alignak.objects.service.Service :return: None...
[ "def", "del_all_svc_downtimes", "(", "self", ",", "service", ")", ":", "for", "downtime", "in", "service", ".", "downtimes", ":", "self", ".", "del_svc_downtime", "(", "downtime", ")", "self", ".", "send_an_element", "(", "service", ".", "get_update_status_brok"...
Delete all service downtime Format of the line that triggers function call:: DEL_ALL_SVC_DOWNTIMES;<host_name>;<service_description> :param service: service to edit :type service: alignak.objects.service.Service :return: None
[ "Delete", "all", "service", "downtime", "Format", "of", "the", "line", "that", "triggers", "function", "call", "::" ]
python
train
googledatalab/pydatalab
google/datalab/contrib/pipeline/_pipeline.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/contrib/pipeline/_pipeline.py#L201-L236
def _get_operator_param_name_and_values(operator_class_name, task_details): """ Internal helper gets the name of the python parameter for the Airflow operator class. In some cases, we do not expose the airflow parameter name in its native form, but choose to expose a name that's more standard for Datala...
[ "def", "_get_operator_param_name_and_values", "(", "operator_class_name", ",", "task_details", ")", ":", "# We make a clone and then remove 'type' and 'up_stream' since these aren't needed for the", "# the operator's parameters.", "operator_task_details", "=", "task_details", ".", "copy"...
Internal helper gets the name of the python parameter for the Airflow operator class. In some cases, we do not expose the airflow parameter name in its native form, but choose to expose a name that's more standard for Datalab, or one that's more friendly. For example, Airflow's BigQueryOperator uses '...
[ "Internal", "helper", "gets", "the", "name", "of", "the", "python", "parameter", "for", "the", "Airflow", "operator", "class", ".", "In", "some", "cases", "we", "do", "not", "expose", "the", "airflow", "parameter", "name", "in", "its", "native", "form", "b...
python
train
cloud-custodian/cloud-custodian
c7n/cli.py
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/cli.py#L178-L190
def _schema_options(p): """ Add options specific to schema subcommand. """ p.add_argument( 'resource', metavar='selector', nargs='?', default=None).completer = _schema_tab_completer p.add_argument( '--summary', action="store_true", help="Summarize counts of available resourc...
[ "def", "_schema_options", "(", "p", ")", ":", "p", ".", "add_argument", "(", "'resource'", ",", "metavar", "=", "'selector'", ",", "nargs", "=", "'?'", ",", "default", "=", "None", ")", ".", "completer", "=", "_schema_tab_completer", "p", ".", "add_argumen...
Add options specific to schema subcommand.
[ "Add", "options", "specific", "to", "schema", "subcommand", "." ]
python
train