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
700
troeger/opensubmit
web/opensubmit/admin/course.py
CourseAdmin.get_queryset
def get_queryset(self, request): ''' Restrict the listed courses for the current user.''' qs = super(CourseAdmin, self).get_queryset(request) if request.user.is_superuser: return qs else: return qs.filter(Q(tutors__pk=request.user.pk) | Q(owner=request.user)).dist...
python
def get_queryset(self, request): ''' Restrict the listed courses for the current user.''' qs = super(CourseAdmin, self).get_queryset(request) if request.user.is_superuser: return qs else: return qs.filter(Q(tutors__pk=request.user.pk) | Q(owner=request.user)).dist...
['def', 'get_queryset', '(', 'self', ',', 'request', ')', ':', 'qs', '=', 'super', '(', 'CourseAdmin', ',', 'self', ')', '.', 'get_queryset', '(', 'request', ')', 'if', 'request', '.', 'user', '.', 'is_superuser', ':', 'return', 'qs', 'else', ':', 'return', 'qs', '.', 'filter', '(', 'Q', '(', 'tutors__pk', '=', 'reques...
Restrict the listed courses for the current user.
['Restrict', 'the', 'listed', 'courses', 'for', 'the', 'current', 'user', '.']
train
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/course.py#L25-L31
701
allenai/allennlp
allennlp/common/params.py
Params.get
def get(self, key: str, default: Any = DEFAULT): """ Performs the functionality associated with dict.get(key) but also checks for returned dicts and returns a Params object in their place with an updated history. """ if default is self.DEFAULT: try: va...
python
def get(self, key: str, default: Any = DEFAULT): """ Performs the functionality associated with dict.get(key) but also checks for returned dicts and returns a Params object in their place with an updated history. """ if default is self.DEFAULT: try: va...
['def', 'get', '(', 'self', ',', 'key', ':', 'str', ',', 'default', ':', 'Any', '=', 'DEFAULT', ')', ':', 'if', 'default', 'is', 'self', '.', 'DEFAULT', ':', 'try', ':', 'value', '=', 'self', '.', 'params', '.', 'get', '(', 'key', ')', 'except', 'KeyError', ':', 'raise', 'ConfigurationError', '(', '"key \\"{}\\" is req...
Performs the functionality associated with dict.get(key) but also checks for returned dicts and returns a Params object in their place with an updated history.
['Performs', 'the', 'functionality', 'associated', 'with', 'dict', '.', 'get', '(', 'key', ')', 'but', 'also', 'checks', 'for', 'returned', 'dicts', 'and', 'returns', 'a', 'Params', 'object', 'in', 'their', 'place', 'with', 'an', 'updated', 'history', '.']
train
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/common/params.py#L291-L303
702
deepmind/pysc2
pysc2/lib/run_parallel.py
RunParallel.run
def run(self, funcs): """Run a set of functions in parallel, returning their results. Make sure any function you pass exits with a reasonable timeout. If it doesn't return within the timeout or the result is ignored due an exception in a separate thread it will continue to stick around until it finishe...
python
def run(self, funcs): """Run a set of functions in parallel, returning their results. Make sure any function you pass exits with a reasonable timeout. If it doesn't return within the timeout or the result is ignored due an exception in a separate thread it will continue to stick around until it finishe...
['def', 'run', '(', 'self', ',', 'funcs', ')', ':', 'funcs', '=', '[', 'f', 'if', 'callable', '(', 'f', ')', 'else', 'functools', '.', 'partial', '(', '*', 'f', ')', 'for', 'f', 'in', 'funcs', ']', 'if', 'len', '(', 'funcs', ')', '==', '1', ':', "# Ignore threads if it's not needed.", 'return', '[', 'funcs', '[', '0', ...
Run a set of functions in parallel, returning their results. Make sure any function you pass exits with a reasonable timeout. If it doesn't return within the timeout or the result is ignored due an exception in a separate thread it will continue to stick around until it finishes, including blocking pro...
['Run', 'a', 'set', 'of', 'functions', 'in', 'parallel', 'returning', 'their', 'results', '.']
train
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/run_parallel.py#L37-L75
703
PaloAltoNetworks/pancloud
pancloud/credentials.py
Credentials._credentials_found_in_envars
def _credentials_found_in_envars(): """Check for credentials in envars. Returns: bool: ``True`` if at least one is found, otherwise ``False``. """ return any([os.getenv('PAN_ACCESS_TOKEN'), os.getenv('PAN_CLIENT_ID'), os.getenv('PAN_C...
python
def _credentials_found_in_envars(): """Check for credentials in envars. Returns: bool: ``True`` if at least one is found, otherwise ``False``. """ return any([os.getenv('PAN_ACCESS_TOKEN'), os.getenv('PAN_CLIENT_ID'), os.getenv('PAN_C...
['def', '_credentials_found_in_envars', '(', ')', ':', 'return', 'any', '(', '[', 'os', '.', 'getenv', '(', "'PAN_ACCESS_TOKEN'", ')', ',', 'os', '.', 'getenv', '(', "'PAN_CLIENT_ID'", ')', ',', 'os', '.', 'getenv', '(', "'PAN_CLIENT_SECRET'", ')', ',', 'os', '.', 'getenv', '(', "'PAN_REFRESH_TOKEN'", ')', ']', ')']
Check for credentials in envars. Returns: bool: ``True`` if at least one is found, otherwise ``False``.
['Check', 'for', 'credentials', 'in', 'envars', '.']
train
https://github.com/PaloAltoNetworks/pancloud/blob/c51e4c8aca3c988c60f062291007534edcb55285/pancloud/credentials.py#L183-L193
704
tomer8007/kik-bot-api-unofficial
kik_unofficial/client.py
KikClient.check_username_uniqueness
def check_username_uniqueness(self, username): """ Checks if the given username is available for registration. Results are returned in the on_username_uniqueness_received() callback :param username: The username to check for its existence """ log.info("[+] Checking for U...
python
def check_username_uniqueness(self, username): """ Checks if the given username is available for registration. Results are returned in the on_username_uniqueness_received() callback :param username: The username to check for its existence """ log.info("[+] Checking for U...
['def', 'check_username_uniqueness', '(', 'self', ',', 'username', ')', ':', 'log', '.', 'info', '(', '"[+] Checking for Uniqueness of username \'{}\'"', '.', 'format', '(', 'username', ')', ')', 'return', 'self', '.', '_send_xmpp_element', '(', 'sign_up', '.', 'CheckUsernameUniquenessRequest', '(', 'username', ')', ')...
Checks if the given username is available for registration. Results are returned in the on_username_uniqueness_received() callback :param username: The username to check for its existence
['Checks', 'if', 'the', 'given', 'username', 'is', 'available', 'for', 'registration', '.', 'Results', 'are', 'returned', 'in', 'the', 'on_username_uniqueness_received', '()', 'callback']
train
https://github.com/tomer8007/kik-bot-api-unofficial/blob/2ae5216bc05e7099a41895382fc8e428a7a5c3ac/kik_unofficial/client.py#L359-L367
705
ellmetha/django-machina
machina/apps/forum_conversation/forum_polls/views.py
TopicPollVoteView.get_form_kwargs
def get_form_kwargs(self): """ Returns the keyword arguments to provide tp the associated form. """ kwargs = super(ModelFormMixin, self).get_form_kwargs() kwargs['poll'] = self.object return kwargs
python
def get_form_kwargs(self): """ Returns the keyword arguments to provide tp the associated form. """ kwargs = super(ModelFormMixin, self).get_form_kwargs() kwargs['poll'] = self.object return kwargs
['def', 'get_form_kwargs', '(', 'self', ')', ':', 'kwargs', '=', 'super', '(', 'ModelFormMixin', ',', 'self', ')', '.', 'get_form_kwargs', '(', ')', 'kwargs', '[', "'poll'", ']', '=', 'self', '.', 'object', 'return', 'kwargs']
Returns the keyword arguments to provide tp the associated form.
['Returns', 'the', 'keyword', 'arguments', 'to', 'provide', 'tp', 'the', 'associated', 'form', '.']
train
https://github.com/ellmetha/django-machina/blob/89ac083c1eaf1cfdeae6686ee094cc86362e8c69/machina/apps/forum_conversation/forum_polls/views.py#L37-L41
706
bitesofcode/projex
projex/init.py
importobject
def importobject(module_name, object_name): """ Imports the object with the given name from the inputted module. :param module_name | <str> object_name | <str> :usage |>>> import projex |>>> modname = 'projex.envmanager' |>>> attr = 'En...
python
def importobject(module_name, object_name): """ Imports the object with the given name from the inputted module. :param module_name | <str> object_name | <str> :usage |>>> import projex |>>> modname = 'projex.envmanager' |>>> attr = 'En...
['def', 'importobject', '(', 'module_name', ',', 'object_name', ')', ':', 'if', 'module_name', 'not', 'in', 'sys', '.', 'modules', ':', 'try', ':', '__import__', '(', 'module_name', ')', 'except', 'ImportError', ':', 'logger', '.', 'debug', '(', 'traceback', '.', 'print_exc', '(', ')', ')', 'logger', '.', 'error', '(',...
Imports the object with the given name from the inputted module. :param module_name | <str> object_name | <str> :usage |>>> import projex |>>> modname = 'projex.envmanager' |>>> attr = 'EnvManager' |>>> EnvManager = projex.impor...
['Imports', 'the', 'object', 'with', 'the', 'given', 'name', 'from', 'the', 'inputted', 'module', '.', ':', 'param', 'module_name', '|', '<str', '>', 'object_name', '|', '<str', '>', ':', 'usage', '|', '>>>', 'import', 'projex', '|', '>>>', 'modname', '=', 'projex', '.', 'envmanager', '|', '>>>', 'attr', '=', 'EnvManag...
train
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/init.py#L257-L288
707
petebachant/Nortek-Python
nortek/controls.py
PdControl.coordinate_system
def coordinate_system(self, coordsys): """Sets instrument coordinate system. Accepts an int or string.""" if coordsys.upper() == "ENU": ncs = 0 elif coordsys.upper() == "XYZ": ncs = 1 elif coordsys.upper() == "BEAM": ncs = 2 elif coordsys in [0...
python
def coordinate_system(self, coordsys): """Sets instrument coordinate system. Accepts an int or string.""" if coordsys.upper() == "ENU": ncs = 0 elif coordsys.upper() == "XYZ": ncs = 1 elif coordsys.upper() == "BEAM": ncs = 2 elif coordsys in [0...
['def', 'coordinate_system', '(', 'self', ',', 'coordsys', ')', ':', 'if', 'coordsys', '.', 'upper', '(', ')', '==', '"ENU"', ':', 'ncs', '=', '0', 'elif', 'coordsys', '.', 'upper', '(', ')', '==', '"XYZ"', ':', 'ncs', '=', '1', 'elif', 'coordsys', '.', 'upper', '(', ')', '==', '"BEAM"', ':', 'ncs', '=', '2', 'elif', '...
Sets instrument coordinate system. Accepts an int or string.
['Sets', 'instrument', 'coordinate', 'system', '.', 'Accepts', 'an', 'int', 'or', 'string', '.']
train
https://github.com/petebachant/Nortek-Python/blob/6c979662cf62c11ad5899ccc5e53365c87e5be02/nortek/controls.py#L332-L344
708
danilobellini/audiolazy
audiolazy/lazy_lpc.py
lpc
def lpc(blk, order=None): """ Find the Linear Predictive Coding (LPC) coefficients as a ZFilter object, the analysis whitening filter. This implementation uses the autocorrelation method, using numpy.linalg.pinv as a linear system solver. Parameters ---------- blk : An iterable with well-defined leng...
python
def lpc(blk, order=None): """ Find the Linear Predictive Coding (LPC) coefficients as a ZFilter object, the analysis whitening filter. This implementation uses the autocorrelation method, using numpy.linalg.pinv as a linear system solver. Parameters ---------- blk : An iterable with well-defined leng...
['def', 'lpc', '(', 'blk', ',', 'order', '=', 'None', ')', ':', 'from', 'numpy', 'import', 'matrix', 'from', 'numpy', '.', 'linalg', 'import', 'pinv', 'acdata', '=', 'acorr', '(', 'blk', ',', 'order', ')', 'coeffs', '=', 'pinv', '(', 'toeplitz', '(', 'acdata', '[', ':', '-', '1', ']', ')', ')', '*', '-', 'matrix', '(',...
Find the Linear Predictive Coding (LPC) coefficients as a ZFilter object, the analysis whitening filter. This implementation uses the autocorrelation method, using numpy.linalg.pinv as a linear system solver. Parameters ---------- blk : An iterable with well-defined length. Don't use this function with S...
['Find', 'the', 'Linear', 'Predictive', 'Coding', '(', 'LPC', ')', 'coefficients', 'as', 'a', 'ZFilter', 'object', 'the', 'analysis', 'whitening', 'filter', '.', 'This', 'implementation', 'uses', 'the', 'autocorrelation', 'method', 'using', 'numpy', '.', 'linalg', '.', 'pinv', 'as', 'a', 'linear', 'system', 'solver', '...
train
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_lpc.py#L187-L225
709
facetoe/zenpy
zenpy/lib/api.py
BaseApi.check_ratelimit_budget
def check_ratelimit_budget(self, seconds_waited): """ If we have a ratelimit_budget, ensure it is not exceeded. """ if self.ratelimit_budget is not None: self.ratelimit_budget -= seconds_waited if self.ratelimit_budget < 1: raise RatelimitBudgetExceeded("Rate limi...
python
def check_ratelimit_budget(self, seconds_waited): """ If we have a ratelimit_budget, ensure it is not exceeded. """ if self.ratelimit_budget is not None: self.ratelimit_budget -= seconds_waited if self.ratelimit_budget < 1: raise RatelimitBudgetExceeded("Rate limi...
['def', 'check_ratelimit_budget', '(', 'self', ',', 'seconds_waited', ')', ':', 'if', 'self', '.', 'ratelimit_budget', 'is', 'not', 'None', ':', 'self', '.', 'ratelimit_budget', '-=', 'seconds_waited', 'if', 'self', '.', 'ratelimit_budget', '<', '1', ':', 'raise', 'RatelimitBudgetExceeded', '(', '"Rate limit budget exc...
If we have a ratelimit_budget, ensure it is not exceeded.
['If', 'we', 'have', 'a', 'ratelimit_budget', 'ensure', 'it', 'is', 'not', 'exceeded', '.']
train
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api.py#L153-L158
710
saltstack/salt
salt/modules/boto_kms.py
generate_data_key
def generate_data_key(key_id, encryption_context=None, number_of_bytes=None, key_spec=None, grant_tokens=None, region=None, key=None, keyid=None, profile=None): ''' Generate a secure data key. CLI example:: salt myminion boto_kms.generate_data_key 'alias...
python
def generate_data_key(key_id, encryption_context=None, number_of_bytes=None, key_spec=None, grant_tokens=None, region=None, key=None, keyid=None, profile=None): ''' Generate a secure data key. CLI example:: salt myminion boto_kms.generate_data_key 'alias...
['def', 'generate_data_key', '(', 'key_id', ',', 'encryption_context', '=', 'None', ',', 'number_of_bytes', '=', 'None', ',', 'key_spec', '=', 'None', ',', 'grant_tokens', '=', 'None', ',', 'region', '=', 'None', ',', 'key', '=', 'None', ',', 'keyid', '=', 'None', ',', 'profile', '=', 'None', ')', ':', 'conn', '=', '_g...
Generate a secure data key. CLI example:: salt myminion boto_kms.generate_data_key 'alias/mykey' number_of_bytes=1024 key_spec=AES_128
['Generate', 'a', 'secure', 'data', 'key', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_kms.py#L340-L364
711
xolox/python-verboselogs
verboselogs/__init__.py
VerboseLogger.verbose
def verbose(self, msg, *args, **kw): """Log a message with level :data:`VERBOSE`. The arguments are interpreted as for :func:`logging.debug()`.""" if self.isEnabledFor(VERBOSE): self._log(VERBOSE, msg, args, **kw)
python
def verbose(self, msg, *args, **kw): """Log a message with level :data:`VERBOSE`. The arguments are interpreted as for :func:`logging.debug()`.""" if self.isEnabledFor(VERBOSE): self._log(VERBOSE, msg, args, **kw)
['def', 'verbose', '(', 'self', ',', 'msg', ',', '*', 'args', ',', '*', '*', 'kw', ')', ':', 'if', 'self', '.', 'isEnabledFor', '(', 'VERBOSE', ')', ':', 'self', '.', '_log', '(', 'VERBOSE', ',', 'msg', ',', 'args', ',', '*', '*', 'kw', ')']
Log a message with level :data:`VERBOSE`. The arguments are interpreted as for :func:`logging.debug()`.
['Log', 'a', 'message', 'with', 'level', ':', 'data', ':', 'VERBOSE', '.', 'The', 'arguments', 'are', 'interpreted', 'as', 'for', ':', 'func', ':', 'logging', '.', 'debug', '()', '.']
train
https://github.com/xolox/python-verboselogs/blob/3cebc69e03588bb6c3726c38c324b12732989292/verboselogs/__init__.py#L163-L166
712
aiogram/aiogram
aiogram/dispatcher/webhook.py
WebhookRequestHandler.respond_via_request
def respond_via_request(self, task): """ Handle response after 55 second. :param task: :return: """ warn(f"Detected slow response into webhook. " f"(Greater than {RESPONSE_TIMEOUT} seconds)\n" f"Recommended to use 'async_task' decorator from Dis...
python
def respond_via_request(self, task): """ Handle response after 55 second. :param task: :return: """ warn(f"Detected slow response into webhook. " f"(Greater than {RESPONSE_TIMEOUT} seconds)\n" f"Recommended to use 'async_task' decorator from Dis...
['def', 'respond_via_request', '(', 'self', ',', 'task', ')', ':', 'warn', '(', 'f"Detected slow response into webhook. "', 'f"(Greater than {RESPONSE_TIMEOUT} seconds)\\n"', 'f"Recommended to use \'async_task\' decorator from Dispatcher for handler with long timeouts."', ',', 'TimeoutWarning', ')', 'dispatcher', '=', ...
Handle response after 55 second. :param task: :return:
['Handle', 'response', 'after', '55', 'second', '.']
train
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L196-L219
713
geertj/gruvi
lib/gruvi/sync.py
Condition.wait_for
def wait_for(self, predicate, timeout=None): """Like :meth:`wait` but additionally for *predicate* to be true. The *predicate* argument must be a callable that takes no arguments. Its result is interpreted as a boolean value. """ if not is_locked(self._lock): raise R...
python
def wait_for(self, predicate, timeout=None): """Like :meth:`wait` but additionally for *predicate* to be true. The *predicate* argument must be a callable that takes no arguments. Its result is interpreted as a boolean value. """ if not is_locked(self._lock): raise R...
['def', 'wait_for', '(', 'self', ',', 'predicate', ',', 'timeout', '=', 'None', ')', ':', 'if', 'not', 'is_locked', '(', 'self', '.', '_lock', ')', ':', 'raise', 'RuntimeError', '(', "'lock is not locked'", ')', 'hub', '=', 'get_hub', '(', ')', 'try', ':', 'with', 'switch_back', '(', 'timeout', ',', 'lock', '=', 'threa...
Like :meth:`wait` but additionally for *predicate* to be true. The *predicate* argument must be a callable that takes no arguments. Its result is interpreted as a boolean value.
['Like', ':', 'meth', ':', 'wait', 'but', 'additionally', 'for', '*', 'predicate', '*', 'to', 'be', 'true', '.']
train
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/sync.py#L381-L406
714
wbond/asn1crypto
asn1crypto/x509.py
Certificate.authority_issuer_serial
def authority_issuer_serial(self): """ :return: None or a byte string of the SHA-256 hash of the isser from the authority key identifier extension concatenated with the ascii character ":", concatenated with the serial number from the authority key identif...
python
def authority_issuer_serial(self): """ :return: None or a byte string of the SHA-256 hash of the isser from the authority key identifier extension concatenated with the ascii character ":", concatenated with the serial number from the authority key identif...
['def', 'authority_issuer_serial', '(', 'self', ')', ':', 'if', 'self', '.', '_authority_issuer_serial', 'is', 'False', ':', 'akiv', '=', 'self', '.', 'authority_key_identifier_value', 'if', 'akiv', 'and', 'akiv', '[', "'authority_cert_issuer'", ']', '.', 'native', ':', 'issuer', '=', 'self', '.', 'authority_key_identi...
:return: None or a byte string of the SHA-256 hash of the isser from the authority key identifier extension concatenated with the ascii character ":", concatenated with the serial number from the authority key identifier extension as an ascii string
[':', 'return', ':', 'None', 'or', 'a', 'byte', 'string', 'of', 'the', 'SHA', '-', '256', 'hash', 'of', 'the', 'isser', 'from', 'the', 'authority', 'key', 'identifier', 'extension', 'concatenated', 'with', 'the', 'ascii', 'character', ':', 'concatenated', 'with', 'the', 'serial', 'number', 'from', 'the', 'authority', '...
train
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/x509.py#L2612-L2631
715
hobu/mgrs
mgrs/__init__.py
MGRS.ddtodms
def ddtodms(self, dd): """Take in dd string and convert to dms""" negative = dd < 0 dd = abs(dd) minutes,seconds = divmod(dd*3600,60) degrees,minutes = divmod(minutes,60) if negative: if degrees > 0: degrees = -degrees elif minutes ...
python
def ddtodms(self, dd): """Take in dd string and convert to dms""" negative = dd < 0 dd = abs(dd) minutes,seconds = divmod(dd*3600,60) degrees,minutes = divmod(minutes,60) if negative: if degrees > 0: degrees = -degrees elif minutes ...
['def', 'ddtodms', '(', 'self', ',', 'dd', ')', ':', 'negative', '=', 'dd', '<', '0', 'dd', '=', 'abs', '(', 'dd', ')', 'minutes', ',', 'seconds', '=', 'divmod', '(', 'dd', '*', '3600', ',', '60', ')', 'degrees', ',', 'minutes', '=', 'divmod', '(', 'minutes', ',', '60', ')', 'if', 'negative', ':', 'if', 'degrees', '>',...
Take in dd string and convert to dms
['Take', 'in', 'dd', 'string', 'and', 'convert', 'to', 'dms']
train
https://github.com/hobu/mgrs/blob/759b3aba86779318854c73b8843ea956acb5eb3f/mgrs/__init__.py#L13-L26
716
pyopenapi/pyswagger
pyswagger/spec/base.py
BaseObj.compare
def compare(self, other, base=None): """ comparison, will return the first difference """ if self.__class__ != other.__class__: return False, '' names = self._field_names_ def cmp_func(name, s, o): # special case for string types if isinstance(s, six...
python
def compare(self, other, base=None): """ comparison, will return the first difference """ if self.__class__ != other.__class__: return False, '' names = self._field_names_ def cmp_func(name, s, o): # special case for string types if isinstance(s, six...
['def', 'compare', '(', 'self', ',', 'other', ',', 'base', '=', 'None', ')', ':', 'if', 'self', '.', '__class__', '!=', 'other', '.', '__class__', ':', 'return', 'False', ',', "''", 'names', '=', 'self', '.', '_field_names_', 'def', 'cmp_func', '(', 'name', ',', 's', ',', 'o', ')', ':', '# special case for string types...
comparison, will return the first difference
['comparison', 'will', 'return', 'the', 'first', 'difference']
train
https://github.com/pyopenapi/pyswagger/blob/333c4ca08e758cd2194943d9904a3eda3fe43977/pyswagger/spec/base.py#L345-L391
717
tanghaibao/goatools
goatools/anno/dnld_ebi_goa.py
DnldGoa.dnld_goa
def dnld_goa(self, species, ext='gaf', item=None, fileout=None): """Download GOA source file name on EMBL-EBI ftp server.""" basename = self.get_basename(species, ext, item) src = os.path.join(self.ftp_src_goa, species.upper(), "{F}.gz".format(F=basename)) dst = os.path.join(os.getcwd(),...
python
def dnld_goa(self, species, ext='gaf', item=None, fileout=None): """Download GOA source file name on EMBL-EBI ftp server.""" basename = self.get_basename(species, ext, item) src = os.path.join(self.ftp_src_goa, species.upper(), "{F}.gz".format(F=basename)) dst = os.path.join(os.getcwd(),...
['def', 'dnld_goa', '(', 'self', ',', 'species', ',', 'ext', '=', "'gaf'", ',', 'item', '=', 'None', ',', 'fileout', '=', 'None', ')', ':', 'basename', '=', 'self', '.', 'get_basename', '(', 'species', ',', 'ext', ',', 'item', ')', 'src', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'ftp_src_goa', ',', 'speci...
Download GOA source file name on EMBL-EBI ftp server.
['Download', 'GOA', 'source', 'file', 'name', 'on', 'EMBL', '-', 'EBI', 'ftp', 'server', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/anno/dnld_ebi_goa.py#L41-L47
718
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/reftrack/asset.py
AssetReftypeInterface.get_scenenode
def get_scenenode(self, nodes): """Get the scenenode in the given nodes There should only be one scenenode in nodes! :param nodes: :type nodes: :returns: None :rtype: None :raises: AssertionError """ scenenodes = cmds.ls(nodes, type='jb_sceneNode...
python
def get_scenenode(self, nodes): """Get the scenenode in the given nodes There should only be one scenenode in nodes! :param nodes: :type nodes: :returns: None :rtype: None :raises: AssertionError """ scenenodes = cmds.ls(nodes, type='jb_sceneNode...
['def', 'get_scenenode', '(', 'self', ',', 'nodes', ')', ':', 'scenenodes', '=', 'cmds', '.', 'ls', '(', 'nodes', ',', 'type', '=', "'jb_sceneNode'", ')', 'assert', 'scenenodes', ',', '"Found no scene nodes!"', 'return', 'sorted', '(', 'scenenodes', ')', '[', '0', ']']
Get the scenenode in the given nodes There should only be one scenenode in nodes! :param nodes: :type nodes: :returns: None :rtype: None :raises: AssertionError
['Get', 'the', 'scenenode', 'in', 'the', 'given', 'nodes']
train
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/asset.py#L85-L98
719
theonion/django-bulbs
bulbs/sections/models.py
Section.get_content
def get_content(self): """performs es search and gets content objects """ if "query" in self.query: q = self.query["query"] else: q = self.query search = custom_search_model(Content, q, field_map={ "feature-type": "feature_type.slug", ...
python
def get_content(self): """performs es search and gets content objects """ if "query" in self.query: q = self.query["query"] else: q = self.query search = custom_search_model(Content, q, field_map={ "feature-type": "feature_type.slug", ...
['def', 'get_content', '(', 'self', ')', ':', 'if', '"query"', 'in', 'self', '.', 'query', ':', 'q', '=', 'self', '.', 'query', '[', '"query"', ']', 'else', ':', 'q', '=', 'self', '.', 'query', 'search', '=', 'custom_search_model', '(', 'Content', ',', 'q', ',', 'field_map', '=', '{', '"feature-type"', ':', '"feature_t...
performs es search and gets content objects
['performs', 'es', 'search', 'and', 'gets', 'content', 'objects']
train
https://github.com/theonion/django-bulbs/blob/0c0e6e3127a7dc487b96677fab95cacd2b3806da/bulbs/sections/models.py#L81-L93
720
apache/spark
python/pyspark/sql/dataframe.py
DataFrame.unpersist
def unpersist(self, blocking=False): """Marks the :class:`DataFrame` as non-persistent, and remove all blocks for it from memory and disk. .. note:: `blocking` default has changed to False to match Scala in 2.0. """ self.is_cached = False self._jdf.unpersist(blocking) ...
python
def unpersist(self, blocking=False): """Marks the :class:`DataFrame` as non-persistent, and remove all blocks for it from memory and disk. .. note:: `blocking` default has changed to False to match Scala in 2.0. """ self.is_cached = False self._jdf.unpersist(blocking) ...
['def', 'unpersist', '(', 'self', ',', 'blocking', '=', 'False', ')', ':', 'self', '.', 'is_cached', '=', 'False', 'self', '.', '_jdf', '.', 'unpersist', '(', 'blocking', ')', 'return', 'self']
Marks the :class:`DataFrame` as non-persistent, and remove all blocks for it from memory and disk. .. note:: `blocking` default has changed to False to match Scala in 2.0.
['Marks', 'the', ':', 'class', ':', 'DataFrame', 'as', 'non', '-', 'persistent', 'and', 'remove', 'all', 'blocks', 'for', 'it', 'from', 'memory', 'and', 'disk', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/dataframe.py#L626-L634
721
shaldengeki/python-mal
myanimelist/character.py
Character.parse_pictures
def parse_pictures(self, picture_page): """Parses the DOM and returns character pictures attributes. :type picture_page: :class:`bs4.BeautifulSoup` :param picture_page: MAL character pictures page's DOM :rtype: dict :return: character pictures attributes. """ character_info = self.parse_s...
python
def parse_pictures(self, picture_page): """Parses the DOM and returns character pictures attributes. :type picture_page: :class:`bs4.BeautifulSoup` :param picture_page: MAL character pictures page's DOM :rtype: dict :return: character pictures attributes. """ character_info = self.parse_s...
['def', 'parse_pictures', '(', 'self', ',', 'picture_page', ')', ':', 'character_info', '=', 'self', '.', 'parse_sidebar', '(', 'picture_page', ')', 'second_col', '=', 'picture_page', '.', 'find', '(', "u'div'", ',', '{', "'id'", ':', "'content'", '}', ')', '.', 'find', '(', "u'table'", ')', '.', 'find', '(', "u'tr'", ...
Parses the DOM and returns character pictures attributes. :type picture_page: :class:`bs4.BeautifulSoup` :param picture_page: MAL character pictures page's DOM :rtype: dict :return: character pictures attributes.
['Parses', 'the', 'DOM', 'and', 'returns', 'character', 'pictures', 'attributes', '.']
train
https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L226-L248
722
underworldcode/stripy
stripy-src/stripy/cartesian.py
Triangulation.neighbour_and_arc_simplices
def neighbour_and_arc_simplices(self): """ Get indices of neighbour simplices for each simplex and arc indices. Identical to get_neighbour_simplices() but also returns an array of indices that reside on boundary hull, -1 denotes no neighbour. """ nt, ltri, lct, ierr = _tr...
python
def neighbour_and_arc_simplices(self): """ Get indices of neighbour simplices for each simplex and arc indices. Identical to get_neighbour_simplices() but also returns an array of indices that reside on boundary hull, -1 denotes no neighbour. """ nt, ltri, lct, ierr = _tr...
['def', 'neighbour_and_arc_simplices', '(', 'self', ')', ':', 'nt', ',', 'ltri', ',', 'lct', ',', 'ierr', '=', '_tripack', '.', 'trlist', '(', 'self', '.', 'lst', ',', 'self', '.', 'lptr', ',', 'self', '.', 'lend', ',', 'nrow', '=', '9', ')', 'if', 'ierr', '!=', '0', ':', 'raise', 'ValueError', '(', "'ierr={} in trlist...
Get indices of neighbour simplices for each simplex and arc indices. Identical to get_neighbour_simplices() but also returns an array of indices that reside on boundary hull, -1 denotes no neighbour.
['Get', 'indices', 'of', 'neighbour', 'simplices', 'for', 'each', 'simplex', 'and', 'arc', 'indices', '.', 'Identical', 'to', 'get_neighbour_simplices', '()', 'but', 'also', 'returns', 'an', 'array', 'of', 'indices', 'that', 'reside', 'on', 'boundary', 'hull', '-', '1', 'denotes', 'no', 'neighbour', '.']
train
https://github.com/underworldcode/stripy/blob/d4c3480c3e58c88489ded695eadbe7cd5bf94b48/stripy-src/stripy/cartesian.py#L590-L600
723
SBRG/ssbio
ssbio/protein/structure/structprop.py
StructProp.get_msms_annotations
def get_msms_annotations(self, outdir, force_rerun=False): """Run MSMS on this structure and store the residue depths/ca depths in the corresponding ChainProp SeqRecords """ # Now can run on Biopython Model objects exclusively thanks to Biopython updates # if self.file_type != 'pdb': ...
python
def get_msms_annotations(self, outdir, force_rerun=False): """Run MSMS on this structure and store the residue depths/ca depths in the corresponding ChainProp SeqRecords """ # Now can run on Biopython Model objects exclusively thanks to Biopython updates # if self.file_type != 'pdb': ...
['def', 'get_msms_annotations', '(', 'self', ',', 'outdir', ',', 'force_rerun', '=', 'False', ')', ':', '# Now can run on Biopython Model objects exclusively thanks to Biopython updates', "# if self.file_type != 'pdb':", '# raise ValueError(\'{}: unable to run MSMS with "{}" file type. Please change file type to "p...
Run MSMS on this structure and store the residue depths/ca depths in the corresponding ChainProp SeqRecords
['Run', 'MSMS', 'on', 'this', 'structure', 'and', 'store', 'the', 'residue', 'depths', '/', 'ca', 'depths', 'in', 'the', 'corresponding', 'ChainProp', 'SeqRecords']
train
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L501-L546
724
acorg/dark-matter
dark/process.py
Executor.execute
def execute(self, command): """ Execute (or simulate) a command. Add to our log. @param command: Either a C{str} command (which will be passed to the shell) or a C{list} of command arguments (including the executable name), in which case the shell is not used. @r...
python
def execute(self, command): """ Execute (or simulate) a command. Add to our log. @param command: Either a C{str} command (which will be passed to the shell) or a C{list} of command arguments (including the executable name), in which case the shell is not used. @r...
['def', 'execute', '(', 'self', ',', 'command', ')', ':', 'if', 'isinstance', '(', 'command', ',', 'six', '.', 'string_types', ')', ':', "# Can't have newlines in a command given to the shell.", 'strCommand', '=', 'command', '=', 'command', '.', 'replace', '(', "'\\n'", ',', "' '", ')', '.', 'strip', '(', ')', 'shell',...
Execute (or simulate) a command. Add to our log. @param command: Either a C{str} command (which will be passed to the shell) or a C{list} of command arguments (including the executable name), in which case the shell is not used. @return: A C{CompletedProcess} instance. This has ...
['Execute', '(', 'or', 'simulate', ')', 'a', 'command', '.', 'Add', 'to', 'our', 'log', '.']
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/process.py#L23-L79
725
brentpayne/phrase
phrase/noun_phrase_dictionary.py
NounPhraseDictionary.convert_noun_phrases
def convert_noun_phrases(self, id_run, pos_run): """ Converts any identified phrases in the run into phrase_ids. The dictionary provides all acceptable phrases :param id_run: a run of token ids :param dictionary: a dictionary of acceptable phrases described as there component token ids ...
python
def convert_noun_phrases(self, id_run, pos_run): """ Converts any identified phrases in the run into phrase_ids. The dictionary provides all acceptable phrases :param id_run: a run of token ids :param dictionary: a dictionary of acceptable phrases described as there component token ids ...
['def', 'convert_noun_phrases', '(', 'self', ',', 'id_run', ',', 'pos_run', ')', ':', 'i', '=', '0', 'rv', '=', '[', ']', 'while', 'i', '<', 'len', '(', 'id_run', ')', ':', 'phrase_id', ',', 'offset', '=', 'PhraseDictionary', '.', 'return_max_phrase', '(', 'id_run', ',', 'i', ',', 'self', ')', 'if', 'phrase_id', ':', '...
Converts any identified phrases in the run into phrase_ids. The dictionary provides all acceptable phrases :param id_run: a run of token ids :param dictionary: a dictionary of acceptable phrases described as there component token ids :return: a run of token and phrase ids.
['Converts', 'any', 'identified', 'phrases', 'in', 'the', 'run', 'into', 'phrase_ids', '.', 'The', 'dictionary', 'provides', 'all', 'acceptable', 'phrases', ':', 'param', 'id_run', ':', 'a', 'run', 'of', 'token', 'ids', ':', 'param', 'dictionary', ':', 'a', 'dictionary', 'of', 'acceptable', 'phrases', 'described', 'as'...
train
https://github.com/brentpayne/phrase/blob/2c25e202eff0f284cb724a36cec1b22a1169e7a2/phrase/noun_phrase_dictionary.py#L31-L54
726
praekeltfoundation/molo.yourtips
molo/yourtips/templatetags/tip_tags.py
your_tips_on_tip_submission_form
def your_tips_on_tip_submission_form(context): """ A template tag to display the most recent and popular tip on the tip submission form. :param context: takes context """ context = copy(context) site_main = context['request'].site.root_page most_recent_tip = (YourTipsArticlePage.objects...
python
def your_tips_on_tip_submission_form(context): """ A template tag to display the most recent and popular tip on the tip submission form. :param context: takes context """ context = copy(context) site_main = context['request'].site.root_page most_recent_tip = (YourTipsArticlePage.objects...
['def', 'your_tips_on_tip_submission_form', '(', 'context', ')', ':', 'context', '=', 'copy', '(', 'context', ')', 'site_main', '=', 'context', '[', "'request'", ']', '.', 'site', '.', 'root_page', 'most_recent_tip', '=', '(', 'YourTipsArticlePage', '.', 'objects', '.', 'descendant_of', '(', 'site_main', ')', '.', 'ord...
A template tag to display the most recent and popular tip on the tip submission form. :param context: takes context
['A', 'template', 'tag', 'to', 'display', 'the', 'most', 'recent', 'and', 'popular', 'tip', 'on', 'the', 'tip', 'submission', 'form', '.', ':', 'param', 'context', ':', 'takes', 'context']
train
https://github.com/praekeltfoundation/molo.yourtips/blob/8b3e3b1ff52cd4a78ccca5d153b3909a1f21625f/molo/yourtips/templatetags/tip_tags.py#L55-L80
727
libtcod/python-tcod
tcod/tileset.py
load_truetype_font
def load_truetype_font( path: str, tile_width: int, tile_height: int ) -> Tileset: """Return a new Tileset from a `.ttf` or `.otf` file. Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead. You can send this Tileset to :any:`set_default`. This function is provisional. The API m...
python
def load_truetype_font( path: str, tile_width: int, tile_height: int ) -> Tileset: """Return a new Tileset from a `.ttf` or `.otf` file. Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead. You can send this Tileset to :any:`set_default`. This function is provisional. The API m...
['def', 'load_truetype_font', '(', 'path', ':', 'str', ',', 'tile_width', ':', 'int', ',', 'tile_height', ':', 'int', ')', '->', 'Tileset', ':', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'path', ')', ':', 'raise', 'RuntimeError', '(', '"File not found:\\n\\t%s"', '%', '(', 'os', '.', 'path', '.', 'realpath', ...
Return a new Tileset from a `.ttf` or `.otf` file. Same as :any:`set_truetype_font`, but returns a :any:`Tileset` instead. You can send this Tileset to :any:`set_default`. This function is provisional. The API may change.
['Return', 'a', 'new', 'Tileset', 'from', 'a', '.', 'ttf', 'or', '.', 'otf', 'file', '.']
train
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/tileset.py#L120-L134
728
secynic/ipwhois
ipwhois/scripts/ipwhois_cli.py
IPWhoisCLI.generate_output_events
def generate_output_events(self, source, key, val, line='2', hr=True, show_name=False, colorize=True): """ The function for generating CLI output RDAP events results. Args: source (:obj:`str`): The parent key 'network' or 'objects' (req...
python
def generate_output_events(self, source, key, val, line='2', hr=True, show_name=False, colorize=True): """ The function for generating CLI output RDAP events results. Args: source (:obj:`str`): The parent key 'network' or 'objects' (req...
['def', 'generate_output_events', '(', 'self', ',', 'source', ',', 'key', ',', 'val', ',', 'line', '=', "'2'", ',', 'hr', '=', 'True', ',', 'show_name', '=', 'False', ',', 'colorize', '=', 'True', ')', ':', 'output', '=', 'generate_output', '(', 'line', '=', 'line', ',', 'short', '=', 'HR_RDAP', '[', 'source', ']', '['...
The function for generating CLI output RDAP events results. Args: source (:obj:`str`): The parent key 'network' or 'objects' (required). key (:obj:`str`): The event key 'events' or 'events_actor' (required). val (:obj:`dict`): The event dictio...
['The', 'function', 'for', 'generating', 'CLI', 'output', 'RDAP', 'events', 'results', '.']
train
https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L534-L628
729
openregister/openregister-python
openregister/client.py
Client.config
def config(self, name, suffix): "Return config variable value, defaulting to environment" var = '%s_%s' % (name, suffix) var = var.upper().replace('-', '_') if var in self._config: return self._config[var] return os.environ[var]
python
def config(self, name, suffix): "Return config variable value, defaulting to environment" var = '%s_%s' % (name, suffix) var = var.upper().replace('-', '_') if var in self._config: return self._config[var] return os.environ[var]
['def', 'config', '(', 'self', ',', 'name', ',', 'suffix', ')', ':', 'var', '=', "'%s_%s'", '%', '(', 'name', ',', 'suffix', ')', 'var', '=', 'var', '.', 'upper', '(', ')', '.', 'replace', '(', "'-'", ',', "'_'", ')', 'if', 'var', 'in', 'self', '.', '_config', ':', 'return', 'self', '.', '_config', '[', 'var', ']', 're...
Return config variable value, defaulting to environment
['Return', 'config', 'variable', 'value', 'defaulting', 'to', 'environment']
train
https://github.com/openregister/openregister-python/blob/cdb3ed9b454ff42cffdff4f25f7dbf8c22c517e4/openregister/client.py#L16-L22
730
kensho-technologies/graphql-compiler
graphql_compiler/schema.py
_parse_datetime_value
def _parse_datetime_value(value): """Deserialize a DateTime object from its proper ISO-8601 representation.""" if value.endswith('Z'): # Arrow doesn't support the "Z" literal to denote UTC time. # Strip the "Z" and add an explicit time zone instead. value = value[:-1] + '+00:00' ret...
python
def _parse_datetime_value(value): """Deserialize a DateTime object from its proper ISO-8601 representation.""" if value.endswith('Z'): # Arrow doesn't support the "Z" literal to denote UTC time. # Strip the "Z" and add an explicit time zone instead. value = value[:-1] + '+00:00' ret...
['def', '_parse_datetime_value', '(', 'value', ')', ':', 'if', 'value', '.', 'endswith', '(', "'Z'", ')', ':', '# Arrow doesn\'t support the "Z" literal to denote UTC time.', '# Strip the "Z" and add an explicit time zone instead.', 'value', '=', 'value', '[', ':', '-', '1', ']', '+', "'+00:00'", 'return', 'arrow', '.'...
Deserialize a DateTime object from its proper ISO-8601 representation.
['Deserialize', 'a', 'DateTime', 'object', 'from', 'its', 'proper', 'ISO', '-', '8601', 'representation', '.']
train
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/schema.py#L222-L229
731
jazzband/inflect
inflect.py
engine.plural_verb
def plural_verb(self, text, count=None): """ Return the plural of text, where text is a verb. If count supplied, then return text if count is one of: 1, a, an, one, each, every, this, that otherwise return the plural. Whitespace at the start and end is preserved. ...
python
def plural_verb(self, text, count=None): """ Return the plural of text, where text is a verb. If count supplied, then return text if count is one of: 1, a, an, one, each, every, this, that otherwise return the plural. Whitespace at the start and end is preserved. ...
['def', 'plural_verb', '(', 'self', ',', 'text', ',', 'count', '=', 'None', ')', ':', 'pre', ',', 'word', ',', 'post', '=', 'self', '.', 'partition_word', '(', 'text', ')', 'if', 'not', 'word', ':', 'return', 'text', 'plural', '=', 'self', '.', 'postprocess', '(', 'word', ',', 'self', '.', '_pl_special_verb', '(', 'wor...
Return the plural of text, where text is a verb. If count supplied, then return text if count is one of: 1, a, an, one, each, every, this, that otherwise return the plural. Whitespace at the start and end is preserved.
['Return', 'the', 'plural', 'of', 'text', 'where', 'text', 'is', 'a', 'verb', '.']
train
https://github.com/jazzband/inflect/blob/c2a3df74725990c195a5d7f37199de56873962e9/inflect.py#L2265-L2283
732
gumblex/zhconv
zhconv/zhconv.py
convtable2dict
def convtable2dict(convtable, locale, update=None): """ Convert a list of conversion dict to a dict for a certain locale. >>> sorted(convtable2dict([{'zh-hk': '列斯', 'zh-hans': '利兹', 'zh': '利兹', 'zh-tw': '里茲'}, {':uni': '巨集', 'zh-cn': '宏'}], 'zh-cn').items()) [('列斯', '利兹'), ('利兹', '利兹'), ('巨集', '宏'), ('...
python
def convtable2dict(convtable, locale, update=None): """ Convert a list of conversion dict to a dict for a certain locale. >>> sorted(convtable2dict([{'zh-hk': '列斯', 'zh-hans': '利兹', 'zh': '利兹', 'zh-tw': '里茲'}, {':uni': '巨集', 'zh-cn': '宏'}], 'zh-cn').items()) [('列斯', '利兹'), ('利兹', '利兹'), ('巨集', '宏'), ('...
['def', 'convtable2dict', '(', 'convtable', ',', 'locale', ',', 'update', '=', 'None', ')', ':', 'rdict', '=', 'update', '.', 'copy', '(', ')', 'if', 'update', 'else', '{', '}', 'for', 'r', 'in', 'convtable', ':', 'if', "':uni'", 'in', 'r', ':', 'if', 'locale', 'in', 'r', ':', 'rdict', '[', 'r', '[', "':uni'", ']', ']'...
Convert a list of conversion dict to a dict for a certain locale. >>> sorted(convtable2dict([{'zh-hk': '列斯', 'zh-hans': '利兹', 'zh': '利兹', 'zh-tw': '里茲'}, {':uni': '巨集', 'zh-cn': '宏'}], 'zh-cn').items()) [('列斯', '利兹'), ('利兹', '利兹'), ('巨集', '宏'), ('里茲', '利兹')]
['Convert', 'a', 'list', 'of', 'conversion', 'dict', 'to', 'a', 'dict', 'for', 'a', 'certain', 'locale', '.']
train
https://github.com/gumblex/zhconv/blob/925c0f9494f3439bc05526e7e89bb5f0ab3d185e/zhconv/zhconv.py#L176-L196
733
acorg/dark-matter
bin/fasta-identity-table.py
collectData
def collectData(reads1, reads2, square, matchAmbiguous): """ Get pairwise matching statistics for two sets of reads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the table. @param reads2: An C{OrderedDict} of C{str} read ids w...
python
def collectData(reads1, reads2, square, matchAmbiguous): """ Get pairwise matching statistics for two sets of reads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the table. @param reads2: An C{OrderedDict} of C{str} read ids w...
['def', 'collectData', '(', 'reads1', ',', 'reads2', ',', 'square', ',', 'matchAmbiguous', ')', ':', 'result', '=', 'defaultdict', '(', 'dict', ')', 'for', 'id1', ',', 'read1', 'in', 'reads1', '.', 'items', '(', ')', ':', 'for', 'id2', ',', 'read2', 'in', 'reads2', '.', 'items', '(', ')', ':', 'if', 'id1', '!=', 'id2',...
Get pairwise matching statistics for two sets of reads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the table. @param reads2: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the columns ...
['Get', 'pairwise', 'matching', 'statistics', 'for', 'two', 'sets', 'of', 'reads', '.']
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L182-L208
734
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.set_pointer0d
def set_pointer0d(subseqs): """Set_pointer function for 0-dimensional link sequences.""" print(' . set_pointer0d') lines = Lines() lines.add(1, 'cpdef inline set_pointer0d' '(self, str name, pointerutils.PDouble value):') for seq in subseqs: ...
python
def set_pointer0d(subseqs): """Set_pointer function for 0-dimensional link sequences.""" print(' . set_pointer0d') lines = Lines() lines.add(1, 'cpdef inline set_pointer0d' '(self, str name, pointerutils.PDouble value):') for seq in subseqs: ...
['def', 'set_pointer0d', '(', 'subseqs', ')', ':', 'print', '(', "' . set_pointer0d'", ')', 'lines', '=', 'Lines', '(', ')', 'lines', '.', 'add', '(', '1', ',', "'cpdef inline set_pointer0d'", "'(self, str name, pointerutils.PDouble value):'", ')', 'for', 'seq', 'in', 'subseqs', ':', 'lines', '.', 'add', '('...
Set_pointer function for 0-dimensional link sequences.
['Set_pointer', 'function', 'for', '0', '-', 'dimensional', 'link', 'sequences', '.']
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L570-L579
735
newville/wxmplot
wxmplot/stackedplotframe.py
StackedPlotFrame.onThemeColor
def onThemeColor(self, color, item): """pass theme colors to bottom panel""" bconf = self.panel_bot.conf if item == 'grid': bconf.set_gridcolor(color) elif item == 'bg': bconf.set_bgcolor(color) elif item == 'frame': bconf.set_framecolor(color)...
python
def onThemeColor(self, color, item): """pass theme colors to bottom panel""" bconf = self.panel_bot.conf if item == 'grid': bconf.set_gridcolor(color) elif item == 'bg': bconf.set_bgcolor(color) elif item == 'frame': bconf.set_framecolor(color)...
['def', 'onThemeColor', '(', 'self', ',', 'color', ',', 'item', ')', ':', 'bconf', '=', 'self', '.', 'panel_bot', '.', 'conf', 'if', 'item', '==', "'grid'", ':', 'bconf', '.', 'set_gridcolor', '(', 'color', ')', 'elif', 'item', '==', "'bg'", ':', 'bconf', '.', 'set_bgcolor', '(', 'color', ')', 'elif', 'item', '==', "'f...
pass theme colors to bottom panel
['pass', 'theme', 'colors', 'to', 'bottom', 'panel']
train
https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/stackedplotframe.py#L210-L221
736
python-openxml/python-docx
docx/opc/pkgreader.py
PackageReader.from_file
def from_file(pkg_file): """ Return a |PackageReader| instance loaded with contents of *pkg_file*. """ phys_reader = PhysPkgReader(pkg_file) content_types = _ContentTypeMap.from_xml(phys_reader.content_types_xml) pkg_srels = PackageReader._srels_for(phys_reader, PACKAGE_U...
python
def from_file(pkg_file): """ Return a |PackageReader| instance loaded with contents of *pkg_file*. """ phys_reader = PhysPkgReader(pkg_file) content_types = _ContentTypeMap.from_xml(phys_reader.content_types_xml) pkg_srels = PackageReader._srels_for(phys_reader, PACKAGE_U...
['def', 'from_file', '(', 'pkg_file', ')', ':', 'phys_reader', '=', 'PhysPkgReader', '(', 'pkg_file', ')', 'content_types', '=', '_ContentTypeMap', '.', 'from_xml', '(', 'phys_reader', '.', 'content_types_xml', ')', 'pkg_srels', '=', 'PackageReader', '.', '_srels_for', '(', 'phys_reader', ',', 'PACKAGE_URI', ')', 'spar...
Return a |PackageReader| instance loaded with contents of *pkg_file*.
['Return', 'a', '|PackageReader|', 'instance', 'loaded', 'with', 'contents', 'of', '*', 'pkg_file', '*', '.']
train
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/pkgreader.py#L28-L39
737
mgedmin/imgdiff
imgdiff.py
slow_highlight
def slow_highlight(img1, img2, opts): """Try to find similar areas between two images. Produces two masks for img1 and img2. The algorithm works by comparing every possible alignment of the images, smoothing it a bit to reduce spurious matches in areas that are perceptibly different (e.g. text), a...
python
def slow_highlight(img1, img2, opts): """Try to find similar areas between two images. Produces two masks for img1 and img2. The algorithm works by comparing every possible alignment of the images, smoothing it a bit to reduce spurious matches in areas that are perceptibly different (e.g. text), a...
['def', 'slow_highlight', '(', 'img1', ',', 'img2', ',', 'opts', ')', ':', 'w1', ',', 'h1', '=', 'img1', '.', 'size', 'w2', ',', 'h2', '=', 'img2', '.', 'size', 'W', ',', 'H', '=', 'max', '(', 'w1', ',', 'w2', ')', ',', 'max', '(', 'h1', ',', 'h2', ')', 'pimg1', '=', 'Image', '.', 'new', '(', "'RGB'", ',', '(', 'W', ',...
Try to find similar areas between two images. Produces two masks for img1 and img2. The algorithm works by comparing every possible alignment of the images, smoothing it a bit to reduce spurious matches in areas that are perceptibly different (e.g. text), and then taking the point-wise minimum of ...
['Try', 'to', 'find', 'similar', 'areas', 'between', 'two', 'images', '.']
train
https://github.com/mgedmin/imgdiff/blob/f80b173c6fb1f32f3e016d153b5b84a14d966e1a/imgdiff.py#L481-L552
738
scott-maddox/openbandparams
src/openbandparams/alloy.py
Alloy.add_parameter
def add_parameter(self, parameter, overload=False): ''' Adds a `Parameter` object to the instance. If a `Parameter` with the same name or alias has already been added and `overload` is False (the default), a `ValueError` is thrown. If a class member or method wi...
python
def add_parameter(self, parameter, overload=False): ''' Adds a `Parameter` object to the instance. If a `Parameter` with the same name or alias has already been added and `overload` is False (the default), a `ValueError` is thrown. If a class member or method wi...
['def', 'add_parameter', '(', 'self', ',', 'parameter', ',', 'overload', '=', 'False', ')', ':', 'if', 'not', 'isinstance', '(', 'parameter', ',', 'Parameter', ')', ':', 'raise', 'TypeError', '(', "'`parameter` must be an instance of `Parameter`'", ')', 'if', 'hasattr', '(', 'self', ',', 'parameter', '.', 'name', ')', ...
Adds a `Parameter` object to the instance. If a `Parameter` with the same name or alias has already been added and `overload` is False (the default), a `ValueError` is thrown. If a class member or method with the same name or alias is already defined, a `ValueError` is ...
['Adds', 'a', 'Parameter', 'object', 'to', 'the', 'instance', '.', 'If', 'a', 'Parameter', 'with', 'the', 'same', 'name', 'or', 'alias', 'has', 'already', 'been', 'added', 'and', 'overload', 'is', 'False', '(', 'the', 'default', ')', 'a', 'ValueError', 'is', 'thrown', '.', 'If', 'a', 'class', 'member', 'or', 'method', ...
train
https://github.com/scott-maddox/openbandparams/blob/bc24e59187326bcb8948117434536082c9055777/src/openbandparams/alloy.py#L93-L124
739
log2timeline/plaso
plaso/parsers/esedb_plugins/msie_webcache.py
MsieWebCacheESEDBPlugin.ParsePartitionsTable
def ParsePartitionsTable( self, parser_mediator, database=None, table=None, **unused_kwargs): """Parses the Partitions table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. database (Optional[pyesedb.fil...
python
def ParsePartitionsTable( self, parser_mediator, database=None, table=None, **unused_kwargs): """Parses the Partitions table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. database (Optional[pyesedb.fil...
['def', 'ParsePartitionsTable', '(', 'self', ',', 'parser_mediator', ',', 'database', '=', 'None', ',', 'table', '=', 'None', ',', '*', '*', 'unused_kwargs', ')', ':', 'if', 'database', 'is', 'None', ':', 'raise', 'ValueError', '(', "'Missing database value.'", ')', 'if', 'table', 'is', 'None', ':', 'raise', 'ValueErro...
Parses the Partitions table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. database (Optional[pyesedb.file]): ESE database. table (Optional[pyesedb.table]): table. Raises: ValueError: if the data...
['Parses', 'the', 'Partitions', 'table', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/esedb_plugins/msie_webcache.py#L358-L395
740
pulumi/pulumi
sdk/python/lib/pulumi/config.py
Config.require
def require(self, key: str) -> str: """ Returns a configuration value by its given key. If it doesn't exist, an error is thrown. :param str key: The requested configuration key. :return: The configuration key's value. :rtype: str :raises ConfigMissingError: The configur...
python
def require(self, key: str) -> str: """ Returns a configuration value by its given key. If it doesn't exist, an error is thrown. :param str key: The requested configuration key. :return: The configuration key's value. :rtype: str :raises ConfigMissingError: The configur...
['def', 'require', '(', 'self', ',', 'key', ':', 'str', ')', '->', 'str', ':', 'v', '=', 'self', '.', 'get', '(', 'key', ')', 'if', 'v', 'is', 'None', ':', 'raise', 'ConfigMissingError', '(', 'self', '.', 'full_key', '(', 'key', ')', ')', 'return', 'v']
Returns a configuration value by its given key. If it doesn't exist, an error is thrown. :param str key: The requested configuration key. :return: The configuration key's value. :rtype: str :raises ConfigMissingError: The configuration value did not exist.
['Returns', 'a', 'configuration', 'value', 'by', 'its', 'given', 'key', '.', 'If', 'it', 'doesn', 't', 'exist', 'an', 'error', 'is', 'thrown', '.']
train
https://github.com/pulumi/pulumi/blob/95d51efe6ab9a533838b6d83aa240b5f912e72aa/sdk/python/lib/pulumi/config.py#L115-L127
741
sethmlarson/virtualbox-python
virtualbox/library.py
IMachineDebugger.unload_plug_in
def unload_plug_in(self, name): """Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins. """ if not isinstance(name, basestring): raise TypeError("name can only be an instance of type basestring") s...
python
def unload_plug_in(self, name): """Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins. """ if not isinstance(name, basestring): raise TypeError("name can only be an instance of type basestring") s...
['def', 'unload_plug_in', '(', 'self', ',', 'name', ')', ':', 'if', 'not', 'isinstance', '(', 'name', ',', 'basestring', ')', ':', 'raise', 'TypeError', '(', '"name can only be an instance of type basestring"', ')', 'self', '.', '_call', '(', '"unloadPlugIn"', ',', 'in_p', '=', '[', 'name', ']', ')']
Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins.
['Unloads', 'a', 'DBGF', 'plug', '-', 'in', '.']
train
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L26606-L26616
742
jendrikseipp/vulture
vulture/lines.py
get_last_line_number
def get_last_line_number(node): """Estimate last line number of the given AST node. The estimate is based on the line number of the last descendant of `node` that has a lineno attribute. Therefore, it underestimates the size of code ending with, e.g., multiline strings and comments. When traversin...
python
def get_last_line_number(node): """Estimate last line number of the given AST node. The estimate is based on the line number of the last descendant of `node` that has a lineno attribute. Therefore, it underestimates the size of code ending with, e.g., multiline strings and comments. When traversin...
['def', 'get_last_line_number', '(', 'node', ')', ':', 'max_lineno', '=', 'node', '.', 'lineno', 'while', 'True', ':', 'last_child', '=', '_get_last_child_with_lineno', '(', 'node', ')', 'if', 'last_child', 'is', 'None', ':', 'return', 'max_lineno', 'else', ':', 'try', ':', 'max_lineno', '=', 'max', '(', 'max_lineno', ...
Estimate last line number of the given AST node. The estimate is based on the line number of the last descendant of `node` that has a lineno attribute. Therefore, it underestimates the size of code ending with, e.g., multiline strings and comments. When traversing the tree, we may see a mix of nodes w...
['Estimate', 'last', 'line', 'number', 'of', 'the', 'given', 'AST', 'node', '.']
train
https://github.com/jendrikseipp/vulture/blob/fed11fb7e7ed065058a9fb1acd10052ece37f984/vulture/lines.py#L40-L65
743
RIPE-NCC/ripe-atlas-cousteau
ripe/atlas/cousteau/source.py
AtlasChangeSource.clean
def clean(self): """ Cleans/checks user has entered all required attributes. This might save some queries from being sent to server if they are totally wrong. """ if not all([self._type, self._requested, self._value, self._action]): raise MalFormattedSource( ...
python
def clean(self): """ Cleans/checks user has entered all required attributes. This might save some queries from being sent to server if they are totally wrong. """ if not all([self._type, self._requested, self._value, self._action]): raise MalFormattedSource( ...
['def', 'clean', '(', 'self', ')', ':', 'if', 'not', 'all', '(', '[', 'self', '.', '_type', ',', 'self', '.', '_requested', ',', 'self', '.', '_value', ',', 'self', '.', '_action', ']', ')', ':', 'raise', 'MalFormattedSource', '(', '"<type, requested, value, action> fields are required."', ')']
Cleans/checks user has entered all required attributes. This might save some queries from being sent to server if they are totally wrong.
['Cleans', '/', 'checks', 'user', 'has', 'entered', 'all', 'required', 'attributes', '.', 'This', 'might', 'save', 'some', 'queries', 'from', 'being', 'sent', 'to', 'server', 'if', 'they', 'are', 'totally', 'wrong', '.']
train
https://github.com/RIPE-NCC/ripe-atlas-cousteau/blob/ffee2556aaa4df86525b88c269bb098de11678ec/ripe/atlas/cousteau/source.py#L216-L224
744
AndresMWeber/Nomenclate
nomenclate/core/nameparser.py
NameParser._generic_search
def _generic_search(cls, name, search_string, metadata={}, ignore=''): """ Searches for a specific string given three types of regex search types. Also auto-checks for camel casing. :param name: str, name of object in question :param search_string: str, string to find and insert into the searc...
python
def _generic_search(cls, name, search_string, metadata={}, ignore=''): """ Searches for a specific string given three types of regex search types. Also auto-checks for camel casing. :param name: str, name of object in question :param search_string: str, string to find and insert into the searc...
['def', '_generic_search', '(', 'cls', ',', 'name', ',', 'search_string', ',', 'metadata', '=', '{', '}', ',', 'ignore', '=', "''", ')', ':', 'patterns', '=', '[', 'cls', '.', 'REGEX_ABBR_SEOS', ',', 'cls', '.', 'REGEX_ABBR_ISLAND', ',', 'cls', '.', 'REGEX_ABBR_CAMEL', ']', 'if', 'not', 'search_string', '[', '0', ']', ...
Searches for a specific string given three types of regex search types. Also auto-checks for camel casing. :param name: str, name of object in question :param search_string: str, string to find and insert into the search regexes :param metadata: dict, metadata to add to the result if we find a...
['Searches', 'for', 'a', 'specific', 'string', 'given', 'three', 'types', 'of', 'regex', 'search', 'types', '.', 'Also', 'auto', '-', 'checks', 'for', 'camel', 'casing', '.']
train
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nameparser.py#L344-L369
745
jxtech/wechatpy
wechatpy/client/api/shakearound.py
WeChatShakeAround.update_device
def update_device(self, device_id=None, uuid=None, major=None, minor=None, comment=None): """ 更新设备信息 详情请参考 http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html :param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先 :par...
python
def update_device(self, device_id=None, uuid=None, major=None, minor=None, comment=None): """ 更新设备信息 详情请参考 http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html :param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先 :par...
['def', 'update_device', '(', 'self', ',', 'device_id', '=', 'None', ',', 'uuid', '=', 'None', ',', 'major', '=', 'None', ',', 'minor', '=', 'None', ',', 'comment', '=', 'None', ')', ':', 'data', '=', 'optionaldict', '(', ')', 'data', '[', "'comment'", ']', '=', 'comment', 'data', '[', "'device_identifier'", ']', '=', ...
更新设备信息 详情请参考 http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html :param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先 :param uuid: UUID :param major: major :param minor: minor :param comment: 设备的备注信息,不超过15个汉字或30个英文字母。 :ret...
['更新设备信息', '详情请参考', 'http', ':', '//', 'mp', '.', 'weixin', '.', 'qq', '.', 'com', '/', 'wiki', '/', '15', '/', 'b9e012f917e3484b7ed02771156411f3', '.', 'html']
train
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L49-L74
746
seequent/properties
properties/math.py
Array.to_json
def to_json(value, **kwargs): """Convert array to JSON list nan values are converted to string 'nan', inf values to 'inf'. """ def _recurse_list(val): if val and isinstance(val[0], list): return [_recurse_list(v) for v in val] return [str(v) if np...
python
def to_json(value, **kwargs): """Convert array to JSON list nan values are converted to string 'nan', inf values to 'inf'. """ def _recurse_list(val): if val and isinstance(val[0], list): return [_recurse_list(v) for v in val] return [str(v) if np...
['def', 'to_json', '(', 'value', ',', '*', '*', 'kwargs', ')', ':', 'def', '_recurse_list', '(', 'val', ')', ':', 'if', 'val', 'and', 'isinstance', '(', 'val', '[', '0', ']', ',', 'list', ')', ':', 'return', '[', '_recurse_list', '(', 'v', ')', 'for', 'v', 'in', 'val', ']', 'return', '[', 'str', '(', 'v', ')', 'if', 'n...
Convert array to JSON list nan values are converted to string 'nan', inf values to 'inf'.
['Convert', 'array', 'to', 'JSON', 'list']
train
https://github.com/seequent/properties/blob/096b07012fff86b0a880c8c018320c3b512751b9/properties/math.py#L227-L236
747
slimkrazy/python-google-places
googleplaces/__init__.py
GooglePlaces.add_place
def add_place(self, **kwargs): """Adds a place to the Google Places database. On a successful request, this method will return a dict containing the the new Place's place_id and id in keys 'place_id' and 'id' respectively. keyword arguments: name -- The full text...
python
def add_place(self, **kwargs): """Adds a place to the Google Places database. On a successful request, this method will return a dict containing the the new Place's place_id and id in keys 'place_id' and 'id' respectively. keyword arguments: name -- The full text...
['def', 'add_place', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'required_kwargs', '=', '{', "'name'", ':', '[', 'str', ']', ',', "'lat_lng'", ':', '[', 'dict', ']', ',', "'accuracy'", ':', '[', 'int', ']', ',', "'types'", ':', '[', 'str', ',', 'list', ']', '}', 'request_params', '=', '{', '}', 'for', 'key', 'in',...
Adds a place to the Google Places database. On a successful request, this method will return a dict containing the the new Place's place_id and id in keys 'place_id' and 'id' respectively. keyword arguments: name -- The full text name of the Place. Limited to 255 ...
['Adds', 'a', 'place', 'to', 'the', 'Google', 'Places', 'database', '.']
train
https://github.com/slimkrazy/python-google-places/blob/d4b7363e1655cdc091a6253379f6d2a95b827881/googleplaces/__init__.py#L498-L565
748
googlefonts/glyphsLib
Lib/glyphsLib/builder/axes.py
AxisDefinition.set_user_loc
def set_user_loc(self, master_or_instance, value): """Set the user location of a Glyphs master or instance.""" if hasattr(master_or_instance, "instanceInterpolations"): # The following code is only valid for instances. # Masters also the keys `weight` and `width` but they should ...
python
def set_user_loc(self, master_or_instance, value): """Set the user location of a Glyphs master or instance.""" if hasattr(master_or_instance, "instanceInterpolations"): # The following code is only valid for instances. # Masters also the keys `weight` and `width` but they should ...
['def', 'set_user_loc', '(', 'self', ',', 'master_or_instance', ',', 'value', ')', ':', 'if', 'hasattr', '(', 'master_or_instance', ',', '"instanceInterpolations"', ')', ':', '# The following code is only valid for instances.', '# Masters also the keys `weight` and `width` but they should not be', '# used, they are dep...
Set the user location of a Glyphs master or instance.
['Set', 'the', 'user', 'location', 'of', 'a', 'Glyphs', 'master', 'or', 'instance', '.']
train
https://github.com/googlefonts/glyphsLib/blob/9c12dc70c8d13f08d92b824e6710f6e3bb5037bb/Lib/glyphsLib/builder/axes.py#L367-L418
749
Alignak-monitoring/alignak
alignak/daemons/receiverdaemon.py
Receiver.get_daemon_stats
def get_daemon_stats(self, details=False): """Increase the stats provided by the Daemon base class :return: stats dictionary :rtype: dict """ # Call the base Daemon one res = super(Receiver, self).get_daemon_stats(details=details) res.update({'name': self.name, ...
python
def get_daemon_stats(self, details=False): """Increase the stats provided by the Daemon base class :return: stats dictionary :rtype: dict """ # Call the base Daemon one res = super(Receiver, self).get_daemon_stats(details=details) res.update({'name': self.name, ...
['def', 'get_daemon_stats', '(', 'self', ',', 'details', '=', 'False', ')', ':', '# Call the base Daemon one', 'res', '=', 'super', '(', 'Receiver', ',', 'self', ')', '.', 'get_daemon_stats', '(', 'details', '=', 'details', ')', 'res', '.', 'update', '(', '{', "'name'", ':', 'self', '.', 'name', ',', "'type'", ':', 'se...
Increase the stats provided by the Daemon base class :return: stats dictionary :rtype: dict
['Increase', 'the', 'stats', 'provided', 'by', 'the', 'Daemon', 'base', 'class']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/receiverdaemon.py#L343-L358
750
projecthamster/hamster
src/hamster/lib/stuff.py
totals
def totals(iter, keyfunc, sumfunc): """groups items by field described in keyfunc and counts totals using value from sumfunc """ data = sorted(iter, key=keyfunc) res = {} for k, group in groupby(data, keyfunc): res[k] = sum([sumfunc(entry) for entry in group]) return res
python
def totals(iter, keyfunc, sumfunc): """groups items by field described in keyfunc and counts totals using value from sumfunc """ data = sorted(iter, key=keyfunc) res = {} for k, group in groupby(data, keyfunc): res[k] = sum([sumfunc(entry) for entry in group]) return res
['def', 'totals', '(', 'iter', ',', 'keyfunc', ',', 'sumfunc', ')', ':', 'data', '=', 'sorted', '(', 'iter', ',', 'key', '=', 'keyfunc', ')', 'res', '=', '{', '}', 'for', 'k', ',', 'group', 'in', 'groupby', '(', 'data', ',', 'keyfunc', ')', ':', 'res', '[', 'k', ']', '=', 'sum', '(', '[', 'sumfunc', '(', 'entry', ')', ...
groups items by field described in keyfunc and counts totals using value from sumfunc
['groups', 'items', 'by', 'field', 'described', 'in', 'keyfunc', 'and', 'counts', 'totals', 'using', 'value', 'from', 'sumfunc']
train
https://github.com/projecthamster/hamster/blob/ca5254eff53172796ddafc72226c394ed1858245/src/hamster/lib/stuff.py#L224-L234
751
tcalmant/python-javaobj
javaobj/core.py
JavaObjectMarshaller._writeString
def _writeString(self, obj, use_reference=True): """ Appends a string to the serialization stream :param obj: String to serialize :param use_reference: If True, allow writing a reference """ # TODO: Convert to "modified UTF-8" # http://docs.oracle.com/javase/7/do...
python
def _writeString(self, obj, use_reference=True): """ Appends a string to the serialization stream :param obj: String to serialize :param use_reference: If True, allow writing a reference """ # TODO: Convert to "modified UTF-8" # http://docs.oracle.com/javase/7/do...
['def', '_writeString', '(', 'self', ',', 'obj', ',', 'use_reference', '=', 'True', ')', ':', '# TODO: Convert to "modified UTF-8"', '# http://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html#modified-utf-8', 'string', '=', 'to_bytes', '(', 'obj', ',', '"utf-8"', ')', 'if', 'use_reference', 'and', 'isinstance',...
Appends a string to the serialization stream :param obj: String to serialize :param use_reference: If True, allow writing a reference
['Appends', 'a', 'string', 'to', 'the', 'serialization', 'stream']
train
https://github.com/tcalmant/python-javaobj/blob/e042c2cbf1ce9de659b6cb9290b5ccd5442514d1/javaobj/core.py#L1293-L1328
752
edoburu/django-private-storage
private_storage/views.py
PrivateStorageView.get_private_file
def get_private_file(self): """ Return all relevant data in a single object, so this is easy to extend and server implementations can pick what they need. """ return PrivateFile( request=self.request, storage=self.get_storage(), relative_name=s...
python
def get_private_file(self): """ Return all relevant data in a single object, so this is easy to extend and server implementations can pick what they need. """ return PrivateFile( request=self.request, storage=self.get_storage(), relative_name=s...
['def', 'get_private_file', '(', 'self', ')', ':', 'return', 'PrivateFile', '(', 'request', '=', 'self', '.', 'request', ',', 'storage', '=', 'self', '.', 'get_storage', '(', ')', ',', 'relative_name', '=', 'self', '.', 'get_path', '(', ')', ')']
Return all relevant data in a single object, so this is easy to extend and server implementations can pick what they need.
['Return', 'all', 'relevant', 'data', 'in', 'a', 'single', 'object', 'so', 'this', 'is', 'easy', 'to', 'extend', 'and', 'server', 'implementations', 'can', 'pick', 'what', 'they', 'need', '.']
train
https://github.com/edoburu/django-private-storage/blob/35b718024fee75b0ed3400f601976b20246c7d05/private_storage/views.py#L55-L64
753
bitesofcode/projexui
projexui/widgets/xorbcolumnnavigator.py
XOrbColumnItem.setCurrentSchemaColumn
def setCurrentSchemaColumn(self, column): """ Sets the current item based on the inputed column. :param column | <orb.Column> || None """ if column == self._column: self.treeWidget().setCurrentItem(self) return True ...
python
def setCurrentSchemaColumn(self, column): """ Sets the current item based on the inputed column. :param column | <orb.Column> || None """ if column == self._column: self.treeWidget().setCurrentItem(self) return True ...
['def', 'setCurrentSchemaColumn', '(', 'self', ',', 'column', ')', ':', 'if', 'column', '==', 'self', '.', '_column', ':', 'self', '.', 'treeWidget', '(', ')', '.', 'setCurrentItem', '(', 'self', ')', 'return', 'True', 'for', 'c', 'in', 'range', '(', 'self', '.', 'childCount', '(', ')', ')', ':', 'if', 'self', '.', 'ch...
Sets the current item based on the inputed column. :param column | <orb.Column> || None
['Sets', 'the', 'current', 'item', 'based', 'on', 'the', 'inputed', 'column', '.', ':', 'param', 'column', '|', '<orb', '.', 'Column', '>', '||', 'None']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbcolumnnavigator.py#L80-L94
754
RJT1990/pyflux
pyflux/families/exponential.py
Exponential.markov_blanket
def markov_blanket(y, mean, scale, shape, skewness): """ Markov blanket for the Exponential distribution Parameters ---------- y : np.ndarray univariate time series mean : np.ndarray array of location parameters for the Exponential distribution ...
python
def markov_blanket(y, mean, scale, shape, skewness): """ Markov blanket for the Exponential distribution Parameters ---------- y : np.ndarray univariate time series mean : np.ndarray array of location parameters for the Exponential distribution ...
['def', 'markov_blanket', '(', 'y', ',', 'mean', ',', 'scale', ',', 'shape', ',', 'skewness', ')', ':', 'return', 'ss', '.', 'expon', '.', 'logpdf', '(', 'x', '=', 'y', ',', 'scale', '=', '1', '/', 'mean', ')']
Markov blanket for the Exponential distribution Parameters ---------- y : np.ndarray univariate time series mean : np.ndarray array of location parameters for the Exponential distribution scale : float scale parameter for the Exponential dis...
['Markov', 'blanket', 'for', 'the', 'Exponential', 'distribution']
train
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/families/exponential.py#L195-L219
755
oasiswork/zimsoap
zimsoap/client.py
ZimbraAdminClient.add_account_alias
def add_account_alias(self, account, alias): """ :param account: an account object to be used as a selector :param alias: email alias address :returns: None (the API itself returns nothing) """ self.request('AddAccountAlias', { 'id': self._get_or_...
python
def add_account_alias(self, account, alias): """ :param account: an account object to be used as a selector :param alias: email alias address :returns: None (the API itself returns nothing) """ self.request('AddAccountAlias', { 'id': self._get_or_...
['def', 'add_account_alias', '(', 'self', ',', 'account', ',', 'alias', ')', ':', 'self', '.', 'request', '(', "'AddAccountAlias'", ',', '{', "'id'", ':', 'self', '.', '_get_or_fetch_id', '(', 'account', ',', 'self', '.', 'get_account', ')', ',', "'alias'", ':', 'alias', ',', '}', ')']
:param account: an account object to be used as a selector :param alias: email alias address :returns: None (the API itself returns nothing)
[':', 'param', 'account', ':', 'an', 'account', 'object', 'to', 'be', 'used', 'as', 'a', 'selector', ':', 'param', 'alias', ':', 'email', 'alias', 'address', ':', 'returns', ':', 'None', '(', 'the', 'API', 'itself', 'returns', 'nothing', ')']
train
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1111-L1120
756
CityOfZion/neo-python
neo/Core/Block.py
Block.Serialize
def Serialize(self, writer): """ Serialize full object. Args: writer (neo.IO.BinaryWriter): """ super(Block, self).Serialize(writer) writer.WriteSerializableArray(self.Transactions)
python
def Serialize(self, writer): """ Serialize full object. Args: writer (neo.IO.BinaryWriter): """ super(Block, self).Serialize(writer) writer.WriteSerializableArray(self.Transactions)
['def', 'Serialize', '(', 'self', ',', 'writer', ')', ':', 'super', '(', 'Block', ',', 'self', ')', '.', 'Serialize', '(', 'writer', ')', 'writer', '.', 'WriteSerializableArray', '(', 'self', '.', 'Transactions', ')']
Serialize full object. Args: writer (neo.IO.BinaryWriter):
['Serialize', 'full', 'object', '.']
train
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Core/Block.py#L262-L270
757
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/reftrack/__init__.py
get_groupname
def get_groupname(taskfileinfo): """Return a suitable name for a groupname for the given taskfileinfo. :param taskfileinfo: the taskfile info for the file that needs a group when importing/referencing :type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo` :returns: None :rtype: None :rai...
python
def get_groupname(taskfileinfo): """Return a suitable name for a groupname for the given taskfileinfo. :param taskfileinfo: the taskfile info for the file that needs a group when importing/referencing :type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo` :returns: None :rtype: None :rai...
['def', 'get_groupname', '(', 'taskfileinfo', ')', ':', 'element', '=', 'taskfileinfo', '.', 'task', '.', 'element', 'name', '=', 'element', '.', 'name', 'return', 'name', '+', '"_grp"']
Return a suitable name for a groupname for the given taskfileinfo. :param taskfileinfo: the taskfile info for the file that needs a group when importing/referencing :type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo` :returns: None :rtype: None :raises: None
['Return', 'a', 'suitable', 'name', 'for', 'a', 'groupname', 'for', 'the', 'given', 'taskfileinfo', '.']
train
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/__init__.py#L24-L35
758
bitesofcode/projexui
projexui/widgets/xganttwidget/xganttwidget.py
XGanttWidget.insertTopLevelItem
def insertTopLevelItem( self, index, item ): """ Inserts the inputed item at the given index in the tree. :param index | <int> item | <XGanttWidgetItem> """ self.treeWidget().insertTopLevelItem(index, item) if self....
python
def insertTopLevelItem( self, index, item ): """ Inserts the inputed item at the given index in the tree. :param index | <int> item | <XGanttWidgetItem> """ self.treeWidget().insertTopLevelItem(index, item) if self....
['def', 'insertTopLevelItem', '(', 'self', ',', 'index', ',', 'item', ')', ':', 'self', '.', 'treeWidget', '(', ')', '.', 'insertTopLevelItem', '(', 'index', ',', 'item', ')', 'if', 'self', '.', 'updatesEnabled', '(', ')', ':', 'try', ':', 'item', '.', 'sync', '(', 'recursive', '=', 'True', ')', 'except', 'AttributeErr...
Inserts the inputed item at the given index in the tree. :param index | <int> item | <XGanttWidgetItem>
['Inserts', 'the', 'inputed', 'item', 'at', 'the', 'given', 'index', 'in', 'the', 'tree', '.', ':', 'param', 'index', '|', '<int', '>', 'item', '|', '<XGanttWidgetItem', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xganttwidget/xganttwidget.py#L376-L389
759
brbsix/subnuker
subnuker.py
SrtProject.split
def split(self, text): """Split text into a list of cells.""" import re if re.search('\n\n', text): return text.split('\n\n') elif re.search('\r\n\r\n', text): return text.split('\r\n\r\n') else: LOGGER.error("'%s' does not appear to be a 'srt...
python
def split(self, text): """Split text into a list of cells.""" import re if re.search('\n\n', text): return text.split('\n\n') elif re.search('\r\n\r\n', text): return text.split('\r\n\r\n') else: LOGGER.error("'%s' does not appear to be a 'srt...
['def', 'split', '(', 'self', ',', 'text', ')', ':', 'import', 're', 'if', 're', '.', 'search', '(', "'\\n\\n'", ',', 'text', ')', ':', 'return', 'text', '.', 'split', '(', "'\\n\\n'", ')', 'elif', 're', '.', 'search', '(', "'\\r\\n\\r\\n'", ',', 'text', ')', ':', 'return', 'text', '.', 'split', '(', "'\\r\\n\\r\\n'", ...
Split text into a list of cells.
['Split', 'text', 'into', 'a', 'list', 'of', 'cells', '.']
train
https://github.com/brbsix/subnuker/blob/a94260a6e84b790a9e39e0b1793443ffd4e1f496/subnuker.py#L320-L331
760
Scifabric/pbs
helpers.py
_add_helpingmaterials
def _add_helpingmaterials(config, helping_file, helping_type): """Add helping materials to a project.""" try: project = find_project_by_short_name(config.project['short_name'], config.pbclient, config.all) ...
python
def _add_helpingmaterials(config, helping_file, helping_type): """Add helping materials to a project.""" try: project = find_project_by_short_name(config.project['short_name'], config.pbclient, config.all) ...
['def', '_add_helpingmaterials', '(', 'config', ',', 'helping_file', ',', 'helping_type', ')', ':', 'try', ':', 'project', '=', 'find_project_by_short_name', '(', 'config', '.', 'project', '[', "'short_name'", ']', ',', 'config', '.', 'pbclient', ',', 'config', '.', 'all', ')', 'data', '=', '_load_data', '(', 'helping_...
Add helping materials to a project.
['Add', 'helping', 'materials', 'to', 'a', 'project', '.']
train
https://github.com/Scifabric/pbs/blob/3e5d5f3f0f5d20f740eaacc4d6e872a0c9fb8b38/helpers.py#L233-L277
761
opendns/pyinvestigate
investigate/investigate.py
Investigate.categorization
def categorization(self, domains, labels=False): '''Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more de...
python
def categorization(self, domains, labels=False): '''Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more de...
['def', 'categorization', '(', 'self', ',', 'domains', ',', 'labels', '=', 'False', ')', ':', 'if', 'type', '(', 'domains', ')', 'is', 'str', ':', 'return', 'self', '.', '_get_categorization', '(', 'domains', ',', 'labels', ')', 'elif', 'type', '(', 'domains', ')', 'is', 'list', ':', 'return', 'self', '.', '_post_categ...
Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more detail, see https://investigate.umbrella.com/docs/api#categori...
['Get', 'the', 'domain', 'status', 'and', 'categorization', 'of', 'a', 'domain', 'or', 'list', 'of', 'domains', '.', 'domains', 'can', 'be', 'either', 'a', 'single', 'domain', 'or', 'a', 'list', 'of', 'domains', '.', 'Setting', 'labels', 'to', 'True', 'will', 'give', 'back', 'categorizations', 'in', 'human', '-', 'read...
train
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L108-L121
762
dropbox/pyannotate
pyannotate_tools/annotations/parse.py
tokenize
def tokenize(s): # type: (str) -> List[Token] """Translate a type comment into a list of tokens.""" original = s tokens = [] # type: List[Token] while True: if not s: tokens.append(End()) return tokens elif s[0] == ' ': s = s[1:] elif s[0]...
python
def tokenize(s): # type: (str) -> List[Token] """Translate a type comment into a list of tokens.""" original = s tokens = [] # type: List[Token] while True: if not s: tokens.append(End()) return tokens elif s[0] == ' ': s = s[1:] elif s[0]...
['def', 'tokenize', '(', 's', ')', ':', '# type: (str) -> List[Token]', 'original', '=', 's', 'tokens', '=', '[', ']', '# type: List[Token]', 'while', 'True', ':', 'if', 'not', 's', ':', 'tokens', '.', 'append', '(', 'End', '(', ')', ')', 'return', 'tokens', 'elif', 's', '[', '0', ']', '==', "' '", ':', 's', '=', 's', ...
Translate a type comment into a list of tokens.
['Translate', 'a', 'type', 'comment', 'into', 'a', 'list', 'of', 'tokens', '.']
train
https://github.com/dropbox/pyannotate/blob/d128c76b8a86f208e5c78716f2a917003650cebc/pyannotate_tools/annotations/parse.py#L173-L210
763
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._scheme_propagation
def _scheme_propagation(self, scheme, definitions): """ Will updated a scheme based on inheritance. This is defined in a scheme objects with ``'inherit': '$definition'``. Will also updated parent objects for nested inheritance. Usage:: >>> SCHEME = { >>> 'thing1': {...
python
def _scheme_propagation(self, scheme, definitions): """ Will updated a scheme based on inheritance. This is defined in a scheme objects with ``'inherit': '$definition'``. Will also updated parent objects for nested inheritance. Usage:: >>> SCHEME = { >>> 'thing1': {...
['def', '_scheme_propagation', '(', 'self', ',', 'scheme', ',', 'definitions', ')', ':', 'if', 'not', 'isinstance', '(', 'scheme', ',', 'dict', ')', ':', 'raise', 'TypeError', '(', "'scheme must be a dict to propagate.'", ')', 'inherit_from', '=', 'scheme', '.', 'get', '(', "'inherit'", ')', 'if', 'isinstance', '(', 'i...
Will updated a scheme based on inheritance. This is defined in a scheme objects with ``'inherit': '$definition'``. Will also updated parent objects for nested inheritance. Usage:: >>> SCHEME = { >>> 'thing1': { >>> 'inherit': '$thing2' >>> ...
['Will', 'updated', 'a', 'scheme', 'based', 'on', 'inheritance', '.', 'This', 'is', 'defined', 'in', 'a', 'scheme', 'objects', 'with', 'inherit', ':', '$definition', '.', 'Will', 'also', 'updated', 'parent', 'objects', 'for', 'nested', 'inheritance', '.']
train
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1711-L1780
764
Synerty/peek-plugin-base
peek_plugin_base/storage/DbConnection.py
DbConnection.prefetchDeclarativeIds
def prefetchDeclarativeIds(self, Declarative, count) -> DelcarativeIdGen: """ Prefetch Declarative IDs This function prefetches a chunk of IDs from a database sequence. Doing this allows us to preallocate the IDs before an insert, which significantly speeds up : * Orm inserts, ...
python
def prefetchDeclarativeIds(self, Declarative, count) -> DelcarativeIdGen: """ Prefetch Declarative IDs This function prefetches a chunk of IDs from a database sequence. Doing this allows us to preallocate the IDs before an insert, which significantly speeds up : * Orm inserts, ...
['def', 'prefetchDeclarativeIds', '(', 'self', ',', 'Declarative', ',', 'count', ')', '->', 'DelcarativeIdGen', ':', 'return', '_commonPrefetchDeclarativeIds', '(', 'self', '.', 'dbEngine', ',', 'self', '.', '_sequenceMutex', ',', 'Declarative', ',', 'count', ')']
Prefetch Declarative IDs This function prefetches a chunk of IDs from a database sequence. Doing this allows us to preallocate the IDs before an insert, which significantly speeds up : * Orm inserts, especially those using inheritance * When we need the ID to assign it to a rel...
['Prefetch', 'Declarative', 'IDs']
train
https://github.com/Synerty/peek-plugin-base/blob/276101d028e1ee0678af514c761b74cce5a5cda9/peek_plugin_base/storage/DbConnection.py#L152-L171
765
PeerAssets/pypeerassets
pypeerassets/provider/explorer.py
Explorer.getblockhash
def getblockhash(self, index: int) -> str: '''Returns the hash of the block at ; index 0 is the genesis block.''' return cast(str, self.api_fetch('getblockhash?index=' + str(index)))
python
def getblockhash(self, index: int) -> str: '''Returns the hash of the block at ; index 0 is the genesis block.''' return cast(str, self.api_fetch('getblockhash?index=' + str(index)))
['def', 'getblockhash', '(', 'self', ',', 'index', ':', 'int', ')', '->', 'str', ':', 'return', 'cast', '(', 'str', ',', 'self', '.', 'api_fetch', '(', "'getblockhash?index='", '+', 'str', '(', 'index', ')', ')', ')']
Returns the hash of the block at ; index 0 is the genesis block.
['Returns', 'the', 'hash', 'of', 'the', 'block', 'at', ';', 'index', '0', 'is', 'the', 'genesis', 'block', '.']
train
https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/provider/explorer.py#L73-L76
766
rigetti/pyquil
pyquil/api/_quantum_computer.py
_canonicalize_name
def _canonicalize_name(prefix, qvm_type, noisy): """Take the output of _parse_name to create a canonical name. """ if noisy: noise_suffix = '-noisy' else: noise_suffix = '' if qvm_type is None: qvm_suffix = '' elif qvm_type == 'qvm': qvm_suffix = '-qvm' elif ...
python
def _canonicalize_name(prefix, qvm_type, noisy): """Take the output of _parse_name to create a canonical name. """ if noisy: noise_suffix = '-noisy' else: noise_suffix = '' if qvm_type is None: qvm_suffix = '' elif qvm_type == 'qvm': qvm_suffix = '-qvm' elif ...
['def', '_canonicalize_name', '(', 'prefix', ',', 'qvm_type', ',', 'noisy', ')', ':', 'if', 'noisy', ':', 'noise_suffix', '=', "'-noisy'", 'else', ':', 'noise_suffix', '=', "''", 'if', 'qvm_type', 'is', 'None', ':', 'qvm_suffix', '=', "''", 'elif', 'qvm_type', '==', "'qvm'", ':', 'qvm_suffix', '=', "'-qvm'", 'elif', 'q...
Take the output of _parse_name to create a canonical name.
['Take', 'the', 'output', 'of', '_parse_name', 'to', 'create', 'a', 'canonical', 'name', '.']
train
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_quantum_computer.py#L344-L362
767
UCL-INGI/INGInious
inginious/frontend/user_manager.py
UserManager.course_unregister_user
def course_unregister_user(self, course, username=None): """ Unregister a user to the course :param course: a Course object :param username: The username of the user that we want to unregister. If None, uses self.session_username() """ if username is None: use...
python
def course_unregister_user(self, course, username=None): """ Unregister a user to the course :param course: a Course object :param username: The username of the user that we want to unregister. If None, uses self.session_username() """ if username is None: use...
['def', 'course_unregister_user', '(', 'self', ',', 'course', ',', 'username', '=', 'None', ')', ':', 'if', 'username', 'is', 'None', ':', 'username', '=', 'self', '.', 'session_username', '(', ')', '# Needed if user belongs to a group', 'self', '.', '_database', '.', 'aggregations', '.', 'find_one_and_update', '(', '{...
Unregister a user to the course :param course: a Course object :param username: The username of the user that we want to unregister. If None, uses self.session_username()
['Unregister', 'a', 'user', 'to', 'the', 'course', ':', 'param', 'course', ':', 'a', 'Course', 'object', ':', 'param', 'username', ':', 'The', 'username', 'of', 'the', 'user', 'that', 'we', 'want', 'to', 'unregister', '.', 'If', 'None', 'uses', 'self', '.', 'session_username', '()']
train
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L702-L721
768
oceanprotocol/squid-py
squid_py/ocean/ocean_conditions.py
OceanConditions.refund_reward
def refund_reward(self, agreement_id, amount, account): """ Refund reaward condition. :param agreement_id: id of the agreement, hex str :param amount: Amount of tokens, int :param account: Account :return: """ return self.release_reward(agreement_id, amou...
python
def refund_reward(self, agreement_id, amount, account): """ Refund reaward condition. :param agreement_id: id of the agreement, hex str :param amount: Amount of tokens, int :param account: Account :return: """ return self.release_reward(agreement_id, amou...
['def', 'refund_reward', '(', 'self', ',', 'agreement_id', ',', 'amount', ',', 'account', ')', ':', 'return', 'self', '.', 'release_reward', '(', 'agreement_id', ',', 'amount', ',', 'account', ')']
Refund reaward condition. :param agreement_id: id of the agreement, hex str :param amount: Amount of tokens, int :param account: Account :return:
['Refund', 'reaward', 'condition', '.']
train
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_conditions.py#L65-L74
769
google/grr
grr/server/grr_response_server/databases/mysql_users.py
MySQLDBUsersMixin.DeleteGRRUser
def DeleteGRRUser(self, username, cursor=None): """Deletes the user and all related metadata with the given username.""" cursor.execute("DELETE FROM grr_users WHERE username_hash = %s", (mysql_utils.Hash(username),)) if cursor.rowcount == 0: raise db.UnknownGRRUserError(username)
python
def DeleteGRRUser(self, username, cursor=None): """Deletes the user and all related metadata with the given username.""" cursor.execute("DELETE FROM grr_users WHERE username_hash = %s", (mysql_utils.Hash(username),)) if cursor.rowcount == 0: raise db.UnknownGRRUserError(username)
['def', 'DeleteGRRUser', '(', 'self', ',', 'username', ',', 'cursor', '=', 'None', ')', ':', 'cursor', '.', 'execute', '(', '"DELETE FROM grr_users WHERE username_hash = %s"', ',', '(', 'mysql_utils', '.', 'Hash', '(', 'username', ')', ',', ')', ')', 'if', 'cursor', '.', 'rowcount', '==', '0', ':', 'raise', 'db', '.', ...
Deletes the user and all related metadata with the given username.
['Deletes', 'the', 'user', 'and', 'all', 'related', 'metadata', 'with', 'the', 'given', 'username', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_users.py#L137-L143
770
mattloper/opendr
opendr/topology.py
get_vert_connectivity
def get_vert_connectivity(mesh_v, mesh_f): """Returns a sparse matrix (of size #verts x #verts) where each nonzero element indicates a neighborhood relation. For example, if there is a nonzero element in position (15,12), that means vertex 15 is connected by an edge to vertex 12.""" vpv = sp.csc_ma...
python
def get_vert_connectivity(mesh_v, mesh_f): """Returns a sparse matrix (of size #verts x #verts) where each nonzero element indicates a neighborhood relation. For example, if there is a nonzero element in position (15,12), that means vertex 15 is connected by an edge to vertex 12.""" vpv = sp.csc_ma...
['def', 'get_vert_connectivity', '(', 'mesh_v', ',', 'mesh_f', ')', ':', 'vpv', '=', 'sp', '.', 'csc_matrix', '(', '(', 'len', '(', 'mesh_v', ')', ',', 'len', '(', 'mesh_v', ')', ')', ')', '# for each column in the faces...', 'for', 'i', 'in', 'range', '(', '3', ')', ':', 'IS', '=', 'mesh_f', '[', ':', ',', 'i', ']', '...
Returns a sparse matrix (of size #verts x #verts) where each nonzero element indicates a neighborhood relation. For example, if there is a nonzero element in position (15,12), that means vertex 15 is connected by an edge to vertex 12.
['Returns', 'a', 'sparse', 'matrix', '(', 'of', 'size', '#verts', 'x', '#verts', ')', 'where', 'each', 'nonzero', 'element', 'indicates', 'a', 'neighborhood', 'relation', '.', 'For', 'example', 'if', 'there', 'is', 'a', 'nonzero', 'element', 'in', 'position', '(', '15', '12', ')', 'that', 'means', 'vertex', '15', 'is',...
train
https://github.com/mattloper/opendr/blob/bc16a6a51771d6e062d088ba5cede66649b7c7ec/opendr/topology.py#L18-L35
771
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_new_profile_template
def get_new_profile_template(self): """ Retrieves the profile template for a given server profile. Returns: dict: Server profile template. """ uri = '{}/new-profile-template'.format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_new_profile_template(self): """ Retrieves the profile template for a given server profile. Returns: dict: Server profile template. """ uri = '{}/new-profile-template'.format(self.data["uri"]) return self._helper.do_get(uri)
['def', 'get_new_profile_template', '(', 'self', ')', ':', 'uri', '=', "'{}/new-profile-template'", '.', 'format', '(', 'self', '.', 'data', '[', '"uri"', ']', ')', 'return', 'self', '.', '_helper', '.', 'do_get', '(', 'uri', ')']
Retrieves the profile template for a given server profile. Returns: dict: Server profile template.
['Retrieves', 'the', 'profile', 'template', 'for', 'a', 'given', 'server', 'profile', '.']
train
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L323-L331
772
ewels/MultiQC
multiqc/modules/picard/ValidateSamFile.py
_parse_reports_by_type
def _parse_reports_by_type(self): """ Returns a data dictionary Goes through logs and parses them based on 'No errors found', VERBOSE or SUMMARY type. """ data = dict() for file_meta in self.find_log_files('picard/sam_file_validation', filehandles=True): sample = file_meta['s_name'] ...
python
def _parse_reports_by_type(self): """ Returns a data dictionary Goes through logs and parses them based on 'No errors found', VERBOSE or SUMMARY type. """ data = dict() for file_meta in self.find_log_files('picard/sam_file_validation', filehandles=True): sample = file_meta['s_name'] ...
['def', '_parse_reports_by_type', '(', 'self', ')', ':', 'data', '=', 'dict', '(', ')', 'for', 'file_meta', 'in', 'self', '.', 'find_log_files', '(', "'picard/sam_file_validation'", ',', 'filehandles', '=', 'True', ')', ':', 'sample', '=', 'file_meta', '[', "'s_name'", ']', 'if', 'sample', 'in', 'data', ':', 'log', '.'...
Returns a data dictionary Goes through logs and parses them based on 'No errors found', VERBOSE or SUMMARY type.
['Returns', 'a', 'data', 'dictionary']
train
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/picard/ValidateSamFile.py#L110-L137
773
eqcorrscan/EQcorrscan
eqcorrscan/utils/catalog_to_dd.py
read_phase
def read_phase(ph_file): """ Read hypoDD phase files into Obspy catalog class. :type ph_file: str :param ph_file: Phase file to read event info from. :returns: Catalog of events from file. :rtype: :class:`obspy.core.event.Catalog` >>> from obspy.core.event.catalog import Catalog >>> #...
python
def read_phase(ph_file): """ Read hypoDD phase files into Obspy catalog class. :type ph_file: str :param ph_file: Phase file to read event info from. :returns: Catalog of events from file. :rtype: :class:`obspy.core.event.Catalog` >>> from obspy.core.event.catalog import Catalog >>> #...
['def', 'read_phase', '(', 'ph_file', ')', ':', 'ph_catalog', '=', 'Catalog', '(', ')', 'f', '=', 'open', '(', 'ph_file', ',', "'r'", ')', '# Topline of each event is marked by # in position 0', 'for', 'line', 'in', 'f', ':', 'if', 'line', '[', '0', ']', '==', "'#'", ':', 'if', "'event_text'", 'not', 'in', 'locals', '(...
Read hypoDD phase files into Obspy catalog class. :type ph_file: str :param ph_file: Phase file to read event info from. :returns: Catalog of events from file. :rtype: :class:`obspy.core.event.Catalog` >>> from obspy.core.event.catalog import Catalog >>> # Get the path to the test data >>...
['Read', 'hypoDD', 'phase', 'files', 'into', 'Obspy', 'catalog', 'class', '.']
train
https://github.com/eqcorrscan/EQcorrscan/blob/3121b4aca801ee5d38f56ca297ce1c0f9515d9ff/eqcorrscan/utils/catalog_to_dd.py#L633-L667
774
saltstack/salt
salt/modules/boto_cloudwatch.py
delete_alarm
def delete_alarm(name, region=None, key=None, keyid=None, profile=None): ''' Delete a cloudwatch alarm CLI example to delete a queue:: salt myminion boto_cloudwatch.delete_alarm myalarm region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) conn.de...
python
def delete_alarm(name, region=None, key=None, keyid=None, profile=None): ''' Delete a cloudwatch alarm CLI example to delete a queue:: salt myminion boto_cloudwatch.delete_alarm myalarm region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) conn.de...
['def', 'delete_alarm', '(', 'name', ',', 'region', '=', 'None', ',', 'key', '=', 'None', ',', 'keyid', '=', 'None', ',', 'profile', '=', 'None', ')', ':', 'conn', '=', '_get_conn', '(', 'region', '=', 'region', ',', 'key', '=', 'key', ',', 'keyid', '=', 'keyid', ',', 'profile', '=', 'profile', ')', 'conn', '.', 'delet...
Delete a cloudwatch alarm CLI example to delete a queue:: salt myminion boto_cloudwatch.delete_alarm myalarm region=us-east-1
['Delete', 'a', 'cloudwatch', 'alarm']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cloudwatch.py#L299-L311
775
coldfix/udiskie
udiskie/async_.py
gather._subtask_error
def _subtask_error(self, idx, error): """Receive an error from a single subtask.""" self.set_exception(error) self.errbacks.clear()
python
def _subtask_error(self, idx, error): """Receive an error from a single subtask.""" self.set_exception(error) self.errbacks.clear()
['def', '_subtask_error', '(', 'self', ',', 'idx', ',', 'error', ')', ':', 'self', '.', 'set_exception', '(', 'error', ')', 'self', '.', 'errbacks', '.', 'clear', '(', ')']
Receive an error from a single subtask.
['Receive', 'an', 'error', 'from', 'a', 'single', 'subtask', '.']
train
https://github.com/coldfix/udiskie/blob/804c9d27df6f7361fec3097c432398f2d702f911/udiskie/async_.py#L141-L144
776
dcos/shakedown
shakedown/dcos/security.py
add_user
def add_user(uid, password, desc=None): """ Adds user to the DCOS Enterprise. If not description is provided the uid will be used for the description. :param uid: user id :type uid: str :param password: password :type password: str :param desc: description of user ...
python
def add_user(uid, password, desc=None): """ Adds user to the DCOS Enterprise. If not description is provided the uid will be used for the description. :param uid: user id :type uid: str :param password: password :type password: str :param desc: description of user ...
['def', 'add_user', '(', 'uid', ',', 'password', ',', 'desc', '=', 'None', ')', ':', 'try', ':', 'desc', '=', 'uid', 'if', 'desc', 'is', 'None', 'else', 'desc', 'user_object', '=', '{', '"description"', ':', 'desc', ',', '"password"', ':', 'password', '}', 'acl_url', '=', 'urljoin', '(', '_acl_url', '(', ')', ',', "'us...
Adds user to the DCOS Enterprise. If not description is provided the uid will be used for the description. :param uid: user id :type uid: str :param password: password :type password: str :param desc: description of user :type desc: str
['Adds', 'user', 'to', 'the', 'DCOS', 'Enterprise', '.', 'If', 'not', 'description', 'is', 'provided', 'the', 'uid', 'will', 'be', 'used', 'for', 'the', 'description', '.']
train
https://github.com/dcos/shakedown/blob/e2f9e2382788dbcd29bd18aa058b76e7c3b83b3e/shakedown/dcos/security.py#L17-L37
777
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._build_session
def _build_session(self, name, start_info, end_info): """Builds a session object.""" assert start_info is not None result = api_pb2.Session( name=name, start_time_secs=start_info.start_time_secs, model_uri=start_info.model_uri, metric_values=self._build_session_metric_values...
python
def _build_session(self, name, start_info, end_info): """Builds a session object.""" assert start_info is not None result = api_pb2.Session( name=name, start_time_secs=start_info.start_time_secs, model_uri=start_info.model_uri, metric_values=self._build_session_metric_values...
['def', '_build_session', '(', 'self', ',', 'name', ',', 'start_info', ',', 'end_info', ')', ':', 'assert', 'start_info', 'is', 'not', 'None', 'result', '=', 'api_pb2', '.', 'Session', '(', 'name', '=', 'name', ',', 'start_time_secs', '=', 'start_info', '.', 'start_time_secs', ',', 'model_uri', '=', 'start_info', '.', ...
Builds a session object.
['Builds', 'a', 'session', 'object', '.']
train
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L132-L145
778
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/network.py
Network.Update
def Update(self,name,description=None,location=None): """Updates the attributes of a given Network via PUT. https://www.ctl.io/api-docs/v2/#networks-update-network { "name": "VLAN for Development Servers", "description": "Development Servers on 11.22.33.0/24" } Returns a 204 and no content ""...
python
def Update(self,name,description=None,location=None): """Updates the attributes of a given Network via PUT. https://www.ctl.io/api-docs/v2/#networks-update-network { "name": "VLAN for Development Servers", "description": "Development Servers on 11.22.33.0/24" } Returns a 204 and no content ""...
['def', 'Update', '(', 'self', ',', 'name', ',', 'description', '=', 'None', ',', 'location', '=', 'None', ')', ':', 'if', 'not', 'location', ':', 'location', '=', 'clc', '.', 'v2', '.', 'Account', '.', 'GetLocation', '(', 'session', '=', 'self', '.', 'session', ')', 'payload', '=', '{', "'name'", ':', 'name', '}', 'pa...
Updates the attributes of a given Network via PUT. https://www.ctl.io/api-docs/v2/#networks-update-network { "name": "VLAN for Development Servers", "description": "Development Servers on 11.22.33.0/24" } Returns a 204 and no content
['Updates', 'the', 'attributes', 'of', 'a', 'given', 'Network', 'via', 'PUT', '.']
train
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/network.py#L131-L152
779
mattlong/hermes
hermes/server.py
_listen
def _listen(sockets): """Main server loop. Listens for incoming events and dispatches them to appropriate chatroom""" while True: (i , o, e) = select.select(sockets.keys(),[],[],1) for socket in i: if isinstance(sockets[socket], Chatroom): data_len = sockets[socket].c...
python
def _listen(sockets): """Main server loop. Listens for incoming events and dispatches them to appropriate chatroom""" while True: (i , o, e) = select.select(sockets.keys(),[],[],1) for socket in i: if isinstance(sockets[socket], Chatroom): data_len = sockets[socket].c...
['def', '_listen', '(', 'sockets', ')', ':', 'while', 'True', ':', '(', 'i', ',', 'o', ',', 'e', ')', '=', 'select', '.', 'select', '(', 'sockets', '.', 'keys', '(', ')', ',', '[', ']', ',', '[', ']', ',', '1', ')', 'for', 'socket', 'in', 'i', ':', 'if', 'isinstance', '(', 'sockets', '[', 'socket', ']', ',', 'Chatroom'...
Main server loop. Listens for incoming events and dispatches them to appropriate chatroom
['Main', 'server', 'loop', '.', 'Listens', 'for', 'incoming', 'events', 'and', 'dispatches', 'them', 'to', 'appropriate', 'chatroom']
train
https://github.com/mattlong/hermes/blob/63a5afcafe90ca99aeb44edeee9ed6f90baae431/hermes/server.py#L78-L91
780
insilichem/ommprotocol
ommprotocol/io.py
SerializedReporter.report
def report(self, simulation, state): """Generate a report. Parameters ---------- simulation : Simulation The Simulation to generate a report for state : State The current state of the simulation """ if not self._initialized: se...
python
def report(self, simulation, state): """Generate a report. Parameters ---------- simulation : Simulation The Simulation to generate a report for state : State The current state of the simulation """ if not self._initialized: se...
['def', 'report', '(', 'self', ',', 'simulation', ',', 'state', ')', ':', 'if', 'not', 'self', '.', '_initialized', ':', 'self', '.', '_initialized', '=', 'True', 'self', '.', '_steps', '[', '0', ']', '+=', 'self', '.', 'interval', 'positions', '=', 'state', '.', 'getPositions', '(', ')', '# Serialize', 'self', '.', '_...
Generate a report. Parameters ---------- simulation : Simulation The Simulation to generate a report for state : State The current state of the simulation
['Generate', 'a', 'report', '.']
train
https://github.com/insilichem/ommprotocol/blob/7283fddba7203e5ac3542fdab41fc1279d3b444e/ommprotocol/io.py#L827-L848
781
timothyhahn/rui
rui/rui.py
World.remove_system
def remove_system(self, system): ''' Removes system from world and kills system ''' if system in self._systems: self._systems.remove(system) else: raise UnmanagedSystemError(system)
python
def remove_system(self, system): ''' Removes system from world and kills system ''' if system in self._systems: self._systems.remove(system) else: raise UnmanagedSystemError(system)
['def', 'remove_system', '(', 'self', ',', 'system', ')', ':', 'if', 'system', 'in', 'self', '.', '_systems', ':', 'self', '.', '_systems', '.', 'remove', '(', 'system', ')', 'else', ':', 'raise', 'UnmanagedSystemError', '(', 'system', ')']
Removes system from world and kills system
['Removes', 'system', 'from', 'world', 'and', 'kills', 'system']
train
https://github.com/timothyhahn/rui/blob/ac9f587fb486760d77332866c6e876f78a810f74/rui/rui.py#L99-L106
782
PmagPy/PmagPy
pmagpy/pmag.py
doeigs_s
def doeigs_s(tau, Vdirs): """ get elements of s from eigenvaulues - note that this is very unstable Input: tau,V: tau is an list of eigenvalues in decreasing order: [t1,t2,t3] V is an list of the eigenvector directions [[V1_dec,V1_inc],[V2_dec,V2_...
python
def doeigs_s(tau, Vdirs): """ get elements of s from eigenvaulues - note that this is very unstable Input: tau,V: tau is an list of eigenvalues in decreasing order: [t1,t2,t3] V is an list of the eigenvector directions [[V1_dec,V1_inc],[V2_dec,V2_...
['def', 'doeigs_s', '(', 'tau', ',', 'Vdirs', ')', ':', 't', '=', 'np', '.', 'zeros', '(', '(', '3', ',', '3', ',', ')', ',', "'f'", ')', '# initialize the tau diagonal matrix', 'V', '=', '[', ']', 'for', 'j', 'in', 'range', '(', '3', ')', ':', 't', '[', 'j', ']', '[', 'j', ']', '=', 'tau', '[', 'j', ']', '# diagonaliz...
get elements of s from eigenvaulues - note that this is very unstable Input: tau,V: tau is an list of eigenvalues in decreasing order: [t1,t2,t3] V is an list of the eigenvector directions [[V1_dec,V1_inc],[V2_dec,V2_inc],[V3_dec,V3_inc]] Output: ...
['get', 'elements', 'of', 's', 'from', 'eigenvaulues', '-', 'note', 'that', 'this', 'is', 'very', 'unstable', 'Input', ':', 'tau', 'V', ':', 'tau', 'is', 'an', 'list', 'of', 'eigenvalues', 'in', 'decreasing', 'order', ':', '[', 't1', 't2', 't3', ']', 'V', 'is', 'an', 'list', 'of', 'the', 'eigenvector', 'directions', '[...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L5677-L5700
783
BYU-PCCL/holodeck
holodeck/environments.py
HolodeckEnvironment.set_day_time
def set_day_time(self, hour): """Queue up a change day time command. It will be applied when `tick` or `step` is called next. By the next tick, the lighting and the skysphere will be updated with the new hour. If there is no skysphere or directional light in the world, the command will not funct...
python
def set_day_time(self, hour): """Queue up a change day time command. It will be applied when `tick` or `step` is called next. By the next tick, the lighting and the skysphere will be updated with the new hour. If there is no skysphere or directional light in the world, the command will not funct...
['def', 'set_day_time', '(', 'self', ',', 'hour', ')', ':', 'self', '.', '_should_write_to_command_buffer', '=', 'True', 'command_to_send', '=', 'DayTimeCommand', '(', 'hour', '%', '24', ')', 'self', '.', '_commands', '.', 'add_command', '(', 'command_to_send', ')']
Queue up a change day time command. It will be applied when `tick` or `step` is called next. By the next tick, the lighting and the skysphere will be updated with the new hour. If there is no skysphere or directional light in the world, the command will not function properly but will not cause a crash. ...
['Queue', 'up', 'a', 'change', 'day', 'time', 'command', '.', 'It', 'will', 'be', 'applied', 'when', 'tick', 'or', 'step', 'is', 'called', 'next', '.', 'By', 'the', 'next', 'tick', 'the', 'lighting', 'and', 'the', 'skysphere', 'will', 'be', 'updated', 'with', 'the', 'new', 'hour', '.', 'If', 'there', 'is', 'no', 'skysp...
train
https://github.com/BYU-PCCL/holodeck/blob/01acd4013f5acbd9f61fbc9caaafe19975e8b121/holodeck/environments.py#L291-L301
784
spacetelescope/drizzlepac
drizzlepac/buildmask.py
buildMask
def buildMask(dqarr, bitvalue): """ Builds a bit-mask from an input DQ array and a bitvalue flag """ return bitfield_to_boolean_mask(dqarr, bitvalue, good_mask_value=1, dtype=np.uint8)
python
def buildMask(dqarr, bitvalue): """ Builds a bit-mask from an input DQ array and a bitvalue flag """ return bitfield_to_boolean_mask(dqarr, bitvalue, good_mask_value=1, dtype=np.uint8)
['def', 'buildMask', '(', 'dqarr', ',', 'bitvalue', ')', ':', 'return', 'bitfield_to_boolean_mask', '(', 'dqarr', ',', 'bitvalue', ',', 'good_mask_value', '=', '1', ',', 'dtype', '=', 'np', '.', 'uint8', ')']
Builds a bit-mask from an input DQ array and a bitvalue flag
['Builds', 'a', 'bit', '-', 'mask', 'from', 'an', 'input', 'DQ', 'array', 'and', 'a', 'bitvalue', 'flag']
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/buildmask.py#L82-L85
785
apple/turicreate
src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py
NearestNeighborClassifier._load_version
def _load_version(cls, state, version): """ A function to load a previously saved NearestNeighborClassifier model. Parameters ---------- unpickler : GLUnpickler A GLUnpickler file handler. version : int Version number maintained by the class writ...
python
def _load_version(cls, state, version): """ A function to load a previously saved NearestNeighborClassifier model. Parameters ---------- unpickler : GLUnpickler A GLUnpickler file handler. version : int Version number maintained by the class writ...
['def', '_load_version', '(', 'cls', ',', 'state', ',', 'version', ')', ':', 'assert', '(', 'version', '==', 'cls', '.', '_PYTHON_NN_CLASSIFIER_MODEL_VERSION', ')', 'knn_model', '=', '_tc', '.', 'nearest_neighbors', '.', 'NearestNeighborsModel', '(', 'state', '[', "'knn_model'", ']', ')', 'del', 'state', '[', "'knn_mod...
A function to load a previously saved NearestNeighborClassifier model. Parameters ---------- unpickler : GLUnpickler A GLUnpickler file handler. version : int Version number maintained by the class writer.
['A', 'function', 'to', 'load', 'a', 'previously', 'saved', 'NearestNeighborClassifier', 'model', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/nearest_neighbor_classifier.py#L353-L369
786
Valuehorizon/valuehorizon-people
people/models.py
Person.age
def age(self, as_at_date=None): """ Compute the person's age """ if self.date_of_death != None or self.is_deceased == True: return None as_at_date = date.today() if as_at_date == None else as_at_date if self.date_of_birth != None: if (as_...
python
def age(self, as_at_date=None): """ Compute the person's age """ if self.date_of_death != None or self.is_deceased == True: return None as_at_date = date.today() if as_at_date == None else as_at_date if self.date_of_birth != None: if (as_...
['def', 'age', '(', 'self', ',', 'as_at_date', '=', 'None', ')', ':', 'if', 'self', '.', 'date_of_death', '!=', 'None', 'or', 'self', '.', 'is_deceased', '==', 'True', ':', 'return', 'None', 'as_at_date', '=', 'date', '.', 'today', '(', ')', 'if', 'as_at_date', '==', 'None', 'else', 'as_at_date', 'if', 'self', '.', 'da...
Compute the person's age
['Compute', 'the', 'person', 's', 'age']
train
https://github.com/Valuehorizon/valuehorizon-people/blob/f32d9f1349c1a9384bae5ea61d10c1b1e0318401/people/models.py#L53-L68
787
ga4gh/ga4gh-server
ga4gh/server/datamodel/obo_parser.py
GODag.write_hier_all
def write_hier_all(self, out=sys.stdout, len_dash=1, max_depth=None, num_child=None, short_prt=False): """Write hierarchy for all GO Terms in obo file.""" # Print: [biological_process, molecular_function, and cellular_component] for go_id in ['GO:0008150', 'GO:0003674', 'GO...
python
def write_hier_all(self, out=sys.stdout, len_dash=1, max_depth=None, num_child=None, short_prt=False): """Write hierarchy for all GO Terms in obo file.""" # Print: [biological_process, molecular_function, and cellular_component] for go_id in ['GO:0008150', 'GO:0003674', 'GO...
['def', 'write_hier_all', '(', 'self', ',', 'out', '=', 'sys', '.', 'stdout', ',', 'len_dash', '=', '1', ',', 'max_depth', '=', 'None', ',', 'num_child', '=', 'None', ',', 'short_prt', '=', 'False', ')', ':', '# Print: [biological_process, molecular_function, and cellular_component]', 'for', 'go_id', 'in', '[', "'GO:00...
Write hierarchy for all GO Terms in obo file.
['Write', 'hierarchy', 'for', 'all', 'GO', 'Terms', 'in', 'obo', 'file', '.']
train
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/obo_parser.py#L492-L497
788
tanghaibao/jcvi
jcvi/utils/grouper.py
Grouper.joined
def joined(self, a, b): """ Returns True if a and b are members of the same set. """ mapping = self._mapping try: return mapping[a] is mapping[b] except KeyError: return False
python
def joined(self, a, b): """ Returns True if a and b are members of the same set. """ mapping = self._mapping try: return mapping[a] is mapping[b] except KeyError: return False
['def', 'joined', '(', 'self', ',', 'a', ',', 'b', ')', ':', 'mapping', '=', 'self', '.', '_mapping', 'try', ':', 'return', 'mapping', '[', 'a', ']', 'is', 'mapping', '[', 'b', ']', 'except', 'KeyError', ':', 'return', 'False']
Returns True if a and b are members of the same set.
['Returns', 'True', 'if', 'a', 'and', 'b', 'are', 'members', 'of', 'the', 'same', 'set', '.']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/grouper.py#L63-L71
789
9b/google-alerts
google_alerts/__init__.py
GoogleAlerts.modify
def modify(self, monitor_id, options): """Create a monitor using passed configuration.""" if not self._state: raise InvalidState("State was not properly obtained from the app") monitors = self.list() # Get the latest set of monitors obj = None for monitor in monitors...
python
def modify(self, monitor_id, options): """Create a monitor using passed configuration.""" if not self._state: raise InvalidState("State was not properly obtained from the app") monitors = self.list() # Get the latest set of monitors obj = None for monitor in monitors...
['def', 'modify', '(', 'self', ',', 'monitor_id', ',', 'options', ')', ':', 'if', 'not', 'self', '.', '_state', ':', 'raise', 'InvalidState', '(', '"State was not properly obtained from the app"', ')', 'monitors', '=', 'self', '.', 'list', '(', ')', '# Get the latest set of monitors', 'obj', '=', 'None', 'for', 'monito...
Create a monitor using passed configuration.
['Create', 'a', 'monitor', 'using', 'passed', 'configuration', '.']
train
https://github.com/9b/google-alerts/blob/69a502cbcccf1bcafe963ed40d286441b0117e04/google_alerts/__init__.py#L357-L380
790
nerdvegas/rez
src/rez/utils/filesystem.py
find_matching_symlink
def find_matching_symlink(path, source): """Find a symlink under `path` that points at `source`. If source is relative, it is considered relative to `path`. Returns: str: Name of symlink found, or None. """ def to_abs(target): if os.path.isabs(target): return target ...
python
def find_matching_symlink(path, source): """Find a symlink under `path` that points at `source`. If source is relative, it is considered relative to `path`. Returns: str: Name of symlink found, or None. """ def to_abs(target): if os.path.isabs(target): return target ...
['def', 'find_matching_symlink', '(', 'path', ',', 'source', ')', ':', 'def', 'to_abs', '(', 'target', ')', ':', 'if', 'os', '.', 'path', '.', 'isabs', '(', 'target', ')', ':', 'return', 'target', 'else', ':', 'return', 'os', '.', 'path', '.', 'normpath', '(', 'os', '.', 'path', '.', 'join', '(', 'path', ',', 'target',...
Find a symlink under `path` that points at `source`. If source is relative, it is considered relative to `path`. Returns: str: Name of symlink found, or None.
['Find', 'a', 'symlink', 'under', 'path', 'that', 'points', 'at', 'source', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L291-L314
791
pysathq/pysat
pysat/solvers.py
Minisat22.get_model
def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.minisat and self.status == True: model = pysolvers.minisat22_model(self.minisat) return model if model != None else []
python
def get_model(self): """ Get a model if the formula was previously satisfied. """ if self.minisat and self.status == True: model = pysolvers.minisat22_model(self.minisat) return model if model != None else []
['def', 'get_model', '(', 'self', ')', ':', 'if', 'self', '.', 'minisat', 'and', 'self', '.', 'status', '==', 'True', ':', 'model', '=', 'pysolvers', '.', 'minisat22_model', '(', 'self', '.', 'minisat', ')', 'return', 'model', 'if', 'model', '!=', 'None', 'else', '[', ']']
Get a model if the formula was previously satisfied.
['Get', 'a', 'model', 'if', 'the', 'formula', 'was', 'previously', 'satisfied', '.']
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/solvers.py#L3072-L3079
792
RedHatInsights/insights-core
insights/core/ls_parser.py
parse_selinux
def parse_selinux(parts): """ Parse part of an ls output line that is selinux. Args: parts (list): A four element list of strings representing the initial parts of an ls line after the permission bits. The parts are owner group, selinux info, and the path. Returns: ...
python
def parse_selinux(parts): """ Parse part of an ls output line that is selinux. Args: parts (list): A four element list of strings representing the initial parts of an ls line after the permission bits. The parts are owner group, selinux info, and the path. Returns: ...
['def', 'parse_selinux', '(', 'parts', ')', ':', 'owner', ',', 'group', '=', 'parts', '[', ':', '2', ']', 'selinux', '=', 'parts', '[', '2', ']', '.', 'split', '(', '":"', ')', 'lsel', '=', 'len', '(', 'selinux', ')', 'path', ',', 'link', '=', 'parse_path', '(', 'parts', '[', '-', '1', ']', ')', 'result', '=', '{', '"o...
Parse part of an ls output line that is selinux. Args: parts (list): A four element list of strings representing the initial parts of an ls line after the permission bits. The parts are owner group, selinux info, and the path. Returns: A dict containing owner, group, se...
['Parse', 'part', 'of', 'an', 'ls', 'output', 'line', 'that', 'is', 'selinux', '.']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/ls_parser.py#L68-L98
793
python-diamond/Diamond
src/collectors/smart/smart.py
SmartCollector.collect
def collect(self): """ Collect and publish S.M.A.R.T. attributes """ devices = re.compile(self.config['devices']) for device in os.listdir('/dev'): if devices.match(device): command = [self.config['bin'], "-A", os.path.join('/dev', ...
python
def collect(self): """ Collect and publish S.M.A.R.T. attributes """ devices = re.compile(self.config['devices']) for device in os.listdir('/dev'): if devices.match(device): command = [self.config['bin'], "-A", os.path.join('/dev', ...
['def', 'collect', '(', 'self', ')', ':', 'devices', '=', 're', '.', 'compile', '(', 'self', '.', 'config', '[', "'devices'", ']', ')', 'for', 'device', 'in', 'os', '.', 'listdir', '(', "'/dev'", ')', ':', 'if', 'devices', '.', 'match', '(', 'device', ')', ':', 'command', '=', '[', 'self', '.', 'config', '[', "'bin'", ...
Collect and publish S.M.A.R.T. attributes
['Collect', 'and', 'publish', 'S', '.', 'M', '.', 'A', '.', 'R', '.', 'T', '.', 'attributes']
train
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/smart/smart.py#L45-L99
794
azraq27/neural
neural/alignment.py
convert_coord
def convert_coord(coord_from,matrix_file,base_to_aligned=True): '''Takes an XYZ array (in DICOM coordinates) and uses the matrix file produced by 3dAllineate to transform it. By default, the 3dAllineate matrix transforms from base to aligned space; to get the inverse transform set ``base_to_aligned`` to ``False...
python
def convert_coord(coord_from,matrix_file,base_to_aligned=True): '''Takes an XYZ array (in DICOM coordinates) and uses the matrix file produced by 3dAllineate to transform it. By default, the 3dAllineate matrix transforms from base to aligned space; to get the inverse transform set ``base_to_aligned`` to ``False...
['def', 'convert_coord', '(', 'coord_from', ',', 'matrix_file', ',', 'base_to_aligned', '=', 'True', ')', ':', 'with', 'open', '(', 'matrix_file', ')', 'as', 'f', ':', 'try', ':', 'values', '=', '[', 'float', '(', 'y', ')', 'for', 'y', 'in', "' '", '.', 'join', '(', '[', 'x', 'for', 'x', 'in', 'f', '.', 'readlines', '(...
Takes an XYZ array (in DICOM coordinates) and uses the matrix file produced by 3dAllineate to transform it. By default, the 3dAllineate matrix transforms from base to aligned space; to get the inverse transform set ``base_to_aligned`` to ``False``
['Takes', 'an', 'XYZ', 'array', '(', 'in', 'DICOM', 'coordinates', ')', 'and', 'uses', 'the', 'matrix', 'file', 'produced', 'by', '3dAllineate', 'to', 'transform', 'it', '.', 'By', 'default', 'the', '3dAllineate', 'matrix', 'transforms', 'from', 'base', 'to', 'aligned', 'space', ';', 'to', 'get', 'the', 'inverse', 'tra...
train
https://github.com/azraq27/neural/blob/fe91bfeecbf73ad99708cf5dca66cb61fcd529f5/neural/alignment.py#L120-L135
795
arista-eosplus/pyeapi
pyeapi/client.py
Config.read
def read(self, filename): """Reads the file specified by filename This method will load the eapi.conf file specified by filename into the instance object. It will also add the default connection localhost if it was not defined in the eapi.conf file Args: filename (...
python
def read(self, filename): """Reads the file specified by filename This method will load the eapi.conf file specified by filename into the instance object. It will also add the default connection localhost if it was not defined in the eapi.conf file Args: filename (...
['def', 'read', '(', 'self', ',', 'filename', ')', ':', 'try', ':', 'SafeConfigParser', '.', 'read', '(', 'self', ',', 'filename', ')', 'except', 'SafeConfigParserError', 'as', 'exc', ':', '# Ignore file and syslog a message on SafeConfigParser errors', 'msg', '=', '(', '"%s: parsing error in eapi conf file: %s"', '%',...
Reads the file specified by filename This method will load the eapi.conf file specified by filename into the instance object. It will also add the default connection localhost if it was not defined in the eapi.conf file Args: filename (str): The full path to the file to lo...
['Reads', 'the', 'file', 'specified', 'by', 'filename']
train
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/client.py#L183-L209
796
SavinaRoja/OpenAccess_EPUB
src/openaccess_epub/utils/images.py
make_image_cache
def make_image_cache(img_cache): """ Initiates the image cache if it does not exist """ log.info('Initiating the image cache at {0}'.format(img_cache)) if not os.path.isdir(img_cache): utils.mkdir_p(img_cache) utils.mkdir_p(os.path.join(img_cache, '10.1371')) utils.mkdir_p(os...
python
def make_image_cache(img_cache): """ Initiates the image cache if it does not exist """ log.info('Initiating the image cache at {0}'.format(img_cache)) if not os.path.isdir(img_cache): utils.mkdir_p(img_cache) utils.mkdir_p(os.path.join(img_cache, '10.1371')) utils.mkdir_p(os...
['def', 'make_image_cache', '(', 'img_cache', ')', ':', 'log', '.', 'info', '(', "'Initiating the image cache at {0}'", '.', 'format', '(', 'img_cache', ')', ')', 'if', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'img_cache', ')', ':', 'utils', '.', 'mkdir_p', '(', 'img_cache', ')', 'utils', '.', 'mkdir_p', '(', 'os',...
Initiates the image cache if it does not exist
['Initiates', 'the', 'image', 'cache', 'if', 'it', 'does', 'not', 'exist']
train
https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/images.py#L171-L179
797
googleapis/google-cloud-python
api_core/google/api_core/gapic_v1/method.py
wrap_method
def wrap_method( func, default_retry=None, default_timeout=None, client_info=client_info.DEFAULT_CLIENT_INFO, ): """Wrap an RPC method with common behavior. This applies common error wrapping, retry, and timeout behavior a function. The wrapped function will take optional ``retry`` and ``ti...
python
def wrap_method( func, default_retry=None, default_timeout=None, client_info=client_info.DEFAULT_CLIENT_INFO, ): """Wrap an RPC method with common behavior. This applies common error wrapping, retry, and timeout behavior a function. The wrapped function will take optional ``retry`` and ``ti...
['def', 'wrap_method', '(', 'func', ',', 'default_retry', '=', 'None', ',', 'default_timeout', '=', 'None', ',', 'client_info', '=', 'client_info', '.', 'DEFAULT_CLIENT_INFO', ',', ')', ':', 'func', '=', 'grpc_helpers', '.', 'wrap_errors', '(', 'func', ')', 'if', 'client_info', 'is', 'not', 'None', ':', 'user_agent_met...
Wrap an RPC method with common behavior. This applies common error wrapping, retry, and timeout behavior a function. The wrapped function will take optional ``retry`` and ``timeout`` arguments. For example:: import google.api_core.gapic_v1.method from google.api_core import retry ...
['Wrap', 'an', 'RPC', 'method', 'with', 'common', 'behavior', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/gapic_v1/method.py#L146-L242
798
d0c-s4vage/pfp
pfp/interp.py
Scope.clone
def clone(self): """Return a new Scope object that has the curr_scope pinned at the current one :returns: A new scope object """ self._dlog("cloning the stack") # TODO is this really necessary to create a brand new one? # I think it is... need to think about it mo...
python
def clone(self): """Return a new Scope object that has the curr_scope pinned at the current one :returns: A new scope object """ self._dlog("cloning the stack") # TODO is this really necessary to create a brand new one? # I think it is... need to think about it mo...
['def', 'clone', '(', 'self', ')', ':', 'self', '.', '_dlog', '(', '"cloning the stack"', ')', '# TODO is this really necessary to create a brand new one?', '# I think it is... need to think about it more.', '# or... are we going to need ref counters and a global', '# scope object that allows a view into (or a snapshot...
Return a new Scope object that has the curr_scope pinned at the current one :returns: A new scope object
['Return', 'a', 'new', 'Scope', 'object', 'that', 'has', 'the', 'curr_scope', 'pinned', 'at', 'the', 'current', 'one', ':', 'returns', ':', 'A', 'new', 'scope', 'object']
train
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L295-L309
799
kensho-technologies/graphql-compiler
graphql_compiler/compiler/expressions.py
BinaryComposition.visit_and_update
def visit_and_update(self, visitor_fn): """Create an updated version (if needed) of BinaryComposition via the visitor pattern.""" new_left = self.left.visit_and_update(visitor_fn) new_right = self.right.visit_and_update(visitor_fn) if new_left is not self.left or new_right is not self.r...
python
def visit_and_update(self, visitor_fn): """Create an updated version (if needed) of BinaryComposition via the visitor pattern.""" new_left = self.left.visit_and_update(visitor_fn) new_right = self.right.visit_and_update(visitor_fn) if new_left is not self.left or new_right is not self.r...
['def', 'visit_and_update', '(', 'self', ',', 'visitor_fn', ')', ':', 'new_left', '=', 'self', '.', 'left', '.', 'visit_and_update', '(', 'visitor_fn', ')', 'new_right', '=', 'self', '.', 'right', '.', 'visit_and_update', '(', 'visitor_fn', ')', 'if', 'new_left', 'is', 'not', 'self', '.', 'left', 'or', 'new_right', 'is...
Create an updated version (if needed) of BinaryComposition via the visitor pattern.
['Create', 'an', 'updated', 'version', '(', 'if', 'needed', ')', 'of', 'BinaryComposition', 'via', 'the', 'visitor', 'pattern', '.']
train
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/expressions.py#L781-L789