Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
1,400
orbingol/NURBS-Python
geomdl/linalg.py
vector_dot
def vector_dot(vector1, vector2): """ Computes the dot-product of the input vectors. :param vector1: input vector 1 :type vector1: list, tuple :param vector2: input vector 2 :type vector2: list, tuple :return: result of the dot product :rtype: float """ try: if vector1 is No...
python
def vector_dot(vector1, vector2): """ Computes the dot-product of the input vectors. :param vector1: input vector 1 :type vector1: list, tuple :param vector2: input vector 2 :type vector2: list, tuple :return: result of the dot product :rtype: float """ try: if vector1 is No...
['def', 'vector_dot', '(', 'vector1', ',', 'vector2', ')', ':', 'try', ':', 'if', 'vector1', 'is', 'None', 'or', 'len', '(', 'vector1', ')', '==', '0', 'or', 'vector2', 'is', 'None', 'or', 'len', '(', 'vector2', ')', '==', '0', ':', 'raise', 'ValueError', '(', '"Input vectors cannot be empty"', ')', 'except', 'TypeErro...
Computes the dot-product of the input vectors. :param vector1: input vector 1 :type vector1: list, tuple :param vector2: input vector 2 :type vector2: list, tuple :return: result of the dot product :rtype: float
['Computes', 'the', 'dot', '-', 'product', 'of', 'the', 'input', 'vectors', '.']
train
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/linalg.py#L62-L87
1,401
TissueMAPS/TmDeploy
elasticluster/elasticluster/cluster.py
Node.connect
def connect(self, keyfile=None): """Connect to the node via ssh using the paramiko library. :return: :py:class:`paramiko.SSHClient` - ssh connection or None on failure """ ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ...
python
def connect(self, keyfile=None): """Connect to the node via ssh using the paramiko library. :return: :py:class:`paramiko.SSHClient` - ssh connection or None on failure """ ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ...
['def', 'connect', '(', 'self', ',', 'keyfile', '=', 'None', ')', ':', 'ssh', '=', 'paramiko', '.', 'SSHClient', '(', ')', 'ssh', '.', 'set_missing_host_key_policy', '(', 'paramiko', '.', 'AutoAddPolicy', '(', ')', ')', 'if', 'keyfile', 'and', 'os', '.', 'path', '.', 'exists', '(', 'keyfile', ')', ':', 'ssh', '.', 'loa...
Connect to the node via ssh using the paramiko library. :return: :py:class:`paramiko.SSHClient` - ssh connection or None on failure
['Connect', 'to', 'the', 'node', 'via', 'ssh', 'using', 'the', 'paramiko', 'library', '.']
train
https://github.com/TissueMAPS/TmDeploy/blob/f891b4ffb21431988bc4a063ae871da3bf284a45/elasticluster/elasticluster/cluster.py#L1141-L1194
1,402
assamite/creamas
creamas/core/simulation.py
Simulation.end
def end(self, folder=None): """End the simulation and destroy the current simulation environment. """ ret = self.env.destroy(folder=folder) self._end_time = time.time() self._log(logging.DEBUG, "Simulation run with {} steps took {:.3f}s to" " complete, while act...
python
def end(self, folder=None): """End the simulation and destroy the current simulation environment. """ ret = self.env.destroy(folder=folder) self._end_time = time.time() self._log(logging.DEBUG, "Simulation run with {} steps took {:.3f}s to" " complete, while act...
['def', 'end', '(', 'self', ',', 'folder', '=', 'None', ')', ':', 'ret', '=', 'self', '.', 'env', '.', 'destroy', '(', 'folder', '=', 'folder', ')', 'self', '.', '_end_time', '=', 'time', '.', 'time', '(', ')', 'self', '.', '_log', '(', 'logging', '.', 'DEBUG', ',', '"Simulation run with {} steps took {:.3f}s to"', '" ...
End the simulation and destroy the current simulation environment.
['End', 'the', 'simulation', 'and', 'destroy', 'the', 'current', 'simulation', 'environment', '.']
train
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/core/simulation.py#L282-L291
1,403
sprockets/sprockets-influxdb
sprockets_influxdb.py
Measurement.marshall
def marshall(self): """Return the measurement in the line protocol format. :rtype: str """ return '{},{} {} {}'.format( self._escape(self.name), ','.join(['{}={}'.format(self._escape(k), self._escape(v)) for k, v in self.tags.items()]), ...
python
def marshall(self): """Return the measurement in the line protocol format. :rtype: str """ return '{},{} {} {}'.format( self._escape(self.name), ','.join(['{}={}'.format(self._escape(k), self._escape(v)) for k, v in self.tags.items()]), ...
['def', 'marshall', '(', 'self', ')', ':', 'return', "'{},{} {} {}'", '.', 'format', '(', 'self', '.', '_escape', '(', 'self', '.', 'name', ')', ',', "','", '.', 'join', '(', '[', "'{}={}'", '.', 'format', '(', 'self', '.', '_escape', '(', 'k', ')', ',', 'self', '.', '_escape', '(', 'v', ')', ')', 'for', 'k', ',', 'v',...
Return the measurement in the line protocol format. :rtype: str
['Return', 'the', 'measurement', 'in', 'the', 'line', 'protocol', 'format', '.']
train
https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L858-L869
1,404
lpantano/seqcluster
seqcluster/seqbuster/__init__.py
_download_mirbase
def _download_mirbase(args, version="CURRENT"): """ Download files from mirbase """ if not args.hairpin or not args.mirna: logger.info("Working with version %s" % version) hairpin_fn = op.join(op.abspath(args.out), "hairpin.fa.gz") mirna_fn = op.join(op.abspath(args.out), "miRNA....
python
def _download_mirbase(args, version="CURRENT"): """ Download files from mirbase """ if not args.hairpin or not args.mirna: logger.info("Working with version %s" % version) hairpin_fn = op.join(op.abspath(args.out), "hairpin.fa.gz") mirna_fn = op.join(op.abspath(args.out), "miRNA....
['def', '_download_mirbase', '(', 'args', ',', 'version', '=', '"CURRENT"', ')', ':', 'if', 'not', 'args', '.', 'hairpin', 'or', 'not', 'args', '.', 'mirna', ':', 'logger', '.', 'info', '(', '"Working with version %s"', '%', 'version', ')', 'hairpin_fn', '=', 'op', '.', 'join', '(', 'op', '.', 'abspath', '(', 'args', '...
Download files from mirbase
['Download', 'files', 'from', 'mirbase']
train
https://github.com/lpantano/seqcluster/blob/774e23add8cd4fdc83d626cea3bd1f458e7d060d/seqcluster/seqbuster/__init__.py#L23-L38
1,405
skioo/django-customer-billing
billing/models.py
total_amount
def total_amount(qs) -> Total: """Sums the amounts of the objects in the queryset, keeping each currency separate. :param qs: A querystring containing objects that have an amount field of type Money. :return: A Total object. """ aggregate = qs.values('amount_currency').annotate(sum=Sum('amount')) ...
python
def total_amount(qs) -> Total: """Sums the amounts of the objects in the queryset, keeping each currency separate. :param qs: A querystring containing objects that have an amount field of type Money. :return: A Total object. """ aggregate = qs.values('amount_currency').annotate(sum=Sum('amount')) ...
['def', 'total_amount', '(', 'qs', ')', '->', 'Total', ':', 'aggregate', '=', 'qs', '.', 'values', '(', "'amount_currency'", ')', '.', 'annotate', '(', 'sum', '=', 'Sum', '(', "'amount'", ')', ')', 'return', 'Total', '(', 'Money', '(', 'amount', '=', 'r', '[', "'sum'", ']', ',', 'currency', '=', 'r', '[', "'amount_curr...
Sums the amounts of the objects in the queryset, keeping each currency separate. :param qs: A querystring containing objects that have an amount field of type Money. :return: A Total object.
['Sums', 'the', 'amounts', 'of', 'the', 'objects', 'in', 'the', 'queryset', 'keeping', 'each', 'currency', 'separate', '.', ':', 'param', 'qs', ':', 'A', 'querystring', 'containing', 'objects', 'that', 'have', 'an', 'amount', 'field', 'of', 'type', 'Money', '.', ':', 'return', ':', 'A', 'Total', 'object', '.']
train
https://github.com/skioo/django-customer-billing/blob/6ac1ed9ef9d1d7eee0379de7f0c4b76919ae1f2d/billing/models.py#L22-L28
1,406
biocommons/bioutils
src/bioutils/sequences.py
aa3_to_aa1
def aa3_to_aa1(seq): """convert string of 3-letter amino acids to 1-letter amino acids >>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu") 'CATSARELAME' >>> aa3_to_aa1(None) """ if seq is None: return None return "".join(aa3_to_aa1_lut[aa3] for aa3 in [seq[i:i +...
python
def aa3_to_aa1(seq): """convert string of 3-letter amino acids to 1-letter amino acids >>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu") 'CATSARELAME' >>> aa3_to_aa1(None) """ if seq is None: return None return "".join(aa3_to_aa1_lut[aa3] for aa3 in [seq[i:i +...
['def', 'aa3_to_aa1', '(', 'seq', ')', ':', 'if', 'seq', 'is', 'None', ':', 'return', 'None', 'return', '""', '.', 'join', '(', 'aa3_to_aa1_lut', '[', 'aa3', ']', 'for', 'aa3', 'in', '[', 'seq', '[', 'i', ':', 'i', '+', '3', ']', 'for', 'i', 'in', 'range', '(', '0', ',', 'len', '(', 'seq', ')', ',', '3', ')', ']', ')']
convert string of 3-letter amino acids to 1-letter amino acids >>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu") 'CATSARELAME' >>> aa3_to_aa1(None)
['convert', 'string', 'of', '3', '-', 'letter', 'amino', 'acids', 'to', '1', '-', 'letter', 'amino', 'acids']
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L158-L170
1,407
exekias/droplet
droplet/web/wizards.py
next
def next(transport, wizard, step, data): """ Validate step and go to the next one (or finish the wizard) :param transport: Transport object :param wizard: Wizard block name :param step: Current step number :param data: form data for the step """ step = int(step) wizard = blocks.get(...
python
def next(transport, wizard, step, data): """ Validate step and go to the next one (or finish the wizard) :param transport: Transport object :param wizard: Wizard block name :param step: Current step number :param data: form data for the step """ step = int(step) wizard = blocks.get(...
['def', 'next', '(', 'transport', ',', 'wizard', ',', 'step', ',', 'data', ')', ':', 'step', '=', 'int', '(', 'step', ')', 'wizard', '=', 'blocks', '.', 'get', '(', 'wizard', ')', '# Retrieve form block', 'form', '=', 'wizard', '.', 'next', '(', 'step', ')', 'valid', '=', 'forms', '.', 'send', '(', 'transport', ',', 'f...
Validate step and go to the next one (or finish the wizard) :param transport: Transport object :param wizard: Wizard block name :param step: Current step number :param data: form data for the step
['Validate', 'step', 'and', 'go', 'to', 'the', 'next', 'one', '(', 'or', 'finish', 'the', 'wizard', ')']
train
https://github.com/exekias/droplet/blob/aeac573a2c1c4b774e99d5414a1c79b1bb734941/droplet/web/wizards.py#L86-L111
1,408
calmjs/calmjs
src/calmjs/dist.py
validate_line_list
def validate_line_list(dist, attr, value): """ Validate that the value is compatible """ # does not work as reliably in Python 2. if isinstance(value, str): value = value.split() value = list(value) try: check = (' '.join(value)).split() if check == value: ...
python
def validate_line_list(dist, attr, value): """ Validate that the value is compatible """ # does not work as reliably in Python 2. if isinstance(value, str): value = value.split() value = list(value) try: check = (' '.join(value)).split() if check == value: ...
['def', 'validate_line_list', '(', 'dist', ',', 'attr', ',', 'value', ')', ':', '# does not work as reliably in Python 2.', 'if', 'isinstance', '(', 'value', ',', 'str', ')', ':', 'value', '=', 'value', '.', 'split', '(', ')', 'value', '=', 'list', '(', 'value', ')', 'try', ':', 'check', '=', '(', "' '", '.', 'join', '...
Validate that the value is compatible
['Validate', 'that', 'the', 'value', 'is', 'compatible']
train
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L79-L95
1,409
apache/incubator-superset
superset/db_engine_specs.py
BaseEngineSpec.modify_url_for_impersonation
def modify_url_for_impersonation(cls, url, impersonate_user, username): """ Modify the SQL Alchemy URL object with the user to impersonate if applicable. :param url: SQLAlchemy URL object :param impersonate_user: Bool indicating if impersonation is enabled :param username: Effect...
python
def modify_url_for_impersonation(cls, url, impersonate_user, username): """ Modify the SQL Alchemy URL object with the user to impersonate if applicable. :param url: SQLAlchemy URL object :param impersonate_user: Bool indicating if impersonation is enabled :param username: Effect...
['def', 'modify_url_for_impersonation', '(', 'cls', ',', 'url', ',', 'impersonate_user', ',', 'username', ')', ':', 'if', 'impersonate_user', 'is', 'not', 'None', 'and', 'username', 'is', 'not', 'None', ':', 'url', '.', 'username', '=', 'username']
Modify the SQL Alchemy URL object with the user to impersonate if applicable. :param url: SQLAlchemy URL object :param impersonate_user: Bool indicating if impersonation is enabled :param username: Effective username
['Modify', 'the', 'SQL', 'Alchemy', 'URL', 'object', 'with', 'the', 'user', 'to', 'impersonate', 'if', 'applicable', '.', ':', 'param', 'url', ':', 'SQLAlchemy', 'URL', 'object', ':', 'param', 'impersonate_user', ':', 'Bool', 'indicating', 'if', 'impersonation', 'is', 'enabled', ':', 'param', 'username', ':', 'Effectiv...
train
https://github.com/apache/incubator-superset/blob/ca2996c78f679260eb79c6008e276733df5fb653/superset/db_engine_specs.py#L395-L403
1,410
google/grr
grr/server/grr_response_server/check_lib/checks.py
Matcher.Detect
def Detect(self, baseline, host_data): """Run host_data through detectors and return them if a detector triggers. Args: baseline: The base set of rdf values used to evaluate whether an issue exists. host_data: The rdf values passed back by the filters. Returns: A CheckResult mess...
python
def Detect(self, baseline, host_data): """Run host_data through detectors and return them if a detector triggers. Args: baseline: The base set of rdf values used to evaluate whether an issue exists. host_data: The rdf values passed back by the filters. Returns: A CheckResult mess...
['def', 'Detect', '(', 'self', ',', 'baseline', ',', 'host_data', ')', ':', 'result', '=', 'CheckResult', '(', ')', 'for', 'detector', 'in', 'self', '.', 'detectors', ':', 'finding', '=', 'detector', '(', 'baseline', ',', 'host_data', ')', 'if', 'finding', ':', 'result', '.', 'ExtendAnomalies', '(', '[', 'finding', ']'...
Run host_data through detectors and return them if a detector triggers. Args: baseline: The base set of rdf values used to evaluate whether an issue exists. host_data: The rdf values passed back by the filters. Returns: A CheckResult message containing anomalies if any detectors iden...
['Run', 'host_data', 'through', 'detectors', 'and', 'return', 'them', 'if', 'a', 'detector', 'triggers', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/check_lib/checks.py#L455-L473
1,411
senaite/senaite.core
bika/lims/browser/analysisrequest/add2.py
AnalysisRequestAddView.get_batch
def get_batch(self): """Returns the Batch """ context = self.context parent = api.get_parent(context) if context.portal_type == "Batch": return context elif parent.portal_type == "Batch": return parent return None
python
def get_batch(self): """Returns the Batch """ context = self.context parent = api.get_parent(context) if context.portal_type == "Batch": return context elif parent.portal_type == "Batch": return parent return None
['def', 'get_batch', '(', 'self', ')', ':', 'context', '=', 'self', '.', 'context', 'parent', '=', 'api', '.', 'get_parent', '(', 'context', ')', 'if', 'context', '.', 'portal_type', '==', '"Batch"', ':', 'return', 'context', 'elif', 'parent', '.', 'portal_type', '==', '"Batch"', ':', 'return', 'parent', 'return', 'Non...
Returns the Batch
['Returns', 'the', 'Batch']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analysisrequest/add2.py#L348-L357
1,412
limodou/uliweb
uliweb/lib/werkzeug/contrib/jsrouting.py
generate_map
def generate_map(map, name='url_map'): """ Generates a JavaScript function containing the rules defined in this map, to be used with a MapAdapter's generate_javascript method. If you don't pass a name the returned JavaScript code is an expression that returns a function. Otherwise it's a standalon...
python
def generate_map(map, name='url_map'): """ Generates a JavaScript function containing the rules defined in this map, to be used with a MapAdapter's generate_javascript method. If you don't pass a name the returned JavaScript code is an expression that returns a function. Otherwise it's a standalon...
['def', 'generate_map', '(', 'map', ',', 'name', '=', "'url_map'", ')', ':', 'from', 'warnings', 'import', 'warn', 'warn', '(', 'DeprecationWarning', '(', "'This module is deprecated'", ')', ')', 'map', '.', 'update', '(', ')', 'rules', '=', '[', ']', 'converters', '=', '[', ']', 'for', 'rule', 'in', 'map', '.', 'iter_...
Generates a JavaScript function containing the rules defined in this map, to be used with a MapAdapter's generate_javascript method. If you don't pass a name the returned JavaScript code is an expression that returns a function. Otherwise it's a standalone script that assigns the function with that na...
['Generates', 'a', 'JavaScript', 'function', 'containing', 'the', 'rules', 'defined', 'in', 'this', 'map', 'to', 'be', 'used', 'with', 'a', 'MapAdapter', 's', 'generate_javascript', 'method', '.', 'If', 'you', 'don', 't', 'pass', 'a', 'name', 'the', 'returned', 'JavaScript', 'code', 'is', 'an', 'expression', 'that', 'r...
train
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/lib/werkzeug/contrib/jsrouting.py#L170-L214
1,413
opendatateam/udata
udata/entrypoints.py
known_dists
def known_dists(): '''Return a list of all Distributions exporting udata.* entrypoints''' return ( dist for dist in pkg_resources.working_set if any(k in ENTRYPOINTS for k in dist.get_entry_map().keys()) )
python
def known_dists(): '''Return a list of all Distributions exporting udata.* entrypoints''' return ( dist for dist in pkg_resources.working_set if any(k in ENTRYPOINTS for k in dist.get_entry_map().keys()) )
['def', 'known_dists', '(', ')', ':', 'return', '(', 'dist', 'for', 'dist', 'in', 'pkg_resources', '.', 'working_set', 'if', 'any', '(', 'k', 'in', 'ENTRYPOINTS', 'for', 'k', 'in', 'dist', '.', 'get_entry_map', '(', ')', '.', 'keys', '(', ')', ')', ')']
Return a list of all Distributions exporting udata.* entrypoints
['Return', 'a', 'list', 'of', 'all', 'Distributions', 'exporting', 'udata', '.', '*', 'entrypoints']
train
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/entrypoints.py#L56-L61
1,414
saltstack/salt
salt/modules/boto3_elasticache.py
modify_cache_parameter_group
def modify_cache_parameter_group(name, region=None, key=None, keyid=None, profile=None, **args): ''' Update a cache parameter group in place. Note that due to a design limitation in AWS, this function is not atomic -- a maximum of 20 params may be modified in one underl...
python
def modify_cache_parameter_group(name, region=None, key=None, keyid=None, profile=None, **args): ''' Update a cache parameter group in place. Note that due to a design limitation in AWS, this function is not atomic -- a maximum of 20 params may be modified in one underl...
['def', 'modify_cache_parameter_group', '(', 'name', ',', 'region', '=', 'None', ',', 'key', '=', 'None', ',', 'keyid', '=', 'None', ',', 'profile', '=', 'None', ',', '*', '*', 'args', ')', ':', 'args', '=', 'dict', '(', '[', '(', 'k', ',', 'v', ')', 'for', 'k', ',', 'v', 'in', 'args', '.', 'items', '(', ')', 'if', 'no...
Update a cache parameter group in place. Note that due to a design limitation in AWS, this function is not atomic -- a maximum of 20 params may be modified in one underlying boto call. This means that if more than 20 params need to be changed, the update is performed in blocks of 20, which in turns means ...
['Update', 'a', 'cache', 'parameter', 'group', 'in', 'place', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_elasticache.py#L977-L1028
1,415
pyroscope/pyrocore
pavement.py
release
def release(): "check release before upload to PyPI" sh("paver bdist_wheel") wheels = path("dist").files("*.whl") if not wheels: error("\n*** ERROR: No release wheel was built!") sys.exit(1) if any(".dev" in i for i in wheels): error("\n*** ERROR: You're still using a 'dev' v...
python
def release(): "check release before upload to PyPI" sh("paver bdist_wheel") wheels = path("dist").files("*.whl") if not wheels: error("\n*** ERROR: No release wheel was built!") sys.exit(1) if any(".dev" in i for i in wheels): error("\n*** ERROR: You're still using a 'dev' v...
['def', 'release', '(', ')', ':', 'sh', '(', '"paver bdist_wheel"', ')', 'wheels', '=', 'path', '(', '"dist"', ')', '.', 'files', '(', '"*.whl"', ')', 'if', 'not', 'wheels', ':', 'error', '(', '"\\n*** ERROR: No release wheel was built!"', ')', 'sys', '.', 'exit', '(', '1', ')', 'if', 'any', '(', '".dev"', 'in', 'i', '...
check release before upload to PyPI
['check', 'release', 'before', 'upload', 'to', 'PyPI']
train
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/pavement.py#L370-L407
1,416
licenses/lice
lice/core.py
extract_vars
def extract_vars(template): """ Extract variables from template. Variables are enclosed in double curly braces. """ keys = set() for match in re.finditer(r"\{\{ (?P<key>\w+) \}\}", template.getvalue()): keys.add(match.groups()[0]) return sorted(list(keys))
python
def extract_vars(template): """ Extract variables from template. Variables are enclosed in double curly braces. """ keys = set() for match in re.finditer(r"\{\{ (?P<key>\w+) \}\}", template.getvalue()): keys.add(match.groups()[0]) return sorted(list(keys))
['def', 'extract_vars', '(', 'template', ')', ':', 'keys', '=', 'set', '(', ')', 'for', 'match', 'in', 're', '.', 'finditer', '(', 'r"\\{\\{ (?P<key>\\w+) \\}\\}"', ',', 'template', '.', 'getvalue', '(', ')', ')', ':', 'keys', '.', 'add', '(', 'match', '.', 'groups', '(', ')', '[', '0', ']', ')', 'return', 'sorted', '(...
Extract variables from template. Variables are enclosed in double curly braces.
['Extract', 'variables', 'from', 'template', '.', 'Variables', 'are', 'enclosed', 'in', 'double', 'curly', 'braces', '.']
train
https://github.com/licenses/lice/blob/71635c2544d5edf9e93af4141467763916a86624/lice/core.py#L149-L156
1,417
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_interface_ext.py
brocade_interface_ext.get_interface_switchport_output_switchport_acceptable_frame_type
def get_interface_switchport_output_switchport_acceptable_frame_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_interface_switchport = ET.Element("get_interface_switchport") config = get_interface_switchport output = ET.SubElement(get_in...
python
def get_interface_switchport_output_switchport_acceptable_frame_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_interface_switchport = ET.Element("get_interface_switchport") config = get_interface_switchport output = ET.SubElement(get_in...
['def', 'get_interface_switchport_output_switchport_acceptable_frame_type', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_interface_switchport', '=', 'ET', '.', 'Element', '(', '"get_interface_switchport"', ')', 'config', '=', 'get_interface_switchport',...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_interface_ext.py#L362-L378
1,418
Erotemic/utool
utool/util_alg.py
upper_diag_self_prodx
def upper_diag_self_prodx(list_): """ upper diagnoal of cartesian product of self and self. Weird name. fixme Args: list_ (list): Returns: list: CommandLine: python -m utool.util_alg --exec-upper_diag_self_prodx Example: >>> # ENABLE_DOCTEST >>> fr...
python
def upper_diag_self_prodx(list_): """ upper diagnoal of cartesian product of self and self. Weird name. fixme Args: list_ (list): Returns: list: CommandLine: python -m utool.util_alg --exec-upper_diag_self_prodx Example: >>> # ENABLE_DOCTEST >>> fr...
['def', 'upper_diag_self_prodx', '(', 'list_', ')', ':', 'return', '[', '(', 'item1', ',', 'item2', ')', 'for', 'n1', ',', 'item1', 'in', 'enumerate', '(', 'list_', ')', 'for', 'n2', ',', 'item2', 'in', 'enumerate', '(', 'list_', ')', 'if', 'n1', '<', 'n2', ']']
upper diagnoal of cartesian product of self and self. Weird name. fixme Args: list_ (list): Returns: list: CommandLine: python -m utool.util_alg --exec-upper_diag_self_prodx Example: >>> # ENABLE_DOCTEST >>> from utool.util_alg import * # NOQA >>>...
['upper', 'diagnoal', 'of', 'cartesian', 'product', 'of', 'self', 'and', 'self', '.', 'Weird', 'name', '.', 'fixme']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_alg.py#L487-L511
1,419
Robpol86/libnl
libnl/nl.py
nl_complete_msg
def nl_complete_msg(sk, msg): """Finalize Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L450 This function finalizes a Netlink message by completing the message with desirable flags and values depending on the socket configuration. - If not yet filled out, the source...
python
def nl_complete_msg(sk, msg): """Finalize Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L450 This function finalizes a Netlink message by completing the message with desirable flags and values depending on the socket configuration. - If not yet filled out, the source...
['def', 'nl_complete_msg', '(', 'sk', ',', 'msg', ')', ':', 'nlh', '=', 'msg', '.', 'nm_nlh', 'if', 'nlh', '.', 'nlmsg_pid', '==', 'NL_AUTO_PORT', ':', 'nlh', '.', 'nlmsg_pid', '=', 'nl_socket_get_local_port', '(', 'sk', ')', 'if', 'nlh', '.', 'nlmsg_seq', '==', 'NL_AUTO_SEQ', ':', 'nlh', '.', 'nlmsg_seq', '=', 'sk', '...
Finalize Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L450 This function finalizes a Netlink message by completing the message with desirable flags and values depending on the socket configuration. - If not yet filled out, the source address of the message (`nlmsg_pid`)...
['Finalize', 'Netlink', 'message', '.']
train
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/nl.py#L213-L242
1,420
obulpathi/cdn-fastly-python
fastly/__init__.py
FastlyConnection.update_user
def update_user(self, user_id, **kwargs): """Update a user.""" body = self._formdata(kwargs, FastlyUser.FIELDS) content = self._fetch("/user/%s" % user_id, method="PUT", body=body) return FastlyUser(self, content)
python
def update_user(self, user_id, **kwargs): """Update a user.""" body = self._formdata(kwargs, FastlyUser.FIELDS) content = self._fetch("/user/%s" % user_id, method="PUT", body=body) return FastlyUser(self, content)
['def', 'update_user', '(', 'self', ',', 'user_id', ',', '*', '*', 'kwargs', ')', ':', 'body', '=', 'self', '.', '_formdata', '(', 'kwargs', ',', 'FastlyUser', '.', 'FIELDS', ')', 'content', '=', 'self', '.', '_fetch', '(', '"/user/%s"', '%', 'user_id', ',', 'method', '=', '"PUT"', ',', 'body', '=', 'body', ')', 'retur...
Update a user.
['Update', 'a', 'user', '.']
train
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L839-L843
1,421
fermiPy/fermipy
fermipy/utils.py
make_psf_kernel
def make_psf_kernel(psf, npix, cdelt, xpix, ypix, psf_scale_fn=None, normalize=False): """ Generate a kernel for a point-source. Parameters ---------- psf : `~fermipy.irfs.PSFModel` npix : int Number of pixels in X and Y dimensions. cdelt : float Pixel size in degrees. ...
python
def make_psf_kernel(psf, npix, cdelt, xpix, ypix, psf_scale_fn=None, normalize=False): """ Generate a kernel for a point-source. Parameters ---------- psf : `~fermipy.irfs.PSFModel` npix : int Number of pixels in X and Y dimensions. cdelt : float Pixel size in degrees. ...
['def', 'make_psf_kernel', '(', 'psf', ',', 'npix', ',', 'cdelt', ',', 'xpix', ',', 'ypix', ',', 'psf_scale_fn', '=', 'None', ',', 'normalize', '=', 'False', ')', ':', 'egy', '=', 'psf', '.', 'energies', 'x', '=', 'make_pixel_distance', '(', 'npix', ',', 'xpix', ',', 'ypix', ')', 'x', '*=', 'cdelt', 'k', '=', 'np', '.'...
Generate a kernel for a point-source. Parameters ---------- psf : `~fermipy.irfs.PSFModel` npix : int Number of pixels in X and Y dimensions. cdelt : float Pixel size in degrees.
['Generate', 'a', 'kernel', 'for', 'a', 'point', '-', 'source', '.']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1777-L1805
1,422
googleapis/gax-python
google/gax/api_callable.py
_bundleable
def _bundleable(desc): """Creates a function that transforms an API call into a bundling call. It transform a_func from an API call that receives the requests and returns the response into a callable that receives the same request, and returns a :class:`bundling.Event`. The returned Event object c...
python
def _bundleable(desc): """Creates a function that transforms an API call into a bundling call. It transform a_func from an API call that receives the requests and returns the response into a callable that receives the same request, and returns a :class:`bundling.Event`. The returned Event object c...
['def', '_bundleable', '(', 'desc', ')', ':', 'def', 'inner', '(', 'a_func', ',', 'settings', ',', 'request', ',', '*', '*', 'kwargs', ')', ':', '"""Schedules execution of a bundling task."""', 'if', 'not', 'settings', '.', 'bundler', ':', 'return', 'a_func', '(', 'request', ',', '*', '*', 'kwargs', ')', 'the_id', '=',...
Creates a function that transforms an API call into a bundling call. It transform a_func from an API call that receives the requests and returns the response into a callable that receives the same request, and returns a :class:`bundling.Event`. The returned Event object can be used to obtain the event...
['Creates', 'a', 'function', 'that', 'transforms', 'an', 'API', 'call', 'into', 'a', 'bundling', 'call', '.']
train
https://github.com/googleapis/gax-python/blob/309aedfcfd48e4c8fa22dd60e9c84c3cc71bb20e/google/gax/api_callable.py#L43-L71
1,423
trevisanj/f311
f311/hapi.py
getStickXY
def getStickXY(TableName): """ Get X and Y for fine plotting of a stick spectrum. Usage: X,Y = getStickXY(TableName). """ cent,intens = getColumns(TableName,('nu','sw')) n = len(cent) cent_ = zeros(n*3) intens_ = zeros(n*3) for i in range(n): intens_[3*i] = 0 intens_[...
python
def getStickXY(TableName): """ Get X and Y for fine plotting of a stick spectrum. Usage: X,Y = getStickXY(TableName). """ cent,intens = getColumns(TableName,('nu','sw')) n = len(cent) cent_ = zeros(n*3) intens_ = zeros(n*3) for i in range(n): intens_[3*i] = 0 intens_[...
['def', 'getStickXY', '(', 'TableName', ')', ':', 'cent', ',', 'intens', '=', 'getColumns', '(', 'TableName', ',', '(', "'nu'", ',', "'sw'", ')', ')', 'n', '=', 'len', '(', 'cent', ')', 'cent_', '=', 'zeros', '(', 'n', '*', '3', ')', 'intens_', '=', 'zeros', '(', 'n', '*', '3', ')', 'for', 'i', 'in', 'range', '(', 'n',...
Get X and Y for fine plotting of a stick spectrum. Usage: X,Y = getStickXY(TableName).
['Get', 'X', 'and', 'Y', 'for', 'fine', 'plotting', 'of', 'a', 'stick', 'spectrum', '.', 'Usage', ':', 'X', 'Y', '=', 'getStickXY', '(', 'TableName', ')', '.']
train
https://github.com/trevisanj/f311/blob/9e502a3d1e1f74d4290a8a0bae9a34ef8d7b29f7/f311/hapi.py#L11730-L11744
1,424
santosjorge/cufflinks
cufflinks/datagen.py
sinwave
def sinwave(n=4,inc=.25): """ Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis """ x=np.arange(-n,n,inc) y=np.arange(-n,n,inc) X,Y=np.meshgrid(x,y) R = np.sqrt(X**2...
python
def sinwave(n=4,inc=.25): """ Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis """ x=np.arange(-n,n,inc) y=np.arange(-n,n,inc) X,Y=np.meshgrid(x,y) R = np.sqrt(X**2...
['def', 'sinwave', '(', 'n', '=', '4', ',', 'inc', '=', '.25', ')', ':', 'x', '=', 'np', '.', 'arange', '(', '-', 'n', ',', 'n', ',', 'inc', ')', 'y', '=', 'np', '.', 'arange', '(', '-', 'n', ',', 'n', ',', 'inc', ')', 'X', ',', 'Y', '=', 'np', '.', 'meshgrid', '(', 'x', ',', 'y', ')', 'R', '=', 'np', '.', 'sqrt', '(',...
Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis
['Returns', 'a', 'DataFrame', 'with', 'the', 'required', 'format', 'for', 'a', 'surface', '(', 'sine', 'wave', ')', 'plot']
train
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L364-L381
1,425
thespacedoctor/neddy
neddy/conesearch.py
conesearch._oversized_subqueries
def _oversized_subqueries( self, coordinate, radiusArcsec): """ *subdivide oversized query* **Key Arguments:** # - **Return:** - None .. todo:: - @review: when complete, clean _oversized_subqueries method...
python
def _oversized_subqueries( self, coordinate, radiusArcsec): """ *subdivide oversized query* **Key Arguments:** # - **Return:** - None .. todo:: - @review: when complete, clean _oversized_subqueries method...
['def', '_oversized_subqueries', '(', 'self', ',', 'coordinate', ',', 'radiusArcsec', ')', ':', 'self', '.', 'log', '.', 'info', '(', "'starting the ``_oversized_subqueries`` method'", ')', 'import', 'math', 'smallerRadiusArcsec', '=', 'radiusArcsec', '/', '2.', 'print', '"Calculating 7 sub-disks for coordinates %(coor...
*subdivide oversized query* **Key Arguments:** # - **Return:** - None .. todo:: - @review: when complete, clean _oversized_subqueries method - @review: when complete add logging
['*', 'subdivide', 'oversized', 'query', '*']
train
https://github.com/thespacedoctor/neddy/blob/f32653b7d6a39a2c46c5845f83b3a29056311e5e/neddy/conesearch.py#L296-L347
1,426
jopohl/urh
src/urh/signalprocessing/ProtocolAnalyzer.py
ProtocolAnalyzer.estimate_frequency_for_zero
def estimate_frequency_for_zero(self, sample_rate: float, nbits=42) -> float: """ Calculates the frequency of at most nbits logical zeros and returns the mean of these frequencies :param nbits: :return: """ return self.__estimate_frequency_for_bit(False, sample_rate, nbi...
python
def estimate_frequency_for_zero(self, sample_rate: float, nbits=42) -> float: """ Calculates the frequency of at most nbits logical zeros and returns the mean of these frequencies :param nbits: :return: """ return self.__estimate_frequency_for_bit(False, sample_rate, nbi...
['def', 'estimate_frequency_for_zero', '(', 'self', ',', 'sample_rate', ':', 'float', ',', 'nbits', '=', '42', ')', '->', 'float', ':', 'return', 'self', '.', '__estimate_frequency_for_bit', '(', 'False', ',', 'sample_rate', ',', 'nbits', ')']
Calculates the frequency of at most nbits logical zeros and returns the mean of these frequencies :param nbits: :return:
['Calculates', 'the', 'frequency', 'of', 'at', 'most', 'nbits', 'logical', 'zeros', 'and', 'returns', 'the', 'mean', 'of', 'these', 'frequencies']
train
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolAnalyzer.py#L496-L503
1,427
cbclab/MOT
mot/lib/cl_environments.py
CLEnvironmentFactory.all_devices
def all_devices(cl_device_type=None, platform=None): """Get multiple device environments, optionally only of the indicated type. This will only fetch devices that support double point precision. Args: cl_device_type (cl.device_type.* or string): The type of the device we want, ...
python
def all_devices(cl_device_type=None, platform=None): """Get multiple device environments, optionally only of the indicated type. This will only fetch devices that support double point precision. Args: cl_device_type (cl.device_type.* or string): The type of the device we want, ...
['def', 'all_devices', '(', 'cl_device_type', '=', 'None', ',', 'platform', '=', 'None', ')', ':', 'if', 'isinstance', '(', 'cl_device_type', ',', 'str', ')', ':', 'cl_device_type', '=', 'device_type_from_string', '(', 'cl_device_type', ')', 'runtime_list', '=', '[', ']', 'if', 'platform', 'is', 'None', ':', 'platforms...
Get multiple device environments, optionally only of the indicated type. This will only fetch devices that support double point precision. Args: cl_device_type (cl.device_type.* or string): The type of the device we want, can be a opencl device type or a string matching 'GP...
['Get', 'multiple', 'device', 'environments', 'optionally', 'only', 'of', 'the', 'indicated', 'type', '.']
train
https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/lib/cl_environments.py#L210-L244
1,428
theislab/anndata
anndata/readwrite/read.py
read_umi_tools
def read_umi_tools(filename: PathLike, dtype: str='float32') -> AnnData: """Read a gzipped condensed count matrix from umi_tools. Parameters ---------- filename File name to read from. """ # import pandas for conversion of a dict of dicts into a matrix # import gzip to read a gzippe...
python
def read_umi_tools(filename: PathLike, dtype: str='float32') -> AnnData: """Read a gzipped condensed count matrix from umi_tools. Parameters ---------- filename File name to read from. """ # import pandas for conversion of a dict of dicts into a matrix # import gzip to read a gzippe...
['def', 'read_umi_tools', '(', 'filename', ':', 'PathLike', ',', 'dtype', ':', 'str', '=', "'float32'", ')', '->', 'AnnData', ':', '# import pandas for conversion of a dict of dicts into a matrix', '# import gzip to read a gzipped file :-)', 'import', 'gzip', 'from', 'pandas', 'import', 'DataFrame', 'dod', '=', '{', '}...
Read a gzipped condensed count matrix from umi_tools. Parameters ---------- filename File name to read from.
['Read', 'a', 'gzipped', 'condensed', 'count', 'matrix', 'from', 'umi_tools', '.']
train
https://github.com/theislab/anndata/blob/34f4eb63710628fbc15e7050e5efcac1d7806062/anndata/readwrite/read.py#L68-L94
1,429
twilio/twilio-python
twilio/rest/api/v2010/account/usage/trigger.py
TriggerInstance.update
def update(self, callback_method=values.unset, callback_url=values.unset, friendly_name=values.unset): """ Update the TriggerInstance :param unicode callback_method: The HTTP method to use to call callback_url :param unicode callback_url: The URL we call when the trigger ...
python
def update(self, callback_method=values.unset, callback_url=values.unset, friendly_name=values.unset): """ Update the TriggerInstance :param unicode callback_method: The HTTP method to use to call callback_url :param unicode callback_url: The URL we call when the trigger ...
['def', 'update', '(', 'self', ',', 'callback_method', '=', 'values', '.', 'unset', ',', 'callback_url', '=', 'values', '.', 'unset', ',', 'friendly_name', '=', 'values', '.', 'unset', ')', ':', 'return', 'self', '.', '_proxy', '.', 'update', '(', 'callback_method', '=', 'callback_method', ',', 'callback_url', '=', 'ca...
Update the TriggerInstance :param unicode callback_method: The HTTP method to use to call callback_url :param unicode callback_url: The URL we call when the trigger fires :param unicode friendly_name: A string to describe the resource :returns: Updated TriggerInstance :rtype: t...
['Update', 'the', 'TriggerInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/usage/trigger.py#L789-L805
1,430
Karaage-Cluster/python-tldap
tldap/database/__init__.py
_python_to_mod_new
def _python_to_mod_new(changes: Changeset) -> Dict[str, List[List[bytes]]]: """ Convert a LdapChanges object to a modlist for add operation. """ table: LdapObjectClass = type(changes.src) fields = table.get_fields() result: Dict[str, List[List[bytes]]] = {} for name, field in fields.items(): ...
python
def _python_to_mod_new(changes: Changeset) -> Dict[str, List[List[bytes]]]: """ Convert a LdapChanges object to a modlist for add operation. """ table: LdapObjectClass = type(changes.src) fields = table.get_fields() result: Dict[str, List[List[bytes]]] = {} for name, field in fields.items(): ...
['def', '_python_to_mod_new', '(', 'changes', ':', 'Changeset', ')', '->', 'Dict', '[', 'str', ',', 'List', '[', 'List', '[', 'bytes', ']', ']', ']', ':', 'table', ':', 'LdapObjectClass', '=', 'type', '(', 'changes', '.', 'src', ')', 'fields', '=', 'table', '.', 'get_fields', '(', ')', 'result', ':', 'Dict', '[', 'str'...
Convert a LdapChanges object to a modlist for add operation.
['Convert', 'a', 'LdapChanges', 'object', 'to', 'a', 'modlist', 'for', 'add', 'operation', '.']
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/database/__init__.py#L407-L423
1,431
modin-project/modin
modin/pandas/base.py
BasePandasDataset.pow
def pow(self, other, axis="columns", level=None, fill_value=None): """Pow this DataFrame against another DataFrame/Series/scalar. Args: other: The object to use to apply the pow against this. axis: The axis to pow over. level: The Multilevel index level to appl...
python
def pow(self, other, axis="columns", level=None, fill_value=None): """Pow this DataFrame against another DataFrame/Series/scalar. Args: other: The object to use to apply the pow against this. axis: The axis to pow over. level: The Multilevel index level to appl...
['def', 'pow', '(', 'self', ',', 'other', ',', 'axis', '=', '"columns"', ',', 'level', '=', 'None', ',', 'fill_value', '=', 'None', ')', ':', 'return', 'self', '.', '_binary_op', '(', '"pow"', ',', 'other', ',', 'axis', '=', 'axis', ',', 'level', '=', 'level', ',', 'fill_value', '=', 'fill_value', ')']
Pow this DataFrame against another DataFrame/Series/scalar. Args: other: The object to use to apply the pow against this. axis: The axis to pow over. level: The Multilevel index level to apply pow over. fill_value: The value to fill NaNs with. Re...
['Pow', 'this', 'DataFrame', 'against', 'another', 'DataFrame', '/', 'Series', '/', 'scalar', '.', 'Args', ':', 'other', ':', 'The', 'object', 'to', 'use', 'to', 'apply', 'the', 'pow', 'against', 'this', '.', 'axis', ':', 'The', 'axis', 'to', 'pow', 'over', '.', 'level', ':', 'The', 'Multilevel', 'index', 'level', 'to'...
train
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L1738-L1752
1,432
mikekatz04/BOWIE
snr_calculator_folder/gwsnrcalc/genconutils/forminput.py
SensitivityInput.set_wd_noise
def set_wd_noise(self, wd_noise): """Add White Dwarf Background Noise This adds the White Dwarf (WD) Background noise. This can either do calculations with, without, or with and without WD noise. Args: wd_noise (bool or str, optional): Add or remove WD background noise. Fir...
python
def set_wd_noise(self, wd_noise): """Add White Dwarf Background Noise This adds the White Dwarf (WD) Background noise. This can either do calculations with, without, or with and without WD noise. Args: wd_noise (bool or str, optional): Add or remove WD background noise. Fir...
['def', 'set_wd_noise', '(', 'self', ',', 'wd_noise', ')', ':', 'if', 'isinstance', '(', 'wd_noise', ',', 'bool', ')', ':', 'wd_noise', '=', 'str', '(', 'wd_noise', ')', 'if', 'wd_noise', '.', 'lower', '(', ')', '==', "'yes'", 'or', 'wd_noise', '.', 'lower', '(', ')', '==', "'true'", ':', 'wd_noise', '=', "'True'", 'el...
Add White Dwarf Background Noise This adds the White Dwarf (WD) Background noise. This can either do calculations with, without, or with and without WD noise. Args: wd_noise (bool or str, optional): Add or remove WD background noise. First option is to have only cal...
['Add', 'White', 'Dwarf', 'Background', 'Noise']
train
https://github.com/mikekatz04/BOWIE/blob/a941342a3536cb57c817a1643896d99a3f354a86/snr_calculator_folder/gwsnrcalc/genconutils/forminput.py#L200-L229
1,433
beregond/jsonmodels
jsonmodels/models.py
Base.populate
def populate(self, **values): """Populate values to fields. Skip non-existing.""" values = values.copy() fields = list(self.iterate_with_name()) for _, structure_name, field in fields: if structure_name in values: field.__set__(self, values.pop(structure_name)...
python
def populate(self, **values): """Populate values to fields. Skip non-existing.""" values = values.copy() fields = list(self.iterate_with_name()) for _, structure_name, field in fields: if structure_name in values: field.__set__(self, values.pop(structure_name)...
['def', 'populate', '(', 'self', ',', '*', '*', 'values', ')', ':', 'values', '=', 'values', '.', 'copy', '(', ')', 'fields', '=', 'list', '(', 'self', '.', 'iterate_with_name', '(', ')', ')', 'for', '_', ',', 'structure_name', ',', 'field', 'in', 'fields', ':', 'if', 'structure_name', 'in', 'values', ':', 'field', '.'...
Populate values to fields. Skip non-existing.
['Populate', 'values', 'to', 'fields', '.', 'Skip', 'non', '-', 'existing', '.']
train
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/models.py#L36-L45
1,434
chaoss/grimoirelab-sortinghat
sortinghat/cmd/load.py
Load.__reset_unique_identities
def __reset_unique_identities(self): """Clear identities relationships and enrollments data""" self.log("Reseting unique identities...") self.log("Clearing identities relationships") nids = 0 uidentities = api.unique_identities(self.db) for uidentity in uidentities: ...
python
def __reset_unique_identities(self): """Clear identities relationships and enrollments data""" self.log("Reseting unique identities...") self.log("Clearing identities relationships") nids = 0 uidentities = api.unique_identities(self.db) for uidentity in uidentities: ...
['def', '__reset_unique_identities', '(', 'self', ')', ':', 'self', '.', 'log', '(', '"Reseting unique identities..."', ')', 'self', '.', 'log', '(', '"Clearing identities relationships"', ')', 'nids', '=', '0', 'uidentities', '=', 'api', '.', 'unique_identities', '(', 'self', '.', 'db', ')', 'for', 'uidentity', 'in', ...
Clear identities relationships and enrollments data
['Clear', 'identities', 'relationships', 'and', 'enrollments', 'data']
train
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/load.py#L325-L350
1,435
bukun/TorCMS
torcms/model/post_model.py
MPost.get_all
def get_all(kind='2'): ''' Get All the records. ''' return TabPost.select().where( (TabPost.kind == kind) & (TabPost.valid == 1) ).order_by( TabPost.time_update.desc() )
python
def get_all(kind='2'): ''' Get All the records. ''' return TabPost.select().where( (TabPost.kind == kind) & (TabPost.valid == 1) ).order_by( TabPost.time_update.desc() )
['def', 'get_all', '(', 'kind', '=', "'2'", ')', ':', 'return', 'TabPost', '.', 'select', '(', ')', '.', 'where', '(', '(', 'TabPost', '.', 'kind', '==', 'kind', ')', '&', '(', 'TabPost', '.', 'valid', '==', '1', ')', ')', '.', 'order_by', '(', 'TabPost', '.', 'time_update', '.', 'desc', '(', ')', ')']
Get All the records.
['Get', 'All', 'the', 'records', '.']
train
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L560-L569
1,436
artefactual-labs/mets-reader-writer
metsrw/mets.py
METSDocument.remove_entry
def remove_entry(self, fs_entry): """Removes an FSEntry object from this METS document. Any children of this FSEntry will also be removed. This will be removed as a child of it's parent, if any. :param metsrw.mets.FSEntry fs_entry: FSEntry to remove from the METS """ tr...
python
def remove_entry(self, fs_entry): """Removes an FSEntry object from this METS document. Any children of this FSEntry will also be removed. This will be removed as a child of it's parent, if any. :param metsrw.mets.FSEntry fs_entry: FSEntry to remove from the METS """ tr...
['def', 'remove_entry', '(', 'self', ',', 'fs_entry', ')', ':', 'try', ':', 'self', '.', '_root_elements', '.', 'remove', '(', 'fs_entry', ')', 'except', 'ValueError', ':', '# fs_entry may not be in the root elements', 'pass', 'if', 'fs_entry', '.', 'parent', ':', 'fs_entry', '.', 'parent', '.', 'remove_child', '(', 'f...
Removes an FSEntry object from this METS document. Any children of this FSEntry will also be removed. This will be removed as a child of it's parent, if any. :param metsrw.mets.FSEntry fs_entry: FSEntry to remove from the METS
['Removes', 'an', 'FSEntry', 'object', 'from', 'this', 'METS', 'document', '.']
train
https://github.com/artefactual-labs/mets-reader-writer/blob/d95939cabdfdc25cb1bf67df0c84bd0d6e6a73ff/metsrw/mets.py#L123-L138
1,437
adamziel/python_translate
python_translate/translations.py
MessageCatalogue.get
def get(self, id, domain='messages'): """ Gets a message translation. @rtype: str @return: The message translation """ assert isinstance(id, (str, unicode)) assert isinstance(domain, (str, unicode)) if self.defines(id, domain): return self.me...
python
def get(self, id, domain='messages'): """ Gets a message translation. @rtype: str @return: The message translation """ assert isinstance(id, (str, unicode)) assert isinstance(domain, (str, unicode)) if self.defines(id, domain): return self.me...
['def', 'get', '(', 'self', ',', 'id', ',', 'domain', '=', "'messages'", ')', ':', 'assert', 'isinstance', '(', 'id', ',', '(', 'str', ',', 'unicode', ')', ')', 'assert', 'isinstance', '(', 'domain', ',', '(', 'str', ',', 'unicode', ')', ')', 'if', 'self', '.', 'defines', '(', 'id', ',', 'domain', ')', ':', 'return', '...
Gets a message translation. @rtype: str @return: The message translation
['Gets', 'a', 'message', 'translation', '.']
train
https://github.com/adamziel/python_translate/blob/0aee83f434bd2d1b95767bcd63adb7ac7036c7df/python_translate/translations.py#L114-L130
1,438
digidotcom/python-devicecloud
devicecloud/devicecore.py
Device.is_connected
def is_connected(self, use_cached=True): """Return True if the device is currrently connect and False if not""" device_json = self.get_device_json(use_cached) return int(device_json.get("dpConnectionStatus")) > 0
python
def is_connected(self, use_cached=True): """Return True if the device is currrently connect and False if not""" device_json = self.get_device_json(use_cached) return int(device_json.get("dpConnectionStatus")) > 0
['def', 'is_connected', '(', 'self', ',', 'use_cached', '=', 'True', ')', ':', 'device_json', '=', 'self', '.', 'get_device_json', '(', 'use_cached', ')', 'return', 'int', '(', 'device_json', '.', 'get', '(', '"dpConnectionStatus"', ')', ')', '>', '0']
Return True if the device is currrently connect and False if not
['Return', 'True', 'if', 'the', 'device', 'is', 'currrently', 'connect', 'and', 'False', 'if', 'not']
train
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L428-L431
1,439
pytroll/posttroll
posttroll/address_receiver.py
AddressReceiver._check_age
def _check_age(self, pub, min_interval=timedelta(seconds=0)): """Check the age of the receiver. """ now = datetime.utcnow() if (now - self._last_age_check) <= min_interval: return LOGGER.debug("%s - checking addresses", str(datetime.utcnow())) self._last_age_...
python
def _check_age(self, pub, min_interval=timedelta(seconds=0)): """Check the age of the receiver. """ now = datetime.utcnow() if (now - self._last_age_check) <= min_interval: return LOGGER.debug("%s - checking addresses", str(datetime.utcnow())) self._last_age_...
['def', '_check_age', '(', 'self', ',', 'pub', ',', 'min_interval', '=', 'timedelta', '(', 'seconds', '=', '0', ')', ')', ':', 'now', '=', 'datetime', '.', 'utcnow', '(', ')', 'if', '(', 'now', '-', 'self', '.', '_last_age_check', ')', '<=', 'min_interval', ':', 'return', 'LOGGER', '.', 'debug', '(', '"%s - checking ad...
Check the age of the receiver.
['Check', 'the', 'age', 'of', 'the', 'receiver', '.']
train
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/address_receiver.py#L114-L136
1,440
croscon/fleaker
fleaker/marshmallow/fields/arrow.py
ArrowField._serialize
def _serialize(self, value, attr, obj): """Convert the Arrow object into a string.""" if isinstance(value, arrow.arrow.Arrow): value = value.datetime return super(ArrowField, self)._serialize(value, attr, obj)
python
def _serialize(self, value, attr, obj): """Convert the Arrow object into a string.""" if isinstance(value, arrow.arrow.Arrow): value = value.datetime return super(ArrowField, self)._serialize(value, attr, obj)
['def', '_serialize', '(', 'self', ',', 'value', ',', 'attr', ',', 'obj', ')', ':', 'if', 'isinstance', '(', 'value', ',', 'arrow', '.', 'arrow', '.', 'Arrow', ')', ':', 'value', '=', 'value', '.', 'datetime', 'return', 'super', '(', 'ArrowField', ',', 'self', ')', '.', '_serialize', '(', 'value', ',', 'attr', ',', 'ob...
Convert the Arrow object into a string.
['Convert', 'the', 'Arrow', 'object', 'into', 'a', 'string', '.']
train
https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/fields/arrow.py#L42-L47
1,441
openbermuda/ripl
ripl/caption.py
SlideShow.create_image
def create_image(self, image_file, caption): """ Create an image with a caption """ suffix = 'png' if image_file: img = Image.open(os.path.join(self.gallery, image_file)) width, height = img.size ratio = width/WIDTH img = img.resize((int(width // r...
python
def create_image(self, image_file, caption): """ Create an image with a caption """ suffix = 'png' if image_file: img = Image.open(os.path.join(self.gallery, image_file)) width, height = img.size ratio = width/WIDTH img = img.resize((int(width // r...
['def', 'create_image', '(', 'self', ',', 'image_file', ',', 'caption', ')', ':', 'suffix', '=', "'png'", 'if', 'image_file', ':', 'img', '=', 'Image', '.', 'open', '(', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'gallery', ',', 'image_file', ')', ')', 'width', ',', 'height', '=', 'img', '.', 'size', 'ratio', '=...
Create an image with a caption
['Create', 'an', 'image', 'with', 'a', 'caption']
train
https://github.com/openbermuda/ripl/blob/4886b1a697e4b81c2202db9cb977609e034f8e70/ripl/caption.py#L65-L81
1,442
ranaroussi/ezibpy
ezibpy/ezibpy.py
ezIBpy.requestAccountUpdates
def requestAccountUpdates(self, subscribe=True): """ Register to account updates https://www.interactivebrokers.com/en/software/api/apiguide/java/reqaccountupdates.htm """ if self.subscribeAccount != subscribe: self.subscribeAccount = subscribe self.ibConn...
python
def requestAccountUpdates(self, subscribe=True): """ Register to account updates https://www.interactivebrokers.com/en/software/api/apiguide/java/reqaccountupdates.htm """ if self.subscribeAccount != subscribe: self.subscribeAccount = subscribe self.ibConn...
['def', 'requestAccountUpdates', '(', 'self', ',', 'subscribe', '=', 'True', ')', ':', 'if', 'self', '.', 'subscribeAccount', '!=', 'subscribe', ':', 'self', '.', 'subscribeAccount', '=', 'subscribe', 'self', '.', 'ibConn', '.', 'reqAccountUpdates', '(', 'subscribe', ',', '0', ')']
Register to account updates https://www.interactivebrokers.com/en/software/api/apiguide/java/reqaccountupdates.htm
['Register', 'to', 'account', 'updates', 'https', ':', '//', 'www', '.', 'interactivebrokers', '.', 'com', '/', 'en', '/', 'software', '/', 'api', '/', 'apiguide', '/', 'java', '/', 'reqaccountupdates', '.', 'htm']
train
https://github.com/ranaroussi/ezibpy/blob/1a9d4bf52018abd2a01af7c991d7cf00cda53e0c/ezibpy/ezibpy.py#L1954-L1961
1,443
wheeler-microfluidics/dmf-control-board-firmware
dmf_control_board_firmware/__init__.py
feedback_results_to_measurements_frame
def feedback_results_to_measurements_frame(feedback_result): ''' Extract measured data from `FeedbackResults` instance into `pandas.DataFrame`. ''' index = pd.Index(feedback_result.time * 1e-3, name='seconds') df_feedback = pd.DataFrame(np.column_stack([feedback_result.V_fb, ...
python
def feedback_results_to_measurements_frame(feedback_result): ''' Extract measured data from `FeedbackResults` instance into `pandas.DataFrame`. ''' index = pd.Index(feedback_result.time * 1e-3, name='seconds') df_feedback = pd.DataFrame(np.column_stack([feedback_result.V_fb, ...
['def', 'feedback_results_to_measurements_frame', '(', 'feedback_result', ')', ':', 'index', '=', 'pd', '.', 'Index', '(', 'feedback_result', '.', 'time', '*', '1e-3', ',', 'name', '=', "'seconds'", ')', 'df_feedback', '=', 'pd', '.', 'DataFrame', '(', 'np', '.', 'column_stack', '(', '[', 'feedback_result', '.', 'V_fb'...
Extract measured data from `FeedbackResults` instance into `pandas.DataFrame`.
['Extract', 'measured', 'data', 'from', 'FeedbackResults', 'instance', 'into', 'pandas', '.', 'DataFrame', '.']
train
https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/dmf_control_board_firmware/__init__.py#L158-L172
1,444
ioos/compliance-checker
compliance_checker/acdd.py
ACDDBaseCheck.check_acknowledgment
def check_acknowledgment(self, ds): ''' Check if acknowledgment/acknowledgment attribute is present. Because acknowledgement has its own check, we are keeping it out of the Global Attributes (even though it is a Global Attr). :param netCDF4.Dataset ds: An open netCDF dataset ...
python
def check_acknowledgment(self, ds): ''' Check if acknowledgment/acknowledgment attribute is present. Because acknowledgement has its own check, we are keeping it out of the Global Attributes (even though it is a Global Attr). :param netCDF4.Dataset ds: An open netCDF dataset ...
['def', 'check_acknowledgment', '(', 'self', ',', 'ds', ')', ':', 'check', '=', 'False', 'messages', '=', '[', ']', 'if', 'hasattr', '(', 'ds', ',', "'acknowledgment'", ')', 'or', 'hasattr', '(', 'ds', ',', "'acknowledgement'", ')', ':', 'check', '=', 'True', 'else', ':', 'messages', '.', 'append', '(', '"acknowledgmen...
Check if acknowledgment/acknowledgment attribute is present. Because acknowledgement has its own check, we are keeping it out of the Global Attributes (even though it is a Global Attr). :param netCDF4.Dataset ds: An open netCDF dataset
['Check', 'if', 'acknowledgment', '/', 'acknowledgment', 'attribute', 'is', 'present', '.', 'Because', 'acknowledgement', 'has', 'its', 'own', 'check', 'we', 'are', 'keeping', 'it', 'out', 'of', 'the', 'Global', 'Attributes', '(', 'even', 'though', 'it', 'is', 'a', 'Global', 'Attr', ')', '.']
train
https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/acdd.py#L203-L219
1,445
enkore/i3pystatus
i3pystatus/core/color.py
ColorRangeModule.get_hex_color_range
def get_hex_color_range(start_color, end_color, quantity): """ Generates a list of quantity Hex colors from start_color to end_color. :param start_color: Hex or plain English color for start of range :param end_color: Hex or plain English color for end of range :param quantity: ...
python
def get_hex_color_range(start_color, end_color, quantity): """ Generates a list of quantity Hex colors from start_color to end_color. :param start_color: Hex or plain English color for start of range :param end_color: Hex or plain English color for end of range :param quantity: ...
['def', 'get_hex_color_range', '(', 'start_color', ',', 'end_color', ',', 'quantity', ')', ':', 'raw_colors', '=', '[', 'c', '.', 'hex', 'for', 'c', 'in', 'list', '(', 'Color', '(', 'start_color', ')', '.', 'range_to', '(', 'Color', '(', 'end_color', ')', ',', 'quantity', ')', ')', ']', 'colors', '=', '[', ']', 'for', ...
Generates a list of quantity Hex colors from start_color to end_color. :param start_color: Hex or plain English color for start of range :param end_color: Hex or plain English color for end of range :param quantity: Number of colours to return :return: A list of Hex color values
['Generates', 'a', 'list', 'of', 'quantity', 'Hex', 'colors', 'from', 'start_color', 'to', 'end_color', '.']
train
https://github.com/enkore/i3pystatus/blob/14cfde967cecf79b40e223e35a04600f4c875af7/i3pystatus/core/color.py#L15-L38
1,446
tonybaloney/retox
retox/ui.py
VirtualEnvironmentFrame.start
def start(self, activity, action): ''' Mark an action as started :param activity: The virtualenv activity name :type activity: ``str`` :param action: The virtualenv action :type action: :class:`tox.session.Action` ''' try: self._start_actio...
python
def start(self, activity, action): ''' Mark an action as started :param activity: The virtualenv activity name :type activity: ``str`` :param action: The virtualenv action :type action: :class:`tox.session.Action` ''' try: self._start_actio...
['def', 'start', '(', 'self', ',', 'activity', ',', 'action', ')', ':', 'try', ':', 'self', '.', '_start_action', '(', 'activity', ',', 'action', ')', 'except', 'ValueError', ':', 'retox_log', '.', 'debug', '(', '"Could not find action %s in env %s"', '%', '(', 'activity', ',', 'self', '.', 'name', ')', ')', 'self', '....
Mark an action as started :param activity: The virtualenv activity name :type activity: ``str`` :param action: The virtualenv action :type action: :class:`tox.session.Action`
['Mark', 'an', 'action', 'as', 'started']
train
https://github.com/tonybaloney/retox/blob/4635e31001d2ac083423f46766249ac8daca7c9c/retox/ui.py#L233-L247
1,447
apache/incubator-mxnet
python/mxnet/ndarray/ndarray.py
NDArray._get_index_nd
def _get_index_nd(self, key): """Returns an index array for use in scatter_nd and gather_nd.""" def _is_advanced_index(index): """The definition of advanced index here includes integers as well, while integers are considered as basic index type when the key contains only ...
python
def _get_index_nd(self, key): """Returns an index array for use in scatter_nd and gather_nd.""" def _is_advanced_index(index): """The definition of advanced index here includes integers as well, while integers are considered as basic index type when the key contains only ...
['def', '_get_index_nd', '(', 'self', ',', 'key', ')', ':', 'def', '_is_advanced_index', '(', 'index', ')', ':', '"""The definition of advanced index here includes integers as well, while\n integers are considered as basic index type when the key contains only\n slices and integers."""', 'return',...
Returns an index array for use in scatter_nd and gather_nd.
['Returns', 'an', 'index', 'array', 'for', 'use', 'in', 'scatter_nd', 'and', 'gather_nd', '.']
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/ndarray/ndarray.py#L518-L662
1,448
tariqdaouda/pyGeno
pyGeno/tools/parsers/FastqTools.py
FastqFile.newEntry
def newEntry(self, ident = "", seq = "", plus = "", qual = "") : """Appends an empty entry at the end of the CSV and returns it""" e = FastqEntry() self.data.append(e) return e
python
def newEntry(self, ident = "", seq = "", plus = "", qual = "") : """Appends an empty entry at the end of the CSV and returns it""" e = FastqEntry() self.data.append(e) return e
['def', 'newEntry', '(', 'self', ',', 'ident', '=', '""', ',', 'seq', '=', '""', ',', 'plus', '=', '""', ',', 'qual', '=', '""', ')', ':', 'e', '=', 'FastqEntry', '(', ')', 'self', '.', 'data', '.', 'append', '(', 'e', ')', 'return', 'e']
Appends an empty entry at the end of the CSV and returns it
['Appends', 'an', 'empty', 'entry', 'at', 'the', 'end', 'of', 'the', 'CSV', 'and', 'returns', 'it']
train
https://github.com/tariqdaouda/pyGeno/blob/474b1250bf78ce5c7e7c3bbbfdbad9635d5a7d14/pyGeno/tools/parsers/FastqTools.py#L76-L80
1,449
materialsproject/pymatgen
pymatgen/util/num.py
monotonic
def monotonic(values, mode="<", atol=1.e-8): """ Returns False if values are not monotonic (decreasing|increasing). mode is "<" for a decreasing sequence, ">" for an increasing sequence. Two numbers are considered equal if they differ less that atol. .. warning: Not very efficient for large...
python
def monotonic(values, mode="<", atol=1.e-8): """ Returns False if values are not monotonic (decreasing|increasing). mode is "<" for a decreasing sequence, ">" for an increasing sequence. Two numbers are considered equal if they differ less that atol. .. warning: Not very efficient for large...
['def', 'monotonic', '(', 'values', ',', 'mode', '=', '"<"', ',', 'atol', '=', '1.e-8', ')', ':', 'if', 'len', '(', 'values', ')', '==', '1', ':', 'return', 'True', 'if', 'mode', '==', '">"', ':', 'for', 'i', 'in', 'range', '(', 'len', '(', 'values', ')', '-', '1', ')', ':', 'v', ',', 'vp', '=', 'values', '[', 'i', ']'...
Returns False if values are not monotonic (decreasing|increasing). mode is "<" for a decreasing sequence, ">" for an increasing sequence. Two numbers are considered equal if they differ less that atol. .. warning: Not very efficient for large data sets. >>> values = [1.2, 1.3, 1.4] >>> mon...
['Returns', 'False', 'if', 'values', 'are', 'not', 'monotonic', '(', 'decreasing|increasing', ')', '.', 'mode', 'is', '<', 'for', 'a', 'decreasing', 'sequence', '>', 'for', 'an', 'increasing', 'sequence', '.', 'Two', 'numbers', 'are', 'considered', 'equal', 'if', 'they', 'differ', 'less', 'that', 'atol', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L104-L137
1,450
mushkevych/scheduler
synergy/db/dao/job_dao.py
JobDao.run_query
def run_query(self, collection_name, query): """ method runs query on a specified collection and return a list of filtered Job records """ cursor = self.ds.filter(collection_name, query) return [Job.from_json(document) for document in cursor]
python
def run_query(self, collection_name, query): """ method runs query on a specified collection and return a list of filtered Job records """ cursor = self.ds.filter(collection_name, query) return [Job.from_json(document) for document in cursor]
['def', 'run_query', '(', 'self', ',', 'collection_name', ',', 'query', ')', ':', 'cursor', '=', 'self', '.', 'ds', '.', 'filter', '(', 'collection_name', ',', 'query', ')', 'return', '[', 'Job', '.', 'from_json', '(', 'document', ')', 'for', 'document', 'in', 'cursor', ']']
method runs query on a specified collection and return a list of filtered Job records
['method', 'runs', 'query', 'on', 'a', 'specified', 'collection', 'and', 'return', 'a', 'list', 'of', 'filtered', 'Job', 'records']
train
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/dao/job_dao.py#L94-L97
1,451
python-diamond/Diamond
src/collectors/users/users.py
UsersCollector.get_default_config_help
def get_default_config_help(self): """ Returns the default collector help text """ config_help = super(UsersCollector, self).get_default_config_help() config_help.update({ }) return config_help
python
def get_default_config_help(self): """ Returns the default collector help text """ config_help = super(UsersCollector, self).get_default_config_help() config_help.update({ }) return config_help
['def', 'get_default_config_help', '(', 'self', ')', ':', 'config_help', '=', 'super', '(', 'UsersCollector', ',', 'self', ')', '.', 'get_default_config_help', '(', ')', 'config_help', '.', 'update', '(', '{', '}', ')', 'return', 'config_help']
Returns the default collector help text
['Returns', 'the', 'default', 'collector', 'help', 'text']
train
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/users/users.py#L29-L36
1,452
chemlab/chemlab
chemlab/utils/pbc.py
noperiodic
def noperiodic(r_array, periodic, reference=None): '''Rearrange the array of coordinates *r_array* in a way that doensn't cross the periodic boundary. Parameters ---------- r_array : :class:`numpy.ndarray`, (Nx3) Array of 3D coordinates. periodic: :class:`numpy.ndarray`, ...
python
def noperiodic(r_array, periodic, reference=None): '''Rearrange the array of coordinates *r_array* in a way that doensn't cross the periodic boundary. Parameters ---------- r_array : :class:`numpy.ndarray`, (Nx3) Array of 3D coordinates. periodic: :class:`numpy.ndarray`, ...
['def', 'noperiodic', '(', 'r_array', ',', 'periodic', ',', 'reference', '=', 'None', ')', ':', 'if', 'reference', 'is', 'None', ':', 'center', '=', 'r_array', '[', '0', ']', 'else', ':', 'center', '=', 'reference', '# Find the displacements', 'dr', '=', '(', 'center', '-', 'r_array', ')', 'drsign', '=', 'np', '.', 'si...
Rearrange the array of coordinates *r_array* in a way that doensn't cross the periodic boundary. Parameters ---------- r_array : :class:`numpy.ndarray`, (Nx3) Array of 3D coordinates. periodic: :class:`numpy.ndarray`, (3) Periodic boundary dimensions. reference...
['Rearrange', 'the', 'array', 'of', 'coordinates', '*', 'r_array', '*', 'in', 'a', 'way', 'that', 'doensn', 't', 'cross', 'the', 'periodic', 'boundary', '.']
train
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/utils/pbc.py#L34-L77
1,453
ga4gh/ga4gh-server
ga4gh/server/gff3.py
Gff3Set._linkFeature
def _linkFeature(self, feature): """ Link a feature with its parents. """ parentNames = feature.attributes.get("Parent") if parentNames is None: self.roots.add(feature) else: for parentName in parentNames: self._linkToParent(feature...
python
def _linkFeature(self, feature): """ Link a feature with its parents. """ parentNames = feature.attributes.get("Parent") if parentNames is None: self.roots.add(feature) else: for parentName in parentNames: self._linkToParent(feature...
['def', '_linkFeature', '(', 'self', ',', 'feature', ')', ':', 'parentNames', '=', 'feature', '.', 'attributes', '.', 'get', '(', '"Parent"', ')', 'if', 'parentNames', 'is', 'None', ':', 'self', '.', 'roots', '.', 'add', '(', 'feature', ')', 'else', ':', 'for', 'parentName', 'in', 'parentNames', ':', 'self', '.', '_lin...
Link a feature with its parents.
['Link', 'a', 'feature', 'with', 'its', 'parents', '.']
train
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/gff3.py#L165-L174
1,454
ericsuh/dirichlet
dirichlet/simplex.py
_contour
def _contour(f, vertexlabels=None, contourfunc=None, **kwargs): '''Workhorse function for the above, where ``contourfunc`` is the contour plotting function to use for actual plotting.''' if contourfunc is None: contourfunc = plt.tricontour if vertexlabels is None: vertexlabels = ('1','2...
python
def _contour(f, vertexlabels=None, contourfunc=None, **kwargs): '''Workhorse function for the above, where ``contourfunc`` is the contour plotting function to use for actual plotting.''' if contourfunc is None: contourfunc = plt.tricontour if vertexlabels is None: vertexlabels = ('1','2...
['def', '_contour', '(', 'f', ',', 'vertexlabels', '=', 'None', ',', 'contourfunc', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', 'contourfunc', 'is', 'None', ':', 'contourfunc', '=', 'plt', '.', 'tricontour', 'if', 'vertexlabels', 'is', 'None', ':', 'vertexlabels', '=', '(', "'1'", ',', "'2'", ',', "'3'", ')',...
Workhorse function for the above, where ``contourfunc`` is the contour plotting function to use for actual plotting.
['Workhorse', 'function', 'for', 'the', 'above', 'where', 'contourfunc', 'is', 'the', 'contour', 'plotting', 'function', 'to', 'use', 'for', 'actual', 'plotting', '.']
train
https://github.com/ericsuh/dirichlet/blob/bf39a6d219348cbb4ed95dc195587a9c55c633b9/dirichlet/simplex.py#L96-L114
1,455
hyperledger/indy-plenum
plenum/server/node.py
Node.handleOneNodeMsg
def handleOneNodeMsg(self, wrappedMsg): """ Validate and process one message from a node. :param wrappedMsg: Tuple of message and the name of the node that sent the message """ try: vmsg = self.validateNodeMsg(wrappedMsg) if vmsg: ...
python
def handleOneNodeMsg(self, wrappedMsg): """ Validate and process one message from a node. :param wrappedMsg: Tuple of message and the name of the node that sent the message """ try: vmsg = self.validateNodeMsg(wrappedMsg) if vmsg: ...
['def', 'handleOneNodeMsg', '(', 'self', ',', 'wrappedMsg', ')', ':', 'try', ':', 'vmsg', '=', 'self', '.', 'validateNodeMsg', '(', 'wrappedMsg', ')', 'if', 'vmsg', ':', 'logger', '.', 'trace', '(', '"{} msg validated {}"', '.', 'format', '(', 'self', ',', 'wrappedMsg', ')', ',', 'extra', '=', '{', '"tags"', ':', '[', ...
Validate and process one message from a node. :param wrappedMsg: Tuple of message and the name of the node that sent the message
['Validate', 'and', 'process', 'one', 'message', 'from', 'a', 'node', '.']
train
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1867-L1887
1,456
rm-hull/luma.core
luma/core/sprite_system.py
framerate_regulator.effective_FPS
def effective_FPS(self): """ Calculates the effective frames-per-second - this should largely correlate to the desired FPS supplied in the constructor, but no guarantees are given. :returns: The effective frame rate. :rtype: float """ if self.start_time i...
python
def effective_FPS(self): """ Calculates the effective frames-per-second - this should largely correlate to the desired FPS supplied in the constructor, but no guarantees are given. :returns: The effective frame rate. :rtype: float """ if self.start_time i...
['def', 'effective_FPS', '(', 'self', ')', ':', 'if', 'self', '.', 'start_time', 'is', 'None', ':', 'self', '.', 'start_time', '=', '0', 'elapsed', '=', 'monotonic', '(', ')', '-', 'self', '.', 'start_time', 'return', 'self', '.', 'called', '/', 'elapsed']
Calculates the effective frames-per-second - this should largely correlate to the desired FPS supplied in the constructor, but no guarantees are given. :returns: The effective frame rate. :rtype: float
['Calculates', 'the', 'effective', 'frames', '-', 'per', '-', 'second', '-', 'this', 'should', 'largely', 'correlate', 'to', 'the', 'desired', 'FPS', 'supplied', 'in', 'the', 'constructor', 'but', 'no', 'guarantees', 'are', 'given', '.']
train
https://github.com/rm-hull/luma.core/blob/034b628fb304a01e77732a299c0b42e94d6443db/luma/core/sprite_system.py#L216-L228
1,457
DLR-RM/RAFCON
source/rafcon/core/states/container_state.py
ContainerState._check_transition_target
def _check_transition_target(self, transition): """Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the ...
python
def _check_transition_target(self, transition): """Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the ...
['def', '_check_transition_target', '(', 'self', ',', 'transition', ')', ':', 'to_state_id', '=', 'transition', '.', 'to_state', 'to_outcome_id', '=', 'transition', '.', 'to_outcome', 'if', 'to_state_id', '==', 'self', '.', 'state_id', ':', 'if', 'to_outcome_id', 'not', 'in', 'self', '.', 'outcomes', ':', 'return', 'Fa...
Checks the validity of a transition target Checks whether the transition target is valid. :param rafcon.core.transition.Transition transition: The transition to be checked :return bool validity, str message: validity is True, when the transition is valid, False else. message gives ...
['Checks', 'the', 'validity', 'of', 'a', 'transition', 'target']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/container_state.py#L1978-L2000
1,458
EpistasisLab/tpot
tpot/builtins/feature_set_selector.py
FeatureSetSelector.fit
def fit(self, X, y=None): """Fit FeatureSetSelector for feature selection Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to cla...
python
def fit(self, X, y=None): """Fit FeatureSetSelector for feature selection Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to cla...
['def', 'fit', '(', 'self', ',', 'X', ',', 'y', '=', 'None', ')', ':', 'subset_df', '=', 'pd', '.', 'read_csv', '(', 'self', '.', 'subset_list', ',', 'header', '=', '0', ',', 'index_col', '=', '0', ')', 'if', 'isinstance', '(', 'self', '.', 'sel_subset', ',', 'int', ')', ':', 'self', '.', 'sel_subset_name', '=', 'subse...
Fit FeatureSetSelector for feature selection Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to classes in classification, real numbers ...
['Fit', 'FeatureSetSelector', 'for', 'feature', 'selection']
train
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/feature_set_selector.py#L66-L114
1,459
numenta/htmresearch
projects/speech_commands/analyze_experiment.py
findOptimalResults
def findOptimalResults(expName, suite, outFile): """ Go through every experiment in the specified folder. For each experiment, find the iteration with the best validation score, and return the metrics associated with that iteration. """ writer = csv.writer(outFile) headers = ["testAccuracy", "bgAccuracy",...
python
def findOptimalResults(expName, suite, outFile): """ Go through every experiment in the specified folder. For each experiment, find the iteration with the best validation score, and return the metrics associated with that iteration. """ writer = csv.writer(outFile) headers = ["testAccuracy", "bgAccuracy",...
['def', 'findOptimalResults', '(', 'expName', ',', 'suite', ',', 'outFile', ')', ':', 'writer', '=', 'csv', '.', 'writer', '(', 'outFile', ')', 'headers', '=', '[', '"testAccuracy"', ',', '"bgAccuracy"', ',', '"maxTotalAccuracy"', ',', '"experiment path"', ']', 'writer', '.', 'writerow', '(', 'headers', ')', 'info', '=...
Go through every experiment in the specified folder. For each experiment, find the iteration with the best validation score, and return the metrics associated with that iteration.
['Go', 'through', 'every', 'experiment', 'in', 'the', 'specified', 'folder', '.', 'For', 'each', 'experiment', 'find', 'the', 'iteration', 'with', 'the', 'best', 'validation', 'score', 'and', 'return', 'the', 'metrics', 'associated', 'with', 'that', 'iteration', '.']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/speech_commands/analyze_experiment.py#L189-L216
1,460
bitprophet/ssh
ssh/sftp_client.py
SFTPClient.readlink
def readlink(self, path): """ Return the target of a symbolic link (shortcut). You can use L{symlink} to create these. The result may be either an absolute or relative pathname. @param path: path of the symbolic link file @type path: str @return: target path ...
python
def readlink(self, path): """ Return the target of a symbolic link (shortcut). You can use L{symlink} to create these. The result may be either an absolute or relative pathname. @param path: path of the symbolic link file @type path: str @return: target path ...
['def', 'readlink', '(', 'self', ',', 'path', ')', ':', 'path', '=', 'self', '.', '_adjust_cwd', '(', 'path', ')', 'self', '.', '_log', '(', 'DEBUG', ',', "'readlink(%r)'", '%', 'path', ')', 't', ',', 'msg', '=', 'self', '.', '_request', '(', 'CMD_READLINK', ',', 'path', ')', 'if', 't', '!=', 'CMD_NAME', ':', 'raise', ...
Return the target of a symbolic link (shortcut). You can use L{symlink} to create these. The result may be either an absolute or relative pathname. @param path: path of the symbolic link file @type path: str @return: target path @rtype: str
['Return', 'the', 'target', 'of', 'a', 'symbolic', 'link', '(', 'shortcut', ')', '.', 'You', 'can', 'use', 'L', '{', 'symlink', '}', 'to', 'create', 'these', '.', 'The', 'result', 'may', 'be', 'either', 'an', 'absolute', 'or', 'relative', 'pathname', '.']
train
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/sftp_client.py#L453-L474
1,461
moonso/loqusdb
loqusdb/utils/load.py
load_variants
def load_variants(adapter, vcf_obj, case_obj, skip_case_id=False, gq_treshold=None, max_window=3000, variant_type='snv'): """Load variants for a family into the database. Args: adapter (loqusdb.plugins.Adapter): initialized plugin case_obj(Case): dict with case information ...
python
def load_variants(adapter, vcf_obj, case_obj, skip_case_id=False, gq_treshold=None, max_window=3000, variant_type='snv'): """Load variants for a family into the database. Args: adapter (loqusdb.plugins.Adapter): initialized plugin case_obj(Case): dict with case information ...
['def', 'load_variants', '(', 'adapter', ',', 'vcf_obj', ',', 'case_obj', ',', 'skip_case_id', '=', 'False', ',', 'gq_treshold', '=', 'None', ',', 'max_window', '=', '3000', ',', 'variant_type', '=', "'snv'", ')', ':', 'if', 'variant_type', '==', "'snv'", ':', 'nr_variants', '=', 'case_obj', '[', "'nr_variants'", ']', ...
Load variants for a family into the database. Args: adapter (loqusdb.plugins.Adapter): initialized plugin case_obj(Case): dict with case information nr_variants(int) skip_case_id (bool): whether to include the case id on variant level or not gq_t...
['Load', 'variants', 'for', 'a', 'family', 'into', 'the', 'database', '.']
train
https://github.com/moonso/loqusdb/blob/792dcd0d461aff5adc703c49eebf58964913a513/loqusdb/utils/load.py#L179-L222
1,462
PSPC-SPAC-buyandsell/von_anchor
von_anchor/wallet/wallet.py
Wallet.reseed_init
async def reseed_init(self, next_seed: str = None) -> str: """ Begin reseed operation: generate new key. Raise WalletState if wallet is closed. :param next_seed: incoming replacement seed (default random) :return: new verification key """ LOGGER.debug('Wallet.reseed_ini...
python
async def reseed_init(self, next_seed: str = None) -> str: """ Begin reseed operation: generate new key. Raise WalletState if wallet is closed. :param next_seed: incoming replacement seed (default random) :return: new verification key """ LOGGER.debug('Wallet.reseed_ini...
['async', 'def', 'reseed_init', '(', 'self', ',', 'next_seed', ':', 'str', '=', 'None', ')', '->', 'str', ':', 'LOGGER', '.', 'debug', '(', "'Wallet.reseed_init >>> next_seed: [SEED]'", ')', 'if', 'not', 'self', '.', 'handle', ':', 'LOGGER', '.', 'debug', '(', "'Wallet.reseed_init <!< Wallet %s is closed'", ',', 'self'...
Begin reseed operation: generate new key. Raise WalletState if wallet is closed. :param next_seed: incoming replacement seed (default random) :return: new verification key
['Begin', 'reseed', 'operation', ':', 'generate', 'new', 'key', '.', 'Raise', 'WalletState', 'if', 'wallet', 'is', 'closed', '.']
train
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/wallet/wallet.py#L1254-L1270
1,463
ThreatConnect-Inc/tcex
tcex/tcex_ti_group.py
Group.tag
def tag(self, name, formatter=None): """Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag. """ ...
python
def tag(self, name, formatter=None): """Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag. """ ...
['def', 'tag', '(', 'self', ',', 'name', ',', 'formatter', '=', 'None', ')', ':', 'tag', '=', 'Tag', '(', 'name', ',', 'formatter', ')', 'for', 'tag_data', 'in', 'self', '.', '_tags', ':', 'if', 'tag_data', '.', 'name', '==', 'name', ':', 'tag', '=', 'tag_data', 'break', 'else', ':', 'self', '.', '_tags', '.', 'append'...
Return instance of Tag. Args: name (str): The value for this tag. formatter (method, optional): A method that take a tag value and returns a formatted tag. Returns: obj: An instance of Tag.
['Return', 'instance', 'of', 'Tag', '.']
train
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_group.py#L239-L257
1,464
pandas-dev/pandas
pandas/util/_validators.py
validate_bool_kwarg
def validate_bool_kwarg(value, arg_name): """ Ensures that argument passed in arg_name is of type bool. """ if not (is_bool(value) or value is None): raise ValueError('For argument "{arg}" expected type bool, received ' 'type {typ}.'.format(arg=arg_name, ...
python
def validate_bool_kwarg(value, arg_name): """ Ensures that argument passed in arg_name is of type bool. """ if not (is_bool(value) or value is None): raise ValueError('For argument "{arg}" expected type bool, received ' 'type {typ}.'.format(arg=arg_name, ...
['def', 'validate_bool_kwarg', '(', 'value', ',', 'arg_name', ')', ':', 'if', 'not', '(', 'is_bool', '(', 'value', ')', 'or', 'value', 'is', 'None', ')', ':', 'raise', 'ValueError', '(', '\'For argument "{arg}" expected type bool, received \'', "'type {typ}.'", '.', 'format', '(', 'arg', '=', 'arg_name', ',', 'typ', '=...
Ensures that argument passed in arg_name is of type bool.
['Ensures', 'that', 'argument', 'passed', 'in', 'arg_name', 'is', 'of', 'type', 'bool', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_validators.py#L221-L227
1,465
smarie/python-parsyfiles
parsyfiles/plugins_base/support_for_primitive_types.py
_can_construct_from_str
def _can_construct_from_str(strict_mode: bool, from_type: Type, to_type: Type) -> bool: """ Returns true if the provided types are valid for constructor_with_str_arg conversion Explicitly declare that we are not able to convert primitive types (they already have their own converters) :param strict_mode...
python
def _can_construct_from_str(strict_mode: bool, from_type: Type, to_type: Type) -> bool: """ Returns true if the provided types are valid for constructor_with_str_arg conversion Explicitly declare that we are not able to convert primitive types (they already have their own converters) :param strict_mode...
['def', '_can_construct_from_str', '(', 'strict_mode', ':', 'bool', ',', 'from_type', ':', 'Type', ',', 'to_type', ':', 'Type', ')', '->', 'bool', ':', 'return', 'to_type', 'not', 'in', '{', 'int', ',', 'float', ',', 'bool', '}']
Returns true if the provided types are valid for constructor_with_str_arg conversion Explicitly declare that we are not able to convert primitive types (they already have their own converters) :param strict_mode: :param from_type: :param to_type: :return:
['Returns', 'true', 'if', 'the', 'provided', 'types', 'are', 'valid', 'for', 'constructor_with_str_arg', 'conversion', 'Explicitly', 'declare', 'that', 'we', 'are', 'not', 'able', 'to', 'convert', 'primitive', 'types', '(', 'they', 'already', 'have', 'their', 'own', 'converters', ')']
train
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_base/support_for_primitive_types.py#L121-L131
1,466
boriel/zxbasic
arch/zx48k/optimizer.py
BasicBlock.is_used
def is_used(self, regs, i, top=None): """ Checks whether any of the given regs are required from the given point to the end or not. """ if i < 0: i = 0 if self.lock: return True regs = list(regs) # make a copy if top is None: ...
python
def is_used(self, regs, i, top=None): """ Checks whether any of the given regs are required from the given point to the end or not. """ if i < 0: i = 0 if self.lock: return True regs = list(regs) # make a copy if top is None: ...
['def', 'is_used', '(', 'self', ',', 'regs', ',', 'i', ',', 'top', '=', 'None', ')', ':', 'if', 'i', '<', '0', ':', 'i', '=', '0', 'if', 'self', '.', 'lock', ':', 'return', 'True', 'regs', '=', 'list', '(', 'regs', ')', '# make a copy', 'if', 'top', 'is', 'None', ':', 'top', '=', 'len', '(', 'self', ')', 'else', ':', '...
Checks whether any of the given regs are required from the given point to the end or not.
['Checks', 'whether', 'any', 'of', 'the', 'given', 'regs', 'are', 'required', 'from', 'the', 'given', 'point', 'to', 'the', 'end', 'or', 'not', '.']
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/optimizer.py#L1531-L1563
1,467
welchbj/sublemon
sublemon/subprocess.py
SublemonSubprocess.wait_done
async def wait_done(self) -> int: """Coroutine to wait for subprocess run completion. Returns: The exit code of the subprocess. """ await self._done_running_evt.wait() if self._exit_code is None: raise SublemonLifetimeError( 'Subprocess e...
python
async def wait_done(self) -> int: """Coroutine to wait for subprocess run completion. Returns: The exit code of the subprocess. """ await self._done_running_evt.wait() if self._exit_code is None: raise SublemonLifetimeError( 'Subprocess e...
['async', 'def', 'wait_done', '(', 'self', ')', '->', 'int', ':', 'await', 'self', '.', '_done_running_evt', '.', 'wait', '(', ')', 'if', 'self', '.', '_exit_code', 'is', 'None', ':', 'raise', 'SublemonLifetimeError', '(', "'Subprocess exited abnormally with `None` exit code'", ')', 'return', 'self', '.', '_exit_code']
Coroutine to wait for subprocess run completion. Returns: The exit code of the subprocess.
['Coroutine', 'to', 'wait', 'for', 'subprocess', 'run', 'completion', '.']
train
https://github.com/welchbj/sublemon/blob/edbfd1ca2a0ce3de9470dfc88f8db1cadf4b6326/sublemon/subprocess.py#L67-L78
1,468
frmdstryr/enamlx
enamlx/qt/qt_plot_area.py
AbstractQtPlotItem._refresh_multi_axis
def _refresh_multi_axis(self): """ If linked axis' are used, setup and link them """ d = self.declaration #: Create a separate viewbox self.viewbox = pg.ViewBox() #: If this is the first nested plot, use the parent right axis _plots = [c for c in self.pa...
python
def _refresh_multi_axis(self): """ If linked axis' are used, setup and link them """ d = self.declaration #: Create a separate viewbox self.viewbox = pg.ViewBox() #: If this is the first nested plot, use the parent right axis _plots = [c for c in self.pa...
['def', '_refresh_multi_axis', '(', 'self', ')', ':', 'd', '=', 'self', '.', 'declaration', '#: Create a separate viewbox', 'self', '.', 'viewbox', '=', 'pg', '.', 'ViewBox', '(', ')', '#: If this is the first nested plot, use the parent right axis', '_plots', '=', '[', 'c', 'for', 'c', 'in', 'self', '.', 'parent', '('...
If linked axis' are used, setup and link them
['If', 'linked', 'axis', 'are', 'used', 'setup', 'and', 'link', 'them']
train
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_plot_area.py#L174-L204
1,469
fhcrc/seqmagick
seqmagick/subcommands/quality_filter.py
moving_average
def moving_average(iterable, n): """ From Python collections module documentation moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0 """ it = iter(iterable) d = collections.deque(itertools.islice(it, n - 1)) d.appendleft(0) s = sum(d) for elem in it: s += elem ...
python
def moving_average(iterable, n): """ From Python collections module documentation moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0 """ it = iter(iterable) d = collections.deque(itertools.islice(it, n - 1)) d.appendleft(0) s = sum(d) for elem in it: s += elem ...
['def', 'moving_average', '(', 'iterable', ',', 'n', ')', ':', 'it', '=', 'iter', '(', 'iterable', ')', 'd', '=', 'collections', '.', 'deque', '(', 'itertools', '.', 'islice', '(', 'it', ',', 'n', '-', '1', ')', ')', 'd', '.', 'appendleft', '(', '0', ')', 's', '=', 'sum', '(', 'd', ')', 'for', 'elem', 'in', 'it', ':', ...
From Python collections module documentation moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0
['From', 'Python', 'collections', 'module', 'documentation']
train
https://github.com/fhcrc/seqmagick/blob/1642bb87ba5c171fbd307f9da0f8a0ee1d69d5ed/seqmagick/subcommands/quality_filter.py#L204-L217
1,470
threeML/astromodels
astromodels/functions/priors.py
Gaussian.from_unit_cube
def from_unit_cube(self, x): """ Used by multinest :param x: 0 < x < 1 :param lower_bound: :param upper_bound: :return: """ mu = self.mu.value sigma = self.sigma.value sqrt_two = 1.414213562 if x < 1e-16 or (1 - x) < 1e-16: ...
python
def from_unit_cube(self, x): """ Used by multinest :param x: 0 < x < 1 :param lower_bound: :param upper_bound: :return: """ mu = self.mu.value sigma = self.sigma.value sqrt_two = 1.414213562 if x < 1e-16 or (1 - x) < 1e-16: ...
['def', 'from_unit_cube', '(', 'self', ',', 'x', ')', ':', 'mu', '=', 'self', '.', 'mu', '.', 'value', 'sigma', '=', 'self', '.', 'sigma', '.', 'value', 'sqrt_two', '=', '1.414213562', 'if', 'x', '<', '1e-16', 'or', '(', '1', '-', 'x', ')', '<', '1e-16', ':', 'res', '=', '-', '1e32', 'else', ':', 'res', '=', 'mu', '+',...
Used by multinest :param x: 0 < x < 1 :param lower_bound: :param upper_bound: :return:
['Used', 'by', 'multinest']
train
https://github.com/threeML/astromodels/blob/9aac365a372f77603039533df9a6b694c1e360d5/astromodels/functions/priors.py#L75-L98
1,471
django-fluent/django-fluent-dashboard
fluent_dashboard/modules.py
CacheStatusGroup.init_with_context
def init_with_context(self, context): """ Initializes the status list. """ super(CacheStatusGroup, self).init_with_context(context) if 'dashboardmods' in settings.INSTALLED_APPS: import dashboardmods memcache_mods = dashboardmods.get_memcache_dash_modules...
python
def init_with_context(self, context): """ Initializes the status list. """ super(CacheStatusGroup, self).init_with_context(context) if 'dashboardmods' in settings.INSTALLED_APPS: import dashboardmods memcache_mods = dashboardmods.get_memcache_dash_modules...
['def', 'init_with_context', '(', 'self', ',', 'context', ')', ':', 'super', '(', 'CacheStatusGroup', ',', 'self', ')', '.', 'init_with_context', '(', 'context', ')', 'if', "'dashboardmods'", 'in', 'settings', '.', 'INSTALLED_APPS', ':', 'import', 'dashboardmods', 'memcache_mods', '=', 'dashboardmods', '.', 'get_memcac...
Initializes the status list.
['Initializes', 'the', 'status', 'list', '.']
train
https://github.com/django-fluent/django-fluent-dashboard/blob/aee7ef39e0586cd160036b13b7944b69cd2b4b8c/fluent_dashboard/modules.py#L250-L270
1,472
hydraplatform/hydra-base
hydra_base/util/hdb.py
add_resource_types
def add_resource_types(resource_i, types): """ Save a reference to the types used for this resource. @returns a list of type_ids representing the type ids on the resource. """ if types is None: return [] existing_type_ids = [] if resource_i.types: for t in resource_i.t...
python
def add_resource_types(resource_i, types): """ Save a reference to the types used for this resource. @returns a list of type_ids representing the type ids on the resource. """ if types is None: return [] existing_type_ids = [] if resource_i.types: for t in resource_i.t...
['def', 'add_resource_types', '(', 'resource_i', ',', 'types', ')', ':', 'if', 'types', 'is', 'None', ':', 'return', '[', ']', 'existing_type_ids', '=', '[', ']', 'if', 'resource_i', '.', 'types', ':', 'for', 't', 'in', 'resource_i', '.', 'types', ':', 'existing_type_ids', '.', 'append', '(', 't', '.', 'type_id', ')', ...
Save a reference to the types used for this resource. @returns a list of type_ids representing the type ids on the resource.
['Save', 'a', 'reference', 'to', 'the', 'types', 'used', 'for', 'this', 'resource', '.']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/util/hdb.py#L37-L71
1,473
sorgerlab/indra
indra/preassembler/__init__.py
Preassembler._get_stmt_by_group
def _get_stmt_by_group(self, stmt_type, stmts_this_type, eh): """Group Statements of `stmt_type` by their hierarchical relations.""" # Dict of stmt group key tuples, indexed by their first Agent stmt_by_first = collections.defaultdict(lambda: []) # Dict of stmt group key tuples, indexed ...
python
def _get_stmt_by_group(self, stmt_type, stmts_this_type, eh): """Group Statements of `stmt_type` by their hierarchical relations.""" # Dict of stmt group key tuples, indexed by their first Agent stmt_by_first = collections.defaultdict(lambda: []) # Dict of stmt group key tuples, indexed ...
['def', '_get_stmt_by_group', '(', 'self', ',', 'stmt_type', ',', 'stmts_this_type', ',', 'eh', ')', ':', '# Dict of stmt group key tuples, indexed by their first Agent', 'stmt_by_first', '=', 'collections', '.', 'defaultdict', '(', 'lambda', ':', '[', ']', ')', '# Dict of stmt group key tuples, indexed by their second...
Group Statements of `stmt_type` by their hierarchical relations.
['Group', 'Statements', 'of', 'stmt_type', 'by', 'their', 'hierarchical', 'relations', '.']
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L220-L326
1,474
saltstack/salt
salt/states/file.py
_gen_keep_files
def _gen_keep_files(name, require, walk_d=None): ''' Generate the list of files that need to be kept when a dir based function like directory or recurse has a clean. ''' def _is_child(path, directory): ''' Check whether ``path`` is child of ``directory`` ''' path = os...
python
def _gen_keep_files(name, require, walk_d=None): ''' Generate the list of files that need to be kept when a dir based function like directory or recurse has a clean. ''' def _is_child(path, directory): ''' Check whether ``path`` is child of ``directory`` ''' path = os...
['def', '_gen_keep_files', '(', 'name', ',', 'require', ',', 'walk_d', '=', 'None', ')', ':', 'def', '_is_child', '(', 'path', ',', 'directory', ')', ':', "'''\n Check whether ``path`` is child of ``directory``\n '''", 'path', '=', 'os', '.', 'path', '.', 'abspath', '(', 'path', ')', 'directory', '=', 'os...
Generate the list of files that need to be kept when a dir based function like directory or recurse has a clean.
['Generate', 'the', 'list', 'of', 'files', 'that', 'need', 'to', 'be', 'kept', 'when', 'a', 'dir', 'based', 'function', 'like', 'directory', 'or', 'recurse', 'has', 'a', 'clean', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/file.py#L559-L631
1,475
ngmarchant/oasis
oasis/kad.py
KadaneSampler._sample_item
def _sample_item(self, **kwargs): """Sample an item from the pool according to the instrumental distribution """ t = self.t_ if 'fixed_stratum' in kwargs: stratum_idx = kwargs['fixed_stratum'] else: stratum_idx = None if stratum_idx is not ...
python
def _sample_item(self, **kwargs): """Sample an item from the pool according to the instrumental distribution """ t = self.t_ if 'fixed_stratum' in kwargs: stratum_idx = kwargs['fixed_stratum'] else: stratum_idx = None if stratum_idx is not ...
['def', '_sample_item', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 't', '=', 'self', '.', 't_', 'if', "'fixed_stratum'", 'in', 'kwargs', ':', 'stratum_idx', '=', 'kwargs', '[', "'fixed_stratum'", ']', 'else', ':', 'stratum_idx', '=', 'None', 'if', 'stratum_idx', 'is', 'not', 'None', ':', '# Sample in given stratum...
Sample an item from the pool according to the instrumental distribution
['Sample', 'an', 'item', 'from', 'the', 'pool', 'according', 'to', 'the', 'instrumental', 'distribution']
train
https://github.com/ngmarchant/oasis/blob/28a037a8924b85ae97db8a93960a910a219d6a4a/oasis/kad.py#L105-L131
1,476
Ezhil-Language-Foundation/open-tamil
tamil/utf8.py
uyirmei_constructed
def uyirmei_constructed( mei_idx, uyir_idx): """ construct uyirmei letter give mei index and uyir index """ idx,idy = mei_idx,uyir_idx assert ( idy >= 0 and idy < uyir_len() ) assert ( idx >= 0 and idx < 6+mei_len() ) return grantha_agaram_letters[mei_idx]+accent_symbols[uyir_idx]
python
def uyirmei_constructed( mei_idx, uyir_idx): """ construct uyirmei letter give mei index and uyir index """ idx,idy = mei_idx,uyir_idx assert ( idy >= 0 and idy < uyir_len() ) assert ( idx >= 0 and idx < 6+mei_len() ) return grantha_agaram_letters[mei_idx]+accent_symbols[uyir_idx]
['def', 'uyirmei_constructed', '(', 'mei_idx', ',', 'uyir_idx', ')', ':', 'idx', ',', 'idy', '=', 'mei_idx', ',', 'uyir_idx', 'assert', '(', 'idy', '>=', '0', 'and', 'idy', '<', 'uyir_len', '(', ')', ')', 'assert', '(', 'idx', '>=', '0', 'and', 'idx', '<', '6', '+', 'mei_len', '(', ')', ')', 'return', 'grantha_agaram_l...
construct uyirmei letter give mei index and uyir index
['construct', 'uyirmei', 'letter', 'give', 'mei', 'index', 'and', 'uyir', 'index']
train
https://github.com/Ezhil-Language-Foundation/open-tamil/blob/b7556e88878d29bbc6c944ee17cdd3f75b8ea9f0/tamil/utf8.py#L265-L270
1,477
openstack/networking-cisco
networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py
CiscoUcsmDriver._delete_vlan_profile
def _delete_vlan_profile(self, handle, vlan_id, ucsm_ip): """Deletes VLAN Profile from UCS Manager.""" vlan_name = self.make_vlan_name(vlan_id) vlan_profile_dest = (const.VLAN_PATH + const.VLAN_PROFILE_PATH_PREFIX + vlan_name) try: handle.StartTra...
python
def _delete_vlan_profile(self, handle, vlan_id, ucsm_ip): """Deletes VLAN Profile from UCS Manager.""" vlan_name = self.make_vlan_name(vlan_id) vlan_profile_dest = (const.VLAN_PATH + const.VLAN_PROFILE_PATH_PREFIX + vlan_name) try: handle.StartTra...
['def', '_delete_vlan_profile', '(', 'self', ',', 'handle', ',', 'vlan_id', ',', 'ucsm_ip', ')', ':', 'vlan_name', '=', 'self', '.', 'make_vlan_name', '(', 'vlan_id', ')', 'vlan_profile_dest', '=', '(', 'const', '.', 'VLAN_PATH', '+', 'const', '.', 'VLAN_PROFILE_PATH_PREFIX', '+', 'vlan_name', ')', 'try', ':', 'handle'...
Deletes VLAN Profile from UCS Manager.
['Deletes', 'VLAN', 'Profile', 'from', 'UCS', 'Manager', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/ucsm/deprecated_network_driver.py#L706-L727
1,478
fedora-infra/fedmsg
fedmsg/core.py
FedMsgContext.tail_messages
def tail_messages(self, topic="", passive=False, **kw): """ Subscribe to messages published on the sockets listed in :ref:`conf-endpoints`. Args: topic (six.text_type): The topic to subscribe to. The default is to subscribe to all topics. passive (bool): ...
python
def tail_messages(self, topic="", passive=False, **kw): """ Subscribe to messages published on the sockets listed in :ref:`conf-endpoints`. Args: topic (six.text_type): The topic to subscribe to. The default is to subscribe to all topics. passive (bool): ...
['def', 'tail_messages', '(', 'self', ',', 'topic', '=', '""', ',', 'passive', '=', 'False', ',', '*', '*', 'kw', ')', ':', 'if', 'not', 'self', '.', 'c', '.', 'get', '(', "'zmq_enabled'", ',', 'True', ')', ':', 'raise', 'ValueError', '(', '"fedmsg.tail_messages() is only available for "', '"zeromq. Use the hub-consum...
Subscribe to messages published on the sockets listed in :ref:`conf-endpoints`. Args: topic (six.text_type): The topic to subscribe to. The default is to subscribe to all topics. passive (bool): If ``True``, bind to the :ref:`conf-endpoints` sockets inste...
['Subscribe', 'to', 'messages', 'published', 'on', 'the', 'sockets', 'listed', 'in', ':', 'ref', ':', 'conf', '-', 'endpoints', '.']
train
https://github.com/fedora-infra/fedmsg/blob/c21d6b3ce023fc3c0e881c704f5b55fb6e6392d7/fedmsg/core.py#L345-L370
1,479
TAPPGuild/bitjws
bitjws/jws.py
_jws_header
def _jws_header(keyid, algorithm): """Produce a base64-encoded JWS header.""" data = { 'typ': 'JWT', 'alg': algorithm.name, # 'kid' is used to indicate the public part of the key # used during signing. 'kid': keyid } datajson = json.dumps(data, sort_keys=True).en...
python
def _jws_header(keyid, algorithm): """Produce a base64-encoded JWS header.""" data = { 'typ': 'JWT', 'alg': algorithm.name, # 'kid' is used to indicate the public part of the key # used during signing. 'kid': keyid } datajson = json.dumps(data, sort_keys=True).en...
['def', '_jws_header', '(', 'keyid', ',', 'algorithm', ')', ':', 'data', '=', '{', "'typ'", ':', "'JWT'", ',', "'alg'", ':', 'algorithm', '.', 'name', ',', "# 'kid' is used to indicate the public part of the key", '# used during signing.', "'kid'", ':', 'keyid', '}', 'datajson', '=', 'json', '.', 'dumps', '(', 'data', ...
Produce a base64-encoded JWS header.
['Produce', 'a', 'base64', '-', 'encoded', 'JWS', 'header', '.']
train
https://github.com/TAPPGuild/bitjws/blob/bcf943e0c60985da11fb7895a416525e63728c35/bitjws/jws.py#L70-L81
1,480
gwastro/pycbc
pycbc/pnutils.py
energy_coefficients
def energy_coefficients(m1, m2, s1z=0, s2z=0, phase_order=-1, spin_order=-1): """ Return the energy coefficients. This assumes that the system has aligned spins only. """ implemented_phase_order = 7 implemented_spin_order = 7 if phase_order > implemented_phase_order: raise ValueError("pN coe...
python
def energy_coefficients(m1, m2, s1z=0, s2z=0, phase_order=-1, spin_order=-1): """ Return the energy coefficients. This assumes that the system has aligned spins only. """ implemented_phase_order = 7 implemented_spin_order = 7 if phase_order > implemented_phase_order: raise ValueError("pN coe...
['def', 'energy_coefficients', '(', 'm1', ',', 'm2', ',', 's1z', '=', '0', ',', 's2z', '=', '0', ',', 'phase_order', '=', '-', '1', ',', 'spin_order', '=', '-', '1', ')', ':', 'implemented_phase_order', '=', '7', 'implemented_spin_order', '=', '7', 'if', 'phase_order', '>', 'implemented_phase_order', ':', 'raise', 'Val...
Return the energy coefficients. This assumes that the system has aligned spins only.
['Return', 'the', 'energy', 'coefficients', '.', 'This', 'assumes', 'that', 'the', 'system', 'has', 'aligned', 'spins', 'only', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/pnutils.py#L689-L762
1,481
manolomartinez/greg
greg/classes.py
Session.retrieve_data_directory
def retrieve_data_directory(self): """ Retrieve the data directory Look first into config_filename_global then into config_filename_user. The latter takes preeminence. """ args = self.args try: if args['datadirectory']: aux.ensure_dir(a...
python
def retrieve_data_directory(self): """ Retrieve the data directory Look first into config_filename_global then into config_filename_user. The latter takes preeminence. """ args = self.args try: if args['datadirectory']: aux.ensure_dir(a...
['def', 'retrieve_data_directory', '(', 'self', ')', ':', 'args', '=', 'self', '.', 'args', 'try', ':', 'if', 'args', '[', "'datadirectory'", ']', ':', 'aux', '.', 'ensure_dir', '(', 'args', '[', "'datadirectory'", ']', ')', 'return', 'args', '[', "'datadirectory'", ']', 'except', 'KeyError', ':', 'pass', 'config', '='...
Retrieve the data directory Look first into config_filename_global then into config_filename_user. The latter takes preeminence.
['Retrieve', 'the', 'data', 'directory', 'Look', 'first', 'into', 'config_filename_global', 'then', 'into', 'config_filename_user', '.', 'The', 'latter', 'takes', 'preeminence', '.']
train
https://github.com/manolomartinez/greg/blob/63bb24197c13087a01963ac439cd8380007d9467/greg/classes.py#L71-L91
1,482
Robin8Put/pmes
ams/utils/pagination.py
Paginator.get_range
def get_range(self): """ Get range """ if not self.page: return (1, self.last_blocks[self.coinid]) # Get start of the range start = self.page * self.limit # Get finish of the range end = (self.page + 1) * self.limit if start > self.last_blocks[self.coinid]: return (1,1) if end > self.last_bloc...
python
def get_range(self): """ Get range """ if not self.page: return (1, self.last_blocks[self.coinid]) # Get start of the range start = self.page * self.limit # Get finish of the range end = (self.page + 1) * self.limit if start > self.last_blocks[self.coinid]: return (1,1) if end > self.last_bloc...
['def', 'get_range', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'page', ':', 'return', '(', '1', ',', 'self', '.', 'last_blocks', '[', 'self', '.', 'coinid', ']', ')', '# Get start of the range', 'start', '=', 'self', '.', 'page', '*', 'self', '.', 'limit', '# Get finish of the range', 'end', '=', '(', 'self', '....
Get range
['Get', 'range']
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/ams/utils/pagination.py#L28-L44
1,483
hvac/hvac
hvac/v1/__init__.py
Client.create_vault_ec2_client_configuration
def create_vault_ec2_client_configuration(self, access_key, secret_key, endpoint=None, mount_point='aws-ec2'): """POST /auth/<mount_point>/config/client Configure the credentials required to perform API calls to AWS as well as custom endpoints to talk to AWS APIs. The instance identity document...
python
def create_vault_ec2_client_configuration(self, access_key, secret_key, endpoint=None, mount_point='aws-ec2'): """POST /auth/<mount_point>/config/client Configure the credentials required to perform API calls to AWS as well as custom endpoints to talk to AWS APIs. The instance identity document...
['def', 'create_vault_ec2_client_configuration', '(', 'self', ',', 'access_key', ',', 'secret_key', ',', 'endpoint', '=', 'None', ',', 'mount_point', '=', "'aws-ec2'", ')', ':', 'params', '=', '{', "'access_key'", ':', 'access_key', ',', "'secret_key'", ':', 'secret_key', '}', 'if', 'endpoint', 'is', 'not', 'None', ':'...
POST /auth/<mount_point>/config/client Configure the credentials required to perform API calls to AWS as well as custom endpoints to talk to AWS APIs. The instance identity document fetched from the PKCS#7 signature will provide the EC2 instance ID. The credentials configured using this endpoin...
['POST', '/', 'auth', '/', '<mount_point', '>', '/', 'config', '/', 'client']
train
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/v1/__init__.py#L906-L942
1,484
eonpatapon/contrail-api-cli
contrail_api_cli/resource.py
Resource.parent
def parent(self, resource): """Set parent resource :param resource: parent resource :type resource: Resource :raises ResourceNotFound: resource not found on the API """ resource.check() self['parent_type'] = resource.type self['parent_uuid'] = resource.u...
python
def parent(self, resource): """Set parent resource :param resource: parent resource :type resource: Resource :raises ResourceNotFound: resource not found on the API """ resource.check() self['parent_type'] = resource.type self['parent_uuid'] = resource.u...
['def', 'parent', '(', 'self', ',', 'resource', ')', ':', 'resource', '.', 'check', '(', ')', 'self', '[', "'parent_type'", ']', '=', 'resource', '.', 'type', 'self', '[', "'parent_uuid'", ']', '=', 'resource', '.', 'uuid']
Set parent resource :param resource: parent resource :type resource: Resource :raises ResourceNotFound: resource not found on the API
['Set', 'parent', 'resource']
train
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/resource.py#L550-L560
1,485
cloudant/python-cloudant
src/cloudant/database.py
CouchDatabase._get_view_result
def _get_view_result(view, raw_result, **kwargs): """ Get view results helper. """ if raw_result: return view(**kwargs) if kwargs: return Result(view, **kwargs) return view.result
python
def _get_view_result(view, raw_result, **kwargs): """ Get view results helper. """ if raw_result: return view(**kwargs) if kwargs: return Result(view, **kwargs) return view.result
['def', '_get_view_result', '(', 'view', ',', 'raw_result', ',', '*', '*', 'kwargs', ')', ':', 'if', 'raw_result', ':', 'return', 'view', '(', '*', '*', 'kwargs', ')', 'if', 'kwargs', ':', 'return', 'Result', '(', 'view', ',', '*', '*', 'kwargs', ')', 'return', 'view', '.', 'result']
Get view results helper.
['Get', 'view', 'results', 'helper', '.']
train
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/database.py#L400-L407
1,486
wesyoung/pyzyre
zyre/_zyre_ctypes.py
Zyre.set_header
def set_header(self, name, format, *args): """ Set node header; these are provided to other nodes during discovery and come in each ENTER message. """ return lib.zyre_set_header(self._as_parameter_, name, format, *args)
python
def set_header(self, name, format, *args): """ Set node header; these are provided to other nodes during discovery and come in each ENTER message. """ return lib.zyre_set_header(self._as_parameter_, name, format, *args)
['def', 'set_header', '(', 'self', ',', 'name', ',', 'format', ',', '*', 'args', ')', ':', 'return', 'lib', '.', 'zyre_set_header', '(', 'self', '.', '_as_parameter_', ',', 'name', ',', 'format', ',', '*', 'args', ')']
Set node header; these are provided to other nodes during discovery and come in each ENTER message.
['Set', 'node', 'header', ';', 'these', 'are', 'provided', 'to', 'other', 'nodes', 'during', 'discovery', 'and', 'come', 'in', 'each', 'ENTER', 'message', '.']
train
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/zyre/_zyre_ctypes.py#L226-L231
1,487
KrishnaswamyLab/PHATE
Python/phate/plot.py
scatter2d
def scatter2d(data, **kwargs): """Create a 2D scatter plot Builds upon `matplotlib.pyplot.scatter` with nice defaults and handles categorical colors / legends better. Parameters ---------- data : array-like, shape=[n_samples, n_features] Input data. Only the first two components will b...
python
def scatter2d(data, **kwargs): """Create a 2D scatter plot Builds upon `matplotlib.pyplot.scatter` with nice defaults and handles categorical colors / legends better. Parameters ---------- data : array-like, shape=[n_samples, n_features] Input data. Only the first two components will b...
['def', 'scatter2d', '(', 'data', ',', '*', '*', 'kwargs', ')', ':', 'warnings', '.', 'warn', '(', '"`phate.plot.scatter2d` is deprecated. "', '"Use `scprep.plot.scatter2d` instead."', ',', 'FutureWarning', ')', 'data', '=', '_get_plot_data', '(', 'data', ',', 'ndim', '=', '2', ')', 'return', 'scprep', '.', 'plot', '.'...
Create a 2D scatter plot Builds upon `matplotlib.pyplot.scatter` with nice defaults and handles categorical colors / legends better. Parameters ---------- data : array-like, shape=[n_samples, n_features] Input data. Only the first two components will be used. c : list-like or None, opt...
['Create', 'a', '2D', 'scatter', 'plot']
train
https://github.com/KrishnaswamyLab/PHATE/blob/346a4597dcfc523f8bef99bce482e677282b6719/Python/phate/plot.py#L220-L345
1,488
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py
MAVWPLoader._read_waypoints_v110
def _read_waypoints_v110(self, file): '''read a version 110 waypoint''' comment = '' for line in file: if line.startswith('#'): comment = line[1:].lstrip() continue line = line.strip() if not line: continue ...
python
def _read_waypoints_v110(self, file): '''read a version 110 waypoint''' comment = '' for line in file: if line.startswith('#'): comment = line[1:].lstrip() continue line = line.strip() if not line: continue ...
['def', '_read_waypoints_v110', '(', 'self', ',', 'file', ')', ':', 'comment', '=', "''", 'for', 'line', 'in', 'file', ':', 'if', 'line', '.', 'startswith', '(', "'#'", ')', ':', 'comment', '=', 'line', '[', '1', ':', ']', '.', 'lstrip', '(', ')', 'continue', 'line', '=', 'line', '.', 'strip', '(', ')', 'if', 'not', 'l...
read a version 110 waypoint
['read', 'a', 'version', '110', 'waypoint']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavwp.py#L170-L205
1,489
noahbenson/neuropythy
neuropythy/geometry/util.py
cartesian_to_barycentric_3D
def cartesian_to_barycentric_3D(tri, xy): ''' cartesian_to_barycentric_3D(tri,xy) is identical to cartesian_to_barycentric_2D(tri,xy) except it works on 3D data. Note that if tri is a 3 x 3 x n, a 3 x n x 3 or an n x 3 x 3 matrix, the first dimension must always be the triangle vertices and the second 3...
python
def cartesian_to_barycentric_3D(tri, xy): ''' cartesian_to_barycentric_3D(tri,xy) is identical to cartesian_to_barycentric_2D(tri,xy) except it works on 3D data. Note that if tri is a 3 x 3 x n, a 3 x n x 3 or an n x 3 x 3 matrix, the first dimension must always be the triangle vertices and the second 3...
['def', 'cartesian_to_barycentric_3D', '(', 'tri', ',', 'xy', ')', ':', 'xy', '=', 'np', '.', 'asarray', '(', 'xy', ')', 'tri', '=', 'np', '.', 'asarray', '(', 'tri', ')', 'if', 'len', '(', 'xy', '.', 'shape', ')', '==', '1', ':', 'return', 'cartesian_to_barycentric_3D', '(', 'np', '.', 'transpose', '(', 'np', '.', 'as...
cartesian_to_barycentric_3D(tri,xy) is identical to cartesian_to_barycentric_2D(tri,xy) except it works on 3D data. Note that if tri is a 3 x 3 x n, a 3 x n x 3 or an n x 3 x 3 matrix, the first dimension must always be the triangle vertices and the second 3-sized dimension must be the (x,y,z) coordinates.
['cartesian_to_barycentric_3D', '(', 'tri', 'xy', ')', 'is', 'identical', 'to', 'cartesian_to_barycentric_2D', '(', 'tri', 'xy', ')', 'except', 'it', 'works', 'on', '3D', 'data', '.', 'Note', 'that', 'if', 'tri', 'is', 'a', '3', 'x', '3', 'x', 'n', 'a', '3', 'x', 'n', 'x', '3', 'or', 'an', 'n', 'x', '3', 'x', '3', 'mat...
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/geometry/util.py#L371-L413
1,490
fhcrc/seqmagick
seqmagick/subcommands/quality_filter.py
RecordReportHandler._found_barcode
def _found_barcode(self, record, sample, barcode=None): """Hook called when barcode is found""" assert record.id == self.current_record['sequence_name'] self.current_record['sample'] = sample
python
def _found_barcode(self, record, sample, barcode=None): """Hook called when barcode is found""" assert record.id == self.current_record['sequence_name'] self.current_record['sample'] = sample
['def', '_found_barcode', '(', 'self', ',', 'record', ',', 'sample', ',', 'barcode', '=', 'None', ')', ':', 'assert', 'record', '.', 'id', '==', 'self', '.', 'current_record', '[', "'sequence_name'", ']', 'self', '.', 'current_record', '[', "'sample'", ']', '=', 'sample']
Hook called when barcode is found
['Hook', 'called', 'when', 'barcode', 'is', 'found']
train
https://github.com/fhcrc/seqmagick/blob/1642bb87ba5c171fbd307f9da0f8a0ee1d69d5ed/seqmagick/subcommands/quality_filter.py#L327-L330
1,491
kalefranz/auxlib
auxlib/_vendor/boltons/timeutils.py
daterange
def daterange(start, stop, step=1, inclusive=False): """In the spirit of :func:`range` and :func:`xrange`, the `daterange` generator that yields a sequence of :class:`~datetime.date` objects, starting at *start*, incrementing by *step*, until *stop* is reached. When *inclusive* is True, the final d...
python
def daterange(start, stop, step=1, inclusive=False): """In the spirit of :func:`range` and :func:`xrange`, the `daterange` generator that yields a sequence of :class:`~datetime.date` objects, starting at *start*, incrementing by *step*, until *stop* is reached. When *inclusive* is True, the final d...
['def', 'daterange', '(', 'start', ',', 'stop', ',', 'step', '=', '1', ',', 'inclusive', '=', 'False', ')', ':', 'if', 'not', 'isinstance', '(', 'start', ',', 'date', ')', ':', 'raise', 'TypeError', '(', '"start expected datetime.date instance"', ')', 'if', 'stop', 'and', 'not', 'isinstance', '(', 'stop', ',', 'date', ...
In the spirit of :func:`range` and :func:`xrange`, the `daterange` generator that yields a sequence of :class:`~datetime.date` objects, starting at *start*, incrementing by *step*, until *stop* is reached. When *inclusive* is True, the final date may be *stop*, **if** *step* falls evenly on it. By ...
['In', 'the', 'spirit', 'of', ':', 'func', ':', 'range', 'and', ':', 'func', ':', 'xrange', 'the', 'daterange', 'generator', 'that', 'yields', 'a', 'sequence', 'of', ':', 'class', ':', '~datetime', '.', 'date', 'objects', 'starting', 'at', '*', 'start', '*', 'incrementing', 'by', '*', 'step', '*', 'until', '*', 'stop',...
train
https://github.com/kalefranz/auxlib/blob/6ff2d6b57d128d0b9ed8f01ad83572e938da064f/auxlib/_vendor/boltons/timeutils.py#L280-L364
1,492
pygobject/pgi
pgi/clib/gir/gibaseinfo.py
GIBaseInfo._take_ownership
def _take_ownership(self): """Make the Python instance take ownership of the GIBaseInfo. i.e. unref if the python instance gets gc'ed. """ if self: ptr = cast(self.value, GIBaseInfo) _UnrefFinalizer.track(self, ptr) self.__owns = True
python
def _take_ownership(self): """Make the Python instance take ownership of the GIBaseInfo. i.e. unref if the python instance gets gc'ed. """ if self: ptr = cast(self.value, GIBaseInfo) _UnrefFinalizer.track(self, ptr) self.__owns = True
['def', '_take_ownership', '(', 'self', ')', ':', 'if', 'self', ':', 'ptr', '=', 'cast', '(', 'self', '.', 'value', ',', 'GIBaseInfo', ')', '_UnrefFinalizer', '.', 'track', '(', 'self', ',', 'ptr', ')', 'self', '.', '__owns', '=', 'True']
Make the Python instance take ownership of the GIBaseInfo. i.e. unref if the python instance gets gc'ed.
['Make', 'the', 'Python', 'instance', 'take', 'ownership', 'of', 'the', 'GIBaseInfo', '.', 'i', '.', 'e', '.', 'unref', 'if', 'the', 'python', 'instance', 'gets', 'gc', 'ed', '.']
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/clib/gir/gibaseinfo.py#L61-L69
1,493
jepegit/cellpy
cellpy/readers/cellreader.py
just_load_srno
def just_load_srno(srno, prm_filename=None): """Simply load an dataset based on serial number (srno). This convenience function reads a dataset based on a serial number. This serial number (srno) must then be defined in your database. It is mainly used to check that things are set up correctly. Ar...
python
def just_load_srno(srno, prm_filename=None): """Simply load an dataset based on serial number (srno). This convenience function reads a dataset based on a serial number. This serial number (srno) must then be defined in your database. It is mainly used to check that things are set up correctly. Ar...
['def', 'just_load_srno', '(', 'srno', ',', 'prm_filename', '=', 'None', ')', ':', 'from', 'cellpy', 'import', 'dbreader', ',', 'filefinder', 'print', '(', '"just_load_srno: srno: %i"', '%', 'srno', ')', '# ------------reading parameters--------------------------------------------', '# print "just_load_srno: read prms"...
Simply load an dataset based on serial number (srno). This convenience function reads a dataset based on a serial number. This serial number (srno) must then be defined in your database. It is mainly used to check that things are set up correctly. Args: prm_filename: name of parameter file (op...
['Simply', 'load', 'an', 'dataset', 'based', 'on', 'serial', 'number', '(', 'srno', ')', '.']
train
https://github.com/jepegit/cellpy/blob/9f4a84cdd11f72cfa02cda8c2d7b5174abbb7370/cellpy/readers/cellreader.py#L4223-L4290
1,494
thisfred/val
val/_val.py
BaseSchema.validate
def validate(self, data): """Validate data. Raise NotValid error for invalid data.""" validated = self._validated(data) errors = [] for validator in self.additional_validators: if not validator(validated): errors.append( "%s invalidated by ...
python
def validate(self, data): """Validate data. Raise NotValid error for invalid data.""" validated = self._validated(data) errors = [] for validator in self.additional_validators: if not validator(validated): errors.append( "%s invalidated by ...
['def', 'validate', '(', 'self', ',', 'data', ')', ':', 'validated', '=', 'self', '.', '_validated', '(', 'data', ')', 'errors', '=', '[', ']', 'for', 'validator', 'in', 'self', '.', 'additional_validators', ':', 'if', 'not', 'validator', '(', 'validated', ')', ':', 'errors', '.', 'append', '(', '"%s invalidated by \'%...
Validate data. Raise NotValid error for invalid data.
['Validate', 'data', '.', 'Raise', 'NotValid', 'error', 'for', 'invalid', 'data', '.']
train
https://github.com/thisfred/val/blob/ba022e0c6c47acb3b8a45e7c44c84cc0f495c41c/val/_val.py#L243-L265
1,495
wright-group/WrightTools
WrightTools/data/_spcm.py
from_spcm
def from_spcm(filepath, name=None, *, delimiter=",", parent=None, verbose=True) -> Data: """Create a ``Data`` object from a Becker & Hickl spcm file (ASCII-exported, ``.asc``). If provided, setup parameters are stored in the ``attrs`` dictionary of the ``Data`` object. See the `spcm`__ software hompage fo...
python
def from_spcm(filepath, name=None, *, delimiter=",", parent=None, verbose=True) -> Data: """Create a ``Data`` object from a Becker & Hickl spcm file (ASCII-exported, ``.asc``). If provided, setup parameters are stored in the ``attrs`` dictionary of the ``Data`` object. See the `spcm`__ software hompage fo...
['def', 'from_spcm', '(', 'filepath', ',', 'name', '=', 'None', ',', '*', ',', 'delimiter', '=', '","', ',', 'parent', '=', 'None', ',', 'verbose', '=', 'True', ')', '->', 'Data', ':', 'filestr', '=', 'os', '.', 'fspath', '(', 'filepath', ')', 'filepath', '=', 'pathlib', '.', 'Path', '(', 'filepath', ')', '# check file...
Create a ``Data`` object from a Becker & Hickl spcm file (ASCII-exported, ``.asc``). If provided, setup parameters are stored in the ``attrs`` dictionary of the ``Data`` object. See the `spcm`__ software hompage for more info. __ http://www.becker-hickl.com/software/spcm.htm Parameters ---------...
['Create', 'a', 'Data', 'object', 'from', 'a', 'Becker', '&', 'Hickl', 'spcm', 'file', '(', 'ASCII', '-', 'exported', '.', 'asc', ')', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_spcm.py#L28-L145
1,496
Unidata/MetPy
metpy/calc/basic.py
sigma_to_pressure
def sigma_to_pressure(sigma, psfc, ptop): r"""Calculate pressure from sigma values. Parameters ---------- sigma : ndarray The sigma levels to be converted to pressure levels. psfc : `pint.Quantity` The surface pressure value. ptop : `pint.Quantity` The pressure value a...
python
def sigma_to_pressure(sigma, psfc, ptop): r"""Calculate pressure from sigma values. Parameters ---------- sigma : ndarray The sigma levels to be converted to pressure levels. psfc : `pint.Quantity` The surface pressure value. ptop : `pint.Quantity` The pressure value a...
['def', 'sigma_to_pressure', '(', 'sigma', ',', 'psfc', ',', 'ptop', ')', ':', 'if', 'np', '.', 'any', '(', 'sigma', '<', '0', ')', 'or', 'np', '.', 'any', '(', 'sigma', '>', '1', ')', ':', 'raise', 'ValueError', '(', "'Sigma values should be bounded by 0 and 1'", ')', 'if', 'psfc', '.', 'magnitude', '<', '0', 'or', 'p...
r"""Calculate pressure from sigma values. Parameters ---------- sigma : ndarray The sigma levels to be converted to pressure levels. psfc : `pint.Quantity` The surface pressure value. ptop : `pint.Quantity` The pressure value at the top of the model domain. Returns ...
['r', 'Calculate', 'pressure', 'from', 'sigma', 'values', '.']
train
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/calc/basic.py#L583-L620
1,497
holgern/pyedflib
demo/stacklineplot.py
stackplot_t
def stackplot_t(tarray, seconds=None, start_time=None, ylabels=None): """ will plot a stack of traces one above the other assuming tarray.shape = numSamples, numRows """ data = tarray numSamples, numRows = tarray.shape # data = np.random.randn(numSamples,numRows) # test data # data.shape = numS...
python
def stackplot_t(tarray, seconds=None, start_time=None, ylabels=None): """ will plot a stack of traces one above the other assuming tarray.shape = numSamples, numRows """ data = tarray numSamples, numRows = tarray.shape # data = np.random.randn(numSamples,numRows) # test data # data.shape = numS...
['def', 'stackplot_t', '(', 'tarray', ',', 'seconds', '=', 'None', ',', 'start_time', '=', 'None', ',', 'ylabels', '=', 'None', ')', ':', 'data', '=', 'tarray', 'numSamples', ',', 'numRows', '=', 'tarray', '.', 'shape', '# data = np.random.randn(numSamples,numRows) # test data', '# data.shape = numSamples, numRows', 'i...
will plot a stack of traces one above the other assuming tarray.shape = numSamples, numRows
['will', 'plot', 'a', 'stack', 'of', 'traces', 'one', 'above', 'the', 'other', 'assuming', 'tarray', '.', 'shape', '=', 'numSamples', 'numRows']
train
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/demo/stacklineplot.py#L20-L76
1,498
cdgriffith/Reusables
reusables/file_operations.py
find_files
def find_files(directory=".", ext=None, name=None, match_case=False, disable_glob=False, depth=None, abspath=False, enable_scandir=False): """ Walk through a file directory and return an iterator of files that match requirements. Will autodetect if name has glob as magic ch...
python
def find_files(directory=".", ext=None, name=None, match_case=False, disable_glob=False, depth=None, abspath=False, enable_scandir=False): """ Walk through a file directory and return an iterator of files that match requirements. Will autodetect if name has glob as magic ch...
['def', 'find_files', '(', 'directory', '=', '"."', ',', 'ext', '=', 'None', ',', 'name', '=', 'None', ',', 'match_case', '=', 'False', ',', 'disable_glob', '=', 'False', ',', 'depth', '=', 'None', ',', 'abspath', '=', 'False', ',', 'enable_scandir', '=', 'False', ')', ':', 'if', 'ext', 'or', 'not', 'name', ':', 'disab...
Walk through a file directory and return an iterator of files that match requirements. Will autodetect if name has glob as magic characters. Note: For the example below, you can use find_files_list to return as a list, this is simply an easy way to show the output. .. code:: python list(r...
['Walk', 'through', 'a', 'file', 'directory', 'and', 'return', 'an', 'iterator', 'of', 'files', 'that', 'match', 'requirements', '.', 'Will', 'autodetect', 'if', 'name', 'has', 'glob', 'as', 'magic', 'characters', '.']
train
https://github.com/cdgriffith/Reusables/blob/bc32f72e4baee7d76a6d58b88fcb23dd635155cd/reusables/file_operations.py#L463-L541
1,499
sbg/sevenbridges-python
sevenbridges/models/app.py
App.sync
def sync(self): """ Syncs the parent app changes with the current app instance. :return: Synced App object. """ app = self._api.post(url=self._URL['sync'].format(id=self.id)).json() return App(api=self._api, **app)
python
def sync(self): """ Syncs the parent app changes with the current app instance. :return: Synced App object. """ app = self._api.post(url=self._URL['sync'].format(id=self.id)).json() return App(api=self._api, **app)
['def', 'sync', '(', 'self', ')', ':', 'app', '=', 'self', '.', '_api', '.', 'post', '(', 'url', '=', 'self', '.', '_URL', '[', "'sync'", ']', '.', 'format', '(', 'id', '=', 'self', '.', 'id', ')', ')', '.', 'json', '(', ')', 'return', 'App', '(', 'api', '=', 'self', '.', '_api', ',', '*', '*', 'app', ')']
Syncs the parent app changes with the current app instance. :return: Synced App object.
['Syncs', 'the', 'parent', 'app', 'changes', 'with', 'the', 'current', 'app', 'instance', '.', ':', 'return', ':', 'Synced', 'App', 'object', '.']
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L208-L214