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
5,800
zapier/email-reply-parser
email_reply_parser/__init__.py
EmailMessage._finish_fragment
def _finish_fragment(self): """ Creates fragment """ if self.fragment: self.fragment.finish() if self.fragment.headers: # Regardless of what's been seen to this point, if we encounter a headers fragment, # all the previous fragments should...
python
def _finish_fragment(self): """ Creates fragment """ if self.fragment: self.fragment.finish() if self.fragment.headers: # Regardless of what's been seen to this point, if we encounter a headers fragment, # all the previous fragments should...
['def', '_finish_fragment', '(', 'self', ')', ':', 'if', 'self', '.', 'fragment', ':', 'self', '.', 'fragment', '.', 'finish', '(', ')', 'if', 'self', '.', 'fragment', '.', 'headers', ':', "# Regardless of what's been seen to this point, if we encounter a headers fragment,", '# all the previous fragments should be mark...
Creates fragment
['Creates', 'fragment']
train
https://github.com/zapier/email-reply-parser/blob/0c0b73a9bf2188b079a191417b273fc2cf695bf2/email_reply_parser/__init__.py#L124-L146
5,801
saltstack/salt
salt/states/pbm.py
default_vsan_policy_configured
def default_vsan_policy_configured(name, policy): ''' Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter. policy Dict representation of a policy ''' # TODO Refactor when recurse_differ supports list_differ # It's goi...
python
def default_vsan_policy_configured(name, policy): ''' Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter. policy Dict representation of a policy ''' # TODO Refactor when recurse_differ supports list_differ # It's goi...
['def', 'default_vsan_policy_configured', '(', 'name', ',', 'policy', ')', ':', '# TODO Refactor when recurse_differ supports list_differ', "# It's going to make the whole thing much easier", 'policy_copy', '=', 'copy', '.', 'deepcopy', '(', 'policy', ')', 'proxy_type', '=', '__salt__', '[', "'vsphere.get_proxy_type'",...
Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter. policy Dict representation of a policy
['Configures', 'the', 'default', 'VSAN', 'policy', 'on', 'a', 'vCenter', '.', 'The', 'state', 'assumes', 'there', 'is', 'only', 'one', 'default', 'VSAN', 'policy', 'on', 'a', 'vCenter', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pbm.py#L138-L275
5,802
jdodds/feather
feather/dispatcher.py
Dispatcher.register
def register(self, plugin): """Add the plugin to our set of listeners for each message that it listens to, tell it to use our messages Queue for communication, and start it up. """ for listener in plugin.listeners: self.listeners[listener].add(plugin) self.plu...
python
def register(self, plugin): """Add the plugin to our set of listeners for each message that it listens to, tell it to use our messages Queue for communication, and start it up. """ for listener in plugin.listeners: self.listeners[listener].add(plugin) self.plu...
['def', 'register', '(', 'self', ',', 'plugin', ')', ':', 'for', 'listener', 'in', 'plugin', '.', 'listeners', ':', 'self', '.', 'listeners', '[', 'listener', ']', '.', 'add', '(', 'plugin', ')', 'self', '.', 'plugins', '.', 'add', '(', 'plugin', ')', 'plugin', '.', 'messenger', '=', 'self', '.', 'messages', 'plugin', ...
Add the plugin to our set of listeners for each message that it listens to, tell it to use our messages Queue for communication, and start it up.
['Add', 'the', 'plugin', 'to', 'our', 'set', 'of', 'listeners', 'for', 'each', 'message', 'that', 'it', 'listens', 'to', 'tell', 'it', 'to', 'use', 'our', 'messages', 'Queue', 'for', 'communication', 'and', 'start', 'it', 'up', '.']
train
https://github.com/jdodds/feather/blob/92a9426e692b33c7fddf758df8dbc99a9a1ba8ef/feather/dispatcher.py#L16-L25
5,803
EconForge/dolo
dolo/algos/perturbation.py
perturb
def perturb(model, verbose=False, steady_state=None, eigmax=1.0-1e-6, solve_steady_state=False, order=1, details=True): """Compute first order approximation of optimal controls Parameters: ----------- model: NumericModel Model to be solved verbose: boolean ...
python
def perturb(model, verbose=False, steady_state=None, eigmax=1.0-1e-6, solve_steady_state=False, order=1, details=True): """Compute first order approximation of optimal controls Parameters: ----------- model: NumericModel Model to be solved verbose: boolean ...
['def', 'perturb', '(', 'model', ',', 'verbose', '=', 'False', ',', 'steady_state', '=', 'None', ',', 'eigmax', '=', '1.0', '-', '1e-6', ',', 'solve_steady_state', '=', 'False', ',', 'order', '=', '1', ',', 'details', '=', 'True', ')', ':', 'if', 'order', '>', '1', ':', 'raise', 'Exception', '(', '"Not implemented."', ...
Compute first order approximation of optimal controls Parameters: ----------- model: NumericModel Model to be solved verbose: boolean If True: displays number of contracting eigenvalues steady_state: ndarray Use supplied steady-state value to compute the approximation. ...
['Compute', 'first', 'order', 'approximation', 'of', 'optimal', 'controls']
train
https://github.com/EconForge/dolo/blob/d91ddf148b009bf79852d9aec70f3a1877e0f79a/dolo/algos/perturbation.py#L187-L253
5,804
portantier/habu
habu/lib/delegator.py
Command.send
def send(self, s, end=os.linesep, signal=False): """Sends the given string or signal to std_in.""" if self.blocking: raise RuntimeError('send can only be used on non-blocking commands.') if not signal: if self._uses_subprocess: return self.subprocess.com...
python
def send(self, s, end=os.linesep, signal=False): """Sends the given string or signal to std_in.""" if self.blocking: raise RuntimeError('send can only be used on non-blocking commands.') if not signal: if self._uses_subprocess: return self.subprocess.com...
['def', 'send', '(', 'self', ',', 's', ',', 'end', '=', 'os', '.', 'linesep', ',', 'signal', '=', 'False', ')', ':', 'if', 'self', '.', 'blocking', ':', 'raise', 'RuntimeError', '(', "'send can only be used on non-blocking commands.'", ')', 'if', 'not', 'signal', ':', 'if', 'self', '.', '_uses_subprocess', ':', 'return...
Sends the given string or signal to std_in.
['Sends', 'the', 'given', 'string', 'or', 'signal', 'to', 'std_in', '.']
train
https://github.com/portantier/habu/blob/87091e389dc6332fe1b82830c22b2eefc55816f2/habu/lib/delegator.py#L172-L184
5,805
riga/tfdeploy
tfdeploy.py
Model.add
def add(self, tensor, tf_sess=None, key=None, **kwargs): """ Adds a new root *tensor* for a *key* which, if *None*, defaults to a consecutive number. When *tensor* is not an instance of :py:class:`Tensor` but an instance of ``tensorflow.Tensor``, it is converted first. In that case, *tf_...
python
def add(self, tensor, tf_sess=None, key=None, **kwargs): """ Adds a new root *tensor* for a *key* which, if *None*, defaults to a consecutive number. When *tensor* is not an instance of :py:class:`Tensor` but an instance of ``tensorflow.Tensor``, it is converted first. In that case, *tf_...
['def', 'add', '(', 'self', ',', 'tensor', ',', 'tf_sess', '=', 'None', ',', 'key', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 'isinstance', '(', 'tensor', ',', 'Tensor', ')', ':', 'tensor', '=', 'Tensor', '(', 'tensor', ',', 'tf_sess', ',', '*', '*', 'kwargs', ')', 'if', 'key', 'is', 'None', ':', 'if...
Adds a new root *tensor* for a *key* which, if *None*, defaults to a consecutive number. When *tensor* is not an instance of :py:class:`Tensor` but an instance of ``tensorflow.Tensor``, it is converted first. In that case, *tf_sess* should be a valid tensorflow session and *kwargs* are forwarded...
['Adds', 'a', 'new', 'root', '*', 'tensor', '*', 'for', 'a', '*', 'key', '*', 'which', 'if', '*', 'None', '*', 'defaults', 'to', 'a', 'consecutive', 'number', '.', 'When', '*', 'tensor', '*', 'is', 'not', 'an', 'instance', 'of', ':', 'py', ':', 'class', ':', 'Tensor', 'but', 'an', 'instance', 'of', 'tensorflow', '.', '...
train
https://github.com/riga/tfdeploy/blob/8481f657d6e3a51d76185a195b993e45f448828a/tfdeploy.py#L145-L161
5,806
wummel/linkchecker
linkcheck/log.py
error
def error (logname, msg, *args, **kwargs): """Log an error. return: None """ log = logging.getLogger(logname) if log.isEnabledFor(logging.ERROR): _log(log.error, msg, args, **kwargs)
python
def error (logname, msg, *args, **kwargs): """Log an error. return: None """ log = logging.getLogger(logname) if log.isEnabledFor(logging.ERROR): _log(log.error, msg, args, **kwargs)
['def', 'error', '(', 'logname', ',', 'msg', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'log', '=', 'logging', '.', 'getLogger', '(', 'logname', ')', 'if', 'log', '.', 'isEnabledFor', '(', 'logging', '.', 'ERROR', ')', ':', '_log', '(', 'log', '.', 'error', ',', 'msg', ',', 'args', ',', '*', '*', 'kwargs', ')...
Log an error. return: None
['Log', 'an', 'error', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/log.py#L108-L115
5,807
tehmaze/ipcalc
ipcalc.py
Network.netmask_long
def netmask_long(self): """ Network netmask derived from subnet size, as long. >>> localnet = Network('127.0.0.1/8') >>> print(localnet.netmask_long()) 4278190080 """ if self.version() == 4: return (MAX_IPV4 >> (32 - self.mask)) << (32 - self.mask) ...
python
def netmask_long(self): """ Network netmask derived from subnet size, as long. >>> localnet = Network('127.0.0.1/8') >>> print(localnet.netmask_long()) 4278190080 """ if self.version() == 4: return (MAX_IPV4 >> (32 - self.mask)) << (32 - self.mask) ...
['def', 'netmask_long', '(', 'self', ')', ':', 'if', 'self', '.', 'version', '(', ')', '==', '4', ':', 'return', '(', 'MAX_IPV4', '>>', '(', '32', '-', 'self', '.', 'mask', ')', ')', '<<', '(', '32', '-', 'self', '.', 'mask', ')', 'else', ':', 'return', '(', 'MAX_IPV6', '>>', '(', '128', '-', 'self', '.', 'mask', ')', ...
Network netmask derived from subnet size, as long. >>> localnet = Network('127.0.0.1/8') >>> print(localnet.netmask_long()) 4278190080
['Network', 'netmask', 'derived', 'from', 'subnet', 'size', 'as', 'long', '.']
train
https://github.com/tehmaze/ipcalc/blob/d436b95d2783347c3e0084d76ec3c52d1f5d2f0b/ipcalc.py#L595-L606
5,808
inonit/drf-haystack
drf_haystack/utils.py
merge_dict
def merge_dict(a, b): """ Recursively merges and returns dict a with dict b. Any list values will be combined and returned sorted. :param a: dictionary object :param b: dictionary object :return: merged dictionary object """ if not isinstance(b, dict): return b result = de...
python
def merge_dict(a, b): """ Recursively merges and returns dict a with dict b. Any list values will be combined and returned sorted. :param a: dictionary object :param b: dictionary object :return: merged dictionary object """ if not isinstance(b, dict): return b result = de...
['def', 'merge_dict', '(', 'a', ',', 'b', ')', ':', 'if', 'not', 'isinstance', '(', 'b', ',', 'dict', ')', ':', 'return', 'b', 'result', '=', 'deepcopy', '(', 'a', ')', 'for', 'key', ',', 'val', 'in', 'six', '.', 'iteritems', '(', 'b', ')', ':', 'if', 'key', 'in', 'result', 'and', 'isinstance', '(', 'result', '[', 'key...
Recursively merges and returns dict a with dict b. Any list values will be combined and returned sorted. :param a: dictionary object :param b: dictionary object :return: merged dictionary object
['Recursively', 'merges', 'and', 'returns', 'dict', 'a', 'with', 'dict', 'b', '.', 'Any', 'list', 'values', 'will', 'be', 'combined', 'and', 'returned', 'sorted', '.']
train
https://github.com/inonit/drf-haystack/blob/ceabd0f6318f129758341ab08292a20205d6f4cd/drf_haystack/utils.py#L9-L31
5,809
textbook/atmdb
atmdb/client.py
TMDbClient._get_popular_people_page
async def _get_popular_people_page(self, page=1): """Get a specific page of popular person data. Arguments: page (:py:class:`int`, optional): The page to get. Returns: :py:class:`dict`: The page data. """ return await self.get_data(self.url_builder( ...
python
async def _get_popular_people_page(self, page=1): """Get a specific page of popular person data. Arguments: page (:py:class:`int`, optional): The page to get. Returns: :py:class:`dict`: The page data. """ return await self.get_data(self.url_builder( ...
['async', 'def', '_get_popular_people_page', '(', 'self', ',', 'page', '=', '1', ')', ':', 'return', 'await', 'self', '.', 'get_data', '(', 'self', '.', 'url_builder', '(', "'person/popular'", ',', 'url_params', '=', 'OrderedDict', '(', 'page', '=', 'page', ')', ',', ')', ')']
Get a specific page of popular person data. Arguments: page (:py:class:`int`, optional): The page to get. Returns: :py:class:`dict`: The page data.
['Get', 'a', 'specific', 'page', 'of', 'popular', 'person', 'data', '.']
train
https://github.com/textbook/atmdb/blob/cab14547d2e777a1e26c2560266365c484855789/atmdb/client.py#L230-L243
5,810
pydata/xarray
xarray/core/dataset.py
Dataset.filter_by_attrs
def filter_by_attrs(self, **kwargs): """Returns a ``Dataset`` with variables that match specific conditions. Can pass in ``key=value`` or ``key=callable``. A Dataset is returned containing only the variables for which all the filter tests pass. These tests are either ``key=value`` for ...
python
def filter_by_attrs(self, **kwargs): """Returns a ``Dataset`` with variables that match specific conditions. Can pass in ``key=value`` or ``key=callable``. A Dataset is returned containing only the variables for which all the filter tests pass. These tests are either ``key=value`` for ...
['def', 'filter_by_attrs', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', '# noqa', 'selection', '=', '[', ']', 'for', 'var_name', ',', 'variable', 'in', 'self', '.', 'data_vars', '.', 'items', '(', ')', ':', 'has_value_flag', '=', 'False', 'for', 'attr_name', ',', 'pattern', 'in', 'kwargs', '.', 'items', '(', ')', ':...
Returns a ``Dataset`` with variables that match specific conditions. Can pass in ``key=value`` or ``key=callable``. A Dataset is returned containing only the variables for which all the filter tests pass. These tests are either ``key=value`` for which the attribute ``key`` has the exac...
['Returns', 'a', 'Dataset', 'with', 'variables', 'that', 'match', 'specific', 'conditions', '.']
train
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataset.py#L4187-L4278
5,811
gem/oq-engine
openquake/commonlib/logictree.py
SourceModelLogicTree._validate_planar_fault_geometry
def _validate_planar_fault_geometry(self, node, _float_re): """ Validares a node representation of a planar fault geometry """ valid_spacing = node["spacing"] for key in ["topLeft", "topRight", "bottomLeft", "bottomRight"]: lon = getattr(node, key)["lon"] ...
python
def _validate_planar_fault_geometry(self, node, _float_re): """ Validares a node representation of a planar fault geometry """ valid_spacing = node["spacing"] for key in ["topLeft", "topRight", "bottomLeft", "bottomRight"]: lon = getattr(node, key)["lon"] ...
['def', '_validate_planar_fault_geometry', '(', 'self', ',', 'node', ',', '_float_re', ')', ':', 'valid_spacing', '=', 'node', '[', '"spacing"', ']', 'for', 'key', 'in', '[', '"topLeft"', ',', '"topRight"', ',', '"bottomLeft"', ',', '"bottomRight"', ']', ':', 'lon', '=', 'getattr', '(', 'node', ',', 'key', ')', '[', '"...
Validares a node representation of a planar fault geometry
['Validares', 'a', 'node', 'representation', 'of', 'a', 'planar', 'fault', 'geometry']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/logictree.py#L994-L1010
5,812
tensorflow/tensor2tensor
tensor2tensor/models/research/universal_transformer.py
universal_transformer_base_range
def universal_transformer_base_range(rhp): """Range of hyperparameters.""" # After starting from base, set intervals for some parameters. rhp.set_discrete("num_rec_steps", [6, 8, 10]) rhp.set_discrete("hidden_size", [1024, 2048, 4096]) rhp.set_discrete("filter_size", [2048, 4096, 8192]) rhp.set_discrete("nu...
python
def universal_transformer_base_range(rhp): """Range of hyperparameters.""" # After starting from base, set intervals for some parameters. rhp.set_discrete("num_rec_steps", [6, 8, 10]) rhp.set_discrete("hidden_size", [1024, 2048, 4096]) rhp.set_discrete("filter_size", [2048, 4096, 8192]) rhp.set_discrete("nu...
['def', 'universal_transformer_base_range', '(', 'rhp', ')', ':', '# After starting from base, set intervals for some parameters.', 'rhp', '.', 'set_discrete', '(', '"num_rec_steps"', ',', '[', '6', ',', '8', ',', '10', ']', ')', 'rhp', '.', 'set_discrete', '(', '"hidden_size"', ',', '[', '1024', ',', '2048', ',', '409...
Range of hyperparameters.
['Range', 'of', 'hyperparameters', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/universal_transformer.py#L788-L797
5,813
KelSolaar/Foundations
foundations/io.py
remove
def remove(path): """ Removes given path. :param path: Path to remove. :type path: unicode :return: Method success. :rtype: bool """ try: if os.path.isfile(path): LOGGER.debug("> Removing '{0}' file.".format(path)) os.remove(path) elif os.path.is...
python
def remove(path): """ Removes given path. :param path: Path to remove. :type path: unicode :return: Method success. :rtype: bool """ try: if os.path.isfile(path): LOGGER.debug("> Removing '{0}' file.".format(path)) os.remove(path) elif os.path.is...
['def', 'remove', '(', 'path', ')', ':', 'try', ':', 'if', 'os', '.', 'path', '.', 'isfile', '(', 'path', ')', ':', 'LOGGER', '.', 'debug', '(', '"> Removing \'{0}\' file."', '.', 'format', '(', 'path', ')', ')', 'os', '.', 'remove', '(', 'path', ')', 'elif', 'os', '.', 'path', '.', 'isdir', '(', 'path', ')', ':', 'LOG...
Removes given path. :param path: Path to remove. :type path: unicode :return: Method success. :rtype: bool
['Removes', 'given', 'path', '.']
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/io.py#L344-L364
5,814
tonioo/sievelib
sievelib/managesieve.py
Client.getscript
def getscript(self, name): """Download a script from the server See MANAGESIEVE specifications, section 2.9 :param name: script's name :rtype: string :returns: the script's content on succes, None otherwise """ code, data, content = self.__send_command( ...
python
def getscript(self, name): """Download a script from the server See MANAGESIEVE specifications, section 2.9 :param name: script's name :rtype: string :returns: the script's content on succes, None otherwise """ code, data, content = self.__send_command( ...
['def', 'getscript', '(', 'self', ',', 'name', ')', ':', 'code', ',', 'data', ',', 'content', '=', 'self', '.', '__send_command', '(', '"GETSCRIPT"', ',', '[', 'name', '.', 'encode', '(', '"utf-8"', ')', ']', ',', 'withcontent', '=', 'True', ')', 'if', 'code', '==', '"OK"', ':', 'lines', '=', 'content', '.', 'splitline...
Download a script from the server See MANAGESIEVE specifications, section 2.9 :param name: script's name :rtype: string :returns: the script's content on succes, None otherwise
['Download', 'a', 'script', 'from', 'the', 'server']
train
https://github.com/tonioo/sievelib/blob/88822d1f1daf30ef3dd9ac74911301b0773ef3c8/sievelib/managesieve.py#L580-L596
5,815
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_gasheli.py
GasHeliModule.stop_motor
def stop_motor(self): '''stop motor''' if not self.valid_starter_settings(): return self.motor_t1 = time.time() self.starting_motor = False self.stopping_motor = True self.old_override = self.module('rc').get_override_chan(self.gasheli_settings.ignition_chan-1...
python
def stop_motor(self): '''stop motor''' if not self.valid_starter_settings(): return self.motor_t1 = time.time() self.starting_motor = False self.stopping_motor = True self.old_override = self.module('rc').get_override_chan(self.gasheli_settings.ignition_chan-1...
['def', 'stop_motor', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'valid_starter_settings', '(', ')', ':', 'return', 'self', '.', 'motor_t1', '=', 'time', '.', 'time', '(', ')', 'self', '.', 'starting_motor', '=', 'False', 'self', '.', 'stopping_motor', '=', 'True', 'self', '.', 'old_override', '=', 'self', '.', '...
stop motor
['stop', 'motor']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_gasheli.py#L124-L133
5,816
horejsek/python-webdriverwrapper
webdriverwrapper/errors.py
WebdriverWrapperErrorMixin.check_expected_errors
def check_expected_errors(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected errors. You can set expected errors by decorators :py:func:`.expected_error_page`, :py:func:`.allowed_error_pages`, :py:fu...
python
def check_expected_errors(self, test_method): """ This method is called after each test. It will read decorated informations and check if there are expected errors. You can set expected errors by decorators :py:func:`.expected_error_page`, :py:func:`.allowed_error_pages`, :py:fu...
['def', 'check_expected_errors', '(', 'self', ',', 'test_method', ')', ':', 'f', '=', 'lambda', 'key', ',', 'default', '=', '[', ']', ':', 'getattr', '(', 'test_method', ',', 'key', ',', 'default', ')', 'expected_error_page', '=', 'f', '(', 'EXPECTED_ERROR_PAGE', ',', 'default', '=', 'None', ')', 'allowed_error_pages',...
This method is called after each test. It will read decorated informations and check if there are expected errors. You can set expected errors by decorators :py:func:`.expected_error_page`, :py:func:`.allowed_error_pages`, :py:func:`.expected_error_messages`, :py:func:`.allowed_error_me...
['This', 'method', 'is', 'called', 'after', 'each', 'test', '.', 'It', 'will', 'read', 'decorated', 'informations', 'and', 'check', 'if', 'there', 'are', 'expected', 'errors', '.']
train
https://github.com/horejsek/python-webdriverwrapper/blob/a492f79ab60ed83d860dd817b6a0961500d7e3f5/webdriverwrapper/errors.py#L107-L126
5,817
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
Color.dark
def dark(cls): "Make the current foreground color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
python
def dark(cls): "Make the current foreground color dark." wAttributes = cls._get_text_attributes() wAttributes &= ~win32.FOREGROUND_INTENSITY cls._set_text_attributes(wAttributes)
['def', 'dark', '(', 'cls', ')', ':', 'wAttributes', '=', 'cls', '.', '_get_text_attributes', '(', ')', 'wAttributes', '&=', '~', 'win32', '.', 'FOREGROUND_INTENSITY', 'cls', '.', '_set_text_attributes', '(', 'wAttributes', ')']
Make the current foreground color dark.
['Make', 'the', 'current', 'foreground', 'color', 'dark', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L936-L940
5,818
mushkevych/scheduler
synergy/scheduler/timetable.py
Timetable.assign_job_record
def assign_job_record(self, tree_node): """ - looks for an existing job record in the DB, and if not found - creates a job record in STATE_EMBRYO and bind it to the given tree node """ try: job_record = self.job_dao.get_one(tree_node.process_name, tree_node.timeperiod) ex...
python
def assign_job_record(self, tree_node): """ - looks for an existing job record in the DB, and if not found - creates a job record in STATE_EMBRYO and bind it to the given tree node """ try: job_record = self.job_dao.get_one(tree_node.process_name, tree_node.timeperiod) ex...
['def', 'assign_job_record', '(', 'self', ',', 'tree_node', ')', ':', 'try', ':', 'job_record', '=', 'self', '.', 'job_dao', '.', 'get_one', '(', 'tree_node', '.', 'process_name', ',', 'tree_node', '.', 'timeperiod', ')', 'except', 'LookupError', ':', 'state_machine_name', '=', 'context', '.', 'process_context', '[', '...
- looks for an existing job record in the DB, and if not found - creates a job record in STATE_EMBRYO and bind it to the given tree node
['-', 'looks', 'for', 'an', 'existing', 'job', 'record', 'in', 'the', 'DB', 'and', 'if', 'not', 'found', '-', 'creates', 'a', 'job', 'record', 'in', 'STATE_EMBRYO', 'and', 'bind', 'it', 'to', 'the', 'given', 'tree', 'node']
train
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L155-L164
5,819
CGATOxford/UMI-tools
umi_tools/umi_methods.py
random_read_generator.refill_random
def refill_random(self): ''' refill the list of random_umis ''' self.random_umis = np.random.choice( list(self.umis.keys()), self.random_fill_size, p=self.prob) self.random_ix = 0
python
def refill_random(self): ''' refill the list of random_umis ''' self.random_umis = np.random.choice( list(self.umis.keys()), self.random_fill_size, p=self.prob) self.random_ix = 0
['def', 'refill_random', '(', 'self', ')', ':', 'self', '.', 'random_umis', '=', 'np', '.', 'random', '.', 'choice', '(', 'list', '(', 'self', '.', 'umis', '.', 'keys', '(', ')', ')', ',', 'self', '.', 'random_fill_size', ',', 'p', '=', 'self', '.', 'prob', ')', 'self', '.', 'random_ix', '=', '0']
refill the list of random_umis
['refill', 'the', 'list', 'of', 'random_umis']
train
https://github.com/CGATOxford/UMI-tools/blob/c4b5d84aac391d59916d294f8f4f8f5378abcfbe/umi_tools/umi_methods.py#L154-L158
5,820
biolink/ontobio
ontobio/golr/golr_query.py
map_field
def map_field(fn, m) : """ Maps a field name, given a mapping file. Returns input if fieldname is unmapped. """ if m is None: return fn if fn in m: return m[fn] else: return fn
python
def map_field(fn, m) : """ Maps a field name, given a mapping file. Returns input if fieldname is unmapped. """ if m is None: return fn if fn in m: return m[fn] else: return fn
['def', 'map_field', '(', 'fn', ',', 'm', ')', ':', 'if', 'm', 'is', 'None', ':', 'return', 'fn', 'if', 'fn', 'in', 'm', ':', 'return', 'm', '[', 'fn', ']', 'else', ':', 'return', 'fn']
Maps a field name, given a mapping file. Returns input if fieldname is unmapped.
['Maps', 'a', 'field', 'name', 'given', 'a', 'mapping', 'file', '.', 'Returns', 'input', 'if', 'fieldname', 'is', 'unmapped', '.']
train
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/golr/golr_query.py#L271-L281
5,821
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
Usuario.inserir
def inserir(self, user, pwd, name, email, user_ldap): """Inserts a new User and returns its identifier. The user will be created with active status. :param user: Username. String with a minimum 3 and maximum of 45 characters :param pwd: User password. String with a minimum 3 and maximu...
python
def inserir(self, user, pwd, name, email, user_ldap): """Inserts a new User and returns its identifier. The user will be created with active status. :param user: Username. String with a minimum 3 and maximum of 45 characters :param pwd: User password. String with a minimum 3 and maximu...
['def', 'inserir', '(', 'self', ',', 'user', ',', 'pwd', ',', 'name', ',', 'email', ',', 'user_ldap', ')', ':', 'user_map', '=', 'dict', '(', ')', 'user_map', '[', "'user'", ']', '=', 'user', 'user_map', '[', "'password'", ']', '=', 'pwd', 'user_map', '[', "'name'", ']', '=', 'name', 'user_map', '[', "'email'", ']', '=...
Inserts a new User and returns its identifier. The user will be created with active status. :param user: Username. String with a minimum 3 and maximum of 45 characters :param pwd: User password. String with a minimum 3 and maximum of 45 characters :param name: User name. String with a ...
['Inserts', 'a', 'new', 'User', 'and', 'returns', 'its', 'identifier', '.']
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L206-L237
5,822
awacha/sastool
sastool/io/credo_cpth5/header.py
Header.energy
def energy(self) -> ErrorValue: """X-ray energy""" return (ErrorValue(*(scipy.constants.physical_constants['speed of light in vacuum'][0::2])) * ErrorValue(*(scipy.constants.physical_constants['Planck constant in eV s'][0::2])) / scipy.constants.nano / sel...
python
def energy(self) -> ErrorValue: """X-ray energy""" return (ErrorValue(*(scipy.constants.physical_constants['speed of light in vacuum'][0::2])) * ErrorValue(*(scipy.constants.physical_constants['Planck constant in eV s'][0::2])) / scipy.constants.nano / sel...
['def', 'energy', '(', 'self', ')', '->', 'ErrorValue', ':', 'return', '(', 'ErrorValue', '(', '*', '(', 'scipy', '.', 'constants', '.', 'physical_constants', '[', "'speed of light in vacuum'", ']', '[', '0', ':', ':', '2', ']', ')', ')', '*', 'ErrorValue', '(', '*', '(', 'scipy', '.', 'constants', '.', 'physical_const...
X-ray energy
['X', '-', 'ray', 'energy']
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/io/credo_cpth5/header.py#L50-L55
5,823
pytroll/satpy
satpy/readers/abi_l1b.py
NC_ABI_L1B._ir_calibrate
def _ir_calibrate(self, data): """Calibrate IR channels to BT.""" fk1 = float(self["planck_fk1"]) fk2 = float(self["planck_fk2"]) bc1 = float(self["planck_bc1"]) bc2 = float(self["planck_bc2"]) res = (fk2 / xu.log(fk1 / data + 1) - bc1) / bc2 res.attrs = data.att...
python
def _ir_calibrate(self, data): """Calibrate IR channels to BT.""" fk1 = float(self["planck_fk1"]) fk2 = float(self["planck_fk2"]) bc1 = float(self["planck_bc1"]) bc2 = float(self["planck_bc2"]) res = (fk2 / xu.log(fk1 / data + 1) - bc1) / bc2 res.attrs = data.att...
['def', '_ir_calibrate', '(', 'self', ',', 'data', ')', ':', 'fk1', '=', 'float', '(', 'self', '[', '"planck_fk1"', ']', ')', 'fk2', '=', 'float', '(', 'self', '[', '"planck_fk2"', ']', ')', 'bc1', '=', 'float', '(', 'self', '[', '"planck_bc1"', ']', ')', 'bc2', '=', 'float', '(', 'self', '[', '"planck_bc2"', ']', ')',...
Calibrate IR channels to BT.
['Calibrate', 'IR', 'channels', 'to', 'BT', '.']
train
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/abi_l1b.py#L200-L211
5,824
basho/riak-python-client
riak/datatypes/map.py
Map._check_key
def _check_key(self, key): """ Ensures well-formedness of a key. """ if not len(key) == 2: raise TypeError('invalid key: %r' % key) elif key[1] not in TYPES: raise TypeError('invalid datatype: %s' % key[1])
python
def _check_key(self, key): """ Ensures well-formedness of a key. """ if not len(key) == 2: raise TypeError('invalid key: %r' % key) elif key[1] not in TYPES: raise TypeError('invalid datatype: %s' % key[1])
['def', '_check_key', '(', 'self', ',', 'key', ')', ':', 'if', 'not', 'len', '(', 'key', ')', '==', '2', ':', 'raise', 'TypeError', '(', "'invalid key: %r'", '%', 'key', ')', 'elif', 'key', '[', '1', ']', 'not', 'in', 'TYPES', ':', 'raise', 'TypeError', '(', "'invalid datatype: %s'", '%', 'key', '[', '1', ']', ')']
Ensures well-formedness of a key.
['Ensures', 'well', '-', 'formedness', 'of', 'a', 'key', '.']
train
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/datatypes/map.py#L227-L234
5,825
DataONEorg/d1_python
lib_client/src/d1_client/baseclient_1_1.py
DataONEBaseClient_1_1.getQueryEngineDescription
def getQueryEngineDescription(self, queryEngine, **kwargs): """See Also: getQueryEngineDescriptionResponse() Args: queryEngine: **kwargs: Returns: """ response = self.getQueryEngineDescriptionResponse(queryEngine, **kwargs) return self._read_dataone...
python
def getQueryEngineDescription(self, queryEngine, **kwargs): """See Also: getQueryEngineDescriptionResponse() Args: queryEngine: **kwargs: Returns: """ response = self.getQueryEngineDescriptionResponse(queryEngine, **kwargs) return self._read_dataone...
['def', 'getQueryEngineDescription', '(', 'self', ',', 'queryEngine', ',', '*', '*', 'kwargs', ')', ':', 'response', '=', 'self', '.', 'getQueryEngineDescriptionResponse', '(', 'queryEngine', ',', '*', '*', 'kwargs', ')', 'return', 'self', '.', '_read_dataone_type_response', '(', 'response', ',', "'QueryEngineDescripti...
See Also: getQueryEngineDescriptionResponse() Args: queryEngine: **kwargs: Returns:
['See', 'Also', ':', 'getQueryEngineDescriptionResponse', '()']
train
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_client/src/d1_client/baseclient_1_1.py#L130-L141
5,826
peterldowns/python-mustache
mustache/rendering.py
__render
def __render(template, state, index=0): """ Given a /template/ string, a parser /state/, and a starting offset (/index/), return the rendered version of the template. """ # Find a Match match = state.tag_re.search(template, index) if not match: return template[index:] info = get...
python
def __render(template, state, index=0): """ Given a /template/ string, a parser /state/, and a starting offset (/index/), return the rendered version of the template. """ # Find a Match match = state.tag_re.search(template, index) if not match: return template[index:] info = get...
['def', '__render', '(', 'template', ',', 'state', ',', 'index', '=', '0', ')', ':', '# Find a Match', 'match', '=', 'state', '.', 'tag_re', '.', 'search', '(', 'template', ',', 'index', ')', 'if', 'not', 'match', ':', 'return', 'template', '[', 'index', ':', ']', 'info', '=', 'get_match_info', '(', 'template', ',', 'm...
Given a /template/ string, a parser /state/, and a starting offset (/index/), return the rendered version of the template.
['Given', 'a', '/', 'template', '/', 'string', 'a', 'parser', '/', 'state', '/', 'and', 'a', 'starting', 'offset', '(', '/', 'index', '/', ')', 'return', 'the', 'rendered', 'version', 'of', 'the', 'template', '.']
train
https://github.com/peterldowns/python-mustache/blob/ea3753696ea9886b6eb39cc5de27db7054adc069/mustache/rendering.py#L148-L284
5,827
mcocdawc/chemcoord
src/chemcoord/internal_coordinates/_zmat_class_core.py
ZmatCore.iupacify
def iupacify(self): """Give the IUPAC conform representation. Mathematically speaking the angles in a zmatrix are representations of an equivalence class. We will denote an equivalence relation with :math:`\\sim` and use :math:`\\alpha` for an angle and :math:`\\delta` for a dih...
python
def iupacify(self): """Give the IUPAC conform representation. Mathematically speaking the angles in a zmatrix are representations of an equivalence class. We will denote an equivalence relation with :math:`\\sim` and use :math:`\\alpha` for an angle and :math:`\\delta` for a dih...
['def', 'iupacify', '(', 'self', ')', ':', 'def', 'convert_d', '(', 'd', ')', ':', 'r', '=', 'd', '%', '360', 'return', 'r', '-', '(', 'r', '//', '180', ')', '*', '360', 'new', '=', 'self', '.', 'copy', '(', ')', 'new', '.', 'unsafe_loc', '[', ':', ',', "'angle'", ']', '=', 'new', '[', "'angle'", ']', '%', '360', 'sele...
Give the IUPAC conform representation. Mathematically speaking the angles in a zmatrix are representations of an equivalence class. We will denote an equivalence relation with :math:`\\sim` and use :math:`\\alpha` for an angle and :math:`\\delta` for a dihedral angle. Then the f...
['Give', 'the', 'IUPAC', 'conform', 'representation', '.']
train
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/internal_coordinates/_zmat_class_core.py#L280-L321
5,828
vpelletier/python-libusb1
usb1/__init__.py
USBPoller.register
def register(self, fd, events): """ Register an USB-unrelated fd to poller. Convenience method. """ if fd in self.__fd_set: raise ValueError( 'This fd is a special USB event fd, it cannot be polled.' ) self.__poller.register(fd, eve...
python
def register(self, fd, events): """ Register an USB-unrelated fd to poller. Convenience method. """ if fd in self.__fd_set: raise ValueError( 'This fd is a special USB event fd, it cannot be polled.' ) self.__poller.register(fd, eve...
['def', 'register', '(', 'self', ',', 'fd', ',', 'events', ')', ':', 'if', 'fd', 'in', 'self', '.', '__fd_set', ':', 'raise', 'ValueError', '(', "'This fd is a special USB event fd, it cannot be polled.'", ')', 'self', '.', '__poller', '.', 'register', '(', 'fd', ',', 'events', ')']
Register an USB-unrelated fd to poller. Convenience method.
['Register', 'an', 'USB', '-', 'unrelated', 'fd', 'to', 'poller', '.', 'Convenience', 'method', '.']
train
https://github.com/vpelletier/python-libusb1/blob/740c9778e28523e4ec3543415d95f5400ae0fa24/usb1/__init__.py#L1107-L1116
5,829
inasafe/inasafe
safe/utilities/geonode/upload_layer_requests.py
pretty_print_post
def pretty_print_post(req): """Helper to print a "prepared" query. Useful to debug a POST query. However pay attention at the formatting used in this function because it is programmed to be pretty printed and may differ from the actual request. """ print(('{}\n{}\n{}\n\n{}'.format( '---...
python
def pretty_print_post(req): """Helper to print a "prepared" query. Useful to debug a POST query. However pay attention at the formatting used in this function because it is programmed to be pretty printed and may differ from the actual request. """ print(('{}\n{}\n{}\n\n{}'.format( '---...
['def', 'pretty_print_post', '(', 'req', ')', ':', 'print', '(', '(', "'{}\\n{}\\n{}\\n\\n{}'", '.', 'format', '(', "'-----------START-----------'", ',', 'req', '.', 'method', '+', "' '", '+', 'req', '.', 'url', ',', "'\\n'", '.', 'join', '(', "'{}: {}'", '.', 'format', '(', 'k', ',', 'v', ')', 'for', 'k', ',', 'v', 'i...
Helper to print a "prepared" query. Useful to debug a POST query. However pay attention at the formatting used in this function because it is programmed to be pretty printed and may differ from the actual request.
['Helper', 'to', 'print', 'a', 'prepared', 'query', '.', 'Useful', 'to', 'debug', 'a', 'POST', 'query', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/geonode/upload_layer_requests.py#L84-L96
5,830
schettino72/import-deps
import_deps/__init__.py
ModuleSet._get_imported_module
def _get_imported_module(self, module_name): """try to get imported module reference by its name""" # if imported module on module_set add to list imp_mod = self.by_name.get(module_name) if imp_mod: return imp_mod # last part of import section might not be a module ...
python
def _get_imported_module(self, module_name): """try to get imported module reference by its name""" # if imported module on module_set add to list imp_mod = self.by_name.get(module_name) if imp_mod: return imp_mod # last part of import section might not be a module ...
['def', '_get_imported_module', '(', 'self', ',', 'module_name', ')', ':', '# if imported module on module_set add to list', 'imp_mod', '=', 'self', '.', 'by_name', '.', 'get', '(', 'module_name', ')', 'if', 'imp_mod', ':', 'return', 'imp_mod', '# last part of import section might not be a module', '# remove last secti...
try to get imported module reference by its name
['try', 'to', 'get', 'imported', 'module', 'reference', 'by', 'its', 'name']
train
https://github.com/schettino72/import-deps/blob/311f2badd2c93f743d09664397f21e7eaa16e1f1/import_deps/__init__.py#L95-L116
5,831
makinacorpus/django-tracking-fields
tracking_fields/tracking.py
_create_event
def _create_event(instance, action): """ Create a new event, getting the use if django-cuser is available. """ user = None user_repr = repr(user) if CUSER: user = CuserMiddleware.get_user() user_repr = repr(user) if user is not None and user.is_anonymous: user...
python
def _create_event(instance, action): """ Create a new event, getting the use if django-cuser is available. """ user = None user_repr = repr(user) if CUSER: user = CuserMiddleware.get_user() user_repr = repr(user) if user is not None and user.is_anonymous: user...
['def', '_create_event', '(', 'instance', ',', 'action', ')', ':', 'user', '=', 'None', 'user_repr', '=', 'repr', '(', 'user', ')', 'if', 'CUSER', ':', 'user', '=', 'CuserMiddleware', '.', 'get_user', '(', ')', 'user_repr', '=', 'repr', '(', 'user', ')', 'if', 'user', 'is', 'not', 'None', 'and', 'user', '.', 'is_anonym...
Create a new event, getting the use if django-cuser is available.
['Create', 'a', 'new', 'event', 'getting', 'the', 'use', 'if', 'django', '-', 'cuser', 'is', 'available', '.']
train
https://github.com/makinacorpus/django-tracking-fields/blob/463313d0f9c0f8107a0413f4d418d1a8c2311981/tracking_fields/tracking.py#L100-L117
5,832
pyrogram/pyrogram
pyrogram/client/methods/messages/send_animation.py
SendAnimation.send_animation
def send_animation( self, chat_id: Union[int, str], animation: str, caption: str = "", parse_mode: str = "", duration: int = 0, width: int = 0, height: int = 0, thumb: str = None, disable_notification: bool = None, reply_to_message_...
python
def send_animation( self, chat_id: Union[int, str], animation: str, caption: str = "", parse_mode: str = "", duration: int = 0, width: int = 0, height: int = 0, thumb: str = None, disable_notification: bool = None, reply_to_message_...
['def', 'send_animation', '(', 'self', ',', 'chat_id', ':', 'Union', '[', 'int', ',', 'str', ']', ',', 'animation', ':', 'str', ',', 'caption', ':', 'str', '=', '""', ',', 'parse_mode', ':', 'str', '=', '""', ',', 'duration', ':', 'int', '=', '0', ',', 'width', ':', 'int', '=', '0', ',', 'height', ':', 'int', '=', '0',...
Use this method to send animation files (animation or H.264/MPEG-4 AVC video without sound). Args: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". ...
['Use', 'this', 'method', 'to', 'send', 'animation', 'files', '(', 'animation', 'or', 'H', '.', '264', '/', 'MPEG', '-', '4', 'AVC', 'video', 'without', 'sound', ')', '.']
train
https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/messages/send_animation.py#L31-L204
5,833
bfrog/whizzer
whizzer/client.py
Connector.start
def start(self): """Start the connector state machine.""" if self.started: raise ConnectorStartedError() self.started = True try: self.connect_watcher.start() self.timeout_watcher.start() self.sock.connect(self.addr) except IOErro...
python
def start(self): """Start the connector state machine.""" if self.started: raise ConnectorStartedError() self.started = True try: self.connect_watcher.start() self.timeout_watcher.start() self.sock.connect(self.addr) except IOErro...
['def', 'start', '(', 'self', ')', ':', 'if', 'self', '.', 'started', ':', 'raise', 'ConnectorStartedError', '(', ')', 'self', '.', 'started', '=', 'True', 'try', ':', 'self', '.', 'connect_watcher', '.', 'start', '(', ')', 'self', '.', 'timeout_watcher', '.', 'start', '(', ')', 'self', '.', 'sock', '.', 'connect', '('...
Start the connector state machine.
['Start', 'the', 'connector', 'state', 'machine', '.']
train
https://github.com/bfrog/whizzer/blob/a1e43084b3ac8c1f3fb4ada081777cdbf791fd77/whizzer/client.py#L91-L107
5,834
jsvine/tinyapi
tinyapi/draft.py
Draft.save
def save(self): """Save current draft state.""" response = self.session.request("save:Message", [ self.data ]) self.data = response self.message_id = self.data["id"] return self
python
def save(self): """Save current draft state.""" response = self.session.request("save:Message", [ self.data ]) self.data = response self.message_id = self.data["id"] return self
['def', 'save', '(', 'self', ')', ':', 'response', '=', 'self', '.', 'session', '.', 'request', '(', '"save:Message"', ',', '[', 'self', '.', 'data', ']', ')', 'self', '.', 'data', '=', 'response', 'self', '.', 'message_id', '=', 'self', '.', 'data', '[', '"id"', ']', 'return', 'self']
Save current draft state.
['Save', 'current', 'draft', 'state', '.']
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/draft.py#L32-L37
5,835
log2timeline/plaso
plaso/engine/processing_status.py
ProcessStatus.UpdateNumberOfWarnings
def UpdateNumberOfWarnings( self, number_of_consumed_warnings, number_of_produced_warnings): """Updates the number of warnings. Args: number_of_consumed_warnings (int): total number of warnings consumed by the process. number_of_produced_warnings (int): total number of warnings prod...
python
def UpdateNumberOfWarnings( self, number_of_consumed_warnings, number_of_produced_warnings): """Updates the number of warnings. Args: number_of_consumed_warnings (int): total number of warnings consumed by the process. number_of_produced_warnings (int): total number of warnings prod...
['def', 'UpdateNumberOfWarnings', '(', 'self', ',', 'number_of_consumed_warnings', ',', 'number_of_produced_warnings', ')', ':', 'consumed_warnings_delta', '=', '0', 'if', 'number_of_consumed_warnings', 'is', 'not', 'None', ':', 'if', 'number_of_consumed_warnings', '<', 'self', '.', 'number_of_consumed_warnings', ':', ...
Updates the number of warnings. Args: number_of_consumed_warnings (int): total number of warnings consumed by the process. number_of_produced_warnings (int): total number of warnings produced by the process. Returns: bool: True if either number of warnings has increased. ...
['Updates', 'the', 'number', 'of', 'warnings', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/engine/processing_status.py#L265-L306
5,836
odlgroup/odl
odl/contrib/solvers/spdhg/stochastic_primal_dual_hybrid_gradient.py
spdhg
def spdhg(x, f, g, A, tau, sigma, niter, **kwargs): r"""Computes a saddle point with a stochastic PDHG. This means, a solution (x*, y*), y* = (y*_1, ..., y*_n) such that (x*, y*) in arg min_x max_y sum_i=1^n <y_i, A_i> - f*[i](y_i) + g(x) where g : X -> IR_infty and f[i] : Y[i] -> IR_infty are convex...
python
def spdhg(x, f, g, A, tau, sigma, niter, **kwargs): r"""Computes a saddle point with a stochastic PDHG. This means, a solution (x*, y*), y* = (y*_1, ..., y*_n) such that (x*, y*) in arg min_x max_y sum_i=1^n <y_i, A_i> - f*[i](y_i) + g(x) where g : X -> IR_infty and f[i] : Y[i] -> IR_infty are convex...
['def', 'spdhg', '(', 'x', ',', 'f', ',', 'g', ',', 'A', ',', 'tau', ',', 'sigma', ',', 'niter', ',', '*', '*', 'kwargs', ')', ':', '# Probabilities', 'prob', '=', 'kwargs', '.', 'pop', '(', "'prob'", ',', 'None', ')', 'if', 'prob', 'is', 'None', ':', 'prob', '=', '[', '1', '/', 'len', '(', 'A', ')', ']', '*', 'len', '...
r"""Computes a saddle point with a stochastic PDHG. This means, a solution (x*, y*), y* = (y*_1, ..., y*_n) such that (x*, y*) in arg min_x max_y sum_i=1^n <y_i, A_i> - f*[i](y_i) + g(x) where g : X -> IR_infty and f[i] : Y[i] -> IR_infty are convex, l.s.c. and proper functionals. For this algorithm,...
['r', 'Computes', 'a', 'saddle', 'point', 'with', 'a', 'stochastic', 'PDHG', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/contrib/solvers/spdhg/stochastic_primal_dual_hybrid_gradient.py#L87-L168
5,837
davidrpugh/pyCollocation
pycollocation/solvers/solvers.py
Solver.solve
def solve(self, basis_kwargs, boundary_points, coefs_array, nodes, problem, **solver_options): """ Solve a boundary value problem using the collocation method. Parameters ---------- basis_kwargs : dict Dictionary of keyword arguments used to build basis...
python
def solve(self, basis_kwargs, boundary_points, coefs_array, nodes, problem, **solver_options): """ Solve a boundary value problem using the collocation method. Parameters ---------- basis_kwargs : dict Dictionary of keyword arguments used to build basis...
['def', 'solve', '(', 'self', ',', 'basis_kwargs', ',', 'boundary_points', ',', 'coefs_array', ',', 'nodes', ',', 'problem', ',', '*', '*', 'solver_options', ')', ':', 'result', '=', 'optimize', '.', 'root', '(', 'self', '.', '_compute_residuals', ',', 'x0', '=', 'coefs_array', ',', 'args', '=', '(', 'basis_kwargs', ',...
Solve a boundary value problem using the collocation method. Parameters ---------- basis_kwargs : dict Dictionary of keyword arguments used to build basis functions. coefs_array : numpy.ndarray Array of coefficients for basis functions defining the initial ...
['Solve', 'a', 'boundary', 'value', 'problem', 'using', 'the', 'collocation', 'method', '.']
train
https://github.com/davidrpugh/pyCollocation/blob/9376f3488a992dc416cfd2a4dbb396d094927569/pycollocation/solvers/solvers.py#L234-L267
5,838
FNNDSC/pfmisc
pfmisc/C_snode.py
C_stree.node_copy
def node_copy(self, astr_pathInTree, **kwargs): """ Typically called by the explore()/recurse() methods and of form: f(pathInTree, **kwargs) and returns dictionary of which one element is 'status': True|False recursion continuation fl...
python
def node_copy(self, astr_pathInTree, **kwargs): """ Typically called by the explore()/recurse() methods and of form: f(pathInTree, **kwargs) and returns dictionary of which one element is 'status': True|False recursion continuation fl...
['def', 'node_copy', '(', 'self', ',', 'astr_pathInTree', ',', '*', '*', 'kwargs', ')', ':', "# Here, 'T' is the target 'disk'.", 'T', '=', 'None', 'str_pathDiskRoot', '=', "''", 'str_pathDiskFull', '=', "''", 'str_pathTree', '=', "''", 'str_pathTreeOrig', '=', 'self', '.', 'pwd', '(', ')', 'for', 'key', ',', 'val', 'i...
Typically called by the explore()/recurse() methods and of form: f(pathInTree, **kwargs) and returns dictionary of which one element is 'status': True|False recursion continuation flag is returned: 'continue': True|False to sign...
['Typically', 'called', 'by', 'the', 'explore', '()', '/', 'recurse', '()', 'methods', 'and', 'of', 'form', ':']
train
https://github.com/FNNDSC/pfmisc/blob/960b4d6135fcc50bed0a8e55db2ab1ddad9b99d8/pfmisc/C_snode.py#L1213-L1287
5,839
bokeh/bokeh
bokeh/io/util.py
_shares_exec_prefix
def _shares_exec_prefix(basedir): ''' Whether a give base directory is on the system exex prefix ''' import sys prefix = sys.exec_prefix return (prefix is not None and basedir.startswith(prefix))
python
def _shares_exec_prefix(basedir): ''' Whether a give base directory is on the system exex prefix ''' import sys prefix = sys.exec_prefix return (prefix is not None and basedir.startswith(prefix))
['def', '_shares_exec_prefix', '(', 'basedir', ')', ':', 'import', 'sys', 'prefix', '=', 'sys', '.', 'exec_prefix', 'return', '(', 'prefix', 'is', 'not', 'None', 'and', 'basedir', '.', 'startswith', '(', 'prefix', ')', ')']
Whether a give base directory is on the system exex prefix
['Whether', 'a', 'give', 'base', 'directory', 'is', 'on', 'the', 'system', 'exex', 'prefix']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/util.py#L120-L126
5,840
tanghaibao/goatools
goatools/cli/compare_gos.py
_Init._init_go_sets
def _init_go_sets(self, go_fins): """Get lists of GO IDs.""" go_sets = [] assert go_fins, "EXPECTED FILES CONTAINING GO IDs" assert len(go_fins) >= 2, "EXPECTED 2+ GO LISTS. FOUND: {L}".format( L=' '.join(go_fins)) obj = GetGOs(self.godag) for fin in go_fins: ...
python
def _init_go_sets(self, go_fins): """Get lists of GO IDs.""" go_sets = [] assert go_fins, "EXPECTED FILES CONTAINING GO IDs" assert len(go_fins) >= 2, "EXPECTED 2+ GO LISTS. FOUND: {L}".format( L=' '.join(go_fins)) obj = GetGOs(self.godag) for fin in go_fins: ...
['def', '_init_go_sets', '(', 'self', ',', 'go_fins', ')', ':', 'go_sets', '=', '[', ']', 'assert', 'go_fins', ',', '"EXPECTED FILES CONTAINING GO IDs"', 'assert', 'len', '(', 'go_fins', ')', '>=', '2', ',', '"EXPECTED 2+ GO LISTS. FOUND: {L}"', '.', 'format', '(', 'L', '=', "' '", '.', 'join', '(', 'go_fins', ')', ')'...
Get lists of GO IDs.
['Get', 'lists', 'of', 'GO', 'IDs', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/compare_gos.py#L250-L260
5,841
Azure/azure-cli-extensions
src/sqlvm-preview/azext_sqlvm_preview/_format.py
format_auto_patching_settings
def format_auto_patching_settings(result): ''' Formats the AutoPatchingSettings object removing arguments that are empty ''' from collections import OrderedDict # Only display parameters that have content order_dict = OrderedDict() if result.enable is not None: order_dict['enable'] =...
python
def format_auto_patching_settings(result): ''' Formats the AutoPatchingSettings object removing arguments that are empty ''' from collections import OrderedDict # Only display parameters that have content order_dict = OrderedDict() if result.enable is not None: order_dict['enable'] =...
['def', 'format_auto_patching_settings', '(', 'result', ')', ':', 'from', 'collections', 'import', 'OrderedDict', '# Only display parameters that have content', 'order_dict', '=', 'OrderedDict', '(', ')', 'if', 'result', '.', 'enable', 'is', 'not', 'None', ':', 'order_dict', '[', "'enable'", ']', '=', 'result', '.', 'e...
Formats the AutoPatchingSettings object removing arguments that are empty
['Formats', 'the', 'AutoPatchingSettings', 'object', 'removing', 'arguments', 'that', 'are', 'empty']
train
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/sqlvm-preview/azext_sqlvm_preview/_format.py#L181-L197
5,842
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendaritem.py
XCalendarItem.setDuration
def setDuration( self, duration ): """ Changes the number of days that this item represents. This will move the end date the appropriate number of days away from the start date. The duration is calculated as the 1 plus the number of days from start to end, so a duration of ...
python
def setDuration( self, duration ): """ Changes the number of days that this item represents. This will move the end date the appropriate number of days away from the start date. The duration is calculated as the 1 plus the number of days from start to end, so a duration of ...
['def', 'setDuration', '(', 'self', ',', 'duration', ')', ':', 'if', '(', 'duration', '<=', '0', ')', ':', 'return', 'self', '.', '_dateEnd', '=', 'self', '.', '_dateStart', '.', 'addDays', '(', 'duration', '-', '1', ')', 'self', '.', 'markForRebuild', '(', ')']
Changes the number of days that this item represents. This will move the end date the appropriate number of days away from the start date. The duration is calculated as the 1 plus the number of days from start to end, so a duration of 1 will have the same start and end date. The du...
['Changes', 'the', 'number', 'of', 'days', 'that', 'this', 'item', 'represents', '.', 'This', 'will', 'move', 'the', 'end', 'date', 'the', 'appropriate', 'number', 'of', 'days', 'away', 'from', 'the', 'start', 'date', '.', 'The', 'duration', 'is', 'calculated', 'as', 'the', '1', 'plus', 'the', 'number', 'of', 'days', '...
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendaritem.py#L577-L591
5,843
inasafe/inasafe
safe/gui/tools/minimum_needs/needs_manager_dialog.py
NeedsManagerDialog.mark_current_profile_as_pending
def mark_current_profile_as_pending(self): """Mark the current profile as pending by colouring the text red. """ index = self.profile_combo.currentIndex() item = self.profile_combo.model().item(index) item.setForeground(QtGui.QColor('red'))
python
def mark_current_profile_as_pending(self): """Mark the current profile as pending by colouring the text red. """ index = self.profile_combo.currentIndex() item = self.profile_combo.model().item(index) item.setForeground(QtGui.QColor('red'))
['def', 'mark_current_profile_as_pending', '(', 'self', ')', ':', 'index', '=', 'self', '.', 'profile_combo', '.', 'currentIndex', '(', ')', 'item', '=', 'self', '.', 'profile_combo', '.', 'model', '(', ')', '.', 'item', '(', 'index', ')', 'item', '.', 'setForeground', '(', 'QtGui', '.', 'QColor', '(', "'red'", ')', ')...
Mark the current profile as pending by colouring the text red.
['Mark', 'the', 'current', 'profile', 'as', 'pending', 'by', 'colouring', 'the', 'text', 'red', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/minimum_needs/needs_manager_dialog.py#L321-L326
5,844
bpython/curtsies
examples/tttplaybitboard.py
max_play
def max_play(w, i, grid): "Play like Spock, except breaking ties by drunk_value." return min(successors(grid), key=lambda succ: (evaluate(succ), drunk_value(succ)))
python
def max_play(w, i, grid): "Play like Spock, except breaking ties by drunk_value." return min(successors(grid), key=lambda succ: (evaluate(succ), drunk_value(succ)))
['def', 'max_play', '(', 'w', ',', 'i', ',', 'grid', ')', ':', 'return', 'min', '(', 'successors', '(', 'grid', ')', ',', 'key', '=', 'lambda', 'succ', ':', '(', 'evaluate', '(', 'succ', ')', ',', 'drunk_value', '(', 'succ', ')', ')', ')']
Play like Spock, except breaking ties by drunk_value.
['Play', 'like', 'Spock', 'except', 'breaking', 'ties', 'by', 'drunk_value', '.']
train
https://github.com/bpython/curtsies/blob/223e42b97fbf6c86b479ed4f0963a067333c5a63/examples/tttplaybitboard.py#L106-L109
5,845
apple/turicreate
src/external/xgboost/python-package/xgboost/sklearn.py
XGBClassifier.fit
def fit(self, X, y, sample_weight=None, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable = attribute-defined-outside-init,arguments-differ """ Fit gradient boosting classifier Parameters ---------- X : array_like ...
python
def fit(self, X, y, sample_weight=None, eval_set=None, eval_metric=None, early_stopping_rounds=None, verbose=True): # pylint: disable = attribute-defined-outside-init,arguments-differ """ Fit gradient boosting classifier Parameters ---------- X : array_like ...
['def', 'fit', '(', 'self', ',', 'X', ',', 'y', ',', 'sample_weight', '=', 'None', ',', 'eval_set', '=', 'None', ',', 'eval_metric', '=', 'None', ',', 'early_stopping_rounds', '=', 'None', ',', 'verbose', '=', 'True', ')', ':', '# pylint: disable = attribute-defined-outside-init,arguments-differ', 'evals_result', '=', ...
Fit gradient boosting classifier Parameters ---------- X : array_like Feature matrix y : array_like Labels sample_weight : array_like Weight for each instance eval_set : list, optional A list of (X, y) pairs to use as a val...
['Fit', 'gradient', 'boosting', 'classifier']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L280-L369
5,846
konstantint/matplotlib-venn
matplotlib_venn/_venn3.py
compute_venn3_regions
def compute_venn3_regions(centers, radii): ''' Given the 3x2 matrix with circle center coordinates, and a 3-element list (or array) with circle radii [as returned from solve_venn3_circles], returns the 7 regions, comprising the venn diagram, as VennRegion objects. Regions are returned in order (Abc, aB...
python
def compute_venn3_regions(centers, radii): ''' Given the 3x2 matrix with circle center coordinates, and a 3-element list (or array) with circle radii [as returned from solve_venn3_circles], returns the 7 regions, comprising the venn diagram, as VennRegion objects. Regions are returned in order (Abc, aB...
['def', 'compute_venn3_regions', '(', 'centers', ',', 'radii', ')', ':', 'A', '=', 'VennCircleRegion', '(', 'centers', '[', '0', ']', ',', 'radii', '[', '0', ']', ')', 'B', '=', 'VennCircleRegion', '(', 'centers', '[', '1', ']', ',', 'radii', '[', '1', ']', ')', 'C', '=', 'VennCircleRegion', '(', 'centers', '[', '2', '...
Given the 3x2 matrix with circle center coordinates, and a 3-element list (or array) with circle radii [as returned from solve_venn3_circles], returns the 7 regions, comprising the venn diagram, as VennRegion objects. Regions are returned in order (Abc, aBc, ABc, abC, AbC, aBC, ABC) >>> centers, radii = s...
['Given', 'the', '3x2', 'matrix', 'with', 'circle', 'center', 'coordinates', 'and', 'a', '3', '-', 'element', 'list', '(', 'or', 'array', ')', 'with', 'circle', 'radii', '[', 'as', 'returned', 'from', 'solve_venn3_circles', ']', 'returns', 'the', '7', 'regions', 'comprising', 'the', 'venn', 'diagram', 'as', 'VennRegion...
train
https://github.com/konstantint/matplotlib-venn/blob/c26796c9925bdac512edf48387452fbd1848c791/matplotlib_venn/_venn3.py#L182-L202
5,847
pytest-dev/pluggy
pluggy/callers.py
_multicall
def _multicall(hook_impls, caller_kwargs, firstresult=False): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper set...
python
def _multicall(hook_impls, caller_kwargs, firstresult=False): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper set...
['def', '_multicall', '(', 'hook_impls', ',', 'caller_kwargs', ',', 'firstresult', '=', 'False', ')', ':', '__tracebackhide__', '=', 'True', 'results', '=', '[', ']', 'excinfo', '=', 'None', 'try', ':', '# run impl and wrapper setup functions in a loop', 'teardowns', '=', '[', ']', 'try', ':', 'for', 'hook_impl', 'in',...
Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__().
['Execute', 'a', 'call', 'into', 'multiple', 'python', 'functions', '/', 'methods', 'and', 'return', 'the', 'result', '(', 's', ')', '.']
train
https://github.com/pytest-dev/pluggy/blob/4de9e440eeadd9f0eb8c5232b349ef64e20e33fb/pluggy/callers.py#L157-L208
5,848
IdentityPython/SATOSA
src/satosa/deprecated.py
UserIdHasher.hash_id
def hash_id(salt, user_id, requester, state): """ Sets a user id to the internal_response, in the format specified by the internal response :type salt: str :type user_id: str :type requester: str :type state: satosa.state.State :rtype: str :param...
python
def hash_id(salt, user_id, requester, state): """ Sets a user id to the internal_response, in the format specified by the internal response :type salt: str :type user_id: str :type requester: str :type state: satosa.state.State :rtype: str :param...
['def', 'hash_id', '(', 'salt', ',', 'user_id', ',', 'requester', ',', 'state', ')', ':', 'hash_type_to_format', '=', '{', 'NAMEID_FORMAT_TRANSIENT', ':', '"{id}{req}{time}"', ',', 'NAMEID_FORMAT_PERSISTENT', ':', '"{id}{req}"', ',', '"pairwise"', ':', '"{id}{req}"', ',', '"public"', ':', '"{id}"', ',', 'NAMEID_FORMAT_...
Sets a user id to the internal_response, in the format specified by the internal response :type salt: str :type user_id: str :type requester: str :type state: satosa.state.State :rtype: str :param salt: A salt string for the ID hashing :param user_id: th...
['Sets', 'a', 'user', 'id', 'to', 'the', 'internal_response', 'in', 'the', 'format', 'specified', 'by', 'the', 'internal', 'response']
train
https://github.com/IdentityPython/SATOSA/blob/49da5d4c0ac1a5ebf1a71b4f7aaf04f0e52d8fdb/src/satosa/deprecated.py#L155-L201
5,849
Open-ET/openet-core-beta
openet/core/common.py
landsat_c1_toa_cloud_mask
def landsat_c1_toa_cloud_mask(input_img, snow_flag=False, cirrus_flag=False, cloud_confidence=2, shadow_confidence=3, snow_confidence=3, cirrus_confidence=3): """Extract cloud mask from the Landsat Collection 1 TOA BQA band Parameters ---------- ...
python
def landsat_c1_toa_cloud_mask(input_img, snow_flag=False, cirrus_flag=False, cloud_confidence=2, shadow_confidence=3, snow_confidence=3, cirrus_confidence=3): """Extract cloud mask from the Landsat Collection 1 TOA BQA band Parameters ---------- ...
['def', 'landsat_c1_toa_cloud_mask', '(', 'input_img', ',', 'snow_flag', '=', 'False', ',', 'cirrus_flag', '=', 'False', ',', 'cloud_confidence', '=', '2', ',', 'shadow_confidence', '=', '3', ',', 'snow_confidence', '=', '3', ',', 'cirrus_confidence', '=', '3', ')', ':', 'qa_img', '=', 'input_img', '.', 'select', '(', ...
Extract cloud mask from the Landsat Collection 1 TOA BQA band Parameters ---------- input_img : ee.Image Image from a Landsat Collection 1 TOA collection with a BQA band (e.g. LANDSAT/LE07/C01/T1_TOA). snow_flag : bool If true, mask snow pixels (the default is False). cirrus...
['Extract', 'cloud', 'mask', 'from', 'the', 'Landsat', 'Collection', '1', 'TOA', 'BQA', 'band']
train
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/common.py#L6-L80
5,850
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.GetEntry
def GetEntry(self, entry): """ Get an entry. Tree collections are reset (see ``rootpy.tree.treeobject``) Parameters ---------- entry : int entry index Returns ------- ROOT.TTree.GetEntry : int The number of bytes read ...
python
def GetEntry(self, entry): """ Get an entry. Tree collections are reset (see ``rootpy.tree.treeobject``) Parameters ---------- entry : int entry index Returns ------- ROOT.TTree.GetEntry : int The number of bytes read ...
['def', 'GetEntry', '(', 'self', ',', 'entry', ')', ':', 'if', 'not', '(', '0', '<=', 'entry', '<', 'self', '.', 'GetEntries', '(', ')', ')', ':', 'raise', 'IndexError', '(', '"entry index out of range: {0:d}"', '.', 'format', '(', 'entry', ')', ')', 'self', '.', '_buffer', '.', 'reset_collections', '(', ')', 'return',...
Get an entry. Tree collections are reset (see ``rootpy.tree.treeobject``) Parameters ---------- entry : int entry index Returns ------- ROOT.TTree.GetEntry : int The number of bytes read
['Get', 'an', 'entry', '.', 'Tree', 'collections', 'are', 'reset', '(', 'see', 'rootpy', '.', 'tree', '.', 'treeobject', ')']
train
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L386-L404
5,851
Asana/python-asana
asana/resources/gen/stories.py
_Stories.update
def update(self, story, params={}, **options): """Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. P...
python
def update(self, story, params={}, **options): """Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. P...
['def', 'update', '(', 'self', ',', 'story', ',', 'params', '=', '{', '}', ',', '*', '*', 'options', ')', ':', 'path', '=', '"/stories/%s"', '%', '(', 'story', ')', 'return', 'self', '.', 'client', '.', 'put', '(', 'path', ',', 'params', ',', '*', '*', 'options', ')']
Updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of `text` and `html_text` can be specified. Parameters ---------- story : {Id} Globally ...
['Updates', 'the', 'story', 'and', 'returns', 'the', 'full', 'record', 'for', 'the', 'updated', 'story', '.', 'Only', 'comment', 'stories', 'can', 'have', 'their', 'text', 'updated', 'and', 'only', 'comment', 'stories', 'and', 'attachment', 'stories', 'can', 'be', 'pinned', '.', 'Only', 'one', 'of', 'text', 'and', 'htm...
train
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/gen/stories.py#L53-L67
5,852
jpoullet2000/atlasclient
atlasclient/base.py
QueryableModel.create
def create(self, **kwargs): """Create a new instance of this resource type. As a general rule, the identifier should have been provided, but in some subclasses the identifier is server-side-generated. Those classes have to overload this method to deal with that scenario. """ ...
python
def create(self, **kwargs): """Create a new instance of this resource type. As a general rule, the identifier should have been provided, but in some subclasses the identifier is server-side-generated. Those classes have to overload this method to deal with that scenario. """ ...
['def', 'create', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'method', '=', "'post'", 'if', 'self', '.', 'primary_key', 'in', 'kwargs', ':', 'del', 'kwargs', '[', 'self', '.', 'primary_key', ']', 'data', '=', 'self', '.', '_generate_input_dict', '(', '*', '*', 'kwargs', ')', 'self', '.', 'load', '(', ...
Create a new instance of this resource type. As a general rule, the identifier should have been provided, but in some subclasses the identifier is server-side-generated. Those classes have to overload this method to deal with that scenario.
['Create', 'a', 'new', 'instance', 'of', 'this', 'resource', 'type', '.']
train
https://github.com/jpoullet2000/atlasclient/blob/4548b441143ebf7fc4075d113db5ca5a23e0eed2/atlasclient/base.py#L651-L663
5,853
bitesofcode/projex
projex/enum.py
enum.toSet
def toSet(self, flags): """ Generates a flag value based on the given set of values. :param values: <set> :return: <int> """ return {key for key, value in self.items() if value & flags}
python
def toSet(self, flags): """ Generates a flag value based on the given set of values. :param values: <set> :return: <int> """ return {key for key, value in self.items() if value & flags}
['def', 'toSet', '(', 'self', ',', 'flags', ')', ':', 'return', '{', 'key', 'for', 'key', ',', 'value', 'in', 'self', '.', 'items', '(', ')', 'if', 'value', '&', 'flags', '}']
Generates a flag value based on the given set of values. :param values: <set> :return: <int>
['Generates', 'a', 'flag', 'value', 'based', 'on', 'the', 'given', 'set', 'of', 'values', '.']
train
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/enum.py#L245-L253
5,854
ethereum/web3.py
web3/contract.py
Contract.constructor
def constructor(cls, *args, **kwargs): """ :param args: The contract constructor arguments as positional arguments :param kwargs: The contract constructor arguments as keyword arguments :return: a contract constructor object """ if cls.bytecode is None: raise ...
python
def constructor(cls, *args, **kwargs): """ :param args: The contract constructor arguments as positional arguments :param kwargs: The contract constructor arguments as keyword arguments :return: a contract constructor object """ if cls.bytecode is None: raise ...
['def', 'constructor', '(', 'cls', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'cls', '.', 'bytecode', 'is', 'None', ':', 'raise', 'ValueError', '(', '"Cannot call constructor on a contract that does not have \'bytecode\' associated "', '"with it"', ')', 'return', 'ContractConstructor', '(', 'cls', '.', ...
:param args: The contract constructor arguments as positional arguments :param kwargs: The contract constructor arguments as keyword arguments :return: a contract constructor object
[':', 'param', 'args', ':', 'The', 'contract', 'constructor', 'arguments', 'as', 'positional', 'arguments', ':', 'param', 'kwargs', ':', 'The', 'contract', 'constructor', 'arguments', 'as', 'keyword', 'arguments', ':', 'return', ':', 'a', 'contract', 'constructor', 'object']
train
https://github.com/ethereum/web3.py/blob/71b8bf03dc6d332dd97d8902a38ffab6f8b5a5ab/web3/contract.py#L309-L325
5,855
libvips/pyvips
pyvips/gvalue.py
GValue.to_enum
def to_enum(gtype, value): """Turn a string into an enum value ready to be passed into libvips. """ if isinstance(value, basestring if _is_PY2 else str): enum_value = vips_lib.vips_enum_from_nick(b'pyvips', gtype, _to_bytes(valu...
python
def to_enum(gtype, value): """Turn a string into an enum value ready to be passed into libvips. """ if isinstance(value, basestring if _is_PY2 else str): enum_value = vips_lib.vips_enum_from_nick(b'pyvips', gtype, _to_bytes(valu...
['def', 'to_enum', '(', 'gtype', ',', 'value', ')', ':', 'if', 'isinstance', '(', 'value', ',', 'basestring', 'if', '_is_PY2', 'else', 'str', ')', ':', 'enum_value', '=', 'vips_lib', '.', 'vips_enum_from_nick', '(', "b'pyvips'", ',', 'gtype', ',', '_to_bytes', '(', 'value', ')', ')', 'if', 'enum_value', '<', '0', ':', ...
Turn a string into an enum value ready to be passed into libvips.
['Turn', 'a', 'string', 'into', 'an', 'enum', 'value', 'ready', 'to', 'be', 'passed', 'into', 'libvips', '.']
train
https://github.com/libvips/pyvips/blob/f4d9334d2e3085b4b058129f14ac17a7872b109b/pyvips/gvalue.py#L89-L103
5,856
tensorflow/cleverhans
cleverhans/attacks/bapp.py
binary_search_batch
def binary_search_batch(original_image, perturbed_images, decision_function, shape, constraint, theta): """ Binary search to approach the boundary. """ # Compute distance between each of perturbed image and original image. dists_post_update = np.array([ compute_distance( o...
python
def binary_search_batch(original_image, perturbed_images, decision_function, shape, constraint, theta): """ Binary search to approach the boundary. """ # Compute distance between each of perturbed image and original image. dists_post_update = np.array([ compute_distance( o...
['def', 'binary_search_batch', '(', 'original_image', ',', 'perturbed_images', ',', 'decision_function', ',', 'shape', ',', 'constraint', ',', 'theta', ')', ':', '# Compute distance between each of perturbed image and original image.', 'dists_post_update', '=', 'np', '.', 'array', '(', '[', 'compute_distance', '(', 'or...
Binary search to approach the boundary.
['Binary', 'search', 'to', 'approach', 'the', 'boundary', '.']
train
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/attacks/bapp.py#L417-L468
5,857
cggh/scikit-allel
allel/stats/sf.py
plot_sfs_folded_scaled
def plot_sfs_folded_scaled(*args, **kwargs): """Plot a folded scaled site frequency spectrum. Parameters ---------- s : array_like, int, shape (n_chromosomes/2,) Site frequency spectrum. yscale : string, optional Y axis scale. bins : int or array_like, int, optional Alle...
python
def plot_sfs_folded_scaled(*args, **kwargs): """Plot a folded scaled site frequency spectrum. Parameters ---------- s : array_like, int, shape (n_chromosomes/2,) Site frequency spectrum. yscale : string, optional Y axis scale. bins : int or array_like, int, optional Alle...
['def', 'plot_sfs_folded_scaled', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '.', 'setdefault', '(', "'yscale'", ',', "'linear'", ')', 'ax', '=', 'plot_sfs_folded', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', 'ax', '.', 'set_ylabel', '(', "'scaled site frequency'", ')', 'n', '=', 'kwargs', '.', ...
Plot a folded scaled site frequency spectrum. Parameters ---------- s : array_like, int, shape (n_chromosomes/2,) Site frequency spectrum. yscale : string, optional Y axis scale. bins : int or array_like, int, optional Allele count bins. n : int, optional Number ...
['Plot', 'a', 'folded', 'scaled', 'site', 'frequency', 'spectrum', '.']
train
https://github.com/cggh/scikit-allel/blob/3c979a57a100240ba959dd13f98839349530f215/allel/stats/sf.py#L638-L675
5,858
rsinger86/django-lifecycle
django_lifecycle/__init__.py
LifecycleModelMixin._run_hooked_methods
def _run_hooked_methods(self, hook: str): """ Iterate through decorated methods to find those that should be triggered by the current hook. If conditions exist, check them before running otherwise go ahead and run. """ for method in self._potentially_hooked_me...
python
def _run_hooked_methods(self, hook: str): """ Iterate through decorated methods to find those that should be triggered by the current hook. If conditions exist, check them before running otherwise go ahead and run. """ for method in self._potentially_hooked_me...
['def', '_run_hooked_methods', '(', 'self', ',', 'hook', ':', 'str', ')', ':', 'for', 'method', 'in', 'self', '.', '_potentially_hooked_methods', ':', 'for', 'callback_specs', 'in', 'method', '.', '_hooked', ':', 'if', 'callback_specs', '[', "'hook'", ']', '!=', 'hook', ':', 'continue', 'when', '=', 'callback_specs', '...
Iterate through decorated methods to find those that should be triggered by the current hook. If conditions exist, check them before running otherwise go ahead and run.
['Iterate', 'through', 'decorated', 'methods', 'to', 'find', 'those', 'that', 'should', 'be', 'triggered', 'by', 'the', 'current', 'hook', '.', 'If', 'conditions', 'exist', 'check', 'them', 'before', 'running', 'otherwise', 'go', 'ahead', 'and', 'run', '.']
train
https://github.com/rsinger86/django-lifecycle/blob/2196908ef0e242e52aab5bfaa3d337930700c106/django_lifecycle/__init__.py#L228-L245
5,859
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.find_tags
def find_tags(self): """Find information about the tags in the repository.""" listing = self.context.capture('hg', 'tags') for line in listing.splitlines(): tokens = line.split() if len(tokens) >= 2 and ':' in tokens[1]: revision_number, revision_id = toke...
python
def find_tags(self): """Find information about the tags in the repository.""" listing = self.context.capture('hg', 'tags') for line in listing.splitlines(): tokens = line.split() if len(tokens) >= 2 and ':' in tokens[1]: revision_number, revision_id = toke...
['def', 'find_tags', '(', 'self', ')', ':', 'listing', '=', 'self', '.', 'context', '.', 'capture', '(', "'hg'", ',', "'tags'", ')', 'for', 'line', 'in', 'listing', '.', 'splitlines', '(', ')', ':', 'tokens', '=', 'line', '.', 'split', '(', ')', 'if', 'len', '(', 'tokens', ')', '>=', '2', 'and', "':'", 'in', 'tokens', ...
Find information about the tags in the repository.
['Find', 'information', 'about', 'the', 'tags', 'in', 'the', 'repository', '.']
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L180-L192
5,860
cackharot/suds-py3
suds/sax/element.py
Element.resolvePrefix
def resolvePrefix(self, prefix, default=Namespace.default): """ Resolve the specified prefix to a namespace. The I{nsprefixes} is searched. If not found, it walks up the tree until either resolved or the top of the tree is reached. Searching up the tree provides for inherited ...
python
def resolvePrefix(self, prefix, default=Namespace.default): """ Resolve the specified prefix to a namespace. The I{nsprefixes} is searched. If not found, it walks up the tree until either resolved or the top of the tree is reached. Searching up the tree provides for inherited ...
['def', 'resolvePrefix', '(', 'self', ',', 'prefix', ',', 'default', '=', 'Namespace', '.', 'default', ')', ':', 'n', '=', 'self', 'while', 'n', 'is', 'not', 'None', ':', 'if', 'prefix', 'in', 'n', '.', 'nsprefixes', ':', 'return', '(', 'prefix', ',', 'n', '.', 'nsprefixes', '[', 'prefix', ']', ')', 'if', 'prefix', 'in...
Resolve the specified prefix to a namespace. The I{nsprefixes} is searched. If not found, it walks up the tree until either resolved or the top of the tree is reached. Searching up the tree provides for inherited mappings. @param prefix: A namespace prefix to resolve. @type pr...
['Resolve', 'the', 'specified', 'prefix', 'to', 'a', 'namespace', '.', 'The', 'I', '{', 'nsprefixes', '}', 'is', 'searched', '.', 'If', 'not', 'found', 'it', 'walks', 'up', 'the', 'tree', 'until', 'either', 'resolved', 'or', 'the', 'top', 'of', 'the', 'tree', 'is', 'reached', '.', 'Searching', 'up', 'the', 'tree', 'pro...
train
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/sax/element.py#L505-L526
5,861
gem/oq-engine
openquake/hazardlib/site.py
SiteCollection.from_shakemap
def from_shakemap(cls, shakemap_array): """ Build a site collection from a shakemap array """ self = object.__new__(cls) self.complete = self n = len(shakemap_array) dtype = numpy.dtype([(p, site_param_dt[p]) for p in 'sids lon lat dep...
python
def from_shakemap(cls, shakemap_array): """ Build a site collection from a shakemap array """ self = object.__new__(cls) self.complete = self n = len(shakemap_array) dtype = numpy.dtype([(p, site_param_dt[p]) for p in 'sids lon lat dep...
['def', 'from_shakemap', '(', 'cls', ',', 'shakemap_array', ')', ':', 'self', '=', 'object', '.', '__new__', '(', 'cls', ')', 'self', '.', 'complete', '=', 'self', 'n', '=', 'len', '(', 'shakemap_array', ')', 'dtype', '=', 'numpy', '.', 'dtype', '(', '[', '(', 'p', ',', 'site_param_dt', '[', 'p', ']', ')', 'for', 'p', ...
Build a site collection from a shakemap array
['Build', 'a', 'site', 'collection', 'from', 'a', 'shakemap', 'array']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/site.py#L164-L180
5,862
census-instrumentation/opencensus-python
contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/stats_exporter/__init__.py
StackdriverStatsExporter._convert_point
def _convert_point(self, metric, ts, point, sd_point): """Convert an OC metric point to a SD point.""" if (metric.descriptor.type == metric_descriptor.MetricDescriptorType .CUMULATIVE_DISTRIBUTION): sd_dist_val = sd_point.value.distribution_value sd_dist_val.coun...
python
def _convert_point(self, metric, ts, point, sd_point): """Convert an OC metric point to a SD point.""" if (metric.descriptor.type == metric_descriptor.MetricDescriptorType .CUMULATIVE_DISTRIBUTION): sd_dist_val = sd_point.value.distribution_value sd_dist_val.coun...
['def', '_convert_point', '(', 'self', ',', 'metric', ',', 'ts', ',', 'point', ',', 'sd_point', ')', ':', 'if', '(', 'metric', '.', 'descriptor', '.', 'type', '==', 'metric_descriptor', '.', 'MetricDescriptorType', '.', 'CUMULATIVE_DISTRIBUTION', ')', ':', 'sd_dist_val', '=', 'sd_point', '.', 'value', '.', 'distributio...
Convert an OC metric point to a SD point.
['Convert', 'an', 'OC', 'metric', 'point', 'to', 'a', 'SD', 'point', '.']
train
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/stats_exporter/__init__.py#L193-L252
5,863
pytorn/torn
torn/plugins/log.py
warning
def warning(message, code='WARNING'): """Display Warning. Method prints the warning message, message being given as an input. Arguments: message {string} -- The message to be displayed. """ now = datetime.now().strftime('%Y-%m-%d %H:%M:%S') output = now + ' [' + torn.plugins.color...
python
def warning(message, code='WARNING'): """Display Warning. Method prints the warning message, message being given as an input. Arguments: message {string} -- The message to be displayed. """ now = datetime.now().strftime('%Y-%m-%d %H:%M:%S') output = now + ' [' + torn.plugins.color...
['def', 'warning', '(', 'message', ',', 'code', '=', "'WARNING'", ')', ':', 'now', '=', 'datetime', '.', 'now', '(', ')', '.', 'strftime', '(', "'%Y-%m-%d %H:%M:%S'", ')', 'output', '=', 'now', '+', "' ['", '+', 'torn', '.', 'plugins', '.', 'colors', '.', 'WARNING', '+', 'code', '+', 'torn', '.', 'plugins', '.', 'color...
Display Warning. Method prints the warning message, message being given as an input. Arguments: message {string} -- The message to be displayed.
['Display', 'Warning', '.']
train
https://github.com/pytorn/torn/blob/68ba077173a1d22236d570d933dd99a3e3f0040f/torn/plugins/log.py#L10-L24
5,864
richq/cmake-lint
cmakelint/main.py
ProcessLine
def ProcessLine(filename, linenumber, clean_lines, errors): """ Arguments: filename the name of the file linenumber the line number index clean_lines CleansedLines instance errors the error handling function """ CheckLintPragma(filename, linenumber, clean_lines.raw_lines...
python
def ProcessLine(filename, linenumber, clean_lines, errors): """ Arguments: filename the name of the file linenumber the line number index clean_lines CleansedLines instance errors the error handling function """ CheckLintPragma(filename, linenumber, clean_lines.raw_lines...
['def', 'ProcessLine', '(', 'filename', ',', 'linenumber', ',', 'clean_lines', ',', 'errors', ')', ':', 'CheckLintPragma', '(', 'filename', ',', 'linenumber', ',', 'clean_lines', '.', 'raw_lines', '[', 'linenumber', ']', ',', 'errors', ')', 'CheckLineLength', '(', 'filename', ',', 'linenumber', ',', 'clean_lines', ',',...
Arguments: filename the name of the file linenumber the line number index clean_lines CleansedLines instance errors the error handling function
['Arguments', ':', 'filename', 'the', 'name', 'of', 'the', 'file', 'linenumber', 'the', 'line', 'number', 'index', 'clean_lines', 'CleansedLines', 'instance', 'errors', 'the', 'error', 'handling', 'function']
train
https://github.com/richq/cmake-lint/blob/058c6c0ed2536abd3e79a51c38ee6e686568e3b3/cmakelint/main.py#L435-L448
5,865
brainiak/brainiak
brainiak/utils/fmrisim.py
_calc_fwhm
def _calc_fwhm(volume, mask, voxel_size=[1.0, 1.0, 1.0], ): """ Calculate the FWHM of a volume Estimates the FWHM (mm) of a volume's non-masked voxels Parameters ---------- volume : 3 dimensional array Functional data to have the FWHM measured. ...
python
def _calc_fwhm(volume, mask, voxel_size=[1.0, 1.0, 1.0], ): """ Calculate the FWHM of a volume Estimates the FWHM (mm) of a volume's non-masked voxels Parameters ---------- volume : 3 dimensional array Functional data to have the FWHM measured. ...
['def', '_calc_fwhm', '(', 'volume', ',', 'mask', ',', 'voxel_size', '=', '[', '1.0', ',', '1.0', ',', '1.0', ']', ',', ')', ':', '# What are the dimensions of the volume', 'dimensions', '=', 'volume', '.', 'shape', '# Iterate through the TRs, creating a FWHM for each TR', '# Preset', 'v_count', '=', '0', 'v_sum', '=',...
Calculate the FWHM of a volume Estimates the FWHM (mm) of a volume's non-masked voxels Parameters ---------- volume : 3 dimensional array Functional data to have the FWHM measured. mask : 3 dimensional array A binary mask of the brain voxels in volume voxel_size : length 3 li...
['Calculate', 'the', 'FWHM', 'of', 'a', 'volume', 'Estimates', 'the', 'FWHM', '(', 'mm', ')', 'of', 'a', 'volume', 's', 'non', '-', 'masked', 'voxels']
train
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/utils/fmrisim.py#L964-L1069
5,866
saltstack/salt
salt/states/ssh_known_hosts.py
absent
def absent(name, user=None, config=None): ''' Verifies that the specified host is not known by the given user name The host name Note that only single host names are supported. If foo.example.com and bar.example.com are the same machine and you need to exclude both, you wil...
python
def absent(name, user=None, config=None): ''' Verifies that the specified host is not known by the given user name The host name Note that only single host names are supported. If foo.example.com and bar.example.com are the same machine and you need to exclude both, you wil...
['def', 'absent', '(', 'name', ',', 'user', '=', 'None', ',', 'config', '=', 'None', ')', ':', 'ret', '=', '{', "'name'", ':', 'name', ',', "'changes'", ':', '{', '}', ',', "'result'", ':', 'True', ',', "'comment'", ':', "''", '}', 'if', 'not', 'user', ':', 'config', '=', 'config', 'or', "'/etc/ssh/ssh_known_hosts'", '...
Verifies that the specified host is not known by the given user name The host name Note that only single host names are supported. If foo.example.com and bar.example.com are the same machine and you need to exclude both, you will need one Salt state for each. user The ...
['Verifies', 'that', 'the', 'specified', 'host', 'is', 'not', 'known', 'by', 'the', 'given', 'user']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_known_hosts.py#L194-L245
5,867
tensorflow/cleverhans
scripts/compute_accuracy.py
main
def main(argv=None): """ Print accuracies """ try: _name_of_script, filepath = argv except ValueError: raise ValueError(argv) print_accuracies(filepath=filepath, test_start=FLAGS.test_start, test_end=FLAGS.test_end, which_set=FLAGS.which_set, nb_iter=FLAGS.nb_it...
python
def main(argv=None): """ Print accuracies """ try: _name_of_script, filepath = argv except ValueError: raise ValueError(argv) print_accuracies(filepath=filepath, test_start=FLAGS.test_start, test_end=FLAGS.test_end, which_set=FLAGS.which_set, nb_iter=FLAGS.nb_it...
['def', 'main', '(', 'argv', '=', 'None', ')', ':', 'try', ':', '_name_of_script', ',', 'filepath', '=', 'argv', 'except', 'ValueError', ':', 'raise', 'ValueError', '(', 'argv', ')', 'print_accuracies', '(', 'filepath', '=', 'filepath', ',', 'test_start', '=', 'FLAGS', '.', 'test_start', ',', 'test_end', '=', 'FLAGS', ...
Print accuracies
['Print', 'accuracies']
train
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/scripts/compute_accuracy.py#L162-L173
5,868
emory-libraries/eulfedora
eulfedora/models.py
DigitalObject.getProfile
def getProfile(self): """Get information about this object (label, owner, date created, etc.). :rtype: :class:`ObjectProfile` """ if self._create: return ObjectProfile() else: if self._profile is None: r = self.api.getObjectProfile(self.pi...
python
def getProfile(self): """Get information about this object (label, owner, date created, etc.). :rtype: :class:`ObjectProfile` """ if self._create: return ObjectProfile() else: if self._profile is None: r = self.api.getObjectProfile(self.pi...
['def', 'getProfile', '(', 'self', ')', ':', 'if', 'self', '.', '_create', ':', 'return', 'ObjectProfile', '(', ')', 'else', ':', 'if', 'self', '.', '_profile', 'is', 'None', ':', 'r', '=', 'self', '.', 'api', '.', 'getObjectProfile', '(', 'self', '.', 'pid', ')', 'self', '.', '_profile', '=', 'parse_xml_object', '(', ...
Get information about this object (label, owner, date created, etc.). :rtype: :class:`ObjectProfile`
['Get', 'information', 'about', 'this', 'object', '(', 'label', 'owner', 'date', 'created', 'etc', '.', ')', '.']
train
https://github.com/emory-libraries/eulfedora/blob/161826f3fdcdab4007f6fa7dfd9f1ecabc4bcbe4/eulfedora/models.py#L1475-L1486
5,869
EpistasisLab/tpot
tpot/base.py
TPOTBase._check_dataset
def _check_dataset(self, features, target, sample_weight=None): """Check if a dataset has a valid feature set and labels. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} or None List of clas...
python
def _check_dataset(self, features, target, sample_weight=None): """Check if a dataset has a valid feature set and labels. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} or None List of clas...
['def', '_check_dataset', '(', 'self', ',', 'features', ',', 'target', ',', 'sample_weight', '=', 'None', ')', ':', '# Check sample_weight', 'if', 'sample_weight', 'is', 'not', 'None', ':', 'try', ':', 'sample_weight', '=', 'np', '.', 'array', '(', 'sample_weight', ')', '.', 'astype', '(', "'float'", ')', 'except', 'Va...
Check if a dataset has a valid feature set and labels. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} or None List of class labels for prediction sample_weight: array-like {n_samples} (opti...
['Check', 'if', 'a', 'dataset', 'has', 'a', 'valid', 'feature', 'set', 'and', 'labels', '.']
train
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1137-L1205
5,870
catherinedevlin/ddl-generator
ddlgenerator/typehelpers.py
coerce_to_specific
def coerce_to_specific(datum): """ Coerces datum to the most specific data type possible Order of preference: datetime, boolean, integer, decimal, float, string >>> coerce_to_specific('-000000001854.60') Decimal('-1854.60') >>> coerce_to_specific(7.2) Decimal('7.2') >>> coerce_to_specif...
python
def coerce_to_specific(datum): """ Coerces datum to the most specific data type possible Order of preference: datetime, boolean, integer, decimal, float, string >>> coerce_to_specific('-000000001854.60') Decimal('-1854.60') >>> coerce_to_specific(7.2) Decimal('7.2') >>> coerce_to_specif...
['def', 'coerce_to_specific', '(', 'datum', ')', ':', 'if', 'datum', 'is', 'None', ':', 'return', 'None', 'try', ':', 'result', '=', 'dateutil', '.', 'parser', '.', 'parse', '(', 'datum', ')', '# but even if this does not raise an exception, may', "# not be a date -- dateutil's parser is very aggressive", '# check for ...
Coerces datum to the most specific data type possible Order of preference: datetime, boolean, integer, decimal, float, string >>> coerce_to_specific('-000000001854.60') Decimal('-1854.60') >>> coerce_to_specific(7.2) Decimal('7.2') >>> coerce_to_specific("Jan 17 2012") datetime.datetime(201...
['Coerces', 'datum', 'to', 'the', 'most', 'specific', 'data', 'type', 'possible', 'Order', 'of', 'preference', ':', 'datetime', 'boolean', 'integer', 'decimal', 'float', 'string']
train
https://github.com/catherinedevlin/ddl-generator/blob/db6741216d1e9ad84b07d4ad281bfff021d344ea/ddlgenerator/typehelpers.py#L51-L112
5,871
evhub/coconut
conf.py
PatchedAutoStructify.patched_nested_parse
def patched_nested_parse(self, *args, **kwargs): """Sets match_titles then calls stored_nested_parse.""" kwargs["match_titles"] = True return self.stored_nested_parse(*args, **kwargs)
python
def patched_nested_parse(self, *args, **kwargs): """Sets match_titles then calls stored_nested_parse.""" kwargs["match_titles"] = True return self.stored_nested_parse(*args, **kwargs)
['def', 'patched_nested_parse', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', '"match_titles"', ']', '=', 'True', 'return', 'self', '.', 'stored_nested_parse', '(', '*', 'args', ',', '*', '*', 'kwargs', ')']
Sets match_titles then calls stored_nested_parse.
['Sets', 'match_titles', 'then', 'calls', 'stored_nested_parse', '.']
train
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/conf.py#L81-L84
5,872
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.bind
def bind(self, destination='', source='', routing_key='', virtual_host='/', arguments=None): """Bind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virt...
python
def bind(self, destination='', source='', routing_key='', virtual_host='/', arguments=None): """Bind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virt...
['def', 'bind', '(', 'self', ',', 'destination', '=', "''", ',', 'source', '=', "''", ',', 'routing_key', '=', "''", ',', 'virtual_host', '=', "'/'", ',', 'arguments', '=', 'None', ')', ':', 'bind_payload', '=', 'json', '.', 'dumps', '(', '{', "'destination'", ':', 'destination', ',', "'destination_type'", ':', "'e'", ...
Bind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name :param dict|None arguments: Bind key/value arguments :raises ApiError: R...
['Bind', 'an', 'Exchange', '.']
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L125-L155
5,873
IvanMalison/okcupyd
okcupyd/profile.py
Profile.authcode_post
def authcode_post(self, path, **kwargs): """Perform an HTTP POST to okcupid.com using this profiles session where the authcode is automatically added as a form item. """ kwargs.setdefault('data', {})['authcode'] = self.authcode return self._session.okc_post(path, **kwargs)
python
def authcode_post(self, path, **kwargs): """Perform an HTTP POST to okcupid.com using this profiles session where the authcode is automatically added as a form item. """ kwargs.setdefault('data', {})['authcode'] = self.authcode return self._session.okc_post(path, **kwargs)
['def', 'authcode_post', '(', 'self', ',', 'path', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '.', 'setdefault', '(', "'data'", ',', '{', '}', ')', '[', "'authcode'", ']', '=', 'self', '.', 'authcode', 'return', 'self', '.', '_session', '.', 'okc_post', '(', 'path', ',', '*', '*', 'kwargs', ')']
Perform an HTTP POST to okcupid.com using this profiles session where the authcode is automatically added as a form item.
['Perform', 'an', 'HTTP', 'POST', 'to', 'okcupid', '.', 'com', 'using', 'this', 'profiles', 'session', 'where', 'the', 'authcode', 'is', 'automatically', 'added', 'as', 'a', 'form', 'item', '.']
train
https://github.com/IvanMalison/okcupyd/blob/46f4eaa9419098f6c299738ce148af55c64deb64/okcupyd/profile.py#L374-L379
5,874
shotastage/mirage-django-lts
mirage/proj/environ.py
MirageEnvironment.search_project_root
def search_project_root(): """ Search your Django project root. returns: - path:string Django project root path """ while True: current = os.getcwd() if pathlib.Path("Miragefile.py").is_file() or pathlib.Path("Miragefile").is_file(): ...
python
def search_project_root(): """ Search your Django project root. returns: - path:string Django project root path """ while True: current = os.getcwd() if pathlib.Path("Miragefile.py").is_file() or pathlib.Path("Miragefile").is_file(): ...
['def', 'search_project_root', '(', ')', ':', 'while', 'True', ':', 'current', '=', 'os', '.', 'getcwd', '(', ')', 'if', 'pathlib', '.', 'Path', '(', '"Miragefile.py"', ')', '.', 'is_file', '(', ')', 'or', 'pathlib', '.', 'Path', '(', '"Miragefile"', ')', '.', 'is_file', '(', ')', ':', 'return', 'current', 'elif', 'os'...
Search your Django project root. returns: - path:string Django project root path
['Search', 'your', 'Django', 'project', 'root', '.']
train
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L61-L78
5,875
openstack/horizon
openstack_dashboard/api/neutron.py
rbac_policy_update
def rbac_policy_update(request, policy_id, **kwargs): """Update a RBAC Policy. :param request: request context :param policy_id: target policy id :param target_tenant: target tenant of the policy :return: RBACPolicy object """ body = {'rbac_policy': kwargs} rbac_policy = neutronclient(r...
python
def rbac_policy_update(request, policy_id, **kwargs): """Update a RBAC Policy. :param request: request context :param policy_id: target policy id :param target_tenant: target tenant of the policy :return: RBACPolicy object """ body = {'rbac_policy': kwargs} rbac_policy = neutronclient(r...
['def', 'rbac_policy_update', '(', 'request', ',', 'policy_id', ',', '*', '*', 'kwargs', ')', ':', 'body', '=', '{', "'rbac_policy'", ':', 'kwargs', '}', 'rbac_policy', '=', 'neutronclient', '(', 'request', ')', '.', 'update_rbac_policy', '(', 'policy_id', ',', 'body', '=', 'body', ')', '.', 'get', '(', "'rbac_policy'"...
Update a RBAC Policy. :param request: request context :param policy_id: target policy id :param target_tenant: target tenant of the policy :return: RBACPolicy object
['Update', 'a', 'RBAC', 'Policy', '.']
train
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/neutron.py#L2025-L2036
5,876
benhoff/pluginmanager
pluginmanager/plugin_interface.py
PluginInterface.add_plugin_filepaths
def add_plugin_filepaths(self, filepaths, except_blacklisted=True): """ Adds `filepaths` to internal state. Recommend passing in absolute filepaths. Method will attempt to convert to absolute paths if they are not already. `filepaths` can be a single object or an iterable ...
python
def add_plugin_filepaths(self, filepaths, except_blacklisted=True): """ Adds `filepaths` to internal state. Recommend passing in absolute filepaths. Method will attempt to convert to absolute paths if they are not already. `filepaths` can be a single object or an iterable ...
['def', 'add_plugin_filepaths', '(', 'self', ',', 'filepaths', ',', 'except_blacklisted', '=', 'True', ')', ':', 'self', '.', 'file_manager', '.', 'add_plugin_filepaths', '(', 'filepaths', ',', 'except_blacklisted', ')']
Adds `filepaths` to internal state. Recommend passing in absolute filepaths. Method will attempt to convert to absolute paths if they are not already. `filepaths` can be a single object or an iterable If `except_blacklisted` is `True`, all `filepaths` that have been blacklisted...
['Adds', 'filepaths', 'to', 'internal', 'state', '.', 'Recommend', 'passing', 'in', 'absolute', 'filepaths', '.', 'Method', 'will', 'attempt', 'to', 'convert', 'to', 'absolute', 'paths', 'if', 'they', 'are', 'not', 'already', '.']
train
https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_interface.py#L214-L226
5,877
aio-libs/aiohttp
aiohttp/multipart.py
MultipartWriter.write
async def write(self, writer: Any, close_boundary: bool=True) -> None: """Write body.""" if not self._parts: return for part, encoding, te_encoding in self._parts: await writer.write(b'--' + self._boundary + b'\r\n') await writer.write(par...
python
async def write(self, writer: Any, close_boundary: bool=True) -> None: """Write body.""" if not self._parts: return for part, encoding, te_encoding in self._parts: await writer.write(b'--' + self._boundary + b'\r\n') await writer.write(par...
['async', 'def', 'write', '(', 'self', ',', 'writer', ':', 'Any', ',', 'close_boundary', ':', 'bool', '=', 'True', ')', '->', 'None', ':', 'if', 'not', 'self', '.', '_parts', ':', 'return', 'for', 'part', ',', 'encoding', ',', 'te_encoding', 'in', 'self', '.', '_parts', ':', 'await', 'writer', '.', 'write', '(', "b'--'...
Write body.
['Write', 'body', '.']
train
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/multipart.py#L883-L907
5,878
python-openxml/python-docx
docx/section.py
_Footer._drop_definition
def _drop_definition(self): """Remove footer definition (footer part) associated with this section.""" rId = self._sectPr.remove_footerReference(self._hdrftr_index) self._document_part.drop_rel(rId)
python
def _drop_definition(self): """Remove footer definition (footer part) associated with this section.""" rId = self._sectPr.remove_footerReference(self._hdrftr_index) self._document_part.drop_rel(rId)
['def', '_drop_definition', '(', 'self', ')', ':', 'rId', '=', 'self', '.', '_sectPr', '.', 'remove_footerReference', '(', 'self', '.', '_hdrftr_index', ')', 'self', '.', '_document_part', '.', 'drop_rel', '(', 'rId', ')']
Remove footer definition (footer part) associated with this section.
['Remove', 'footer', 'definition', '(', 'footer', 'part', ')', 'associated', 'with', 'this', 'section', '.']
train
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/section.py#L381-L384
5,879
floydhub/floyd-cli
floyd/cli/experiment.py
info
def info(job_name_or_id): """ View detailed information of a job. """ try: experiment = ExperimentClient().get(normalize_job_name(job_name_or_id)) except FloydException: experiment = ExperimentClient().get(job_name_or_id) task_instance_id = get_module_task_instance_id(experiment...
python
def info(job_name_or_id): """ View detailed information of a job. """ try: experiment = ExperimentClient().get(normalize_job_name(job_name_or_id)) except FloydException: experiment = ExperimentClient().get(job_name_or_id) task_instance_id = get_module_task_instance_id(experiment...
['def', 'info', '(', 'job_name_or_id', ')', ':', 'try', ':', 'experiment', '=', 'ExperimentClient', '(', ')', '.', 'get', '(', 'normalize_job_name', '(', 'job_name_or_id', ')', ')', 'except', 'FloydException', ':', 'experiment', '=', 'ExperimentClient', '(', ')', '.', 'get', '(', 'job_name_or_id', ')', 'task_instance_i...
View detailed information of a job.
['View', 'detailed', 'information', 'of', 'a', 'job', '.']
train
https://github.com/floydhub/floyd-cli/blob/ea6b9521119cbde2dfc71ce0cc87c0d9c143fc6c/floyd/cli/experiment.py#L166-L189
5,880
kkroening/ffmpeg-python
ffmpeg/_run.py
compile
def compile(stream_spec, cmd='ffmpeg', overwrite_output=False): """Build command-line for invoking ffmpeg. The :meth:`run` function uses this to build the commnad line arguments and should work in most cases, but calling this function directly is useful for debugging or if you need to invoke ffmpeg ...
python
def compile(stream_spec, cmd='ffmpeg', overwrite_output=False): """Build command-line for invoking ffmpeg. The :meth:`run` function uses this to build the commnad line arguments and should work in most cases, but calling this function directly is useful for debugging or if you need to invoke ffmpeg ...
['def', 'compile', '(', 'stream_spec', ',', 'cmd', '=', "'ffmpeg'", ',', 'overwrite_output', '=', 'False', ')', ':', 'if', 'isinstance', '(', 'cmd', ',', 'basestring', ')', ':', 'cmd', '=', '[', 'cmd', ']', 'elif', 'type', '(', 'cmd', ')', '!=', 'list', ':', 'cmd', '=', 'list', '(', 'cmd', ')', 'return', 'cmd', '+', 'g...
Build command-line for invoking ffmpeg. The :meth:`run` function uses this to build the commnad line arguments and should work in most cases, but calling this function directly is useful for debugging or if you need to invoke ffmpeg manually for whatever reason. This is the same as calling :meth:`...
['Build', 'command', '-', 'line', 'for', 'invoking', 'ffmpeg', '.']
train
https://github.com/kkroening/ffmpeg-python/blob/ac111dc3a976ddbb872bc7d6d4fe24a267c1a956/ffmpeg/_run.py#L158-L173
5,881
aio-libs/aiohttp
aiohttp/web_response.py
StreamResponse.set_cookie
def set_cookie(self, name: str, value: str, *, expires: Optional[str]=None, domain: Optional[str]=None, max_age: Optional[Union[int, str]]=None, path: str='/', secure: Optional[str]=None, httponly: Optional...
python
def set_cookie(self, name: str, value: str, *, expires: Optional[str]=None, domain: Optional[str]=None, max_age: Optional[Union[int, str]]=None, path: str='/', secure: Optional[str]=None, httponly: Optional...
['def', 'set_cookie', '(', 'self', ',', 'name', ':', 'str', ',', 'value', ':', 'str', ',', '*', ',', 'expires', ':', 'Optional', '[', 'str', ']', '=', 'None', ',', 'domain', ':', 'Optional', '[', 'str', ']', '=', 'None', ',', 'max_age', ':', 'Optional', '[', 'Union', '[', 'int', ',', 'str', ']', ']', '=', 'None', ',', ...
Set or update response cookie. Sets new cookie or updates existent with new value. Also updates only those params which are not None.
['Set', 'or', 'update', 'response', 'cookie', '.']
train
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/web_response.py#L179-L221
5,882
arne-cl/discoursegraphs
src/discoursegraphs/readwrite/dot.py
quote_for_pydot
def quote_for_pydot(string): """ takes a string (or int) and encloses it with "-chars. if the string contains "-chars itself, they will be escaped. """ if isinstance(string, int): string = str(string) escaped_str = QUOTE_RE.sub(r'\\"', string) return u'"{}"'.format(escaped_str)
python
def quote_for_pydot(string): """ takes a string (or int) and encloses it with "-chars. if the string contains "-chars itself, they will be escaped. """ if isinstance(string, int): string = str(string) escaped_str = QUOTE_RE.sub(r'\\"', string) return u'"{}"'.format(escaped_str)
['def', 'quote_for_pydot', '(', 'string', ')', ':', 'if', 'isinstance', '(', 'string', ',', 'int', ')', ':', 'string', '=', 'str', '(', 'string', ')', 'escaped_str', '=', 'QUOTE_RE', '.', 'sub', '(', 'r\'\\\\"\'', ',', 'string', ')', 'return', 'u\'"{}"\'', '.', 'format', '(', 'escaped_str', ')']
takes a string (or int) and encloses it with "-chars. if the string contains "-chars itself, they will be escaped.
['takes', 'a', 'string', '(', 'or', 'int', ')', 'and', 'encloses', 'it', 'with', '-', 'chars', '.', 'if', 'the', 'string', 'contains', '-', 'chars', 'itself', 'they', 'will', 'be', 'escaped', '.']
train
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/readwrite/dot.py#L20-L28
5,883
saltstack/salt
salt/thorium/__init__.py
ThorState.call_runtime
def call_runtime(self): ''' Execute the runtime ''' cache = self.gather_cache() chunks = self.get_chunks() interval = self.opts['thorium_interval'] recompile = self.opts.get('thorium_recompile', 300) r_start = time.time() while True: ev...
python
def call_runtime(self): ''' Execute the runtime ''' cache = self.gather_cache() chunks = self.get_chunks() interval = self.opts['thorium_interval'] recompile = self.opts.get('thorium_recompile', 300) r_start = time.time() while True: ev...
['def', 'call_runtime', '(', 'self', ')', ':', 'cache', '=', 'self', '.', 'gather_cache', '(', ')', 'chunks', '=', 'self', '.', 'get_chunks', '(', ')', 'interval', '=', 'self', '.', 'opts', '[', "'thorium_interval'", ']', 'recompile', '=', 'self', '.', 'opts', '.', 'get', '(', "'thorium_recompile'", ',', '300', ')', 'r...
Execute the runtime
['Execute', 'the', 'runtime']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/__init__.py#L163-L190
5,884
IdentityPython/oidcendpoint
src/oidcendpoint/user_authn/user.py
factory
def factory(cls, **kwargs): """ Factory method that can be used to easily instantiate a class instance :param cls: The name of the class :param kwargs: Keyword arguments :return: An instance of the class or None if the name doesn't match any known class. """ for name, obj in inspect...
python
def factory(cls, **kwargs): """ Factory method that can be used to easily instantiate a class instance :param cls: The name of the class :param kwargs: Keyword arguments :return: An instance of the class or None if the name doesn't match any known class. """ for name, obj in inspect...
['def', 'factory', '(', 'cls', ',', '*', '*', 'kwargs', ')', ':', 'for', 'name', ',', 'obj', 'in', 'inspect', '.', 'getmembers', '(', 'sys', '.', 'modules', '[', '__name__', ']', ')', ':', 'if', 'inspect', '.', 'isclass', '(', 'obj', ')', 'and', 'issubclass', '(', 'obj', ',', 'UserAuthnMethod', ')', ':', 'try', ':', 'i...
Factory method that can be used to easily instantiate a class instance :param cls: The name of the class :param kwargs: Keyword arguments :return: An instance of the class or None if the name doesn't match any known class.
['Factory', 'method', 'that', 'can', 'be', 'used', 'to', 'easily', 'instantiate', 'a', 'class', 'instance']
train
https://github.com/IdentityPython/oidcendpoint/blob/6c1d729d51bfb6332816117fe476073df7a1d823/src/oidcendpoint/user_authn/user.py#L301-L316
5,885
PmagPy/PmagPy
programs/demag_gui.py
Demag_GUI.read_redo_file
def read_redo_file(self, redo_file): """ Reads a .redo formated file and replaces all current interpretations with interpretations taken from the .redo file Parameters ---------- redo_file : path to .redo file to read """ if not self.clear_interpretations...
python
def read_redo_file(self, redo_file): """ Reads a .redo formated file and replaces all current interpretations with interpretations taken from the .redo file Parameters ---------- redo_file : path to .redo file to read """ if not self.clear_interpretations...
['def', 'read_redo_file', '(', 'self', ',', 'redo_file', ')', ':', 'if', 'not', 'self', '.', 'clear_interpretations', '(', ')', ':', 'return', 'print', '(', '"-I- read redo file and processing new bounds"', ')', 'fin', '=', 'open', '(', 'redo_file', ',', "'r'", ')', 'new_s', '=', '""', 'for', 'Line', 'in', 'fin', '.', ...
Reads a .redo formated file and replaces all current interpretations with interpretations taken from the .redo file Parameters ---------- redo_file : path to .redo file to read
['Reads', 'a', '.', 'redo', 'formated', 'file', 'and', 'replaces', 'all', 'current', 'interpretations', 'with', 'interpretations', 'taken', 'from', 'the', '.', 'redo', 'file']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/demag_gui.py#L4746-L4799
5,886
OzymandiasTheGreat/python-libinput
libinput/event.py
TabletPadEvent.strip_position
def strip_position(self): """The current position of the strip, normalized to the range [0, 1], with 0 being the top/left-most point in the tablet's current logical orientation. If the source is :attr:`~libinput.constant.TabletPadStripAxisSource.FINGER`, libinput sends a terminating event with a value of -...
python
def strip_position(self): """The current position of the strip, normalized to the range [0, 1], with 0 being the top/left-most point in the tablet's current logical orientation. If the source is :attr:`~libinput.constant.TabletPadStripAxisSource.FINGER`, libinput sends a terminating event with a value of -...
['def', 'strip_position', '(', 'self', ')', ':', 'if', 'self', '.', 'type', '!=', 'EventType', '.', 'TABLET_PAD_STRIP', ':', 'raise', 'AttributeError', '(', '_wrong_prop', '.', 'format', '(', 'self', '.', 'type', ')', ')', 'return', 'self', '.', '_libinput', '.', 'libinput_event_tablet_pad_get_strip_position', '(', 'se...
The current position of the strip, normalized to the range [0, 1], with 0 being the top/left-most point in the tablet's current logical orientation. If the source is :attr:`~libinput.constant.TabletPadStripAxisSource.FINGER`, libinput sends a terminating event with a value of -1 when the finger is lifted f...
['The', 'current', 'position', 'of', 'the', 'strip', 'normalized', 'to', 'the', 'range', '[', '0', '1', ']', 'with', '0', 'being', 'the', 'top', '/', 'left', '-', 'most', 'point', 'in', 'the', 'tablet', 's', 'current', 'logical', 'orientation', '.']
train
https://github.com/OzymandiasTheGreat/python-libinput/blob/1f477ee9f1d56b284b20e0317ea8967c64ef1218/libinput/event.py#L1520-L1545
5,887
DataONEorg/d1_python
client_cli/src/d1_cli/impl/command_parser.py
CLI.do_run
def do_run(self, line): """run Perform each operation in the queue of write operations.""" self._split_args(line, 0, 0) self._command_processor.get_operation_queue().execute() self._print_info_if_verbose( "All operations in the write queue were successfully executed" ...
python
def do_run(self, line): """run Perform each operation in the queue of write operations.""" self._split_args(line, 0, 0) self._command_processor.get_operation_queue().execute() self._print_info_if_verbose( "All operations in the write queue were successfully executed" ...
['def', 'do_run', '(', 'self', ',', 'line', ')', ':', 'self', '.', '_split_args', '(', 'line', ',', '0', ',', '0', ')', 'self', '.', '_command_processor', '.', 'get_operation_queue', '(', ')', '.', 'execute', '(', ')', 'self', '.', '_print_info_if_verbose', '(', '"All operations in the write queue were successfully exe...
run Perform each operation in the queue of write operations.
['run', 'Perform', 'each', 'operation', 'in', 'the', 'queue', 'of', 'write', 'operations', '.']
train
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/client_cli/src/d1_cli/impl/command_parser.py#L499-L505
5,888
TeamHG-Memex/eli5
eli5/sklearn/unhashing.py
FeatureUnhasher.recalculate_attributes
def recalculate_attributes(self, force=False): # type: (bool) -> None """ Update all computed attributes. It is only needed if you need to access computed attributes after :meth:`patrial_fit` was called. """ if not self._attributes_dirty and not force: return ...
python
def recalculate_attributes(self, force=False): # type: (bool) -> None """ Update all computed attributes. It is only needed if you need to access computed attributes after :meth:`patrial_fit` was called. """ if not self._attributes_dirty and not force: return ...
['def', 'recalculate_attributes', '(', 'self', ',', 'force', '=', 'False', ')', ':', '# type: (bool) -> None', 'if', 'not', 'self', '.', '_attributes_dirty', 'and', 'not', 'force', ':', 'return', 'terms', '=', '[', 'term', 'for', 'term', ',', '_', 'in', 'self', '.', '_term_counts', '.', 'most_common', '(', ')', ']', 'i...
Update all computed attributes. It is only needed if you need to access computed attributes after :meth:`patrial_fit` was called.
['Update', 'all', 'computed', 'attributes', '.', 'It', 'is', 'only', 'needed', 'if', 'you', 'need', 'to', 'access', 'computed', 'attributes', 'after', ':', 'meth', ':', 'patrial_fit', 'was', 'called', '.']
train
https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/unhashing.py#L166-L188
5,889
alorence/pysvg-py3
pysvg/core.py
BaseElement.save
def save(self, filename, encoding ='ISO-8859-1', standalone='no'): """ Stores any element in a svg file (including header). Calling this method only makes sense if the root element is an svg elemnt """ f = codecs.open(filename, 'w', encoding) s = self.wrap_xml(self.getXM...
python
def save(self, filename, encoding ='ISO-8859-1', standalone='no'): """ Stores any element in a svg file (including header). Calling this method only makes sense if the root element is an svg elemnt """ f = codecs.open(filename, 'w', encoding) s = self.wrap_xml(self.getXM...
['def', 'save', '(', 'self', ',', 'filename', ',', 'encoding', '=', "'ISO-8859-1'", ',', 'standalone', '=', "'no'", ')', ':', 'f', '=', 'codecs', '.', 'open', '(', 'filename', ',', "'w'", ',', 'encoding', ')', 's', '=', 'self', '.', 'wrap_xml', '(', 'self', '.', 'getXML', '(', ')', ',', 'encoding', ',', 'standalone', '...
Stores any element in a svg file (including header). Calling this method only makes sense if the root element is an svg elemnt
['Stores', 'any', 'element', 'in', 'a', 'svg', 'file', '(', 'including', 'header', ')', '.', 'Calling', 'this', 'method', 'only', 'makes', 'sense', 'if', 'the', 'root', 'element', 'is', 'an', 'svg', 'elemnt']
train
https://github.com/alorence/pysvg-py3/blob/ce217a4da3ada44a71d3e2f391d37c67d95c724e/pysvg/core.py#L140-L149
5,890
swisscom/cleanerversion
versions/models.py
Versionable.detach
def detach(self): """ Detaches the instance from its history. Similar to creating a new object with the same field values. The id and identity fields are set to a new value. The returned object has not been saved, call save() afterwards when you are ready to persist the ...
python
def detach(self): """ Detaches the instance from its history. Similar to creating a new object with the same field values. The id and identity fields are set to a new value. The returned object has not been saved, call save() afterwards when you are ready to persist the ...
['def', 'detach', '(', 'self', ')', ':', 'self', '.', 'id', '=', 'self', '.', 'identity', '=', 'self', '.', 'uuid', '(', ')', 'self', '.', 'version_start_date', '=', 'self', '.', 'version_birth_date', '=', 'get_utc_now', '(', ')', 'self', '.', 'version_end_date', '=', 'None', 'return', 'self']
Detaches the instance from its history. Similar to creating a new object with the same field values. The id and identity fields are set to a new value. The returned object has not been saved, call save() afterwards when you are ready to persist the object. ManyToMany and revers...
['Detaches', 'the', 'instance', 'from', 'its', 'history', '.']
train
https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/models.py#L1013-L1030
5,891
pazz/alot
alot/db/manager.py
DBManager.get_named_queries
def get_named_queries(self): """ returns the named queries stored in the database. :rtype: dict (str -> str) mapping alias to full query string """ db = Database(path=self.path) return {k[6:]: v for k, v in db.get_configs('query.')}
python
def get_named_queries(self): """ returns the named queries stored in the database. :rtype: dict (str -> str) mapping alias to full query string """ db = Database(path=self.path) return {k[6:]: v for k, v in db.get_configs('query.')}
['def', 'get_named_queries', '(', 'self', ')', ':', 'db', '=', 'Database', '(', 'path', '=', 'self', '.', 'path', ')', 'return', '{', 'k', '[', '6', ':', ']', ':', 'v', 'for', 'k', ',', 'v', 'in', 'db', '.', 'get_configs', '(', "'query.'", ')', '}']
returns the named queries stored in the database. :rtype: dict (str -> str) mapping alias to full query string
['returns', 'the', 'named', 'queries', 'stored', 'in', 'the', 'database', '.', ':', 'rtype', ':', 'dict', '(', 'str', '-', '>', 'str', ')', 'mapping', 'alias', 'to', 'full', 'query', 'string']
train
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/db/manager.py#L306-L312
5,892
PythonCharmers/python-future
src/future/backports/urllib/robotparser.py
Entry.allowance
def allowance(self, filename): """Preconditions: - our agent applies to this entry - filename is URL decoded""" for line in self.rulelines: if line.applies_to(filename): return line.allowance return True
python
def allowance(self, filename): """Preconditions: - our agent applies to this entry - filename is URL decoded""" for line in self.rulelines: if line.applies_to(filename): return line.allowance return True
['def', 'allowance', '(', 'self', ',', 'filename', ')', ':', 'for', 'line', 'in', 'self', '.', 'rulelines', ':', 'if', 'line', '.', 'applies_to', '(', 'filename', ')', ':', 'return', 'line', '.', 'allowance', 'return', 'True']
Preconditions: - our agent applies to this entry - filename is URL decoded
['Preconditions', ':', '-', 'our', 'agent', 'applies', 'to', 'this', 'entry', '-', 'filename', 'is', 'URL', 'decoded']
train
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/robotparser.py#L204-L211
5,893
paramiko/paramiko
paramiko/pkey.py
PKey._write_private_key_file
def _write_private_key_file(self, filename, key, format, password=None): """ Write an SSH2-format private key file in a form that can be read by paramiko or openssh. If no password is given, the key is written in a trivially-encoded format (base64) which is completely insecure. If ...
python
def _write_private_key_file(self, filename, key, format, password=None): """ Write an SSH2-format private key file in a form that can be read by paramiko or openssh. If no password is given, the key is written in a trivially-encoded format (base64) which is completely insecure. If ...
['def', '_write_private_key_file', '(', 'self', ',', 'filename', ',', 'key', ',', 'format', ',', 'password', '=', 'None', ')', ':', 'with', 'open', '(', 'filename', ',', '"w"', ')', 'as', 'f', ':', 'os', '.', 'chmod', '(', 'filename', ',', 'o600', ')', 'self', '.', '_write_private_key', '(', 'f', ',', 'key', ',', 'form...
Write an SSH2-format private key file in a form that can be read by paramiko or openssh. If no password is given, the key is written in a trivially-encoded format (base64) which is completely insecure. If a password is given, DES-EDE3-CBC is used. :param str tag: ``"RSA"``...
['Write', 'an', 'SSH2', '-', 'format', 'private', 'key', 'file', 'in', 'a', 'form', 'that', 'can', 'be', 'read', 'by', 'paramiko', 'or', 'openssh', '.', 'If', 'no', 'password', 'is', 'given', 'the', 'key', 'is', 'written', 'in', 'a', 'trivially', '-', 'encoded', 'format', '(', 'base64', ')', 'which', 'is', 'completely'...
train
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/pkey.py#L340-L357
5,894
saltstack/salt
salt/modules/arista_pyeapi.py
config
def config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' Configures the node with the specified commands. This method is used to send configuration commands to the node....
python
def config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' Configures the node with the specified commands. This method is used to send configuration commands to the node....
['def', 'config', '(', 'commands', '=', 'None', ',', 'config_file', '=', 'None', ',', 'template_engine', '=', "'jinja'", ',', 'context', '=', 'None', ',', 'defaults', '=', 'None', ',', 'saltenv', '=', "'base'", ',', '*', '*', 'kwargs', ')', ':', 'initial_config', '=', 'get_config', '(', 'as_string', '=', 'True', ',', '...
Configures the node with the specified commands. This method is used to send configuration commands to the node. It will take either a string or a list and prepend the necessary commands to put the session into config mode. Returns the diff after the configuration commands are loaded. config_fil...
['Configures', 'the', 'node', 'with', 'the', 'specified', 'commands', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/arista_pyeapi.py#L396-L534
5,895
ynop/audiomate
audiomate/tracks/container.py
ContainerTrack.read_frames
def read_frames(self, frame_size, hop_size, offset=0, duration=None, block_size=None): """ Generator that reads and returns the samples of the track in frames. Args: frame_size (int): The number of samples per frame. hop_size (int): The number of samp...
python
def read_frames(self, frame_size, hop_size, offset=0, duration=None, block_size=None): """ Generator that reads and returns the samples of the track in frames. Args: frame_size (int): The number of samples per frame. hop_size (int): The number of samp...
['def', 'read_frames', '(', 'self', ',', 'frame_size', ',', 'hop_size', ',', 'offset', '=', '0', ',', 'duration', '=', 'None', ',', 'block_size', '=', 'None', ')', ':', 'with', 'self', '.', 'container', '.', 'open_if_needed', '(', 'mode', '=', "'r'", ')', 'as', 'cnt', ':', 'samples', ',', 'sr', '=', 'cnt', '.', 'get', ...
Generator that reads and returns the samples of the track in frames. Args: frame_size (int): The number of samples per frame. hop_size (int): The number of samples between two frames. offset (float): The time in seconds, from where to start readin...
['Generator', 'that', 'reads', 'and', 'returns', 'the', 'samples', 'of', 'the', 'track', 'in', 'frames', '.']
train
https://github.com/ynop/audiomate/blob/61727920b23a708293c3d526fa3000d4de9c6c21/audiomate/tracks/container.py#L117-L155
5,896
biocore/mustached-octo-ironman
moi/group.py
Group.unlisten_to_node
def unlisten_to_node(self, id_): """Stop listening to a job Parameters ---------- id_ : str An ID to remove Returns -------- str or None The ID removed or None if the ID was not removed """ id_pubsub = _pubsub_key(id_) ...
python
def unlisten_to_node(self, id_): """Stop listening to a job Parameters ---------- id_ : str An ID to remove Returns -------- str or None The ID removed or None if the ID was not removed """ id_pubsub = _pubsub_key(id_) ...
['def', 'unlisten_to_node', '(', 'self', ',', 'id_', ')', ':', 'id_pubsub', '=', '_pubsub_key', '(', 'id_', ')', 'if', 'id_pubsub', 'in', 'self', '.', '_listening_to', ':', 'del', 'self', '.', '_listening_to', '[', 'id_pubsub', ']', 'self', '.', 'toredis', '.', 'unsubscribe', '(', 'id_pubsub', ')', 'parent', '=', 'json...
Stop listening to a job Parameters ---------- id_ : str An ID to remove Returns -------- str or None The ID removed or None if the ID was not removed
['Stop', 'listening', 'to', 'a', 'job']
train
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/group.py#L139-L163
5,897
MagicStack/asyncpg
asyncpg/pool.py
Pool.release
async def release(self, connection, *, timeout=None): """Release a database connection back to the pool. :param Connection connection: A :class:`~asyncpg.connection.Connection` object to release. :param float timeout: A timeout for releasing the connection. If not speci...
python
async def release(self, connection, *, timeout=None): """Release a database connection back to the pool. :param Connection connection: A :class:`~asyncpg.connection.Connection` object to release. :param float timeout: A timeout for releasing the connection. If not speci...
['async', 'def', 'release', '(', 'self', ',', 'connection', ',', '*', ',', 'timeout', '=', 'None', ')', ':', 'if', '(', 'type', '(', 'connection', ')', 'is', 'not', 'PoolConnectionProxy', 'or', 'connection', '.', '_holder', '.', '_pool', 'is', 'not', 'self', ')', ':', 'raise', 'exceptions', '.', 'InterfaceError', '(', ...
Release a database connection back to the pool. :param Connection connection: A :class:`~asyncpg.connection.Connection` object to release. :param float timeout: A timeout for releasing the connection. If not specified, defaults to the timeout provided in the corresp...
['Release', 'a', 'database', 'connection', 'back', 'to', 'the', 'pool', '.']
train
https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/pool.py#L609-L645
5,898
saltstack/salt
salt/states/neutron_secgroup_rule.py
absent
def absent(name, auth=None, **kwargs): ''' Ensure a security group rule does not exist name name or id of the security group rule to delete rule_id uuid of the rule to delete project_id id of project to delete rule from ''' rule_id = kwargs['rule_id'] ret = {'n...
python
def absent(name, auth=None, **kwargs): ''' Ensure a security group rule does not exist name name or id of the security group rule to delete rule_id uuid of the rule to delete project_id id of project to delete rule from ''' rule_id = kwargs['rule_id'] ret = {'n...
['def', 'absent', '(', 'name', ',', 'auth', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'rule_id', '=', 'kwargs', '[', "'rule_id'", ']', 'ret', '=', '{', "'name'", ':', 'rule_id', ',', "'changes'", ':', '{', '}', ',', "'result'", ':', 'True', ',', "'comment'", ':', "''", '}', '__salt__', '[', "'neutronng.setup_clou...
Ensure a security group rule does not exist name name or id of the security group rule to delete rule_id uuid of the rule to delete project_id id of project to delete rule from
['Ensure', 'a', 'security', 'group', 'rule', 'does', 'not', 'exist']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_secgroup_rule.py#L131-L180
5,899
JukeboxPipeline/jukebox-core
src/jukeboxcore/reftrack.py
RefobjInterface.create
def create(self, typ, identifier, parent=None): """Create a new refobj with the given typ and parent :param typ: the entity type :type typ: str :param identifier: the refobj id. Used to identify refobjects of the same parent, element and type in the UI :type identifier: int ...
python
def create(self, typ, identifier, parent=None): """Create a new refobj with the given typ and parent :param typ: the entity type :type typ: str :param identifier: the refobj id. Used to identify refobjects of the same parent, element and type in the UI :type identifier: int ...
['def', 'create', '(', 'self', ',', 'typ', ',', 'identifier', ',', 'parent', '=', 'None', ')', ':', 'refobj', '=', 'self', '.', 'create_refobj', '(', ')', 'self', '.', 'set_typ', '(', 'refobj', ',', 'typ', ')', 'self', '.', 'set_id', '(', 'refobj', ',', 'identifier', ')', 'if', 'parent', ':', 'self', '.', 'set_parent',...
Create a new refobj with the given typ and parent :param typ: the entity type :type typ: str :param identifier: the refobj id. Used to identify refobjects of the same parent, element and type in the UI :type identifier: int :param parent: the parent refobject :type paren...
['Create', 'a', 'new', 'refobj', 'with', 'the', 'given', 'typ', 'and', 'parent']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/reftrack.py#L1903-L1921