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
4,200
podio/podio-py
pypodio2/encode.py
multipart_encode
def multipart_encode(params, boundary=None, cb=None): """Encode ``params`` as multipart/form-data. ``params`` should be a sequence of (name, value) pairs or MultipartParam objects, or a mapping of names to values. Values are either strings parameter values, or file-like objects to use as the parame...
python
def multipart_encode(params, boundary=None, cb=None): """Encode ``params`` as multipart/form-data. ``params`` should be a sequence of (name, value) pairs or MultipartParam objects, or a mapping of names to values. Values are either strings parameter values, or file-like objects to use as the parame...
['def', 'multipart_encode', '(', 'params', ',', 'boundary', '=', 'None', ',', 'cb', '=', 'None', ')', ':', 'if', 'boundary', 'is', 'None', ':', 'boundary', '=', 'gen_boundary', '(', ')', 'else', ':', 'boundary', '=', 'urllib', '.', 'quote_plus', '(', 'boundary', ')', 'headers', '=', 'get_headers', '(', 'params', ',', '...
Encode ``params`` as multipart/form-data. ``params`` should be a sequence of (name, value) pairs or MultipartParam objects, or a mapping of names to values. Values are either strings parameter values, or file-like objects to use as the parameter value. The file-like objects must support .read() and ei...
['Encode', 'params', 'as', 'multipart', '/', 'form', '-', 'data', '.']
train
https://github.com/podio/podio-py/blob/5ce956034a06c98b0ef18fcd940b36da0908ad6c/pypodio2/encode.py#L385-L433
4,201
GoogleCloudPlatform/appengine-pipelines
python/src/pipeline/pipeline.py
PipelineFuture._inherit_outputs
def _inherit_outputs(self, pipeline_name, already_defined, resolve_outputs=False): """Inherits outputs from a calling Pipeline. Args: pipeline_name: The Pipeline class name (used for debugging). already_defined: Maps output name t...
python
def _inherit_outputs(self, pipeline_name, already_defined, resolve_outputs=False): """Inherits outputs from a calling Pipeline. Args: pipeline_name: The Pipeline class name (used for debugging). already_defined: Maps output name t...
['def', '_inherit_outputs', '(', 'self', ',', 'pipeline_name', ',', 'already_defined', ',', 'resolve_outputs', '=', 'False', ')', ':', 'for', 'name', ',', 'slot_key', 'in', 'already_defined', '.', 'iteritems', '(', ')', ':', 'if', 'not', 'isinstance', '(', 'slot_key', ',', 'db', '.', 'Key', ')', ':', 'slot_key', '=', '...
Inherits outputs from a calling Pipeline. Args: pipeline_name: The Pipeline class name (used for debugging). already_defined: Maps output name to stringified db.Key (of _SlotRecords) of any exiting output slots to be inherited by this future. resolve_outputs: When True, this method will d...
['Inherits', 'outputs', 'from', 'a', 'calling', 'Pipeline', '.']
train
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L314-L358
4,202
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.create_instances
def create_instances(self, config_list): """Creates multiple virtual server instances. This takes a list of dictionaries using the same arguments as create_instance(). .. warning:: This will add charges to your account Example:: # Define the instance ...
python
def create_instances(self, config_list): """Creates multiple virtual server instances. This takes a list of dictionaries using the same arguments as create_instance(). .. warning:: This will add charges to your account Example:: # Define the instance ...
['def', 'create_instances', '(', 'self', ',', 'config_list', ')', ':', 'tags', '=', '[', 'conf', '.', 'pop', '(', "'tags'", ',', 'None', ')', 'for', 'conf', 'in', 'config_list', ']', 'resp', '=', 'self', '.', 'guest', '.', 'createObjects', '(', '[', 'self', '.', '_generate_create_dict', '(', '*', '*', 'kwargs', ')', 'f...
Creates multiple virtual server instances. This takes a list of dictionaries using the same arguments as create_instance(). .. warning:: This will add charges to your account Example:: # Define the instance we want to create. new_vsi = { ...
['Creates', 'multiple', 'virtual', 'server', 'instances', '.']
train
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L594-L644
4,203
materialsvirtuallab/monty
monty/fnmatch.py
WildCard.filter
def filter(self, names): """ Returns a list with the names matching the pattern. """ names = list_strings(names) fnames = [] for f in names: for pat in self.pats: if fnmatch.fnmatch(f, pat): fnames.append(f) return...
python
def filter(self, names): """ Returns a list with the names matching the pattern. """ names = list_strings(names) fnames = [] for f in names: for pat in self.pats: if fnmatch.fnmatch(f, pat): fnames.append(f) return...
['def', 'filter', '(', 'self', ',', 'names', ')', ':', 'names', '=', 'list_strings', '(', 'names', ')', 'fnames', '=', '[', ']', 'for', 'f', 'in', 'names', ':', 'for', 'pat', 'in', 'self', '.', 'pats', ':', 'if', 'fnmatch', '.', 'fnmatch', '(', 'f', ',', 'pat', ')', ':', 'fnames', '.', 'append', '(', 'f', ')', 'return'...
Returns a list with the names matching the pattern.
['Returns', 'a', 'list', 'with', 'the', 'names', 'matching', 'the', 'pattern', '.']
train
https://github.com/materialsvirtuallab/monty/blob/d99d6f3c68372d83489d28ff515566c93cd569e2/monty/fnmatch.py#L41-L53
4,204
saltstack/salt
salt/states/pip_state.py
_fulfills_version_spec
def _fulfills_version_spec(version, version_spec): ''' Check version number against version specification info and return a boolean value based on whether or not the version number meets the specified version. ''' for oper, spec in version_spec: if oper is None: continue ...
python
def _fulfills_version_spec(version, version_spec): ''' Check version number against version specification info and return a boolean value based on whether or not the version number meets the specified version. ''' for oper, spec in version_spec: if oper is None: continue ...
['def', '_fulfills_version_spec', '(', 'version', ',', 'version_spec', ')', ':', 'for', 'oper', ',', 'spec', 'in', 'version_spec', ':', 'if', 'oper', 'is', 'None', ':', 'continue', 'if', 'not', 'salt', '.', 'utils', '.', 'versions', '.', 'compare', '(', 'ver1', '=', 'version', ',', 'oper', '=', 'oper', ',', 'ver2', '='...
Check version number against version specification info and return a boolean value based on whether or not the version number meets the specified version.
['Check', 'version', 'number', 'against', 'version', 'specification', 'info', 'and', 'return', 'a', 'boolean', 'value', 'based', 'on', 'whether', 'or', 'not', 'the', 'version', 'number', 'meets', 'the', 'specified', 'version', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pip_state.py#L92-L103
4,205
taskcluster/taskcluster-client.py
taskcluster/awsprovisioner.py
AwsProvisioner.backendStatus
def backendStatus(self, *args, **kwargs): """ Backend Status This endpoint is used to show when the last time the provisioner has checked in. A check in is done through the deadman's snitch api. It is done at the conclusion of a provisioning iteration and used to tell ...
python
def backendStatus(self, *args, **kwargs): """ Backend Status This endpoint is used to show when the last time the provisioner has checked in. A check in is done through the deadman's snitch api. It is done at the conclusion of a provisioning iteration and used to tell ...
['def', 'backendStatus', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', '_makeApiCall', '(', 'self', '.', 'funcinfo', '[', '"backendStatus"', ']', ',', '*', 'args', ',', '*', '*', 'kwargs', ')']
Backend Status This endpoint is used to show when the last time the provisioner has checked in. A check in is done through the deadman's snitch api. It is done at the conclusion of a provisioning iteration and used to tell if the background provisioning process is still runnin...
['Backend', 'Status']
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/awsprovisioner.py#L298-L315
4,206
johnnoone/aioconsul
aioconsul/common/addr.py
parse_addr
def parse_addr(addr, *, proto=None, host=None): """Parses an address Returns: Address: the parsed address """ port = None if isinstance(addr, Address): return addr elif isinstance(addr, str): if addr.startswith('http://'): proto, addr = 'http', addr[7:] ...
python
def parse_addr(addr, *, proto=None, host=None): """Parses an address Returns: Address: the parsed address """ port = None if isinstance(addr, Address): return addr elif isinstance(addr, str): if addr.startswith('http://'): proto, addr = 'http', addr[7:] ...
['def', 'parse_addr', '(', 'addr', ',', '*', ',', 'proto', '=', 'None', ',', 'host', '=', 'None', ')', ':', 'port', '=', 'None', 'if', 'isinstance', '(', 'addr', ',', 'Address', ')', ':', 'return', 'addr', 'elif', 'isinstance', '(', 'addr', ',', 'str', ')', ':', 'if', 'addr', '.', 'startswith', '(', "'http://'", ')', '...
Parses an address Returns: Address: the parsed address
['Parses', 'an', 'address']
train
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/common/addr.py#L12-L46
4,207
JarryShaw/PyPCAPKit
src/protocols/transport/tcp.py
TCP._read_mptcp_dss
def _read_mptcp_dss(self, bits, size, kind): """Read Data Sequence Signal (Data ACK and Data Sequence Mapping) option. Positional arguments: * bits - str, 4-bit data * size - int, length of option * kind - int, 30 (Multipath TCP) Returns: * dict ...
python
def _read_mptcp_dss(self, bits, size, kind): """Read Data Sequence Signal (Data ACK and Data Sequence Mapping) option. Positional arguments: * bits - str, 4-bit data * size - int, length of option * kind - int, 30 (Multipath TCP) Returns: * dict ...
['def', '_read_mptcp_dss', '(', 'self', ',', 'bits', ',', 'size', ',', 'kind', ')', ':', 'bits', '=', 'self', '.', '_read_binary', '(', '1', ')', 'mflg', '=', '8', 'if', 'int', '(', 'bits', '[', '4', ']', ')', 'else', '4', 'Mflg', '=', 'True', 'if', 'int', '(', 'bits', '[', '5', ']', ')', 'else', 'False', 'aflg', '=', ...
Read Data Sequence Signal (Data ACK and Data Sequence Mapping) option. Positional arguments: * bits - str, 4-bit data * size - int, length of option * kind - int, 30 (Multipath TCP) Returns: * dict -- extracted Data Sequence Signal (DSS) option ...
['Read', 'Data', 'Sequence', 'Signal', '(', 'Data', 'ACK', 'and', 'Data', 'Sequence', 'Mapping', ')', 'option', '.']
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/transport/tcp.py#L986-L1072
4,208
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.set_static_ip_address
def set_static_ip_address(self, payload): """Set static ip address for a VM.""" # This request is received from CLI for setting ip address of an # instance. macaddr = payload.get('mac') ipaddr = payload.get('ip') # Find the entry associated with the mac in the database....
python
def set_static_ip_address(self, payload): """Set static ip address for a VM.""" # This request is received from CLI for setting ip address of an # instance. macaddr = payload.get('mac') ipaddr = payload.get('ip') # Find the entry associated with the mac in the database....
['def', 'set_static_ip_address', '(', 'self', ',', 'payload', ')', ':', '# This request is received from CLI for setting ip address of an', '# instance.', 'macaddr', '=', 'payload', '.', 'get', '(', "'mac'", ')', 'ipaddr', '=', 'payload', '.', 'get', '(', "'ip'", ')', '# Find the entry associated with the mac in the da...
Set static ip address for a VM.
['Set', 'static', 'ip', 'address', 'for', 'a', 'VM', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1510-L1555
4,209
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_set_user_agent
def libvlc_set_user_agent(p_instance, name, http): '''Sets the application name. LibVLC passes this as the user agent string when a protocol requires it. @param p_instance: LibVLC instance. @param name: human-readable application name, e.g. "FooBar player 1.2.3". @param http: HTTP User Agent, e.g. "...
python
def libvlc_set_user_agent(p_instance, name, http): '''Sets the application name. LibVLC passes this as the user agent string when a protocol requires it. @param p_instance: LibVLC instance. @param name: human-readable application name, e.g. "FooBar player 1.2.3". @param http: HTTP User Agent, e.g. "...
['def', 'libvlc_set_user_agent', '(', 'p_instance', ',', 'name', ',', 'http', ')', ':', 'f', '=', '_Cfunctions', '.', 'get', '(', "'libvlc_set_user_agent'", ',', 'None', ')', 'or', '_Cfunction', '(', "'libvlc_set_user_agent'", ',', '(', '(', '1', ',', ')', ',', '(', '1', ',', ')', ',', '(', '1', ',', ')', ',', ')', ','...
Sets the application name. LibVLC passes this as the user agent string when a protocol requires it. @param p_instance: LibVLC instance. @param name: human-readable application name, e.g. "FooBar player 1.2.3". @param http: HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0". @version: LibVLC 1.1.1 or ...
['Sets', 'the', 'application', 'name', '.', 'LibVLC', 'passes', 'this', 'as', 'the', 'user', 'agent', 'string', 'when', 'a', 'protocol', 'requires', 'it', '.']
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L3838-L3849
4,210
tensorflow/tensor2tensor
tensor2tensor/layers/modalities.py
ctc_symbol_loss
def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weight_fn): """Compute the CTC loss.""" del model_hparams, vocab_size # unused arg logits = top_out with tf.name_scope("ctc_loss", values=[logits, targets]): # For CTC we assume targets are 1d, [batch, length, 1, 1] here. targets_shape = ...
python
def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weight_fn): """Compute the CTC loss.""" del model_hparams, vocab_size # unused arg logits = top_out with tf.name_scope("ctc_loss", values=[logits, targets]): # For CTC we assume targets are 1d, [batch, length, 1, 1] here. targets_shape = ...
['def', 'ctc_symbol_loss', '(', 'top_out', ',', 'targets', ',', 'model_hparams', ',', 'vocab_size', ',', 'weight_fn', ')', ':', 'del', 'model_hparams', ',', 'vocab_size', '# unused arg', 'logits', '=', 'top_out', 'with', 'tf', '.', 'name_scope', '(', '"ctc_loss"', ',', 'values', '=', '[', 'logits', ',', 'targets', ']',...
Compute the CTC loss.
['Compute', 'the', 'CTC', 'loss', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L638-L662
4,211
saltstack/salt
salt/states/boto_s3_bucket.py
_compare_replication
def _compare_replication(current, desired, region, key, keyid, profile): ''' Replication accepts a non-ARN role name, but always returns an ARN ''' if desired is not None and desired.get('Role'): desired = copy.deepcopy(desired) desired['Role'] = _get_role_arn(desired['Role'], ...
python
def _compare_replication(current, desired, region, key, keyid, profile): ''' Replication accepts a non-ARN role name, but always returns an ARN ''' if desired is not None and desired.get('Role'): desired = copy.deepcopy(desired) desired['Role'] = _get_role_arn(desired['Role'], ...
['def', '_compare_replication', '(', 'current', ',', 'desired', ',', 'region', ',', 'key', ',', 'keyid', ',', 'profile', ')', ':', 'if', 'desired', 'is', 'not', 'None', 'and', 'desired', '.', 'get', '(', "'Role'", ')', ':', 'desired', '=', 'copy', '.', 'deepcopy', '(', 'desired', ')', 'desired', '[', "'Role'", ']', '='...
Replication accepts a non-ARN role name, but always returns an ARN
['Replication', 'accepts', 'a', 'non', '-', 'ARN', 'role', 'name', 'but', 'always', 'returns', 'an', 'ARN']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L326-L334
4,212
tcalmant/ipopo
samples/run_remote.py
InstallUtils.transport_jsonrpc
def transport_jsonrpc(self): """ Installs the JSON-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.json_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discover...
python
def transport_jsonrpc(self): """ Installs the JSON-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.json_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discover...
['def', 'transport_jsonrpc', '(', 'self', ')', ':', '# Install the bundle', 'self', '.', 'context', '.', 'install_bundle', '(', '"pelix.remote.json_rpc"', ')', '.', 'start', '(', ')', 'with', 'use_waiting_list', '(', 'self', '.', 'context', ')', 'as', 'ipopo', ':', '# Instantiate the discovery', 'ipopo', '.', 'add', '(...
Installs the JSON-RPC transport bundles and instantiates components
['Installs', 'the', 'JSON', '-', 'RPC', 'transport', 'bundles', 'and', 'instantiates', 'components']
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L172-L186
4,213
thefactory/marathon-python
marathon/client.py
MarathonClient.list_tasks
def list_tasks(self, app_id=None, **kwargs): """List running tasks, optionally filtered by app_id. :param str app_id: if passed, only show tasks for this application :param kwargs: arbitrary search filters :returns: list of tasks :rtype: list[:class:`marathon.models.task.Marath...
python
def list_tasks(self, app_id=None, **kwargs): """List running tasks, optionally filtered by app_id. :param str app_id: if passed, only show tasks for this application :param kwargs: arbitrary search filters :returns: list of tasks :rtype: list[:class:`marathon.models.task.Marath...
['def', 'list_tasks', '(', 'self', ',', 'app_id', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'response', '=', 'self', '.', '_do_request', '(', "'GET'", ',', "'/v2/apps/%s/tasks'", '%', 'app_id', 'if', 'app_id', 'else', "'/v2/tasks'", ')', 'tasks', '=', 'self', '.', '_parse_response', '(', 'response', ',', 'Maratho...
List running tasks, optionally filtered by app_id. :param str app_id: if passed, only show tasks for this application :param kwargs: arbitrary search filters :returns: list of tasks :rtype: list[:class:`marathon.models.task.MarathonTask`]
['List', 'running', 'tasks', 'optionally', 'filtered', 'by', 'app_id', '.']
train
https://github.com/thefactory/marathon-python/blob/592b253aa8edf2475c97ca438ad7b6936652caf2/marathon/client.py#L498-L516
4,214
nickmilon/Hellas
Hellas/Athens.py
dms2dd
def dms2dd(degrees, minutes, seconds, direction): """convert degrees, minutes, seconds to dd :param string direction: one of N S W E """ dd = (degrees + minutes/60.0) + (seconds/3600.0) # 60.0 fraction for python 2+ compatibility return dd * -1 if direction == 'S' or direction == 'W' else ...
python
def dms2dd(degrees, minutes, seconds, direction): """convert degrees, minutes, seconds to dd :param string direction: one of N S W E """ dd = (degrees + minutes/60.0) + (seconds/3600.0) # 60.0 fraction for python 2+ compatibility return dd * -1 if direction == 'S' or direction == 'W' else ...
['def', 'dms2dd', '(', 'degrees', ',', 'minutes', ',', 'seconds', ',', 'direction', ')', ':', 'dd', '=', '(', 'degrees', '+', 'minutes', '/', '60.0', ')', '+', '(', 'seconds', '/', '3600.0', ')', '# 60.0 fraction for python 2+ compatibility', 'return', 'dd', '*', '-', '1', 'if', 'direction', '==', "'S'", 'or', 'directi...
convert degrees, minutes, seconds to dd :param string direction: one of N S W E
['convert', 'degrees', 'minutes', 'seconds', 'to', 'dd', ':', 'param', 'string', 'direction', ':', 'one', 'of', 'N', 'S', 'W', 'E']
train
https://github.com/nickmilon/Hellas/blob/542e4778692fbec90753942946f20100412ec9ee/Hellas/Athens.py#L83-L88
4,215
aganezov/bg
bg/breakpoint_graph.py
BreakpointGraph.split_bgedge
def split_bgedge(self, bgedge, guidance=None, sorted_guidance=False, account_for_colors_multiplicity_in_guidance=True, key=None): """ Splits a :class:`bg.edge.BGEdge` in current :class:`BreakpointGraph` most similar to supplied one (if no unique identifier ``key`` is pr...
python
def split_bgedge(self, bgedge, guidance=None, sorted_guidance=False, account_for_colors_multiplicity_in_guidance=True, key=None): """ Splits a :class:`bg.edge.BGEdge` in current :class:`BreakpointGraph` most similar to supplied one (if no unique identifier ``key`` is pr...
['def', 'split_bgedge', '(', 'self', ',', 'bgedge', ',', 'guidance', '=', 'None', ',', 'sorted_guidance', '=', 'False', ',', 'account_for_colors_multiplicity_in_guidance', '=', 'True', ',', 'key', '=', 'None', ')', ':', 'self', '.', '__split_bgedge', '(', 'bgedge', '=', 'bgedge', ',', 'guidance', '=', 'guidance', ',', ...
Splits a :class:`bg.edge.BGEdge` in current :class:`BreakpointGraph` most similar to supplied one (if no unique identifier ``key`` is provided) with respect to supplied guidance. Proxies a call to :meth:`BreakpointGraph._BreakpointGraph__split_bgedge` method. :param bgedge: an edge to find most "simil...
['Splits', 'a', ':', 'class', ':', 'bg', '.', 'edge', '.', 'BGEdge', 'in', 'current', ':', 'class', ':', 'BreakpointGraph', 'most', 'similar', 'to', 'supplied', 'one', '(', 'if', 'no', 'unique', 'identifier', 'key', 'is', 'provided', ')', 'with', 'respect', 'to', 'supplied', 'guidance', '.']
train
https://github.com/aganezov/bg/blob/1ec758193441e49e7b34e0da09571480f4c24455/bg/breakpoint_graph.py#L528-L547
4,216
Erotemic/utool
utool/_internal/py2_syntax_funcs.py
ignores_exc_tb
def ignores_exc_tb(*args, **kwargs): """ PYTHON 2 ONLY VERSION -- needs to be in its own file for syntactic reasons ignore_exc_tb decorates a function and remove both itself and the function from any exception traceback that occurs. This is useful to decorate other trivial decorators which are...
python
def ignores_exc_tb(*args, **kwargs): """ PYTHON 2 ONLY VERSION -- needs to be in its own file for syntactic reasons ignore_exc_tb decorates a function and remove both itself and the function from any exception traceback that occurs. This is useful to decorate other trivial decorators which are...
['def', 'ignores_exc_tb', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'outer_wrapper', '=', 'kwargs', '.', 'get', '(', "'outer_wrapper'", ',', 'True', ')', 'def', 'ignores_exc_tb_closure', '(', 'func', ')', ':', 'if', 'not', 'IGNORE_TRACEBACK', ':', '# if the global enforces that we should not ignore anytraceb...
PYTHON 2 ONLY VERSION -- needs to be in its own file for syntactic reasons ignore_exc_tb decorates a function and remove both itself and the function from any exception traceback that occurs. This is useful to decorate other trivial decorators which are polluting your stacktrace. if IGNORE_TRACEB...
['PYTHON', '2', 'ONLY', 'VERSION', '--', 'needs', 'to', 'be', 'in', 'its', 'own', 'file', 'for', 'syntactic', 'reasons']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/_internal/py2_syntax_funcs.py#L10-L61
4,217
blockstack/blockstack-core
blockstack/lib/config.py
get_epoch_namespace_prices
def get_epoch_namespace_prices( block_height, units ): """ get the list of namespace prices by block height """ assert units in ['BTC', TOKEN_TYPE_STACKS], 'Invalid unit {}'.format(units) epoch_config = get_epoch_config( block_height ) if units == 'BTC': return epoch_config['namespace_...
python
def get_epoch_namespace_prices( block_height, units ): """ get the list of namespace prices by block height """ assert units in ['BTC', TOKEN_TYPE_STACKS], 'Invalid unit {}'.format(units) epoch_config = get_epoch_config( block_height ) if units == 'BTC': return epoch_config['namespace_...
['def', 'get_epoch_namespace_prices', '(', 'block_height', ',', 'units', ')', ':', 'assert', 'units', 'in', '[', "'BTC'", ',', 'TOKEN_TYPE_STACKS', ']', ',', "'Invalid unit {}'", '.', 'format', '(', 'units', ')', 'epoch_config', '=', 'get_epoch_config', '(', 'block_height', ')', 'if', 'units', '==', "'BTC'", ':', 'retu...
get the list of namespace prices by block height
['get', 'the', 'list', 'of', 'namespace', 'prices', 'by', 'block', 'height']
train
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/config.py#L1062-L1073
4,218
rmst/chi
chi/rl/async_dqn.py
delling_network
def delling_network(): """ Architecture according to Duelling DQN: https://arxiv.org/abs/1511.06581 """ @tt.model(tracker=tf.train.ExponentialMovingAverage(1 - .0005), # TODO: replace with original weight freeze optimizer=tf.train.RMSPropOptimizer(6.25e-5, .95, .95, .01)) ...
python
def delling_network(): """ Architecture according to Duelling DQN: https://arxiv.org/abs/1511.06581 """ @tt.model(tracker=tf.train.ExponentialMovingAverage(1 - .0005), # TODO: replace with original weight freeze optimizer=tf.train.RMSPropOptimizer(6.25e-5, .95, .95, .01)) ...
['def', 'delling_network', '(', ')', ':', '@', 'tt', '.', 'model', '(', 'tracker', '=', 'tf', '.', 'train', '.', 'ExponentialMovingAverage', '(', '1', '-', '.0005', ')', ',', '# TODO: replace with original weight freeze', 'optimizer', '=', 'tf', '.', 'train', '.', 'RMSPropOptimizer', '(', '6.25e-5', ',', '.95', ',', '....
Architecture according to Duelling DQN: https://arxiv.org/abs/1511.06581
['Architecture', 'according', 'to', 'Duelling', 'DQN', ':', 'https', ':', '//', 'arxiv', '.', 'org', '/', 'abs', '/', '1511', '.', '06581']
train
https://github.com/rmst/chi/blob/b9205127f3736eb6ebbf6bb2960c4bbb747142b7/chi/rl/async_dqn.py#L218-L241
4,219
yyuu/botornado
boto/ec2/connection.py
EC2Connection.get_all_bundle_tasks
def get_all_bundle_tasks(self, bundle_ids=None, filters=None): """ Retrieve current bundling tasks. If no bundle id is specified, all tasks are retrieved. :type bundle_ids: list :param bundle_ids: A list of strings containing identifiers for previously...
python
def get_all_bundle_tasks(self, bundle_ids=None, filters=None): """ Retrieve current bundling tasks. If no bundle id is specified, all tasks are retrieved. :type bundle_ids: list :param bundle_ids: A list of strings containing identifiers for previously...
['def', 'get_all_bundle_tasks', '(', 'self', ',', 'bundle_ids', '=', 'None', ',', 'filters', '=', 'None', ')', ':', 'params', '=', '{', '}', 'if', 'bundle_ids', ':', 'self', '.', 'build_list_params', '(', 'params', ',', 'bundle_ids', ',', "'BundleId'", ')', 'if', 'filters', ':', 'self', '.', 'build_filter_params', '(',...
Retrieve current bundling tasks. If no bundle id is specified, all tasks are retrieved. :type bundle_ids: list :param bundle_ids: A list of strings containing identifiers for previously created bundling tasks. :type filters: dict :param filters: Optio...
['Retrieve', 'current', 'bundling', 'tasks', '.', 'If', 'no', 'bundle', 'id', 'is', 'specified', 'all', 'tasks', 'are', 'retrieved', '.']
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/connection.py#L2533-L2560
4,220
QuantEcon/QuantEcon.py
quantecon/game_theory/vertex_enumeration.py
_get_mixed_actions
def _get_mixed_actions(labeling_bits, equation_tup, trans_recips): """ From a labeling for player 0, a tuple of hyperplane equations of the polar polytopes, and a tuple of the reciprocals of the translations, return a tuple of the corresponding, normalized mixed actions. Parameters ---------- ...
python
def _get_mixed_actions(labeling_bits, equation_tup, trans_recips): """ From a labeling for player 0, a tuple of hyperplane equations of the polar polytopes, and a tuple of the reciprocals of the translations, return a tuple of the corresponding, normalized mixed actions. Parameters ---------- ...
['def', '_get_mixed_actions', '(', 'labeling_bits', ',', 'equation_tup', ',', 'trans_recips', ')', ':', 'm', ',', 'n', '=', 'equation_tup', '[', '0', ']', '.', 'shape', '[', '0', ']', '-', '1', ',', 'equation_tup', '[', '1', ']', '.', 'shape', '[', '0', ']', '-', '1', 'out', '=', 'np', '.', 'empty', '(', 'm', '+', 'n',...
From a labeling for player 0, a tuple of hyperplane equations of the polar polytopes, and a tuple of the reciprocals of the translations, return a tuple of the corresponding, normalized mixed actions. Parameters ---------- labeling_bits : scalar(np.uint64) Integer with set bits representing...
['From', 'a', 'labeling', 'for', 'player', '0', 'a', 'tuple', 'of', 'hyperplane', 'equations', 'of', 'the', 'polar', 'polytopes', 'and', 'a', 'tuple', 'of', 'the', 'reciprocals', 'of', 'the', 'translations', 'return', 'a', 'tuple', 'of', 'the', 'corresponding', 'normalized', 'mixed', 'actions', '.']
train
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/vertex_enumeration.py#L294-L335
4,221
inasafe/inasafe
safe/gui/tools/wizard/step_kw00_purpose.py
StepKwPurpose.clear_further_steps
def clear_further_steps(self): """Clear all further steps in order to properly calculate the prev step """ self.parent.step_kw_hazard_category.lstHazardCategories.clear() self.parent.step_kw_subcategory.lstSubcategories.clear() self.parent.step_kw_layermode.lstLayerModes.clear() ...
python
def clear_further_steps(self): """Clear all further steps in order to properly calculate the prev step """ self.parent.step_kw_hazard_category.lstHazardCategories.clear() self.parent.step_kw_subcategory.lstSubcategories.clear() self.parent.step_kw_layermode.lstLayerModes.clear() ...
['def', 'clear_further_steps', '(', 'self', ')', ':', 'self', '.', 'parent', '.', 'step_kw_hazard_category', '.', 'lstHazardCategories', '.', 'clear', '(', ')', 'self', '.', 'parent', '.', 'step_kw_subcategory', '.', 'lstSubcategories', '.', 'clear', '(', ')', 'self', '.', 'parent', '.', 'step_kw_layermode', '.', 'lstL...
Clear all further steps in order to properly calculate the prev step
['Clear', 'all', 'further', 'steps', 'in', 'order', 'to', 'properly', 'calculate', 'the', 'prev', 'step']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw00_purpose.py#L99-L116
4,222
testing-cabal/systemfixtures
systemfixtures/filesystem.py
FakeFilesystem.add
def add(self, path): """Add a path to the overlay filesytem. Any filesystem operation involving the this path or any sub-paths of it will be transparently redirected to temporary root dir. @path: An absolute path string. """ if not path.startswith(os.sep): r...
python
def add(self, path): """Add a path to the overlay filesytem. Any filesystem operation involving the this path or any sub-paths of it will be transparently redirected to temporary root dir. @path: An absolute path string. """ if not path.startswith(os.sep): r...
['def', 'add', '(', 'self', ',', 'path', ')', ':', 'if', 'not', 'path', '.', 'startswith', '(', 'os', '.', 'sep', ')', ':', 'raise', 'ValueError', '(', '"Non-absolute path \'{}\'"', '.', 'format', '(', 'path', ')', ')', 'path', '=', 'path', '.', 'rstrip', '(', 'os', '.', 'sep', ')', 'while', 'True', ':', 'self', '.', '...
Add a path to the overlay filesytem. Any filesystem operation involving the this path or any sub-paths of it will be transparently redirected to temporary root dir. @path: An absolute path string.
['Add', 'a', 'path', 'to', 'the', 'overlay', 'filesytem', '.']
train
https://github.com/testing-cabal/systemfixtures/blob/adf1b822bf83dc2a2f6bf7b85b5d8055e5e6ccd4/systemfixtures/filesystem.py#L65-L80
4,223
gem/oq-engine
openquake/commonlib/calc.py
make_hmap
def make_hmap(pmap, imtls, poes): """ Compute the hazard maps associated to the passed probability map. :param pmap: hazard curves in the form of a ProbabilityMap :param imtls: DictArray with M intensity measure types :param poes: P PoEs where to compute the maps :returns: a ProbabilityMap with...
python
def make_hmap(pmap, imtls, poes): """ Compute the hazard maps associated to the passed probability map. :param pmap: hazard curves in the form of a ProbabilityMap :param imtls: DictArray with M intensity measure types :param poes: P PoEs where to compute the maps :returns: a ProbabilityMap with...
['def', 'make_hmap', '(', 'pmap', ',', 'imtls', ',', 'poes', ')', ':', 'M', ',', 'P', '=', 'len', '(', 'imtls', ')', ',', 'len', '(', 'poes', ')', 'hmap', '=', 'probability_map', '.', 'ProbabilityMap', '.', 'build', '(', 'M', ',', 'P', ',', 'pmap', ',', 'dtype', '=', 'F32', ')', 'if', 'len', '(', 'pmap', ')', '==', '0'...
Compute the hazard maps associated to the passed probability map. :param pmap: hazard curves in the form of a ProbabilityMap :param imtls: DictArray with M intensity measure types :param poes: P PoEs where to compute the maps :returns: a ProbabilityMap with size (N, M, P)
['Compute', 'the', 'hazard', 'maps', 'associated', 'to', 'the', 'passed', 'probability', 'map', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/calc.py#L184-L205
4,224
alefnula/tea
tea/console/format.py
format_page
def format_page(text): """Format the text for output adding ASCII frame around the text. Args: text (str): Text that needs to be formatted. Returns: str: Formatted string. """ width = max(map(len, text.splitlines())) page = "+-" + "-" * width + "-+\n" for line in...
python
def format_page(text): """Format the text for output adding ASCII frame around the text. Args: text (str): Text that needs to be formatted. Returns: str: Formatted string. """ width = max(map(len, text.splitlines())) page = "+-" + "-" * width + "-+\n" for line in...
['def', 'format_page', '(', 'text', ')', ':', 'width', '=', 'max', '(', 'map', '(', 'len', ',', 'text', '.', 'splitlines', '(', ')', ')', ')', 'page', '=', '"+-"', '+', '"-"', '*', 'width', '+', '"-+\\n"', 'for', 'line', 'in', 'text', '.', 'splitlines', '(', ')', ':', 'page', '+=', '"| "', '+', 'line', '.', 'ljust', '(...
Format the text for output adding ASCII frame around the text. Args: text (str): Text that needs to be formatted. Returns: str: Formatted string.
['Format', 'the', 'text', 'for', 'output', 'adding', 'ASCII', 'frame', 'around', 'the', 'text', '.', 'Args', ':', 'text', '(', 'str', ')', ':', 'Text', 'that', 'needs', 'to', 'be', 'formatted', '.', 'Returns', ':', 'str', ':', 'Formatted', 'string', '.']
train
https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L16-L30
4,225
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
MAVLink.mission_request_partial_list_encode
def mission_request_partial_list_encode(self, target_system, target_component, start_index, end_index): ''' Request a partial list of mission items from the system/component. http://qgroundcontrol.org/mavlink/waypoint_protocol. If start and end index are t...
python
def mission_request_partial_list_encode(self, target_system, target_component, start_index, end_index): ''' Request a partial list of mission items from the system/component. http://qgroundcontrol.org/mavlink/waypoint_protocol. If start and end index are t...
['def', 'mission_request_partial_list_encode', '(', 'self', ',', 'target_system', ',', 'target_component', ',', 'start_index', ',', 'end_index', ')', ':', 'return', 'MAVLink_mission_request_partial_list_message', '(', 'target_system', ',', 'target_component', ',', 'start_index', ',', 'end_index', ')']
Request a partial list of mission items from the system/component. http://qgroundcontrol.org/mavlink/waypoint_protocol. If start and end index are the same, just send one waypoint. target_system : System ID (uint8_t) target_com...
['Request', 'a', 'partial', 'list', 'of', 'mission', 'items', 'from', 'the', 'system', '/', 'component', '.', 'http', ':', '//', 'qgroundcontrol', '.', 'org', '/', 'mavlink', '/', 'waypoint_protocol', '.', 'If', 'start', 'and', 'end', 'index', 'are', 'the', 'same', 'just', 'send', 'one', 'waypoint', '.']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9407-L9420
4,226
saltstack/salt
salt/key.py
Key.gen_keys
def gen_keys(self, keydir=None, keyname=None, keysize=None, user=None): ''' Generate minion RSA public keypair ''' keydir, keyname, keysize, user = self._get_key_attrs(keydir, keyname, keysize, user) salt.crypt.gen_keys...
python
def gen_keys(self, keydir=None, keyname=None, keysize=None, user=None): ''' Generate minion RSA public keypair ''' keydir, keyname, keysize, user = self._get_key_attrs(keydir, keyname, keysize, user) salt.crypt.gen_keys...
['def', 'gen_keys', '(', 'self', ',', 'keydir', '=', 'None', ',', 'keyname', '=', 'None', ',', 'keysize', '=', 'None', ',', 'user', '=', 'None', ')', ':', 'keydir', ',', 'keyname', ',', 'keysize', ',', 'user', '=', 'self', '.', '_get_key_attrs', '(', 'keydir', ',', 'keyname', ',', 'keysize', ',', 'user', ')', 'salt', '...
Generate minion RSA public keypair
['Generate', 'minion', 'RSA', 'public', 'keypair']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L343-L350
4,227
pypa/pipenv
pipenv/patched/notpip/_vendor/distro.py
LinuxDistribution.name
def name(self, pretty=False): """ Return the name of the OS distribution, as a string. For details, see :func:`distro.name`. """ name = self.os_release_attr('name') \ or self.lsb_release_attr('distributor_id') \ or self.distro_release_attr('name') \ ...
python
def name(self, pretty=False): """ Return the name of the OS distribution, as a string. For details, see :func:`distro.name`. """ name = self.os_release_attr('name') \ or self.lsb_release_attr('distributor_id') \ or self.distro_release_attr('name') \ ...
['def', 'name', '(', 'self', ',', 'pretty', '=', 'False', ')', ':', 'name', '=', 'self', '.', 'os_release_attr', '(', "'name'", ')', 'or', 'self', '.', 'lsb_release_attr', '(', "'distributor_id'", ')', 'or', 'self', '.', 'distro_release_attr', '(', "'name'", ')', 'or', 'self', '.', 'uname_attr', '(', "'name'", ')', 'if...
Return the name of the OS distribution, as a string. For details, see :func:`distro.name`.
['Return', 'the', 'name', 'of', 'the', 'OS', 'distribution', 'as', 'a', 'string', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/distro.py#L706-L725
4,228
bhmm/bhmm
bhmm/output_models/outputmodel.py
OutputModel.set_implementation
def set_implementation(self, impl): """ Sets the implementation of this module Parameters ---------- impl : str One of ["python", "c"] """ if impl.lower() == 'python': self.__impl__ = self.__IMPL_PYTHON__ elif impl.lower() == 'c':...
python
def set_implementation(self, impl): """ Sets the implementation of this module Parameters ---------- impl : str One of ["python", "c"] """ if impl.lower() == 'python': self.__impl__ = self.__IMPL_PYTHON__ elif impl.lower() == 'c':...
['def', 'set_implementation', '(', 'self', ',', 'impl', ')', ':', 'if', 'impl', '.', 'lower', '(', ')', '==', "'python'", ':', 'self', '.', '__impl__', '=', 'self', '.', '__IMPL_PYTHON__', 'elif', 'impl', '.', 'lower', '(', ')', '==', "'c'", ':', 'self', '.', '__impl__', '=', 'self', '.', '__IMPL_C__', 'else', ':', 'im...
Sets the implementation of this module Parameters ---------- impl : str One of ["python", "c"]
['Sets', 'the', 'implementation', 'of', 'this', 'module']
train
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/output_models/outputmodel.py#L69-L86
4,229
TheHive-Project/Cortex-Analyzers
analyzers/MaxMind/ipaddr.py
_get_prefix_length
def _get_prefix_length(number1, number2, bits): """Get the number of leading bits that are same for two numbers. Args: number1: an integer. number2: another integer. bits: the maximum number of bits to compare. Returns: The number of leading bits that are the same for two n...
python
def _get_prefix_length(number1, number2, bits): """Get the number of leading bits that are same for two numbers. Args: number1: an integer. number2: another integer. bits: the maximum number of bits to compare. Returns: The number of leading bits that are the same for two n...
['def', '_get_prefix_length', '(', 'number1', ',', 'number2', ',', 'bits', ')', ':', 'for', 'i', 'in', 'range', '(', 'bits', ')', ':', 'if', 'number1', '>>', 'i', '==', 'number2', '>>', 'i', ':', 'return', 'bits', '-', 'i', 'return', '0']
Get the number of leading bits that are same for two numbers. Args: number1: an integer. number2: another integer. bits: the maximum number of bits to compare. Returns: The number of leading bits that are the same for two numbers.
['Get', 'the', 'number', 'of', 'leading', 'bits', 'that', 'are', 'same', 'for', 'two', 'numbers', '.']
train
https://github.com/TheHive-Project/Cortex-Analyzers/blob/8dae6a8c4cf9af5554ae8c844985c4b44d4bd4bf/analyzers/MaxMind/ipaddr.py#L170-L185
4,230
systemd/python-systemd
systemd/journal.py
stream
def stream(identifier=None, priority=LOG_INFO, level_prefix=False): r"""Return a file object wrapping a stream to journal. Log messages written to this file as simple newline sepearted text strings are written to the journal. The file will be line buffered, so messages are actually sent after a ne...
python
def stream(identifier=None, priority=LOG_INFO, level_prefix=False): r"""Return a file object wrapping a stream to journal. Log messages written to this file as simple newline sepearted text strings are written to the journal. The file will be line buffered, so messages are actually sent after a ne...
['def', 'stream', '(', 'identifier', '=', 'None', ',', 'priority', '=', 'LOG_INFO', ',', 'level_prefix', '=', 'False', ')', ':', 'if', 'identifier', 'is', 'None', ':', 'if', 'not', '_sys', '.', 'argv', 'or', 'not', '_sys', '.', 'argv', '[', '0', ']', 'or', '_sys', '.', 'argv', '[', '0', ']', '==', "'-c'", ':', 'identif...
r"""Return a file object wrapping a stream to journal. Log messages written to this file as simple newline sepearted text strings are written to the journal. The file will be line buffered, so messages are actually sent after a newline character is written. >>> from systemd import journal >>>...
['r', 'Return', 'a', 'file', 'object', 'wrapping', 'a', 'stream', 'to', 'journal', '.']
train
https://github.com/systemd/python-systemd/blob/c06c5d401d60ae9175367be0797a6c2b562ac5ba/systemd/journal.py#L460-L501
4,231
ivelum/graphql-py
graphql/parser.py
GraphQLParser.p_operation_definition4
def p_operation_definition4(self, p): """ operation_definition : operation_type name selection_set """ p[0] = self.operation_cls(p[1])(selections=p[3], name=p[2])
python
def p_operation_definition4(self, p): """ operation_definition : operation_type name selection_set """ p[0] = self.operation_cls(p[1])(selections=p[3], name=p[2])
['def', 'p_operation_definition4', '(', 'self', ',', 'p', ')', ':', 'p', '[', '0', ']', '=', 'self', '.', 'operation_cls', '(', 'p', '[', '1', ']', ')', '(', 'selections', '=', 'p', '[', '3', ']', ',', 'name', '=', 'p', '[', '2', ']', ')']
operation_definition : operation_type name selection_set
['operation_definition', ':', 'operation_type', 'name', 'selection_set']
train
https://github.com/ivelum/graphql-py/blob/72baf16d838e82349ee5e8d8f8971ce11cfcedf9/graphql/parser.py#L126-L130
4,232
ClimateImpactLab/DataFS
datafs/config/helpers.py
check_requirements
def check_requirements(to_populate, prompts, helper=False): ''' Iterates through required values, checking to_populate for required values If a key in prompts is missing in to_populate and ``helper==True``, prompts the user using the values in to_populate. Otherwise, raises an error. Parameter...
python
def check_requirements(to_populate, prompts, helper=False): ''' Iterates through required values, checking to_populate for required values If a key in prompts is missing in to_populate and ``helper==True``, prompts the user using the values in to_populate. Otherwise, raises an error. Parameter...
['def', 'check_requirements', '(', 'to_populate', ',', 'prompts', ',', 'helper', '=', 'False', ')', ':', 'for', 'kw', ',', 'prompt', 'in', 'prompts', '.', 'items', '(', ')', ':', 'if', 'helper', ':', 'if', 'kw', 'not', 'in', 'to_populate', ':', 'to_populate', '[', 'kw', ']', '=', 'click', '.', 'prompt', '(', 'prompt', ...
Iterates through required values, checking to_populate for required values If a key in prompts is missing in to_populate and ``helper==True``, prompts the user using the values in to_populate. Otherwise, raises an error. Parameters ---------- to_populate : dict Data dictionary to fill...
['Iterates', 'through', 'required', 'values', 'checking', 'to_populate', 'for', 'required', 'values']
train
https://github.com/ClimateImpactLab/DataFS/blob/0d32c2b4e18d300a11b748a552f6adbc3dd8f59d/datafs/config/helpers.py#L158-L187
4,233
Microsoft/nni
examples/trials/ga_squad/graph.py
Graph.is_topology
def is_topology(self, layers=None): ''' valid the topology ''' if layers is None: layers = self.layers layers_nodle = [] result = [] for i, layer in enumerate(layers): if layer.is_delete is False: layers_nodle.append(i) ...
python
def is_topology(self, layers=None): ''' valid the topology ''' if layers is None: layers = self.layers layers_nodle = [] result = [] for i, layer in enumerate(layers): if layer.is_delete is False: layers_nodle.append(i) ...
['def', 'is_topology', '(', 'self', ',', 'layers', '=', 'None', ')', ':', 'if', 'layers', 'is', 'None', ':', 'layers', '=', 'self', '.', 'layers', 'layers_nodle', '=', '[', ']', 'result', '=', '[', ']', 'for', 'i', ',', 'layer', 'in', 'enumerate', '(', 'layers', ')', ':', 'if', 'layer', '.', 'is_delete', 'is', 'False',...
valid the topology
['valid', 'the', 'topology']
train
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/ga_squad/graph.py#L133-L168
4,234
libtcod/python-tcod
tcod/image.py
Image.blit_2x
def blit_2x( self, console: tcod.console.Console, dest_x: int, dest_y: int, img_x: int = 0, img_y: int = 0, img_width: int = -1, img_height: int = -1, ) -> None: """Blit onto a Console with double resolution. Args: console ...
python
def blit_2x( self, console: tcod.console.Console, dest_x: int, dest_y: int, img_x: int = 0, img_y: int = 0, img_width: int = -1, img_height: int = -1, ) -> None: """Blit onto a Console with double resolution. Args: console ...
['def', 'blit_2x', '(', 'self', ',', 'console', ':', 'tcod', '.', 'console', '.', 'Console', ',', 'dest_x', ':', 'int', ',', 'dest_y', ':', 'int', ',', 'img_x', ':', 'int', '=', '0', ',', 'img_y', ':', 'int', '=', '0', ',', 'img_width', ':', 'int', '=', '-', '1', ',', 'img_height', ':', 'int', '=', '-', '1', ',', ')', ...
Blit onto a Console with double resolution. Args: console (Console): Blit destination Console. dest_x (int): Console tile X position starting from the left at 0. dest_y (int): Console tile Y position starting from the top at 0. img_x (int): Left corner pixel of t...
['Blit', 'onto', 'a', 'Console', 'with', 'double', 'resolution', '.']
train
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/image.py#L254-L286
4,235
google/transitfeed
examples/google_random_queries.py
WriteOutput
def WriteOutput(title, locations, limit, f): """Write html to f for up to limit trips between locations. Args: title: String used in html title locations: list of (lat, lng) tuples limit: maximum number of queries in the html f: a file object """ output_prefix = """ <html> <head> <meta http-equ...
python
def WriteOutput(title, locations, limit, f): """Write html to f for up to limit trips between locations. Args: title: String used in html title locations: list of (lat, lng) tuples limit: maximum number of queries in the html f: a file object """ output_prefix = """ <html> <head> <meta http-equ...
['def', 'WriteOutput', '(', 'title', ',', 'locations', ',', 'limit', ',', 'f', ')', ':', 'output_prefix', '=', '"""\n<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n<title>%(title)s</title>\n</head>\n<body>\nRandom queries for %(title)s<p>\nThis list of random queries should speed u...
Write html to f for up to limit trips between locations. Args: title: String used in html title locations: list of (lat, lng) tuples limit: maximum number of queries in the html f: a file object
['Write', 'html', 'to', 'f', 'for', 'up', 'to', 'limit', 'trips', 'between', 'locations', '.']
train
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/examples/google_random_queries.py#L122-L178
4,236
vxgmichel/aiostream
aiostream/stream/combine.py
chain
async def chain(*sources): """Chain asynchronous sequences together, in the order they are given. Note: the sequences are not iterated until it is required, so if the operation is interrupted, the remaining sequences will be left untouched. """ for source in sources: async with streamco...
python
async def chain(*sources): """Chain asynchronous sequences together, in the order they are given. Note: the sequences are not iterated until it is required, so if the operation is interrupted, the remaining sequences will be left untouched. """ for source in sources: async with streamco...
['async', 'def', 'chain', '(', '*', 'sources', ')', ':', 'for', 'source', 'in', 'sources', ':', 'async', 'with', 'streamcontext', '(', 'source', ')', 'as', 'streamer', ':', 'async', 'for', 'item', 'in', 'streamer', ':', 'yield', 'item']
Chain asynchronous sequences together, in the order they are given. Note: the sequences are not iterated until it is required, so if the operation is interrupted, the remaining sequences will be left untouched.
['Chain', 'asynchronous', 'sequences', 'together', 'in', 'the', 'order', 'they', 'are', 'given', '.']
train
https://github.com/vxgmichel/aiostream/blob/43bdf04ab19108a3f1b5a472062e1392a26cbcf8/aiostream/stream/combine.py#L18-L28
4,237
BernardFW/bernard
src/bernard/i18n/utils.py
LocalesFlatDict.update
def update(self, new_data: Dict[Text, Dict[Text, Text]]): """ Receive an update from a loader. :param new_data: New translation data from the loader """ for locale, data in new_data.items(): if locale not in self.dict: self.dict[locale] = {} ...
python
def update(self, new_data: Dict[Text, Dict[Text, Text]]): """ Receive an update from a loader. :param new_data: New translation data from the loader """ for locale, data in new_data.items(): if locale not in self.dict: self.dict[locale] = {} ...
['def', 'update', '(', 'self', ',', 'new_data', ':', 'Dict', '[', 'Text', ',', 'Dict', '[', 'Text', ',', 'Text', ']', ']', ')', ':', 'for', 'locale', ',', 'data', 'in', 'new_data', '.', 'items', '(', ')', ':', 'if', 'locale', 'not', 'in', 'self', '.', 'dict', ':', 'self', '.', 'dict', '[', 'locale', ']', '=', '{', '}',...
Receive an update from a loader. :param new_data: New translation data from the loader
['Receive', 'an', 'update', 'from', 'a', 'loader', '.']
train
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/utils.py#L109-L120
4,238
mitsei/dlkit
dlkit/records/osid/base_records.py
FilesRecord.get_url_by_label
def get_url_by_label(self, label, asset_content_type=None): """stub""" return self._get_asset_content(self.get_asset_id_by_label(label)).get_url()
python
def get_url_by_label(self, label, asset_content_type=None): """stub""" return self._get_asset_content(self.get_asset_id_by_label(label)).get_url()
['def', 'get_url_by_label', '(', 'self', ',', 'label', ',', 'asset_content_type', '=', 'None', ')', ':', 'return', 'self', '.', '_get_asset_content', '(', 'self', '.', 'get_asset_id_by_label', '(', 'label', ')', ')', '.', 'get_url', '(', ')']
stub
['stub']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/base_records.py#L1776-L1778
4,239
marrow/mongo
marrow/mongo/query/query.py
Q._iop
def _iop(self, operation, other, *allowed): """An iterative operation operating on multiple values. Consumes iterators to construct a concrete list at time of execution. """ f = self._field if self._combining: # We are a field-compound query fragment, e.g. (Foo.bar & Foo.baz). return reduce(self....
python
def _iop(self, operation, other, *allowed): """An iterative operation operating on multiple values. Consumes iterators to construct a concrete list at time of execution. """ f = self._field if self._combining: # We are a field-compound query fragment, e.g. (Foo.bar & Foo.baz). return reduce(self....
['def', '_iop', '(', 'self', ',', 'operation', ',', 'other', ',', '*', 'allowed', ')', ':', 'f', '=', 'self', '.', '_field', 'if', 'self', '.', '_combining', ':', '# We are a field-compound query fragment, e.g. (Foo.bar & Foo.baz).', 'return', 'reduce', '(', 'self', '.', '_combining', ',', '(', 'q', '.', '_iop', '(', '...
An iterative operation operating on multiple values. Consumes iterators to construct a concrete list at time of execution.
['An', 'iterative', 'operation', 'operating', 'on', 'multiple', 'values', '.', 'Consumes', 'iterators', 'to', 'construct', 'a', 'concrete', 'list', 'at', 'time', 'of', 'execution', '.']
train
https://github.com/marrow/mongo/blob/2066dc73e281b8a46cb5fc965267d6b8e1b18467/marrow/mongo/query/query.py#L172-L196
4,240
thiezn/iperf3-python
iperf3/iperf3.py
Client.protocol
def protocol(self): """The iperf3 instance protocol valid protocols are 'tcp' and 'udp' :rtype: str """ proto_id = self.lib.iperf_get_test_protocol_id(self._test) if proto_id == SOCK_STREAM: self._protocol = 'tcp' elif proto_id == SOCK_DGRAM: ...
python
def protocol(self): """The iperf3 instance protocol valid protocols are 'tcp' and 'udp' :rtype: str """ proto_id = self.lib.iperf_get_test_protocol_id(self._test) if proto_id == SOCK_STREAM: self._protocol = 'tcp' elif proto_id == SOCK_DGRAM: ...
['def', 'protocol', '(', 'self', ')', ':', 'proto_id', '=', 'self', '.', 'lib', '.', 'iperf_get_test_protocol_id', '(', 'self', '.', '_test', ')', 'if', 'proto_id', '==', 'SOCK_STREAM', ':', 'self', '.', '_protocol', '=', "'tcp'", 'elif', 'proto_id', '==', 'SOCK_DGRAM', ':', 'self', '.', '_protocol', '=', "'udp'", 'ret...
The iperf3 instance protocol valid protocols are 'tcp' and 'udp' :rtype: str
['The', 'iperf3', 'instance', 'protocol']
train
https://github.com/thiezn/iperf3-python/blob/094a6e043f44fb154988348603661b1473c23a50/iperf3/iperf3.py#L457-L471
4,241
talkincode/txradius
txradius/mschap/des_c.py
c2ln
def c2ln(c,l1,l2,n): "char[n] to two unsigned long???" c = c + n l1, l2 = U32(0), U32(0) f = 0 if n == 8: l2 = l2 | (U32(c[7]) << 24) f = 1 if f or (n == 7): l2 = l2 | (U32(c[6]) << 16) f = 1 if f or (n == 6): l2 = l2 | (U32(c[5]) << 8) f = 1 ...
python
def c2ln(c,l1,l2,n): "char[n] to two unsigned long???" c = c + n l1, l2 = U32(0), U32(0) f = 0 if n == 8: l2 = l2 | (U32(c[7]) << 24) f = 1 if f or (n == 7): l2 = l2 | (U32(c[6]) << 16) f = 1 if f or (n == 6): l2 = l2 | (U32(c[5]) << 8) f = 1 ...
['def', 'c2ln', '(', 'c', ',', 'l1', ',', 'l2', ',', 'n', ')', ':', 'c', '=', 'c', '+', 'n', 'l1', ',', 'l2', '=', 'U32', '(', '0', ')', ',', 'U32', '(', '0', ')', 'f', '=', '0', 'if', 'n', '==', '8', ':', 'l2', '=', 'l2', '|', '(', 'U32', '(', 'c', '[', '7', ']', ')', '<<', '24', ')', 'f', '=', '1', 'if', 'f', 'or', '...
char[n] to two unsigned long???
['char', '[', 'n', ']', 'to', 'two', 'unsigned', 'long???']
train
https://github.com/talkincode/txradius/blob/b86fdbc9be41183680b82b07d3a8e8ea10926e01/txradius/mschap/des_c.py#L35-L64
4,242
arne-cl/discoursegraphs
src/discoursegraphs/readwrite/decour.py
DecourDocumentGraph._add_dominance_relation
def _add_dominance_relation(self, source, target): """add a dominance relation to this docgraph""" # TODO: fix #39, so we don't need to add nodes by hand self.add_node(target, layers={self.ns, self.ns+':unit'}) self.add_edge(source, target, layers={self.ns, self.ns+...
python
def _add_dominance_relation(self, source, target): """add a dominance relation to this docgraph""" # TODO: fix #39, so we don't need to add nodes by hand self.add_node(target, layers={self.ns, self.ns+':unit'}) self.add_edge(source, target, layers={self.ns, self.ns+...
['def', '_add_dominance_relation', '(', 'self', ',', 'source', ',', 'target', ')', ':', "# TODO: fix #39, so we don't need to add nodes by hand", 'self', '.', 'add_node', '(', 'target', ',', 'layers', '=', '{', 'self', '.', 'ns', ',', 'self', '.', 'ns', '+', "':unit'", '}', ')', 'self', '.', 'add_edge', '(', 'source', ...
add a dominance relation to this docgraph
['add', 'a', 'dominance', 'relation', 'to', 'this', 'docgraph']
train
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/readwrite/decour.py#L143-L149
4,243
icgood/pymap
pymap/parsing/command/select.py
IdleCommand.parse_done
def parse_done(self, buf: memoryview) -> Tuple[bool, memoryview]: """Parse the continuation line sent by the client to end the ``IDLE`` command. Args: buf: The continuation line to parse. """ match = self._pattern.match(buf) if not match: raise N...
python
def parse_done(self, buf: memoryview) -> Tuple[bool, memoryview]: """Parse the continuation line sent by the client to end the ``IDLE`` command. Args: buf: The continuation line to parse. """ match = self._pattern.match(buf) if not match: raise N...
['def', 'parse_done', '(', 'self', ',', 'buf', ':', 'memoryview', ')', '->', 'Tuple', '[', 'bool', ',', 'memoryview', ']', ':', 'match', '=', 'self', '.', '_pattern', '.', 'match', '(', 'buf', ')', 'if', 'not', 'match', ':', 'raise', 'NotParseable', '(', 'buf', ')', 'done', '=', 'match', '.', 'group', '(', '1', ')', '....
Parse the continuation line sent by the client to end the ``IDLE`` command. Args: buf: The continuation line to parse.
['Parse', 'the', 'continuation', 'line', 'sent', 'by', 'the', 'client', 'to', 'end', 'the', 'IDLE', 'command', '.']
train
https://github.com/icgood/pymap/blob/e77d9a54d760e3cbe044a548883bb4299ed61dc2/pymap/parsing/command/select.py#L485-L498
4,244
ejeschke/ginga
ginga/ImageView.py
ImageViewBase.auto_levels_cb
def auto_levels_cb(self, setting, value): """Handle callback related to changes in auto-cut levels.""" # Did we change the method? method = self.t_['autocut_method'] params = self.t_.get('autocut_params', []) params = dict(params) if method != str(self.autocuts): ...
python
def auto_levels_cb(self, setting, value): """Handle callback related to changes in auto-cut levels.""" # Did we change the method? method = self.t_['autocut_method'] params = self.t_.get('autocut_params', []) params = dict(params) if method != str(self.autocuts): ...
['def', 'auto_levels_cb', '(', 'self', ',', 'setting', ',', 'value', ')', ':', '# Did we change the method?', 'method', '=', 'self', '.', 't_', '[', "'autocut_method'", ']', 'params', '=', 'self', '.', 't_', '.', 'get', '(', "'autocut_params'", ',', '[', ']', ')', 'params', '=', 'dict', '(', 'params', ')', 'if', 'metho...
Handle callback related to changes in auto-cut levels.
['Handle', 'callback', 'related', 'to', 'changes', 'in', 'auto', '-', 'cut', 'levels', '.']
train
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2655-L2672
4,245
joeyespo/gitpress
gitpress/plugins.py
add_plugin
def add_plugin(plugin, directory=None): """Adds the specified plugin. This returns False if it was already added.""" repo = require_repo(directory) plugins = get_value(repo, 'plugins', expect_type=dict) if plugin in plugins: return False plugins[plugin] = {} set_value(repo, 'plugins', p...
python
def add_plugin(plugin, directory=None): """Adds the specified plugin. This returns False if it was already added.""" repo = require_repo(directory) plugins = get_value(repo, 'plugins', expect_type=dict) if plugin in plugins: return False plugins[plugin] = {} set_value(repo, 'plugins', p...
['def', 'add_plugin', '(', 'plugin', ',', 'directory', '=', 'None', ')', ':', 'repo', '=', 'require_repo', '(', 'directory', ')', 'plugins', '=', 'get_value', '(', 'repo', ',', "'plugins'", ',', 'expect_type', '=', 'dict', ')', 'if', 'plugin', 'in', 'plugins', ':', 'return', 'False', 'plugins', '[', 'plugin', ']', '=',...
Adds the specified plugin. This returns False if it was already added.
['Adds', 'the', 'specified', 'plugin', '.', 'This', 'returns', 'False', 'if', 'it', 'was', 'already', 'added', '.']
train
https://github.com/joeyespo/gitpress/blob/a23edb80b6e4a113d167217475344a01c92b5c6d/gitpress/plugins.py#L14-L23
4,246
lovvskillz/python-discord-webhook
discord_webhook/webhook.py
DiscordEmbed.add_embed_field
def add_embed_field(self, **kwargs): """ set field of embed :keyword name: name of the field :keyword value: value of the field :keyword inline: (optional) whether or not this field should display inline """ self.fields.append({ 'name': kwargs.get('nam...
python
def add_embed_field(self, **kwargs): """ set field of embed :keyword name: name of the field :keyword value: value of the field :keyword inline: (optional) whether or not this field should display inline """ self.fields.append({ 'name': kwargs.get('nam...
['def', 'add_embed_field', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'fields', '.', 'append', '(', '{', "'name'", ':', 'kwargs', '.', 'get', '(', "'name'", ')', ',', "'value'", ':', 'kwargs', '.', 'get', '(', "'value'", ')', ',', "'inline'", ':', 'kwargs', '.', 'get', '(', "'inline'", ',', 'True', ')...
set field of embed :keyword name: name of the field :keyword value: value of the field :keyword inline: (optional) whether or not this field should display inline
['set', 'field', 'of', 'embed', ':', 'keyword', 'name', ':', 'name', 'of', 'the', 'field', ':', 'keyword', 'value', ':', 'value', 'of', 'the', 'field', ':', 'keyword', 'inline', ':', '(', 'optional', ')', 'whether', 'or', 'not', 'this', 'field', 'should', 'display', 'inline']
train
https://github.com/lovvskillz/python-discord-webhook/blob/5278184078c9da9362b6343c478a92e0904a7f83/discord_webhook/webhook.py#L259-L270
4,247
StackStorm/pybind
pybind/slxos/v17r_1_01a/mpls_config/router/mpls/mpls_cmds_holder/autobw_template/__init__.py
autobw_template._set_adjustment_threshold
def _set_adjustment_threshold(self, v, load=False): """ Setter method for adjustment_threshold, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/autobw_template/adjustment_threshold (container) If this variable is read-only (config: false) in the source YANG file, then _set_adjustment...
python
def _set_adjustment_threshold(self, v, load=False): """ Setter method for adjustment_threshold, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/autobw_template/adjustment_threshold (container) If this variable is read-only (config: false) in the source YANG file, then _set_adjustment...
['def', '_set_adjustment_threshold', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'adjustment_threshold', '.', 'adjustment_threshold', ',', ...
Setter method for adjustment_threshold, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/autobw_template/adjustment_threshold (container) If this variable is read-only (config: false) in the source YANG file, then _set_adjustment_threshold is considered as a private method. Backends looki...
['Setter', 'method', 'for', 'adjustment_threshold', 'mapped', 'from', 'YANG', 'variable', '/', 'mpls_config', '/', 'router', '/', 'mpls', '/', 'mpls_cmds_holder', '/', 'autobw_template', '/', 'adjustment_threshold', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false',...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/mpls_config/router/mpls/mpls_cmds_holder/autobw_template/__init__.py#L171-L192
4,248
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
Fei4RunBase.exit_sync
def exit_sync(self): ''' Waiting for all threads to appear, then continue. ''' if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]: raise RuntimeError('Thread name "%s" is not valid.') if self._scan_threads and self.current_module_...
python
def exit_sync(self): ''' Waiting for all threads to appear, then continue. ''' if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]: raise RuntimeError('Thread name "%s" is not valid.') if self._scan_threads and self.current_module_...
['def', 'exit_sync', '(', 'self', ')', ':', 'if', 'self', '.', '_scan_threads', 'and', 'self', '.', 'current_module_handle', 'not', 'in', '[', 't', '.', 'name', 'for', 't', 'in', 'self', '.', '_scan_threads', ']', ':', 'raise', 'RuntimeError', '(', '\'Thread name "%s" is not valid.\'', ')', 'if', 'self', '.', '_scan_th...
Waiting for all threads to appear, then continue.
['Waiting', 'for', 'all', 'threads', 'to', 'appear', 'then', 'continue', '.']
train
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L1186-L1201
4,249
booktype/python-ooxml
ooxml/doc.py
StylesCollection.get_by_name
def get_by_name(self, name, style_type = None): """Find style by it's descriptive name. :Returns: Returns found style of type :class:`ooxml.doc.Style`. """ for st in self.styles.values(): if st: if st.name == name: return st ...
python
def get_by_name(self, name, style_type = None): """Find style by it's descriptive name. :Returns: Returns found style of type :class:`ooxml.doc.Style`. """ for st in self.styles.values(): if st: if st.name == name: return st ...
['def', 'get_by_name', '(', 'self', ',', 'name', ',', 'style_type', '=', 'None', ')', ':', 'for', 'st', 'in', 'self', '.', 'styles', '.', 'values', '(', ')', ':', 'if', 'st', ':', 'if', 'st', '.', 'name', '==', 'name', ':', 'return', 'st', 'if', 'style_type', 'and', 'not', 'st', ':', 'st', '=', 'self', '.', 'styles', '...
Find style by it's descriptive name. :Returns: Returns found style of type :class:`ooxml.doc.Style`.
['Find', 'style', 'by', 'it', 's', 'descriptive', 'name', '.']
train
https://github.com/booktype/python-ooxml/blob/b56990a5bee2e1bc46839cec5161ff3726dc4d87/ooxml/doc.py#L55-L68
4,250
UCL-INGI/INGInious
inginious/frontend/pages/api/_api_page.py
APIPage.POST
def POST(self, *args, **kwargs): """ POST request """ return self._handle_api(self.API_POST, args, kwargs)
python
def POST(self, *args, **kwargs): """ POST request """ return self._handle_api(self.API_POST, args, kwargs)
['def', 'POST', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', '_handle_api', '(', 'self', '.', 'API_POST', ',', 'args', ',', 'kwargs', ')']
POST request
['POST', 'request']
train
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/api/_api_page.py#L27-L29
4,251
mezz64/pyEmby
pyemby/server.py
EmbyServer.start
def start(self): """Public method for initiating connectivity with the emby server.""" asyncio.ensure_future(self.register(), loop=self._event_loop) if self._own_loop: _LOGGER.info("Starting up our own event loop.") self._event_loop.run_forever() self._event_...
python
def start(self): """Public method for initiating connectivity with the emby server.""" asyncio.ensure_future(self.register(), loop=self._event_loop) if self._own_loop: _LOGGER.info("Starting up our own event loop.") self._event_loop.run_forever() self._event_...
['def', 'start', '(', 'self', ')', ':', 'asyncio', '.', 'ensure_future', '(', 'self', '.', 'register', '(', ')', ',', 'loop', '=', 'self', '.', '_event_loop', ')', 'if', 'self', '.', '_own_loop', ':', '_LOGGER', '.', 'info', '(', '"Starting up our own event loop."', ')', 'self', '.', '_event_loop', '.', 'run_forever', ...
Public method for initiating connectivity with the emby server.
['Public', 'method', 'for', 'initiating', 'connectivity', 'with', 'the', 'emby', 'server', '.']
train
https://github.com/mezz64/pyEmby/blob/6bb621e4e25bf1b9b0aba2c38b588e68f8816226/pyemby/server.py#L156-L164
4,252
clalancette/pycdlib
pycdlib/udf.py
NSRVolumeStructure.parse
def parse(self, data, extent): # type: (bytes, int) -> None ''' Parse the passed in data into a UDF NSR Volume Structure. Parameters: data - The data to parse. extent - The extent that this descriptor currently lives at. Returns: Nothing. ''' ...
python
def parse(self, data, extent): # type: (bytes, int) -> None ''' Parse the passed in data into a UDF NSR Volume Structure. Parameters: data - The data to parse. extent - The extent that this descriptor currently lives at. Returns: Nothing. ''' ...
['def', 'parse', '(', 'self', ',', 'data', ',', 'extent', ')', ':', '# type: (bytes, int) -> None', 'if', 'self', '.', '_initialized', ':', 'raise', 'pycdlibexception', '.', 'PyCdlibInternalError', '(', "'UDF NSR Volume Structure already initialized'", ')', '(', 'structure_type', ',', 'self', '.', 'standard_ident', ','...
Parse the passed in data into a UDF NSR Volume Structure. Parameters: data - The data to parse. extent - The extent that this descriptor currently lives at. Returns: Nothing.
['Parse', 'the', 'passed', 'in', 'data', 'into', 'a', 'UDF', 'NSR', 'Volume', 'Structure', '.']
train
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/udf.py#L282-L310
4,253
moble/quaternion
calculus.py
derivative
def derivative(f, t): """Fourth-order finite-differencing with non-uniform time steps The formula for this finite difference comes from Eq. (A 5b) of "Derivative formulas and errors for non-uniformly spaced points" by M. K. Bowen and Ronald Smith. As explained in their Eqs. (B 9b) and (B 10b), this is a ...
python
def derivative(f, t): """Fourth-order finite-differencing with non-uniform time steps The formula for this finite difference comes from Eq. (A 5b) of "Derivative formulas and errors for non-uniformly spaced points" by M. K. Bowen and Ronald Smith. As explained in their Eqs. (B 9b) and (B 10b), this is a ...
['def', 'derivative', '(', 'f', ',', 't', ')', ':', 'dfdt', '=', 'np', '.', 'empty_like', '(', 'f', ')', 'if', '(', 'f', '.', 'ndim', '==', '1', ')', ':', '_derivative', '(', 'f', ',', 't', ',', 'dfdt', ')', 'elif', '(', 'f', '.', 'ndim', '==', '2', ')', ':', '_derivative_2d', '(', 'f', ',', 't', ',', 'dfdt', ')', 'eli...
Fourth-order finite-differencing with non-uniform time steps The formula for this finite difference comes from Eq. (A 5b) of "Derivative formulas and errors for non-uniformly spaced points" by M. K. Bowen and Ronald Smith. As explained in their Eqs. (B 9b) and (B 10b), this is a fourth-order formula -- th...
['Fourth', '-', 'order', 'finite', '-', 'differencing', 'with', 'non', '-', 'uniform', 'time', 'steps']
train
https://github.com/moble/quaternion/blob/7a323e81b391d6892e2874073e495e0beb057e85/calculus.py#L9-L28
4,254
websocket-client/websocket-client
websocket/_app.py
WebSocketApp.send
def send(self, data, opcode=ABNF.OPCODE_TEXT): """ send message. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT. """ if not self.sock or self.sock.send(da...
python
def send(self, data, opcode=ABNF.OPCODE_TEXT): """ send message. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT. """ if not self.sock or self.sock.send(da...
['def', 'send', '(', 'self', ',', 'data', ',', 'opcode', '=', 'ABNF', '.', 'OPCODE_TEXT', ')', ':', 'if', 'not', 'self', '.', 'sock', 'or', 'self', '.', 'sock', '.', 'send', '(', 'data', ',', 'opcode', ')', '==', '0', ':', 'raise', 'WebSocketConnectionClosedException', '(', '"Connection is already closed."', ')']
send message. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT.
['send', 'message', '.', 'data', ':', 'message', 'to', 'send', '.', 'If', 'you', 'set', 'opcode', 'to', 'OPCODE_TEXT', 'data', 'must', 'be', 'utf', '-', '8', 'string', 'or', 'unicode', '.', 'opcode', ':', 'operation', 'code', 'of', 'data', '.', 'default', 'is', 'OPCODE_TEXT', '.']
train
https://github.com/websocket-client/websocket-client/blob/3c25814664fef5b78716ed8841123ed1c0d17824/websocket/_app.py#L145-L155
4,255
watson-developer-cloud/python-sdk
ibm_watson/speech_to_text_v1.py
Word._from_dict
def _from_dict(cls, _dict): """Initialize a Word object from a json dictionary.""" args = {} if 'word' in _dict: args['word'] = _dict.get('word') else: raise ValueError( 'Required property \'word\' not present in Word JSON') if 'sounds_like...
python
def _from_dict(cls, _dict): """Initialize a Word object from a json dictionary.""" args = {} if 'word' in _dict: args['word'] = _dict.get('word') else: raise ValueError( 'Required property \'word\' not present in Word JSON') if 'sounds_like...
['def', '_from_dict', '(', 'cls', ',', '_dict', ')', ':', 'args', '=', '{', '}', 'if', "'word'", 'in', '_dict', ':', 'args', '[', "'word'", ']', '=', '_dict', '.', 'get', '(', "'word'", ')', 'else', ':', 'raise', 'ValueError', '(', "'Required property \\'word\\' not present in Word JSON'", ')', 'if', "'sounds_like'", '...
Initialize a Word object from a json dictionary.
['Initialize', 'a', 'Word', 'object', 'from', 'a', 'json', 'dictionary', '.']
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/speech_to_text_v1.py#L5261-L5293
4,256
saltstack/salt
salt/cloud/clouds/opennebula.py
vn_info
def vn_info(call=None, kwargs=None): ''' Retrieves information for the virtual network. .. versionadded:: 2016.3.0 name The name of the virtual network for which to gather information. Can be used instead of ``vn_id``. vn_id The ID of the virtual network for which to gathe...
python
def vn_info(call=None, kwargs=None): ''' Retrieves information for the virtual network. .. versionadded:: 2016.3.0 name The name of the virtual network for which to gather information. Can be used instead of ``vn_id``. vn_id The ID of the virtual network for which to gathe...
['def', 'vn_info', '(', 'call', '=', 'None', ',', 'kwargs', '=', 'None', ')', ':', 'if', 'call', '!=', "'function'", ':', 'raise', 'SaltCloudSystemExit', '(', "'The vn_info function must be called with -f or --function.'", ')', 'if', 'kwargs', 'is', 'None', ':', 'kwargs', '=', '{', '}', 'name', '=', 'kwargs', '.', 'get...
Retrieves information for the virtual network. .. versionadded:: 2016.3.0 name The name of the virtual network for which to gather information. Can be used instead of ``vn_id``. vn_id The ID of the virtual network for which to gather information. Can be used instead of ``n...
['Retrieves', 'information', 'for', 'the', 'virtual', 'network', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/opennebula.py#L4242-L4298
4,257
acutesoftware/AIKIF
aikif/lib/cls_filelist.py
FileList.save_filelist
def save_filelist(self, opFile, opFormat, delim=',', qu='"'): """ uses a List of files and collects meta data on them and saves to an text file as a list or with metadata depending on opFormat. """ op_folder = os.path.dirname(opFile) if op_folder is not None: # ...
python
def save_filelist(self, opFile, opFormat, delim=',', qu='"'): """ uses a List of files and collects meta data on them and saves to an text file as a list or with metadata depending on opFormat. """ op_folder = os.path.dirname(opFile) if op_folder is not None: # ...
['def', 'save_filelist', '(', 'self', ',', 'opFile', ',', 'opFormat', ',', 'delim', '=', "','", ',', 'qu', '=', '\'"\'', ')', ':', 'op_folder', '=', 'os', '.', 'path', '.', 'dirname', '(', 'opFile', ')', 'if', 'op_folder', 'is', 'not', 'None', ':', '# short filename passed\r', 'if', 'not', 'os', '.', 'path', '.', 'exis...
uses a List of files and collects meta data on them and saves to an text file as a list or with metadata depending on opFormat.
['uses', 'a', 'List', 'of', 'files', 'and', 'collects', 'meta', 'data', 'on', 'them', 'and', 'saves', 'to', 'an', 'text', 'file', 'as', 'a', 'list', 'or', 'with', 'metadata', 'depending', 'on', 'opFormat', '.']
train
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L192-L228
4,258
cloud-custodian/cloud-custodian
c7n/policy.py
PolicyCollection.resource_types
def resource_types(self): """resource types used by the collection.""" rtypes = set() for p in self.policies: rtypes.add(p.resource_type) return rtypes
python
def resource_types(self): """resource types used by the collection.""" rtypes = set() for p in self.policies: rtypes.add(p.resource_type) return rtypes
['def', 'resource_types', '(', 'self', ')', ':', 'rtypes', '=', 'set', '(', ')', 'for', 'p', 'in', 'self', '.', 'policies', ':', 'rtypes', '.', 'add', '(', 'p', '.', 'resource_type', ')', 'return', 'rtypes']
resource types used by the collection.
['resource', 'types', 'used', 'by', 'the', 'collection', '.']
train
https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/policy.py#L118-L123
4,259
readbeyond/aeneas
aeneas/extra/ctw_speect.py
CustomTTSWrapper._synthesize_single_python_helper
def _synthesize_single_python_helper( self, text, voice_code, output_file_path=None, return_audio_data=True ): """ This is an helper function to synthesize a single text fragment via a Python call. If ``output_file_path`` is ``None``, the audi...
python
def _synthesize_single_python_helper( self, text, voice_code, output_file_path=None, return_audio_data=True ): """ This is an helper function to synthesize a single text fragment via a Python call. If ``output_file_path`` is ``None``, the audi...
['def', '_synthesize_single_python_helper', '(', 'self', ',', 'text', ',', 'voice_code', ',', 'output_file_path', '=', 'None', ',', 'return_audio_data', '=', 'True', ')', ':', '# return zero if text is the empty string', 'if', 'len', '(', 'text', ')', '==', '0', ':', '#', '# NOTE values of sample_rate, encoding, data',...
This is an helper function to synthesize a single text fragment via a Python call. If ``output_file_path`` is ``None``, the audio data will not persist to file at the end of the method. :rtype: tuple (result, (duration, sample_rate, encoding, data))
['This', 'is', 'an', 'helper', 'function', 'to', 'synthesize', 'a', 'single', 'text', 'fragment', 'via', 'a', 'Python', 'call', '.']
train
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/extra/ctw_speect.py#L91-L163
4,260
pandas-dev/pandas
pandas/core/algorithms.py
quantile
def quantile(x, q, interpolation_method='fraction'): """ Compute sample quantile or quantiles of the input array. For example, q=0.5 computes the median. The `interpolation_method` parameter supports three values, namely `fraction` (default), `lower` and `higher`. Interpolation is done only, if...
python
def quantile(x, q, interpolation_method='fraction'): """ Compute sample quantile or quantiles of the input array. For example, q=0.5 computes the median. The `interpolation_method` parameter supports three values, namely `fraction` (default), `lower` and `higher`. Interpolation is done only, if...
['def', 'quantile', '(', 'x', ',', 'q', ',', 'interpolation_method', '=', "'fraction'", ')', ':', 'x', '=', 'np', '.', 'asarray', '(', 'x', ')', 'mask', '=', 'isna', '(', 'x', ')', 'x', '=', 'x', '[', '~', 'mask', ']', 'values', '=', 'np', '.', 'sort', '(', 'x', ')', 'def', '_interpolate', '(', 'a', ',', 'b', ',', 'fra...
Compute sample quantile or quantiles of the input array. For example, q=0.5 computes the median. The `interpolation_method` parameter supports three values, namely `fraction` (default), `lower` and `higher`. Interpolation is done only, if the desired quantile lies between two data points `i` and `j`. F...
['Compute', 'sample', 'quantile', 'or', 'quantiles', 'of', 'the', 'input', 'array', '.', 'For', 'example', 'q', '=', '0', '.', '5', 'computes', 'the', 'median', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/algorithms.py#L966-L1043
4,261
tino/pyFirmata
pyfirmata/util.py
from_two_bytes
def from_two_bytes(bytes): """ Return an integer from two 7 bit bytes. """ lsb, msb = bytes try: # Usually bytes have been converted to integers with ord already return msb << 7 | lsb except TypeError: # But add this for easy testing # One of them can be a string,...
python
def from_two_bytes(bytes): """ Return an integer from two 7 bit bytes. """ lsb, msb = bytes try: # Usually bytes have been converted to integers with ord already return msb << 7 | lsb except TypeError: # But add this for easy testing # One of them can be a string,...
['def', 'from_two_bytes', '(', 'bytes', ')', ':', 'lsb', ',', 'msb', '=', 'bytes', 'try', ':', '# Usually bytes have been converted to integers with ord already', 'return', 'msb', '<<', '7', '|', 'lsb', 'except', 'TypeError', ':', '# But add this for easy testing', '# One of them can be a string, or both', 'try', ':', ...
Return an integer from two 7 bit bytes.
['Return', 'an', 'integer', 'from', 'two', '7', 'bit', 'bytes', '.']
train
https://github.com/tino/pyFirmata/blob/05881909c4d7c4e808e9ed457144670b2136706e/pyfirmata/util.py#L86-L105
4,262
nabetama/slacky
slacky/rest/rest.py
Groups.list
def list(self, **kwargs): """ https://api.slack.com/methods/groups.list """ if kwargs: self.params.update(kwargs) return FromUrl('https://slack.com/api/groups.list', self._requests)(data=self.params).get()
python
def list(self, **kwargs): """ https://api.slack.com/methods/groups.list """ if kwargs: self.params.update(kwargs) return FromUrl('https://slack.com/api/groups.list', self._requests)(data=self.params).get()
['def', 'list', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'if', 'kwargs', ':', 'self', '.', 'params', '.', 'update', '(', 'kwargs', ')', 'return', 'FromUrl', '(', "'https://slack.com/api/groups.list'", ',', 'self', '.', '_requests', ')', '(', 'data', '=', 'self', '.', 'params', ')', '.', 'get', '(', ')']
https://api.slack.com/methods/groups.list
['https', ':', '//', 'api', '.', 'slack', '.', 'com', '/', 'methods', '/', 'groups', '.', 'list']
train
https://github.com/nabetama/slacky/blob/dde62ce49af9b8f581729c36d2ac790310b570e4/slacky/rest/rest.py#L467-L472
4,263
OpenGov/carpenter
carpenter/blocks/tableanalyzer.py
TableAnalyzer._find_valid_block
def _find_valid_block(self, table, worksheet, flags, units, used_cells, start_pos, end_pos): ''' Searches for the next location where a valid block could reside and constructs the block object representing that location. ''' for row_index in range(len(table)): if row_...
python
def _find_valid_block(self, table, worksheet, flags, units, used_cells, start_pos, end_pos): ''' Searches for the next location where a valid block could reside and constructs the block object representing that location. ''' for row_index in range(len(table)): if row_...
['def', '_find_valid_block', '(', 'self', ',', 'table', ',', 'worksheet', ',', 'flags', ',', 'units', ',', 'used_cells', ',', 'start_pos', ',', 'end_pos', ')', ':', 'for', 'row_index', 'in', 'range', '(', 'len', '(', 'table', ')', ')', ':', 'if', 'row_index', '<', 'start_pos', '[', '0', ']', 'or', 'row_index', '>', 'en...
Searches for the next location where a valid block could reside and constructs the block object representing that location.
['Searches', 'for', 'the', 'next', 'location', 'where', 'a', 'valid', 'block', 'could', 'reside', 'and', 'constructs', 'the', 'block', 'object', 'representing', 'that', 'location', '.']
train
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/blocks/tableanalyzer.py#L198-L223
4,264
tensorflow/tensor2tensor
tensor2tensor/models/lstm.py
lstm_seq2seq_internal_attention_bid_encoder
def lstm_seq2seq_internal_attention_bid_encoder(inputs, targets, hparams, train): """LSTM seq2seq model with attention, main step used for training.""" with tf.variable_scope("lstm_seq2seq_attention_bid_encoder"): inputs_length = common_layers.length_from_embeddin...
python
def lstm_seq2seq_internal_attention_bid_encoder(inputs, targets, hparams, train): """LSTM seq2seq model with attention, main step used for training.""" with tf.variable_scope("lstm_seq2seq_attention_bid_encoder"): inputs_length = common_layers.length_from_embeddin...
['def', 'lstm_seq2seq_internal_attention_bid_encoder', '(', 'inputs', ',', 'targets', ',', 'hparams', ',', 'train', ')', ':', 'with', 'tf', '.', 'variable_scope', '(', '"lstm_seq2seq_attention_bid_encoder"', ')', ':', 'inputs_length', '=', 'common_layers', '.', 'length_from_embedding', '(', 'inputs', ')', '# Flatten in...
LSTM seq2seq model with attention, main step used for training.
['LSTM', 'seq2seq', 'model', 'with', 'attention', 'main', 'step', 'used', 'for', 'training', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/lstm.py#L305-L325
4,265
maaku/python-bitcoin
bitcoin/base58.py
b58encode
def b58encode(b, errors='strict'): "Encode bytes to a base58-encoded string." len_ = len(b) # Convert big-endian bytes to integer n = BigInteger.deserialize(BytesIO(b), len_) # Divide that integer into base58 res = [] while n > 0: n, r = divmod (n, 58) res.append(b58digits[...
python
def b58encode(b, errors='strict'): "Encode bytes to a base58-encoded string." len_ = len(b) # Convert big-endian bytes to integer n = BigInteger.deserialize(BytesIO(b), len_) # Divide that integer into base58 res = [] while n > 0: n, r = divmod (n, 58) res.append(b58digits[...
['def', 'b58encode', '(', 'b', ',', 'errors', '=', "'strict'", ')', ':', 'len_', '=', 'len', '(', 'b', ')', '# Convert big-endian bytes to integer', 'n', '=', 'BigInteger', '.', 'deserialize', '(', 'BytesIO', '(', 'b', ')', ',', 'len_', ')', '# Divide that integer into base58', 'res', '=', '[', ']', 'while', 'n', '>', ...
Encode bytes to a base58-encoded string.
['Encode', 'bytes', 'to', 'a', 'base58', '-', 'encoded', 'string', '.']
train
https://github.com/maaku/python-bitcoin/blob/1b80c284170fd3f547cc45f4700ce169f3f99641/bitcoin/base58.py#L24-L43
4,266
Kortemme-Lab/klab
klab/bio/pdb.py
PDB._determine_heterogen_chain_type
def _determine_heterogen_chain_type(residue_types): '''We distinguish three types of heterogen chain: i) all solution; ii) all ligand; or iii) other (a mix of solution, ligand, and/or ions). residue_types should be a Set of sequence identifers e.g. GTP, ZN, HOH. ''' residue_type_id_le...
python
def _determine_heterogen_chain_type(residue_types): '''We distinguish three types of heterogen chain: i) all solution; ii) all ligand; or iii) other (a mix of solution, ligand, and/or ions). residue_types should be a Set of sequence identifers e.g. GTP, ZN, HOH. ''' residue_type_id_le...
['def', '_determine_heterogen_chain_type', '(', 'residue_types', ')', ':', 'residue_type_id_lengths', '=', 'set', '(', 'map', '(', 'len', ',', 'residue_types', ')', ')', 'if', '(', 'len', '(', 'residue_types', ')', '>', '0', ')', ':', 'if', 'len', '(', 'residue_types', '.', 'difference', '(', 'common_solution_ids', ')'...
We distinguish three types of heterogen chain: i) all solution; ii) all ligand; or iii) other (a mix of solution, ligand, and/or ions). residue_types should be a Set of sequence identifers e.g. GTP, ZN, HOH.
['We', 'distinguish', 'three', 'types', 'of', 'heterogen', 'chain', ':', 'i', ')', 'all', 'solution', ';', 'ii', ')', 'all', 'ligand', ';', 'or', 'iii', ')', 'other', '(', 'a', 'mix', 'of', 'solution', 'ligand', 'and', '/', 'or', 'ions', ')', '.', 'residue_types', 'should', 'be', 'a', 'Set', 'of', 'sequence', 'identife...
train
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L1798-L1809
4,267
eternnoir/pyTelegramBotAPI
telebot/__init__.py
TeleBot.get_user_profile_photos
def get_user_profile_photos(self, user_id, offset=None, limit=None): """ Retrieves the user profile photos of the person with 'user_id' See https://core.telegram.org/bots/api#getuserprofilephotos :param user_id: :param offset: :param limit: :return: API reply. ...
python
def get_user_profile_photos(self, user_id, offset=None, limit=None): """ Retrieves the user profile photos of the person with 'user_id' See https://core.telegram.org/bots/api#getuserprofilephotos :param user_id: :param offset: :param limit: :return: API reply. ...
['def', 'get_user_profile_photos', '(', 'self', ',', 'user_id', ',', 'offset', '=', 'None', ',', 'limit', '=', 'None', ')', ':', 'result', '=', 'apihelper', '.', 'get_user_profile_photos', '(', 'self', '.', 'token', ',', 'user_id', ',', 'offset', ',', 'limit', ')', 'return', 'types', '.', 'UserProfilePhotos', '.', 'de_...
Retrieves the user profile photos of the person with 'user_id' See https://core.telegram.org/bots/api#getuserprofilephotos :param user_id: :param offset: :param limit: :return: API reply.
['Retrieves', 'the', 'user', 'profile', 'photos', 'of', 'the', 'person', 'with', 'user_id', 'See', 'https', ':', '//', 'core', '.', 'telegram', '.', 'org', '/', 'bots', '/', 'api#getuserprofilephotos', ':', 'param', 'user_id', ':', ':', 'param', 'offset', ':', ':', 'param', 'limit', ':', ':', 'return', ':', 'API', 'rep...
train
https://github.com/eternnoir/pyTelegramBotAPI/blob/47b53b88123097f1b9562a6cd5d4e080b86185d1/telebot/__init__.py#L491-L501
4,268
aheadley/python-crunchyroll
crunchyroll/apis/android_manga.py
AndroidMangaApi._build_request
def _build_request(self, method, url, params=None): """Build a function to do an API request "We have to go deeper" or "It's functions all the way down!" """ full_params = self._get_base_params() if params is not None: full_params.update(params) try: ...
python
def _build_request(self, method, url, params=None): """Build a function to do an API request "We have to go deeper" or "It's functions all the way down!" """ full_params = self._get_base_params() if params is not None: full_params.update(params) try: ...
['def', '_build_request', '(', 'self', ',', 'method', ',', 'url', ',', 'params', '=', 'None', ')', ':', 'full_params', '=', 'self', '.', '_get_base_params', '(', ')', 'if', 'params', 'is', 'not', 'None', ':', 'full_params', '.', 'update', '(', 'params', ')', 'try', ':', 'request_func', '=', 'lambda', 'u', ',', 'd', ':'...
Build a function to do an API request "We have to go deeper" or "It's functions all the way down!"
['Build', 'a', 'function', 'to', 'do', 'an', 'API', 'request']
train
https://github.com/aheadley/python-crunchyroll/blob/9bf2eb644f0d0f3e9dc21b95b8e355c6e2050178/crunchyroll/apis/android_manga.py#L107-L161
4,269
abalkin/tz
pavement.py
doc_open
def doc_open(): """Build the HTML docs and open them in a web browser.""" doc_index = os.path.join(DOCS_DIRECTORY, 'build', 'html', 'index.html') if sys.platform == 'darwin': # Mac OS X subprocess.check_call(['open', doc_index]) elif sys.platform == 'win32': # Windows sub...
python
def doc_open(): """Build the HTML docs and open them in a web browser.""" doc_index = os.path.join(DOCS_DIRECTORY, 'build', 'html', 'index.html') if sys.platform == 'darwin': # Mac OS X subprocess.check_call(['open', doc_index]) elif sys.platform == 'win32': # Windows sub...
['def', 'doc_open', '(', ')', ':', 'doc_index', '=', 'os', '.', 'path', '.', 'join', '(', 'DOCS_DIRECTORY', ',', "'build'", ',', "'html'", ',', "'index.html'", ')', 'if', 'sys', '.', 'platform', '==', "'darwin'", ':', '# Mac OS X', 'subprocess', '.', 'check_call', '(', '[', "'open'", ',', 'doc_index', ']', ')', 'elif',...
Build the HTML docs and open them in a web browser.
['Build', 'the', 'HTML', 'docs', 'and', 'open', 'them', 'in', 'a', 'web', 'browser', '.']
train
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/pavement.py#L219-L234
4,270
CSchoel/nolds
nolds/measures.py
lyap_e_len
def lyap_e_len(**kwargs): """ Helper function that calculates the minimum number of data points required to use lyap_e. Note that none of the required parameters may be set to None. Kwargs: kwargs(dict): arguments used for lyap_e (required: emb_dim, matrix_dim, min_nb and min_tsep) Return...
python
def lyap_e_len(**kwargs): """ Helper function that calculates the minimum number of data points required to use lyap_e. Note that none of the required parameters may be set to None. Kwargs: kwargs(dict): arguments used for lyap_e (required: emb_dim, matrix_dim, min_nb and min_tsep) Return...
['def', 'lyap_e_len', '(', '*', '*', 'kwargs', ')', ':', 'm', '=', '(', 'kwargs', '[', "'emb_dim'", ']', '-', '1', ')', '//', '(', 'kwargs', '[', "'matrix_dim'", ']', '-', '1', ')', '# minimum length required to find single orbit vector', 'min_len', '=', 'kwargs', '[', "'emb_dim'", ']', '# we need to follow each starti...
Helper function that calculates the minimum number of data points required to use lyap_e. Note that none of the required parameters may be set to None. Kwargs: kwargs(dict): arguments used for lyap_e (required: emb_dim, matrix_dim, min_nb and min_tsep) Returns: minimum number of data poin...
['Helper', 'function', 'that', 'calculates', 'the', 'minimum', 'number', 'of', 'data', 'points', 'required', 'to', 'use', 'lyap_e', '.']
train
https://github.com/CSchoel/nolds/blob/8a5ecc472d67ac08b571bd68967287668ca9058e/nolds/measures.py#L345-L370
4,271
ronhanson/python-tbx
tbx/file.py
readlinkabs
def readlinkabs(l): """ Return an absolute path for the destination of a symlink """ assert (os.path.islink(l)) p = os.readlink(l) if os.path.isabs(p): return os.path.abspath(p) return os.path.abspath(os.path.join(os.path.dirname(l), p))
python
def readlinkabs(l): """ Return an absolute path for the destination of a symlink """ assert (os.path.islink(l)) p = os.readlink(l) if os.path.isabs(p): return os.path.abspath(p) return os.path.abspath(os.path.join(os.path.dirname(l), p))
['def', 'readlinkabs', '(', 'l', ')', ':', 'assert', '(', 'os', '.', 'path', '.', 'islink', '(', 'l', ')', ')', 'p', '=', 'os', '.', 'readlink', '(', 'l', ')', 'if', 'os', '.', 'path', '.', 'isabs', '(', 'p', ')', ':', 'return', 'os', '.', 'path', '.', 'abspath', '(', 'p', ')', 'return', 'os', '.', 'path', '.', 'abspat...
Return an absolute path for the destination of a symlink
['Return', 'an', 'absolute', 'path', 'for', 'the', 'destination', 'of', 'a', 'symlink']
train
https://github.com/ronhanson/python-tbx/blob/87f72ae0cadecafbcd144f1e930181fba77f6b83/tbx/file.py#L68-L77
4,272
kakwa/ldapcherry
ldapcherry/__init__.py
LdapCherry.login
def login(self, login, password, url=None): """login page """ auth = self._auth(login, password) cherrypy.session['isadmin'] = auth['isadmin'] cherrypy.session['connected'] = auth['connected'] if auth['connected']: if auth['isadmin']: message ...
python
def login(self, login, password, url=None): """login page """ auth = self._auth(login, password) cherrypy.session['isadmin'] = auth['isadmin'] cherrypy.session['connected'] = auth['connected'] if auth['connected']: if auth['isadmin']: message ...
['def', 'login', '(', 'self', ',', 'login', ',', 'password', ',', 'url', '=', 'None', ')', ':', 'auth', '=', 'self', '.', '_auth', '(', 'login', ',', 'password', ')', 'cherrypy', '.', 'session', '[', "'isadmin'", ']', '=', 'auth', '[', "'isadmin'", ']', 'cherrypy', '.', 'session', '[', "'connected'", ']', '=', 'auth', ...
login page
['login', 'page']
train
https://github.com/kakwa/ldapcherry/blob/b5e7cb6a44065abc30d164e72981b3713a172dda/ldapcherry/__init__.py#L891-L931
4,273
swisscom/cleanerversion
versions/models.py
VersionedQuerySet.querytime
def querytime(self, value): """ Sets self._querytime as well as self.query.querytime. :param value: None or datetime :return: """ self._querytime = value self.query.querytime = value
python
def querytime(self, value): """ Sets self._querytime as well as self.query.querytime. :param value: None or datetime :return: """ self._querytime = value self.query.querytime = value
['def', 'querytime', '(', 'self', ',', 'value', ')', ':', 'self', '.', '_querytime', '=', 'value', 'self', '.', 'query', '.', 'querytime', '=', 'value']
Sets self._querytime as well as self.query.querytime. :param value: None or datetime :return:
['Sets', 'self', '.', '_querytime', 'as', 'well', 'as', 'self', '.', 'query', '.', 'querytime', '.', ':', 'param', 'value', ':', 'None', 'or', 'datetime', ':', 'return', ':']
train
https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/models.py#L475-L482
4,274
mikedh/trimesh
trimesh/voxel.py
local_voxelize
def local_voxelize(mesh, point, pitch, radius, fill=True, **kwargs): """ Voxelize a mesh in the region of a cube around a point. When fill=True, uses proximity.contains to fill the resulting voxels so may be meaningless for non-watertight meshes. Useful to reduce memory cost for small values of pitc...
python
def local_voxelize(mesh, point, pitch, radius, fill=True, **kwargs): """ Voxelize a mesh in the region of a cube around a point. When fill=True, uses proximity.contains to fill the resulting voxels so may be meaningless for non-watertight meshes. Useful to reduce memory cost for small values of pitc...
['def', 'local_voxelize', '(', 'mesh', ',', 'point', ',', 'pitch', ',', 'radius', ',', 'fill', '=', 'True', ',', '*', '*', 'kwargs', ')', ':', 'from', 'scipy', 'import', 'ndimage', '# make sure point is correct type/shape', 'point', '=', 'np', '.', 'asanyarray', '(', 'point', ',', 'dtype', '=', 'np', '.', 'float64', ')...
Voxelize a mesh in the region of a cube around a point. When fill=True, uses proximity.contains to fill the resulting voxels so may be meaningless for non-watertight meshes. Useful to reduce memory cost for small values of pitch as opposed to global voxelization. Parameters ----------- mesh : t...
['Voxelize', 'a', 'mesh', 'in', 'the', 'region', 'of', 'a', 'cube', 'around', 'a', 'point', '.', 'When', 'fill', '=', 'True', 'uses', 'proximity', '.', 'contains', 'to', 'fill', 'the', 'resulting', 'voxels', 'so', 'may', 'be', 'meaningless', 'for', 'non', '-', 'watertight', 'meshes', '.', 'Useful', 'to', 'reduce', 'mem...
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/voxel.py#L425-L513
4,275
NicolasLM/spinach
spinach/brokers/redis.py
RedisBroker.get_jobs_from_queue
def get_jobs_from_queue(self, queue: str, max_jobs: int) -> List[Job]: """Get jobs from a queue.""" jobs_json_string = self._run_script( self._get_jobs_from_queue, self._to_namespaced(queue), self._to_namespaced(RUNNING_JOBS_KEY.format(self._id)), JobStatu...
python
def get_jobs_from_queue(self, queue: str, max_jobs: int) -> List[Job]: """Get jobs from a queue.""" jobs_json_string = self._run_script( self._get_jobs_from_queue, self._to_namespaced(queue), self._to_namespaced(RUNNING_JOBS_KEY.format(self._id)), JobStatu...
['def', 'get_jobs_from_queue', '(', 'self', ',', 'queue', ':', 'str', ',', 'max_jobs', ':', 'int', ')', '->', 'List', '[', 'Job', ']', ':', 'jobs_json_string', '=', 'self', '.', '_run_script', '(', 'self', '.', '_get_jobs_from_queue', ',', 'self', '.', '_to_namespaced', '(', 'queue', ')', ',', 'self', '.', '_to_namespa...
Get jobs from a queue.
['Get', 'jobs', 'from', 'a', 'queue', '.']
train
https://github.com/NicolasLM/spinach/blob/0122f916643101eab5cdc1f3da662b9446e372aa/spinach/brokers/redis.py#L145-L158
4,276
saltstack/salt
salt/modules/xapi_virt.py
get_macs
def get_macs(vm_): ''' Return a list off MAC addresses from the named vm CLI Example: .. code-block:: bash salt '*' virt.get_macs <vm name> ''' macs = [] nics = get_nics(vm_) if nics is None: return None for nic in nics: macs.append(nic) return macs
python
def get_macs(vm_): ''' Return a list off MAC addresses from the named vm CLI Example: .. code-block:: bash salt '*' virt.get_macs <vm name> ''' macs = [] nics = get_nics(vm_) if nics is None: return None for nic in nics: macs.append(nic) return macs
['def', 'get_macs', '(', 'vm_', ')', ':', 'macs', '=', '[', ']', 'nics', '=', 'get_nics', '(', 'vm_', ')', 'if', 'nics', 'is', 'None', ':', 'return', 'None', 'for', 'nic', 'in', 'nics', ':', 'macs', '.', 'append', '(', 'nic', ')', 'return', 'macs']
Return a list off MAC addresses from the named vm CLI Example: .. code-block:: bash salt '*' virt.get_macs <vm name>
['Return', 'a', 'list', 'off', 'MAC', 'addresses', 'from', 'the', 'named', 'vm']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L380-L397
4,277
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
Cursor.count
def count(self, with_limit_and_skip=False): """Get the size of the results set for this query. Returns the number of documents in the results set for this query. Does not take :meth:`limit` and :meth:`skip` into account by default - set `with_limit_and_skip` to ``True`` if that is the d...
python
def count(self, with_limit_and_skip=False): """Get the size of the results set for this query. Returns the number of documents in the results set for this query. Does not take :meth:`limit` and :meth:`skip` into account by default - set `with_limit_and_skip` to ``True`` if that is the d...
['def', 'count', '(', 'self', ',', 'with_limit_and_skip', '=', 'False', ')', ':', 'validate_boolean', '(', '"with_limit_and_skip"', ',', 'with_limit_and_skip', ')', 'cmd', '=', 'SON', '(', '[', '(', '"count"', ',', 'self', '.', '__collection', '.', 'name', ')', ',', '(', '"query"', ',', 'self', '.', '__spec', ')', ']',...
Get the size of the results set for this query. Returns the number of documents in the results set for this query. Does not take :meth:`limit` and :meth:`skip` into account by default - set `with_limit_and_skip` to ``True`` if that is the desired behavior. Raises :class:`~pymongo.errors...
['Get', 'the', 'size', 'of', 'the', 'results', 'set', 'for', 'this', 'query', '.']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L680-L727
4,278
rosenbrockc/fortpy
fortpy/isense/rtupdate.py
ModuleUpdater.update_instance_extent
def update_instance_extent(self, instance, module, operation): """Updates a new instance that was added to a module to be complete if the end token is present in any remaining, overlapping operations. """ #Essentially, we want to look in the rest of the statements that are #part ...
python
def update_instance_extent(self, instance, module, operation): """Updates a new instance that was added to a module to be complete if the end token is present in any remaining, overlapping operations. """ #Essentially, we want to look in the rest of the statements that are #part ...
['def', 'update_instance_extent', '(', 'self', ',', 'instance', ',', 'module', ',', 'operation', ')', ':', '#Essentially, we want to look in the rest of the statements that are', '#part of the current operation to see how many more of them pertain ', '#to the new instance that was added.', '#New signatures only result ...
Updates a new instance that was added to a module to be complete if the end token is present in any remaining, overlapping operations.
['Updates', 'a', 'new', 'instance', 'that', 'was', 'added', 'to', 'a', 'module', 'to', 'be', 'complete', 'if', 'the', 'end', 'token', 'is', 'present', 'in', 'any', 'remaining', 'overlapping', 'operations', '.']
train
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/rtupdate.py#L586-L627
4,279
jahuth/litus
spikes.py
SpikeContainer.temporal_firing_rate
def temporal_firing_rate(self,time_dimension=0,resolution=1.0,units=None, min_t=None,max_t=None,weight_function=None,normalize_time=False, normalize_n=False,start_units_with_0=True,cell_dimension='N'): """ Outputs a time histogram of spikes. ...
python
def temporal_firing_rate(self,time_dimension=0,resolution=1.0,units=None, min_t=None,max_t=None,weight_function=None,normalize_time=False, normalize_n=False,start_units_with_0=True,cell_dimension='N'): """ Outputs a time histogram of spikes. ...
['def', 'temporal_firing_rate', '(', 'self', ',', 'time_dimension', '=', '0', ',', 'resolution', '=', '1.0', ',', 'units', '=', 'None', ',', 'min_t', '=', 'None', ',', 'max_t', '=', 'None', ',', 'weight_function', '=', 'None', ',', 'normalize_time', '=', 'False', ',', 'normalize_n', '=', 'False', ',', 'start_units_with...
Outputs a time histogram of spikes. `bins`: number of bins (default is 1ms bins from 0 to t_max) `weight_function`: if set, computes a weighted histogram, dependent on the (index, time) tuples of each spike weight_function = lambda x: weight_map.flatten()[array(x[:,0],dtype...
['Outputs', 'a', 'time', 'histogram', 'of', 'spikes', '.']
train
https://github.com/jahuth/litus/blob/712b016ea2dbb1cf0a30bfdbb0a136945a7b7c5e/spikes.py#L1201-L1232
4,280
saltstack/salt
salt/netapi/rest_wsgi.py
start
def start(): ''' Start simple_server() ''' from wsgiref.simple_server import make_server # When started outside of salt-api __opts__ will not be injected if '__opts__' not in globals(): globals()['__opts__'] = get_opts() if __virtual__() is False: raise SystemExit(1...
python
def start(): ''' Start simple_server() ''' from wsgiref.simple_server import make_server # When started outside of salt-api __opts__ will not be injected if '__opts__' not in globals(): globals()['__opts__'] = get_opts() if __virtual__() is False: raise SystemExit(1...
['def', 'start', '(', ')', ':', 'from', 'wsgiref', '.', 'simple_server', 'import', 'make_server', '# When started outside of salt-api __opts__ will not be injected', 'if', "'__opts__'", 'not', 'in', 'globals', '(', ')', ':', 'globals', '(', ')', '[', "'__opts__'", ']', '=', 'get_opts', '(', ')', 'if', '__virtual__', '(...
Start simple_server()
['Start', 'simple_server', '()']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_wsgi.py#L308-L329
4,281
HumanCellAtlas/cloud-blobstore
cloud_blobstore/s3.py
S3BlobStore.get_user_metadata
def get_user_metadata( self, bucket: str, key: str ) -> typing.Dict[str, str]: """ Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or suffixes for the metadata keys, they should be stripped befo...
python
def get_user_metadata( self, bucket: str, key: str ) -> typing.Dict[str, str]: """ Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or suffixes for the metadata keys, they should be stripped befo...
['def', 'get_user_metadata', '(', 'self', ',', 'bucket', ':', 'str', ',', 'key', ':', 'str', ')', '->', 'typing', '.', 'Dict', '[', 'str', ',', 'str', ']', ':', 'try', ':', 'response', '=', 'self', '.', 'get_all_metadata', '(', 'bucket', ',', 'key', ')', 'metadata', '=', 'response', '[', "'Metadata'", ']', '.', 'copy',...
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or suffixes for the metadata keys, they should be stripped before being returned. :param bucket: the bucket the object resides in. :param key: the key of the object for which metadata is...
['Retrieves', 'the', 'user', 'metadata', 'for', 'a', 'given', 'object', 'in', 'a', 'given', 'bucket', '.', 'If', 'the', 'platform', 'has', 'any', 'mandatory', 'prefixes', 'or', 'suffixes', 'for', 'the', 'metadata', 'keys', 'they', 'should', 'be', 'stripped', 'before', 'being', 'returned', '.', ':', 'param', 'bucket', '...
train
https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/s3.py#L326-L356
4,282
google/grr
grr/server/grr_response_server/flow.py
StartFlow
def StartFlow(client_id=None, cpu_limit=None, creator=None, flow_args=None, flow_cls=None, network_bytes_limit=None, original_flow=None, output_plugins=None, start_at=None, parent_flow_obj=None,...
python
def StartFlow(client_id=None, cpu_limit=None, creator=None, flow_args=None, flow_cls=None, network_bytes_limit=None, original_flow=None, output_plugins=None, start_at=None, parent_flow_obj=None,...
['def', 'StartFlow', '(', 'client_id', '=', 'None', ',', 'cpu_limit', '=', 'None', ',', 'creator', '=', 'None', ',', 'flow_args', '=', 'None', ',', 'flow_cls', '=', 'None', ',', 'network_bytes_limit', '=', 'None', ',', 'original_flow', '=', 'None', ',', 'output_plugins', '=', 'None', ',', 'start_at', '=', 'None', ',', ...
The main factory function for creating and executing a new flow. Args: client_id: ID of the client this flow should run on. cpu_limit: CPU limit in seconds for this flow. creator: Username that requested this flow. flow_args: An arg protocol buffer which is an instance of the required flow's ar...
['The', 'main', 'factory', 'function', 'for', 'creating', 'and', 'executing', 'a', 'new', 'flow', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow.py#L338-L508
4,283
mon/ifstools
ifstools/handlers/TexFolder.py
ImageCanvas.load
def load(self, draw_bbox = False, **kwargs): ''' Makes the canvas. This could be far speedier if it copied raw pixels, but that would take far too much time to write vs using Image inbuilts ''' im = Image.new('RGBA', self.img_size) draw = None if draw_bbox: ...
python
def load(self, draw_bbox = False, **kwargs): ''' Makes the canvas. This could be far speedier if it copied raw pixels, but that would take far too much time to write vs using Image inbuilts ''' im = Image.new('RGBA', self.img_size) draw = None if draw_bbox: ...
['def', 'load', '(', 'self', ',', 'draw_bbox', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'im', '=', 'Image', '.', 'new', '(', "'RGBA'", ',', 'self', '.', 'img_size', ')', 'draw', '=', 'None', 'if', 'draw_bbox', ':', 'draw', '=', 'ImageDraw', '.', 'Draw', '(', 'im', ')', 'for', 'sprite', 'in', 'self', '.', 'image...
Makes the canvas. This could be far speedier if it copied raw pixels, but that would take far too much time to write vs using Image inbuilts
['Makes', 'the', 'canvas', '.', 'This', 'could', 'be', 'far', 'speedier', 'if', 'it', 'copied', 'raw', 'pixels', 'but', 'that', 'would', 'take', 'far', 'too', 'much', 'time', 'to', 'write', 'vs', 'using', 'Image', 'inbuilts']
train
https://github.com/mon/ifstools/blob/ccd9c1c3632aa22cdcc4e064f17e07803b1d27ba/ifstools/handlers/TexFolder.py#L35-L56
4,284
anomaly/prestans
prestans/rest/request.py
Request.body_template
def body_template(self, value): """ Must be an instance of a prestans.types.DataCollection subclass; this is generally set during the RequestHandler lifecycle. Setting this spwans the parsing process of the body. If the HTTP verb is GET an AssertionError is thrown. Use with extre...
python
def body_template(self, value): """ Must be an instance of a prestans.types.DataCollection subclass; this is generally set during the RequestHandler lifecycle. Setting this spwans the parsing process of the body. If the HTTP verb is GET an AssertionError is thrown. Use with extre...
['def', 'body_template', '(', 'self', ',', 'value', ')', ':', 'if', 'self', '.', 'method', '==', 'VERB', '.', 'GET', ':', 'raise', 'AssertionError', '(', '"body_template cannot be set for GET requests"', ')', 'if', 'value', 'is', 'None', ':', 'self', '.', 'logger', '.', 'warning', '(', '"body_template is None, parsing ...
Must be an instance of a prestans.types.DataCollection subclass; this is generally set during the RequestHandler lifecycle. Setting this spwans the parsing process of the body. If the HTTP verb is GET an AssertionError is thrown. Use with extreme caution.
['Must', 'be', 'an', 'instance', 'of', 'a', 'prestans', '.', 'types', '.', 'DataCollection', 'subclass', ';', 'this', 'is', 'generally', 'set', 'during', 'the', 'RequestHandler', 'lifecycle', '.', 'Setting', 'this', 'spwans', 'the', 'parsing', 'process', 'of', 'the', 'body', '.', 'If', 'the', 'HTTP', 'verb', 'is', 'GET...
train
https://github.com/anomaly/prestans/blob/13f5b2467bfd403dcd2d085f15cbf4644044f105/prestans/rest/request.py#L116-L142
4,285
gccxml/pygccxml
pygccxml/declarations/pattern_parser.py
parser_t.find_args
def find_args(self, text, start=None): """implementation details""" if start is None: start = 0 first_occurance = text.find(self.__begin, start) if first_occurance == -1: return self.NOT_FOUND previous_found, found = first_occurance + 1, 0 while Tr...
python
def find_args(self, text, start=None): """implementation details""" if start is None: start = 0 first_occurance = text.find(self.__begin, start) if first_occurance == -1: return self.NOT_FOUND previous_found, found = first_occurance + 1, 0 while Tr...
['def', 'find_args', '(', 'self', ',', 'text', ',', 'start', '=', 'None', ')', ':', 'if', 'start', 'is', 'None', ':', 'start', '=', '0', 'first_occurance', '=', 'text', '.', 'find', '(', 'self', '.', '__begin', ',', 'start', ')', 'if', 'first_occurance', '==', '-', '1', ':', 'return', 'self', '.', 'NOT_FOUND', 'previou...
implementation details
['implementation', 'details']
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/pattern_parser.py#L155-L170
4,286
pyokagan/pyglreg
glreg.py
Registry.get_supports
def get_supports(self): """Returns set of extension support strings referenced in this Registry :return: set of extension support strings """ out = set() for ext in self.extensions.values(): out.update(ext.get_supports()) return out
python
def get_supports(self): """Returns set of extension support strings referenced in this Registry :return: set of extension support strings """ out = set() for ext in self.extensions.values(): out.update(ext.get_supports()) return out
['def', 'get_supports', '(', 'self', ')', ':', 'out', '=', 'set', '(', ')', 'for', 'ext', 'in', 'self', '.', 'extensions', '.', 'values', '(', ')', ':', 'out', '.', 'update', '(', 'ext', '.', 'get_supports', '(', ')', ')', 'return', 'out']
Returns set of extension support strings referenced in this Registry :return: set of extension support strings
['Returns', 'set', 'of', 'extension', 'support', 'strings', 'referenced', 'in', 'this', 'Registry']
train
https://github.com/pyokagan/pyglreg/blob/68fa5a6c6cee8667879840fbbcc7d30f52852915/glreg.py#L592-L600
4,287
saltstack/salt
salt/modules/boto_iot.py
create_topic_rule
def create_topic_rule(ruleName, sql, actions, description, ruleDisabled=False, region=None, key=None, keyid=None, profile=None): ''' Given a valid config, create a topic rule. Returns {created: true} if the rule was created and returns {created: False} if the rule was not create...
python
def create_topic_rule(ruleName, sql, actions, description, ruleDisabled=False, region=None, key=None, keyid=None, profile=None): ''' Given a valid config, create a topic rule. Returns {created: true} if the rule was created and returns {created: False} if the rule was not create...
['def', 'create_topic_rule', '(', 'ruleName', ',', 'sql', ',', 'actions', ',', 'description', ',', 'ruleDisabled', '=', 'False', ',', 'region', '=', 'None', ',', 'key', '=', 'None', ',', 'keyid', '=', 'None', ',', 'profile', '=', 'None', ')', ':', 'try', ':', 'conn', '=', '_get_conn', '(', 'region', '=', 'region', ',',...
Given a valid config, create a topic rule. Returns {created: true} if the rule was created and returns {created: False} if the rule was not created. CLI Example: .. code-block:: bash salt myminion boto_iot.create_topic_rule my_rule "SELECT * FROM 'some/thing'" \\ '[{"lambda":{"fu...
['Given', 'a', 'valid', 'config', 'create', 'a', 'topic', 'rule', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iot.py#L726-L756
4,288
kristianfoerster/melodist
melodist/precipitation.py
aggregate_precipitation
def aggregate_precipitation(vec_data,hourly=True, percentile=50): """Aggregates highly resolved precipitation data and creates statistics Parameters ---------- vec_data : pd.Series hourly (hourly=True) OR 5-min values Returns ------- output : cascade object representing st...
python
def aggregate_precipitation(vec_data,hourly=True, percentile=50): """Aggregates highly resolved precipitation data and creates statistics Parameters ---------- vec_data : pd.Series hourly (hourly=True) OR 5-min values Returns ------- output : cascade object representing st...
['def', 'aggregate_precipitation', '(', 'vec_data', ',', 'hourly', '=', 'True', ',', 'percentile', '=', '50', ')', ':', 'cascade_opt', '=', 'cascade', '.', 'CascadeStatistics', '(', ')', 'cascade_opt', '.', 'percentile', '=', 'percentile', '# length of input time series', 'n_in', '=', 'len', '(', 'vec_data', ')', 'n_ou...
Aggregates highly resolved precipitation data and creates statistics Parameters ---------- vec_data : pd.Series hourly (hourly=True) OR 5-min values Returns ------- output : cascade object representing statistics of the cascade model
['Aggregates', 'highly', 'resolved', 'precipitation', 'data', 'and', 'creates', 'statistics']
train
https://github.com/kristianfoerster/melodist/blob/ddc155c77b65f791be0021dbbaf68c6bac42ecbd/melodist/precipitation.py#L403-L586
4,289
androguard/androguard
androguard/decompiler/dad/util.py
build_path
def build_path(graph, node1, node2, path=None): """ Build the path from node1 to node2. The path is composed of all the nodes between node1 and node2, node1 excluded. Although if there is a loop starting from node1, it will be included in the path. """ if path is None: path = [] ...
python
def build_path(graph, node1, node2, path=None): """ Build the path from node1 to node2. The path is composed of all the nodes between node1 and node2, node1 excluded. Although if there is a loop starting from node1, it will be included in the path. """ if path is None: path = [] ...
['def', 'build_path', '(', 'graph', ',', 'node1', ',', 'node2', ',', 'path', '=', 'None', ')', ':', 'if', 'path', 'is', 'None', ':', 'path', '=', '[', ']', 'if', 'node1', 'is', 'node2', ':', 'return', 'path', 'path', '.', 'append', '(', 'node2', ')', 'for', 'pred', 'in', 'graph', '.', 'all_preds', '(', 'node2', ')', ':...
Build the path from node1 to node2. The path is composed of all the nodes between node1 and node2, node1 excluded. Although if there is a loop starting from node1, it will be included in the path.
['Build', 'the', 'path', 'from', 'node1', 'to', 'node2', '.', 'The', 'path', 'is', 'composed', 'of', 'all', 'the', 'nodes', 'between', 'node1', 'and', 'node2', 'node1', 'excluded', '.', 'Although', 'if', 'there', 'is', 'a', 'loop', 'starting', 'from', 'node1', 'it', 'will', 'be', 'included', 'in', 'the', 'path', '.']
train
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/decompiler/dad/util.py#L100-L116
4,290
odlgroup/odl
odl/space/base_tensors.py
TensorSpace.complex_space
def complex_space(self): """The space corresponding to this space's `complex_dtype`. Raises ------ ValueError If `dtype` is not a numeric data type. """ if not is_numeric_dtype(self.dtype): raise ValueError( '`complex_space` not de...
python
def complex_space(self): """The space corresponding to this space's `complex_dtype`. Raises ------ ValueError If `dtype` is not a numeric data type. """ if not is_numeric_dtype(self.dtype): raise ValueError( '`complex_space` not de...
['def', 'complex_space', '(', 'self', ')', ':', 'if', 'not', 'is_numeric_dtype', '(', 'self', '.', 'dtype', ')', ':', 'raise', 'ValueError', '(', "'`complex_space` not defined for non-numeric `dtype`'", ')', 'return', 'self', '.', 'astype', '(', 'self', '.', 'complex_dtype', ')']
The space corresponding to this space's `complex_dtype`. Raises ------ ValueError If `dtype` is not a numeric data type.
['The', 'space', 'corresponding', 'to', 'this', 'space', 's', 'complex_dtype', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/space/base_tensors.py#L193-L204
4,291
JarryShaw/PyPCAPKit
src/protocols/internet/ipv6_route.py
IPv6_Route._read_data_type_none
def _read_data_type_none(self, length): """Read IPv6-Route unknown type data. Structure of IPv6-Route unknown type data [RFC 8200][RFC 5095]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | ...
python
def _read_data_type_none(self, length): """Read IPv6-Route unknown type data. Structure of IPv6-Route unknown type data [RFC 8200][RFC 5095]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | ...
['def', '_read_data_type_none', '(', 'self', ',', 'length', ')', ':', '_data', '=', 'self', '.', '_read_fileng', '(', 'length', ')', 'data', '=', 'dict', '(', 'data', '=', '_data', ',', ')', 'return', 'data']
Read IPv6-Route unknown type data. Structure of IPv6-Route unknown type data [RFC 8200][RFC 5095]: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next Header | Hdr Ext Len | Routing Type | Segments Left | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
['Read', 'IPv6', '-', 'Route', 'unknown', 'type', 'data', '.']
train
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/internet/ipv6_route.py#L169-L197
4,292
adamrehn/ue4cli
ue4cli/Utility.py
Utility.join
def join(delim, items, quotes=False): """ Joins the supplied list of strings after removing any empty strings from the list """ transform = lambda s: s if quotes == True: transform = lambda s: s if ' ' not in s else '"{}"'.format(s) stripped = list([transform(i) for i in items if len(i) > 0]) if len...
python
def join(delim, items, quotes=False): """ Joins the supplied list of strings after removing any empty strings from the list """ transform = lambda s: s if quotes == True: transform = lambda s: s if ' ' not in s else '"{}"'.format(s) stripped = list([transform(i) for i in items if len(i) > 0]) if len...
['def', 'join', '(', 'delim', ',', 'items', ',', 'quotes', '=', 'False', ')', ':', 'transform', '=', 'lambda', 's', ':', 's', 'if', 'quotes', '==', 'True', ':', 'transform', '=', 'lambda', 's', ':', 's', 'if', "' '", 'not', 'in', 's', 'else', '\'"{}"\'', '.', 'format', '(', 's', ')', 'stripped', '=', 'list', '(', '[', ...
Joins the supplied list of strings after removing any empty strings from the list
['Joins', 'the', 'supplied', 'list', 'of', 'strings', 'after', 'removing', 'any', 'empty', 'strings', 'from', 'the', 'list']
train
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/Utility.py#L72-L83
4,293
googleapis/google-cloud-python
storage/google/cloud/storage/_helpers.py
_scalar_property
def _scalar_property(fieldname): """Create a property descriptor around the :class:`_PropertyMixin` helpers. """ def _getter(self): """Scalar property getter.""" return self._properties.get(fieldname) def _setter(self, value): """Scalar property setter.""" self._patch_p...
python
def _scalar_property(fieldname): """Create a property descriptor around the :class:`_PropertyMixin` helpers. """ def _getter(self): """Scalar property getter.""" return self._properties.get(fieldname) def _setter(self, value): """Scalar property setter.""" self._patch_p...
['def', '_scalar_property', '(', 'fieldname', ')', ':', 'def', '_getter', '(', 'self', ')', ':', '"""Scalar property getter."""', 'return', 'self', '.', '_properties', '.', 'get', '(', 'fieldname', ')', 'def', '_setter', '(', 'self', ',', 'value', ')', ':', '"""Scalar property setter."""', 'self', '.', '_patch_property...
Create a property descriptor around the :class:`_PropertyMixin` helpers.
['Create', 'a', 'property', 'descriptor', 'around', 'the', ':', 'class', ':', '_PropertyMixin', 'helpers', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/_helpers.py#L216-L228
4,294
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/reftrackwidget.py
OptionSelector.setup_ui
def setup_ui(self, ): """Setup the ui :returns: None :rtype: None :raises: None """ labels = self.reftrack.get_option_labels() self.browser = ComboBoxBrowser(len(labels), headers=labels) self.browser_vbox.addWidget(self.browser)
python
def setup_ui(self, ): """Setup the ui :returns: None :rtype: None :raises: None """ labels = self.reftrack.get_option_labels() self.browser = ComboBoxBrowser(len(labels), headers=labels) self.browser_vbox.addWidget(self.browser)
['def', 'setup_ui', '(', 'self', ',', ')', ':', 'labels', '=', 'self', '.', 'reftrack', '.', 'get_option_labels', '(', ')', 'self', '.', 'browser', '=', 'ComboBoxBrowser', '(', 'len', '(', 'labels', ')', ',', 'headers', '=', 'labels', ')', 'self', '.', 'browser_vbox', '.', 'addWidget', '(', 'self', '.', 'browser', ')']
Setup the ui :returns: None :rtype: None :raises: None
['Setup', 'the', 'ui']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/reftrackwidget.py#L39-L48
4,295
nornir-automation/nornir
nornir/plugins/tasks/networking/napalm_cli.py
napalm_cli
def napalm_cli(task: Task, commands: List[str]) -> Result: """ Run commands on remote devices using napalm Arguments: commands: commands to execute Returns: Result object with the following attributes set: * result (``dict``): result of the commands execution """ devi...
python
def napalm_cli(task: Task, commands: List[str]) -> Result: """ Run commands on remote devices using napalm Arguments: commands: commands to execute Returns: Result object with the following attributes set: * result (``dict``): result of the commands execution """ devi...
['def', 'napalm_cli', '(', 'task', ':', 'Task', ',', 'commands', ':', 'List', '[', 'str', ']', ')', '->', 'Result', ':', 'device', '=', 'task', '.', 'host', '.', 'get_connection', '(', '"napalm"', ',', 'task', '.', 'nornir', '.', 'config', ')', 'result', '=', 'device', '.', 'cli', '(', 'commands', ')', 'return', 'Resul...
Run commands on remote devices using napalm Arguments: commands: commands to execute Returns: Result object with the following attributes set: * result (``dict``): result of the commands execution
['Run', 'commands', 'on', 'remote', 'devices', 'using', 'napalm']
train
https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/napalm_cli.py#L6-L19
4,296
google/apitools
apitools/base/py/base_api.py
BaseApiService.__CombineGlobalParams
def __CombineGlobalParams(self, global_params, default_params): """Combine the given params with the defaults.""" util.Typecheck(global_params, (type(None), self.__client.params_type)) result = self.__client.params_type() global_params = global_params or self.__client.params_type() ...
python
def __CombineGlobalParams(self, global_params, default_params): """Combine the given params with the defaults.""" util.Typecheck(global_params, (type(None), self.__client.params_type)) result = self.__client.params_type() global_params = global_params or self.__client.params_type() ...
['def', '__CombineGlobalParams', '(', 'self', ',', 'global_params', ',', 'default_params', ')', ':', 'util', '.', 'Typecheck', '(', 'global_params', ',', '(', 'type', '(', 'None', ')', ',', 'self', '.', '__client', '.', 'params_type', ')', ')', 'result', '=', 'self', '.', '__client', '.', 'params_type', '(', ')', 'glob...
Combine the given params with the defaults.
['Combine', 'the', 'given', 'params', 'with', 'the', 'defaults', '.']
train
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/py/base_api.py#L511-L522
4,297
romanz/trezor-agent
libagent/gpg/keyring.py
gpg_version
def gpg_version(sp=subprocess): """Get a keygrip of the primary GPG key of the specified user.""" args = gpg_command(['--version']) output = check_output(args=args, sp=sp) line = output.split(b'\n')[0] # b'gpg (GnuPG) 2.1.11' line = line.split(b' ')[-1] # b'2.1.11' line = line.split(b'-')[0] ...
python
def gpg_version(sp=subprocess): """Get a keygrip of the primary GPG key of the specified user.""" args = gpg_command(['--version']) output = check_output(args=args, sp=sp) line = output.split(b'\n')[0] # b'gpg (GnuPG) 2.1.11' line = line.split(b' ')[-1] # b'2.1.11' line = line.split(b'-')[0] ...
['def', 'gpg_version', '(', 'sp', '=', 'subprocess', ')', ':', 'args', '=', 'gpg_command', '(', '[', "'--version'", ']', ')', 'output', '=', 'check_output', '(', 'args', '=', 'args', ',', 'sp', '=', 'sp', ')', 'line', '=', 'output', '.', 'split', '(', "b'\\n'", ')', '[', '0', ']', "# b'gpg (GnuPG) 2.1.11'", 'line', '='...
Get a keygrip of the primary GPG key of the specified user.
['Get', 'a', 'keygrip', 'of', 'the', 'primary', 'GPG', 'key', 'of', 'the', 'specified', 'user', '.']
train
https://github.com/romanz/trezor-agent/blob/513b1259c4d7aca5f88cd958edc11828d0712f1b/libagent/gpg/keyring.py#L223-L230
4,298
grauwoelfchen/flask-dotenv
flask_dotenv.py
DotEnv.init_app
def init_app(self, app, env_file=None, verbose_mode=False): """Imports .env file.""" if self.app is None: self.app = app self.verbose_mode = verbose_mode if env_file is None: env_file = os.path.join(os.getcwd(), ".env") if not os.path.exists(env_file): ...
python
def init_app(self, app, env_file=None, verbose_mode=False): """Imports .env file.""" if self.app is None: self.app = app self.verbose_mode = verbose_mode if env_file is None: env_file = os.path.join(os.getcwd(), ".env") if not os.path.exists(env_file): ...
['def', 'init_app', '(', 'self', ',', 'app', ',', 'env_file', '=', 'None', ',', 'verbose_mode', '=', 'False', ')', ':', 'if', 'self', '.', 'app', 'is', 'None', ':', 'self', '.', 'app', '=', 'app', 'self', '.', 'verbose_mode', '=', 'verbose_mode', 'if', 'env_file', 'is', 'None', ':', 'env_file', '=', 'os', '.', 'path', ...
Imports .env file.
['Imports', '.', 'env', 'file', '.']
train
https://github.com/grauwoelfchen/flask-dotenv/blob/7dc811fff18570c4b6803ce48c3ecca7eebabe51/flask_dotenv.py#L24-L35
4,299
apple/turicreate
src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py
_ColumnFunctionTransformation._load_version
def _load_version(cls, unpickler, version): """ A function to load a previously saved SentenceSplitter instance. Parameters ---------- unpickler : GLUnpickler A GLUnpickler file handler. version : int Version number maintained by the class writer...
python
def _load_version(cls, unpickler, version): """ A function to load a previously saved SentenceSplitter instance. Parameters ---------- unpickler : GLUnpickler A GLUnpickler file handler. version : int Version number maintained by the class writer...
['def', '_load_version', '(', 'cls', ',', 'unpickler', ',', 'version', ')', ':', 'state', ',', '_exclude', ',', '_features', '=', 'unpickler', '.', 'load', '(', ')', 'features', '=', 'state', '[', "'features'", ']', 'excluded_features', '=', 'state', '[', "'excluded_features'", ']', 'model', '=', 'cls', '.', '__new__',...
A function to load a previously saved SentenceSplitter instance. Parameters ---------- unpickler : GLUnpickler A GLUnpickler file handler. version : int Version number maintained by the class writer.
['A', 'function', 'to', 'load', 'a', 'previously', 'saved', 'SentenceSplitter', 'instance', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L72-L95