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
600
honeybadger-io/honeybadger-python
honeybadger/contrib/flask.py
FlaskHoneybadger.init_app
def init_app(self, app, report_exceptions=False, reset_context_after_request=False): """ Initialize honeybadger and listen for errors. :param Flask app: the Flask application object. :param bool report_exceptions: whether to automatically report exceptions raised by Flask on requests ...
python
def init_app(self, app, report_exceptions=False, reset_context_after_request=False): """ Initialize honeybadger and listen for errors. :param Flask app: the Flask application object. :param bool report_exceptions: whether to automatically report exceptions raised by Flask on requests ...
['def', 'init_app', '(', 'self', ',', 'app', ',', 'report_exceptions', '=', 'False', ',', 'reset_context_after_request', '=', 'False', ')', ':', 'from', 'flask', 'import', 'request_tearing_down', ',', 'got_request_exception', 'self', '.', 'app', '=', 'app', 'self', '.', 'app', '.', 'logger', '.', 'info', '(', "'Initial...
Initialize honeybadger and listen for errors. :param Flask app: the Flask application object. :param bool report_exceptions: whether to automatically report exceptions raised by Flask on requests (i.e. by calling abort) or not. :param bool reset_context_after_request: whether to reset ...
['Initialize', 'honeybadger', 'and', 'listen', 'for', 'errors', '.', ':', 'param', 'Flask', 'app', ':', 'the', 'Flask', 'application', 'object', '.', ':', 'param', 'bool', 'report_exceptions', ':', 'whether', 'to', 'automatically', 'report', 'exceptions', 'raised', 'by', 'Flask', 'on', 'requests', '(', 'i', '.', 'e', '...
train
https://github.com/honeybadger-io/honeybadger-python/blob/81519b40d3e446b62035f64e34900e08ff91938c/honeybadger/contrib/flask.py#L98-L127
601
bwohlberg/sporco
sporco/prox/_lp.py
norm_2l2
def norm_2l2(x, axis=None): r"""Compute the squared :math:`\ell_2` norm .. math:: \| \mathbf{x} \|_2^2 = \sum_i x_i^2 where :math:`x_i` is element :math:`i` of vector :math:`\mathbf{x}`. Parameters ---------- x : array_like Input array :math:`\mathbf{x}` axis : `None` or int o...
python
def norm_2l2(x, axis=None): r"""Compute the squared :math:`\ell_2` norm .. math:: \| \mathbf{x} \|_2^2 = \sum_i x_i^2 where :math:`x_i` is element :math:`i` of vector :math:`\mathbf{x}`. Parameters ---------- x : array_like Input array :math:`\mathbf{x}` axis : `None` or int o...
['def', 'norm_2l2', '(', 'x', ',', 'axis', '=', 'None', ')', ':', 'nl2', '=', 'np', '.', 'sum', '(', 'x', '**', '2', ',', 'axis', '=', 'axis', ',', 'keepdims', '=', 'True', ')', '# If the result has a single element, convert it to a scalar', 'if', 'nl2', '.', 'size', '==', '1', ':', 'nl2', '=', 'nl2', '.', 'ravel', '('...
r"""Compute the squared :math:`\ell_2` norm .. math:: \| \mathbf{x} \|_2^2 = \sum_i x_i^2 where :math:`x_i` is element :math:`i` of vector :math:`\mathbf{x}`. Parameters ---------- x : array_like Input array :math:`\mathbf{x}` axis : `None` or int or tuple of ints, optional (defau...
['r', 'Compute', 'the', 'squared', ':', 'math', ':', '\\', 'ell_2', 'norm']
train
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/prox/_lp.py#L183-L212
602
caffeinehit/django-oauth2-provider
provider/oauth2/forms.py
ScopeChoiceField.validate
def validate(self, value): """ Validates that the input is a list or tuple. """ if self.required and not value: raise OAuthValidationError({'error': 'invalid_request'}) # Validate that each value in the value list is in self.choices. for val in value: ...
python
def validate(self, value): """ Validates that the input is a list or tuple. """ if self.required and not value: raise OAuthValidationError({'error': 'invalid_request'}) # Validate that each value in the value list is in self.choices. for val in value: ...
['def', 'validate', '(', 'self', ',', 'value', ')', ':', 'if', 'self', '.', 'required', 'and', 'not', 'value', ':', 'raise', 'OAuthValidationError', '(', '{', "'error'", ':', "'invalid_request'", '}', ')', '# Validate that each value in the value list is in self.choices.', 'for', 'val', 'in', 'value', ':', 'if', 'not',...
Validates that the input is a list or tuple.
['Validates', 'that', 'the', 'input', 'is', 'a', 'list', 'or', 'tuple', '.']
train
https://github.com/caffeinehit/django-oauth2-provider/blob/6b5bc0d3ad706d2aaa47fa476f38406cddd01236/provider/oauth2/forms.py#L70-L83
603
sarenji/pyrc
example.py
GangstaBot.bling
def bling(self, target, sender): "will print yo" if target.startswith("#"): self.message(target, "%s: yo" % sender) else: self.message(sender, "yo")
python
def bling(self, target, sender): "will print yo" if target.startswith("#"): self.message(target, "%s: yo" % sender) else: self.message(sender, "yo")
['def', 'bling', '(', 'self', ',', 'target', ',', 'sender', ')', ':', 'if', 'target', '.', 'startswith', '(', '"#"', ')', ':', 'self', '.', 'message', '(', 'target', ',', '"%s: yo"', '%', 'sender', ')', 'else', ':', 'self', '.', 'message', '(', 'sender', ',', '"yo"', ')']
will print yo
['will', 'print', 'yo']
train
https://github.com/sarenji/pyrc/blob/5e8377ddcda6e0ef4ba7d66cf400e243b1fb8f68/example.py#L11-L16
604
collectiveacuity/jsonModel
jsonmodel/validators.py
jsonModel._validate_number
def _validate_number(self, input_number, path_to_root, object_title=''): ''' a helper method for validating properties of a number :return: input_number ''' rules_path_to_root = re.sub('\[\d+\]', '[0]', path_to_root) input_criteria = self.keyMap[rules_path_to_root]...
python
def _validate_number(self, input_number, path_to_root, object_title=''): ''' a helper method for validating properties of a number :return: input_number ''' rules_path_to_root = re.sub('\[\d+\]', '[0]', path_to_root) input_criteria = self.keyMap[rules_path_to_root]...
['def', '_validate_number', '(', 'self', ',', 'input_number', ',', 'path_to_root', ',', 'object_title', '=', "''", ')', ':', 'rules_path_to_root', '=', 're', '.', 'sub', '(', "'\\[\\d+\\]'", ',', "'[0]'", ',', 'path_to_root', ')', 'input_criteria', '=', 'self', '.', 'keyMap', '[', 'rules_path_to_root', ']', 'error_dict...
a helper method for validating properties of a number :return: input_number
['a', 'helper', 'method', 'for', 'validating', 'properties', 'of', 'a', 'number']
train
https://github.com/collectiveacuity/jsonModel/blob/1ea64c36d78add3faa7b85ff82c5ec685458c940/jsonmodel/validators.py#L1000-L1064
605
IDSIA/sacred
sacred/ingredient.py
Ingredient.gather_named_configs
def gather_named_configs(self, ingredient): """Collect all named configs from this ingredient and its sub-ingredients. Yields ------ config_name: str The full (dotted) name of the named config. config: ConfigScope or ConfigDict or basestring The c...
python
def gather_named_configs(self, ingredient): """Collect all named configs from this ingredient and its sub-ingredients. Yields ------ config_name: str The full (dotted) name of the named config. config: ConfigScope or ConfigDict or basestring The c...
['def', 'gather_named_configs', '(', 'self', ',', 'ingredient', ')', ':', 'for', 'config_name', ',', 'config', 'in', 'ingredient', '.', 'named_configs', '.', 'items', '(', ')', ':', 'yield', 'join_paths', '(', 'ingredient', '.', 'path', ',', 'config_name', ')', ',', 'config']
Collect all named configs from this ingredient and its sub-ingredients. Yields ------ config_name: str The full (dotted) name of the named config. config: ConfigScope or ConfigDict or basestring The corresponding named config.
['Collect', 'all', 'named', 'configs', 'from', 'this', 'ingredient', 'and', 'its', 'sub', '-', 'ingredients', '.']
train
https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/ingredient.py#L314-L326
606
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py
MessageToString
def MessageToString(message, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, float_format=None, use_field_number=False, descriptor_pool=None, ...
python
def MessageToString(message, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, float_format=None, use_field_number=False, descriptor_pool=None, ...
['def', 'MessageToString', '(', 'message', ',', 'as_utf8', '=', 'False', ',', 'as_one_line', '=', 'False', ',', 'pointy_brackets', '=', 'False', ',', 'use_index_order', '=', 'False', ',', 'float_format', '=', 'None', ',', 'use_field_number', '=', 'False', ',', 'descriptor_pool', '=', 'None', ',', 'indent', '=', '0', ')...
Convert protobuf message to text format. Floating point values can be formatted compactly with 15 digits of precision (which is the most that IEEE 754 "double" can guarantee) using float_format='.15g'. To ensure that converting to text and back to a proto will result in an identical value, float_format='.17g' ...
['Convert', 'protobuf', 'message', 'to', 'text', 'format', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L121-L164
607
ratt-ru/PyMORESANE
pymoresane/iuwt.py
iuwt_recomposition
def iuwt_recomposition(in1, scale_adjust=0, mode='ser', core_count=1, store_on_gpu=False, smoothed_array=None): """ This function serves as a handler for the different implementations of the IUWT recomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 ...
python
def iuwt_recomposition(in1, scale_adjust=0, mode='ser', core_count=1, store_on_gpu=False, smoothed_array=None): """ This function serves as a handler for the different implementations of the IUWT recomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 ...
['def', 'iuwt_recomposition', '(', 'in1', ',', 'scale_adjust', '=', '0', ',', 'mode', '=', "'ser'", ',', 'core_count', '=', '1', ',', 'store_on_gpu', '=', 'False', ',', 'smoothed_array', '=', 'None', ')', ':', 'if', 'mode', '==', "'ser'", ':', 'return', 'ser_iuwt_recomposition', '(', 'in1', ',', 'scale_adjust', ',', 's...
This function serves as a handler for the different implementations of the IUWT recomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 (no default): Array on which the decomposition is to be performed. scale_adjust (no default): ...
['This', 'function', 'serves', 'as', 'a', 'handler', 'for', 'the', 'different', 'implementations', 'of', 'the', 'IUWT', 'recomposition', '.', 'It', 'allows', 'the', 'different', 'methods', 'to', 'be', 'used', 'almost', 'interchangeably', '.']
train
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L43-L64
608
tanghaibao/jcvi
jcvi/utils/aws.py
start
def start(args): """ %prog start Launch ec2 instance through command line. """ p = OptionParser(start.__doc__) p.add_option("--ondemand", default=False, action="store_true", help="Do we want a more expensive on-demand instance") p.add_option("--profile", default="mvrad-data...
python
def start(args): """ %prog start Launch ec2 instance through command line. """ p = OptionParser(start.__doc__) p.add_option("--ondemand", default=False, action="store_true", help="Do we want a more expensive on-demand instance") p.add_option("--profile", default="mvrad-data...
['def', 'start', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'start', '.', '__doc__', ')', 'p', '.', 'add_option', '(', '"--ondemand"', ',', 'default', '=', 'False', ',', 'action', '=', '"store_true"', ',', 'help', '=', '"Do we want a more expensive on-demand instance"', ')', 'p', '.', 'add_option', '(', '"--...
%prog start Launch ec2 instance through command line.
['%prog', 'start']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/aws.py#L135-L239
609
FNNDSC/chrisapp
chrisapp/base.py
ChrisApp.add_argument
def add_argument(self, *args, **kwargs): """ Add a parameter to this app. """ if not (('action' in kwargs) and (kwargs['action'] == 'help')): # make sure required parameter options were defined try: name = kwargs['dest'] param_type ...
python
def add_argument(self, *args, **kwargs): """ Add a parameter to this app. """ if not (('action' in kwargs) and (kwargs['action'] == 'help')): # make sure required parameter options were defined try: name = kwargs['dest'] param_type ...
['def', 'add_argument', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', '(', '(', "'action'", 'in', 'kwargs', ')', 'and', '(', 'kwargs', '[', "'action'", ']', '==', "'help'", ')', ')', ':', '# make sure required parameter options were defined', 'try', ':', 'name', '=', 'kwargs', '[', "'de...
Add a parameter to this app.
['Add', 'a', 'parameter', 'to', 'this', 'app', '.']
train
https://github.com/FNNDSC/chrisapp/blob/b176655f97206240fe173dfe86736f82f0d85bc4/chrisapp/base.py#L210-L253
610
mardiros/pyshop
pyshop/models.py
User.by_ldap_credentials
def by_ldap_credentials(cls, session, login, password, settings): """if possible try to contact the LDAP for authentification if success and login don't exist localy create one and return it :param session: SQLAlchemy session :type session: :class:`sqlalchemy.Session` :param lo...
python
def by_ldap_credentials(cls, session, login, password, settings): """if possible try to contact the LDAP for authentification if success and login don't exist localy create one and return it :param session: SQLAlchemy session :type session: :class:`sqlalchemy.Session` :param lo...
['def', 'by_ldap_credentials', '(', 'cls', ',', 'session', ',', 'login', ',', 'password', ',', 'settings', ')', ':', 'if', 'not', 'asbool', '(', 'settings', '.', 'get', '(', "'pyshop.ldap.use_for_auth'", ',', "'False'", ')', ')', ':', 'return', 'None', 'if', 'ldap', 'is', 'None', ':', 'raise', 'ImportError', '(', '"no ...
if possible try to contact the LDAP for authentification if success and login don't exist localy create one and return it :param session: SQLAlchemy session :type session: :class:`sqlalchemy.Session` :param login: username :type login: unicode :param password: user pas...
['if', 'possible', 'try', 'to', 'contact', 'the', 'LDAP', 'for', 'authentification', 'if', 'success', 'and', 'login', 'don', 't', 'exist', 'localy', 'create', 'one', 'and', 'return', 'it']
train
https://github.com/mardiros/pyshop/blob/b42510b9c3fa16e0e5710457401ac38fea5bf7a0/pyshop/models.py#L228-L347
611
tk0miya/tk.phpautodoc
src/phply/phpparse.py
p_common_scalar_magic_method
def p_common_scalar_magic_method(p): 'common_scalar : METHOD_C' p[0] = ast.MagicConstant(p[1].upper(), None, lineno=p.lineno(1))
python
def p_common_scalar_magic_method(p): 'common_scalar : METHOD_C' p[0] = ast.MagicConstant(p[1].upper(), None, lineno=p.lineno(1))
['def', 'p_common_scalar_magic_method', '(', 'p', ')', ':', 'p', '[', '0', ']', '=', 'ast', '.', 'MagicConstant', '(', 'p', '[', '1', ']', '.', 'upper', '(', ')', ',', 'None', ',', 'lineno', '=', 'p', '.', 'lineno', '(', '1', ')', ')']
common_scalar : METHOD_C
['common_scalar', ':', 'METHOD_C']
train
https://github.com/tk0miya/tk.phpautodoc/blob/cf789f64abaf76351485cee231a075227e665fb6/src/phply/phpparse.py#L1218-L1220
612
codelv/enaml-native
src/enamlnative/android/android_grid_layout.py
AndroidGridLayout.create_widget
def create_widget(self): """ Create the underlying widget. """ d = self.declaration self.widget = GridLayout(self.get_context(), None, d.style)
python
def create_widget(self): """ Create the underlying widget. """ d = self.declaration self.widget = GridLayout(self.get_context(), None, d.style)
['def', 'create_widget', '(', 'self', ')', ':', 'd', '=', 'self', '.', 'declaration', 'self', '.', 'widget', '=', 'GridLayout', '(', 'self', '.', 'get_context', '(', ')', ',', 'None', ',', 'd', '.', 'style', ')']
Create the underlying widget.
['Create', 'the', 'underlying', 'widget', '.']
train
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_grid_layout.py#L48-L53
613
tamasgal/km3pipe
km3pipe/stats.py
param_describe
def param_describe(params, quant=95, axis=0): """Get mean + quantile range from bootstrapped params.""" par = np.mean(params, axis=axis) lo, up = perc(quant) p_up = np.percentile(params, up, axis=axis) p_lo = np.percentile(params, lo, axis=axis) return par, p_lo, p_up
python
def param_describe(params, quant=95, axis=0): """Get mean + quantile range from bootstrapped params.""" par = np.mean(params, axis=axis) lo, up = perc(quant) p_up = np.percentile(params, up, axis=axis) p_lo = np.percentile(params, lo, axis=axis) return par, p_lo, p_up
['def', 'param_describe', '(', 'params', ',', 'quant', '=', '95', ',', 'axis', '=', '0', ')', ':', 'par', '=', 'np', '.', 'mean', '(', 'params', ',', 'axis', '=', 'axis', ')', 'lo', ',', 'up', '=', 'perc', '(', 'quant', ')', 'p_up', '=', 'np', '.', 'percentile', '(', 'params', ',', 'up', ',', 'axis', '=', 'axis', ')', ...
Get mean + quantile range from bootstrapped params.
['Get', 'mean', '+', 'quantile', 'range', 'from', 'bootstrapped', 'params', '.']
train
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/stats.py#L190-L196
614
omaraboumrad/mastool
mastool/practices.py
find_poor_default_arg
def find_poor_default_arg(node): """Finds poor default args""" poor_defaults = [ ast.Call, ast.Dict, ast.DictComp, ast.GeneratorExp, ast.List, ast.ListComp, ast.Set, ast.SetComp, ] # pylint: disable=unidiomatic-typecheck return ( ...
python
def find_poor_default_arg(node): """Finds poor default args""" poor_defaults = [ ast.Call, ast.Dict, ast.DictComp, ast.GeneratorExp, ast.List, ast.ListComp, ast.Set, ast.SetComp, ] # pylint: disable=unidiomatic-typecheck return ( ...
['def', 'find_poor_default_arg', '(', 'node', ')', ':', 'poor_defaults', '=', '[', 'ast', '.', 'Call', ',', 'ast', '.', 'Dict', ',', 'ast', '.', 'DictComp', ',', 'ast', '.', 'GeneratorExp', ',', 'ast', '.', 'List', ',', 'ast', '.', 'ListComp', ',', 'ast', '.', 'Set', ',', 'ast', '.', 'SetComp', ',', ']', '# pylint: dis...
Finds poor default args
['Finds', 'poor', 'default', 'args']
train
https://github.com/omaraboumrad/mastool/blob/0ec566de6717d03c6ec61affe5d1e9ff8d7e6ebd/mastool/practices.py#L154-L171
615
symphonyoss/python-symphony
symphony/Pod/connections.py
Connections.sessioninfo
def sessioninfo(self): ''' session info ''' response, status_code = self.__pod__.Session.get_v2_sessioninfo( sessionToken=self.__session__ ).result() self.logger.debug('%s: %s' % (status_code, response)) return status_code, response
python
def sessioninfo(self): ''' session info ''' response, status_code = self.__pod__.Session.get_v2_sessioninfo( sessionToken=self.__session__ ).result() self.logger.debug('%s: %s' % (status_code, response)) return status_code, response
['def', 'sessioninfo', '(', 'self', ')', ':', 'response', ',', 'status_code', '=', 'self', '.', '__pod__', '.', 'Session', '.', 'get_v2_sessioninfo', '(', 'sessionToken', '=', 'self', '.', '__session__', ')', '.', 'result', '(', ')', 'self', '.', 'logger', '.', 'debug', '(', "'%s: %s'", '%', '(', 'status_code', ',', 'r...
session info
['session', 'info']
train
https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/connections.py#L19-L25
616
StackStorm/pybind
pybind/slxos/v17r_1_01a/routing_system/route_map/content/set_/__init__.py
set_._set_weight
def _set_weight(self, v, load=False): """ Setter method for weight, mapped from YANG variable /routing_system/route_map/content/set/weight (container) If this variable is read-only (config: false) in the source YANG file, then _set_weight is considered as a private method. Backends looking to popula...
python
def _set_weight(self, v, load=False): """ Setter method for weight, mapped from YANG variable /routing_system/route_map/content/set/weight (container) If this variable is read-only (config: false) in the source YANG file, then _set_weight is considered as a private method. Backends looking to popula...
['def', '_set_weight', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'weight', '.', 'weight', ',', 'is_container', '=', "'container'", ',', '...
Setter method for weight, mapped from YANG variable /routing_system/route_map/content/set/weight (container) If this variable is read-only (config: false) in the source YANG file, then _set_weight is considered as a private method. Backends looking to populate this variable should do so via calling this...
['Setter', 'method', 'for', 'weight', 'mapped', 'from', 'YANG', 'variable', '/', 'routing_system', '/', 'route_map', '/', 'content', '/', 'set', '/', 'weight', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_s...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/routing_system/route_map/content/set_/__init__.py#L453-L476
617
Azure/azure-cosmos-python
azure/cosmos/cosmos_client.py
CosmosClient.DeleteConflict
def DeleteConflict(self, conflict_link, options=None): """Deletes a conflict. :param str conflict_link: The link to the conflict. :param dict options: The request options for the request. :return: The deleted Conflict. :rtype: dic...
python
def DeleteConflict(self, conflict_link, options=None): """Deletes a conflict. :param str conflict_link: The link to the conflict. :param dict options: The request options for the request. :return: The deleted Conflict. :rtype: dic...
['def', 'DeleteConflict', '(', 'self', ',', 'conflict_link', ',', 'options', '=', 'None', ')', ':', 'if', 'options', 'is', 'None', ':', 'options', '=', '{', '}', 'path', '=', 'base', '.', 'GetPathFromLink', '(', 'conflict_link', ')', 'conflict_id', '=', 'base', '.', 'GetResourceIdOrFullNameFromLink', '(', 'conflict_lin...
Deletes a conflict. :param str conflict_link: The link to the conflict. :param dict options: The request options for the request. :return: The deleted Conflict. :rtype: dict
['Deletes', 'a', 'conflict', '.']
train
https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2259-L2282
618
Samreay/ChainConsumer
chainconsumer/diagnostic.py
Diagnostic.gelman_rubin
def gelman_rubin(self, chain=None, threshold=0.05): r""" Runs the Gelman Rubin diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnostic on al...
python
def gelman_rubin(self, chain=None, threshold=0.05): r""" Runs the Gelman Rubin diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnostic on al...
['def', 'gelman_rubin', '(', 'self', ',', 'chain', '=', 'None', ',', 'threshold', '=', '0.05', ')', ':', 'if', 'chain', 'is', 'None', ':', 'return', 'np', '.', 'all', '(', '[', 'self', '.', 'gelman_rubin', '(', 'k', ',', 'threshold', '=', 'threshold', ')', 'for', 'k', 'in', 'range', '(', 'len', '(', 'self', '.', 'paren...
r""" Runs the Gelman Rubin diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnostic on all chains. You can also supply and integer (the c...
['r', 'Runs', 'the', 'Gelman', 'Rubin', 'diagnostic', 'on', 'the', 'supplied', 'chains', '.']
train
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/diagnostic.py#L11-L76
619
KelSolaar/Umbra
umbra/ui/widgets/codeEditor_QPlainTextEdit.py
LinesNumbers_QWidget.separator_width
def separator_width(self, value): """ Setter for **self.__separator_width** attribute. :param value: Attribute value. :type value: int """ if value is not None: assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format("separator_width", ...
python
def separator_width(self, value): """ Setter for **self.__separator_width** attribute. :param value: Attribute value. :type value: int """ if value is not None: assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format("separator_width", ...
['def', 'separator_width', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'is', 'not', 'None', ':', 'assert', 'type', '(', 'value', ')', 'is', 'int', ',', '"\'{0}\' attribute: \'{1}\' type is not \'int\'!"', '.', 'format', '(', '"separator_width"', ',', 'value', ')', 'assert', 'value', '>', '0', ',', '"\'{0}\' att...
Setter for **self.__separator_width** attribute. :param value: Attribute value. :type value: int
['Setter', 'for', '**', 'self', '.', '__separator_width', '**', 'attribute', '.']
train
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/ui/widgets/codeEditor_QPlainTextEdit.py#L171-L182
620
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/_events/pubsub.py
_get_event_id
def _get_event_id(object_type: str) -> str: """Return an event key for the event on the object type. This must be a unique event id for the object. Args: object_type (str): Type of object Returns: str, event id """ key = _keys.event_counter(object_type) DB.watch(key, pipe...
python
def _get_event_id(object_type: str) -> str: """Return an event key for the event on the object type. This must be a unique event id for the object. Args: object_type (str): Type of object Returns: str, event id """ key = _keys.event_counter(object_type) DB.watch(key, pipe...
['def', '_get_event_id', '(', 'object_type', ':', 'str', ')', '->', 'str', ':', 'key', '=', '_keys', '.', 'event_counter', '(', 'object_type', ')', 'DB', '.', 'watch', '(', 'key', ',', 'pipeline', '=', 'True', ')', 'count', '=', 'DB', '.', 'get_value', '(', 'key', ')', 'DB', '.', 'increment', '(', 'key', ')', 'DB', '.'...
Return an event key for the event on the object type. This must be a unique event id for the object. Args: object_type (str): Type of object Returns: str, event id
['Return', 'an', 'event', 'key', 'for', 'the', 'event', 'on', 'the', 'object', 'type', '.']
train
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_events/pubsub.py#L169-L188
621
dmlc/xgboost
python-package/xgboost/core.py
DMatrix.feature_names
def feature_names(self, feature_names): """Set feature names (column labels). Parameters ---------- feature_names : list or None Labels for features. None will reset existing feature names """ if feature_names is not None: # validate feature name ...
python
def feature_names(self, feature_names): """Set feature names (column labels). Parameters ---------- feature_names : list or None Labels for features. None will reset existing feature names """ if feature_names is not None: # validate feature name ...
['def', 'feature_names', '(', 'self', ',', 'feature_names', ')', ':', 'if', 'feature_names', 'is', 'not', 'None', ':', '# validate feature name', 'try', ':', 'if', 'not', 'isinstance', '(', 'feature_names', ',', 'str', ')', ':', 'feature_names', '=', '[', 'n', 'for', 'n', 'in', 'iter', '(', 'feature_names', ')', ']', '...
Set feature names (column labels). Parameters ---------- feature_names : list or None Labels for features. None will reset existing feature names
['Set', 'feature', 'names', '(', 'column', 'labels', ')', '.']
train
https://github.com/dmlc/xgboost/blob/253fdd8a42d5ec6b819788199584d27bf9ea6253/python-package/xgboost/core.py#L843-L874
622
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
validate_jhove
def validate_jhove(filename, jhove=None, ignore=None): """Validate TIFF file using jhove -m TIFF-hul. Raise ValueError if jhove outputs an error message unless the message contains one of the strings in 'ignore'. JHOVE does not support bigtiff or more than 50 IFDs. See `JHOVE TIFF-hul Module <htt...
python
def validate_jhove(filename, jhove=None, ignore=None): """Validate TIFF file using jhove -m TIFF-hul. Raise ValueError if jhove outputs an error message unless the message contains one of the strings in 'ignore'. JHOVE does not support bigtiff or more than 50 IFDs. See `JHOVE TIFF-hul Module <htt...
['def', 'validate_jhove', '(', 'filename', ',', 'jhove', '=', 'None', ',', 'ignore', '=', 'None', ')', ':', 'import', 'subprocess', '# noqa: delayed import', 'if', 'ignore', 'is', 'None', ':', 'ignore', '=', '[', "'More than 50 IFDs'", ']', 'if', 'jhove', 'is', 'None', ':', 'jhove', '=', "'jhove'", 'out', '=', 'subproc...
Validate TIFF file using jhove -m TIFF-hul. Raise ValueError if jhove outputs an error message unless the message contains one of the strings in 'ignore'. JHOVE does not support bigtiff or more than 50 IFDs. See `JHOVE TIFF-hul Module <http://jhove.sourceforge.net/tiff-hul.html>`_
['Validate', 'TIFF', 'file', 'using', 'jhove', '-', 'm', 'TIFF', '-', 'hul', '.']
train
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L10684-L10711
623
jbarlow83/OCRmyPDF
src/ocrmypdf/leptonica.py
Pix.scale
def scale(self, scale_xy): "Returns the pix object rescaled according to the proportions given." with _LeptonicaErrorTrap(): return Pix(lept.pixScale(self._cdata, scale_xy[0], scale_xy[1]))
python
def scale(self, scale_xy): "Returns the pix object rescaled according to the proportions given." with _LeptonicaErrorTrap(): return Pix(lept.pixScale(self._cdata, scale_xy[0], scale_xy[1]))
['def', 'scale', '(', 'self', ',', 'scale_xy', ')', ':', 'with', '_LeptonicaErrorTrap', '(', ')', ':', 'return', 'Pix', '(', 'lept', '.', 'pixScale', '(', 'self', '.', '_cdata', ',', 'scale_xy', '[', '0', ']', ',', 'scale_xy', '[', '1', ']', ')', ')']
Returns the pix object rescaled according to the proportions given.
['Returns', 'the', 'pix', 'object', 'rescaled', 'according', 'to', 'the', 'proportions', 'given', '.']
train
https://github.com/jbarlow83/OCRmyPDF/blob/79c84eefa353632a3d7ccddbd398c6678c1c1777/src/ocrmypdf/leptonica.py#L367-L370
624
idlesign/uwsgiconf
uwsgiconf/options/applications.py
Applications.switch_into_lazy_mode
def switch_into_lazy_mode(self, affect_master=None): """Load apps in workers instead of master. This option may have memory usage implications as Copy-on-Write semantics can not be used. .. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params for ...
python
def switch_into_lazy_mode(self, affect_master=None): """Load apps in workers instead of master. This option may have memory usage implications as Copy-on-Write semantics can not be used. .. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params for ...
['def', 'switch_into_lazy_mode', '(', 'self', ',', 'affect_master', '=', 'None', ')', ':', 'self', '.', '_set', '(', "'lazy'", 'if', 'affect_master', 'else', "'lazy-apps'", ',', 'True', ',', 'cast', '=', 'bool', ')', 'return', 'self', '.', '_section']
Load apps in workers instead of master. This option may have memory usage implications as Copy-on-Write semantics can not be used. .. note:: Consider using ``touch_chain_reload`` option in ``workers`` basic params for lazy apps reloading. :param bool affect_master: If **Tr...
['Load', 'apps', 'in', 'workers', 'instead', 'of', 'master', '.']
train
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/applications.py#L70-L88
625
sanger-pathogens/circlator
circlator/merge.py
Merger._write_act_files
def _write_act_files(self, ref_fasta, qry_fasta, coords_file, outprefix): '''Writes crunch file and shell script to start up ACT, showing comparison of ref and qry''' if self.verbose: print('Making ACT files from', ref_fasta, qry_fasta, coords_file) ref_fasta = os.path.relpath(ref_fa...
python
def _write_act_files(self, ref_fasta, qry_fasta, coords_file, outprefix): '''Writes crunch file and shell script to start up ACT, showing comparison of ref and qry''' if self.verbose: print('Making ACT files from', ref_fasta, qry_fasta, coords_file) ref_fasta = os.path.relpath(ref_fa...
['def', '_write_act_files', '(', 'self', ',', 'ref_fasta', ',', 'qry_fasta', ',', 'coords_file', ',', 'outprefix', ')', ':', 'if', 'self', '.', 'verbose', ':', 'print', '(', "'Making ACT files from'", ',', 'ref_fasta', ',', 'qry_fasta', ',', 'coords_file', ')', 'ref_fasta', '=', 'os', '.', 'path', '.', 'relpath', '(', ...
Writes crunch file and shell script to start up ACT, showing comparison of ref and qry
['Writes', 'crunch', 'file', 'and', 'shell', 'script', 'to', 'start', 'up', 'ACT', 'showing', 'comparison', 'of', 'ref', 'and', 'qry']
train
https://github.com/sanger-pathogens/circlator/blob/a4befb8c9dbbcd4b3ad1899a95aa3e689d58b638/circlator/merge.py#L636-L659
626
jreese/dotlink
dotlink/dotlink.py
Dotlink.scp
def scp(self, local_file, remote_path=''): """Copy a local file to the given remote path.""" if self.args.user: upload_spec = '{0}@{1}:{2}'.format(self.args.user, self.args.server, remote_path) ...
python
def scp(self, local_file, remote_path=''): """Copy a local file to the given remote path.""" if self.args.user: upload_spec = '{0}@{1}:{2}'.format(self.args.user, self.args.server, remote_path) ...
['def', 'scp', '(', 'self', ',', 'local_file', ',', 'remote_path', '=', "''", ')', ':', 'if', 'self', '.', 'args', '.', 'user', ':', 'upload_spec', '=', "'{0}@{1}:{2}'", '.', 'format', '(', 'self', '.', 'args', '.', 'user', ',', 'self', '.', 'args', '.', 'server', ',', 'remote_path', ')', 'else', ':', 'upload_spec', '=...
Copy a local file to the given remote path.
['Copy', 'a', 'local', 'file', 'to', 'the', 'given', 'remote', 'path', '.']
train
https://github.com/jreese/dotlink/blob/5e48c1493c20fc6df4ad0144e80563915ce339b6/dotlink/dotlink.py#L231-L240
627
SavinaRoja/PyUserInput
pykeyboard/windows.py
PyKeyboard.release_key
def release_key(self, character=''): """ Release a given character key. """ try: shifted = self.is_char_shifted(character) except AttributeError: win32api.keybd_event(character, 0, KEYEVENTF_KEYUP, 0) else: if shifted: w...
python
def release_key(self, character=''): """ Release a given character key. """ try: shifted = self.is_char_shifted(character) except AttributeError: win32api.keybd_event(character, 0, KEYEVENTF_KEYUP, 0) else: if shifted: w...
['def', 'release_key', '(', 'self', ',', 'character', '=', "''", ')', ':', 'try', ':', 'shifted', '=', 'self', '.', 'is_char_shifted', '(', 'character', ')', 'except', 'AttributeError', ':', 'win32api', '.', 'keybd_event', '(', 'character', ',', '0', ',', 'KEYEVENTF_KEYUP', ',', '0', ')', 'else', ':', 'if', 'shifted', ...
Release a given character key.
['Release', 'a', 'given', 'character', 'key', '.']
train
https://github.com/SavinaRoja/PyUserInput/blob/153c1d39b1a41b467b235fd182392d6dcbf07947/pykeyboard/windows.py#L58-L70
628
maartenbreddels/ipyvolume
ipyvolume/astro.py
_randomSO3
def _randomSO3(): """Return random rotatation matrix, algo by James Arvo.""" u1 = np.random.random() u2 = np.random.random() u3 = np.random.random() R = np.array( [ [np.cos(2 * np.pi * u1), np.sin(2 * np.pi * u1), 0], [-np.sin(2 * np.pi * u1), np.cos(2 * np.pi * u1), ...
python
def _randomSO3(): """Return random rotatation matrix, algo by James Arvo.""" u1 = np.random.random() u2 = np.random.random() u3 = np.random.random() R = np.array( [ [np.cos(2 * np.pi * u1), np.sin(2 * np.pi * u1), 0], [-np.sin(2 * np.pi * u1), np.cos(2 * np.pi * u1), ...
['def', '_randomSO3', '(', ')', ':', 'u1', '=', 'np', '.', 'random', '.', 'random', '(', ')', 'u2', '=', 'np', '.', 'random', '.', 'random', '(', ')', 'u3', '=', 'np', '.', 'random', '.', 'random', '(', ')', 'R', '=', 'np', '.', 'array', '(', '[', '[', 'np', '.', 'cos', '(', '2', '*', 'np', '.', 'pi', '*', 'u1', ')', '...
Return random rotatation matrix, algo by James Arvo.
['Return', 'random', 'rotatation', 'matrix', 'algo', 'by', 'James', 'Arvo', '.']
train
https://github.com/maartenbreddels/ipyvolume/blob/e68b72852b61276f8e6793bc8811f5b2432a155f/ipyvolume/astro.py#L11-L25
629
tgalal/yowsup
yowsup/config/transforms/config_dict.py
ConfigDictTransform.transform
def transform(self, config): """ :param config: :type config: dict :return: :rtype: yowsup.config.config.Config """ out = {} for prop in vars(config): out[prop] = getattr(config, prop) return out
python
def transform(self, config): """ :param config: :type config: dict :return: :rtype: yowsup.config.config.Config """ out = {} for prop in vars(config): out[prop] = getattr(config, prop) return out
['def', 'transform', '(', 'self', ',', 'config', ')', ':', 'out', '=', '{', '}', 'for', 'prop', 'in', 'vars', '(', 'config', ')', ':', 'out', '[', 'prop', ']', '=', 'getattr', '(', 'config', ',', 'prop', ')', 'return', 'out']
:param config: :type config: dict :return: :rtype: yowsup.config.config.Config
[':', 'param', 'config', ':', ':', 'type', 'config', ':', 'dict', ':', 'return', ':', ':', 'rtype', ':', 'yowsup', '.', 'config', '.', 'config', '.', 'Config']
train
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/transforms/config_dict.py#L8-L18
630
Apitax/Apitax
apitax/api/controllers/scriptax_controller.py
delete_driver_script
def delete_driver_script(driver, script_delete=None): # noqa: E501 """Delete a script Delete a script # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :param script_delete: The data needed to delete this script :type script_delete: dict | bytes ...
python
def delete_driver_script(driver, script_delete=None): # noqa: E501 """Delete a script Delete a script # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :param script_delete: The data needed to delete this script :type script_delete: dict | bytes ...
['def', 'delete_driver_script', '(', 'driver', ',', 'script_delete', '=', 'None', ')', ':', '# noqa: E501', 'if', 'connexion', '.', 'request', '.', 'is_json', ':', 'script_delete', '=', 'ScriptDelete', '.', 'from_dict', '(', 'connexion', '.', 'request', '.', 'get_json', '(', ')', ')', '# noqa: E501', 'response', '=', '...
Delete a script Delete a script # noqa: E501 :param driver: The driver to use for the request. ie. github :type driver: str :param script_delete: The data needed to delete this script :type script_delete: dict | bytes :rtype: Response
['Delete', 'a', 'script']
train
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/scriptax_controller.py#L47-L71
631
PyCQA/astroid
astroid/manager.py
AstroidManager.ast_from_file
def ast_from_file(self, filepath, modname=None, fallback=True, source=False): """given a module name, return the astroid object""" try: filepath = modutils.get_source_file(filepath, include_no_ext=True) source = True except modutils.NoSourceFile: pass ...
python
def ast_from_file(self, filepath, modname=None, fallback=True, source=False): """given a module name, return the astroid object""" try: filepath = modutils.get_source_file(filepath, include_no_ext=True) source = True except modutils.NoSourceFile: pass ...
['def', 'ast_from_file', '(', 'self', ',', 'filepath', ',', 'modname', '=', 'None', ',', 'fallback', '=', 'True', ',', 'source', '=', 'False', ')', ':', 'try', ':', 'filepath', '=', 'modutils', '.', 'get_source_file', '(', 'filepath', ',', 'include_no_ext', '=', 'True', ')', 'source', '=', 'True', 'except', 'modutils',...
given a module name, return the astroid object
['given', 'a', 'module', 'name', 'return', 'the', 'astroid', 'object']
train
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/manager.py#L71-L96
632
tanghaibao/jcvi
jcvi/assembly/postprocess.py
overlap
def overlap(args): """ %prog overlap ctgfasta poolfasta Fish out the sequences in `poolfasta` that overlap with `ctgfasta`. Mix and combine using `minimus2`. """ p = OptionParser(overlap.__doc__) opts, args = p.parse_args(args) if len(args) != 2: sys.exit(not p.print_help()) ...
python
def overlap(args): """ %prog overlap ctgfasta poolfasta Fish out the sequences in `poolfasta` that overlap with `ctgfasta`. Mix and combine using `minimus2`. """ p = OptionParser(overlap.__doc__) opts, args = p.parse_args(args) if len(args) != 2: sys.exit(not p.print_help()) ...
['def', 'overlap', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'overlap', '.', '__doc__', ')', 'opts', ',', 'args', '=', 'p', '.', 'parse_args', '(', 'args', ')', 'if', 'len', '(', 'args', ')', '!=', '2', ':', 'sys', '.', 'exit', '(', 'not', 'p', '.', 'print_help', '(', ')', ')', 'ctgfasta', ',', 'poolfasta',...
%prog overlap ctgfasta poolfasta Fish out the sequences in `poolfasta` that overlap with `ctgfasta`. Mix and combine using `minimus2`.
['%prog', 'overlap', 'ctgfasta', 'poolfasta']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/postprocess.py#L388-L503
633
StackStorm/pybind
pybind/nos/v6_0_2f/rbridge_id/qos/__init__.py
qos._set_rcv_queue
def _set_rcv_queue(self, v, load=False): """ Setter method for rcv_queue, mapped from YANG variable /rbridge_id/qos/rcv_queue (container) If this variable is read-only (config: false) in the source YANG file, then _set_rcv_queue is considered as a private method. Backends looking to populate this va...
python
def _set_rcv_queue(self, v, load=False): """ Setter method for rcv_queue, mapped from YANG variable /rbridge_id/qos/rcv_queue (container) If this variable is read-only (config: false) in the source YANG file, then _set_rcv_queue is considered as a private method. Backends looking to populate this va...
['def', '_set_rcv_queue', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'rcv_queue', '.', 'rcv_queue', ',', 'is_container', '=', "'container'...
Setter method for rcv_queue, mapped from YANG variable /rbridge_id/qos/rcv_queue (container) If this variable is read-only (config: false) in the source YANG file, then _set_rcv_queue is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_rcv_...
['Setter', 'method', 'for', 'rcv_queue', 'mapped', 'from', 'YANG', 'variable', '/', 'rbridge_id', '/', 'qos', '/', 'rcv_queue', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_rcv_queue', 'is', 'considered...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/rbridge_id/qos/__init__.py#L127-L148
634
BernardFW/bernard
src/bernard/middleware/_builtins.py
AutoSleep.clean_stacks
def clean_stacks(self, stacks: List[List[BaseLayer]]) \ -> List[List[BaseLayer]]: """ Two cases: if a stack finishes by a sleep then let's keep it (it means that there was nothing after the text). However if the stack finishes with something else (like a quick reply) then we ...
python
def clean_stacks(self, stacks: List[List[BaseLayer]]) \ -> List[List[BaseLayer]]: """ Two cases: if a stack finishes by a sleep then let's keep it (it means that there was nothing after the text). However if the stack finishes with something else (like a quick reply) then we ...
['def', 'clean_stacks', '(', 'self', ',', 'stacks', ':', 'List', '[', 'List', '[', 'BaseLayer', ']', ']', ')', '->', 'List', '[', 'List', '[', 'BaseLayer', ']', ']', ':', 'ns', ':', 'List', '[', 'List', '[', 'BaseLayer', ']', ']', '=', '[', ']', 'for', 'stack', 'in', 'stacks', ':', 'if', 'isinstance', '(', 'stack', '['...
Two cases: if a stack finishes by a sleep then let's keep it (it means that there was nothing after the text). However if the stack finishes with something else (like a quick reply) then we don't risk an is preserved.
['Two', 'cases', ':', 'if', 'a', 'stack', 'finishes', 'by', 'a', 'sleep', 'then', 'let', 's', 'keep', 'it', '(', 'it', 'means', 'that', 'there', 'was', 'nothing', 'after', 'the', 'text', ')', '.', 'However', 'if', 'the', 'stack', 'finishes', 'with', 'something', 'else', '(', 'like', 'a', 'quick', 'reply', ')', 'then', ...
train
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/middleware/_builtins.py#L95-L119
635
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py
Matrix3.from_euler
def from_euler(self, roll, pitch, yaw): '''fill the matrix from Euler angles in radians''' cp = cos(pitch) sp = sin(pitch) sr = sin(roll) cr = cos(roll) sy = sin(yaw) cy = cos(yaw) self.a.x = cp * cy self.a.y = (sr * sp * cy) - (cr * sy) s...
python
def from_euler(self, roll, pitch, yaw): '''fill the matrix from Euler angles in radians''' cp = cos(pitch) sp = sin(pitch) sr = sin(roll) cr = cos(roll) sy = sin(yaw) cy = cos(yaw) self.a.x = cp * cy self.a.y = (sr * sp * cy) - (cr * sy) s...
['def', 'from_euler', '(', 'self', ',', 'roll', ',', 'pitch', ',', 'yaw', ')', ':', 'cp', '=', 'cos', '(', 'pitch', ')', 'sp', '=', 'sin', '(', 'pitch', ')', 'sr', '=', 'sin', '(', 'roll', ')', 'cr', '=', 'cos', '(', 'roll', ')', 'sy', '=', 'sin', '(', 'yaw', ')', 'cy', '=', 'cos', '(', 'yaw', ')', 'self', '.', 'a', '....
fill the matrix from Euler angles in radians
['fill', 'the', 'matrix', 'from', 'Euler', 'angles', 'in', 'radians']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/rotmat.py#L154-L171
636
eventbrite/eventbrite-sdk-python
eventbrite/access_methods.py
AccessMethodsMixin.get_user_events
def get_user_events(self, id, **data): """ GET /users/:id/events/ Returns a :ref:`paginated <pagination>` response of :format:`events <event>`, under the key ``events``, of all events the user has access to """ return self.get("/users/{0}/events/".format(id), data=data)
python
def get_user_events(self, id, **data): """ GET /users/:id/events/ Returns a :ref:`paginated <pagination>` response of :format:`events <event>`, under the key ``events``, of all events the user has access to """ return self.get("/users/{0}/events/".format(id), data=data)
['def', 'get_user_events', '(', 'self', ',', 'id', ',', '*', '*', 'data', ')', ':', 'return', 'self', '.', 'get', '(', '"/users/{0}/events/"', '.', 'format', '(', 'id', ')', ',', 'data', '=', 'data', ')']
GET /users/:id/events/ Returns a :ref:`paginated <pagination>` response of :format:`events <event>`, under the key ``events``, of all events the user has access to
['GET', '/', 'users', '/', ':', 'id', '/', 'events', '/', 'Returns', 'a', ':', 'ref', ':', 'paginated', '<pagination', '>', 'response', 'of', ':', 'format', ':', 'events', '<event', '>', 'under', 'the', 'key', 'events', 'of', 'all', 'events', 'the', 'user', 'has', 'access', 'to']
train
https://github.com/eventbrite/eventbrite-sdk-python/blob/f2e5dc5aa1aa3e45766de13f16fd65722163d91a/eventbrite/access_methods.py#L776-L782
637
dw/mitogen
mitogen/core.py
Latch.close
def close(self): """ Mark the latch as closed, and cause every sleeping thread to be woken, with :class:`mitogen.core.LatchError` raised in each thread. """ self._lock.acquire() try: self.closed = True while self._waking < len(self._sleeping): ...
python
def close(self): """ Mark the latch as closed, and cause every sleeping thread to be woken, with :class:`mitogen.core.LatchError` raised in each thread. """ self._lock.acquire() try: self.closed = True while self._waking < len(self._sleeping): ...
['def', 'close', '(', 'self', ')', ':', 'self', '.', '_lock', '.', 'acquire', '(', ')', 'try', ':', 'self', '.', 'closed', '=', 'True', 'while', 'self', '.', '_waking', '<', 'len', '(', 'self', '.', '_sleeping', ')', ':', 'wsock', ',', 'cookie', '=', 'self', '.', '_sleeping', '[', 'self', '.', '_waking', ']', 'self', '...
Mark the latch as closed, and cause every sleeping thread to be woken, with :class:`mitogen.core.LatchError` raised in each thread.
['Mark', 'the', 'latch', 'as', 'closed', 'and', 'cause', 'every', 'sleeping', 'thread', 'to', 'be', 'woken', 'with', ':', 'class', ':', 'mitogen', '.', 'core', '.', 'LatchError', 'raised', 'in', 'each', 'thread', '.']
train
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/core.py#L2101-L2114
638
bodylabs/lace
lace/topology.py
MeshMixin.remove_redundant_verts
def remove_redundant_verts(self, eps=1e-10): """Given verts and faces, this remove colocated vertices""" import numpy as np from scipy.spatial import cKDTree # FIXME pylint: disable=no-name-in-module fshape = self.f.shape tree = cKDTree(self.v) close_pairs = list(tree.que...
python
def remove_redundant_verts(self, eps=1e-10): """Given verts and faces, this remove colocated vertices""" import numpy as np from scipy.spatial import cKDTree # FIXME pylint: disable=no-name-in-module fshape = self.f.shape tree = cKDTree(self.v) close_pairs = list(tree.que...
['def', 'remove_redundant_verts', '(', 'self', ',', 'eps', '=', '1e-10', ')', ':', 'import', 'numpy', 'as', 'np', 'from', 'scipy', '.', 'spatial', 'import', 'cKDTree', '# FIXME pylint: disable=no-name-in-module', 'fshape', '=', 'self', '.', 'f', '.', 'shape', 'tree', '=', 'cKDTree', '(', 'self', '.', 'v', ')', 'close_p...
Given verts and faces, this remove colocated vertices
['Given', 'verts', 'and', 'faces', 'this', 'remove', 'colocated', 'vertices']
train
https://github.com/bodylabs/lace/blob/b68f4a60a4cac66c0607ffbae38ef9d07d37f459/lace/topology.py#L498-L518
639
fastai/fastai
fastai/vision/data.py
_db_pre_transform
def _db_pre_transform(self, train_tfm:List[Callable], valid_tfm:List[Callable]): "Call `train_tfm` and `valid_tfm` after opening image, before converting from `PIL.Image`" self.train_ds.x.after_open = compose(train_tfm) self.valid_ds.x.after_open = compose(valid_tfm) return self
python
def _db_pre_transform(self, train_tfm:List[Callable], valid_tfm:List[Callable]): "Call `train_tfm` and `valid_tfm` after opening image, before converting from `PIL.Image`" self.train_ds.x.after_open = compose(train_tfm) self.valid_ds.x.after_open = compose(valid_tfm) return self
['def', '_db_pre_transform', '(', 'self', ',', 'train_tfm', ':', 'List', '[', 'Callable', ']', ',', 'valid_tfm', ':', 'List', '[', 'Callable', ']', ')', ':', 'self', '.', 'train_ds', '.', 'x', '.', 'after_open', '=', 'compose', '(', 'train_tfm', ')', 'self', '.', 'valid_ds', '.', 'x', '.', 'after_open', '=', 'compose',...
Call `train_tfm` and `valid_tfm` after opening image, before converting from `PIL.Image`
['Call', 'train_tfm', 'and', 'valid_tfm', 'after', 'opening', 'image', 'before', 'converting', 'from', 'PIL', '.', 'Image']
train
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/data.py#L440-L444
640
modin-project/modin
modin/backends/pandas/query_compiler.py
PandasQueryCompiler.numeric_function_clean_dataframe
def numeric_function_clean_dataframe(self, axis): """Preprocesses numeric functions to clean dataframe and pick numeric indices. Args: axis: '0' if columns and '1' if rows. Returns: Tuple with return value(if any), indices to apply func to & cleaned Manager. """...
python
def numeric_function_clean_dataframe(self, axis): """Preprocesses numeric functions to clean dataframe and pick numeric indices. Args: axis: '0' if columns and '1' if rows. Returns: Tuple with return value(if any), indices to apply func to & cleaned Manager. """...
['def', 'numeric_function_clean_dataframe', '(', 'self', ',', 'axis', ')', ':', 'result', '=', 'None', 'query_compiler', '=', 'self', '# If no numeric columns and over columns, then return empty Series', 'if', 'not', 'axis', 'and', 'len', '(', 'self', '.', 'index', ')', '==', '0', ':', 'result', '=', 'pandas', '.', 'Se...
Preprocesses numeric functions to clean dataframe and pick numeric indices. Args: axis: '0' if columns and '1' if rows. Returns: Tuple with return value(if any), indices to apply func to & cleaned Manager.
['Preprocesses', 'numeric', 'functions', 'to', 'clean', 'dataframe', 'and', 'pick', 'numeric', 'indices', '.']
train
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L181-L209
641
pmacosta/pmisc
pmisc/member.py
isreal
def isreal(obj): """ Test if the argument is a real number (float or integer). :param obj: Object :type obj: any :rtype: boolean """ return ( (obj is not None) and (not isinstance(obj, bool)) and isinstance(obj, (int, float)) )
python
def isreal(obj): """ Test if the argument is a real number (float or integer). :param obj: Object :type obj: any :rtype: boolean """ return ( (obj is not None) and (not isinstance(obj, bool)) and isinstance(obj, (int, float)) )
['def', 'isreal', '(', 'obj', ')', ':', 'return', '(', '(', 'obj', 'is', 'not', 'None', ')', 'and', '(', 'not', 'isinstance', '(', 'obj', ',', 'bool', ')', ')', 'and', 'isinstance', '(', 'obj', ',', '(', 'int', ',', 'float', ')', ')', ')']
Test if the argument is a real number (float or integer). :param obj: Object :type obj: any :rtype: boolean
['Test', 'if', 'the', 'argument', 'is', 'a', 'real', 'number', '(', 'float', 'or', 'integer', ')', '.']
train
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/member.py#L84-L97
642
twilio/twilio-python
twilio/rest/api/v2010/account/__init__.py
AccountContext.new_keys
def new_keys(self): """ Access the new_keys :returns: twilio.rest.api.v2010.account.new_key.NewKeyList :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList """ if self._new_keys is None: self._new_keys = NewKeyList(self._version, account_sid=self._solutio...
python
def new_keys(self): """ Access the new_keys :returns: twilio.rest.api.v2010.account.new_key.NewKeyList :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList """ if self._new_keys is None: self._new_keys = NewKeyList(self._version, account_sid=self._solutio...
['def', 'new_keys', '(', 'self', ')', ':', 'if', 'self', '.', '_new_keys', 'is', 'None', ':', 'self', '.', '_new_keys', '=', 'NewKeyList', '(', 'self', '.', '_version', ',', 'account_sid', '=', 'self', '.', '_solution', '[', "'sid'", ']', ',', ')', 'return', 'self', '.', '_new_keys']
Access the new_keys :returns: twilio.rest.api.v2010.account.new_key.NewKeyList :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList
['Access', 'the', 'new_keys']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/__init__.py#L474-L483
643
ewels/MultiQC
multiqc/modules/bbmap/bbmap.py
MultiqcModule.make_basic_table
def make_basic_table(self, file_type): """ Create table of key-value items in 'file_type'. """ table_data = {sample: items['kv'] for sample, items in self.mod_data[file_type].items() } table_headers = {} for column_header, (description, h...
python
def make_basic_table(self, file_type): """ Create table of key-value items in 'file_type'. """ table_data = {sample: items['kv'] for sample, items in self.mod_data[file_type].items() } table_headers = {} for column_header, (description, h...
['def', 'make_basic_table', '(', 'self', ',', 'file_type', ')', ':', 'table_data', '=', '{', 'sample', ':', 'items', '[', "'kv'", ']', 'for', 'sample', ',', 'items', 'in', 'self', '.', 'mod_data', '[', 'file_type', ']', '.', 'items', '(', ')', '}', 'table_headers', '=', '{', '}', 'for', 'column_header', ',', '(', 'desc...
Create table of key-value items in 'file_type'.
['Create', 'table', 'of', 'key', '-', 'value', 'items', 'in', 'file_type', '.']
train
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/bbmap/bbmap.py#L165-L192
644
saltstack/salt
salt/modules/systemd_service.py
_check_unmask
def _check_unmask(name, unmask, unmask_runtime, root=None): ''' Common code for conditionally removing masks before making changes to a service's state. ''' if unmask: unmask_(name, runtime=False, root=root) if unmask_runtime: unmask_(name, runtime=True, root=root)
python
def _check_unmask(name, unmask, unmask_runtime, root=None): ''' Common code for conditionally removing masks before making changes to a service's state. ''' if unmask: unmask_(name, runtime=False, root=root) if unmask_runtime: unmask_(name, runtime=True, root=root)
['def', '_check_unmask', '(', 'name', ',', 'unmask', ',', 'unmask_runtime', ',', 'root', '=', 'None', ')', ':', 'if', 'unmask', ':', 'unmask_', '(', 'name', ',', 'runtime', '=', 'False', ',', 'root', '=', 'root', ')', 'if', 'unmask_runtime', ':', 'unmask_', '(', 'name', ',', 'runtime', '=', 'True', ',', 'root', '=', 'r...
Common code for conditionally removing masks before making changes to a service's state.
['Common', 'code', 'for', 'conditionally', 'removing', 'masks', 'before', 'making', 'changes', 'to', 'a', 'service', 's', 'state', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L141-L149
645
ArtoLabs/SimpleSteem
simplesteem/util.py
Util.minutes_back
def minutes_back(self, date): ''' Gives a number (integer) of days since a given date ''' elapsed = (datetime.utcnow() - datetime.strptime(date,'%Y-%m-%dT%H:%M:%S')) if elapsed.days > 0: secondsback = (elapsed.days * 24 * 60 * 60) + elapsed.seconds else: ...
python
def minutes_back(self, date): ''' Gives a number (integer) of days since a given date ''' elapsed = (datetime.utcnow() - datetime.strptime(date,'%Y-%m-%dT%H:%M:%S')) if elapsed.days > 0: secondsback = (elapsed.days * 24 * 60 * 60) + elapsed.seconds else: ...
['def', 'minutes_back', '(', 'self', ',', 'date', ')', ':', 'elapsed', '=', '(', 'datetime', '.', 'utcnow', '(', ')', '-', 'datetime', '.', 'strptime', '(', 'date', ',', "'%Y-%m-%dT%H:%M:%S'", ')', ')', 'if', 'elapsed', '.', 'days', '>', '0', ':', 'secondsback', '=', '(', 'elapsed', '.', 'days', '*', '24', '*', '60', '...
Gives a number (integer) of days since a given date
['Gives', 'a', 'number', '(', 'integer', ')', 'of', 'days', 'since', 'a', 'given', 'date']
train
https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/util.py#L87-L97
646
fulfilio/fulfil-python-api
fulfil_client/client.py
AsyncResult.refresh_if_needed
def refresh_if_needed(self): """ Refresh the status of the task from server if required. """ if self.state in (self.PENDING, self.STARTED): try: response, = self._fetch_result()['tasks'] except (KeyError, ValueError): raise Exceptio...
python
def refresh_if_needed(self): """ Refresh the status of the task from server if required. """ if self.state in (self.PENDING, self.STARTED): try: response, = self._fetch_result()['tasks'] except (KeyError, ValueError): raise Exceptio...
['def', 'refresh_if_needed', '(', 'self', ')', ':', 'if', 'self', '.', 'state', 'in', '(', 'self', '.', 'PENDING', ',', 'self', '.', 'STARTED', ')', ':', 'try', ':', 'response', ',', '=', 'self', '.', '_fetch_result', '(', ')', '[', "'tasks'", ']', 'except', '(', 'KeyError', ',', 'ValueError', ')', ':', 'raise', 'Excep...
Refresh the status of the task from server if required.
['Refresh', 'the', 'status', 'of', 'the', 'task', 'from', 'server', 'if', 'required', '.']
train
https://github.com/fulfilio/fulfil-python-api/blob/180ac969c427b1292439a0371866aa5f169ffa6b/fulfil_client/client.py#L572-L590
647
elapouya/python-textops
textops/base.py
eformat
def eformat(format_str,lst,dct,defvalue='-'): """ Formats a list and a dictionary, manages unkown keys It works like :meth:`string.Formatter.vformat` except that it accepts a defvalue for not matching keys. Defvalue can be a callable that will receive the requested key as argument and return a string ...
python
def eformat(format_str,lst,dct,defvalue='-'): """ Formats a list and a dictionary, manages unkown keys It works like :meth:`string.Formatter.vformat` except that it accepts a defvalue for not matching keys. Defvalue can be a callable that will receive the requested key as argument and return a string ...
['def', 'eformat', '(', 'format_str', ',', 'lst', ',', 'dct', ',', 'defvalue', '=', "'-'", ')', ':', 'return', 'vformat', '(', 'format_str', ',', 'DefaultList', '(', 'defvalue', ',', 'lst', ')', ',', 'DefaultDict', '(', 'defvalue', ',', 'dct', ')', ')']
Formats a list and a dictionary, manages unkown keys It works like :meth:`string.Formatter.vformat` except that it accepts a defvalue for not matching keys. Defvalue can be a callable that will receive the requested key as argument and return a string Args: format_string (str): Same format string ...
['Formats', 'a', 'list', 'and', 'a', 'dictionary', 'manages', 'unkown', 'keys']
train
https://github.com/elapouya/python-textops/blob/5c63b9074a1acd8dd108725f1b370f6684c941ef/textops/base.py#L1035-L1058
648
saltstack/salt
salt/modules/mysql.py
verify_login
def verify_login(user, password=None, **connection_args): ''' Attempt to login using the provided credentials. If successful, return true. Otherwise, return False. CLI Example: .. code-block:: bash salt '*' mysql.verify_login root password ''' # Override the connection args for u...
python
def verify_login(user, password=None, **connection_args): ''' Attempt to login using the provided credentials. If successful, return true. Otherwise, return False. CLI Example: .. code-block:: bash salt '*' mysql.verify_login root password ''' # Override the connection args for u...
['def', 'verify_login', '(', 'user', ',', 'password', '=', 'None', ',', '*', '*', 'connection_args', ')', ':', '# Override the connection args for username and password', 'connection_args', '[', "'connection_user'", ']', '=', 'user', 'connection_args', '[', "'connection_pass'", ']', '=', 'password', 'dbc', '=', '_conne...
Attempt to login using the provided credentials. If successful, return true. Otherwise, return False. CLI Example: .. code-block:: bash salt '*' mysql.verify_login root password
['Attempt', 'to', 'login', 'using', 'the', 'provided', 'credentials', '.', 'If', 'successful', 'return', 'true', '.', 'Otherwise', 'return', 'False', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mysql.py#L2336-L2358
649
tgbugs/pyontutils
neurondm/neurondm/lang.py
config
def config(remote_base= 'https://raw.githubusercontent.com/SciCrunch/NIF-Ontology/', local_base= None, # devconfig.ontology_local_repo by default branch= devconfig.neurons_branch, core_graph_paths= ['ttl/phenotype-core.ttl', 'ttl/ph...
python
def config(remote_base= 'https://raw.githubusercontent.com/SciCrunch/NIF-Ontology/', local_base= None, # devconfig.ontology_local_repo by default branch= devconfig.neurons_branch, core_graph_paths= ['ttl/phenotype-core.ttl', 'ttl/ph...
['def', 'config', '(', 'remote_base', '=', "'https://raw.githubusercontent.com/SciCrunch/NIF-Ontology/'", ',', 'local_base', '=', 'None', ',', '# devconfig.ontology_local_repo by default', 'branch', '=', 'devconfig', '.', 'neurons_branch', ',', 'core_graph_paths', '=', '[', "'ttl/phenotype-core.ttl'", ',', "'ttl/phenot...
Wraps graphBase.configGraphIO to provide a set of sane defaults for input ontologies and output files.
['Wraps', 'graphBase', '.', 'configGraphIO', 'to', 'provide', 'a', 'set', 'of', 'sane', 'defaults', 'for', 'input', 'ontologies', 'and', 'output', 'files', '.']
train
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/neurondm/neurondm/lang.py#L34-L75
650
gabstopper/smc-python
smc/base/collection.py
ElementCollection.filter
def filter(self, *filter, **kw): # @ReservedAssignment """ Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC...
python
def filter(self, *filter, **kw): # @ReservedAssignment """ Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC...
['def', 'filter', '(', 'self', ',', '*', 'filter', ',', '*', '*', 'kw', ')', ':', '# @ReservedAssignment', 'iexact', '=', 'None', 'if', 'filter', ':', '_filter', '=', 'filter', '[', '0', ']', 'exact_match', '=', 'kw', '.', 'pop', '(', "'exact_match'", ',', 'False', ')', 'case_sensitive', '=', 'kw', '.', 'pop', '(', "'c...
Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC will only search the name and comment fields. Otherwise other key f...
['Filter', 'results', 'for', 'specific', 'element', 'type', '.', 'keyword', 'arguments', 'can', 'be', 'used', 'to', 'specify', 'a', 'match', 'against', 'the', 'elements', 'attribute', 'directly', '.', 'It', 's', 'important', 'to', 'note', 'that', 'if', 'the', 'search', 'filter', 'contains', 'a', '/', 'or', '-', 'the', ...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L472-L522
651
hardbyte/python-can
can/io/sqlite.py
SqliteWriter.stop
def stop(self): """Stops the reader an writes all remaining messages to the database. Thus, this might take a while and block. """ BufferedReader.stop(self) self._stop_running_event.set() self._writer_thread.join() BaseIOHandler.stop(self)
python
def stop(self): """Stops the reader an writes all remaining messages to the database. Thus, this might take a while and block. """ BufferedReader.stop(self) self._stop_running_event.set() self._writer_thread.join() BaseIOHandler.stop(self)
['def', 'stop', '(', 'self', ')', ':', 'BufferedReader', '.', 'stop', '(', 'self', ')', 'self', '.', '_stop_running_event', '.', 'set', '(', ')', 'self', '.', '_writer_thread', '.', 'join', '(', ')', 'BaseIOHandler', '.', 'stop', '(', 'self', ')']
Stops the reader an writes all remaining messages to the database. Thus, this might take a while and block.
['Stops', 'the', 'reader', 'an', 'writes', 'all', 'remaining', 'messages', 'to', 'the', 'database', '.', 'Thus', 'this', 'might', 'take', 'a', 'while', 'and', 'block', '.']
train
https://github.com/hardbyte/python-can/blob/cdc5254d96072df7739263623f3e920628a7d214/can/io/sqlite.py#L229-L236
652
django-fluent/django-fluent-comments
fluent_comments/__init__.py
get_form
def get_form(): """ Return the form to use for commenting. """ global form_class from fluent_comments import appsettings if form_class is None: if appsettings.FLUENT_COMMENTS_FORM_CLASS: from django.utils.module_loading import import_string form_class = import_str...
python
def get_form(): """ Return the form to use for commenting. """ global form_class from fluent_comments import appsettings if form_class is None: if appsettings.FLUENT_COMMENTS_FORM_CLASS: from django.utils.module_loading import import_string form_class = import_str...
['def', 'get_form', '(', ')', ':', 'global', 'form_class', 'from', 'fluent_comments', 'import', 'appsettings', 'if', 'form_class', 'is', 'None', ':', 'if', 'appsettings', '.', 'FLUENT_COMMENTS_FORM_CLASS', ':', 'from', 'django', '.', 'utils', '.', 'module_loading', 'import', 'import_string', 'form_class', '=', 'import_...
Return the form to use for commenting.
['Return', 'the', 'form', 'to', 'use', 'for', 'commenting', '.']
train
https://github.com/django-fluent/django-fluent-comments/blob/bfe98d55b56fedd8ca2e2659eed53a6390e53adf/fluent_comments/__init__.py#L26-L40
653
openclimatedata/pymagicc
pymagicc/definitions/__init__.py
get_magicc6_to_magicc7_variable_mapping
def get_magicc6_to_magicc7_variable_mapping(inverse=False): """Get the mappings from MAGICC6 to MAGICC7 variables. Note that this mapping is not one to one. For example, "HFC4310", "HFC43-10" and "HFC-43-10" in MAGICC6 both map to "HFC4310" in MAGICC7 but "HFC4310" in MAGICC7 maps back to "HFC4310". ...
python
def get_magicc6_to_magicc7_variable_mapping(inverse=False): """Get the mappings from MAGICC6 to MAGICC7 variables. Note that this mapping is not one to one. For example, "HFC4310", "HFC43-10" and "HFC-43-10" in MAGICC6 both map to "HFC4310" in MAGICC7 but "HFC4310" in MAGICC7 maps back to "HFC4310". ...
['def', 'get_magicc6_to_magicc7_variable_mapping', '(', 'inverse', '=', 'False', ')', ':', '# we generate the mapping dynamically, the first name in the list', '# is the one which will be used for inverse mappings', 'magicc6_simple_mapping_vars', '=', '[', '"KYOTO-CO2EQ"', ',', '"CO2I"', ',', '"CO2B"', ',', '"CH4"', ',...
Get the mappings from MAGICC6 to MAGICC7 variables. Note that this mapping is not one to one. For example, "HFC4310", "HFC43-10" and "HFC-43-10" in MAGICC6 both map to "HFC4310" in MAGICC7 but "HFC4310" in MAGICC7 maps back to "HFC4310". Note that HFC-245fa was mistakenly labelled as HFC-245ca in MAGI...
['Get', 'the', 'mappings', 'from', 'MAGICC6', 'to', 'MAGICC7', 'variables', '.']
train
https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/definitions/__init__.py#L426-L562
654
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_fabric_service.py
brocade_fabric_service.show_fabric_trunk_info_output_show_trunk_list_trunk_list_groups_trunk_list_member_trunk_list_nbr_interface_type
def show_fabric_trunk_info_output_show_trunk_list_trunk_list_groups_trunk_list_member_trunk_list_nbr_interface_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_fabric_trunk_info = ET.Element("show_fabric_trunk_info") config = show_fabric_trunk_i...
python
def show_fabric_trunk_info_output_show_trunk_list_trunk_list_groups_trunk_list_member_trunk_list_nbr_interface_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_fabric_trunk_info = ET.Element("show_fabric_trunk_info") config = show_fabric_trunk_i...
['def', 'show_fabric_trunk_info_output_show_trunk_list_trunk_list_groups_trunk_list_member_trunk_list_nbr_interface_type', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'show_fabric_trunk_info', '=', 'ET', '.', 'Element', '(', '"show_fabric_trunk_info"', ')',...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_fabric_service.py#L905-L919
655
celery/django-celery
djcelery/compat.py
python_2_unicode_compatible
def python_2_unicode_compatible(cls): """Taken from Django project (django/utils/encoding.py) & modified a bit to always have __unicode__ method available. """ if '__str__' not in cls.__dict__: raise ValueError("@python_2_unicode_compatible cannot be applied " "to %s bec...
python
def python_2_unicode_compatible(cls): """Taken from Django project (django/utils/encoding.py) & modified a bit to always have __unicode__ method available. """ if '__str__' not in cls.__dict__: raise ValueError("@python_2_unicode_compatible cannot be applied " "to %s bec...
['def', 'python_2_unicode_compatible', '(', 'cls', ')', ':', 'if', "'__str__'", 'not', 'in', 'cls', '.', '__dict__', ':', 'raise', 'ValueError', '(', '"@python_2_unicode_compatible cannot be applied "', '"to %s because it doesn\'t define __str__()."', '%', 'cls', '.', '__name__', ')', 'cls', '.', '__unicode__', '=', 'c...
Taken from Django project (django/utils/encoding.py) & modified a bit to always have __unicode__ method available.
['Taken', 'from', 'Django', 'project', '(', 'django', '/', 'utils', '/', 'encoding', '.', 'py', ')', '&', 'modified', 'a', 'bit', 'to', 'always', 'have', '__unicode__', 'method', 'available', '.']
train
https://github.com/celery/django-celery/blob/5d1ecb09c6304d22cc447c7c08fba0bd1febc2ef/djcelery/compat.py#L12-L26
656
cloudboss/friend
friend/collections.py
select_dict
def select_dict(coll, key, value): """ Given an iterable of dictionaries, return the dictionaries where the values at a given key match the given value. If the value is an iterable of objects, the function will consider any to be a match. This is especially useful when calling REST APIs which ...
python
def select_dict(coll, key, value): """ Given an iterable of dictionaries, return the dictionaries where the values at a given key match the given value. If the value is an iterable of objects, the function will consider any to be a match. This is especially useful when calling REST APIs which ...
['def', 'select_dict', '(', 'coll', ',', 'key', ',', 'value', ')', ':', 'if', 'getattr', '(', 'value', ',', "'__iter__'", ',', 'None', ')', ':', 'iterable', '=', 'value', 'else', ':', 'iterable', '=', '[', 'value', ']', 'return', '[', 'v', 'for', 'v', 'in', 'coll', 'if', 'key', 'in', 'v', 'and', 'v', '[', 'key', ']', '...
Given an iterable of dictionaries, return the dictionaries where the values at a given key match the given value. If the value is an iterable of objects, the function will consider any to be a match. This is especially useful when calling REST APIs which return arrays of JSON objects. When such a r...
['Given', 'an', 'iterable', 'of', 'dictionaries', 'return', 'the', 'dictionaries', 'where', 'the', 'values', 'at', 'a', 'given', 'key', 'match', 'the', 'given', 'value', '.', 'If', 'the', 'value', 'is', 'an', 'iterable', 'of', 'objects', 'the', 'function', 'will', 'consider', 'any', 'to', 'be', 'a', 'match', '.']
train
https://github.com/cloudboss/friend/blob/3357e6ec849552e3ae9ed28017ff0926e4006e4e/friend/collections.py#L22-L59
657
project-ncl/pnc-cli
pnc_cli/common.py
get_entity
def get_entity(api, entity_id): """ Generic "getSpecific" call that calls get_specific with the given id :param api: api to call get_specific on :param id: id of the entity to retrieve :return: REST entity """ response = utils.checked_api_call(api, 'get_specific', id=entity_id) if respon...
python
def get_entity(api, entity_id): """ Generic "getSpecific" call that calls get_specific with the given id :param api: api to call get_specific on :param id: id of the entity to retrieve :return: REST entity """ response = utils.checked_api_call(api, 'get_specific', id=entity_id) if respon...
['def', 'get_entity', '(', 'api', ',', 'entity_id', ')', ':', 'response', '=', 'utils', '.', 'checked_api_call', '(', 'api', ',', "'get_specific'", ',', 'id', '=', 'entity_id', ')', 'if', 'response', ':', 'return', 'response', '.', 'content', 'return']
Generic "getSpecific" call that calls get_specific with the given id :param api: api to call get_specific on :param id: id of the entity to retrieve :return: REST entity
['Generic', 'getSpecific', 'call', 'that', 'calls', 'get_specific', 'with', 'the', 'given', 'id', ':', 'param', 'api', ':', 'api', 'to', 'call', 'get_specific', 'on', ':', 'param', 'id', ':', 'id', 'of', 'the', 'entity', 'to', 'retrieve', ':', 'return', ':', 'REST', 'entity']
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/common.py#L52-L62
658
jrmontag/STLDecompose
stldecompose/forecast_funcs.py
mean
def mean(data, n=3, **kwargs): """The mean forecast for the next point is the mean value of the previous ``n`` points in the series. Args: data (np.array): Observed data, presumed to be ordered in time. n (int): period over which to calculate the mean Returns: float: a single...
python
def mean(data, n=3, **kwargs): """The mean forecast for the next point is the mean value of the previous ``n`` points in the series. Args: data (np.array): Observed data, presumed to be ordered in time. n (int): period over which to calculate the mean Returns: float: a single...
['def', 'mean', '(', 'data', ',', 'n', '=', '3', ',', '*', '*', 'kwargs', ')', ':', "# don't start averaging until we've seen n points", 'if', 'len', '(', 'data', '[', '-', 'n', ':', ']', ')', '<', 'n', ':', 'forecast', '=', 'np', '.', 'nan', 'else', ':', "# nb: we'll keep the forecast as a float", 'forecast', '=', 'np...
The mean forecast for the next point is the mean value of the previous ``n`` points in the series. Args: data (np.array): Observed data, presumed to be ordered in time. n (int): period over which to calculate the mean Returns: float: a single-valued forecast for the next value in...
['The', 'mean', 'forecast', 'for', 'the', 'next', 'point', 'is', 'the', 'mean', 'value', 'of', 'the', 'previous', 'n', 'points', 'in', 'the', 'series', '.']
train
https://github.com/jrmontag/STLDecompose/blob/f53f89dab4b13618c1cf13f88a01e3e3dc8abdec/stldecompose/forecast_funcs.py#L41-L58
659
pywbem/pywbem
pywbem/_statistics.py
OperationStatistic.stop_timer
def stop_timer(self, request_len, reply_len, server_time=None, exception=False): """ This is a low-level method is called by pywbem at the end of an operation. It completes the measurement for that operation by capturing the needed data, and updates the statistics data...
python
def stop_timer(self, request_len, reply_len, server_time=None, exception=False): """ This is a low-level method is called by pywbem at the end of an operation. It completes the measurement for that operation by capturing the needed data, and updates the statistics data...
['def', 'stop_timer', '(', 'self', ',', 'request_len', ',', 'reply_len', ',', 'server_time', '=', 'None', ',', 'exception', '=', 'False', ')', ':', 'if', 'not', 'self', '.', 'container', '.', 'enabled', ':', 'return', 'None', '# stop the timer', 'if', 'self', '.', '_start_time', 'is', 'None', ':', 'raise', 'RuntimeErro...
This is a low-level method is called by pywbem at the end of an operation. It completes the measurement for that operation by capturing the needed data, and updates the statistics data, if statistics is enabled for the connection. Parameters: request_len (:term:`integer`) ...
['This', 'is', 'a', 'low', '-', 'level', 'method', 'is', 'called', 'by', 'pywbem', 'at', 'the', 'end', 'of', 'an', 'operation', '.', 'It', 'completes', 'the', 'measurement', 'for', 'that', 'operation', 'by', 'capturing', 'the', 'needed', 'data', 'and', 'updates', 'the', 'statistics', 'data', 'if', 'statistics', 'is', '...
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_statistics.py#L398-L470
660
tanghaibao/jcvi
jcvi/compara/quota.py
get_1D_overlap
def get_1D_overlap(eclusters, depth=1): """ Find blocks that are 1D overlapping, returns cliques of block ids that are in conflict """ overlap_set = set() active = set() ends = [] for i, (chr, left, right) in enumerate(eclusters): ends.append((chr, left, 0, i)) # 0/1 for left/r...
python
def get_1D_overlap(eclusters, depth=1): """ Find blocks that are 1D overlapping, returns cliques of block ids that are in conflict """ overlap_set = set() active = set() ends = [] for i, (chr, left, right) in enumerate(eclusters): ends.append((chr, left, 0, i)) # 0/1 for left/r...
['def', 'get_1D_overlap', '(', 'eclusters', ',', 'depth', '=', '1', ')', ':', 'overlap_set', '=', 'set', '(', ')', 'active', '=', 'set', '(', ')', 'ends', '=', '[', ']', 'for', 'i', ',', '(', 'chr', ',', 'left', ',', 'right', ')', 'in', 'enumerate', '(', 'eclusters', ')', ':', 'ends', '.', 'append', '(', '(', 'chr', ',...
Find blocks that are 1D overlapping, returns cliques of block ids that are in conflict
['Find', 'blocks', 'that', 'are', '1D', 'overlapping', 'returns', 'cliques', 'of', 'block', 'ids', 'that', 'are', 'in', 'conflict']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/compara/quota.py#L33-L61
661
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
FigureThumbnail.eventFilter
def eventFilter(self, widget, event): """ A filter that is used to send a signal when the figure canvas is clicked. """ if event.type() == QEvent.MouseButtonPress: if event.button() == Qt.LeftButton: self.sig_canvas_clicked.emit(self) return su...
python
def eventFilter(self, widget, event): """ A filter that is used to send a signal when the figure canvas is clicked. """ if event.type() == QEvent.MouseButtonPress: if event.button() == Qt.LeftButton: self.sig_canvas_clicked.emit(self) return su...
['def', 'eventFilter', '(', 'self', ',', 'widget', ',', 'event', ')', ':', 'if', 'event', '.', 'type', '(', ')', '==', 'QEvent', '.', 'MouseButtonPress', ':', 'if', 'event', '.', 'button', '(', ')', '==', 'Qt', '.', 'LeftButton', ':', 'self', '.', 'sig_canvas_clicked', '.', 'emit', '(', 'self', ')', 'return', 'super', ...
A filter that is used to send a signal when the figure canvas is clicked.
['A', 'filter', 'that', 'is', 'used', 'to', 'send', 'a', 'signal', 'when', 'the', 'figure', 'canvas', 'is', 'clicked', '.']
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L809-L817
662
RudolfCardinal/pythonlib
cardinal_pythonlib/extract_text.py
convert_odt_to_text
def convert_odt_to_text(filename: str = None, blob: bytes = None, config: TextProcessingConfig = _DEFAULT_CONFIG) -> str: """ Converts an OpenOffice ODT file to text. Pass either a filename or a binary object. """ # We can't use exactly the same metho...
python
def convert_odt_to_text(filename: str = None, blob: bytes = None, config: TextProcessingConfig = _DEFAULT_CONFIG) -> str: """ Converts an OpenOffice ODT file to text. Pass either a filename or a binary object. """ # We can't use exactly the same metho...
['def', 'convert_odt_to_text', '(', 'filename', ':', 'str', '=', 'None', ',', 'blob', ':', 'bytes', '=', 'None', ',', 'config', ':', 'TextProcessingConfig', '=', '_DEFAULT_CONFIG', ')', '->', 'str', ':', "# We can't use exactly the same method as for DOCX files, using docx:", '# sometimes that works, but sometimes it f...
Converts an OpenOffice ODT file to text. Pass either a filename or a binary object.
['Converts', 'an', 'OpenOffice', 'ODT', 'file', 'to', 'text', '.']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/extract_text.py#L972-L991
663
hotdoc/hotdoc
hotdoc/extensions/c/clang/cindex.py
Type.element_count
def element_count(self): """Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises. """ result = conf.lib.clang_getNumElements(self) if result < 0: raise Exception('Type does not have elements.') ...
python
def element_count(self): """Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises. """ result = conf.lib.clang_getNumElements(self) if result < 0: raise Exception('Type does not have elements.') ...
['def', 'element_count', '(', 'self', ')', ':', 'result', '=', 'conf', '.', 'lib', '.', 'clang_getNumElements', '(', 'self', ')', 'if', 'result', '<', '0', ':', 'raise', 'Exception', '(', "'Type does not have elements.'", ')', 'return', 'result']
Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises.
['Retrieve', 'the', 'number', 'of', 'elements', 'in', 'this', 'type', '.']
train
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/extensions/c/clang/cindex.py#L2026-L2037
664
ska-sa/katcp-python
katcp/server.py
MessageHandlerThread.stop
def stop(self, timeout=1.0): """Stop the handler thread (from another thread). Parameters ---------- timeout : float, optional Seconds to wait for server to have *started*. """ if timeout: self._running.wait(timeout) self._running.clear()...
python
def stop(self, timeout=1.0): """Stop the handler thread (from another thread). Parameters ---------- timeout : float, optional Seconds to wait for server to have *started*. """ if timeout: self._running.wait(timeout) self._running.clear()...
['def', 'stop', '(', 'self', ',', 'timeout', '=', '1.0', ')', ':', 'if', 'timeout', ':', 'self', '.', '_running', '.', 'wait', '(', 'timeout', ')', 'self', '.', '_running', '.', 'clear', '(', ')', '# Make sure to wake the run thread.', 'self', '.', '_wake', '.', 'set', '(', ')']
Stop the handler thread (from another thread). Parameters ---------- timeout : float, optional Seconds to wait for server to have *started*.
['Stop', 'the', 'handler', 'thread', '(', 'from', 'another', 'thread', ')', '.']
train
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L877-L890
665
pantsbuild/pants
src/python/pants/build_graph/target.py
Target.create_sources_field
def create_sources_field(self, sources, sources_rel_path, key_arg=None): """Factory method to create a SourcesField appropriate for the type of the sources object. Note that this method is called before the call to Target.__init__ so don't expect fields to be populated! :API: public :return: a pa...
python
def create_sources_field(self, sources, sources_rel_path, key_arg=None): """Factory method to create a SourcesField appropriate for the type of the sources object. Note that this method is called before the call to Target.__init__ so don't expect fields to be populated! :API: public :return: a pa...
['def', 'create_sources_field', '(', 'self', ',', 'sources', ',', 'sources_rel_path', ',', 'key_arg', '=', 'None', ')', ':', 'if', 'not', 'sources', ':', 'sources', '=', 'FilesetWithSpec', '.', 'empty', '(', 'sources_rel_path', ')', 'elif', 'not', 'isinstance', '(', 'sources', ',', 'FilesetWithSpec', ')', ':', 'key_arg...
Factory method to create a SourcesField appropriate for the type of the sources object. Note that this method is called before the call to Target.__init__ so don't expect fields to be populated! :API: public :return: a payload field object representing the sources parameter :rtype: SourcesField
['Factory', 'method', 'to', 'create', 'a', 'SourcesField', 'appropriate', 'for', 'the', 'type', 'of', 'the', 'sources', 'object', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/build_graph/target.py#L852-L870
666
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
surfnm
def surfnm(a, b, c, point): """ This routine computes the outward-pointing, unit normal vector from a point on the surface of an ellipsoid. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/surfnm_c.html :param a: Length of the ellisoid semi-axis along the x-axis. :type a: float :par...
python
def surfnm(a, b, c, point): """ This routine computes the outward-pointing, unit normal vector from a point on the surface of an ellipsoid. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/surfnm_c.html :param a: Length of the ellisoid semi-axis along the x-axis. :type a: float :par...
['def', 'surfnm', '(', 'a', ',', 'b', ',', 'c', ',', 'point', ')', ':', 'a', '=', 'ctypes', '.', 'c_double', '(', 'a', ')', 'b', '=', 'ctypes', '.', 'c_double', '(', 'b', ')', 'c', '=', 'ctypes', '.', 'c_double', '(', 'c', ')', 'point', '=', 'stypes', '.', 'toDoubleVector', '(', 'point', ')', 'normal', '=', 'stypes', '...
This routine computes the outward-pointing, unit normal vector from a point on the surface of an ellipsoid. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/surfnm_c.html :param a: Length of the ellisoid semi-axis along the x-axis. :type a: float :param b: Length of the ellisoid semi-axis a...
['This', 'routine', 'computes', 'the', 'outward', '-', 'pointing', 'unit', 'normal', 'vector', 'from', 'a', 'point', 'on', 'the', 'surface', 'of', 'an', 'ellipsoid', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L13575-L13599
667
tensorflow/tensor2tensor
tensor2tensor/layers/common_attention.py
masked_local_attention_2d
def masked_local_attention_2d(q, k, v, query_shape=(8, 16), memory_flange=(8, 16), name=None): """Strided block local self-attention. Each position in a query block ...
python
def masked_local_attention_2d(q, k, v, query_shape=(8, 16), memory_flange=(8, 16), name=None): """Strided block local self-attention. Each position in a query block ...
['def', 'masked_local_attention_2d', '(', 'q', ',', 'k', ',', 'v', ',', 'query_shape', '=', '(', '8', ',', '16', ')', ',', 'memory_flange', '=', '(', '8', ',', '16', ')', ',', 'name', '=', 'None', ')', ':', 'with', 'tf', '.', 'variable_scope', '(', 'name', ',', 'default_name', '=', '"local_masked_self_attention_2d"', '...
Strided block local self-attention. Each position in a query block can attend to all the generated queries in the query block, which are generated in raster scan, and positions that are generated to the left and top. The shapes are specified by query shape and memory flange. Note that if you're using this func...
['Strided', 'block', 'local', 'self', '-', 'attention', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_attention.py#L3760-L3850
668
ueg1990/faker-schema
faker_schema/schema_loader.py
load_json_from_file
def load_json_from_file(file_path): """Load schema from a JSON file""" try: with open(file_path) as f: json_data = json.load(f) except ValueError as e: raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e)) else: return json_data
python
def load_json_from_file(file_path): """Load schema from a JSON file""" try: with open(file_path) as f: json_data = json.load(f) except ValueError as e: raise ValueError('Given file {} is not a valid JSON file: {}'.format(file_path, e)) else: return json_data
['def', 'load_json_from_file', '(', 'file_path', ')', ':', 'try', ':', 'with', 'open', '(', 'file_path', ')', 'as', 'f', ':', 'json_data', '=', 'json', '.', 'load', '(', 'f', ')', 'except', 'ValueError', 'as', 'e', ':', 'raise', 'ValueError', '(', "'Given file {} is not a valid JSON file: {}'", '.', 'format', '(', 'fil...
Load schema from a JSON file
['Load', 'schema', 'from', 'a', 'JSON', 'file']
train
https://github.com/ueg1990/faker-schema/blob/419175eaf34baa43b306dd05c17362763948ec49/faker_schema/schema_loader.py#L4-L12
669
google/grr
grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py
_ExtractHuntIdFromPath
def _ExtractHuntIdFromPath(entry, event): """Extracts a Hunt ID from an APIAuditEntry's HTTP request path.""" match = re.match(r".*hunt/([^/]+).*", entry.http_request_path) if match: event.urn = "aff4:/hunts/{}".format(match.group(1))
python
def _ExtractHuntIdFromPath(entry, event): """Extracts a Hunt ID from an APIAuditEntry's HTTP request path.""" match = re.match(r".*hunt/([^/]+).*", entry.http_request_path) if match: event.urn = "aff4:/hunts/{}".format(match.group(1))
['def', '_ExtractHuntIdFromPath', '(', 'entry', ',', 'event', ')', ':', 'match', '=', 're', '.', 'match', '(', 'r".*hunt/([^/]+).*"', ',', 'entry', '.', 'http_request_path', ')', 'if', 'match', ':', 'event', '.', 'urn', '=', '"aff4:/hunts/{}"', '.', 'format', '(', 'match', '.', 'group', '(', '1', ')', ')']
Extracts a Hunt ID from an APIAuditEntry's HTTP request path.
['Extracts', 'a', 'Hunt', 'ID', 'from', 'an', 'APIAuditEntry', 's', 'HTTP', 'request', 'path', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/report_plugins/server_report_plugins.py#L82-L86
670
tensorflow/mesh
mesh_tensorflow/ops.py
MeshImpl.slice_begin
def slice_begin(self, tensor_shape, pnum): """Begin position for the tensor slice for the given processor. Args: tensor_shape: Shape. pnum: int <= self.size. Returns: list of integers with length tensor_shape.ndims. """ tensor_layout = self.tensor_layout(tensor_shape) coordin...
python
def slice_begin(self, tensor_shape, pnum): """Begin position for the tensor slice for the given processor. Args: tensor_shape: Shape. pnum: int <= self.size. Returns: list of integers with length tensor_shape.ndims. """ tensor_layout = self.tensor_layout(tensor_shape) coordin...
['def', 'slice_begin', '(', 'self', ',', 'tensor_shape', ',', 'pnum', ')', ':', 'tensor_layout', '=', 'self', '.', 'tensor_layout', '(', 'tensor_shape', ')', 'coordinates', '=', 'pnum_to_processor_coordinates', '(', 'self', '.', 'shape', ',', 'pnum', ')', 'ret', '=', '[', ']', 'for', 'dim_size', ',', 'mesh_axis', 'in',...
Begin position for the tensor slice for the given processor. Args: tensor_shape: Shape. pnum: int <= self.size. Returns: list of integers with length tensor_shape.ndims.
['Begin', 'position', 'for', 'the', 'tensor', 'slice', 'for', 'the', 'given', 'processor', '.']
train
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/ops.py#L859-L879
671
mottosso/be
be/util.py
ls
def ls(*topic, **kwargs): """List topic from external datastore Arguments: topic (str): One or more topics, e.g. ("project", "item", "task") root (str, optional): Absolute path to where projects reside, defaults to os.getcwd() backend (callable, optional): Function to call w...
python
def ls(*topic, **kwargs): """List topic from external datastore Arguments: topic (str): One or more topics, e.g. ("project", "item", "task") root (str, optional): Absolute path to where projects reside, defaults to os.getcwd() backend (callable, optional): Function to call w...
['def', 'ls', '(', '*', 'topic', ',', '*', '*', 'kwargs', ')', ':', 'context', '=', 'dump', '(', ')', 'root', '=', 'kwargs', '.', 'get', '(', '"root"', ')', 'or', 'context', '.', 'get', '(', '"cwd"', ')', 'or', 'os', '.', 'getcwd', '(', ')', 'backend', '=', 'kwargs', '.', 'get', '(', '"backend"', ',', 'os', '.', 'listd...
List topic from external datastore Arguments: topic (str): One or more topics, e.g. ("project", "item", "task") root (str, optional): Absolute path to where projects reside, defaults to os.getcwd() backend (callable, optional): Function to call with absolute path as ...
['List', 'topic', 'from', 'external', 'datastore']
train
https://github.com/mottosso/be/blob/0f3d4f3597c71223f616d78c6d9b2c8dffcd8a71/be/util.py#L7-L82
672
openstack/pyghmi
pyghmi/ipmi/command.py
Command.set_channel_access
def set_channel_access(self, channel=None, access_update_mode='non_volatile', alerting=False, per_msg_auth=False, user_level_auth=False, access_mode='always', privilege_update_mode='non_volatile', ...
python
def set_channel_access(self, channel=None, access_update_mode='non_volatile', alerting=False, per_msg_auth=False, user_level_auth=False, access_mode='always', privilege_update_mode='non_volatile', ...
['def', 'set_channel_access', '(', 'self', ',', 'channel', '=', 'None', ',', 'access_update_mode', '=', "'non_volatile'", ',', 'alerting', '=', 'False', ',', 'per_msg_auth', '=', 'False', ',', 'user_level_auth', '=', 'False', ',', 'access_mode', '=', "'always'", ',', 'privilege_update_mode', '=', "'non_volatile'", ',',...
Set channel access :param channel: number [1:7] :param access_update_mode: dont_change = don't set or change Channel Access non_volatile = set non-volatile Channel Access volatile = set volatile (active) setting of Channel Access :param alerting: PEF A...
['Set', 'channel', 'access']
train
https://github.com/openstack/pyghmi/blob/f710b1d30a8eed19a9e86f01f9351c737666f3e5/pyghmi/ipmi/command.py#L1281-L1392
673
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_add_device_override
def do_add_device_override(self, args): """Add a device override to the IM. Usage: add_device_override address cat subcat [firmware] Arguments: address: Insteon address of the device to override cat: Device category subcat: Device subcategory ...
python
def do_add_device_override(self, args): """Add a device override to the IM. Usage: add_device_override address cat subcat [firmware] Arguments: address: Insteon address of the device to override cat: Device category subcat: Device subcategory ...
['def', 'do_add_device_override', '(', 'self', ',', 'args', ')', ':', 'params', '=', 'args', '.', 'split', '(', ')', 'addr', '=', 'None', 'cat', '=', 'None', 'subcat', '=', 'None', 'firmware', '=', 'None', 'error', '=', 'None', 'try', ':', 'addr', '=', 'Address', '(', 'params', '[', '0', ']', ')', 'cat', '=', 'binascii...
Add a device override to the IM. Usage: add_device_override address cat subcat [firmware] Arguments: address: Insteon address of the device to override cat: Device category subcat: Device subcategory firmware: Optional - Device firmware ...
['Add', 'a', 'device', 'override', 'to', 'the', 'IM', '.']
train
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L945-L992
674
saltstack/salt
salt/spm/__init__.py
SPMClient._traverse_repos
def _traverse_repos(self, callback, repo_name=None): ''' Traverse through all repo files and apply the functionality provided in the callback to them ''' repo_files = [] if os.path.exists(self.opts['spm_repos_config']): repo_files.append(self.opts['spm_repos_c...
python
def _traverse_repos(self, callback, repo_name=None): ''' Traverse through all repo files and apply the functionality provided in the callback to them ''' repo_files = [] if os.path.exists(self.opts['spm_repos_config']): repo_files.append(self.opts['spm_repos_c...
['def', '_traverse_repos', '(', 'self', ',', 'callback', ',', 'repo_name', '=', 'None', ')', ':', 'repo_files', '=', '[', ']', 'if', 'os', '.', 'path', '.', 'exists', '(', 'self', '.', 'opts', '[', "'spm_repos_config'", ']', ')', ':', 'repo_files', '.', 'append', '(', 'self', '.', 'opts', '[', "'spm_repos_config'", ']'...
Traverse through all repo files and apply the functionality provided in the callback to them
['Traverse', 'through', 'all', 'repo', 'files', 'and', 'apply', 'the', 'functionality', 'provided', 'in', 'the', 'callback', 'to', 'them']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L620-L644
675
striglia/pyramid_swagger
pyramid_swagger/tween.py
get_swagger_objects
def get_swagger_objects(settings, route_info, registry): """Returns appropriate swagger handler and swagger spec schema. Swagger Handler contains callables that isolate implementation differences in the tween to handle both Swagger 1.2 and Swagger 2.0. Exception is made when `settings.prefer_20_routes...
python
def get_swagger_objects(settings, route_info, registry): """Returns appropriate swagger handler and swagger spec schema. Swagger Handler contains callables that isolate implementation differences in the tween to handle both Swagger 1.2 and Swagger 2.0. Exception is made when `settings.prefer_20_routes...
['def', 'get_swagger_objects', '(', 'settings', ',', 'route_info', ',', 'registry', ')', ':', 'enabled_swagger_versions', '=', 'get_swagger_versions', '(', 'registry', '.', 'settings', ')', 'schema12', '=', 'registry', '.', 'settings', '[', "'pyramid_swagger.schema12'", ']', 'schema20', '=', 'registry', '.', 'settings'...
Returns appropriate swagger handler and swagger spec schema. Swagger Handler contains callables that isolate implementation differences in the tween to handle both Swagger 1.2 and Swagger 2.0. Exception is made when `settings.prefer_20_routes` are non-empty and ['1.2', '2.0'] both are present in avail...
['Returns', 'appropriate', 'swagger', 'handler', 'and', 'swagger', 'spec', 'schema', '.']
train
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L107-L141
676
yero13/na3x
na3x/transformation/transformer.py
Transformation.perform
def perform(self, cfg): """ Performs transformation according to configuration :param cfg: transformation configuration """ self.__src = self._load(cfg[Transformation.__CFG_KEY_LOAD]) self.__transform(cfg[Transformation.__CFG_KEY_TRANSFORM]) self.__cleanup(cfg[Tra...
python
def perform(self, cfg): """ Performs transformation according to configuration :param cfg: transformation configuration """ self.__src = self._load(cfg[Transformation.__CFG_KEY_LOAD]) self.__transform(cfg[Transformation.__CFG_KEY_TRANSFORM]) self.__cleanup(cfg[Tra...
['def', 'perform', '(', 'self', ',', 'cfg', ')', ':', 'self', '.', '__src', '=', 'self', '.', '_load', '(', 'cfg', '[', 'Transformation', '.', '__CFG_KEY_LOAD', ']', ')', 'self', '.', '__transform', '(', 'cfg', '[', 'Transformation', '.', '__CFG_KEY_TRANSFORM', ']', ')', 'self', '.', '__cleanup', '(', 'cfg', '[', 'Tran...
Performs transformation according to configuration :param cfg: transformation configuration
['Performs', 'transformation', 'according', 'to', 'configuration', ':', 'param', 'cfg', ':', 'transformation', 'configuration']
train
https://github.com/yero13/na3x/blob/b31ef801ea574081125020a7d0f9c4242f8f8b02/na3x/transformation/transformer.py#L127-L135
677
dhylands/rshell
rshell/main.py
extra_info
def extra_info(port): """Collects the serial nunber and manufacturer into a string, if the fields are available.""" extra_items = [] if port.manufacturer: extra_items.append("vendor '{}'".format(port.manufacturer)) if port.serial_number: extra_items.append("serial '{}'".format(por...
python
def extra_info(port): """Collects the serial nunber and manufacturer into a string, if the fields are available.""" extra_items = [] if port.manufacturer: extra_items.append("vendor '{}'".format(port.manufacturer)) if port.serial_number: extra_items.append("serial '{}'".format(por...
['def', 'extra_info', '(', 'port', ')', ':', 'extra_items', '=', '[', ']', 'if', 'port', '.', 'manufacturer', ':', 'extra_items', '.', 'append', '(', '"vendor \'{}\'"', '.', 'format', '(', 'port', '.', 'manufacturer', ')', ')', 'if', 'port', '.', 'serial_number', ':', 'extra_items', '.', 'append', '(', '"serial \'{}\'"...
Collects the serial nunber and manufacturer into a string, if the fields are available.
['Collects', 'the', 'serial', 'nunber', 'and', 'manufacturer', 'into', 'a', 'string', 'if', 'the', 'fields', 'are', 'available', '.']
train
https://github.com/dhylands/rshell/blob/a92a8fa8074ac792241c83c640a51b394667c324/rshell/main.py#L320-L332
678
mattmakai/underwear
underwear/run_underwear.py
colorize
def colorize(lead, num, color): """ Print 'lead' = 'num' in 'color' """ if num != 0 and ANSIBLE_COLOR and color is not None: return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color)) else: return "%s=%-4s" % (lead, str(num))
python
def colorize(lead, num, color): """ Print 'lead' = 'num' in 'color' """ if num != 0 and ANSIBLE_COLOR and color is not None: return "%s%s%-15s" % (stringc(lead, color), stringc("=", color), stringc(str(num), color)) else: return "%s=%-4s" % (lead, str(num))
['def', 'colorize', '(', 'lead', ',', 'num', ',', 'color', ')', ':', 'if', 'num', '!=', '0', 'and', 'ANSIBLE_COLOR', 'and', 'color', 'is', 'not', 'None', ':', 'return', '"%s%s%-15s"', '%', '(', 'stringc', '(', 'lead', ',', 'color', ')', ',', 'stringc', '(', '"="', ',', 'color', ')', ',', 'stringc', '(', 'str', '(', 'nu...
Print 'lead' = 'num' in 'color'
['Print', 'lead', '=', 'num', 'in', 'color']
train
https://github.com/mattmakai/underwear/blob/7c484c7937d2df86dc569d411249ba366ed43ead/underwear/run_underwear.py#L24-L29
679
bartromgens/geojsoncontour
geojsoncontour/utilities/multipoly.py
angle
def angle(v1, v2): """Return the angle in radians between vectors 'v1' and 'v2'.""" v1_u = unit_vector(v1) v2_u = unit_vector(v2) return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))
python
def angle(v1, v2): """Return the angle in radians between vectors 'v1' and 'v2'.""" v1_u = unit_vector(v1) v2_u = unit_vector(v2) return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))
['def', 'angle', '(', 'v1', ',', 'v2', ')', ':', 'v1_u', '=', 'unit_vector', '(', 'v1', ')', 'v2_u', '=', 'unit_vector', '(', 'v2', ')', 'return', 'np', '.', 'arccos', '(', 'np', '.', 'clip', '(', 'np', '.', 'dot', '(', 'v1_u', ',', 'v2_u', ')', ',', '-', '1.0', ',', '1.0', ')', ')']
Return the angle in radians between vectors 'v1' and 'v2'.
['Return', 'the', 'angle', 'in', 'radians', 'between', 'vectors', 'v1', 'and', 'v2', '.']
train
https://github.com/bartromgens/geojsoncontour/blob/79e30718fa0c1d96a2459eb1f45d06d699d240ed/geojsoncontour/utilities/multipoly.py#L39-L43
680
mikedh/trimesh
trimesh/triangles.py
points_to_barycentric
def points_to_barycentric(triangles, points, method='cramer'): """ Find the barycentric coordinates of points relative to triangles. The Cramer's rule solution implements: http://blackpawn.com/texts/pointinpoly The cross product solution impl...
python
def points_to_barycentric(triangles, points, method='cramer'): """ Find the barycentric coordinates of points relative to triangles. The Cramer's rule solution implements: http://blackpawn.com/texts/pointinpoly The cross product solution impl...
['def', 'points_to_barycentric', '(', 'triangles', ',', 'points', ',', 'method', '=', "'cramer'", ')', ':', 'def', 'method_cross', '(', ')', ':', 'n', '=', 'np', '.', 'cross', '(', 'edge_vectors', '[', ':', ',', '0', ']', ',', 'edge_vectors', '[', ':', ',', '1', ']', ')', 'denominator', '=', 'util', '.', 'diagonal_dot'...
Find the barycentric coordinates of points relative to triangles. The Cramer's rule solution implements: http://blackpawn.com/texts/pointinpoly The cross product solution implements: https://www.cs.ubc.ca/~heidrich/Papers/JGT.05.pdf Parameters ----------- triangles : (n, 3, 3) fl...
['Find', 'the', 'barycentric', 'coordinates', 'of', 'points', 'relative', 'to', 'triangles', '.']
train
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/triangles.py#L452-L525
681
andreikop/qutepart
qutepart/__init__.py
Qutepart.terminate
def terminate(self): """ Terminate Qutepart instance. This method MUST be called before application stop to avoid crashes and some other interesting effects Call it on close to free memory and stop background highlighting """ self.text = '' self._completer.termina...
python
def terminate(self): """ Terminate Qutepart instance. This method MUST be called before application stop to avoid crashes and some other interesting effects Call it on close to free memory and stop background highlighting """ self.text = '' self._completer.termina...
['def', 'terminate', '(', 'self', ')', ':', 'self', '.', 'text', '=', "''", 'self', '.', '_completer', '.', 'terminate', '(', ')', 'if', 'self', '.', '_highlighter', 'is', 'not', 'None', ':', 'self', '.', '_highlighter', '.', 'terminate', '(', ')', 'if', 'self', '.', '_vim', 'is', 'not', 'None', ':', 'self', '.', '_vim...
Terminate Qutepart instance. This method MUST be called before application stop to avoid crashes and some other interesting effects Call it on close to free memory and stop background highlighting
['Terminate', 'Qutepart', 'instance', '.', 'This', 'method', 'MUST', 'be', 'called', 'before', 'application', 'stop', 'to', 'avoid', 'crashes', 'and', 'some', 'other', 'interesting', 'effects', 'Call', 'it', 'on', 'close', 'to', 'free', 'memory', 'and', 'stop', 'background', 'highlighting']
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/__init__.py#L335-L348
682
Yipit/ejson
ejson/__init__.py
dumps
def dumps(data, escape=False, **kwargs): """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json lib...
python
def dumps(data, escape=False, **kwargs): """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json lib...
['def', 'dumps', '(', 'data', ',', 'escape', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'if', "'sort_keys'", 'not', 'in', 'kwargs', ':', 'kwargs', '[', "'sort_keys'", ']', '=', 'True', 'converted', '=', 'json', '.', 'dumps', '(', 'data', ',', 'default', '=', '_converter', ',', '*', '*', 'kwargs', ')', 'if', 'esca...
A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json library can handle.
['A', 'wrapper', 'around', 'json', '.', 'dumps', 'that', 'can', 'handle', 'objects', 'that', 'json', 'module', 'is', 'not', 'aware', '.']
train
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L49-L70
683
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
Client.list_ext
def list_ext(self, collection, path, retrieve_all, **_params): """Client extension hook for list.""" return self.list(collection, path, retrieve_all, **_params)
python
def list_ext(self, collection, path, retrieve_all, **_params): """Client extension hook for list.""" return self.list(collection, path, retrieve_all, **_params)
['def', 'list_ext', '(', 'self', ',', 'collection', ',', 'path', ',', 'retrieve_all', ',', '*', '*', '_params', ')', ':', 'return', 'self', '.', 'list', '(', 'collection', ',', 'path', ',', 'retrieve_all', ',', '*', '*', '_params', ')']
Client extension hook for list.
['Client', 'extension', 'hook', 'for', 'list', '.']
train
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L571-L573
684
materialsproject/pymatgen
pymatgen/io/abinit/qadapters.py
MpiRunner.string_to_run
def string_to_run(self, qad, executable, stdin=None, stdout=None, stderr=None, exec_args=None): """ Build and return a string with the command required to launch `executable` with the qadapter `qad`. Args qad: Qadapter instance. executable (str): Executable name or path ...
python
def string_to_run(self, qad, executable, stdin=None, stdout=None, stderr=None, exec_args=None): """ Build and return a string with the command required to launch `executable` with the qadapter `qad`. Args qad: Qadapter instance. executable (str): Executable name or path ...
['def', 'string_to_run', '(', 'self', ',', 'qad', ',', 'executable', ',', 'stdin', '=', 'None', ',', 'stdout', '=', 'None', ',', 'stderr', '=', 'None', ',', 'exec_args', '=', 'None', ')', ':', 'stdin', '=', '"< "', '+', 'stdin', 'if', 'stdin', 'is', 'not', 'None', 'else', '""', 'stdout', '=', '"> "', '+', 'stdout', 'if...
Build and return a string with the command required to launch `executable` with the qadapter `qad`. Args qad: Qadapter instance. executable (str): Executable name or path stdin (str): Name of the file to be used as standard input. None means no redirection. stdou...
['Build', 'and', 'return', 'a', 'string', 'with', 'the', 'command', 'required', 'to', 'launch', 'executable', 'with', 'the', 'qadapter', 'qad', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L83-L128
685
O365/python-o365
O365/drive.py
DriveItemPermission.update_roles
def update_roles(self, roles='view'): """ Updates the roles of this permission :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get('permission').format( driveitem_id=self.drivei...
python
def update_roles(self, roles='view'): """ Updates the roles of this permission :return: Success / Failure :rtype: bool """ if not self.object_id: return False url = self.build_url(self._endpoints.get('permission').format( driveitem_id=self.drivei...
['def', 'update_roles', '(', 'self', ',', 'roles', '=', "'view'", ')', ':', 'if', 'not', 'self', '.', 'object_id', ':', 'return', 'False', 'url', '=', 'self', '.', 'build_url', '(', 'self', '.', '_endpoints', '.', 'get', '(', "'permission'", ')', '.', 'format', '(', 'driveitem_id', '=', 'self', '.', 'driveitem_id', ','...
Updates the roles of this permission :return: Success / Failure :rtype: bool
['Updates', 'the', 'roles', 'of', 'this', 'permission']
train
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/drive.py#L357-L381
686
bokeh/bokeh
bokeh/driving.py
bounce
def bounce(sequence): ''' Return a driver function that can advance a "bounced" sequence of values. .. code-block:: none seq = [0, 1, 2, 3] # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...] Args: sequence (seq) : a sequence of values for the driver to bounce ''' ...
python
def bounce(sequence): ''' Return a driver function that can advance a "bounced" sequence of values. .. code-block:: none seq = [0, 1, 2, 3] # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...] Args: sequence (seq) : a sequence of values for the driver to bounce ''' ...
['def', 'bounce', '(', 'sequence', ')', ':', 'N', '=', 'len', '(', 'sequence', ')', 'def', 'f', '(', 'i', ')', ':', 'div', ',', 'mod', '=', 'divmod', '(', 'i', ',', 'N', ')', 'if', 'div', '%', '2', '==', '0', ':', 'return', 'sequence', '[', 'mod', ']', 'else', ':', 'return', 'sequence', '[', 'N', '-', 'mod', '-', '1', ...
Return a driver function that can advance a "bounced" sequence of values. .. code-block:: none seq = [0, 1, 2, 3] # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...] Args: sequence (seq) : a sequence of values for the driver to bounce
['Return', 'a', 'driver', 'function', 'that', 'can', 'advance', 'a', 'bounced', 'sequence', 'of', 'values', '.']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/driving.py#L73-L94
687
Robpol86/libnl
libnl/genl/ctrl.py
genl_ctrl_grp_by_name
def genl_ctrl_grp_by_name(family, grp_name): """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L446. Positional arguments: family -- genl_family class instance. grp_name -- bytes. Returns: group ID or negative error code. """ for grp in nl_list_for_each_entry(genl_fa...
python
def genl_ctrl_grp_by_name(family, grp_name): """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L446. Positional arguments: family -- genl_family class instance. grp_name -- bytes. Returns: group ID or negative error code. """ for grp in nl_list_for_each_entry(genl_fa...
['def', 'genl_ctrl_grp_by_name', '(', 'family', ',', 'grp_name', ')', ':', 'for', 'grp', 'in', 'nl_list_for_each_entry', '(', 'genl_family_grp', '(', ')', ',', 'family', '.', 'gf_mc_grps', ',', "'list_'", ')', ':', 'if', 'grp', '.', 'name', '==', 'grp_name', ':', 'return', 'grp', '.', 'id_', 'return', '-', 'NLE_OBJ_NOT...
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L446. Positional arguments: family -- genl_family class instance. grp_name -- bytes. Returns: group ID or negative error code.
['https', ':', '//', 'github', '.', 'com', '/', 'thom311', '/', 'libnl', '/', 'blob', '/', 'libnl3_2_25', '/', 'lib', '/', 'genl', '/', 'ctrl', '.', 'c#L446', '.']
train
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/ctrl.py#L211-L224
688
jmbhughes/suvi-trainer
suvitrainer/gui.py
App.make_classify_tab
def make_classify_tab(self): """ initial set up of classification tab""" self.pick_frame = tk.Frame(self.tab_classify) self.pick_frame2 = tk.Frame(self.tab_classify) self.solar_class_var = tk.IntVar() self.solar_class_var.set(0) # initialize to unlabeled buttonnum = 0 ...
python
def make_classify_tab(self): """ initial set up of classification tab""" self.pick_frame = tk.Frame(self.tab_classify) self.pick_frame2 = tk.Frame(self.tab_classify) self.solar_class_var = tk.IntVar() self.solar_class_var.set(0) # initialize to unlabeled buttonnum = 0 ...
['def', 'make_classify_tab', '(', 'self', ')', ':', 'self', '.', 'pick_frame', '=', 'tk', '.', 'Frame', '(', 'self', '.', 'tab_classify', ')', 'self', '.', 'pick_frame2', '=', 'tk', '.', 'Frame', '(', 'self', '.', 'tab_classify', ')', 'self', '.', 'solar_class_var', '=', 'tk', '.', 'IntVar', '(', ')', 'self', '.', 'sol...
initial set up of classification tab
['initial', 'set', 'up', 'of', 'classification', 'tab']
train
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L531-L554
689
Erotemic/utool
utool/util_dev.py
autopep8_diff
def autopep8_diff(fpath): r""" Args: fpath (str): file path string CommandLine: python -m utool.util_dev --test-autopep8_diff --fpath ingest_data.py Example: >>> # DISABLE_DOCTEST >>> from utool.util_dev import * # NOQA >>> fpath = ut.get_argval('--fpath', typ...
python
def autopep8_diff(fpath): r""" Args: fpath (str): file path string CommandLine: python -m utool.util_dev --test-autopep8_diff --fpath ingest_data.py Example: >>> # DISABLE_DOCTEST >>> from utool.util_dev import * # NOQA >>> fpath = ut.get_argval('--fpath', typ...
['def', 'autopep8_diff', '(', 'fpath', ')', ':', 'import', 'utool', 'as', 'ut', 'args', '=', '(', "'autopep8'", ',', 'fpath', ',', "'--diff'", ')', 'res', '=', 'ut', '.', 'cmd', '(', 'args', ',', 'verbose', '=', 'False', ')', 'out', ',', 'err', ',', 'ret', '=', 'res', 'ut', '.', 'print_difftext', '(', 'out', ')']
r""" Args: fpath (str): file path string CommandLine: python -m utool.util_dev --test-autopep8_diff --fpath ingest_data.py Example: >>> # DISABLE_DOCTEST >>> from utool.util_dev import * # NOQA >>> fpath = ut.get_argval('--fpath', type_=str, default='ingest_data.p...
['r', 'Args', ':', 'fpath', '(', 'str', ')', ':', 'file', 'path', 'string']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dev.py#L2209-L2228
690
geertj/gruvi
lib/gruvi/stream.py
Stream.wrap
def wrap(self, encoding, **textio_args): """Return a :class:`io.TextIOWrapper` that wraps the stream. The wrapper provides text IO on top of the byte stream, using the specified *encoding*. The *textio_args* keyword arguments are additional keyword arguments passed to the :class:`~io.Te...
python
def wrap(self, encoding, **textio_args): """Return a :class:`io.TextIOWrapper` that wraps the stream. The wrapper provides text IO on top of the byte stream, using the specified *encoding*. The *textio_args* keyword arguments are additional keyword arguments passed to the :class:`~io.Te...
['def', 'wrap', '(', 'self', ',', 'encoding', ',', '*', '*', 'textio_args', ')', ':', '# By default we want write_through behavior, unless the user specifies', '# something else.', 'if', "'line_buffering'", 'not', 'in', 'textio_args', 'and', "'write_through'", 'not', 'in', 'textio_args', ':', 'textio_args', '[', "'writ...
Return a :class:`io.TextIOWrapper` that wraps the stream. The wrapper provides text IO on top of the byte stream, using the specified *encoding*. The *textio_args* keyword arguments are additional keyword arguments passed to the :class:`~io.TextIOWrapper` constructor. Unless another buf...
['Return', 'a', ':', 'class', ':', 'io', '.', 'TextIOWrapper', 'that', 'wraps', 'the', 'stream', '.']
train
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/stream.py#L177-L190
691
redhat-openstack/python-tripleo-helper
tripleohelper/server.py
Server.yum_update
def yum_update(self, allow_reboot=False): """Do a yum update on the system. :param allow_reboot: If True and if a new kernel has been installed, the system will be rebooted """ self.run('yum clean all') self.run('test -f /usr/bin/subscription-manager && subscription-mana...
python
def yum_update(self, allow_reboot=False): """Do a yum update on the system. :param allow_reboot: If True and if a new kernel has been installed, the system will be rebooted """ self.run('yum clean all') self.run('test -f /usr/bin/subscription-manager && subscription-mana...
['def', 'yum_update', '(', 'self', ',', 'allow_reboot', '=', 'False', ')', ':', 'self', '.', 'run', '(', "'yum clean all'", ')', 'self', '.', 'run', '(', "'test -f /usr/bin/subscription-manager && subscription-manager repos --list-enabled'", ',', 'ignore_error', '=', 'True', ')', 'self', '.', 'run', '(', "'yum repolist...
Do a yum update on the system. :param allow_reboot: If True and if a new kernel has been installed, the system will be rebooted
['Do', 'a', 'yum', 'update', 'on', 'the', 'system', '.']
train
https://github.com/redhat-openstack/python-tripleo-helper/blob/bfa165538335edb1088170c7a92f097167225c81/tripleohelper/server.py#L242-L260
692
bcbio/bcbio-nextgen
bcbio/structural/titancna.py
_run_titancna
def _run_titancna(cn_file, het_file, ploidy, num_clusters, work_dir, data): """Run titanCNA wrapper script on given ploidy and clusters. """ sample = dd.get_sample_name(data) cores = dd.get_num_cores(data) export_cmd = utils.get_R_exports() ploidy_dir = utils.safe_makedir(os.path.join(work_dir, ...
python
def _run_titancna(cn_file, het_file, ploidy, num_clusters, work_dir, data): """Run titanCNA wrapper script on given ploidy and clusters. """ sample = dd.get_sample_name(data) cores = dd.get_num_cores(data) export_cmd = utils.get_R_exports() ploidy_dir = utils.safe_makedir(os.path.join(work_dir, ...
['def', '_run_titancna', '(', 'cn_file', ',', 'het_file', ',', 'ploidy', ',', 'num_clusters', ',', 'work_dir', ',', 'data', ')', ':', 'sample', '=', 'dd', '.', 'get_sample_name', '(', 'data', ')', 'cores', '=', 'dd', '.', 'get_num_cores', '(', 'data', ')', 'export_cmd', '=', 'utils', '.', 'get_R_exports', '(', ')', 'pl...
Run titanCNA wrapper script on given ploidy and clusters.
['Run', 'titanCNA', 'wrapper', 'script', 'on', 'given', 'ploidy', 'and', 'clusters', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/titancna.py#L97-L143
693
Erotemic/utool
utool/util_project.py
ensure_user_profile
def ensure_user_profile(user_profile=None): r""" Args: user_profile (UserProfile): (default = None) Returns: UserProfile: user_profile CommandLine: python -m utool.util_project --exec-ensure_user_profile --show Example: >>> # DISABLE_DOCTEST >>> from utool....
python
def ensure_user_profile(user_profile=None): r""" Args: user_profile (UserProfile): (default = None) Returns: UserProfile: user_profile CommandLine: python -m utool.util_project --exec-ensure_user_profile --show Example: >>> # DISABLE_DOCTEST >>> from utool....
['def', 'ensure_user_profile', '(', 'user_profile', '=', 'None', ')', ':', 'global', '__GLOBAL_PROFILE__', 'if', '__GLOBAL_PROFILE__', 'is', 'None', ':', 'import', 'utool', 'as', 'ut', 'if', 'ut', '.', 'is_developer', '(', ')', ':', '__GLOBAL_PROFILE__', '=', 'ibeis_user_profile', '(', ')', 'else', ':', '__GLOBAL_PROFI...
r""" Args: user_profile (UserProfile): (default = None) Returns: UserProfile: user_profile CommandLine: python -m utool.util_project --exec-ensure_user_profile --show Example: >>> # DISABLE_DOCTEST >>> from utool.util_project import * # NOQA >>> import...
['r', 'Args', ':', 'user_profile', '(', 'UserProfile', ')', ':', '(', 'default', '=', 'None', ')']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_project.py#L573-L603
694
Xython/Linq.py
linq/standard/general.py
Skip
def Skip(self: Iterable, n): """ [ { 'self': [1, 2, 3, 4, 5], 'n': 3, 'assert': lambda ret: list(ret) == [4, 5] } ] """ con = iter(self) for i, _ in enumerate(con): if i == n: break retur...
python
def Skip(self: Iterable, n): """ [ { 'self': [1, 2, 3, 4, 5], 'n': 3, 'assert': lambda ret: list(ret) == [4, 5] } ] """ con = iter(self) for i, _ in enumerate(con): if i == n: break retur...
['def', 'Skip', '(', 'self', ':', 'Iterable', ',', 'n', ')', ':', 'con', '=', 'iter', '(', 'self', ')', 'for', 'i', ',', '_', 'in', 'enumerate', '(', 'con', ')', ':', 'if', 'i', '==', 'n', ':', 'break', 'return', 'con']
[ { 'self': [1, 2, 3, 4, 5], 'n': 3, 'assert': lambda ret: list(ret) == [4, 5] } ]
['[', '{', 'self', ':', '[', '1', '2', '3', '4', '5', ']', 'n', ':', '3', 'assert', ':', 'lambda', 'ret', ':', 'list', '(', 'ret', ')', '==', '[', '4', '5', ']', '}', ']']
train
https://github.com/Xython/Linq.py/blob/ffb65f92f1df0d8161d5f835f5947554f6f33d72/linq/standard/general.py#L209-L223
695
michaelliao/sinaweibopy
weibo.py
APIClient.get_authorize_url
def get_authorize_url(self, redirect_uri=None, **kw): ''' return the authorization url that the user should be redirected to. ''' redirect = redirect_uri if redirect_uri else self.redirect_uri if not redirect: raise APIError('21305', 'Parameter absent: redirect_uri', ...
python
def get_authorize_url(self, redirect_uri=None, **kw): ''' return the authorization url that the user should be redirected to. ''' redirect = redirect_uri if redirect_uri else self.redirect_uri if not redirect: raise APIError('21305', 'Parameter absent: redirect_uri', ...
['def', 'get_authorize_url', '(', 'self', ',', 'redirect_uri', '=', 'None', ',', '*', '*', 'kw', ')', ':', 'redirect', '=', 'redirect_uri', 'if', 'redirect_uri', 'else', 'self', '.', 'redirect_uri', 'if', 'not', 'redirect', ':', 'raise', 'APIError', '(', "'21305'", ',', "'Parameter absent: redirect_uri'", ',', "'OAuth2...
return the authorization url that the user should be redirected to.
['return', 'the', 'authorization', 'url', 'that', 'the', 'user', 'should', 'be', 'redirected', 'to', '.']
train
https://github.com/michaelliao/sinaweibopy/blob/0f19dd71c1fbd16ee539620c7e9e986887f5c665/weibo.py#L259-L270
696
influxdata/influxdb-python
influxdb/influxdb08/client.py
InfluxDBClient.get_database_users
def get_database_users(self): """Get list of database users.""" url = "db/{0}/users".format(self._database) response = self.request( url=url, method='GET', expected_response_code=200 ) return response.json()
python
def get_database_users(self): """Get list of database users.""" url = "db/{0}/users".format(self._database) response = self.request( url=url, method='GET', expected_response_code=200 ) return response.json()
['def', 'get_database_users', '(', 'self', ')', ':', 'url', '=', '"db/{0}/users"', '.', 'format', '(', 'self', '.', '_database', ')', 'response', '=', 'self', '.', 'request', '(', 'url', '=', 'url', ',', 'method', '=', "'GET'", ',', 'expected_response_code', '=', '200', ')', 'return', 'response', '.', 'json', '(', ')']
Get list of database users.
['Get', 'list', 'of', 'database', 'users', '.']
train
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/influxdb08/client.py#L733-L743
697
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB.find_matching_link
def find_matching_link(self, mode, group, addr): """Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number ad...
python
def find_matching_link(self, mode, group, addr): """Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number ad...
['def', 'find_matching_link', '(', 'self', ',', 'mode', ',', 'group', ',', 'addr', ')', ':', 'found_rec', '=', 'None', 'mode_test', '=', 'None', 'if', 'mode', '.', 'lower', '(', ')', 'in', '[', "'c'", ',', "'r'", ']', ':', 'link_group', '=', 'int', '(', 'group', ')', 'link_addr', '=', 'Address', '(', 'addr', ')', 'for'...
Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number addr: Inteon address of the linked device
['Find', 'a', 'matching', 'link', 'in', 'the', 'current', 'device', '.']
train
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1347-L1371
698
log2timeline/dfvfs
dfvfs/file_io/encoded_stream_io.py
EncodedStream._ReadEncodedData
def _ReadEncodedData(self, read_size): """Reads encoded data from the file-like object. Args: read_size (int): number of bytes of encoded data to read. Returns: int: number of bytes of encoded data read. """ encoded_data = self._file_object.read(read_size) read_count = len(encoded...
python
def _ReadEncodedData(self, read_size): """Reads encoded data from the file-like object. Args: read_size (int): number of bytes of encoded data to read. Returns: int: number of bytes of encoded data read. """ encoded_data = self._file_object.read(read_size) read_count = len(encoded...
['def', '_ReadEncodedData', '(', 'self', ',', 'read_size', ')', ':', 'encoded_data', '=', 'self', '.', '_file_object', '.', 'read', '(', 'read_size', ')', 'read_count', '=', 'len', '(', 'encoded_data', ')', 'self', '.', '_encoded_data', '=', "b''", '.', 'join', '(', '[', 'self', '.', '_encoded_data', ',', 'encoded_data...
Reads encoded data from the file-like object. Args: read_size (int): number of bytes of encoded data to read. Returns: int: number of bytes of encoded data read.
['Reads', 'encoded', 'data', 'from', 'the', 'file', '-', 'like', 'object', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/encoded_stream_io.py#L158-L178
699
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI.add_language_to_project
def add_language_to_project(self, project_id, language_code): """ Adds a new language to project """ self._run( url_path="languages/add", id=project_id, language=language_code ) return True
python
def add_language_to_project(self, project_id, language_code): """ Adds a new language to project """ self._run( url_path="languages/add", id=project_id, language=language_code ) return True
['def', 'add_language_to_project', '(', 'self', ',', 'project_id', ',', 'language_code', ')', ':', 'self', '.', '_run', '(', 'url_path', '=', '"languages/add"', ',', 'id', '=', 'project_id', ',', 'language', '=', 'language_code', ')', 'return', 'True']
Adds a new language to project
['Adds', 'a', 'new', 'language', 'to', 'project']
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L253-L262