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
2,200
RobinNil/file_read_backwards
file_read_backwards/buffer_work_space.py
BufferWorkSpace.yieldable
def yieldable(self): """Return True if there is a line that the buffer can return, False otherwise.""" if self.read_buffer is None: return False t = _remove_trailing_new_line(self.read_buffer) n = _find_furthest_new_line(t) if n >= 0: return True ...
python
def yieldable(self): """Return True if there is a line that the buffer can return, False otherwise.""" if self.read_buffer is None: return False t = _remove_trailing_new_line(self.read_buffer) n = _find_furthest_new_line(t) if n >= 0: return True ...
['def', 'yieldable', '(', 'self', ')', ':', 'if', 'self', '.', 'read_buffer', 'is', 'None', ':', 'return', 'False', 't', '=', '_remove_trailing_new_line', '(', 'self', '.', 'read_buffer', ')', 'n', '=', '_find_furthest_new_line', '(', 't', ')', 'if', 'n', '>=', '0', ':', 'return', 'True', '# we have read in entire file...
Return True if there is a line that the buffer can return, False otherwise.
['Return', 'True', 'if', 'there', 'is', 'a', 'line', 'that', 'the', 'buffer', 'can', 'return', 'False', 'otherwise', '.']
train
https://github.com/RobinNil/file_read_backwards/blob/e56443095b58aae309fbc43a0943eba867dc8500/file_read_backwards/buffer_work_space.py#L42-L55
2,201
elastic/apm-agent-python
elasticapm/contrib/django/middleware/__init__.py
_is_ignorable_404
def _is_ignorable_404(uri): """ Returns True if the given request *shouldn't* notify the site managers. """ urls = getattr(django_settings, "IGNORABLE_404_URLS", ()) return any(pattern.search(uri) for pattern in urls)
python
def _is_ignorable_404(uri): """ Returns True if the given request *shouldn't* notify the site managers. """ urls = getattr(django_settings, "IGNORABLE_404_URLS", ()) return any(pattern.search(uri) for pattern in urls)
['def', '_is_ignorable_404', '(', 'uri', ')', ':', 'urls', '=', 'getattr', '(', 'django_settings', ',', '"IGNORABLE_404_URLS"', ',', '(', ')', ')', 'return', 'any', '(', 'pattern', '.', 'search', '(', 'uri', ')', 'for', 'pattern', 'in', 'urls', ')']
Returns True if the given request *shouldn't* notify the site managers.
['Returns', 'True', 'if', 'the', 'given', 'request', '*', 'shouldn', 't', '*', 'notify', 'the', 'site', 'managers', '.']
train
https://github.com/elastic/apm-agent-python/blob/2975663d7bd22282dc39336b2c37b37c12c7a774/elasticapm/contrib/django/middleware/__init__.py#L57-L62
2,202
ihabunek/toot
toot/ui/app.py
TimelineApp.reply
def reply(self): """Reply to the selected status""" status = self.get_selected_status() app, user = self.app, self.user if not app or not user: self.footer.draw_message("You must be logged in to reply", Color.RED) return compose_modal = ComposeModal(self....
python
def reply(self): """Reply to the selected status""" status = self.get_selected_status() app, user = self.app, self.user if not app or not user: self.footer.draw_message("You must be logged in to reply", Color.RED) return compose_modal = ComposeModal(self....
['def', 'reply', '(', 'self', ')', ':', 'status', '=', 'self', '.', 'get_selected_status', '(', ')', 'app', ',', 'user', '=', 'self', '.', 'app', ',', 'self', '.', 'user', 'if', 'not', 'app', 'or', 'not', 'user', ':', 'self', '.', 'footer', '.', 'draw_message', '(', '"You must be logged in to reply"', ',', 'Color', '.'...
Reply to the selected status
['Reply', 'to', 'the', 'selected', 'status']
train
https://github.com/ihabunek/toot/blob/d13fa8685b300f96621fa325774913ec0f413a7f/toot/ui/app.py#L624-L647
2,203
HazyResearch/fonduer
src/fonduer/utils/utils_udf.py
get_mapping
def get_mapping(session, table, candidates, generator, key_map): """Generate map of keys and values for the candidate from the generator. :param session: The database session. :param table: The table we will be inserting into (i.e. Feature or Label). :param candidates: The candidates to get mappings fo...
python
def get_mapping(session, table, candidates, generator, key_map): """Generate map of keys and values for the candidate from the generator. :param session: The database session. :param table: The table we will be inserting into (i.e. Feature or Label). :param candidates: The candidates to get mappings fo...
['def', 'get_mapping', '(', 'session', ',', 'table', ',', 'candidates', ',', 'generator', ',', 'key_map', ')', ':', 'for', 'cand', 'in', 'candidates', ':', '# Grab the old values currently in the DB', 'try', ':', 'temp', '=', 'session', '.', 'query', '(', 'table', ')', '.', 'filter', '(', 'table', '.', 'candidate_id', ...
Generate map of keys and values for the candidate from the generator. :param session: The database session. :param table: The table we will be inserting into (i.e. Feature or Label). :param candidates: The candidates to get mappings for. :param generator: A generator yielding (candidate_id, key, value)...
['Generate', 'map', 'of', 'keys', 'and', 'values', 'for', 'the', 'candidate', 'from', 'the', 'generator', '.']
train
https://github.com/HazyResearch/fonduer/blob/4520f86a716f03dcca458a9f4bddac75b4e7068f/src/fonduer/utils/utils_udf.py#L161-L198
2,204
jmvrbanac/Specter
specter/reporting/console.py
ConsoleReporter.output
def output(self, msg, indent, status=None): """ Alias for print_indent_msg with color determined by status.""" color = None if self.use_color: color = get_color_from_status(status) print_indent_msg(msg, indent, color)
python
def output(self, msg, indent, status=None): """ Alias for print_indent_msg with color determined by status.""" color = None if self.use_color: color = get_color_from_status(status) print_indent_msg(msg, indent, color)
['def', 'output', '(', 'self', ',', 'msg', ',', 'indent', ',', 'status', '=', 'None', ')', ':', 'color', '=', 'None', 'if', 'self', '.', 'use_color', ':', 'color', '=', 'get_color_from_status', '(', 'status', ')', 'print_indent_msg', '(', 'msg', ',', 'indent', ',', 'color', ')']
Alias for print_indent_msg with color determined by status.
['Alias', 'for', 'print_indent_msg', 'with', 'color', 'determined', 'by', 'status', '.']
train
https://github.com/jmvrbanac/Specter/blob/1f5a729b0aa16242add8c1c754efa268335e3944/specter/reporting/console.py#L139-L144
2,205
gwastro/pycbc
pycbc/inference/sampler/emcee.py
EmceeEnsembleSampler.from_config
def from_config(cls, cp, model, nprocesses=1, use_mpi=False): """Loads the sampler from the given config file.""" section = "sampler" # check name assert cp.get(section, "name") == cls.name, ( "name in section [sampler] must match mine") # get the number of walkers to...
python
def from_config(cls, cp, model, nprocesses=1, use_mpi=False): """Loads the sampler from the given config file.""" section = "sampler" # check name assert cp.get(section, "name") == cls.name, ( "name in section [sampler] must match mine") # get the number of walkers to...
['def', 'from_config', '(', 'cls', ',', 'cp', ',', 'model', ',', 'nprocesses', '=', '1', ',', 'use_mpi', '=', 'False', ')', ':', 'section', '=', '"sampler"', '# check name', 'assert', 'cp', '.', 'get', '(', 'section', ',', '"name"', ')', '==', 'cls', '.', 'name', ',', '(', '"name in section [sampler] must match mine"',...
Loads the sampler from the given config file.
['Loads', 'the', 'sampler', 'from', 'the', 'given', 'config', 'file', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/sampler/emcee.py#L194-L218
2,206
saltstack/salt
salt/cloud/clouds/aliyun.py
create_node
def create_node(kwargs): ''' Convenience function to make the rest api call for node creation. ''' if not isinstance(kwargs, dict): kwargs = {} # Required parameters params = { 'Action': 'CreateInstance', 'InstanceType': kwargs.get('size_id', ''), 'RegionId': kwa...
python
def create_node(kwargs): ''' Convenience function to make the rest api call for node creation. ''' if not isinstance(kwargs, dict): kwargs = {} # Required parameters params = { 'Action': 'CreateInstance', 'InstanceType': kwargs.get('size_id', ''), 'RegionId': kwa...
['def', 'create_node', '(', 'kwargs', ')', ':', 'if', 'not', 'isinstance', '(', 'kwargs', ',', 'dict', ')', ':', 'kwargs', '=', '{', '}', '# Required parameters', 'params', '=', '{', "'Action'", ':', "'CreateInstance'", ',', "'InstanceType'", ':', 'kwargs', '.', 'get', '(', "'size_id'", ',', "''", ')', ',', "'RegionId'...
Convenience function to make the rest api call for node creation.
['Convenience', 'function', 'to', 'make', 'the', 'rest', 'api', 'call', 'for', 'node', 'creation', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/aliyun.py#L577-L608
2,207
supercoderz/pyflightdata
pyflightdata/flightdata.py
FlightData.get_history_by_tail_number
def get_history_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the history of a particular aircraft by its tail number. This method can be used to get the history of a particular aircraft by its tail number. It checks the user authentication and returns the data accordingly. ...
python
def get_history_by_tail_number(self, tail_number, page=1, limit=100): """Fetch the history of a particular aircraft by its tail number. This method can be used to get the history of a particular aircraft by its tail number. It checks the user authentication and returns the data accordingly. ...
['def', 'get_history_by_tail_number', '(', 'self', ',', 'tail_number', ',', 'page', '=', '1', ',', 'limit', '=', '100', ')', ':', 'url', '=', 'REG_BASE', '.', 'format', '(', 'tail_number', ',', 'str', '(', 'self', '.', 'AUTH_TOKEN', ')', ',', 'page', ',', 'limit', ')', 'return', 'self', '.', '_fr24', '.', 'get_data', '...
Fetch the history of a particular aircraft by its tail number. This method can be used to get the history of a particular aircraft by its tail number. It checks the user authentication and returns the data accordingly. Args: tail_number (str): The tail number, e.g. VT-ANL ...
['Fetch', 'the', 'history', 'of', 'a', 'particular', 'aircraft', 'by', 'its', 'tail', 'number', '.']
train
https://github.com/supercoderz/pyflightdata/blob/2caf9f429288f9a171893d1b8377d0c6244541cc/pyflightdata/flightdata.py#L85-L110
2,208
dtcooper/python-fitparse
fitparse/records.py
Crc.calculate
def calculate(cls, byte_arr, crc=0): """Compute CRC for input bytes.""" for byte in byte_iter(byte_arr): # Taken verbatim from FIT SDK docs tmp = cls.CRC_TABLE[crc & 0xF] crc = (crc >> 4) & 0x0FFF crc = crc ^ tmp ^ cls.CRC_TABLE[byte & 0xF] tm...
python
def calculate(cls, byte_arr, crc=0): """Compute CRC for input bytes.""" for byte in byte_iter(byte_arr): # Taken verbatim from FIT SDK docs tmp = cls.CRC_TABLE[crc & 0xF] crc = (crc >> 4) & 0x0FFF crc = crc ^ tmp ^ cls.CRC_TABLE[byte & 0xF] tm...
['def', 'calculate', '(', 'cls', ',', 'byte_arr', ',', 'crc', '=', '0', ')', ':', 'for', 'byte', 'in', 'byte_iter', '(', 'byte_arr', ')', ':', '# Taken verbatim from FIT SDK docs', 'tmp', '=', 'cls', '.', 'CRC_TABLE', '[', 'crc', '&', '0xF', ']', 'crc', '=', '(', 'crc', '>>', '4', ')', '&', '0x0FFF', 'crc', '=', 'crc',...
Compute CRC for input bytes.
['Compute', 'CRC', 'for', 'input', 'bytes', '.']
train
https://github.com/dtcooper/python-fitparse/blob/40fa2918c3e91bd8f89908ad3bad81c1c1189dd2/fitparse/records.py#L376-L387
2,209
saltstack/salt
salt/states/mac_xattr.py
exists
def exists(name, attributes): ''' Make sure the given attributes exist on the file/directory name The path to the file/directory attributes The attributes that should exist on the file/directory, this is accepted as an array, with key and value split with an equals sign, if you...
python
def exists(name, attributes): ''' Make sure the given attributes exist on the file/directory name The path to the file/directory attributes The attributes that should exist on the file/directory, this is accepted as an array, with key and value split with an equals sign, if you...
['def', 'exists', '(', 'name', ',', 'attributes', ')', ':', 'ret', '=', '{', "'name'", ':', 'name', ',', "'result'", ':', 'True', ',', "'comment'", ':', "''", ',', "'changes'", ':', '{', '}', '}', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'name', ')', ':', 'ret', '[', "'result'", ']', '=', 'False', 'ret', '['...
Make sure the given attributes exist on the file/directory name The path to the file/directory attributes The attributes that should exist on the file/directory, this is accepted as an array, with key and value split with an equals sign, if you want to specify a hex value then ...
['Make', 'sure', 'the', 'given', 'attributes', 'exist', 'on', 'the', 'file', '/', 'directory']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L35-L85
2,210
riga/law
law/decorator.py
factory
def factory(**default_opts): """ Factory function to create decorators for tasks' run methods. Default options for the decorator function can be given in *default_opts*. The returned decorator can be used with or without function invocation. Example: .. code-block:: python @factory(digits=...
python
def factory(**default_opts): """ Factory function to create decorators for tasks' run methods. Default options for the decorator function can be given in *default_opts*. The returned decorator can be used with or without function invocation. Example: .. code-block:: python @factory(digits=...
['def', 'factory', '(', '*', '*', 'default_opts', ')', ':', 'def', 'wrapper', '(', 'decorator', ')', ':', '@', 'functools', '.', 'wraps', '(', 'decorator', ')', 'def', 'wrapper', '(', 'fn', '=', 'None', ',', '*', '*', 'opts', ')', ':', '_opts', '=', 'default_opts', '.', 'copy', '(', ')', '_opts', '.', 'update', '(', 'o...
Factory function to create decorators for tasks' run methods. Default options for the decorator function can be given in *default_opts*. The returned decorator can be used with or without function invocation. Example: .. code-block:: python @factory(digits=2) def runtime(fn, opts, task, *a...
['Factory', 'function', 'to', 'create', 'decorators', 'for', 'tasks', 'run', 'methods', '.', 'Default', 'options', 'for', 'the', 'decorator', 'function', 'can', 'be', 'given', 'in', '*', 'default_opts', '*', '.', 'The', 'returned', 'decorator', 'can', 'be', 'used', 'with', 'or', 'without', 'function', 'invocation', '.'...
train
https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/decorator.py#L46-L97
2,211
anthok/overwatch-api
overwatch_api/core.py
AsyncOWAPI.get_stats
async def get_stats(self, battletag: str, regions=(EUROPE, KOREA, AMERICAS, CHINA, JAPAN, ANY), platform=None, _session=None, handle_ratelimit=None, max_tries=None, request_timeout=None): """Returns the stats for the profiles on the specified regions and platform. The format for regions ...
python
async def get_stats(self, battletag: str, regions=(EUROPE, KOREA, AMERICAS, CHINA, JAPAN, ANY), platform=None, _session=None, handle_ratelimit=None, max_tries=None, request_timeout=None): """Returns the stats for the profiles on the specified regions and platform. The format for regions ...
['async', 'def', 'get_stats', '(', 'self', ',', 'battletag', ':', 'str', ',', 'regions', '=', '(', 'EUROPE', ',', 'KOREA', ',', 'AMERICAS', ',', 'CHINA', ',', 'JAPAN', ',', 'ANY', ')', ',', 'platform', '=', 'None', ',', '_session', '=', 'None', ',', 'handle_ratelimit', '=', 'None', ',', 'max_tries', '=', 'None', ',', '...
Returns the stats for the profiles on the specified regions and platform. The format for regions without a matching user, the format is the same as get_profile. The stats are returned in a dictionary with a similar format to what https://github.com/SunDwarf/OWAPI/blob/master/api.md#get-apiv3ubattletagstats spec...
['Returns', 'the', 'stats', 'for', 'the', 'profiles', 'on', 'the', 'specified', 'regions', 'and', 'platform', '.', 'The', 'format', 'for', 'regions', 'without', 'a', 'matching', 'user', 'the', 'format', 'is', 'the', 'same', 'as', 'get_profile', '.', 'The', 'stats', 'are', 'returned', 'in', 'a', 'dictionary', 'with', 'a...
train
https://github.com/anthok/overwatch-api/blob/aba976a3c07c4932de13f4236d924b2901b149b9/overwatch_api/core.py#L98-L114
2,212
quantopian/zipline
zipline/finance/asset_restrictions.py
HistoricalRestrictions.is_restricted
def is_restricted(self, assets, dt): """ Returns whether or not an asset or iterable of assets is restricted on a dt. """ if isinstance(assets, Asset): return self._is_restricted_for_asset(assets, dt) is_restricted = partial(self._is_restricted_for_asset, dt=...
python
def is_restricted(self, assets, dt): """ Returns whether or not an asset or iterable of assets is restricted on a dt. """ if isinstance(assets, Asset): return self._is_restricted_for_asset(assets, dt) is_restricted = partial(self._is_restricted_for_asset, dt=...
['def', 'is_restricted', '(', 'self', ',', 'assets', ',', 'dt', ')', ':', 'if', 'isinstance', '(', 'assets', ',', 'Asset', ')', ':', 'return', 'self', '.', '_is_restricted_for_asset', '(', 'assets', ',', 'dt', ')', 'is_restricted', '=', 'partial', '(', 'self', '.', '_is_restricted_for_asset', ',', 'dt', '=', 'dt', ')',...
Returns whether or not an asset or iterable of assets is restricted on a dt.
['Returns', 'whether', 'or', 'not', 'an', 'asset', 'or', 'iterable', 'of', 'assets', 'is', 'restricted', 'on', 'a', 'dt', '.']
train
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/finance/asset_restrictions.py#L177-L189
2,213
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
RocketChat.groups_moderators
def groups_moderators(self, room_id=None, group=None, **kwargs): """Lists all moderators of a group.""" if room_id: return self.__call_api_get('groups.moderators', roomId=room_id, kwargs=kwargs) elif group: return self.__call_api_get('groups.moderators', roomName=group, k...
python
def groups_moderators(self, room_id=None, group=None, **kwargs): """Lists all moderators of a group.""" if room_id: return self.__call_api_get('groups.moderators', roomId=room_id, kwargs=kwargs) elif group: return self.__call_api_get('groups.moderators', roomName=group, k...
['def', 'groups_moderators', '(', 'self', ',', 'room_id', '=', 'None', ',', 'group', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', 'room_id', ':', 'return', 'self', '.', '__call_api_get', '(', "'groups.moderators'", ',', 'roomId', '=', 'room_id', ',', 'kwargs', '=', 'kwargs', ')', 'elif', 'group', ':', 'return'...
Lists all moderators of a group.
['Lists', 'all', 'moderators', 'of', 'a', 'group', '.']
train
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L449-L456
2,214
c0fec0de/anytree
anytree/exporter/dictexporter.py
DictExporter.export
def export(self, node): """Export tree starting at `node`.""" attriter = self.attriter or (lambda attr_values: attr_values) return self.__export(node, self.dictcls, attriter, self.childiter)
python
def export(self, node): """Export tree starting at `node`.""" attriter = self.attriter or (lambda attr_values: attr_values) return self.__export(node, self.dictcls, attriter, self.childiter)
['def', 'export', '(', 'self', ',', 'node', ')', ':', 'attriter', '=', 'self', '.', 'attriter', 'or', '(', 'lambda', 'attr_values', ':', 'attr_values', ')', 'return', 'self', '.', '__export', '(', 'node', ',', 'self', '.', 'dictcls', ',', 'attriter', ',', 'self', '.', 'childiter', ')']
Export tree starting at `node`.
['Export', 'tree', 'starting', 'at', 'node', '.']
train
https://github.com/c0fec0de/anytree/blob/775477e206a75e697983e70dae6372b5a7e42dcf/anytree/exporter/dictexporter.py#L70-L73
2,215
volafiled/python-volapi
volapi/volapi.py
Room.__get_config
def __get_config(self): """ Really connect """ if not self.name: room_resp = self.conn.get(BASE_URL + "/new") room_resp.raise_for_status() url = room_resp.url try: self.name = re.search(r"r/(.+?)$", url).group(1) except Excepti...
python
def __get_config(self): """ Really connect """ if not self.name: room_resp = self.conn.get(BASE_URL + "/new") room_resp.raise_for_status() url = room_resp.url try: self.name = re.search(r"r/(.+?)$", url).group(1) except Excepti...
['def', '__get_config', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'name', ':', 'room_resp', '=', 'self', '.', 'conn', '.', 'get', '(', 'BASE_URL', '+', '"/new"', ')', 'room_resp', '.', 'raise_for_status', '(', ')', 'url', '=', 'room_resp', '.', 'url', 'try', ':', 'self', '.', 'name', '=', 're', '.', 'search', '(...
Really connect
['Really', 'connect']
train
https://github.com/volafiled/python-volapi/blob/5f0bc03dbde703264ac6ed494e2050761f688a3e/volapi/volapi.py#L442-L471
2,216
keon/algorithms
algorithms/tree/avl/avl.py
AvlTree.update_balances
def update_balances(self, recursive=True): """ Calculate tree balance factor """ if self.node: if recursive: if self.node.left: self.node.left.update_balances() if self.node.right: self.node.right.update...
python
def update_balances(self, recursive=True): """ Calculate tree balance factor """ if self.node: if recursive: if self.node.left: self.node.left.update_balances() if self.node.right: self.node.right.update...
['def', 'update_balances', '(', 'self', ',', 'recursive', '=', 'True', ')', ':', 'if', 'self', '.', 'node', ':', 'if', 'recursive', ':', 'if', 'self', '.', 'node', '.', 'left', ':', 'self', '.', 'node', '.', 'left', '.', 'update_balances', '(', ')', 'if', 'self', '.', 'node', '.', 'right', ':', 'self', '.', 'node', '.'...
Calculate tree balance factor
['Calculate', 'tree', 'balance', 'factor']
train
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/tree/avl/avl.py#L72-L86
2,217
pandas-dev/pandas
pandas/io/pytables.py
Table._get_metadata_path
def _get_metadata_path(self, key): """ return the metadata pathname for this key """ return "{group}/meta/{key}/meta".format(group=self.group._v_pathname, key=key)
python
def _get_metadata_path(self, key): """ return the metadata pathname for this key """ return "{group}/meta/{key}/meta".format(group=self.group._v_pathname, key=key)
['def', '_get_metadata_path', '(', 'self', ',', 'key', ')', ':', 'return', '"{group}/meta/{key}/meta"', '.', 'format', '(', 'group', '=', 'self', '.', 'group', '.', '_v_pathname', ',', 'key', '=', 'key', ')']
return the metadata pathname for this key
['return', 'the', 'metadata', 'pathname', 'for', 'this', 'key']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3213-L3216
2,218
Robin8Put/pmes
wallet_manager/handlers/withdraw.py
Withdraw.withdraw_bulk
async def withdraw_bulk(self, *args, **kwargs): """ Withdraw funds requests to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multipl...
python
async def withdraw_bulk(self, *args, **kwargs): """ Withdraw funds requests to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multipl...
['async', 'def', 'withdraw_bulk', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'await', 'self', '.', 'db', '.', 'withdraw_requests', '.', 'insert_one', '(', '{', "'coinid'", ':', 'kwargs', '.', 'get', '(', '"coinid"', ')', ',', "'address'", ':', 'kwargs', '.', 'get', '(', '"address"', ')', ',', "'a...
Withdraw funds requests to user wallet Accepts: - coinid [string] (blockchain id (example: BTCTEST, LTCTEST)) - address [string] withdrawal address (in hex for tokens) - amount [int] withdrawal amount multiplied by decimals_k (10**8) Returns dictionary with following ...
['Withdraw', 'funds', 'requests', 'to', 'user', 'wallet']
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/wallet_manager/handlers/withdraw.py#L156-L174
2,219
twilio/twilio-python
twilio/rest/preview/bulk_exports/export_configuration.py
ExportConfigurationContext.update
def update(self, enabled=values.unset, webhook_url=values.unset, webhook_method=values.unset): """ Update the ExportConfigurationInstance :param bool enabled: The enabled :param unicode webhook_url: The webhook_url :param unicode webhook_method: The webhook_method...
python
def update(self, enabled=values.unset, webhook_url=values.unset, webhook_method=values.unset): """ Update the ExportConfigurationInstance :param bool enabled: The enabled :param unicode webhook_url: The webhook_url :param unicode webhook_method: The webhook_method...
['def', 'update', '(', 'self', ',', 'enabled', '=', 'values', '.', 'unset', ',', 'webhook_url', '=', 'values', '.', 'unset', ',', 'webhook_method', '=', 'values', '.', 'unset', ')', ':', 'data', '=', 'values', '.', 'of', '(', '{', "'Enabled'", ':', 'enabled', ',', "'WebhookUrl'", ':', 'webhook_url', ',', "'WebhookMetho...
Update the ExportConfigurationInstance :param bool enabled: The enabled :param unicode webhook_url: The webhook_url :param unicode webhook_method: The webhook_method :returns: Updated ExportConfigurationInstance :rtype: twilio.rest.preview.bulk_exports.export_configuration.Expo...
['Update', 'the', 'ExportConfigurationInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/preview/bulk_exports/export_configuration.py#L150-L174
2,220
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/poller.py
AsyncPoller.poll
def poll(self): """ Poll the job status. Returns the changes in this iteration.""" self.runner.module_name = 'async_status' self.runner.module_args = "jid=%s" % self.jid self.runner.pattern = "*" self.runner.background = 0 self.runner.inventory.restrict_to(s...
python
def poll(self): """ Poll the job status. Returns the changes in this iteration.""" self.runner.module_name = 'async_status' self.runner.module_args = "jid=%s" % self.jid self.runner.pattern = "*" self.runner.background = 0 self.runner.inventory.restrict_to(s...
['def', 'poll', '(', 'self', ')', ':', 'self', '.', 'runner', '.', 'module_name', '=', "'async_status'", 'self', '.', 'runner', '.', 'module_args', '=', '"jid=%s"', '%', 'self', '.', 'jid', 'self', '.', 'runner', '.', 'pattern', '=', '"*"', 'self', '.', 'runner', '.', 'background', '=', '0', 'self', '.', 'runner', '.',...
Poll the job status. Returns the changes in this iteration.
['Poll', 'the', 'job', 'status', '.']
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/poller.py#L54-L89
2,221
saltstack/salt
salt/modules/schedule.py
modify
def modify(name, **kwargs): ''' Modify an existing job in the schedule CLI Example: .. code-block:: bash salt '*' schedule.modify job1 function='test.ping' seconds=3600 ''' ret = {'comment': '', 'changes': {}, 'result': True} time_conflict = False for i...
python
def modify(name, **kwargs): ''' Modify an existing job in the schedule CLI Example: .. code-block:: bash salt '*' schedule.modify job1 function='test.ping' seconds=3600 ''' ret = {'comment': '', 'changes': {}, 'result': True} time_conflict = False for i...
['def', 'modify', '(', 'name', ',', '*', '*', 'kwargs', ')', ':', 'ret', '=', '{', "'comment'", ':', "''", ',', "'changes'", ':', '{', '}', ',', "'result'", ':', 'True', '}', 'time_conflict', '=', 'False', 'for', 'item', 'in', '[', "'seconds'", ',', "'minutes'", ',', "'hours'", ',', "'days'", ']', ':', 'if', 'item', 'i...
Modify an existing job in the schedule CLI Example: .. code-block:: bash salt '*' schedule.modify job1 function='test.ping' seconds=3600
['Modify', 'an', 'existing', 'job', 'in', 'the', 'schedule']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/schedule.py#L471-L556
2,222
neo4j-drivers/neobolt
neobolt/impl/python/direct.py
AbstractConnectionPool.close
def close(self): """ Close all connections and empty the pool. This method is thread safe. """ if self._closed: return try: with self.lock: if not self._closed: self._closed = True for address in list...
python
def close(self): """ Close all connections and empty the pool. This method is thread safe. """ if self._closed: return try: with self.lock: if not self._closed: self._closed = True for address in list...
['def', 'close', '(', 'self', ')', ':', 'if', 'self', '.', '_closed', ':', 'return', 'try', ':', 'with', 'self', '.', 'lock', ':', 'if', 'not', 'self', '.', '_closed', ':', 'self', '.', '_closed', '=', 'True', 'for', 'address', 'in', 'list', '(', 'self', '.', 'connections', ')', ':', 'self', '.', 'remove', '(', 'addres...
Close all connections and empty the pool. This method is thread safe.
['Close', 'all', 'connections', 'and', 'empty', 'the', 'pool', '.', 'This', 'method', 'is', 'thread', 'safe', '.']
train
https://github.com/neo4j-drivers/neobolt/blob/724569d76e85777c4f5e30e8d0a18116bda4d8cd/neobolt/impl/python/direct.py#L600-L613
2,223
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
ThumbnailScrollBar.setup_scrollarea
def setup_scrollarea(self): """Setup the scrollarea that will contain the FigureThumbnails.""" self.view = QWidget() self.scene = QGridLayout(self.view) self.scene.setColumnStretch(0, 100) self.scene.setColumnStretch(2, 100) self.scrollarea = QScrollArea() self....
python
def setup_scrollarea(self): """Setup the scrollarea that will contain the FigureThumbnails.""" self.view = QWidget() self.scene = QGridLayout(self.view) self.scene.setColumnStretch(0, 100) self.scene.setColumnStretch(2, 100) self.scrollarea = QScrollArea() self....
['def', 'setup_scrollarea', '(', 'self', ')', ':', 'self', '.', 'view', '=', 'QWidget', '(', ')', 'self', '.', 'scene', '=', 'QGridLayout', '(', 'self', '.', 'view', ')', 'self', '.', 'scene', '.', 'setColumnStretch', '(', '0', ',', '100', ')', 'self', '.', 'scene', '.', 'setColumnStretch', '(', '2', ',', '100', ')', '...
Setup the scrollarea that will contain the FigureThumbnails.
['Setup', 'the', 'scrollarea', 'that', 'will', 'contain', 'the', 'FigureThumbnails', '.']
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L517-L539
2,224
jaraco/path.py
path/__init__.py
Path.glob
def glob(self, pattern): """ Return a list of Path objects that match the pattern. `pattern` - a path relative to this directory, with wildcards. For example, ``Path('/users').glob('*/bin/*')`` returns a list of all the files users have in their :file:`bin` directories. .. see...
python
def glob(self, pattern): """ Return a list of Path objects that match the pattern. `pattern` - a path relative to this directory, with wildcards. For example, ``Path('/users').glob('*/bin/*')`` returns a list of all the files users have in their :file:`bin` directories. .. see...
['def', 'glob', '(', 'self', ',', 'pattern', ')', ':', 'cls', '=', 'self', '.', '_next_class', 'return', '[', 'cls', '(', 's', ')', 'for', 's', 'in', 'glob', '.', 'glob', '(', 'self', '/', 'pattern', ')', ']']
Return a list of Path objects that match the pattern. `pattern` - a path relative to this directory, with wildcards. For example, ``Path('/users').glob('*/bin/*')`` returns a list of all the files users have in their :file:`bin` directories. .. seealso:: :func:`glob.glob` .. ...
['Return', 'a', 'list', 'of', 'Path', 'objects', 'that', 'match', 'the', 'pattern', '.']
train
https://github.com/jaraco/path.py/blob/bbe7d99e7a64a004f866ace9ec12bd9b296908f5/path/__init__.py#L616-L631
2,225
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe_ext.py
brocade_fcoe_ext.fcoe_get_login_output_fcoe_login_list_fcoe_login_fcoe_interface_name
def fcoe_get_login_output_fcoe_login_list_fcoe_login_fcoe_interface_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe_get_login = ET.Element("fcoe_get_login") config = fcoe_get_login output = ET.SubElement(fcoe_get_login, "output") ...
python
def fcoe_get_login_output_fcoe_login_list_fcoe_login_fcoe_interface_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe_get_login = ET.Element("fcoe_get_login") config = fcoe_get_login output = ET.SubElement(fcoe_get_login, "output") ...
['def', 'fcoe_get_login_output_fcoe_login_list_fcoe_login_fcoe_interface_name', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'fcoe_get_login', '=', 'ET', '.', 'Element', '(', '"fcoe_get_login"', ')', 'config', '=', 'fcoe_get_login', 'output', '=', 'ET', '.',...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe_ext.py#L640-L654
2,226
openvax/datacache
datacache/download.py
fetch_and_transform
def fetch_and_transform( transformed_filename, transformer, loader, source_filename, source_url, subdir=None): """ Fetch a remote file from `source_url`, save it locally as `source_filename` and then use the `loader` and `transformer` function arguments to tur...
python
def fetch_and_transform( transformed_filename, transformer, loader, source_filename, source_url, subdir=None): """ Fetch a remote file from `source_url`, save it locally as `source_filename` and then use the `loader` and `transformer` function arguments to tur...
['def', 'fetch_and_transform', '(', 'transformed_filename', ',', 'transformer', ',', 'loader', ',', 'source_filename', ',', 'source_url', ',', 'subdir', '=', 'None', ')', ':', 'transformed_path', '=', 'build_path', '(', 'transformed_filename', ',', 'subdir', ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'tra...
Fetch a remote file from `source_url`, save it locally as `source_filename` and then use the `loader` and `transformer` function arguments to turn this saved data into an in-memory object.
['Fetch', 'a', 'remote', 'file', 'from', 'source_url', 'save', 'it', 'locally', 'as', 'source_filename', 'and', 'then', 'use', 'the', 'loader', 'and', 'transformer', 'function', 'arguments', 'to', 'turn', 'this', 'saved', 'data', 'into', 'an', 'in', '-', 'memory', 'object', '.']
train
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/download.py#L217-L238
2,227
Yelp/detect-secrets
detect_secrets/core/log.py
get_logger
def get_logger(name=None, format_string=None): """ :type name: str :param name: used for declaring log channels. :type format_string: str :param format_string: for custom formatting """ logging.captureWarnings(True) log = logging.getLogger(name) # Bind custom method to instance. ...
python
def get_logger(name=None, format_string=None): """ :type name: str :param name: used for declaring log channels. :type format_string: str :param format_string: for custom formatting """ logging.captureWarnings(True) log = logging.getLogger(name) # Bind custom method to instance. ...
['def', 'get_logger', '(', 'name', '=', 'None', ',', 'format_string', '=', 'None', ')', ':', 'logging', '.', 'captureWarnings', '(', 'True', ')', 'log', '=', 'logging', '.', 'getLogger', '(', 'name', ')', '# Bind custom method to instance.', '# Source: https://stackoverflow.com/a/2982', 'log', '.', 'set_debug_level', '...
:type name: str :param name: used for declaring log channels. :type format_string: str :param format_string: for custom formatting
[':', 'type', 'name', ':', 'str', ':', 'param', 'name', ':', 'used', 'for', 'declaring', 'log', 'channels', '.']
train
https://github.com/Yelp/detect-secrets/blob/473923ea71f1ac2b5ea1eacc49b98f97967e3d05/detect_secrets/core/log.py#L5-L32
2,228
wbond/asn1crypto
asn1crypto/util.py
extended_datetime.utcoffset
def utcoffset(self): """ :return: None or a datetime.timedelta() of the offset from UTC """ if self.tzinfo is None: return None return self.tzinfo.utcoffset(self.replace(year=2000))
python
def utcoffset(self): """ :return: None or a datetime.timedelta() of the offset from UTC """ if self.tzinfo is None: return None return self.tzinfo.utcoffset(self.replace(year=2000))
['def', 'utcoffset', '(', 'self', ')', ':', 'if', 'self', '.', 'tzinfo', 'is', 'None', ':', 'return', 'None', 'return', 'self', '.', 'tzinfo', '.', 'utcoffset', '(', 'self', '.', 'replace', '(', 'year', '=', '2000', ')', ')']
:return: None or a datetime.timedelta() of the offset from UTC
[':', 'return', ':', 'None', 'or', 'a', 'datetime', '.', 'timedelta', '()', 'of', 'the', 'offset', 'from', 'UTC']
train
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/util.py#L473-L481
2,229
yeasy/hyperledger-py
hyperledger/ssladapter/ssl_match_hostname.py
_dnsname_match
def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 """ pats = [] if not dn: return False split_dn = dn.split(r'.') leftmost, remainder = split_dn[0], split_dn[1:] wildcards = left...
python
def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 """ pats = [] if not dn: return False split_dn = dn.split(r'.') leftmost, remainder = split_dn[0], split_dn[1:] wildcards = left...
['def', '_dnsname_match', '(', 'dn', ',', 'hostname', ',', 'max_wildcards', '=', '1', ')', ':', 'pats', '=', '[', ']', 'if', 'not', 'dn', ':', 'return', 'False', 'split_dn', '=', 'dn', '.', 'split', '(', "r'.'", ')', 'leftmost', ',', 'remainder', '=', 'split_dn', '[', '0', ']', ',', 'split_dn', '[', '1', ':', ']', 'wil...
Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3
['Matching', 'according', 'to', 'RFC', '6125', 'section', '6', '.', '4', '.', '3']
train
https://github.com/yeasy/hyperledger-py/blob/f24e9cc409b50628b911950466786be6fe74f09f/hyperledger/ssladapter/ssl_match_hostname.py#L28-L75
2,230
getsentry/raven-python
raven/base.py
Client.captureQuery
def captureQuery(self, query, params=(), engine=None, **kwargs): """ Creates an event for a SQL query. >>> client.captureQuery('SELECT * FROM foo') """ return self.capture( 'raven.events.Query', query=query, params=params, engine=engine, **kwargs)
python
def captureQuery(self, query, params=(), engine=None, **kwargs): """ Creates an event for a SQL query. >>> client.captureQuery('SELECT * FROM foo') """ return self.capture( 'raven.events.Query', query=query, params=params, engine=engine, **kwargs)
['def', 'captureQuery', '(', 'self', ',', 'query', ',', 'params', '=', '(', ')', ',', 'engine', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', 'capture', '(', "'raven.events.Query'", ',', 'query', '=', 'query', ',', 'params', '=', 'params', ',', 'engine', '=', 'engine', ',', '*', '*', 'kwargs', ...
Creates an event for a SQL query. >>> client.captureQuery('SELECT * FROM foo')
['Creates', 'an', 'event', 'for', 'a', 'SQL', 'query', '.']
train
https://github.com/getsentry/raven-python/blob/d891c20f0f930153f508e9d698d9de42e910face/raven/base.py#L892-L900
2,231
openstack/networking-arista
networking_arista/ml2/mechanism_arista.py
AristaDriver.create_segments
def create_segments(self, segments): """Enqueue segment creates""" for segment in segments: s_res = MechResource(segment['id'], a_const.SEGMENT_RESOURCE, a_const.CREATE) self.provision_queue.put(s_res)
python
def create_segments(self, segments): """Enqueue segment creates""" for segment in segments: s_res = MechResource(segment['id'], a_const.SEGMENT_RESOURCE, a_const.CREATE) self.provision_queue.put(s_res)
['def', 'create_segments', '(', 'self', ',', 'segments', ')', ':', 'for', 'segment', 'in', 'segments', ':', 's_res', '=', 'MechResource', '(', 'segment', '[', "'id'", ']', ',', 'a_const', '.', 'SEGMENT_RESOURCE', ',', 'a_const', '.', 'CREATE', ')', 'self', '.', 'provision_queue', '.', 'put', '(', 's_res', ')']
Enqueue segment creates
['Enqueue', 'segment', 'creates']
train
https://github.com/openstack/networking-arista/blob/07ce6b1fc62ff74308a6eabfc4cc0ee09fb7b0fe/networking_arista/ml2/mechanism_arista.py#L103-L108
2,232
bitprophet/botox
botox/aws.py
AWS.get
def get(self, arg): """ Return instance object with given EC2 ID or nametag. """ try: reservations = self.get_all_instances(filters={'tag:Name': [arg]}) instance = reservations[0].instances[0] except IndexError: try: instance = ...
python
def get(self, arg): """ Return instance object with given EC2 ID or nametag. """ try: reservations = self.get_all_instances(filters={'tag:Name': [arg]}) instance = reservations[0].instances[0] except IndexError: try: instance = ...
['def', 'get', '(', 'self', ',', 'arg', ')', ':', 'try', ':', 'reservations', '=', 'self', '.', 'get_all_instances', '(', 'filters', '=', '{', "'tag:Name'", ':', '[', 'arg', ']', '}', ')', 'instance', '=', 'reservations', '[', '0', ']', '.', 'instances', '[', '0', ']', 'except', 'IndexError', ':', 'try', ':', 'instance...
Return instance object with given EC2 ID or nametag.
['Return', 'instance', 'object', 'with', 'given', 'EC2', 'ID', 'or', 'nametag', '.']
train
https://github.com/bitprophet/botox/blob/02c887a28bd2638273548cc7d1e6d6f1d4d38bf9/botox/aws.py#L324-L338
2,233
persephone-tools/persephone
persephone/corpus.py
Corpus.indices_to_labels
def indices_to_labels(self, indices: Sequence[int]) -> List[str]: """ Converts a sequence of indices into their corresponding labels.""" return [(self.INDEX_TO_LABEL[index]) for index in indices]
python
def indices_to_labels(self, indices: Sequence[int]) -> List[str]: """ Converts a sequence of indices into their corresponding labels.""" return [(self.INDEX_TO_LABEL[index]) for index in indices]
['def', 'indices_to_labels', '(', 'self', ',', 'indices', ':', 'Sequence', '[', 'int', ']', ')', '->', 'List', '[', 'str', ']', ':', 'return', '[', '(', 'self', '.', 'INDEX_TO_LABEL', '[', 'index', ']', ')', 'for', 'index', 'in', 'indices', ']']
Converts a sequence of indices into their corresponding labels.
['Converts', 'a', 'sequence', 'of', 'indices', 'into', 'their', 'corresponding', 'labels', '.']
train
https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/corpus.py#L497-L500
2,234
tensorflow/datasets
tensorflow_datasets/image/cifar10_corrupted.py
Cifar10Corrupted._generate_examples
def _generate_examples(self, data_dir): """Generate corrupted Cifar10 test data. Apply corruptions to the raw images according to self.corruption_type. Args: data_dir: root directory of downloaded dataset Yields: dictionary with image file and label. """ corruption = self.builder_...
python
def _generate_examples(self, data_dir): """Generate corrupted Cifar10 test data. Apply corruptions to the raw images according to self.corruption_type. Args: data_dir: root directory of downloaded dataset Yields: dictionary with image file and label. """ corruption = self.builder_...
['def', '_generate_examples', '(', 'self', ',', 'data_dir', ')', ':', 'corruption', '=', 'self', '.', 'builder_config', '.', 'corruption', 'severity', '=', 'self', '.', 'builder_config', '.', 'severity', 'images_file', '=', 'os', '.', 'path', '.', 'join', '(', 'data_dir', ',', '_CORRUPTIONS_TO_FILENAMES', '[', 'corrupt...
Generate corrupted Cifar10 test data. Apply corruptions to the raw images according to self.corruption_type. Args: data_dir: root directory of downloaded dataset Yields: dictionary with image file and label.
['Generate', 'corrupted', 'Cifar10', 'test', 'data', '.']
train
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/image/cifar10_corrupted.py#L155-L189
2,235
bwohlberg/sporco
sporco/admm/parcbpdn.py
par_relax_AX
def par_relax_AX(i): """Parallel implementation of relaxation if option ``RelaxParam`` != 1.0. """ global mp_X global mp_Xnr global mp_DX global mp_DXnr mp_Xnr[mp_grp[i]:mp_grp[i+1]] = mp_X[mp_grp[i]:mp_grp[i+1]] mp_DXnr[i] = mp_DX[i] if mp_rlx != 1.0: grpind = slice(mp_...
python
def par_relax_AX(i): """Parallel implementation of relaxation if option ``RelaxParam`` != 1.0. """ global mp_X global mp_Xnr global mp_DX global mp_DXnr mp_Xnr[mp_grp[i]:mp_grp[i+1]] = mp_X[mp_grp[i]:mp_grp[i+1]] mp_DXnr[i] = mp_DX[i] if mp_rlx != 1.0: grpind = slice(mp_...
['def', 'par_relax_AX', '(', 'i', ')', ':', 'global', 'mp_X', 'global', 'mp_Xnr', 'global', 'mp_DX', 'global', 'mp_DXnr', 'mp_Xnr', '[', 'mp_grp', '[', 'i', ']', ':', 'mp_grp', '[', 'i', '+', '1', ']', ']', '=', 'mp_X', '[', 'mp_grp', '[', 'i', ']', ':', 'mp_grp', '[', 'i', '+', '1', ']', ']', 'mp_DXnr', '[', 'i', ']',...
Parallel implementation of relaxation if option ``RelaxParam`` != 1.0.
['Parallel', 'implementation', 'of', 'relaxation', 'if', 'option', 'RelaxParam', '!', '=', '1', '.', '0', '.']
train
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/parcbpdn.py#L163-L177
2,236
log2timeline/plaso
plaso/engine/worker.py
EventExtractionWorker._ExtractMetadataFromFileEntry
def _ExtractMetadataFromFileEntry(self, mediator, file_entry, data_stream): """Extracts metadata from a file entry. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. file_entry (dfvfs.FileEntry): file entry ...
python
def _ExtractMetadataFromFileEntry(self, mediator, file_entry, data_stream): """Extracts metadata from a file entry. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. file_entry (dfvfs.FileEntry): file entry ...
['def', '_ExtractMetadataFromFileEntry', '(', 'self', ',', 'mediator', ',', 'file_entry', ',', 'data_stream', ')', ':', '# Do not extract metadata from the root file entry when it is virtual.', 'if', 'file_entry', '.', 'IsRoot', '(', ')', 'and', 'file_entry', '.', 'type_indicator', 'not', 'in', '(', 'self', '.', '_TYPE...
Extracts metadata from a file entry. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. file_entry (dfvfs.FileEntry): file entry to extract metadata from. data_stream (dfvfs.DataStream): data stream or None...
['Extracts', 'metadata', 'from', 'a', 'file', 'entry', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/engine/worker.py#L338-L374
2,237
ktbyers/netmiko
netmiko/citrix/netscaler_ssh.py
NetscalerSSH.strip_prompt
def strip_prompt(self, a_string): """ Strip 'Done' from command output """ output = super(NetscalerSSH, self).strip_prompt(a_string) lines = output.split(self.RESPONSE_RETURN) if "Done" in lines[-1]: return self.RESPONSE_RETURN.join(lines[:-1]) else: retur...
python
def strip_prompt(self, a_string): """ Strip 'Done' from command output """ output = super(NetscalerSSH, self).strip_prompt(a_string) lines = output.split(self.RESPONSE_RETURN) if "Done" in lines[-1]: return self.RESPONSE_RETURN.join(lines[:-1]) else: retur...
['def', 'strip_prompt', '(', 'self', ',', 'a_string', ')', ':', 'output', '=', 'super', '(', 'NetscalerSSH', ',', 'self', ')', '.', 'strip_prompt', '(', 'a_string', ')', 'lines', '=', 'output', '.', 'split', '(', 'self', '.', 'RESPONSE_RETURN', ')', 'if', '"Done"', 'in', 'lines', '[', '-', '1', ']', ':', 'return', 'sel...
Strip 'Done' from command output
['Strip', 'Done', 'from', 'command', 'output']
train
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/citrix/netscaler_ssh.py#L53-L60
2,238
tompollard/tableone
tableone.py
TableOne._create_significance_table
def _create_significance_table(self,data): """ Create a table containing p-values for significance tests. Add features of the distributions and the p-values to the dataframe. Parameters ---------- data : pandas DataFrame The input dataset. Re...
python
def _create_significance_table(self,data): """ Create a table containing p-values for significance tests. Add features of the distributions and the p-values to the dataframe. Parameters ---------- data : pandas DataFrame The input dataset. Re...
['def', '_create_significance_table', '(', 'self', ',', 'data', ')', ':', '# list features of the variable e.g. matched, paired, n_expected', 'df', '=', 'pd', '.', 'DataFrame', '(', 'index', '=', 'self', '.', '_continuous', '+', 'self', '.', '_categorical', ',', 'columns', '=', '[', "'continuous'", ',', "'nonnormal'", ...
Create a table containing p-values for significance tests. Add features of the distributions and the p-values to the dataframe. Parameters ---------- data : pandas DataFrame The input dataset. Returns ---------- df : pandas DataFrame ...
['Create', 'a', 'table', 'containing', 'p', '-', 'values', 'for', 'significance', 'tests', '.', 'Add', 'features', 'of', 'the', 'distributions', 'and', 'the', 'p', '-', 'values', 'to', 'the', 'dataframe', '.']
train
https://github.com/tompollard/tableone/blob/4a274d3d2f8d16b8eaa0bde030f3da29b876cee8/tableone.py#L518-L572
2,239
tensorflow/tensor2tensor
tensor2tensor/rl/trainer_model_based_params.py
rlmb_tiny_stochastic
def rlmb_tiny_stochastic(): """Tiny setting with a stochastic next-frame model.""" hparams = rlmb_ppo_tiny() hparams.epochs = 1 # Too slow with 2 for regular runs. hparams.generative_model = "next_frame_basic_stochastic" hparams.generative_model_params = "next_frame_basic_stochastic" return hparams
python
def rlmb_tiny_stochastic(): """Tiny setting with a stochastic next-frame model.""" hparams = rlmb_ppo_tiny() hparams.epochs = 1 # Too slow with 2 for regular runs. hparams.generative_model = "next_frame_basic_stochastic" hparams.generative_model_params = "next_frame_basic_stochastic" return hparams
['def', 'rlmb_tiny_stochastic', '(', ')', ':', 'hparams', '=', 'rlmb_ppo_tiny', '(', ')', 'hparams', '.', 'epochs', '=', '1', '# Too slow with 2 for regular runs.', 'hparams', '.', 'generative_model', '=', '"next_frame_basic_stochastic"', 'hparams', '.', 'generative_model_params', '=', '"next_frame_basic_stochastic"', ...
Tiny setting with a stochastic next-frame model.
['Tiny', 'setting', 'with', 'a', 'stochastic', 'next', '-', 'frame', 'model', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/trainer_model_based_params.py#L596-L602
2,240
dcos/shakedown
shakedown/cli/main.py
cli
def cli(**args): """ Shakedown is a DC/OS test-harness wrapper for the pytest tool. """ import shakedown # Read configuration options from ~/.shakedown (if exists) args = read_config(args) # Set configuration defaults args = set_config_defaults(args) if args['quiet']: shakedow...
python
def cli(**args): """ Shakedown is a DC/OS test-harness wrapper for the pytest tool. """ import shakedown # Read configuration options from ~/.shakedown (if exists) args = read_config(args) # Set configuration defaults args = set_config_defaults(args) if args['quiet']: shakedow...
['def', 'cli', '(', '*', '*', 'args', ')', ':', 'import', 'shakedown', '# Read configuration options from ~/.shakedown (if exists)', 'args', '=', 'read_config', '(', 'args', ')', '# Set configuration defaults', 'args', '=', 'set_config_defaults', '(', 'args', ')', 'if', 'args', '[', "'quiet'", ']', ':', 'shakedown', '....
Shakedown is a DC/OS test-harness wrapper for the pytest tool.
['Shakedown', 'is', 'a', 'DC', '/', 'OS', 'test', '-', 'harness', 'wrapper', 'for', 'the', 'pytest', 'tool', '.']
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/cli/main.py#L30-L355
2,241
saltstack/salt
salt/modules/rh_ip.py
_parse_network_settings
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) #...
python
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) #...
['def', '_parse_network_settings', '(', 'opts', ',', 'current', ')', ':', '# Normalize keys', 'opts', '=', 'dict', '(', '(', 'k', '.', 'lower', '(', ')', ',', 'v', ')', 'for', '(', 'k', ',', 'v', ')', 'in', 'six', '.', 'iteritems', '(', 'opts', ')', ')', 'current', '=', 'dict', '(', '(', 'k', '.', 'lower', '(', ')', ',...
Filters given options and outputs valid settings for the global network settings file.
['Filters', 'given', 'options', 'and', 'outputs', 'valid', 'settings', 'for', 'the', 'global', 'network', 'settings', 'file', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L836-L903
2,242
saltstack/salt
salt/modules/glassfish.py
delete_connector_c_pool
def delete_connector_c_pool(name, target='server', cascade=True, server=None): ''' Delete a connection pool ''' data = {'target': target, 'cascade': cascade} return _delete_element(name, 'resources/connector-connection-pool', data, server)
python
def delete_connector_c_pool(name, target='server', cascade=True, server=None): ''' Delete a connection pool ''' data = {'target': target, 'cascade': cascade} return _delete_element(name, 'resources/connector-connection-pool', data, server)
['def', 'delete_connector_c_pool', '(', 'name', ',', 'target', '=', "'server'", ',', 'cascade', '=', 'True', ',', 'server', '=', 'None', ')', ':', 'data', '=', '{', "'target'", ':', 'target', ',', "'cascade'", ':', 'cascade', '}', 'return', '_delete_element', '(', 'name', ',', "'resources/connector-connection-pool'", '...
Delete a connection pool
['Delete', 'a', 'connection', 'pool']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L338-L343
2,243
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
XunitExport._check_lookup_prop
def _check_lookup_prop(self, result_data): """Checks that selected lookup property can be used for this testcase.""" if not self._lookup_prop: return False if not result_data.get("id") and self._lookup_prop != "name": return False if not result_data.get("title") ...
python
def _check_lookup_prop(self, result_data): """Checks that selected lookup property can be used for this testcase.""" if not self._lookup_prop: return False if not result_data.get("id") and self._lookup_prop != "name": return False if not result_data.get("title") ...
['def', '_check_lookup_prop', '(', 'self', ',', 'result_data', ')', ':', 'if', 'not', 'self', '.', '_lookup_prop', ':', 'return', 'False', 'if', 'not', 'result_data', '.', 'get', '(', '"id"', ')', 'and', 'self', '.', '_lookup_prop', '!=', '"name"', ':', 'return', 'False', 'if', 'not', 'result_data', '.', 'get', '(', '"...
Checks that selected lookup property can be used for this testcase.
['Checks', 'that', 'selected', 'lookup', 'property', 'can', 'be', 'used', 'for', 'this', 'testcase', '.']
train
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L175-L184
2,244
saltstack/salt
salt/utils/verify.py
list_path_traversal
def list_path_traversal(path): ''' Returns a full list of directories leading up to, and including, a path. So list_path_traversal('/path/to/salt') would return: ['/', '/path', '/path/to', '/path/to/salt'] in that order. This routine has been tested on Windows systems as well. list_pat...
python
def list_path_traversal(path): ''' Returns a full list of directories leading up to, and including, a path. So list_path_traversal('/path/to/salt') would return: ['/', '/path', '/path/to', '/path/to/salt'] in that order. This routine has been tested on Windows systems as well. list_pat...
['def', 'list_path_traversal', '(', 'path', ')', ':', 'out', '=', '[', 'path', ']', '(', 'head', ',', 'tail', ')', '=', 'os', '.', 'path', '.', 'split', '(', 'path', ')', 'if', 'tail', '==', "''", ':', '# paths with trailing separators will return an empty string', 'out', '=', '[', 'head', ']', '(', 'head', ',', 'tail'...
Returns a full list of directories leading up to, and including, a path. So list_path_traversal('/path/to/salt') would return: ['/', '/path', '/path/to', '/path/to/salt'] in that order. This routine has been tested on Windows systems as well. list_path_traversal('c:\\path\\to\\salt') on Window...
['Returns', 'a', 'full', 'list', 'of', 'directories', 'leading', 'up', 'to', 'and', 'including', 'a', 'path', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/verify.py#L359-L381
2,245
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/__subprocess.py
check_call
def check_call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the...
python
def check_call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the...
['def', 'check_call', '(', '*', 'popenargs', ',', '*', '*', 'kwargs', ')', ':', 'retcode', '=', 'call', '(', '*', 'popenargs', ',', '*', '*', 'kwargs', ')', 'cmd', '=', 'kwargs', '.', 'get', '(', '"args"', ')', 'if', 'cmd', 'is', 'None', ':', 'cmd', '=', 'popenargs', '[', '0', ']', 'if', 'retcode', ':', 'raise', 'Calle...
Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the Popen constructor. Example: check_call...
['Run', 'command', 'with', 'arguments', '.', 'Wait', 'for', 'command', 'to', 'complete', '.', 'If', 'the', 'exit', 'code', 'was', 'zero', 'then', 'return', 'otherwise', 'raise', 'CalledProcessError', '.', 'The', 'CalledProcessError', 'object', 'will', 'have', 'the', 'return', 'code', 'in', 'the', 'returncode', 'attribu...
train
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/__subprocess.py#L493-L509
2,246
wright-group/WrightTools
WrightTools/kit/_timestamp.py
TimeStamp.path
def path(self): """Timestamp for placing into filepaths.""" out = self.datetime.strftime("%Y-%m-%d") out += " " ssm = ( self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0) ).total_seconds() out += str(int(ssm)).zfill(5) ret...
python
def path(self): """Timestamp for placing into filepaths.""" out = self.datetime.strftime("%Y-%m-%d") out += " " ssm = ( self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0) ).total_seconds() out += str(int(ssm)).zfill(5) ret...
['def', 'path', '(', 'self', ')', ':', 'out', '=', 'self', '.', 'datetime', '.', 'strftime', '(', '"%Y-%m-%d"', ')', 'out', '+=', '" "', 'ssm', '=', '(', 'self', '.', 'datetime', '-', 'self', '.', 'datetime', '.', 'replace', '(', 'hour', '=', '0', ',', 'minute', '=', '0', ',', 'second', '=', '0', ',', 'microsecond', '=...
Timestamp for placing into filepaths.
['Timestamp', 'for', 'placing', 'into', 'filepaths', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_timestamp.py#L187-L195
2,247
goshuirc/irc
girc/client.py
ServerConnection.register_event
def register_event(self, direction, verb, child_fn, priority=10): """Register an event with all servers. Args: direction (str): `in`, `out`, `both`, or `girc`. verb (str): Event name, `all`, or `raw`. child_fn (function): Handler function. priority (int):...
python
def register_event(self, direction, verb, child_fn, priority=10): """Register an event with all servers. Args: direction (str): `in`, `out`, `both`, or `girc`. verb (str): Event name, `all`, or `raw`. child_fn (function): Handler function. priority (int):...
['def', 'register_event', '(', 'self', ',', 'direction', ',', 'verb', ',', 'child_fn', ',', 'priority', '=', '10', ')', ':', 'event_managers', '=', '[', ']', 'if', 'direction', 'in', '(', "'in'", ',', "'both'", ')', ':', 'event_managers', '.', 'append', '(', 'self', '.', '_events_in', ')', 'if', 'direction', 'in', '(',...
Register an event with all servers. Args: direction (str): `in`, `out`, `both`, or `girc`. verb (str): Event name, `all`, or `raw`. child_fn (function): Handler function. priority (int): Handler priority (lower priority executes first). Note: `all` will ...
['Register', 'an', 'event', 'with', 'all', 'servers', '.']
train
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/client.py#L98-L119
2,248
briney/abutils
abutils/core/pair.py
Pair._refine_v
def _refine_v(seq, species): ''' Completes the 5' end of a a truncated sequence with germline nucleotides. Input is a MongoDB dict (seq) and the species. ''' vgerm = germlines.get_germline(seq['v_gene']['full'], species) aln = global_alignment(seq['vdj_nt'], vgerm) ...
python
def _refine_v(seq, species): ''' Completes the 5' end of a a truncated sequence with germline nucleotides. Input is a MongoDB dict (seq) and the species. ''' vgerm = germlines.get_germline(seq['v_gene']['full'], species) aln = global_alignment(seq['vdj_nt'], vgerm) ...
['def', '_refine_v', '(', 'seq', ',', 'species', ')', ':', 'vgerm', '=', 'germlines', '.', 'get_germline', '(', 'seq', '[', "'v_gene'", ']', '[', "'full'", ']', ',', 'species', ')', 'aln', '=', 'global_alignment', '(', 'seq', '[', "'vdj_nt'", ']', ',', 'vgerm', ')', 'prepend', '=', "''", 'for', 's', ',', 'g', 'in', 'zi...
Completes the 5' end of a a truncated sequence with germline nucleotides. Input is a MongoDB dict (seq) and the species.
['Completes', 'the', '5', 'end', 'of', 'a', 'a', 'truncated', 'sequence', 'with', 'germline', 'nucleotides', '.', 'Input', 'is', 'a', 'MongoDB', 'dict', '(', 'seq', ')', 'and', 'the', 'species', '.']
train
https://github.com/briney/abutils/blob/944755fc7d28bfc7d4f1ffad94ca0bf9d74ec54b/abutils/core/pair.py#L262-L275
2,249
RudolfCardinal/pythonlib
cardinal_pythonlib/datetimefunc.py
format_datetime
def format_datetime(d: PotentialDatetimeType, fmt: str, default: str = None) -> Optional[str]: """ Format a datetime with a ``strftime`` format specification string, or return ``default`` if the input is ``None``. """ d = coerce_to_pendulum(d) if d is None...
python
def format_datetime(d: PotentialDatetimeType, fmt: str, default: str = None) -> Optional[str]: """ Format a datetime with a ``strftime`` format specification string, or return ``default`` if the input is ``None``. """ d = coerce_to_pendulum(d) if d is None...
['def', 'format_datetime', '(', 'd', ':', 'PotentialDatetimeType', ',', 'fmt', ':', 'str', ',', 'default', ':', 'str', '=', 'None', ')', '->', 'Optional', '[', 'str', ']', ':', 'd', '=', 'coerce_to_pendulum', '(', 'd', ')', 'if', 'd', 'is', 'None', ':', 'return', 'default', 'return', 'd', '.', 'strftime', '(', 'fmt', '...
Format a datetime with a ``strftime`` format specification string, or return ``default`` if the input is ``None``.
['Format', 'a', 'datetime', 'with', 'a', 'strftime', 'format', 'specification', 'string', 'or', 'return', 'default', 'if', 'the', 'input', 'is', 'None', '.']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/datetimefunc.py#L191-L201
2,250
ansible-community/ara
ara/views/file.py
index
def index(): """ This is not served anywhere in the web application. It is used explicitly in the context of generating static files since flask-frozen requires url_for's to crawl content. url_for's are not used with file.show_file directly and are instead dynamically generated through javascrip...
python
def index(): """ This is not served anywhere in the web application. It is used explicitly in the context of generating static files since flask-frozen requires url_for's to crawl content. url_for's are not used with file.show_file directly and are instead dynamically generated through javascrip...
['def', 'index', '(', ')', ':', 'if', 'current_app', '.', 'config', '[', "'ARA_PLAYBOOK_OVERRIDE'", ']', 'is', 'not', 'None', ':', 'override', '=', 'current_app', '.', 'config', '[', "'ARA_PLAYBOOK_OVERRIDE'", ']', 'files', '=', '(', 'models', '.', 'File', '.', 'query', '.', 'filter', '(', 'models', '.', 'File', '.', '...
This is not served anywhere in the web application. It is used explicitly in the context of generating static files since flask-frozen requires url_for's to crawl content. url_for's are not used with file.show_file directly and are instead dynamically generated through javascript for performance purpose...
['This', 'is', 'not', 'served', 'anywhere', 'in', 'the', 'web', 'application', '.', 'It', 'is', 'used', 'explicitly', 'in', 'the', 'context', 'of', 'generating', 'static', 'files', 'since', 'flask', '-', 'frozen', 'requires', 'url_for', 's', 'to', 'crawl', 'content', '.', 'url_for', 's', 'are', 'not', 'used', 'with', '...
train
https://github.com/ansible-community/ara/blob/15e2d0133c23b6d07438a553bb8149fadff21547/ara/views/file.py#L28-L43
2,251
rosenbrockc/fortpy
fortpy/isense/builtin.py
load
def load(parser, serializer): """Returns a dictionary of builtin functions for Fortran. Checks the cache first to see if we have a serialized version. If we don't, it loads it from the XML file. :arg parser: the DocParser instance for parsing the XML tags. :arg serializer: a Serializer instance fro...
python
def load(parser, serializer): """Returns a dictionary of builtin functions for Fortran. Checks the cache first to see if we have a serialized version. If we don't, it loads it from the XML file. :arg parser: the DocParser instance for parsing the XML tags. :arg serializer: a Serializer instance fro...
['def', 'load', '(', 'parser', ',', 'serializer', ')', ':', 'fortdir', '=', 'os', '.', 'path', '.', 'dirname', '(', 'fortpy', '.', '__file__', ')', 'xmlpath', '=', 'os', '.', 'path', '.', 'join', '(', 'fortdir', ',', '"isense"', ',', '"builtin.xml"', ')', 'if', 'not', 'os', '.', 'path', '.', 'isfile', '(', 'xmlpath', '...
Returns a dictionary of builtin functions for Fortran. Checks the cache first to see if we have a serialized version. If we don't, it loads it from the XML file. :arg parser: the DocParser instance for parsing the XML tags. :arg serializer: a Serializer instance from the CodeParser to cache the l...
['Returns', 'a', 'dictionary', 'of', 'builtin', 'functions', 'for', 'Fortran', '.', 'Checks', 'the', 'cache', 'first', 'to', 'see', 'if', 'we', 'have', 'a', 'serialized', 'version', '.', 'If', 'we', 'don', 't', 'it', 'loads', 'it', 'from', 'the', 'XML', 'file', '.']
train
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/builtin.py#L11-L33
2,252
twilio/twilio-python
twilio/rest/messaging/v1/session/message.py
MessagePage.get_instance
def get_instance(self, payload): """ Build an instance of MessageInstance :param dict payload: Payload response from the API :returns: twilio.rest.messaging.v1.session.message.MessageInstance :rtype: twilio.rest.messaging.v1.session.message.MessageInstance """ r...
python
def get_instance(self, payload): """ Build an instance of MessageInstance :param dict payload: Payload response from the API :returns: twilio.rest.messaging.v1.session.message.MessageInstance :rtype: twilio.rest.messaging.v1.session.message.MessageInstance """ r...
['def', 'get_instance', '(', 'self', ',', 'payload', ')', ':', 'return', 'MessageInstance', '(', 'self', '.', '_version', ',', 'payload', ',', 'session_sid', '=', 'self', '.', '_solution', '[', "'session_sid'", ']', ',', ')']
Build an instance of MessageInstance :param dict payload: Payload response from the API :returns: twilio.rest.messaging.v1.session.message.MessageInstance :rtype: twilio.rest.messaging.v1.session.message.MessageInstance
['Build', 'an', 'instance', 'of', 'MessageInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/messaging/v1/session/message.py#L204-L213
2,253
opennode/waldur-core
waldur_core/core/models.py
ReversionMixin._is_version_duplicate
def _is_version_duplicate(self): """ Define should new version be created for object or no. Reasons to provide custom check instead of default `ignore_revision_duplicates`: - no need to compare all revisions - it is OK if right object version exists in any revision; - need...
python
def _is_version_duplicate(self): """ Define should new version be created for object or no. Reasons to provide custom check instead of default `ignore_revision_duplicates`: - no need to compare all revisions - it is OK if right object version exists in any revision; - need...
['def', '_is_version_duplicate', '(', 'self', ')', ':', 'if', 'self', '.', 'id', 'is', 'None', ':', 'return', 'False', 'try', ':', 'latest_version', '=', 'Version', '.', 'objects', '.', 'get_for_object', '(', 'self', ')', '.', 'latest', '(', "'revision__date_created'", ')', 'except', 'Version', '.', 'DoesNotExist', ':'...
Define should new version be created for object or no. Reasons to provide custom check instead of default `ignore_revision_duplicates`: - no need to compare all revisions - it is OK if right object version exists in any revision; - need to compare object attributes (not serialized...
['Define', 'should', 'new', 'version', 'be', 'created', 'for', 'object', 'or', 'no', '.']
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/models.py#L385-L401
2,254
brmscheiner/ideogram
ideogram/importAnalysis.py
getModulePath
def getModulePath(project_path,module_name,verbose): '''Searches for module_name in searchpath and returns the filepath. If no filepath was found, returns None.''' if not module_name: return None sys.path.append(project_path) try: package = pkgutil.get_loader(module_name) except ...
python
def getModulePath(project_path,module_name,verbose): '''Searches for module_name in searchpath and returns the filepath. If no filepath was found, returns None.''' if not module_name: return None sys.path.append(project_path) try: package = pkgutil.get_loader(module_name) except ...
['def', 'getModulePath', '(', 'project_path', ',', 'module_name', ',', 'verbose', ')', ':', 'if', 'not', 'module_name', ':', 'return', 'None', 'sys', '.', 'path', '.', 'append', '(', 'project_path', ')', 'try', ':', 'package', '=', 'pkgutil', '.', 'get_loader', '(', 'module_name', ')', 'except', 'ImportError', ':', 'if...
Searches for module_name in searchpath and returns the filepath. If no filepath was found, returns None.
['Searches', 'for', 'module_name', 'in', 'searchpath', 'and', 'returns', 'the', 'filepath', '.', 'If', 'no', 'filepath', 'was', 'found', 'returns', 'None', '.']
train
https://github.com/brmscheiner/ideogram/blob/422bf566c51fd56f7bbb6e75b16d18d52b4c7568/ideogram/importAnalysis.py#L4-L44
2,255
google/mobly
mobly/controllers/android_device_lib/snippet_client.py
SnippetClient._read_protocol_line
def _read_protocol_line(self): """Reads the next line of instrumentation output relevant to snippets. This method will skip over lines that don't start with 'SNIPPET' or 'INSTRUMENTATION_RESULT'. Returns: (str) Next line of snippet-related instrumentation output, stripped. ...
python
def _read_protocol_line(self): """Reads the next line of instrumentation output relevant to snippets. This method will skip over lines that don't start with 'SNIPPET' or 'INSTRUMENTATION_RESULT'. Returns: (str) Next line of snippet-related instrumentation output, stripped. ...
['def', '_read_protocol_line', '(', 'self', ')', ':', 'while', 'True', ':', 'line', '=', 'self', '.', '_proc', '.', 'stdout', '.', 'readline', '(', ')', '.', 'decode', '(', "'utf-8'", ')', 'if', 'not', 'line', ':', 'raise', 'jsonrpc_client_base', '.', 'AppStartError', '(', 'self', '.', '_ad', ',', "'Unexpected EOF wait...
Reads the next line of instrumentation output relevant to snippets. This method will skip over lines that don't start with 'SNIPPET' or 'INSTRUMENTATION_RESULT'. Returns: (str) Next line of snippet-related instrumentation output, stripped. Raises: jsonrpc_clien...
['Reads', 'the', 'next', 'line', 'of', 'instrumentation', 'output', 'relevant', 'to', 'snippets', '.']
train
https://github.com/google/mobly/blob/38ba2cf7d29a20e6a2fca1718eecb337df38db26/mobly/controllers/android_device_lib/snippet_client.py#L294-L323
2,256
lablup/backend.ai-client-py
src/ai/backend/client/auth.py
generate_signature
def generate_signature(method, version, endpoint, date, rel_url, content_type, content, access_key, secret_key, hash_type): ''' Generates the API request signature from the given parameters. ''' hash_type = hash_type hostname = endpoint._val.netloc # FI...
python
def generate_signature(method, version, endpoint, date, rel_url, content_type, content, access_key, secret_key, hash_type): ''' Generates the API request signature from the given parameters. ''' hash_type = hash_type hostname = endpoint._val.netloc # FI...
['def', 'generate_signature', '(', 'method', ',', 'version', ',', 'endpoint', ',', 'date', ',', 'rel_url', ',', 'content_type', ',', 'content', ',', 'access_key', ',', 'secret_key', ',', 'hash_type', ')', ':', 'hash_type', '=', 'hash_type', 'hostname', '=', 'endpoint', '.', '_val', '.', 'netloc', '# FIXME: migrate to p...
Generates the API request signature from the given parameters.
['Generates', 'the', 'API', 'request', 'signature', 'from', 'the', 'given', 'parameters', '.']
train
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/auth.py#L5-L43
2,257
Alignak-monitoring/alignak
alignak/util.py
list_to_serialized
def list_to_serialized(ref, the_list): """Serialize the list of elements Used for the retention store :param ref: Not used :type ref: :param the_list: dictionary to convert :type the_list: dict :return: dict of serialized :rtype: dict """ result = [] for elt in the_list: ...
python
def list_to_serialized(ref, the_list): """Serialize the list of elements Used for the retention store :param ref: Not used :type ref: :param the_list: dictionary to convert :type the_list: dict :return: dict of serialized :rtype: dict """ result = [] for elt in the_list: ...
['def', 'list_to_serialized', '(', 'ref', ',', 'the_list', ')', ':', 'result', '=', '[', ']', 'for', 'elt', 'in', 'the_list', ':', 'if', 'not', 'getattr', '(', 'elt', ',', "'serialize'", ',', 'None', ')', ':', 'continue', 'result', '.', 'append', '(', 'elt', '.', 'serialize', '(', ')', ')', 'return', 'result']
Serialize the list of elements Used for the retention store :param ref: Not used :type ref: :param the_list: dictionary to convert :type the_list: dict :return: dict of serialized :rtype: dict
['Serialize', 'the', 'list', 'of', 'elements']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/util.py#L607-L624
2,258
gem/oq-engine
openquake/hazardlib/gsim/travasarou_2003.py
TravasarouEtAl2003._compute_distance
def _compute_distance(self, dists, C): """ Compute the second term of the equation described on p. 1144: `` c4 * np.log(sqrt(R ** 2. + h ** 2.) """ return C["c4"] * np.log(np.sqrt(dists.rrup ** 2. + C["h"] ** 2.))
python
def _compute_distance(self, dists, C): """ Compute the second term of the equation described on p. 1144: `` c4 * np.log(sqrt(R ** 2. + h ** 2.) """ return C["c4"] * np.log(np.sqrt(dists.rrup ** 2. + C["h"] ** 2.))
['def', '_compute_distance', '(', 'self', ',', 'dists', ',', 'C', ')', ':', 'return', 'C', '[', '"c4"', ']', '*', 'np', '.', 'log', '(', 'np', '.', 'sqrt', '(', 'dists', '.', 'rrup', '**', '2.', '+', 'C', '[', '"h"', ']', '**', '2.', ')', ')']
Compute the second term of the equation described on p. 1144: `` c4 * np.log(sqrt(R ** 2. + h ** 2.)
['Compute', 'the', 'second', 'term', 'of', 'the', 'equation', 'described', 'on', 'p', '.', '1144', ':']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/travasarou_2003.py#L156-L162
2,259
bwohlberg/sporco
sporco/prox/_lp.py
proj_l2
def proj_l2(v, gamma, axis=None): r"""Compute the projection operator of the :math:`\ell_2` norm. The projection operator of the uncentered :math:`\ell_2` norm, .. math:: \mathrm{argmin}_{\mathbf{x}} (1/2) \| \mathbf{x} - \mathbf{v} \|_2^2 \; \text{ s.t. } \; \| \mathbf{x} - \mathbf{s} \|_2 \l...
python
def proj_l2(v, gamma, axis=None): r"""Compute the projection operator of the :math:`\ell_2` norm. The projection operator of the uncentered :math:`\ell_2` norm, .. math:: \mathrm{argmin}_{\mathbf{x}} (1/2) \| \mathbf{x} - \mathbf{v} \|_2^2 \; \text{ s.t. } \; \| \mathbf{x} - \mathbf{s} \|_2 \l...
['def', 'proj_l2', '(', 'v', ',', 'gamma', ',', 'axis', '=', 'None', ')', ':', 'd', '=', 'np', '.', 'sqrt', '(', 'np', '.', 'sum', '(', 'v', '**', '2', ',', 'axis', '=', 'axis', ',', 'keepdims', '=', 'True', ')', ')', 'return', 'np', '.', 'asarray', '(', '(', 'd', '<=', 'gamma', ')', '*', 'v', '+', '(', 'd', '>', 'gamm...
r"""Compute the projection operator of the :math:`\ell_2` norm. The projection operator of the uncentered :math:`\ell_2` norm, .. math:: \mathrm{argmin}_{\mathbf{x}} (1/2) \| \mathbf{x} - \mathbf{v} \|_2^2 \; \text{ s.t. } \; \| \mathbf{x} - \mathbf{s} \|_2 \leq \gamma can be computed as :mat...
['r', 'Compute', 'the', 'projection', 'operator', 'of', 'the', ':', 'math', ':', '\\', 'ell_2', 'norm', '.']
train
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/prox/_lp.py#L284-L319
2,260
gwastro/pycbc
pycbc/tmpltbank/coord_utils.py
find_max_and_min_frequencies
def find_max_and_min_frequencies(name, mass_range_params, freqs): """ ADD DOCS """ cutoff_fns = pnutils.named_frequency_cutoffs if name not in cutoff_fns.keys(): err_msg = "%s not recognized as a valid cutoff frequency choice." %name err_msg += "Recognized choices: " + " ".join(cuto...
python
def find_max_and_min_frequencies(name, mass_range_params, freqs): """ ADD DOCS """ cutoff_fns = pnutils.named_frequency_cutoffs if name not in cutoff_fns.keys(): err_msg = "%s not recognized as a valid cutoff frequency choice." %name err_msg += "Recognized choices: " + " ".join(cuto...
['def', 'find_max_and_min_frequencies', '(', 'name', ',', 'mass_range_params', ',', 'freqs', ')', ':', 'cutoff_fns', '=', 'pnutils', '.', 'named_frequency_cutoffs', 'if', 'name', 'not', 'in', 'cutoff_fns', '.', 'keys', '(', ')', ':', 'err_msg', '=', '"%s not recognized as a valid cutoff frequency choice."', '%', 'name'...
ADD DOCS
['ADD', 'DOCS']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/tmpltbank/coord_utils.py#L633-L687
2,261
delph-in/pydelphin
delphin/mrs/query.py
select_eps
def select_eps(xmrs, nodeid=None, iv=None, label=None, pred=None): """ Return the list of matching elementary predications in *xmrs*. :class:`~delphin.mrs.components.ElementaryPredication` objects for *xmrs* match if their `nodeid` matches *nodeid*, `intrinsic_variable` matches *iv*, `label` matche...
python
def select_eps(xmrs, nodeid=None, iv=None, label=None, pred=None): """ Return the list of matching elementary predications in *xmrs*. :class:`~delphin.mrs.components.ElementaryPredication` objects for *xmrs* match if their `nodeid` matches *nodeid*, `intrinsic_variable` matches *iv*, `label` matche...
['def', 'select_eps', '(', 'xmrs', ',', 'nodeid', '=', 'None', ',', 'iv', '=', 'None', ',', 'label', '=', 'None', ',', 'pred', '=', 'None', ')', ':', 'epmatch', '=', 'lambda', 'n', ':', '(', '(', 'nodeid', 'is', 'None', 'or', 'n', '.', 'nodeid', '==', 'nodeid', ')', 'and', '(', 'iv', 'is', 'None', 'or', 'n', '.', 'iv',...
Return the list of matching elementary predications in *xmrs*. :class:`~delphin.mrs.components.ElementaryPredication` objects for *xmrs* match if their `nodeid` matches *nodeid*, `intrinsic_variable` matches *iv*, `label` matches *label*, and `pred` to *pred*. The *nodeid*, *iv*, *label*, and *pred* fi...
['Return', 'the', 'list', 'of', 'matching', 'elementary', 'predications', 'in', '*', 'xmrs', '*', '.']
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/query.py#L62-L87
2,262
saltstack/salt
salt/modules/rpm_lowpkg.py
file_list
def file_list(*packages, **kwargs): ''' List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block...
python
def file_list(*packages, **kwargs): ''' List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block...
['def', 'file_list', '(', '*', 'packages', ',', '*', '*', 'kwargs', ')', ':', 'cmd', '=', '[', "'rpm'", ']', 'if', 'kwargs', '.', 'get', '(', "'root'", ')', ':', 'cmd', '.', 'extend', '(', '[', "'--root'", ',', 'kwargs', '[', "'root'", ']', ']', ')', 'cmd', '.', 'append', '(', "'-ql'", 'if', 'packages', 'else', "'-qla'...
List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block:: bash salt '*' lowpkg.file_list httpd...
['List', 'the', 'files', 'that', 'belong', 'to', 'a', 'package', '.', 'Not', 'specifying', 'any', 'packages', 'will', 'return', 'a', 'list', 'of', '_every_', 'file', 'on', 'the', 'system', 's', 'rpm', 'database', '(', 'not', 'generally', 'recommended', ')', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L343-L373
2,263
cloudera/cm_api
python/src/cm_shell/cmps.py
ClouderaShell.do_stop_role
def do_stop_role(self, role): """ Stop a role Usage: > stop_role <role> Stops this role """ if not role: return None if not self.has_cluster(): return None if '-' not in role: print("Please enter a valid role name...
python
def do_stop_role(self, role): """ Stop a role Usage: > stop_role <role> Stops this role """ if not role: return None if not self.has_cluster(): return None if '-' not in role: print("Please enter a valid role name...
['def', 'do_stop_role', '(', 'self', ',', 'role', ')', ':', 'if', 'not', 'role', ':', 'return', 'None', 'if', 'not', 'self', '.', 'has_cluster', '(', ')', ':', 'return', 'None', 'if', "'-'", 'not', 'in', 'role', ':', 'print', '(', '"Please enter a valid role name"', ')', 'return', 'None', 'try', ':', 'service', '=', 'a...
Stop a role Usage: > stop_role <role> Stops this role
['Stop', 'a', 'role', 'Usage', ':', '>', 'stop_role', '<role', '>', 'Stops', 'this', 'role']
train
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/src/cm_shell/cmps.py#L498-L519
2,264
bcbio/bcbio-nextgen
bcbio/rnaseq/gtf.py
tx2genefile
def tx2genefile(gtf, out_file=None, data=None, tsv=True, keep_version=False): """ write out a file of transcript->gene mappings. """ if tsv: extension = ".tsv" sep = "\t" else: extension = ".csv" sep = "," if file_exists(out_file): return out_file with...
python
def tx2genefile(gtf, out_file=None, data=None, tsv=True, keep_version=False): """ write out a file of transcript->gene mappings. """ if tsv: extension = ".tsv" sep = "\t" else: extension = ".csv" sep = "," if file_exists(out_file): return out_file with...
['def', 'tx2genefile', '(', 'gtf', ',', 'out_file', '=', 'None', ',', 'data', '=', 'None', ',', 'tsv', '=', 'True', ',', 'keep_version', '=', 'False', ')', ':', 'if', 'tsv', ':', 'extension', '=', '".tsv"', 'sep', '=', '"\\t"', 'else', ':', 'extension', '=', '".csv"', 'sep', '=', '","', 'if', 'file_exists', '(', 'out_f...
write out a file of transcript->gene mappings.
['write', 'out', 'a', 'file', 'of', 'transcript', '-', '>', 'gene', 'mappings', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/gtf.py#L330-L347
2,265
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
OpenFileCache.close
def close(self, filehandle): """Close openend file if no longer used.""" with self.lock: if filehandle in self.files: self.files[filehandle] -= 1 # trim the file cache index = 0 size = len(self.past) while size >...
python
def close(self, filehandle): """Close openend file if no longer used.""" with self.lock: if filehandle in self.files: self.files[filehandle] -= 1 # trim the file cache index = 0 size = len(self.past) while size >...
['def', 'close', '(', 'self', ',', 'filehandle', ')', ':', 'with', 'self', '.', 'lock', ':', 'if', 'filehandle', 'in', 'self', '.', 'files', ':', 'self', '.', 'files', '[', 'filehandle', ']', '-=', '1', '# trim the file cache', 'index', '=', '0', 'size', '=', 'len', '(', 'self', '.', 'past', ')', 'while', 'size', '>', ...
Close openend file if no longer used.
['Close', 'openend', 'file', 'if', 'no', 'longer', 'used', '.']
train
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L5759-L5775
2,266
AnalogJ/lexicon
lexicon/providers/powerdns.py
Provider.zone_data
def zone_data(self): """Get zone data""" if self._zone_data is None: self._zone_data = self._get('/zones/' + self.domain).json() return self._zone_data
python
def zone_data(self): """Get zone data""" if self._zone_data is None: self._zone_data = self._get('/zones/' + self.domain).json() return self._zone_data
['def', 'zone_data', '(', 'self', ')', ':', 'if', 'self', '.', '_zone_data', 'is', 'None', ':', 'self', '.', '_zone_data', '=', 'self', '.', '_get', '(', "'/zones/'", '+', 'self', '.', 'domain', ')', '.', 'json', '(', ')', 'return', 'self', '.', '_zone_data']
Get zone data
['Get', 'zone', 'data']
train
https://github.com/AnalogJ/lexicon/blob/9330b871988753cad44fe2876a217b4c67b1fa0e/lexicon/providers/powerdns.py#L86-L90
2,267
maxfischer2781/include
include/mount/__init__.py
MountLoader.load_module
def load_module(self, name): """Load and return a module""" if name in sys.modules: return sys.modules[name] # load the actual import hook module module_name = self.mount2name(name) __import__(module_name) # alias the import hook module to the mount, so both c...
python
def load_module(self, name): """Load and return a module""" if name in sys.modules: return sys.modules[name] # load the actual import hook module module_name = self.mount2name(name) __import__(module_name) # alias the import hook module to the mount, so both c...
['def', 'load_module', '(', 'self', ',', 'name', ')', ':', 'if', 'name', 'in', 'sys', '.', 'modules', ':', 'return', 'sys', '.', 'modules', '[', 'name', ']', '# load the actual import hook module', 'module_name', '=', 'self', '.', 'mount2name', '(', 'name', ')', '__import__', '(', 'module_name', ')', '# alias the impor...
Load and return a module
['Load', 'and', 'return', 'a', 'module']
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/mount/__init__.py#L9-L19
2,268
IdentityPython/SATOSA
src/satosa/frontends/saml2.py
SAMLFrontend._get_approved_attributes
def _get_approved_attributes(self, idp, idp_policy, sp_entity_id, state): """ Returns a list of approved attributes :type idp: saml.server.Server :type idp_policy: saml2.assertion.Policy :type sp_entity_id: str :type state: satosa.state.State :rtype: list[str] ...
python
def _get_approved_attributes(self, idp, idp_policy, sp_entity_id, state): """ Returns a list of approved attributes :type idp: saml.server.Server :type idp_policy: saml2.assertion.Policy :type sp_entity_id: str :type state: satosa.state.State :rtype: list[str] ...
['def', '_get_approved_attributes', '(', 'self', ',', 'idp', ',', 'idp_policy', ',', 'sp_entity_id', ',', 'state', ')', ':', 'name_format', '=', 'idp_policy', '.', 'get_name_form', '(', 'sp_entity_id', ')', 'attrconvs', '=', 'idp', '.', 'config', '.', 'attribute_converters', 'idp_policy', '.', 'acs', '=', 'attrconvs', ...
Returns a list of approved attributes :type idp: saml.server.Server :type idp_policy: saml2.assertion.Policy :type sp_entity_id: str :type state: satosa.state.State :rtype: list[str] :param idp: The saml frontend idp server :param idp_policy: The idp policy ...
['Returns', 'a', 'list', 'of', 'approved', 'attributes']
train
https://github.com/IdentityPython/SATOSA/blob/49da5d4c0ac1a5ebf1a71b4f7aaf04f0e52d8fdb/src/satosa/frontends/saml2.py#L247-L274
2,269
seung-lab/cloud-volume
cloudvolume/skeletonservice.py
PrecomputedSkeleton.from_path
def from_path(kls, vertices): """ Given an Nx3 array of vertices that constitute a single path, generate a skeleton with appropriate edges. """ if vertices.shape[0] == 0: return PrecomputedSkeleton() skel = PrecomputedSkeleton(vertices) edges = np.zeros(shape=(skel.vertices.shape[0] ...
python
def from_path(kls, vertices): """ Given an Nx3 array of vertices that constitute a single path, generate a skeleton with appropriate edges. """ if vertices.shape[0] == 0: return PrecomputedSkeleton() skel = PrecomputedSkeleton(vertices) edges = np.zeros(shape=(skel.vertices.shape[0] ...
['def', 'from_path', '(', 'kls', ',', 'vertices', ')', ':', 'if', 'vertices', '.', 'shape', '[', '0', ']', '==', '0', ':', 'return', 'PrecomputedSkeleton', '(', ')', 'skel', '=', 'PrecomputedSkeleton', '(', 'vertices', ')', 'edges', '=', 'np', '.', 'zeros', '(', 'shape', '=', '(', 'skel', '.', 'vertices', '.', 'shape',...
Given an Nx3 array of vertices that constitute a single path, generate a skeleton with appropriate edges.
['Given', 'an', 'Nx3', 'array', 'of', 'vertices', 'that', 'constitute', 'a', 'single', 'path', 'generate', 'a', 'skeleton', 'with', 'appropriate', 'edges', '.']
train
https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L63-L76
2,270
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
replicate
def replicate(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' target = replicate_no_merge(source, model, cache=cache) if target is not None: db = object_session(source) target = db.merge(target) return target
python
def replicate(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' target = replicate_no_merge(source, model, cache=cache) if target is not None: db = object_session(source) target = db.merge(target) return target
['def', 'replicate', '(', 'source', ',', 'model', ',', 'cache', '=', 'None', ')', ':', 'target', '=', 'replicate_no_merge', '(', 'source', ',', 'model', ',', 'cache', '=', 'cache', ')', 'if', 'target', 'is', 'not', 'None', ':', 'db', '=', 'object_session', '(', 'source', ')', 'target', '=', 'db', '.', 'merge', '(', 'ta...
Replicates the `source` object to `model` class and returns its reflection.
['Replicates', 'the', 'source', 'object', 'to', 'model', 'class', 'and', 'returns', 'its', 'reflection', '.']
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L207-L214
2,271
tanghaibao/goatools
goatools/grouper/sorter_nts.py
SorterNts._get_sorted_section
def _get_sorted_section(self, nts_section): """Sort GO IDs in each section, if requested by user.""" #pylint: disable=unnecessary-lambda if self.section_sortby is True: return sorted(nts_section, key=lambda nt: self.sortgos.usrgo_sortby(nt)) if self.section_sortby is False or...
python
def _get_sorted_section(self, nts_section): """Sort GO IDs in each section, if requested by user.""" #pylint: disable=unnecessary-lambda if self.section_sortby is True: return sorted(nts_section, key=lambda nt: self.sortgos.usrgo_sortby(nt)) if self.section_sortby is False or...
['def', '_get_sorted_section', '(', 'self', ',', 'nts_section', ')', ':', '#pylint: disable=unnecessary-lambda', 'if', 'self', '.', 'section_sortby', 'is', 'True', ':', 'return', 'sorted', '(', 'nts_section', ',', 'key', '=', 'lambda', 'nt', ':', 'self', '.', 'sortgos', '.', 'usrgo_sortby', '(', 'nt', ')', ')', 'if', '...
Sort GO IDs in each section, if requested by user.
['Sort', 'GO', 'IDs', 'in', 'each', 'section', 'if', 'requested', 'by', 'user', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/sorter_nts.py#L88-L96
2,272
Alignak-monitoring/alignak
alignak/misc/carboniface.py
CarbonIface.add_data
def add_data(self, metric, value, ts=None): """ Add data to queue :param metric: the metric name :type metric: str :param value: the value of data :type value: int :param ts: the timestamp :type ts: int | None :return: True if added successfully, ...
python
def add_data(self, metric, value, ts=None): """ Add data to queue :param metric: the metric name :type metric: str :param value: the value of data :type value: int :param ts: the timestamp :type ts: int | None :return: True if added successfully, ...
['def', 'add_data', '(', 'self', ',', 'metric', ',', 'value', ',', 'ts', '=', 'None', ')', ':', 'if', 'not', 'ts', ':', 'ts', '=', 'time', '.', 'time', '(', ')', 'if', 'self', '.', '__data_lock', '.', 'acquire', '(', ')', ':', 'self', '.', '__data', '.', 'append', '(', '(', 'metric', ',', '(', 'ts', ',', 'value', ')', ...
Add data to queue :param metric: the metric name :type metric: str :param value: the value of data :type value: int :param ts: the timestamp :type ts: int | None :return: True if added successfully, otherwise False :rtype: bool
['Add', 'data', 'to', 'queue']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/misc/carboniface.py#L40-L59
2,273
RI-imaging/ODTbrain
examples/example_helper.py
load_zip_data
def load_zip_data(zipname, f_sino_real, f_sino_imag, f_angles=None, f_phantom=None, f_info=None): """Load example sinogram data from a .zip file""" ret = [] with zipfile.ZipFile(str(zipname)) as arc: sino_real = np.loadtxt(arc.open(f_sino_real)) sino_imag = np.loadtxt(arc.o...
python
def load_zip_data(zipname, f_sino_real, f_sino_imag, f_angles=None, f_phantom=None, f_info=None): """Load example sinogram data from a .zip file""" ret = [] with zipfile.ZipFile(str(zipname)) as arc: sino_real = np.loadtxt(arc.open(f_sino_real)) sino_imag = np.loadtxt(arc.o...
['def', 'load_zip_data', '(', 'zipname', ',', 'f_sino_real', ',', 'f_sino_imag', ',', 'f_angles', '=', 'None', ',', 'f_phantom', '=', 'None', ',', 'f_info', '=', 'None', ')', ':', 'ret', '=', '[', ']', 'with', 'zipfile', '.', 'ZipFile', '(', 'str', '(', 'zipname', ')', ')', 'as', 'arc', ':', 'sino_real', '=', 'np', '.'...
Load example sinogram data from a .zip file
['Load', 'example', 'sinogram', 'data', 'from', 'a', '.', 'zip', 'file']
train
https://github.com/RI-imaging/ODTbrain/blob/abbab8b790f10c0c7aea8d858d7d60f2fdd7161e/examples/example_helper.py#L119-L143
2,274
aliyun/aliyun-odps-python-sdk
odps/df/expr/groupby.py
value_counts
def value_counts(expr, sort=True, ascending=False, dropna=False): """ Return object containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occuring element. Exclude NA values by default :param expr: sequence :param ...
python
def value_counts(expr, sort=True, ascending=False, dropna=False): """ Return object containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occuring element. Exclude NA values by default :param expr: sequence :param ...
['def', 'value_counts', '(', 'expr', ',', 'sort', '=', 'True', ',', 'ascending', '=', 'False', ',', 'dropna', '=', 'False', ')', ':', 'names', '=', '[', 'expr', '.', 'name', ',', "'count'", ']', 'typos', '=', '[', 'expr', '.', 'dtype', ',', 'types', '.', 'int64', ']', 'return', 'ValueCounts', '(', '_input', '=', 'expr'...
Return object containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occuring element. Exclude NA values by default :param expr: sequence :param sort: if sort :type sort: bool :param dropna: Don’t include counts of ...
['Return', 'object', 'containing', 'counts', 'of', 'unique', 'values', '.']
train
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/df/expr/groupby.py#L535-L553
2,275
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
trainHMM_fromFile
def trainHMM_fromFile(wav_file, gt_file, hmm_model_name, mt_win, mt_step): ''' This function trains a HMM model for segmentation-classification using a single annotated audio file ARGUMENTS: - wav_file: the path of the audio filename - gt_file: the path of the ground truth filename ...
python
def trainHMM_fromFile(wav_file, gt_file, hmm_model_name, mt_win, mt_step): ''' This function trains a HMM model for segmentation-classification using a single annotated audio file ARGUMENTS: - wav_file: the path of the audio filename - gt_file: the path of the ground truth filename ...
['def', 'trainHMM_fromFile', '(', 'wav_file', ',', 'gt_file', ',', 'hmm_model_name', ',', 'mt_win', ',', 'mt_step', ')', ':', '[', 'seg_start', ',', 'seg_end', ',', 'seg_labs', ']', '=', 'readSegmentGT', '(', 'gt_file', ')', 'flags', ',', 'class_names', '=', 'segs2flags', '(', 'seg_start', ',', 'seg_end', ',', 'seg_lab...
This function trains a HMM model for segmentation-classification using a single annotated audio file ARGUMENTS: - wav_file: the path of the audio filename - gt_file: the path of the ground truth filename (a csv file of the form <segment start in seconds>,<segment end ...
['This', 'function', 'trains', 'a', 'HMM', 'model', 'for', 'segmentation', '-', 'classification', 'using', 'a', 'single', 'annotated', 'audio', 'file', 'ARGUMENTS', ':', '-', 'wav_file', ':', 'the', 'path', 'of', 'the', 'audio', 'filename', '-', 'gt_file', ':', 'the', 'path', 'of', 'the', 'ground', 'truth', 'filename',...
train
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L333-L370
2,276
cuihantao/andes
andes/variables/dae.py
DAE.reset_small
def reset_small(self, eq): """Reset numbers smaller than 1e-12 in f and g equations""" assert eq in ('f', 'g') for idx, var in enumerate(self.__dict__[eq]): if abs(var) <= 1e-12: self.__dict__[eq][idx] = 0
python
def reset_small(self, eq): """Reset numbers smaller than 1e-12 in f and g equations""" assert eq in ('f', 'g') for idx, var in enumerate(self.__dict__[eq]): if abs(var) <= 1e-12: self.__dict__[eq][idx] = 0
['def', 'reset_small', '(', 'self', ',', 'eq', ')', ':', 'assert', 'eq', 'in', '(', "'f'", ',', "'g'", ')', 'for', 'idx', ',', 'var', 'in', 'enumerate', '(', 'self', '.', '__dict__', '[', 'eq', ']', ')', ':', 'if', 'abs', '(', 'var', ')', '<=', '1e-12', ':', 'self', '.', '__dict__', '[', 'eq', ']', '[', 'idx', ']', '='...
Reset numbers smaller than 1e-12 in f and g equations
['Reset', 'numbers', 'smaller', 'than', '1e', '-', '12', 'in', 'f', 'and', 'g', 'equations']
train
https://github.com/cuihantao/andes/blob/7067898d4f26ce7534e968b8486c4aa8fe3a511a/andes/variables/dae.py#L700-L705
2,277
the01/python-floscraper
floscraper/webscraper.py
WebScraper._get_tag_match
def _get_tag_match(self, ele, tree): """ Match tag :param ele: :type ele: :param tree: :type tree: None, list :return: :rtype: None | list """ if tree in [None, []]: return [ele] res = [] t = tree[0] br...
python
def _get_tag_match(self, ele, tree): """ Match tag :param ele: :type ele: :param tree: :type tree: None, list :return: :rtype: None | list """ if tree in [None, []]: return [ele] res = [] t = tree[0] br...
['def', '_get_tag_match', '(', 'self', ',', 'ele', ',', 'tree', ')', ':', 'if', 'tree', 'in', '[', 'None', ',', '[', ']', ']', ':', 'return', '[', 'ele', ']', 'res', '=', '[', ']', 't', '=', 'tree', '[', '0', ']', 'branch', '=', 'tree', '[', '1', ':', ']', 'attributes', '=', '{', '}', 'for', 'attr', 'in', 't', ':', 'if...
Match tag :param ele: :type ele: :param tree: :type tree: None, list :return: :rtype: None | list
['Match', 'tag']
train
https://github.com/the01/python-floscraper/blob/d578cd3d6381070d9a07dade1e10387ae33e9a65/floscraper/webscraper.py#L388-L454
2,278
incf-nidash/nidmresults
nidmresults/objects/generic.py
NeuroimagingSoftware.export
def export(self, nidm_version, export_dir): """ Create prov entities and activities. """ if nidm_version['major'] < 1 or \ (nidm_version['major'] == 1 and nidm_version['minor'] < 3): self.type = NLX_OLD_FSL atts = ( (PROV['type'], self.typ...
python
def export(self, nidm_version, export_dir): """ Create prov entities and activities. """ if nidm_version['major'] < 1 or \ (nidm_version['major'] == 1 and nidm_version['minor'] < 3): self.type = NLX_OLD_FSL atts = ( (PROV['type'], self.typ...
['def', 'export', '(', 'self', ',', 'nidm_version', ',', 'export_dir', ')', ':', 'if', 'nidm_version', '[', "'major'", ']', '<', '1', 'or', '(', 'nidm_version', '[', "'major'", ']', '==', '1', 'and', 'nidm_version', '[', "'minor'", ']', '<', '3', ')', ':', 'self', '.', 'type', '=', 'NLX_OLD_FSL', 'atts', '=', '(', '(',...
Create prov entities and activities.
['Create', 'prov', 'entities', 'and', 'activities', '.']
train
https://github.com/incf-nidash/nidmresults/blob/438f7cce6abc4a4379b629bd76f4d427891e033f/nidmresults/objects/generic.py#L454-L472
2,279
SHTOOLS/SHTOOLS
pyshtools/shclasses/shwindow.py
SHWindowCap._multitaper_cross_spectrum
def _multitaper_cross_spectrum(self, clm, slm, k, convention='power', unit='per_l', clat=None, clon=None, coord_degrees=True, lmax=None, taper_wt=None): """ Return the multitaper cross-spectrum estim...
python
def _multitaper_cross_spectrum(self, clm, slm, k, convention='power', unit='per_l', clat=None, clon=None, coord_degrees=True, lmax=None, taper_wt=None): """ Return the multitaper cross-spectrum estim...
['def', '_multitaper_cross_spectrum', '(', 'self', ',', 'clm', ',', 'slm', ',', 'k', ',', 'convention', '=', "'power'", ',', 'unit', '=', "'per_l'", ',', 'clat', '=', 'None', ',', 'clon', '=', 'None', ',', 'coord_degrees', '=', 'True', ',', 'lmax', '=', 'None', ',', 'taper_wt', '=', 'None', ')', ':', 'if', 'lmax', 'is'...
Return the multitaper cross-spectrum estimate and standard error for two input SHCoeffs class instances.
['Return', 'the', 'multitaper', 'cross', '-', 'spectrum', 'estimate', 'and', 'standard', 'error', 'for', 'two', 'input', 'SHCoeffs', 'class', 'instances', '.']
train
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/shclasses/shwindow.py#L1343-L1410
2,280
RPi-Distro/python-gpiozero
gpiozero/tools.py
post_periodic_filtered
def post_periodic_filtered(values, repeat_after, block): """ After every *repeat_after* items, blocks the next *block* items from *values*. Note that unlike :func:`pre_periodic_filtered`, *repeat_after* can't be 0. For example, to block every tenth item read from an ADC:: from gpiozero import M...
python
def post_periodic_filtered(values, repeat_after, block): """ After every *repeat_after* items, blocks the next *block* items from *values*. Note that unlike :func:`pre_periodic_filtered`, *repeat_after* can't be 0. For example, to block every tenth item read from an ADC:: from gpiozero import M...
['def', 'post_periodic_filtered', '(', 'values', ',', 'repeat_after', ',', 'block', ')', ':', 'values', '=', '_normalize', '(', 'values', ')', 'if', 'repeat_after', '<', '1', ':', 'raise', 'ValueError', '(', '"repeat_after must be 1 or larger"', ')', 'if', 'block', '<', '1', ':', 'raise', 'ValueError', '(', '"block mus...
After every *repeat_after* items, blocks the next *block* items from *values*. Note that unlike :func:`pre_periodic_filtered`, *repeat_after* can't be 0. For example, to block every tenth item read from an ADC:: from gpiozero import MCP3008 from gpiozero.tools import post_periodic_filtered ...
['After', 'every', '*', 'repeat_after', '*', 'items', 'blocks', 'the', 'next', '*', 'block', '*', 'items', 'from', '*', 'values', '*', '.', 'Note', 'that', 'unlike', ':', 'func', ':', 'pre_periodic_filtered', '*', 'repeat_after', '*', 'can', 't', 'be', '0', '.', 'For', 'example', 'to', 'block', 'every', 'tenth', 'item'...
train
https://github.com/RPi-Distro/python-gpiozero/blob/7b67374fd0c8c4fde5586d9bad9531f076db9c0c/gpiozero/tools.py#L574-L601
2,281
thombashi/SimpleSQLite
simplesqlite/core.py
SimpleSQLite.has_attr
def has_attr(self, table_name, attr_name): """ :param str table_name: Table name that the attribute exists. :param str attr_name: Attribute name to be tested. :return: |True| if the table has the attribute. :rtype: bool :raises simplesqlite.TableNotFoundError: ...
python
def has_attr(self, table_name, attr_name): """ :param str table_name: Table name that the attribute exists. :param str attr_name: Attribute name to be tested. :return: |True| if the table has the attribute. :rtype: bool :raises simplesqlite.TableNotFoundError: ...
['def', 'has_attr', '(', 'self', ',', 'table_name', ',', 'attr_name', ')', ':', 'self', '.', 'verify_table_existence', '(', 'table_name', ')', 'if', 'typepy', '.', 'is_null_string', '(', 'attr_name', ')', ':', 'return', 'False', 'return', 'attr_name', 'in', 'self', '.', 'fetch_attr_names', '(', 'table_name', ')']
:param str table_name: Table name that the attribute exists. :param str attr_name: Attribute name to be tested. :return: |True| if the table has the attribute. :rtype: bool :raises simplesqlite.TableNotFoundError: |raises_verify_table_existence| :Sample Code: ...
[':', 'param', 'str', 'table_name', ':', 'Table', 'name', 'that', 'the', 'attribute', 'exists', '.', ':', 'param', 'str', 'attr_name', ':', 'Attribute', 'name', 'to', 'be', 'tested', '.', ':', 'return', ':', '|True|', 'if', 'the', 'table', 'has', 'the', 'attribute', '.', ':', 'rtype', ':', 'bool', ':', 'raises', 'simpl...
train
https://github.com/thombashi/SimpleSQLite/blob/b16f212132b9b98773e68bf7395abc2f60f56fe5/simplesqlite/core.py#L955-L995
2,282
gabrielelanaro/chemview
chemview/render.py
render_povray
def render_povray(scene, filename='ipython', width=600, height=600, antialiasing=0.01, extra_opts={}): '''Render the scene with povray for publication. :param dict scene: The scene to render :param string filename: Output filename or 'ipython' to render in the notebook. :param int wid...
python
def render_povray(scene, filename='ipython', width=600, height=600, antialiasing=0.01, extra_opts={}): '''Render the scene with povray for publication. :param dict scene: The scene to render :param string filename: Output filename or 'ipython' to render in the notebook. :param int wid...
['def', 'render_povray', '(', 'scene', ',', 'filename', '=', "'ipython'", ',', 'width', '=', '600', ',', 'height', '=', '600', ',', 'antialiasing', '=', '0.01', ',', 'extra_opts', '=', '{', '}', ')', ':', 'if', 'not', 'vapory_available', ':', 'raise', 'Exception', '(', '"To render with povray, you need to have the vapo...
Render the scene with povray for publication. :param dict scene: The scene to render :param string filename: Output filename or 'ipython' to render in the notebook. :param int width: Width in pixels. :param int height: Height in pixels. :param dict extra_opts: Dictionary to merge/override with the ...
['Render', 'the', 'scene', 'with', 'povray', 'for', 'publication', '.']
train
https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/render.py#L21-L93
2,283
openstack/horizon
openstack_dashboard/api/neutron.py
subnetpool_create
def subnetpool_create(request, name, prefixes, **kwargs): """Create a subnetpool. ip_version is auto-detected in back-end. Parameters: request -- Request context name -- Name for subnetpool prefixes -- List of prefixes for pool Keyword Arguments (optional):...
python
def subnetpool_create(request, name, prefixes, **kwargs): """Create a subnetpool. ip_version is auto-detected in back-end. Parameters: request -- Request context name -- Name for subnetpool prefixes -- List of prefixes for pool Keyword Arguments (optional):...
['def', 'subnetpool_create', '(', 'request', ',', 'name', ',', 'prefixes', ',', '*', '*', 'kwargs', ')', ':', 'LOG', '.', 'debug', '(', '"subnetpool_create(): name=%(name)s, prefixes=%(prefixes)s, "', '"kwargs=%(kwargs)s"', ',', '{', "'name'", ':', 'name', ',', "'prefixes'", ':', 'prefixes', ',', "'kwargs'", ':', 'kwar...
Create a subnetpool. ip_version is auto-detected in back-end. Parameters: request -- Request context name -- Name for subnetpool prefixes -- List of prefixes for pool Keyword Arguments (optional): min_prefixlen -- Minimum prefix length for allocations f...
['Create', 'a', 'subnetpool', '.']
train
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/neutron.py#L1243-L1277
2,284
django-auth-ldap/django-auth-ldap
django_auth_ldap/backend.py
_LDAPUser.populate_user
def populate_user(self): """ Populates the Django user object using the default bind credentials. """ user = None try: # self.attrs will only be non-None if we were able to load this user # from the LDAP directory, so this filters out nonexistent users. ...
python
def populate_user(self): """ Populates the Django user object using the default bind credentials. """ user = None try: # self.attrs will only be non-None if we were able to load this user # from the LDAP directory, so this filters out nonexistent users. ...
['def', 'populate_user', '(', 'self', ')', ':', 'user', '=', 'None', 'try', ':', '# self.attrs will only be non-None if we were able to load this user', '# from the LDAP directory, so this filters out nonexistent users.', 'if', 'self', '.', 'attrs', 'is', 'not', 'None', ':', 'self', '.', '_get_or_create_user', '(', 'fo...
Populates the Django user object using the default bind credentials.
['Populates', 'the', 'Django', 'user', 'object', 'using', 'the', 'default', 'bind', 'credentials', '.']
train
https://github.com/django-auth-ldap/django-auth-ldap/blob/9ce3c2825527f8faa1793958b041816e63d839af/django_auth_ldap/backend.py#L402-L432
2,285
bunq/sdk_python
bunq/sdk/model/generated/endpoint.py
CustomerStatementExport.create
def create(cls, statement_format, date_start, date_end, monetary_account_id=None, regional_format=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int :param statement_format: The format type of statement. Allowed values: ...
python
def create(cls, statement_format, date_start, date_end, monetary_account_id=None, regional_format=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int :param statement_format: The format type of statement. Allowed values: ...
['def', 'create', '(', 'cls', ',', 'statement_format', ',', 'date_start', ',', 'date_end', ',', 'monetary_account_id', '=', 'None', ',', 'regional_format', '=', 'None', ',', 'custom_headers', '=', 'None', ')', ':', 'if', 'custom_headers', 'is', 'None', ':', 'custom_headers', '=', '{', '}', 'request_map', '=', '{', 'cls...
:type user_id: int :type monetary_account_id: int :param statement_format: The format type of statement. Allowed values: MT940, CSV, PDF. :type statement_format: str :param date_start: The start date for making statements. :type date_start: str :param date_end: Th...
[':', 'type', 'user_id', ':', 'int', ':', 'type', 'monetary_account_id', ':', 'int', ':', 'param', 'statement_format', ':', 'The', 'format', 'type', 'of', 'statement', '.', 'Allowed', 'values', ':', 'MT940', 'CSV', 'PDF', '.', ':', 'type', 'statement_format', ':', 'str', ':', 'param', 'date_start', ':', 'The', 'start',...
train
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L16500-L16544
2,286
zhanglab/psamm
psamm/commands/duplicatescheck.py
reaction_signature
def reaction_signature(eq, direction=False, stoichiometry=False): """Return unique signature object for :class:`Reaction`. Signature objects are hashable, and compare equal only if the reactions are considered the same according to the specified rules. Args: direction: Include reaction directi...
python
def reaction_signature(eq, direction=False, stoichiometry=False): """Return unique signature object for :class:`Reaction`. Signature objects are hashable, and compare equal only if the reactions are considered the same according to the specified rules. Args: direction: Include reaction directi...
['def', 'reaction_signature', '(', 'eq', ',', 'direction', '=', 'False', ',', 'stoichiometry', '=', 'False', ')', ':', 'def', 'compounds_sig', '(', 'compounds', ')', ':', 'if', 'stoichiometry', ':', 'return', 'tuple', '(', 'sorted', '(', 'compounds', ')', ')', 'else', ':', 'return', 'tuple', '(', 'sorted', '(', 'compou...
Return unique signature object for :class:`Reaction`. Signature objects are hashable, and compare equal only if the reactions are considered the same according to the specified rules. Args: direction: Include reaction directionality when considering equality. stoichiometry: Include stoichi...
['Return', 'unique', 'signature', 'object', 'for', ':', 'class', ':', 'Reaction', '.']
train
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/duplicatescheck.py#L29-L57
2,287
scanny/python-pptx
pptx/oxml/shapes/picture.py
CT_Picture.crop_to_fit
def crop_to_fit(self, image_size, view_size): """ Set cropping values in `p:blipFill/a:srcRect` such that an image of *image_size* will stretch to exactly fit *view_size* when its aspect ratio is preserved. """ self.blipFill.crop(self._fill_cropping(image_size, view_size)...
python
def crop_to_fit(self, image_size, view_size): """ Set cropping values in `p:blipFill/a:srcRect` such that an image of *image_size* will stretch to exactly fit *view_size* when its aspect ratio is preserved. """ self.blipFill.crop(self._fill_cropping(image_size, view_size)...
['def', 'crop_to_fit', '(', 'self', ',', 'image_size', ',', 'view_size', ')', ':', 'self', '.', 'blipFill', '.', 'crop', '(', 'self', '.', '_fill_cropping', '(', 'image_size', ',', 'view_size', ')', ')']
Set cropping values in `p:blipFill/a:srcRect` such that an image of *image_size* will stretch to exactly fit *view_size* when its aspect ratio is preserved.
['Set', 'cropping', 'values', 'in', 'p', ':', 'blipFill', '/', 'a', ':', 'srcRect', 'such', 'that', 'an', 'image', 'of', '*', 'image_size', '*', 'will', 'stretch', 'to', 'exactly', 'fit', '*', 'view_size', '*', 'when', 'its', 'aspect', 'ratio', 'is', 'preserved', '.']
train
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/oxml/shapes/picture.py#L35-L41
2,288
mpg-age-bioinformatics/AGEpy
AGEpy/kegg.py
ecs_idsKEGG
def ecs_idsKEGG(organism): """ Uses KEGG to retrieve all ids and respective ecs for a given KEGG organism :param organism: an organisms as listed in organismsKEGG() :returns: a Pandas dataframe of with 'ec' and 'KEGGid'. """ kegg_ec=urlopen("http://rest.kegg.jp/link/"+organism+"/enzyme").read...
python
def ecs_idsKEGG(organism): """ Uses KEGG to retrieve all ids and respective ecs for a given KEGG organism :param organism: an organisms as listed in organismsKEGG() :returns: a Pandas dataframe of with 'ec' and 'KEGGid'. """ kegg_ec=urlopen("http://rest.kegg.jp/link/"+organism+"/enzyme").read...
['def', 'ecs_idsKEGG', '(', 'organism', ')', ':', 'kegg_ec', '=', 'urlopen', '(', '"http://rest.kegg.jp/link/"', '+', 'organism', '+', '"/enzyme"', ')', '.', 'read', '(', ')', 'kegg_ec', '=', 'kegg_ec', '.', 'split', '(', '"\\n"', ')', 'final', '=', '[', ']', 'for', 'k', 'in', 'kegg_ec', ':', 'final', '.', 'append', '(...
Uses KEGG to retrieve all ids and respective ecs for a given KEGG organism :param organism: an organisms as listed in organismsKEGG() :returns: a Pandas dataframe of with 'ec' and 'KEGGid'.
['Uses', 'KEGG', 'to', 'retrieve', 'all', 'ids', 'and', 'respective', 'ecs', 'for', 'a', 'given', 'KEGG', 'organism']
train
https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/kegg.py#L107-L123
2,289
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.get_content
def get_content(self, renderer, data, accepted_media_type, renderer_context): """ Get the content as if it had been rendered by the default non-documenting renderer. """ if not renderer: return '[No renderers were found]' renderer_context[...
python
def get_content(self, renderer, data, accepted_media_type, renderer_context): """ Get the content as if it had been rendered by the default non-documenting renderer. """ if not renderer: return '[No renderers were found]' renderer_context[...
['def', 'get_content', '(', 'self', ',', 'renderer', ',', 'data', ',', 'accepted_media_type', ',', 'renderer_context', ')', ':', 'if', 'not', 'renderer', ':', 'return', "'[No renderers were found]'", 'renderer_context', '[', "'indent'", ']', '=', '4', 'content', '=', 'renderer', '.', 'render', '(', 'data', ',', 'accept...
Get the content as if it had been rendered by the default non-documenting renderer.
['Get', 'the', 'content', 'as', 'if', 'it', 'had', 'been', 'rendered', 'by', 'the', 'default', 'non', '-', 'documenting', 'renderer', '.']
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L388-L406
2,290
apache/spark
python/pyspark/sql/dataframe.py
DataFrame.replace
def replace(self, to_replace, value=_NoValue, subset=None): """Returns a new :class:`DataFrame` replacing a value with another value. :func:`DataFrame.replace` and :func:`DataFrameNaFunctions.replace` are aliases of each other. Values to_replace and value must have the same type and can ...
python
def replace(self, to_replace, value=_NoValue, subset=None): """Returns a new :class:`DataFrame` replacing a value with another value. :func:`DataFrame.replace` and :func:`DataFrameNaFunctions.replace` are aliases of each other. Values to_replace and value must have the same type and can ...
['def', 'replace', '(', 'self', ',', 'to_replace', ',', 'value', '=', '_NoValue', ',', 'subset', '=', 'None', ')', ':', 'if', 'value', 'is', '_NoValue', ':', 'if', 'isinstance', '(', 'to_replace', ',', 'dict', ')', ':', 'value', '=', 'None', 'else', ':', 'raise', 'TypeError', '(', '"value argument is required when to_r...
Returns a new :class:`DataFrame` replacing a value with another value. :func:`DataFrame.replace` and :func:`DataFrameNaFunctions.replace` are aliases of each other. Values to_replace and value must have the same type and can only be numerics, booleans, or strings. Value can have None. Wh...
['Returns', 'a', 'new', ':', 'class', ':', 'DataFrame', 'replacing', 'a', 'value', 'with', 'another', 'value', '.', ':', 'func', ':', 'DataFrame', '.', 'replace', 'and', ':', 'func', ':', 'DataFrameNaFunctions', '.', 'replace', 'are', 'aliases', 'of', 'each', 'other', '.', 'Values', 'to_replace', 'and', 'value', 'must'...
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/dataframe.py#L1668-L1805
2,291
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
silenceRemoval
def silenceRemoval(x, fs, st_win, st_step, smoothWindow=0.5, weight=0.5, plot=False): ''' Event Detection (silence removal) ARGUMENTS: - x: the input audio signal - fs: sampling freq - st_win, st_step: window size and step in seconds - smoo...
python
def silenceRemoval(x, fs, st_win, st_step, smoothWindow=0.5, weight=0.5, plot=False): ''' Event Detection (silence removal) ARGUMENTS: - x: the input audio signal - fs: sampling freq - st_win, st_step: window size and step in seconds - smoo...
['def', 'silenceRemoval', '(', 'x', ',', 'fs', ',', 'st_win', ',', 'st_step', ',', 'smoothWindow', '=', '0.5', ',', 'weight', '=', '0.5', ',', 'plot', '=', 'False', ')', ':', 'if', 'weight', '>=', '1', ':', 'weight', '=', '0.99', 'if', 'weight', '<=', '0', ':', 'weight', '=', '0.01', '# Step 1: feature extraction', 'x'...
Event Detection (silence removal) ARGUMENTS: - x: the input audio signal - fs: sampling freq - st_win, st_step: window size and step in seconds - smoothWindow: (optinal) smooth window (in seconds) - weight: (optinal) weight f...
['Event', 'Detection', '(', 'silence', 'removal', ')', 'ARGUMENTS', ':', '-', 'x', ':', 'the', 'input', 'audio', 'signal', '-', 'fs', ':', 'sampling', 'freq', '-', 'st_win', 'st_step', ':', 'window', 'size', 'and', 'step', 'in', 'seconds', '-', 'smoothWindow', ':', '(', 'optinal', ')', 'smooth', 'window', '(', 'in', 's...
train
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L625-L738
2,292
Tanganelli/CoAPthon3
coapthon/layers/messagelayer.py
MessageLayer.receive_empty
def receive_empty(self, message): """ Pair ACKs with requests. :type message: Message :param message: the received message :rtype : Transaction :return: the transaction to which the message belongs to """ logger.debug("receive_empty - " + str(message)) ...
python
def receive_empty(self, message): """ Pair ACKs with requests. :type message: Message :param message: the received message :rtype : Transaction :return: the transaction to which the message belongs to """ logger.debug("receive_empty - " + str(message)) ...
['def', 'receive_empty', '(', 'self', ',', 'message', ')', ':', 'logger', '.', 'debug', '(', '"receive_empty - "', '+', 'str', '(', 'message', ')', ')', 'try', ':', 'host', ',', 'port', '=', 'message', '.', 'source', 'except', 'AttributeError', ':', 'return', 'key_mid', '=', 'str_append_hash', '(', 'host', ',', 'port',...
Pair ACKs with requests. :type message: Message :param message: the received message :rtype : Transaction :return: the transaction to which the message belongs to
['Pair', 'ACKs', 'with', 'requests', '.']
train
https://github.com/Tanganelli/CoAPthon3/blob/985763bfe2eb9e00f49ec100c5b8877c2ed7d531/coapthon/layers/messagelayer.py#L140-L190
2,293
andela-sjames/paystack-python
paystackapi/base.py
PayStackRequests.post
def post(self, endpoint, **kwargs): """Create a resource. Args: endpoint: resource endpoint. """ return self._request(requests.post, endpoint, **kwargs)
python
def post(self, endpoint, **kwargs): """Create a resource. Args: endpoint: resource endpoint. """ return self._request(requests.post, endpoint, **kwargs)
['def', 'post', '(', 'self', ',', 'endpoint', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', '_request', '(', 'requests', '.', 'post', ',', 'endpoint', ',', '*', '*', 'kwargs', ')']
Create a resource. Args: endpoint: resource endpoint.
['Create', 'a', 'resource', '.']
train
https://github.com/andela-sjames/paystack-python/blob/c9e4bddcb76e1490fefc362e71a21486400dccd4/paystackapi/base.py#L70-L76
2,294
boppreh/keyboard
keyboard/__init__.py
get_hotkey_name
def get_hotkey_name(names=None): """ Returns a string representation of hotkey from the given key names, or the currently pressed keys if not given. This function: - normalizes names; - removes "left" and "right" prefixes; - replaces the "+" key name with "plus" to avoid ambiguity; - puts ...
python
def get_hotkey_name(names=None): """ Returns a string representation of hotkey from the given key names, or the currently pressed keys if not given. This function: - normalizes names; - removes "left" and "right" prefixes; - replaces the "+" key name with "plus" to avoid ambiguity; - puts ...
['def', 'get_hotkey_name', '(', 'names', '=', 'None', ')', ':', 'if', 'names', 'is', 'None', ':', '_listener', '.', 'start_if_necessary', '(', ')', 'with', '_pressed_events_lock', ':', 'names', '=', '[', 'e', '.', 'name', 'for', 'e', 'in', '_pressed_events', '.', 'values', '(', ')', ']', 'else', ':', 'names', '=', '[',...
Returns a string representation of hotkey from the given key names, or the currently pressed keys if not given. This function: - normalizes names; - removes "left" and "right" prefixes; - replaces the "+" key name with "plus" to avoid ambiguity; - puts modifier keys first, in a standardized order;...
['Returns', 'a', 'string', 'representation', 'of', 'hotkey', 'from', 'the', 'given', 'key', 'names', 'or', 'the', 'currently', 'pressed', 'keys', 'if', 'not', 'given', '.', 'This', 'function', ':']
train
https://github.com/boppreh/keyboard/blob/dbb73dfff484f733d5fed8dbc53301af5b6c7f50/keyboard/__init__.py#L886-L915
2,295
trombastic/PyScada
pyscada/utils/scheduler.py
Scheduler.run
def run(self): """ the main loop """ try: master_process = BackgroundProcess.objects.filter(pk=self.process_id).first() if master_process: master_process.last_update = now() master_process.message = 'init child processes' ...
python
def run(self): """ the main loop """ try: master_process = BackgroundProcess.objects.filter(pk=self.process_id).first() if master_process: master_process.last_update = now() master_process.message = 'init child processes' ...
['def', 'run', '(', 'self', ')', ':', 'try', ':', 'master_process', '=', 'BackgroundProcess', '.', 'objects', '.', 'filter', '(', 'pk', '=', 'self', '.', 'process_id', ')', '.', 'first', '(', ')', 'if', 'master_process', ':', 'master_process', '.', 'last_update', '=', 'now', '(', ')', 'master_process', '.', 'message', ...
the main loop
['the', 'main', 'loop']
train
https://github.com/trombastic/PyScada/blob/c5fc348a25f0df1340336f694ee9bc1aea62516a/pyscada/utils/scheduler.py#L293-L347
2,296
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
TcExBatch.write_batch_json
def write_batch_json(self, content): """Write batch json data to a file.""" timestamp = str(time.time()).replace('.', '') batch_json_file = os.path.join( self.tcex.args.tc_temp_path, 'batch-{}.json'.format(timestamp) ) with open(batch_json_file, 'w') as fh: ...
python
def write_batch_json(self, content): """Write batch json data to a file.""" timestamp = str(time.time()).replace('.', '') batch_json_file = os.path.join( self.tcex.args.tc_temp_path, 'batch-{}.json'.format(timestamp) ) with open(batch_json_file, 'w') as fh: ...
['def', 'write_batch_json', '(', 'self', ',', 'content', ')', ':', 'timestamp', '=', 'str', '(', 'time', '.', 'time', '(', ')', ')', '.', 'replace', '(', "'.'", ',', "''", ')', 'batch_json_file', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'tcex', '.', 'args', '.', 'tc_temp_path', ',', "'batch-{}.json'", '.'...
Write batch json data to a file.
['Write', 'batch', 'json', 'data', 'to', 'a', 'file', '.']
train
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L1623-L1630
2,297
ktbyers/netmiko
netmiko/cisco/cisco_nxos_ssh.py
CiscoNxosSSH.session_preparation
def session_preparation(self): """Prepare the session after the connection has been established.""" self._test_channel_read(pattern=r"[>#]") self.ansi_escape_codes = True self.set_base_prompt() self.disable_paging() # Clear the read buffer time.sleep(0.3 * self.gl...
python
def session_preparation(self): """Prepare the session after the connection has been established.""" self._test_channel_read(pattern=r"[>#]") self.ansi_escape_codes = True self.set_base_prompt() self.disable_paging() # Clear the read buffer time.sleep(0.3 * self.gl...
['def', 'session_preparation', '(', 'self', ')', ':', 'self', '.', '_test_channel_read', '(', 'pattern', '=', 'r"[>#]"', ')', 'self', '.', 'ansi_escape_codes', '=', 'True', 'self', '.', 'set_base_prompt', '(', ')', 'self', '.', 'disable_paging', '(', ')', '# Clear the read buffer', 'time', '.', 'sleep', '(', '0.3', '*'...
Prepare the session after the connection has been established.
['Prepare', 'the', 'session', 'after', 'the', 'connection', 'has', 'been', 'established', '.']
train
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_nxos_ssh.py#L11-L19
2,298
openstack/stacktach-winchester
winchester/config.py
ConfigManager._load_yaml_config
def _load_yaml_config(cls, config_data, filename="(unknown)"): """Load a yaml config file.""" try: config = yaml.safe_load(config_data) except yaml.YAMLError as err: if hasattr(err, 'problem_mark'): mark = err.problem_mark errmsg = ("Inval...
python
def _load_yaml_config(cls, config_data, filename="(unknown)"): """Load a yaml config file.""" try: config = yaml.safe_load(config_data) except yaml.YAMLError as err: if hasattr(err, 'problem_mark'): mark = err.problem_mark errmsg = ("Inval...
['def', '_load_yaml_config', '(', 'cls', ',', 'config_data', ',', 'filename', '=', '"(unknown)"', ')', ':', 'try', ':', 'config', '=', 'yaml', '.', 'safe_load', '(', 'config_data', ')', 'except', 'yaml', '.', 'YAMLError', 'as', 'err', ':', 'if', 'hasattr', '(', 'err', ',', "'problem_mark'", ')', ':', 'mark', '=', 'err'...
Load a yaml config file.
['Load', 'a', 'yaml', 'config', 'file', '.']
train
https://github.com/openstack/stacktach-winchester/blob/54f3ffc4a8fd84b6fb29ad9b65adb018e8927956/winchester/config.py#L129-L150
2,299
horazont/aioxmpp
aioxmpp/callbacks.py
Filter.filter
def filter(self, obj, *args, **kwargs): """ Filter the given object through the filter chain. :param obj: The object to filter :param args: Additional arguments to pass to each filter function. :param kwargs: Additional keyword arguments to pass to each filter ...
python
def filter(self, obj, *args, **kwargs): """ Filter the given object through the filter chain. :param obj: The object to filter :param args: Additional arguments to pass to each filter function. :param kwargs: Additional keyword arguments to pass to each filter ...
['def', 'filter', '(', 'self', ',', 'obj', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'for', '_', ',', '_', ',', 'func', 'in', 'self', '.', '_filter_order', ':', 'obj', '=', 'func', '(', 'obj', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', 'if', 'obj', 'is', 'None', ':', 'return', 'None', 'return', 'obj']
Filter the given object through the filter chain. :param obj: The object to filter :param args: Additional arguments to pass to each filter function. :param kwargs: Additional keyword arguments to pass to each filter function. :return: The filtered object or :data...
['Filter', 'the', 'given', 'object', 'through', 'the', 'filter', 'chain', '.']
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L790-L809