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
praekeltfoundation/marathon-acme
marathon_acme/cli.py
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/cli.py#L241-L268
def init_storage_dir(storage_dir): """ Initialise the storage directory with the certificates directory and a default wildcard self-signed certificate for HAProxy. :return: the storage path and certs path """ storage_path = FilePath(storage_dir) # Create the default wildcard certificate if...
[ "def", "init_storage_dir", "(", "storage_dir", ")", ":", "storage_path", "=", "FilePath", "(", "storage_dir", ")", "# Create the default wildcard certificate if it doesn't already exist", "default_cert_path", "=", "storage_path", ".", "child", "(", "'default.pem'", ")", "if...
Initialise the storage directory with the certificates directory and a default wildcard self-signed certificate for HAProxy. :return: the storage path and certs path
[ "Initialise", "the", "storage", "directory", "with", "the", "certificates", "directory", "and", "a", "default", "wildcard", "self", "-", "signed", "certificate", "for", "HAProxy", "." ]
python
valid
merll/docker-map
dockermap/map/config/main.py
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/main.py#L502-L521
def get_extended(self, config): """ Generates a configuration that includes all inherited values. :param config: Container configuration. :type config: ContainerConfiguration :return: A merged (shallow) copy of all inherited configurations merged with the container configuration...
[ "def", "get_extended", "(", "self", ",", "config", ")", ":", "if", "not", "config", ".", "extends", "or", "self", ".", "_extended", ":", "return", "config", "extended_config", "=", "ContainerConfiguration", "(", ")", "for", "ext_name", "in", "config", ".", ...
Generates a configuration that includes all inherited values. :param config: Container configuration. :type config: ContainerConfiguration :return: A merged (shallow) copy of all inherited configurations merged with the container configuration. :rtype: ContainerConfiguration
[ "Generates", "a", "configuration", "that", "includes", "all", "inherited", "values", "." ]
python
train
hustlzp/Flask-Boost
flask_boost/cli.py
https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/cli.py#L49-L98
def generate_project(args): """New project.""" # Project templates path src = os.path.join(dirname(abspath(__file__)), 'project') project_name = args.get('<project>') if not project_name: logger.warning('Project name cannot be empty.') return # Destination project path dst...
[ "def", "generate_project", "(", "args", ")", ":", "# Project templates path", "src", "=", "os", ".", "path", ".", "join", "(", "dirname", "(", "abspath", "(", "__file__", ")", ")", ",", "'project'", ")", "project_name", "=", "args", ".", "get", "(", "'<p...
New project.
[ "New", "project", "." ]
python
test
bcbio/bcbio-nextgen
bcbio/structural/cnvkit.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/cnvkit.py#L490-L503
def _add_seg_to_output(out, data, enumerate_chroms=False): """Export outputs to 'seg' format compatible with IGV and GenePattern. """ out_file = "%s.seg" % os.path.splitext(out["cns"])[0] if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_file: cmd = ...
[ "def", "_add_seg_to_output", "(", "out", ",", "data", ",", "enumerate_chroms", "=", "False", ")", ":", "out_file", "=", "\"%s.seg\"", "%", "os", ".", "path", ".", "splitext", "(", "out", "[", "\"cns\"", "]", ")", "[", "0", "]", "if", "not", "utils", ...
Export outputs to 'seg' format compatible with IGV and GenePattern.
[ "Export", "outputs", "to", "seg", "format", "compatible", "with", "IGV", "and", "GenePattern", "." ]
python
train
pebble/libpebble2
libpebble2/protocol/base/types.py
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/protocol/base/types.py#L43-L71
def buffer_to_value(self, obj, buffer, offset, default_endianness=DEFAULT_ENDIANNESS): """ Converts the bytes in ``buffer`` at ``offset`` to a native Python value. Returns that value and the number of bytes consumed to create it. :param obj: The parent :class:`.PebblePacket` of this fie...
[ "def", "buffer_to_value", "(", "self", ",", "obj", ",", "buffer", ",", "offset", ",", "default_endianness", "=", "DEFAULT_ENDIANNESS", ")", ":", "try", ":", "value", ",", "length", "=", "struct", ".", "unpack_from", "(", "str", "(", "self", ".", "endiannes...
Converts the bytes in ``buffer`` at ``offset`` to a native Python value. Returns that value and the number of bytes consumed to create it. :param obj: The parent :class:`.PebblePacket` of this field :type obj: .PebblePacket :param buffer: The buffer from which to extract a value. ...
[ "Converts", "the", "bytes", "in", "buffer", "at", "offset", "to", "a", "native", "Python", "value", ".", "Returns", "that", "value", "and", "the", "number", "of", "bytes", "consumed", "to", "create", "it", "." ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/logging/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/logging/__init__.py#L232-L253
def _set_syslog_client(self, v, load=False): """ Setter method for syslog_client, mapped from YANG variable /logging/syslog_client (container) If this variable is read-only (config: false) in the source YANG file, then _set_syslog_client is considered as a private method. Backends looking to populat...
[ "def", "_set_syslog_client", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "...
Setter method for syslog_client, mapped from YANG variable /logging/syslog_client (container) If this variable is read-only (config: false) in the source YANG file, then _set_syslog_client is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set...
[ "Setter", "method", "for", "syslog_client", "mapped", "from", "YANG", "variable", "/", "logging", "/", "syslog_client", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YA...
python
train
Clinical-Genomics/scout
scout/server/blueprints/cases/controllers.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/cases/controllers.py#L167-L258
def case_report_content(store, institute_obj, case_obj): """Gather contents to be visualized in a case report Args: store(adapter.MongoAdapter) institute_obj(models.Institute) case_obj(models.Case) Returns: data(dict) """ variant_types = { 'causatives_detai...
[ "def", "case_report_content", "(", "store", ",", "institute_obj", ",", "case_obj", ")", ":", "variant_types", "=", "{", "'causatives_detailed'", ":", "'causatives'", ",", "'suspects_detailed'", ":", "'suspects'", ",", "'classified_detailed'", ":", "'acmg_classification'...
Gather contents to be visualized in a case report Args: store(adapter.MongoAdapter) institute_obj(models.Institute) case_obj(models.Case) Returns: data(dict)
[ "Gather", "contents", "to", "be", "visualized", "in", "a", "case", "report" ]
python
test
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L473-L477
def brand_delete(self, id, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/brands#delete-a-brand" api_path = "/api/v2/brands/{id}.json" api_path = api_path.format(id=id) return self.call(api_path, method="DELETE", **kwargs)
[ "def", "brand_delete", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/brands/{id}.json\"", "api_path", "=", "api_path", ".", "format", "(", "id", "=", "id", ")", "return", "self", ".", "call", "(", "api_path", ",",...
https://developer.zendesk.com/rest_api/docs/core/brands#delete-a-brand
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "core", "/", "brands#delete", "-", "a", "-", "brand" ]
python
train
barrust/mediawiki
mediawiki/mediawiki.py
https://github.com/barrust/mediawiki/blob/292e0be6c752409062dceed325d74839caf16a9b/mediawiki/mediawiki.py#L371-L389
def random(self, pages=1): """ Request a random page title or list of random titles Args: pages (int): Number of random pages to return Returns: list or int: A list of random page titles or a random page \ title if pages = 1 "...
[ "def", "random", "(", "self", ",", "pages", "=", "1", ")", ":", "if", "pages", "is", "None", "or", "pages", "<", "1", ":", "raise", "ValueError", "(", "\"Number of pages must be greater than 0\"", ")", "query_params", "=", "{", "\"list\"", ":", "\"random\"",...
Request a random page title or list of random titles Args: pages (int): Number of random pages to return Returns: list or int: A list of random page titles or a random page \ title if pages = 1
[ "Request", "a", "random", "page", "title", "or", "list", "of", "random", "titles" ]
python
train
rootpy/rootpy
rootpy/plotting/graph.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/graph.py#L620-L638
def Append(self, other): """ Append points from another graph """ orig_len = len(self) self.Set(orig_len + len(other)) ipoint = orig_len if hasattr(self, 'SetPointError'): for point in other: self.SetPoint(ipoint, point.x.value, point.y...
[ "def", "Append", "(", "self", ",", "other", ")", ":", "orig_len", "=", "len", "(", "self", ")", "self", ".", "Set", "(", "orig_len", "+", "len", "(", "other", ")", ")", "ipoint", "=", "orig_len", "if", "hasattr", "(", "self", ",", "'SetPointError'", ...
Append points from another graph
[ "Append", "points", "from", "another", "graph" ]
python
train
Erotemic/utool
utool/experimental/euler_tour_tree_avl.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/experimental/euler_tour_tree_avl.py#L834-L846
def avl_new_top(t1, t2, top, direction=0): """ if direction == 0: (t1, t2) is (left, right) if direction == 1: (t1, t2) is (right, left) """ top.parent = None assert top.parent is None, str(top.parent.value) top.set_child(direction, t1) top.set_child(1 - direction, t2) ...
[ "def", "avl_new_top", "(", "t1", ",", "t2", ",", "top", ",", "direction", "=", "0", ")", ":", "top", ".", "parent", "=", "None", "assert", "top", ".", "parent", "is", "None", ",", "str", "(", "top", ".", "parent", ".", "value", ")", "top", ".", ...
if direction == 0: (t1, t2) is (left, right) if direction == 1: (t1, t2) is (right, left)
[ "if", "direction", "==", "0", ":", "(", "t1", "t2", ")", "is", "(", "left", "right", ")", "if", "direction", "==", "1", ":", "(", "t1", "t2", ")", "is", "(", "right", "left", ")" ]
python
train
secdev/scapy
scapy/modules/p0f.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/p0f.py#L363-L566
def p0f_impersonate(pkt, osgenre=None, osdetails=None, signature=None, extrahops=0, mtu=1500, uptime=None): """Modifies pkt so that p0f will think it has been sent by a specific OS. If osdetails is None, then we randomly pick up a personality matching osgenre. If osgenre and signature are also ...
[ "def", "p0f_impersonate", "(", "pkt", ",", "osgenre", "=", "None", ",", "osdetails", "=", "None", ",", "signature", "=", "None", ",", "extrahops", "=", "0", ",", "mtu", "=", "1500", ",", "uptime", "=", "None", ")", ":", "pkt", "=", "pkt", ".", "cop...
Modifies pkt so that p0f will think it has been sent by a specific OS. If osdetails is None, then we randomly pick up a personality matching osgenre. If osgenre and signature are also None, we use a local signature (using p0f_getlocalsigs). If signature is specified (as a tuple), we use the signature. For now, only T...
[ "Modifies", "pkt", "so", "that", "p0f", "will", "think", "it", "has", "been", "sent", "by", "a", "specific", "OS", ".", "If", "osdetails", "is", "None", "then", "we", "randomly", "pick", "up", "a", "personality", "matching", "osgenre", ".", "If", "osgenr...
python
train
gwastro/pycbc
pycbc/workflow/jobsetup.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/jobsetup.py#L506-L518
def pick_tile_size(self, seg_size, data_lengths, valid_chunks, valid_lengths): """ Choose job tiles size based on science segment length """ if len(valid_lengths) == 1: return data_lengths[0], valid_chunks[0], valid_lengths[0] else: # Pick the tile size that is closest t...
[ "def", "pick_tile_size", "(", "self", ",", "seg_size", ",", "data_lengths", ",", "valid_chunks", ",", "valid_lengths", ")", ":", "if", "len", "(", "valid_lengths", ")", "==", "1", ":", "return", "data_lengths", "[", "0", "]", ",", "valid_chunks", "[", "0",...
Choose job tiles size based on science segment length
[ "Choose", "job", "tiles", "size", "based", "on", "science", "segment", "length" ]
python
train
OpenKMIP/PyKMIP
kmip/core/objects.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L250-L310
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0): """ Read the data stream and decode the AttributeReference structure into its parts. Args: input_buffer (stream): A data stream containing encoded object data, supporting a read method. ...
[ "def", "read", "(", "self", ",", "input_buffer", ",", "kmip_version", "=", "enums", ".", "KMIPVersion", ".", "KMIP_2_0", ")", ":", "if", "kmip_version", "<", "enums", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "raise", "exceptions", ".", "VersionNotSupported", ...
Read the data stream and decode the AttributeReference structure into its parts. Args: input_buffer (stream): A data stream containing encoded object data, supporting a read method. kmip_version (enum): A KMIPVersion enumeration defining the KMIP ...
[ "Read", "the", "data", "stream", "and", "decode", "the", "AttributeReference", "structure", "into", "its", "parts", "." ]
python
test
saulpw/visidata
visidata/vdtui.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/vdtui.py#L2142-L2158
def getValue(self, row): 'Memoize calcValue with key id(row)' if self._cachedValues is None: return self.calcValue(row) k = id(row) if k in self._cachedValues: return self._cachedValues[k] ret = self.calcValue(row) self._cachedValues[k] = ret ...
[ "def", "getValue", "(", "self", ",", "row", ")", ":", "if", "self", ".", "_cachedValues", "is", "None", ":", "return", "self", ".", "calcValue", "(", "row", ")", "k", "=", "id", "(", "row", ")", "if", "k", "in", "self", ".", "_cachedValues", ":", ...
Memoize calcValue with key id(row)
[ "Memoize", "calcValue", "with", "key", "id", "(", "row", ")" ]
python
train
jwkvam/bowtie
bowtie/auth.py
https://github.com/jwkvam/bowtie/blob/c494850671ac805bf186fbf2bdb07d2a34ae876d/bowtie/auth.py#L85-L96
def before_request(self) -> Optional[Response]: """Determine if a user is allowed to view this route.""" auth = request.authorization if not auth or not self._check_auth(auth.username, auth.password): return Response( 'Could not verify your access level for that URL.\...
[ "def", "before_request", "(", "self", ")", "->", "Optional", "[", "Response", "]", ":", "auth", "=", "request", ".", "authorization", "if", "not", "auth", "or", "not", "self", ".", "_check_auth", "(", "auth", ".", "username", ",", "auth", ".", "password"...
Determine if a user is allowed to view this route.
[ "Determine", "if", "a", "user", "is", "allowed", "to", "view", "this", "route", "." ]
python
train
konstantint/pyliftover
pyliftover/intervaltree.py
https://github.com/konstantint/pyliftover/blob/5164eed9ae678ad0ddc164df8c2c5767e6a4b39f/pyliftover/intervaltree.py#L90-L101
def sort(self): ''' Must be invoked after all intevals have been added to sort mid_** arrays. ''' if self.single_interval is None or self.single_interval != 0: return # Nothing to do for empty and leaf trees. self.mid_sorted_by_start.sort(key = lambda x: x[0]) ...
[ "def", "sort", "(", "self", ")", ":", "if", "self", ".", "single_interval", "is", "None", "or", "self", ".", "single_interval", "!=", "0", ":", "return", "# Nothing to do for empty and leaf trees.", "self", ".", "mid_sorted_by_start", ".", "sort", "(", "key", ...
Must be invoked after all intevals have been added to sort mid_** arrays.
[ "Must", "be", "invoked", "after", "all", "intevals", "have", "been", "added", "to", "sort", "mid_", "**", "arrays", "." ]
python
train
MaT1g3R/option
option/option_.py
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/option_.py#L144-L168
def expect(self, msg) -> T: """ Unwraps the option. Raises an exception if the value is :py:data:`NONE`. Args: msg: The exception message. Returns: The wrapped value. Raises: ``ValueError`` with message provided by ``msg`` if the value is :p...
[ "def", "expect", "(", "self", ",", "msg", ")", "->", "T", ":", "if", "self", ".", "_is_some", ":", "return", "self", ".", "_val", "raise", "ValueError", "(", "msg", ")" ]
Unwraps the option. Raises an exception if the value is :py:data:`NONE`. Args: msg: The exception message. Returns: The wrapped value. Raises: ``ValueError`` with message provided by ``msg`` if the value is :py:data:`NONE`. Examples: >>...
[ "Unwraps", "the", "option", ".", "Raises", "an", "exception", "if", "the", "value", "is", ":", "py", ":", "data", ":", "NONE", "." ]
python
train
RedHatInsights/insights-core
insights/util/__init__.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/util/__init__.py#L88-L104
def keys_in(items, *args): """ Use this utility function to ensure multiple keys are in one or more dicts. Returns `True` if all keys are present in at least one of the given dicts, otherwise returns `False`. :Parameters: - `items`: Iterable of required keys - Variable number of su...
[ "def", "keys_in", "(", "items", ",", "*", "args", ")", ":", "found", "=", "dict", "(", "(", "key", ",", "False", ")", "for", "key", "in", "items", ")", "for", "d", "in", "args", ":", "for", "item", "in", "items", ":", "if", "not", "found", "[",...
Use this utility function to ensure multiple keys are in one or more dicts. Returns `True` if all keys are present in at least one of the given dicts, otherwise returns `False`. :Parameters: - `items`: Iterable of required keys - Variable number of subsequent arguments, each one being a di...
[ "Use", "this", "utility", "function", "to", "ensure", "multiple", "keys", "are", "in", "one", "or", "more", "dicts", ".", "Returns", "True", "if", "all", "keys", "are", "present", "in", "at", "least", "one", "of", "the", "given", "dicts", "otherwise", "r...
python
train
woolfson-group/isambard
isambard/add_ons/filesystem.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L381-L409
def get_mmcif(code, outfile=None): """ Get mmcif file associated with code from PDBE. Parameters ---------- code : str PDB code. outfile : str Filepath. Writes returned value to this file. Returns ------- mmcif_file : str Filepath to the mmcif file. """ ...
[ "def", "get_mmcif", "(", "code", ",", "outfile", "=", "None", ")", ":", "pdbe_url", "=", "\"http://www.ebi.ac.uk/pdbe/entry-files/download/{0}.cif\"", ".", "format", "(", "code", ")", "r", "=", "requests", ".", "get", "(", "pdbe_url", ")", "if", "r", ".", "s...
Get mmcif file associated with code from PDBE. Parameters ---------- code : str PDB code. outfile : str Filepath. Writes returned value to this file. Returns ------- mmcif_file : str Filepath to the mmcif file.
[ "Get", "mmcif", "file", "associated", "with", "code", "from", "PDBE", "." ]
python
train
totalgood/pugnlp
src/pugnlp/futil.py
https://github.com/totalgood/pugnlp/blob/c43445b14afddfdeadc5f3076675c9e8fc1ee67c/src/pugnlp/futil.py#L225-L313
def generate_files(path='', ext='', level=None, dirs=False, files=True, verbosity=0): """ Recursively generate files (and thier stats) in the indicated directory Filter by the indicated file name extension (ext) Args: path (str): Root/base path to search. ext (str or list of str): File n...
[ "def", "generate_files", "(", "path", "=", "''", ",", "ext", "=", "''", ",", "level", "=", "None", ",", "dirs", "=", "False", ",", "files", "=", "True", ",", "verbosity", "=", "0", ")", ":", "path", "=", "expand_path", "(", "path", "or", "'.'", "...
Recursively generate files (and thier stats) in the indicated directory Filter by the indicated file name extension (ext) Args: path (str): Root/base path to search. ext (str or list of str): File name extension(s). Only file paths that ".endswith()" this string will be returned ...
[ "Recursively", "generate", "files", "(", "and", "thier", "stats", ")", "in", "the", "indicated", "directory" ]
python
train
spacetelescope/synphot_refactor
synphot/spectrum.py
https://github.com/spacetelescope/synphot_refactor/blob/9c064f3cff0c41dd8acadc0f67c6350931275b9f/synphot/spectrum.py#L608-L657
def taper(self, wavelengths=None): """Taper the spectrum or bandpass. The wavelengths to use for the first and last points are calculated by using the same ratio as for the 2 interior points. Parameters ---------- wavelengths : array-like, `~astropy.units.quantity.Quant...
[ "def", "taper", "(", "self", ",", "wavelengths", "=", "None", ")", ":", "x", "=", "self", ".", "_validate_wavelengths", "(", "wavelengths", ")", "# Calculate new end points for tapering", "w1", "=", "x", "[", "0", "]", "**", "2", "/", "x", "[", "1", "]",...
Taper the spectrum or bandpass. The wavelengths to use for the first and last points are calculated by using the same ratio as for the 2 interior points. Parameters ---------- wavelengths : array-like, `~astropy.units.quantity.Quantity`, or `None` Wavelength values ...
[ "Taper", "the", "spectrum", "or", "bandpass", "." ]
python
train
mattlong/hermes
hermes/chatroom.py
https://github.com/mattlong/hermes/blob/63a5afcafe90ca99aeb44edeee9ed6f90baae431/hermes/chatroom.py#L65-L76
def is_member(self, m): """Check if a user is a member of the chatroom""" if not m: return False elif isinstance(m, basestring): jid = m else: jid = m['JID'] is_member = len(filter(lambda m: m['JID'] == jid and m.get('STATUS') in ('ACTIVE', 'I...
[ "def", "is_member", "(", "self", ",", "m", ")", ":", "if", "not", "m", ":", "return", "False", "elif", "isinstance", "(", "m", ",", "basestring", ")", ":", "jid", "=", "m", "else", ":", "jid", "=", "m", "[", "'JID'", "]", "is_member", "=", "len",...
Check if a user is a member of the chatroom
[ "Check", "if", "a", "user", "is", "a", "member", "of", "the", "chatroom" ]
python
train
wecatch/app-turbo
turbo/model.py
https://github.com/wecatch/app-turbo/blob/75faf97371a9a138c53f92168d0a486636cb8a9c/turbo/model.py#L142-L146
def update_one(self, filter_, document, **kwargs): """update method """ self._valide_update_document(document) return self.__collect.update_one(filter_, document, **kwargs)
[ "def", "update_one", "(", "self", ",", "filter_", ",", "document", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_valide_update_document", "(", "document", ")", "return", "self", ".", "__collect", ".", "update_one", "(", "filter_", ",", "document", ",",...
update method
[ "update", "method" ]
python
train
etal/biofrills
biofrills/pairutils.py
https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/pairutils.py#L127-L133
def identity_avg(aseq, bseq): """Compute absolute identity (# matching sites) between sequence strings.""" match = identity_abs(aseq, bseq) alen = len(aseq.replace('-', '').replace('.', '')) blen = len(bseq.replace('-', '').replace('.', '')) avg_len = 0.5 * (alen + blen) return match / avg_len
[ "def", "identity_avg", "(", "aseq", ",", "bseq", ")", ":", "match", "=", "identity_abs", "(", "aseq", ",", "bseq", ")", "alen", "=", "len", "(", "aseq", ".", "replace", "(", "'-'", ",", "''", ")", ".", "replace", "(", "'.'", ",", "''", ")", ")", ...
Compute absolute identity (# matching sites) between sequence strings.
[ "Compute", "absolute", "identity", "(", "#", "matching", "sites", ")", "between", "sequence", "strings", "." ]
python
train
saltstack/salt
salt/states/virt.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L187-L210
def stopped(name, connection=None, username=None, password=None): ''' Stops a VM by shutting it down nicely. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
[ "def", "stopped", "(", "name", ",", "connection", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "return", "_virt_call", "(", "name", ",", "'shutdown'", ",", "'stopped'", ",", "\"Machine has been shut down\"", ",", "connec...
Stops a VM by shutting it down nicely. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect w...
[ "Stops", "a", "VM", "by", "shutting", "it", "down", "nicely", "." ]
python
train
carpedm20/fbchat
fbchat/_client.py
https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L445-L467
def setSession(self, session_cookies): """Loads session cookies :param session_cookies: A dictionay containing session cookies :type session_cookies: dict :return: False if `session_cookies` does not contain proper cookies :rtype: bool """ # Quick check to see if...
[ "def", "setSession", "(", "self", ",", "session_cookies", ")", ":", "# Quick check to see if session_cookies is formatted properly", "if", "not", "session_cookies", "or", "\"c_user\"", "not", "in", "session_cookies", ":", "return", "False", "try", ":", "# Load cookies int...
Loads session cookies :param session_cookies: A dictionay containing session cookies :type session_cookies: dict :return: False if `session_cookies` does not contain proper cookies :rtype: bool
[ "Loads", "session", "cookies" ]
python
train
Erotemic/utool
utool/util_type.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_type.py#L104-L133
def is_comparable_type(var, type_): """ Check to see if `var` is an instance of known compatible types for `type_` Args: var (?): type_ (?): Returns: bool: CommandLine: python -m utool.util_type is_comparable_type --show Example: >>> # DISABLE_DOCTEST ...
[ "def", "is_comparable_type", "(", "var", ",", "type_", ")", ":", "other_types", "=", "COMPARABLE_TYPES", ".", "get", "(", "type_", ",", "type_", ")", "return", "isinstance", "(", "var", ",", "other_types", ")" ]
Check to see if `var` is an instance of known compatible types for `type_` Args: var (?): type_ (?): Returns: bool: CommandLine: python -m utool.util_type is_comparable_type --show Example: >>> # DISABLE_DOCTEST >>> from utool.util_type import * # NOQ...
[ "Check", "to", "see", "if", "var", "is", "an", "instance", "of", "known", "compatible", "types", "for", "type_" ]
python
train
koalalorenzo/python-digitalocean
digitalocean/baseapi.py
https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/baseapi.py#L68-L116
def __perform_request(self, url, type=GET, params=None): """ This method will perform the real request, in this way we can customize only the "output" of the API call by using self.__call_api method. This method will return the request object. """ ...
[ "def", "__perform_request", "(", "self", ",", "url", ",", "type", "=", "GET", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "if", "not", "self", ".", "token", ":", "raise", "TokenError", "(", "\"N...
This method will perform the real request, in this way we can customize only the "output" of the API call by using self.__call_api method. This method will return the request object.
[ "This", "method", "will", "perform", "the", "real", "request", "in", "this", "way", "we", "can", "customize", "only", "the", "output", "of", "the", "API", "call", "by", "using", "self", ".", "__call_api", "method", ".", "This", "method", "will", "return", ...
python
valid
chaoss/grimoirelab-sortinghat
sortinghat/matching/email_name.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matching/email_name.py#L77-L112
def match(self, a, b): """Determine if two unique identities are the same. This method compares the email addresses or the names of each identity to check if the given unique identities are the same. When the given unique identities are the same object or share the same UUID, th...
[ "def", "match", "(", "self", ",", "a", ",", "b", ")", ":", "if", "not", "isinstance", "(", "a", ",", "UniqueIdentity", ")", ":", "raise", "ValueError", "(", "\"<a> is not an instance of UniqueIdentity\"", ")", "if", "not", "isinstance", "(", "b", ",", "Uni...
Determine if two unique identities are the same. This method compares the email addresses or the names of each identity to check if the given unique identities are the same. When the given unique identities are the same object or share the same UUID, this will also produce a positive ma...
[ "Determine", "if", "two", "unique", "identities", "are", "the", "same", "." ]
python
train
zimeon/iiif
iiif/flask_utils.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif/flask_utils.py#L270-L274
def add_compliance_header(self): """Add IIIF Compliance level header to response.""" if (self.manipulator.compliance_uri is not None): self.headers['Link'] = '<' + \ self.manipulator.compliance_uri + '>;rel="profile"'
[ "def", "add_compliance_header", "(", "self", ")", ":", "if", "(", "self", ".", "manipulator", ".", "compliance_uri", "is", "not", "None", ")", ":", "self", ".", "headers", "[", "'Link'", "]", "=", "'<'", "+", "self", ".", "manipulator", ".", "compliance_...
Add IIIF Compliance level header to response.
[ "Add", "IIIF", "Compliance", "level", "header", "to", "response", "." ]
python
train
keenlabs/KeenClient-Python
keen/api.py
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/api.py#L353-L374
def add_access_key_permissions(self, access_key_id, permissions): """ Adds to the existing list of permissions on this key with the contents of this list. Will not remove any existing permissions or modify the remainder of the key. :param access_key_id: the 'key' value of the access key...
[ "def", "add_access_key_permissions", "(", "self", ",", "access_key_id", ",", "permissions", ")", ":", "# Get current state via HTTPS.", "current_access_key", "=", "self", ".", "get_access_key", "(", "access_key_id", ")", "# Copy and only change the single parameter.", "payloa...
Adds to the existing list of permissions on this key with the contents of this list. Will not remove any existing permissions or modify the remainder of the key. :param access_key_id: the 'key' value of the access key to add permissions to :param permissions: the new permissions to add to the e...
[ "Adds", "to", "the", "existing", "list", "of", "permissions", "on", "this", "key", "with", "the", "contents", "of", "this", "list", ".", "Will", "not", "remove", "any", "existing", "permissions", "or", "modify", "the", "remainder", "of", "the", "key", "." ...
python
train
althonos/pronto
pronto/term.py
https://github.com/althonos/pronto/blob/a768adcba19fb34f26f67cde4a03d317f932c274/pronto/term.py#L398-L403
def children(self): """~TermList: the children of all the terms in the list. """ return TermList(unique_everseen( y for x in self for y in x.children ))
[ "def", "children", "(", "self", ")", ":", "return", "TermList", "(", "unique_everseen", "(", "y", "for", "x", "in", "self", "for", "y", "in", "x", ".", "children", ")", ")" ]
~TermList: the children of all the terms in the list.
[ "~TermList", ":", "the", "children", "of", "all", "the", "terms", "in", "the", "list", "." ]
python
train
jxtech/wechatpy
wechatpy/client/api/scan.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/scan.py#L94-L109
def get_product(self, standard, key): """ 查询商品信息 详情请参考 http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html :param standard: 商品编码标准 :param key: 商品编码内容 :return: 返回的 JSON 数据包 """ data = { 'keystandard': standard, ...
[ "def", "get_product", "(", "self", ",", "standard", ",", "key", ")", ":", "data", "=", "{", "'keystandard'", ":", "standard", ",", "'keystr'", ":", "key", ",", "}", "return", "self", ".", "_post", "(", "'product/get'", ",", "data", "=", "data", ")" ]
查询商品信息 详情请参考 http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html :param standard: 商品编码标准 :param key: 商品编码内容 :return: 返回的 JSON 数据包
[ "查询商品信息" ]
python
train
TrafficSenseMSD/SumoTools
traci/_polygon.py
https://github.com/TrafficSenseMSD/SumoTools/blob/8607b4f885f1d1798e43240be643efe6dccccdaa/traci/_polygon.py#L61-L69
def setType(self, polygonID, polygonType): """setType(string, string) -> None Sets the (abstract) type of the polygon. """ self._connection._beginMessage( tc.CMD_SET_POLYGON_VARIABLE, tc.VAR_TYPE, polygonID, 1 + 4 + len(polygonType)) self._connection._packString(poly...
[ "def", "setType", "(", "self", ",", "polygonID", ",", "polygonType", ")", ":", "self", ".", "_connection", ".", "_beginMessage", "(", "tc", ".", "CMD_SET_POLYGON_VARIABLE", ",", "tc", ".", "VAR_TYPE", ",", "polygonID", ",", "1", "+", "4", "+", "len", "("...
setType(string, string) -> None Sets the (abstract) type of the polygon.
[ "setType", "(", "string", "string", ")", "-", ">", "None" ]
python
train
shmir/PyIxNetwork
ixnetwork/ixn_port.py
https://github.com/shmir/PyIxNetwork/blob/e7d7a89c08a5d3a1382b4dcfd915bbfc7eedd33f/ixnetwork/ixn_port.py#L52-L62
def wait_for_up(self, timeout=40): """ Wait until port is up and running, including all parameters (admin state, oper state, license etc.). :param timeout: max time to wait for port up. """ self.wait_for_states(timeout, 'up') connectionStatus = self.get_attribute('connectionSta...
[ "def", "wait_for_up", "(", "self", ",", "timeout", "=", "40", ")", ":", "self", ".", "wait_for_states", "(", "timeout", ",", "'up'", ")", "connectionStatus", "=", "self", ".", "get_attribute", "(", "'connectionStatus'", ")", ".", "strip", "(", ")", "if", ...
Wait until port is up and running, including all parameters (admin state, oper state, license etc.). :param timeout: max time to wait for port up.
[ "Wait", "until", "port", "is", "up", "and", "running", "including", "all", "parameters", "(", "admin", "state", "oper", "state", "license", "etc", ".", ")", "." ]
python
train
holtjma/msbwt
MUS/MultiStringBWT.py
https://github.com/holtjma/msbwt/blob/7503346ec072ddb89520db86fef85569a9ba093a/MUS/MultiStringBWT.py#L555-L593
def getCharAtIndex(self, index): ''' Used for searching, this function masks the complexity behind retrieving a specific character at a specific index in our compressed BWT. @param index - the index to retrieve the character from @param return - return the character in our BWT th...
[ "def", "getCharAtIndex", "(", "self", ",", "index", ")", ":", "#get the bin we should start from", "binID", "=", "index", ">>", "self", ".", "bitPower", "bwtIndex", "=", "self", ".", "refFM", "[", "binID", "]", "#these are the values that indicate how far in we really...
Used for searching, this function masks the complexity behind retrieving a specific character at a specific index in our compressed BWT. @param index - the index to retrieve the character from @param return - return the character in our BWT that's at a particular index (integer format)
[ "Used", "for", "searching", "this", "function", "masks", "the", "complexity", "behind", "retrieving", "a", "specific", "character", "at", "a", "specific", "index", "in", "our", "compressed", "BWT", "." ]
python
train
sdispater/orator
orator/schema/blueprint.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/schema/blueprint.py#L128-L139
def drop_column(self, *columns): """ Indicates that the given columns should be dropped. :param columns: The columns to drop :type columns: tuple :rtype: Fluent """ columns = list(columns) return self._add_command("drop_column", columns=columns)
[ "def", "drop_column", "(", "self", ",", "*", "columns", ")", ":", "columns", "=", "list", "(", "columns", ")", "return", "self", ".", "_add_command", "(", "\"drop_column\"", ",", "columns", "=", "columns", ")" ]
Indicates that the given columns should be dropped. :param columns: The columns to drop :type columns: tuple :rtype: Fluent
[ "Indicates", "that", "the", "given", "columns", "should", "be", "dropped", "." ]
python
train
pydata/xarray
xarray/core/computation.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/computation.py#L339-L384
def apply_dataset_vfunc( func, *args, signature, join='inner', dataset_join='exact', fill_value=_NO_FILL_VALUE, exclude_dims=frozenset(), keep_attrs=False ): """Apply a variable level function over Dataset, dict of DataArray, DataArray, Variable and/or ndarray objects. """ ...
[ "def", "apply_dataset_vfunc", "(", "func", ",", "*", "args", ",", "signature", ",", "join", "=", "'inner'", ",", "dataset_join", "=", "'exact'", ",", "fill_value", "=", "_NO_FILL_VALUE", ",", "exclude_dims", "=", "frozenset", "(", ")", ",", "keep_attrs", "="...
Apply a variable level function over Dataset, dict of DataArray, DataArray, Variable and/or ndarray objects.
[ "Apply", "a", "variable", "level", "function", "over", "Dataset", "dict", "of", "DataArray", "DataArray", "Variable", "and", "/", "or", "ndarray", "objects", "." ]
python
train
greenbender/pynntp
nntp/nntp.py
https://github.com/greenbender/pynntp/blob/991a76331cdf5d8f9dbf5b18f6e29adc80749a2f/nntp/nntp.py#L395-L441
def command(self, verb, args=None): """Call a command on the server. If the user has not authenticated then authentication will be done as part of calling the command on the server. For commands that don't return a status message the status message will default to an empty stri...
[ "def", "command", "(", "self", ",", "verb", ",", "args", "=", "None", ")", ":", "if", "self", ".", "__generating", ":", "raise", "NNTPSyncError", "(", "\"Command issued while a generator is active\"", ")", "cmd", "=", "verb", "if", "args", ":", "cmd", "+=", ...
Call a command on the server. If the user has not authenticated then authentication will be done as part of calling the command on the server. For commands that don't return a status message the status message will default to an empty string. Args: verb: The verb o...
[ "Call", "a", "command", "on", "the", "server", "." ]
python
test
thiezn/iperf3-python
iperf3/iperf3.py
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L508-L511
def bandwidth(self): """Target bandwidth in bits/sec""" self._bandwidth = self.lib.iperf_get_test_rate(self._test) return self._bandwidth
[ "def", "bandwidth", "(", "self", ")", ":", "self", ".", "_bandwidth", "=", "self", ".", "lib", ".", "iperf_get_test_rate", "(", "self", ".", "_test", ")", "return", "self", ".", "_bandwidth" ]
Target bandwidth in bits/sec
[ "Target", "bandwidth", "in", "bits", "/", "sec" ]
python
train
isislovecruft/python-gnupg
pretty_bad_protocol/_logger.py
https://github.com/isislovecruft/python-gnupg/blob/784571449032e811587249743e183fc5e908a673/pretty_bad_protocol/_logger.py#L48-L99
def create_logger(level=logging.NOTSET): """Create a logger for python-gnupg at a specific message level. :type level: :obj:`int` or :obj:`str` :param level: A string or an integer for the lowest level to include in logs. **Available levels:** ==== ======== =====================...
[ "def", "create_logger", "(", "level", "=", "logging", ".", "NOTSET", ")", ":", "_test", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "'pretty_bad_protocol'", ")", ",", "'test'", ...
Create a logger for python-gnupg at a specific message level. :type level: :obj:`int` or :obj:`str` :param level: A string or an integer for the lowest level to include in logs. **Available levels:** ==== ======== ======================================== int str descriptio...
[ "Create", "a", "logger", "for", "python", "-", "gnupg", "at", "a", "specific", "message", "level", "." ]
python
train
Alignak-monitoring/alignak
alignak/objects/itemgroup.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/itemgroup.py#L144-L157
def add_members(self, members): """Add a new member to the members list :param members: member name :type members: str :return: None """ if not isinstance(members, list): members = [members] if not getattr(self, 'members', None): self.mem...
[ "def", "add_members", "(", "self", ",", "members", ")", ":", "if", "not", "isinstance", "(", "members", ",", "list", ")", ":", "members", "=", "[", "members", "]", "if", "not", "getattr", "(", "self", ",", "'members'", ",", "None", ")", ":", "self", ...
Add a new member to the members list :param members: member name :type members: str :return: None
[ "Add", "a", "new", "member", "to", "the", "members", "list" ]
python
train
watson-developer-cloud/python-sdk
ibm_watson/text_to_speech_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/text_to_speech_v1.py#L180-L295
def synthesize(self, text, voice=None, customization_id=None, accept=None, **kwargs): """ Synthesize audio. Synthesizes text to audio that is spoken in the specified voice. The service bases i...
[ "def", "synthesize", "(", "self", ",", "text", ",", "voice", "=", "None", ",", "customization_id", "=", "None", ",", "accept", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "text", "is", "None", ":", "raise", "ValueError", "(", "'text must be p...
Synthesize audio. Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text. The method accepts a maximum of 5 KB of input text i...
[ "Synthesize", "audio", "." ]
python
train
isislovecruft/python-gnupg
pretty_bad_protocol/_parsers.py
https://github.com/isislovecruft/python-gnupg/blob/784571449032e811587249743e183fc5e908a673/pretty_bad_protocol/_parsers.py#L49-L75
def _check_keyserver(location): """Check that a given keyserver is a known protocol and does not contain shell escape characters. :param str location: A string containing the default keyserver. This should contain the desired keyserver protocol which is sup...
[ "def", "_check_keyserver", "(", "location", ")", ":", "protocols", "=", "[", "'hkp://'", ",", "'hkps://'", ",", "'http://'", ",", "'https://'", ",", "'ldap://'", ",", "'mailto:'", "]", "## xxx feels like i´m forgetting one...", "for", "proto", "in", "protocols", "...
Check that a given keyserver is a known protocol and does not contain shell escape characters. :param str location: A string containing the default keyserver. This should contain the desired keyserver protocol which is supported by the keyserver, for example, t...
[ "Check", "that", "a", "given", "keyserver", "is", "a", "known", "protocol", "and", "does", "not", "contain", "shell", "escape", "characters", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_relay.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_relay.py#L15-L37
def cmd_relay(self, args): '''set relays''' if len(args) == 0 or args[0] not in ['set', 'repeat']: print("Usage: relay <set|repeat>") return if args[0] == "set": if len(args) < 3: print("Usage: relay set <RELAY_NUM> <0|1>") retu...
[ "def", "cmd_relay", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "==", "0", "or", "args", "[", "0", "]", "not", "in", "[", "'set'", ",", "'repeat'", "]", ":", "print", "(", "\"Usage: relay <set|repeat>\"", ")", "return", "if", ...
set relays
[ "set", "relays" ]
python
train
orbingol/NURBS-Python
geomdl/visualization/VisMPL.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/visualization/VisMPL.py#L298-L402
def animate(self, **kwargs): """ Animates the surface. This function only animates the triangulated surface. There will be no other elements, such as control points grid or bounding box. Keyword arguments: * ``colormap``: applies colormap to the surface Colormaps a...
[ "def", "animate", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Calling parent render function", "super", "(", "VisSurface", ",", "self", ")", ".", "render", "(", "*", "*", "kwargs", ")", "# Colormaps", "surf_cmaps", "=", "kwargs", ".", "get", "(", ...
Animates the surface. This function only animates the triangulated surface. There will be no other elements, such as control points grid or bounding box. Keyword arguments: * ``colormap``: applies colormap to the surface Colormaps are a visualization feature of Matplotlib....
[ "Animates", "the", "surface", "." ]
python
train
paylogic/pip-accel
pip_accel/__init__.py
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L618-L627
def cleanup_temporary_directories(self): """Delete the build directories and any temporary directories created by pip.""" while self.build_directories: shutil.rmtree(self.build_directories.pop()) for requirement in self.reported_requirements: requirement.remove_temporary_...
[ "def", "cleanup_temporary_directories", "(", "self", ")", ":", "while", "self", ".", "build_directories", ":", "shutil", ".", "rmtree", "(", "self", ".", "build_directories", ".", "pop", "(", ")", ")", "for", "requirement", "in", "self", ".", "reported_require...
Delete the build directories and any temporary directories created by pip.
[ "Delete", "the", "build", "directories", "and", "any", "temporary", "directories", "created", "by", "pip", "." ]
python
train
Accelize/pycosio
pycosio/_core/io_base_raw.py
https://github.com/Accelize/pycosio/blob/1cc1f8fdf5394d92918b7bae2bfa682169ccc48c/pycosio/_core/io_base_raw.py#L401-L428
def write(self, b): """ Write the given bytes-like object, b, to the underlying raw stream, and return the number of bytes written. Args: b (bytes-like object): Bytes to write. Returns: int: The number of bytes written. """ if not self._w...
[ "def", "write", "(", "self", ",", "b", ")", ":", "if", "not", "self", ".", "_writable", ":", "raise", "UnsupportedOperation", "(", "'write'", ")", "# This function write data in a buffer", "# \"flush()\" need to be called to really write content on", "# Cloud Storage", "s...
Write the given bytes-like object, b, to the underlying raw stream, and return the number of bytes written. Args: b (bytes-like object): Bytes to write. Returns: int: The number of bytes written.
[ "Write", "the", "given", "bytes", "-", "like", "object", "b", "to", "the", "underlying", "raw", "stream", "and", "return", "the", "number", "of", "bytes", "written", "." ]
python
train
brutus/wtforms-html5
wtforms_html5.py
https://github.com/brutus/wtforms-html5/blob/a00ab7c68e6238bfa317f40ec3de807dae8ed85e/wtforms_html5.py#L208-L254
def get_html5_kwargs(field, render_kw=None, force=False): """ Returns a copy of *render_kw* with keys added for a bound *field*. If some *render_kw* are given, the new keys are added to a copy of them, which is then returned. If none are given, a dictionary containing only the automatically genera...
[ "def", "get_html5_kwargs", "(", "field", ",", "render_kw", "=", "None", ",", "force", "=", "False", ")", ":", "if", "isinstance", "(", "field", ",", "UnboundField", ")", ":", "msg", "=", "'This function needs a bound field not: {}'", "raise", "ValueError", "(", ...
Returns a copy of *render_kw* with keys added for a bound *field*. If some *render_kw* are given, the new keys are added to a copy of them, which is then returned. If none are given, a dictionary containing only the automatically generated keys is returned. .. important:: This might add new ...
[ "Returns", "a", "copy", "of", "*", "render_kw", "*", "with", "keys", "added", "for", "a", "bound", "*", "field", "*", "." ]
python
train
EUDAT-B2SAFE/B2HANDLE
b2handle/handleclient.py
https://github.com/EUDAT-B2SAFE/B2HANDLE/blob/a6d216d459644e01fbdfd5b318a535950bc5cdbb/b2handle/handleclient.py#L731-L781
def add_additional_URL(self, handle, *urls, **attributes): ''' Add a URL entry to the handle record's 10320/LOC entry. If 10320/LOC does not exist yet, it is created. If the 10320/LOC entry already contains the URL, it is not added a second time. :param handle: The handle to add...
[ "def", "add_additional_URL", "(", "self", ",", "handle", ",", "*", "urls", ",", "*", "*", "attributes", ")", ":", "LOGGER", ".", "debug", "(", "'add_additional_URL...'", ")", "handlerecord_json", "=", "self", ".", "retrieve_handle_record_json", "(", "handle", ...
Add a URL entry to the handle record's 10320/LOC entry. If 10320/LOC does not exist yet, it is created. If the 10320/LOC entry already contains the URL, it is not added a second time. :param handle: The handle to add the URL to. :param urls: The URL(s) to be added. Several URLs may be s...
[ "Add", "a", "URL", "entry", "to", "the", "handle", "record", "s", "10320", "/", "LOC", "entry", ".", "If", "10320", "/", "LOC", "does", "not", "exist", "yet", "it", "is", "created", ".", "If", "the", "10320", "/", "LOC", "entry", "already", "contains...
python
train
Opentrons/opentrons
api/src/opentrons/protocol_api/contexts.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/protocol_api/contexts.py#L367-L374
def loaded_instruments(self) -> Dict[str, Optional['InstrumentContext']]: """ Get the instruments that have been loaded into the protocol. :returns: A dict mapping mount names in lowercase to the instrument in that mount, or `None` if no instrument is present. """ retu...
[ "def", "loaded_instruments", "(", "self", ")", "->", "Dict", "[", "str", ",", "Optional", "[", "'InstrumentContext'", "]", "]", ":", "return", "{", "mount", ".", "name", ".", "lower", "(", ")", ":", "instr", "for", "mount", ",", "instr", "in", "self", ...
Get the instruments that have been loaded into the protocol. :returns: A dict mapping mount names in lowercase to the instrument in that mount, or `None` if no instrument is present.
[ "Get", "the", "instruments", "that", "have", "been", "loaded", "into", "the", "protocol", "." ]
python
train
ewels/MultiQC
multiqc/modules/mirtrace/mirtrace.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/mirtrace/mirtrace.py#L241-L271
def mirtrace_length_plot(self): """ Generate the miRTrace Read Length Distribution""" data = dict() for s_name in self.length_data: try: data[s_name] = {int(d): int(self.length_data[s_name][d]) for d in self.length_data[s_name]} except KeyError: ...
[ "def", "mirtrace_length_plot", "(", "self", ")", ":", "data", "=", "dict", "(", ")", "for", "s_name", "in", "self", ".", "length_data", ":", "try", ":", "data", "[", "s_name", "]", "=", "{", "int", "(", "d", ")", ":", "int", "(", "self", ".", "le...
Generate the miRTrace Read Length Distribution
[ "Generate", "the", "miRTrace", "Read", "Length", "Distribution" ]
python
train
reingart/pyafipws
wsltv.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/wsltv.py#L314-L409
def AnalizarLiquidacion(self, liq): "Método interno para analizar la respuesta de AFIP" # proceso los datos básicos de la liquidación (devuelto por consultar): if liq: cab = liq['cabecera'] self.CAE = str(cab['cae']) self.FechaLiquidacion = cab['fechaLiquidaci...
[ "def", "AnalizarLiquidacion", "(", "self", ",", "liq", ")", ":", "# proceso los datos básicos de la liquidación (devuelto por consultar):", "if", "liq", ":", "cab", "=", "liq", "[", "'cabecera'", "]", "self", ".", "CAE", "=", "str", "(", "cab", "[", "'cae'", "]"...
Método interno para analizar la respuesta de AFIP
[ "Método", "interno", "para", "analizar", "la", "respuesta", "de", "AFIP" ]
python
train
sibirrer/lenstronomy
lenstronomy/LensModel/Optimizer/particle_swarm.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/particle_swarm.py#L167-L174
def create(cls, paramCount): """ Creates a new particle without position, velocity and -inf as fitness """ return Particle(numpy.array([[]]*paramCount), numpy.array([[]]*paramCount), -numpy.Inf)
[ "def", "create", "(", "cls", ",", "paramCount", ")", ":", "return", "Particle", "(", "numpy", ".", "array", "(", "[", "[", "]", "]", "*", "paramCount", ")", ",", "numpy", ".", "array", "(", "[", "[", "]", "]", "*", "paramCount", ")", ",", "-", ...
Creates a new particle without position, velocity and -inf as fitness
[ "Creates", "a", "new", "particle", "without", "position", "velocity", "and", "-", "inf", "as", "fitness" ]
python
train
pahaz/sshtunnel
sshtunnel.py
https://github.com/pahaz/sshtunnel/blob/66a923e4c6c8e41b8348420523fbf5ddfd53176c/sshtunnel.py#L1176-L1195
def _process_deprecated(attrib, deprecated_attrib, kwargs): """ Processes optional deprecate arguments """ if deprecated_attrib not in DEPRECATIONS: raise ValueError('{0} not included in deprecations list' .format(deprecated_attrib)) if de...
[ "def", "_process_deprecated", "(", "attrib", ",", "deprecated_attrib", ",", "kwargs", ")", ":", "if", "deprecated_attrib", "not", "in", "DEPRECATIONS", ":", "raise", "ValueError", "(", "'{0} not included in deprecations list'", ".", "format", "(", "deprecated_attrib", ...
Processes optional deprecate arguments
[ "Processes", "optional", "deprecate", "arguments" ]
python
train
ejhigson/nestcheck
nestcheck/ns_run_utils.py
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L218-L286
def combine_threads(threads, assert_birth_point=False): """ Combine list of threads into a single ns run. This is different to combining runs as repeated threads are allowed, and as some threads can start from log-likelihood contours on which no dead point in the run is present. Note that if al...
[ "def", "combine_threads", "(", "threads", ",", "assert_birth_point", "=", "False", ")", ":", "thread_min_max", "=", "np", ".", "vstack", "(", "[", "td", "[", "'thread_min_max'", "]", "for", "td", "in", "threads", "]", ")", "assert", "len", "(", "threads", ...
Combine list of threads into a single ns run. This is different to combining runs as repeated threads are allowed, and as some threads can start from log-likelihood contours on which no dead point in the run is present. Note that if all the thread labels are not unique and in ascending order, the o...
[ "Combine", "list", "of", "threads", "into", "a", "single", "ns", "run", ".", "This", "is", "different", "to", "combining", "runs", "as", "repeated", "threads", "are", "allowed", "and", "as", "some", "threads", "can", "start", "from", "log", "-", "likelihoo...
python
train
mitsei/dlkit
dlkit/services/authorization.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1155-L1163
def use_plenary_authorization_view(self): """Pass through to provider AuthorizationLookupSession.use_plenary_authorization_view""" self._object_views['authorization'] = PLENARY # self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked for session ...
[ "def", "use_plenary_authorization_view", "(", "self", ")", ":", "self", ".", "_object_views", "[", "'authorization'", "]", "=", "PLENARY", "# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked", "for", "session", "in", "self", ".", ...
Pass through to provider AuthorizationLookupSession.use_plenary_authorization_view
[ "Pass", "through", "to", "provider", "AuthorizationLookupSession", ".", "use_plenary_authorization_view" ]
python
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/apply.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/apply.py#L132-L143
def getLayout(self, algorithmName, verbose=None): """ Returns all the details, including names, parameters, and compatible column types for the Layout algorithm specified by the `algorithmName` parameter. :param algorithmName: Name of the Layout algorithm :param verbose: print more ...
[ "def", "getLayout", "(", "self", ",", "algorithmName", ",", "verbose", "=", "None", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "___url", "+", "'apply/layouts/'", "+", "str", "(", "algorithmName", ")", "+", "''", ",", "method", "=",...
Returns all the details, including names, parameters, and compatible column types for the Layout algorithm specified by the `algorithmName` parameter. :param algorithmName: Name of the Layout algorithm :param verbose: print more :returns: 200: successful operation
[ "Returns", "all", "the", "details", "including", "names", "parameters", "and", "compatible", "column", "types", "for", "the", "Layout", "algorithm", "specified", "by", "the", "algorithmName", "parameter", "." ]
python
train
saltstack/salt
salt/states/azurearm_compute.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_compute.py#L266-L326
def availability_set_absent(name, resource_group, connection_auth=None): ''' .. versionadded:: 2019.2.0 Ensure an availability set does not exist in a resource group. :param name: Name of the availability set. :param resource_group: Name of the resource group containing the availa...
[ "def", "availability_set_absent", "(", "name", ",", "resource_group", ",", "connection_auth", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}",...
.. versionadded:: 2019.2.0 Ensure an availability set does not exist in a resource group. :param name: Name of the availability set. :param resource_group: Name of the resource group containing the availability set. :param connection_auth: A dict with subscription and authent...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
python
train
monarch-initiative/dipper
dipper/sources/Bgee.py
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/Bgee.py#L157-L174
def parse(self, limit=None): """ Given the input taxa, expects files in the raw directory with the name {tax_id}_anat_entity_all_data_Pan_troglodytes.tsv.zip :param limit: int Limit to top ranked anatomy associations per group :return: None """ files_to_download...
[ "def", "parse", "(", "self", ",", "limit", "=", "None", ")", ":", "files_to_download", ",", "ftp", "=", "self", ".", "_get_file_list", "(", "self", ".", "files", "[", "'anat_entity'", "]", "[", "'path'", "]", ",", "self", ".", "files", "[", "'anat_enti...
Given the input taxa, expects files in the raw directory with the name {tax_id}_anat_entity_all_data_Pan_troglodytes.tsv.zip :param limit: int Limit to top ranked anatomy associations per group :return: None
[ "Given", "the", "input", "taxa", "expects", "files", "in", "the", "raw", "directory", "with", "the", "name", "{", "tax_id", "}", "_anat_entity_all_data_Pan_troglodytes", ".", "tsv", ".", "zip" ]
python
train
dwavesystems/dwave_networkx
dwave_networkx/drawing/pegasus_layout.py
https://github.com/dwavesystems/dwave_networkx/blob/9ea1223ddbc7e86db2f90b8b23e250e6642c3d68/dwave_networkx/drawing/pegasus_layout.py#L234-L287
def draw_pegasus_embedding(G, *args, **kwargs): """Draws an embedding onto the pegasus graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings accord...
[ "def", "draw_pegasus_embedding", "(", "G", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "crosses", "=", "kwargs", ".", "pop", "(", "\"crosses\"", ",", "False", ")", "draw_embedding", "(", "G", ",", "pegasus_layout", "(", "G", ",", "crosses", "=...
Draws an embedding onto the pegasus graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings according to embedded_graph. Parameters ---------- ...
[ "Draws", "an", "embedding", "onto", "the", "pegasus", "graph", "G", "according", "to", "layout", "." ]
python
train
airspeed-velocity/asv
asv/extern/asizeof.py
https://github.com/airspeed-velocity/asv/blob/d23bb8b74e8adacbfa3cf5724bda55fb39d56ba6/asv/extern/asizeof.py#L716-L724
def _len_dict(obj): '''Dict length in items (estimate). ''' n = len(obj) # active items if n < 6: # ma_smalltable ... n = 0 # ... in basicsize else: # at least one unused n = _power2(n + 1) return n
[ "def", "_len_dict", "(", "obj", ")", ":", "n", "=", "len", "(", "obj", ")", "# active items", "if", "n", "<", "6", ":", "# ma_smalltable ...", "n", "=", "0", "# ... in basicsize", "else", ":", "# at least one unused", "n", "=", "_power2", "(", "n", "+", ...
Dict length in items (estimate).
[ "Dict", "length", "in", "items", "(", "estimate", ")", "." ]
python
train
spyder-ide/spyder
spyder/utils/sourcecode.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L173-L195
def disambiguate_fname(files_path_list, filename): """Get tab title without ambiguation.""" fname = os.path.basename(filename) same_name_files = get_same_name_files(files_path_list, fname) if len(same_name_files) > 1: compare_path = shortest_path(same_name_files) if compare_path ==...
[ "def", "disambiguate_fname", "(", "files_path_list", ",", "filename", ")", ":", "fname", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "same_name_files", "=", "get_same_name_files", "(", "files_path_list", ",", "fname", ")", "if", "len", "(", ...
Get tab title without ambiguation.
[ "Get", "tab", "title", "without", "ambiguation", "." ]
python
train
lsst-sqre/documenteer
documenteer/sphinxconfig/stackconf.py
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxconfig/stackconf.py#L533-L647
def build_pipelines_lsst_io_configs(*, project_name, copyright=None): """Build a `dict` of Sphinx configurations that populate the ``conf.py`` of the main pipelines_lsst_io Sphinx project for LSST Science Pipelines documentation. The ``conf.py`` file can ingest these configurations via:: from d...
[ "def", "build_pipelines_lsst_io_configs", "(", "*", ",", "project_name", ",", "copyright", "=", "None", ")", ":", "# Work around Sphinx bug related to large and highly-nested source files", "sys", ".", "setrecursionlimit", "(", "2000", ")", "c", "=", "{", "}", "c", "=...
Build a `dict` of Sphinx configurations that populate the ``conf.py`` of the main pipelines_lsst_io Sphinx project for LSST Science Pipelines documentation. The ``conf.py`` file can ingest these configurations via:: from documenteer.sphinxconfig.stackconf import \ build_pipelines_lsst_io...
[ "Build", "a", "dict", "of", "Sphinx", "configurations", "that", "populate", "the", "conf", ".", "py", "of", "the", "main", "pipelines_lsst_io", "Sphinx", "project", "for", "LSST", "Science", "Pipelines", "documentation", "." ]
python
train
wavycloud/pyboto3
pyboto3/support.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/support.py#L244-L352
def describe_cases(caseIdList=None, displayId=None, afterTime=None, beforeTime=None, includeResolvedCases=None, nextToken=None, maxResults=None, language=None, includeCommunications=None): """ Returns a list of cases that you specify by passing one or more case IDs. In addition, you can filter the cases by date...
[ "def", "describe_cases", "(", "caseIdList", "=", "None", ",", "displayId", "=", "None", ",", "afterTime", "=", "None", ",", "beforeTime", "=", "None", ",", "includeResolvedCases", "=", "None", ",", "nextToken", "=", "None", ",", "maxResults", "=", "None", ...
Returns a list of cases that you specify by passing one or more case IDs. In addition, you can filter the cases by date by setting values for the afterTime and beforeTime request parameters. You can set values for the includeResolvedCases and includeCommunications request parameters to control how much information is r...
[ "Returns", "a", "list", "of", "cases", "that", "you", "specify", "by", "passing", "one", "or", "more", "case", "IDs", ".", "In", "addition", "you", "can", "filter", "the", "cases", "by", "date", "by", "setting", "values", "for", "the", "afterTime", "and"...
python
train
bhmm/bhmm
bhmm/util/statistics.py
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/statistics.py#L34-L75
def confidence_interval(data, alpha): """ Computes the mean and alpha-confidence interval of the given sample set Parameters ---------- data : ndarray a 1D-array of samples alpha : float in [0,1] the confidence level, i.e. percentage of data included in the interval ...
[ "def", "confidence_interval", "(", "data", ",", "alpha", ")", ":", "if", "alpha", "<", "0", "or", "alpha", ">", "1", ":", "raise", "ValueError", "(", "'Not a meaningful confidence level: '", "+", "str", "(", "alpha", ")", ")", "# compute mean", "m", "=", "...
Computes the mean and alpha-confidence interval of the given sample set Parameters ---------- data : ndarray a 1D-array of samples alpha : float in [0,1] the confidence level, i.e. percentage of data included in the interval Returns ------- [m,l,r] where m is the me...
[ "Computes", "the", "mean", "and", "alpha", "-", "confidence", "interval", "of", "the", "given", "sample", "set" ]
python
train
PythonCharmers/python-future
src/future/types/newstr.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/types/newstr.py#L275-L286
def splitlines(self, keepends=False): """ S.splitlines(keepends=False) -> list of strings Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true. """ # Py2 unicode.splitli...
[ "def", "splitlines", "(", "self", ",", "keepends", "=", "False", ")", ":", "# Py2 unicode.splitlines() takes keepends as an optional parameter,", "# not as a keyword argument as in Python 3 str.", "parts", "=", "super", "(", "newstr", ",", "self", ")", ".", "splitlines", ...
S.splitlines(keepends=False) -> list of strings Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
[ "S", ".", "splitlines", "(", "keepends", "=", "False", ")", "-", ">", "list", "of", "strings" ]
python
train
almcc/cinder-data
cinder_data/store.py
https://github.com/almcc/cinder-data/blob/4159a5186c4b4fc32354749892e86130530f6ec5/cinder_data/store.py#L41-L55
def peek_record(self, model_class, record_id): """Return an instance of the model_class from the cache if it is present. Args: model_class (:class:`cinder_data.model.CinderModel`): A subclass of :class:`cinder_data.model.CinderModel` of your chosen model. record_...
[ "def", "peek_record", "(", "self", ",", "model_class", ",", "record_id", ")", ":", "if", "self", ".", "_cache", ":", "return", "self", ".", "_cache", ".", "get_record", "(", "model_class", ".", "__name__", ",", "record_id", ")", "else", ":", "return", "N...
Return an instance of the model_class from the cache if it is present. Args: model_class (:class:`cinder_data.model.CinderModel`): A subclass of :class:`cinder_data.model.CinderModel` of your chosen model. record_id (int): The id of the record requested. Returns...
[ "Return", "an", "instance", "of", "the", "model_class", "from", "the", "cache", "if", "it", "is", "present", "." ]
python
train
Vagrants/blackbird
blackbird/utils/configread.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L380-L422
def _get_raw_specs(self, config): """ This method extract only the "Validate.spec" from modules that were collected by ConfigReader._get_modules(). And, this method append "Validate.spec" to raw_specs. This method creates a dictionary like the following: raw_specs = { ...
[ "def", "_get_raw_specs", "(", "self", ",", "config", ")", ":", "# spec_name is hard-corded", "raw_specs", "=", "{", "}", "spec_name", "=", "'Validator'", "modules", "=", "self", ".", "_get_modules", "(", ")", "for", "section", ",", "options", "in", "config", ...
This method extract only the "Validate.spec" from modules that were collected by ConfigReader._get_modules(). And, this method append "Validate.spec" to raw_specs. This method creates a dictionary like the following: raw_specs = { 'redis': ( "[redis]", ...
[ "This", "method", "extract", "only", "the", "Validate", ".", "spec", "from", "modules", "that", "were", "collected", "by", "ConfigReader", ".", "_get_modules", "()", ".", "And", "this", "method", "append", "Validate", ".", "spec", "to", "raw_specs", ".", "Th...
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L474-L485
def OnOpenFile(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN|wx.FD_MULTIPLE) if dialog.ShowModal() == wx.ID_OK: paths = dialog.GetPaths() if self.loader: # we've already got a displayed data-set, open new...
[ "def", "OnOpenFile", "(", "self", ",", "event", ")", ":", "dialog", "=", "wx", ".", "FileDialog", "(", "self", ",", "style", "=", "wx", ".", "OPEN", "|", "wx", ".", "FD_MULTIPLE", ")", "if", "dialog", ".", "ShowModal", "(", ")", "==", "wx", ".", ...
Request to open a new profile file
[ "Request", "to", "open", "a", "new", "profile", "file" ]
python
train
Microsoft/malmo
MalmoEnv/malmoenv/commands.py
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/MalmoEnv/malmoenv/commands.py#L85-L135
def get_actions(self, commands): """Get parameterized actions from command list based on command type and verb.""" actions = [] for type, turn_based, verb in commands: if len(self.action_filter) != 0 and verb not in self.action_filter: continue if type == ...
[ "def", "get_actions", "(", "self", ",", "commands", ")", ":", "actions", "=", "[", "]", "for", "type", ",", "turn_based", ",", "verb", "in", "commands", ":", "if", "len", "(", "self", ".", "action_filter", ")", "!=", "0", "and", "verb", "not", "in", ...
Get parameterized actions from command list based on command type and verb.
[ "Get", "parameterized", "actions", "from", "command", "list", "based", "on", "command", "type", "and", "verb", "." ]
python
train
KE-works/pykechain
pykechain/models/part.py
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L255-L281
def proxy_model(self): """ Retrieve the proxy model of this proxied `Part` as a `Part`. Allows you to retrieve the model of a proxy. But trying to get the catalog model of a part that has no proxy, will raise an :exc:`NotFoundError`. Only models can have a proxy. :return: :clas...
[ "def", "proxy_model", "(", "self", ")", ":", "if", "self", ".", "category", "!=", "Category", ".", "MODEL", ":", "raise", "IllegalArgumentError", "(", "\"Part {} is not a model, therefore it cannot have a proxy model\"", ".", "format", "(", "self", ")", ")", "if", ...
Retrieve the proxy model of this proxied `Part` as a `Part`. Allows you to retrieve the model of a proxy. But trying to get the catalog model of a part that has no proxy, will raise an :exc:`NotFoundError`. Only models can have a proxy. :return: :class:`Part` with category `MODEL` and from whi...
[ "Retrieve", "the", "proxy", "model", "of", "this", "proxied", "Part", "as", "a", "Part", "." ]
python
train
apache/incubator-mxnet
python/mxnet/symbol/symbol.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/symbol/symbol.py#L2718-L2739
def load_json(json_str): """Loads symbol from json string. Parameters ---------- json_str : str A JSON string. Returns ------- sym : Symbol The loaded symbol. See Also -------- Symbol.tojson : Used to save symbol into json string. """ if not isinstance(...
[ "def", "load_json", "(", "json_str", ")", ":", "if", "not", "isinstance", "(", "json_str", ",", "string_types", ")", ":", "raise", "TypeError", "(", "'fname required to be string'", ")", "handle", "=", "SymbolHandle", "(", ")", "check_call", "(", "_LIB", ".", ...
Loads symbol from json string. Parameters ---------- json_str : str A JSON string. Returns ------- sym : Symbol The loaded symbol. See Also -------- Symbol.tojson : Used to save symbol into json string.
[ "Loads", "symbol", "from", "json", "string", "." ]
python
train
diging/tethne
tethne/analyze/collection.py
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/analyze/collection.py#L72-L101
def connected(G, method_name, **kwargs): """ Performs analysis methods from networkx.connected on each graph in the collection. Parameters ---------- G : :class:`.GraphCollection` The :class:`.GraphCollection` to analyze. The specified method will be applied to each graph in ``G...
[ "def", "connected", "(", "G", ",", "method_name", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"To be removed in 0.8. Use GraphCollection.analyze instead.\"", ",", "DeprecationWarning", ")", "return", "G", ".", "analyze", "(", "[", "'connecte...
Performs analysis methods from networkx.connected on each graph in the collection. Parameters ---------- G : :class:`.GraphCollection` The :class:`.GraphCollection` to analyze. The specified method will be applied to each graph in ``G``. method : string Name of method in net...
[ "Performs", "analysis", "methods", "from", "networkx", ".", "connected", "on", "each", "graph", "in", "the", "collection", "." ]
python
train
peri-source/peri
peri/logger.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/logger.py#L82-L88
def set_formatter(self, formatter='standard', handlers=None): """ Set the text format of messages to one of the pre-determined forms, one of ['quiet', 'minimal', 'standard', 'verbose'] """ for h in self.get_handlers(handlers): h.setFormatter(logging.Formatter(formatte...
[ "def", "set_formatter", "(", "self", ",", "formatter", "=", "'standard'", ",", "handlers", "=", "None", ")", ":", "for", "h", "in", "self", ".", "get_handlers", "(", "handlers", ")", ":", "h", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", ...
Set the text format of messages to one of the pre-determined forms, one of ['quiet', 'minimal', 'standard', 'verbose']
[ "Set", "the", "text", "format", "of", "messages", "to", "one", "of", "the", "pre", "-", "determined", "forms", "one", "of", "[", "quiet", "minimal", "standard", "verbose", "]" ]
python
valid
theislab/anndata
anndata/readwrite/read.py
https://github.com/theislab/anndata/blob/34f4eb63710628fbc15e7050e5efcac1d7806062/anndata/readwrite/read.py#L202-L217
def read_mtx(filename: PathLike, dtype: str='float32') -> AnnData: """Read ``.mtx`` file. Parameters ---------- filename The filename. dtype Numpy data type. """ from scipy.io import mmread # could be rewritten accounting for dtype to be more performant X = mmread(fs...
[ "def", "read_mtx", "(", "filename", ":", "PathLike", ",", "dtype", ":", "str", "=", "'float32'", ")", "->", "AnnData", ":", "from", "scipy", ".", "io", "import", "mmread", "# could be rewritten accounting for dtype to be more performant", "X", "=", "mmread", "(", ...
Read ``.mtx`` file. Parameters ---------- filename The filename. dtype Numpy data type.
[ "Read", ".", "mtx", "file", "." ]
python
train
google/grr
grr/server/grr_response_server/databases/db_compat.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/db_compat.py#L70-L96
def ProcessHuntFlowError(flow_obj, error_message=None, backtrace=None, status_msg=None): """Processes error and status message for a given hunt-induced flow.""" if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id): hunt.StopHuntIfCPUOrNetw...
[ "def", "ProcessHuntFlowError", "(", "flow_obj", ",", "error_message", "=", "None", ",", "backtrace", "=", "None", ",", "status_msg", "=", "None", ")", ":", "if", "not", "hunt", ".", "IsLegacyHunt", "(", "flow_obj", ".", "parent_hunt_id", ")", ":", "hunt", ...
Processes error and status message for a given hunt-induced flow.
[ "Processes", "error", "and", "status", "message", "for", "a", "given", "hunt", "-", "induced", "flow", "." ]
python
train
ska-sa/purr
Purr/LogEntry.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/LogEntry.py#L386-L388
def generateIndex(self, refresh=0, refresh_index=0): """Writes the index file""" open(self.index_file, "wt").write(self.renderIndex(refresh=refresh, refresh_index=refresh_index))
[ "def", "generateIndex", "(", "self", ",", "refresh", "=", "0", ",", "refresh_index", "=", "0", ")", ":", "open", "(", "self", ".", "index_file", ",", "\"wt\"", ")", ".", "write", "(", "self", ".", "renderIndex", "(", "refresh", "=", "refresh", ",", "...
Writes the index file
[ "Writes", "the", "index", "file" ]
python
train
devopshq/crosspm
crosspm/helpers/output.py
https://github.com/devopshq/crosspm/blob/c831442ecfaa1d43c66cb148857096cea292c950/crosspm/helpers/output.py#L55-L68
def register_output_format(name): """ Load output format function to dictionary (decorator with this function name) """ def check_decorator(fn): _output_format_map[name] = fn def wrapper(*args, **kwargs): return fn(*args, **kwargs) return wrapper return check_...
[ "def", "register_output_format", "(", "name", ")", ":", "def", "check_decorator", "(", "fn", ")", ":", "_output_format_map", "[", "name", "]", "=", "fn", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "fn", "(", "*", ...
Load output format function to dictionary (decorator with this function name)
[ "Load", "output", "format", "function", "to", "dictionary", "(", "decorator", "with", "this", "function", "name", ")" ]
python
train
junaruga/rpm-py-installer
install.py
https://github.com/junaruga/rpm-py-installer/blob/12f45feb0ba533dec8d0d16ef1e9b7fb8cfbd4ed/install.py#L1282-L1284
def create_installer(self, rpm_py_version, **kwargs): """Create Installer object.""" return DebianInstaller(rpm_py_version, self.python, self.rpm, **kwargs)
[ "def", "create_installer", "(", "self", ",", "rpm_py_version", ",", "*", "*", "kwargs", ")", ":", "return", "DebianInstaller", "(", "rpm_py_version", ",", "self", ".", "python", ",", "self", ".", "rpm", ",", "*", "*", "kwargs", ")" ]
Create Installer object.
[ "Create", "Installer", "object", "." ]
python
train
redhat-cip/python-dciclient
dciclient/v1/shell_commands/job.py
https://github.com/redhat-cip/python-dciclient/blob/a4aa5899062802bbe4c30a075d8447f8d222d214/dciclient/v1/shell_commands/job.py#L314-L335
def file_upload(context, id, name, path, jobstate_id, test_id, mime): """file_upload(context, id, path) Upload a file in a job >>> dcictl job-upload-file [OPTIONS] :param string id: ID of the job to attach file to [required] :param string name: Name of the file [required] :param string path: ...
[ "def", "file_upload", "(", "context", ",", "id", ",", "name", ",", "path", ",", "jobstate_id", ",", "test_id", ",", "mime", ")", ":", "result", "=", "dci_file", ".", "create_with_stream", "(", "context", ",", "name", "=", "name", ",", "job_id", "=", "i...
file_upload(context, id, path) Upload a file in a job >>> dcictl job-upload-file [OPTIONS] :param string id: ID of the job to attach file to [required] :param string name: Name of the file [required] :param string path: Path to the file to upload [required] :param string jobstate_id: ID of th...
[ "file_upload", "(", "context", "id", "path", ")" ]
python
train
sentinel-hub/sentinelhub-py
sentinelhub/ogc.py
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/ogc.py#L524-L558
def _fetch_features(self): """Collects data from WFS service :return: dictionary containing info about product tiles :rtype: dict """ if self.feature_offset is None: return main_url = '{}{}/{}?'.format(self.base_url, ServiceType.WFS.value, self.instance_id) ...
[ "def", "_fetch_features", "(", "self", ")", ":", "if", "self", ".", "feature_offset", "is", "None", ":", "return", "main_url", "=", "'{}{}/{}?'", ".", "format", "(", "self", ".", "base_url", ",", "ServiceType", ".", "WFS", ".", "value", ",", "self", ".",...
Collects data from WFS service :return: dictionary containing info about product tiles :rtype: dict
[ "Collects", "data", "from", "WFS", "service" ]
python
train
nabetama/slacky
slacky/rest/rest.py
https://github.com/nabetama/slacky/blob/dde62ce49af9b8f581729c36d2ac790310b570e4/slacky/rest/rest.py#L552-L560
def set_purpose(self, group_name, purpose): """ https://api.slack.com/methods/groups.setPurpose """ group_id = self.get_group_id(group_name) self.params.update({ 'channel': group_id, 'purpose': purpose, }) return FromUrl('https://slack.com/api/...
[ "def", "set_purpose", "(", "self", ",", "group_name", ",", "purpose", ")", ":", "group_id", "=", "self", ".", "get_group_id", "(", "group_name", ")", "self", ".", "params", ".", "update", "(", "{", "'channel'", ":", "group_id", ",", "'purpose'", ":", "pu...
https://api.slack.com/methods/groups.setPurpose
[ "https", ":", "//", "api", ".", "slack", ".", "com", "/", "methods", "/", "groups", ".", "setPurpose" ]
python
train
MisterY/price-database
pricedb/app.py
https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/app.py#L174-L185
def get_prices_on(self, on_date: str, namespace: str, symbol: str): """ Returns the latest price on the date """ repo = self.get_price_repository() query = ( repo.query.filter(dal.Price.namespace == namespace) .filter(dal.Price.symbol == symbol) .filter(dal.Pr...
[ "def", "get_prices_on", "(", "self", ",", "on_date", ":", "str", ",", "namespace", ":", "str", ",", "symbol", ":", "str", ")", ":", "repo", "=", "self", ".", "get_price_repository", "(", ")", "query", "=", "(", "repo", ".", "query", ".", "filter", "(...
Returns the latest price on the date
[ "Returns", "the", "latest", "price", "on", "the", "date" ]
python
test
apache/incubator-mxnet
python/mxnet/recordio.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/recordio.py#L268-L276
def seek(self, idx): """Sets the current read pointer position. This function is internally called by `read_idx(idx)` to find the current reader pointer position. It doesn't return anything.""" assert not self.writable self._check_pid(allow_reset=True) pos = ctypes.c_siz...
[ "def", "seek", "(", "self", ",", "idx", ")", ":", "assert", "not", "self", ".", "writable", "self", ".", "_check_pid", "(", "allow_reset", "=", "True", ")", "pos", "=", "ctypes", ".", "c_size_t", "(", "self", ".", "idx", "[", "idx", "]", ")", "chec...
Sets the current read pointer position. This function is internally called by `read_idx(idx)` to find the current reader pointer position. It doesn't return anything.
[ "Sets", "the", "current", "read", "pointer", "position", "." ]
python
train
JarryShaw/PyPCAPKit
src/const/ipv6/qs_function.py
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/const/ipv6/qs_function.py#L16-L22
def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return QS_Function(key) if key not in QS_Function._member_map_: extend_enum(QS_Function, key, default) return QS_Function[key]
[ "def", "get", "(", "key", ",", "default", "=", "-", "1", ")", ":", "if", "isinstance", "(", "key", ",", "int", ")", ":", "return", "QS_Function", "(", "key", ")", "if", "key", "not", "in", "QS_Function", ".", "_member_map_", ":", "extend_enum", "(", ...
Backport support for original codes.
[ "Backport", "support", "for", "original", "codes", "." ]
python
train
agoragames/haigha
haigha/connections/rabbit_connection.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/connections/rabbit_connection.py#L227-L238
def _recv_nack(self, method_frame): '''Receive a nack from the broker.''' if self._nack_listener: delivery_tag = method_frame.args.read_longlong() multiple, requeue = method_frame.args.read_bits(2) if multiple: while self._last_ack_id < delivery_tag: ...
[ "def", "_recv_nack", "(", "self", ",", "method_frame", ")", ":", "if", "self", ".", "_nack_listener", ":", "delivery_tag", "=", "method_frame", ".", "args", ".", "read_longlong", "(", ")", "multiple", ",", "requeue", "=", "method_frame", ".", "args", ".", ...
Receive a nack from the broker.
[ "Receive", "a", "nack", "from", "the", "broker", "." ]
python
train
synw/dataswim
dataswim/maps/__init__.py
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/maps/__init__.py#L94-L101
def map(self, lat, long, zoom=13, tiles="map"): """ Sets a map """ try: self.dsmap = self._map(lat, long, zoom, tiles) except Exception as e: self.err(e, self.map, "Can not get map")
[ "def", "map", "(", "self", ",", "lat", ",", "long", ",", "zoom", "=", "13", ",", "tiles", "=", "\"map\"", ")", ":", "try", ":", "self", ".", "dsmap", "=", "self", ".", "_map", "(", "lat", ",", "long", ",", "zoom", ",", "tiles", ")", "except", ...
Sets a map
[ "Sets", "a", "map" ]
python
train
Zsailer/pandas_flavor
pandas_flavor/register.py
https://github.com/Zsailer/pandas_flavor/blob/1953aeee09424300d69a11dd2ffd3460a806fb65/pandas_flavor/register.py#L38-L57
def register_series_method(method): """Register a function as a method attached to the Pandas Series. """ def inner(*args, **kwargs): class AccessorMethod(object): __doc__ = method.__doc__ def __init__(self, pandas_obj): self._obj = pandas_obj @...
[ "def", "register_series_method", "(", "method", ")", ":", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "class", "AccessorMethod", "(", "object", ")", ":", "__doc__", "=", "method", ".", "__doc__", "def", "__init__", "(", "self", ...
Register a function as a method attached to the Pandas Series.
[ "Register", "a", "function", "as", "a", "method", "attached", "to", "the", "Pandas", "Series", "." ]
python
train
pycontribs/pyrax
pyrax/autoscale.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/autoscale.py#L669-L683
def replace_webhook(self, scaling_group, policy, webhook, name, metadata=None): """ Replace an existing webhook. All of the attributes must be specified. If you wish to delete any of the optional attributes, pass them in as None. """ uri = "/%s/%s/policies/%s/...
[ "def", "replace_webhook", "(", "self", ",", "scaling_group", ",", "policy", ",", "webhook", ",", "name", ",", "metadata", "=", "None", ")", ":", "uri", "=", "\"/%s/%s/policies/%s/webhooks/%s\"", "%", "(", "self", ".", "uri_base", ",", "utils", ".", "get_id",...
Replace an existing webhook. All of the attributes must be specified. If you wish to delete any of the optional attributes, pass them in as None.
[ "Replace", "an", "existing", "webhook", ".", "All", "of", "the", "attributes", "must", "be", "specified", ".", "If", "you", "wish", "to", "delete", "any", "of", "the", "optional", "attributes", "pass", "them", "in", "as", "None", "." ]
python
train
pydata/xarray
xarray/tutorial.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/tutorial.py#L26-L89
def open_dataset(name, cache=True, cache_dir=_default_cache_dir, github_url='https://github.com/pydata/xarray-data', branch='master', **kws): """ Load a dataset from the online repository (requires internet). If a local copy is found then always use that to avoid network t...
[ "def", "open_dataset", "(", "name", ",", "cache", "=", "True", ",", "cache_dir", "=", "_default_cache_dir", ",", "github_url", "=", "'https://github.com/pydata/xarray-data'", ",", "branch", "=", "'master'", ",", "*", "*", "kws", ")", ":", "longdir", "=", "_os"...
Load a dataset from the online repository (requires internet). If a local copy is found then always use that to avoid network traffic. Parameters ---------- name : str Name of the netcdf file containing the dataset ie. 'air_temperature' cache_dir : string, optional The dire...
[ "Load", "a", "dataset", "from", "the", "online", "repository", "(", "requires", "internet", ")", "." ]
python
train
titusjan/argos
argos/repo/repotreeview.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/repotreeview.py#L265-L305
def reloadFileOfCurrentItem(self, rtiRegItem=None): """ Finds the repo tree item that holds the file of the current item and reloads it. Reloading is done by removing the repo tree item and inserting a new one. The new item will have by of type rtiRegItem.cls. If rtiRegItem is None (the...
[ "def", "reloadFileOfCurrentItem", "(", "self", ",", "rtiRegItem", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"reloadFileOfCurrentItem, rtiClass={}\"", ".", "format", "(", "rtiRegItem", ")", ")", "currentIndex", "=", "self", ".", "getRowCurrentIndex", "(...
Finds the repo tree item that holds the file of the current item and reloads it. Reloading is done by removing the repo tree item and inserting a new one. The new item will have by of type rtiRegItem.cls. If rtiRegItem is None (the default), the new rtiClass will be the same as the ...
[ "Finds", "the", "repo", "tree", "item", "that", "holds", "the", "file", "of", "the", "current", "item", "and", "reloads", "it", ".", "Reloading", "is", "done", "by", "removing", "the", "repo", "tree", "item", "and", "inserting", "a", "new", "one", "." ]
python
train
jaysonsantos/python-binary-memcached
bmemcached/client/distributed.py
https://github.com/jaysonsantos/python-binary-memcached/blob/6a792829349c69204d9c5045e5c34b4231216dd6/bmemcached/client/distributed.py#L61-L86
def set_multi(self, mappings, time=0, compress_level=-1): """ Set multiple keys with it's values on server. :param mappings: A dict with keys/values :type mappings: dict :param time: Time in seconds that your key will expire. :type time: int :param compress_level...
[ "def", "set_multi", "(", "self", ",", "mappings", ",", "time", "=", "0", ",", "compress_level", "=", "-", "1", ")", ":", "returns", "=", "[", "]", "if", "not", "mappings", ":", "return", "False", "server_mappings", "=", "defaultdict", "(", "dict", ")",...
Set multiple keys with it's values on server. :param mappings: A dict with keys/values :type mappings: dict :param time: Time in seconds that your key will expire. :type time: int :param compress_level: How much to compress. 0 = no compression, 1 = fastest, 9 = slowe...
[ "Set", "multiple", "keys", "with", "it", "s", "values", "on", "server", "." ]
python
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L107-L117
def _same_elements_per_channel(x): """ Test if a 3D (H,W,C) matrix x has the same element in each (H,W) matrix for each channel """ eps = 1e-5 dims = x.shape for c in range(dims[-1]): xc = x[:,:,c].flatten() if not np.all(np.absolute(xc - xc[0]) < eps): return False ...
[ "def", "_same_elements_per_channel", "(", "x", ")", ":", "eps", "=", "1e-5", "dims", "=", "x", ".", "shape", "for", "c", "in", "range", "(", "dims", "[", "-", "1", "]", ")", ":", "xc", "=", "x", "[", ":", ",", ":", ",", "c", "]", ".", "flatte...
Test if a 3D (H,W,C) matrix x has the same element in each (H,W) matrix for each channel
[ "Test", "if", "a", "3D", "(", "H", "W", "C", ")", "matrix", "x", "has", "the", "same", "element", "in", "each", "(", "H", "W", ")", "matrix", "for", "each", "channel" ]
python
train
sirfz/tesserocr
setup.py
https://github.com/sirfz/tesserocr/blob/052fb5d7d4e1398c8a07958b389b37e1090fb897/setup.py#L80-L115
def package_config(): """Use pkg-config to get library build parameters and tesseract version.""" p = subprocess.Popen(['pkg-config', '--exists', '--atleast-version={}'.format(_TESSERACT_MIN_VERSION), '--print-errors', 'tesseract'], stderr=subprocess.PIPE) ...
[ "def", "package_config", "(", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "[", "'pkg-config'", ",", "'--exists'", ",", "'--atleast-version={}'", ".", "format", "(", "_TESSERACT_MIN_VERSION", ")", ",", "'--print-errors'", ",", "'tesseract'", "]", ",", ...
Use pkg-config to get library build parameters and tesseract version.
[ "Use", "pkg", "-", "config", "to", "get", "library", "build", "parameters", "and", "tesseract", "version", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_adsb.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_adsb.py#L154-L158
def get_v_distance(self, latlonalt1, latlonalt2): '''get the horizontal distance between threat and vehicle''' (lat1, lon1, alt1) = latlonalt1 (lat2, lon2, alt2) = latlonalt2 return alt2 - alt1
[ "def", "get_v_distance", "(", "self", ",", "latlonalt1", ",", "latlonalt2", ")", ":", "(", "lat1", ",", "lon1", ",", "alt1", ")", "=", "latlonalt1", "(", "lat2", ",", "lon2", ",", "alt2", ")", "=", "latlonalt2", "return", "alt2", "-", "alt1" ]
get the horizontal distance between threat and vehicle
[ "get", "the", "horizontal", "distance", "between", "threat", "and", "vehicle" ]
python
train
vinci1it2000/schedula
schedula/utils/dsp.py
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/dsp.py#L34-L71
def combine_dicts(*dicts, copy=False, base=None): """ Combines multiple dicts in one. :param dicts: A sequence of dicts. :type dicts: dict :param copy: If True, it returns a deepcopy of input values. :type copy: bool, optional :param base: Base dict where combine m...
[ "def", "combine_dicts", "(", "*", "dicts", ",", "copy", "=", "False", ",", "base", "=", "None", ")", ":", "if", "len", "(", "dicts", ")", "==", "1", "and", "base", "is", "None", ":", "# Only one input dict.", "cd", "=", "dicts", "[", "0", "]", ".",...
Combines multiple dicts in one. :param dicts: A sequence of dicts. :type dicts: dict :param copy: If True, it returns a deepcopy of input values. :type copy: bool, optional :param base: Base dict where combine multiple dicts in one. :type base: dict, optional :ret...
[ "Combines", "multiple", "dicts", "in", "one", "." ]
python
train
clalancette/pycdlib
pycdlib/rockridge.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/rockridge.py#L1558-L1592
def parse(self, rrstr): # type: (bytes) -> None ''' Parse a Rock Ridge Time Stamp record out of a string. Parameters: rrstr - The string to parse the record out of. Returns: Nothing. ''' if self._initialized: raise pycdlibexception.P...
[ "def", "parse", "(", "self", ",", "rrstr", ")", ":", "# type: (bytes) -> None", "if", "self", ".", "_initialized", ":", "raise", "pycdlibexception", ".", "PyCdlibInternalError", "(", "'TF record already initialized!'", ")", "# We assume that the caller has already checked t...
Parse a Rock Ridge Time Stamp record out of a string. Parameters: rrstr - The string to parse the record out of. Returns: Nothing.
[ "Parse", "a", "Rock", "Ridge", "Time", "Stamp", "record", "out", "of", "a", "string", "." ]
python
train
facelessuser/pyspelling
pyspelling/filters/context.py
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/context.py#L48-L76
def setup(self): """Setup.""" self.context_visible_first = self.config['context_visible_first'] self.delimiters = [] self.escapes = None self.line_endings = self.config['normalize_line_endings'] escapes = [] for delimiter in self.config['delimiters']: ...
[ "def", "setup", "(", "self", ")", ":", "self", ".", "context_visible_first", "=", "self", ".", "config", "[", "'context_visible_first'", "]", "self", ".", "delimiters", "=", "[", "]", "self", ".", "escapes", "=", "None", "self", ".", "line_endings", "=", ...
Setup.
[ "Setup", "." ]
python
train