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
500
juju/charm-helpers
charmhelpers/core/hookenv.py
log
def log(message, level=None): """Write a message to the juju log""" command = ['juju-log'] if level: command += ['-l', level] if not isinstance(message, six.string_types): message = repr(message) command += [message[:SH_MAX_ARG]] # Missing juju-log should not cause failures in un...
python
def log(message, level=None): """Write a message to the juju log""" command = ['juju-log'] if level: command += ['-l', level] if not isinstance(message, six.string_types): message = repr(message) command += [message[:SH_MAX_ARG]] # Missing juju-log should not cause failures in un...
['def', 'log', '(', 'message', ',', 'level', '=', 'None', ')', ':', 'command', '=', '[', "'juju-log'", ']', 'if', 'level', ':', 'command', '+=', '[', "'-l'", ',', 'level', ']', 'if', 'not', 'isinstance', '(', 'message', ',', 'six', '.', 'string_types', ')', ':', 'message', '=', 'repr', '(', 'message', ')', 'command', '...
Write a message to the juju log
['Write', 'a', 'message', 'to', 'the', 'juju', 'log']
train
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/hookenv.py#L100-L119
501
Chilipp/funcargparse
funcargparse/__init__.py
FuncArgParser.parse_known_chained
def parse_known_chained(self, args=None): """ Parse the argument directly to the function used for setup This function parses the command line arguments to the function that has been used for the :meth:`setup_args` method. Parameters ---------- args: list ...
python
def parse_known_chained(self, args=None): """ Parse the argument directly to the function used for setup This function parses the command line arguments to the function that has been used for the :meth:`setup_args` method. Parameters ---------- args: list ...
['def', 'parse_known_chained', '(', 'self', ',', 'args', '=', 'None', ')', ':', 'ns', ',', 'remainder', '=', 'self', '.', 'parse_known_args', '(', 'args', ')', 'kws', '=', 'vars', '(', 'ns', ')', 'return', 'self', '.', '_parse2subparser_funcs', '(', 'kws', ')', ',', 'remainder']
Parse the argument directly to the function used for setup This function parses the command line arguments to the function that has been used for the :meth:`setup_args` method. Parameters ---------- args: list The arguments parsed to the :meth:`parse_args` function...
['Parse', 'the', 'argument', 'directly', 'to', 'the', 'function', 'used', 'for', 'setup']
train
https://github.com/Chilipp/funcargparse/blob/398ce8e7fa5aa35c465215446bda151cf1ecf7ad/funcargparse/__init__.py#L952-L979
502
pymc-devs/pymc
pymc/StepMethods.py
TWalk._g
def _g(self, h, xp, s): """Density function for blow and hop moves""" nphi = sum(self.phi) return (nphi / 2.0) * log(2 * pi) + nphi * \ log(s) + 0.5 * sum((h - xp) ** 2) / (s ** 2)
python
def _g(self, h, xp, s): """Density function for blow and hop moves""" nphi = sum(self.phi) return (nphi / 2.0) * log(2 * pi) + nphi * \ log(s) + 0.5 * sum((h - xp) ** 2) / (s ** 2)
['def', '_g', '(', 'self', ',', 'h', ',', 'xp', ',', 's', ')', ':', 'nphi', '=', 'sum', '(', 'self', '.', 'phi', ')', 'return', '(', 'nphi', '/', '2.0', ')', '*', 'log', '(', '2', '*', 'pi', ')', '+', 'nphi', '*', 'log', '(', 's', ')', '+', '0.5', '*', 'sum', '(', '(', 'h', '-', 'xp', ')', '**', '2', ')', '/', '(', 's'...
Density function for blow and hop moves
['Density', 'function', 'for', 'blow', 'and', 'hop', 'moves']
train
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/StepMethods.py#L1732-L1738
503
metapensiero/metapensiero.signal
src/metapensiero/signal/core.py
Signal.prepare_notification
def prepare_notification(self, *, subscribers=None, instance=None, loop=None, notify_external=True): """Sets up a and configures an `~.utils.Executor`:class: instance.""" # merge callbacks added to the class level with those added to the # instance, giving the former...
python
def prepare_notification(self, *, subscribers=None, instance=None, loop=None, notify_external=True): """Sets up a and configures an `~.utils.Executor`:class: instance.""" # merge callbacks added to the class level with those added to the # instance, giving the former...
['def', 'prepare_notification', '(', 'self', ',', '*', ',', 'subscribers', '=', 'None', ',', 'instance', '=', 'None', ',', 'loop', '=', 'None', ',', 'notify_external', '=', 'True', ')', ':', '# merge callbacks added to the class level with those added to the', '# instance, giving the formers precedence while preserving...
Sets up a and configures an `~.utils.Executor`:class: instance.
['Sets', 'up', 'a', 'and', 'configures', 'an', '~', '.', 'utils', '.', 'Executor', ':', 'class', ':', 'instance', '.']
train
https://github.com/metapensiero/metapensiero.signal/blob/1cbbb2e4bff00bf4887163b08b70d278e472bfe3/src/metapensiero/signal/core.py#L339-L383
504
nickmckay/LiPD-utilities
Python/lipd/csvs.py
_reorder_csv
def _reorder_csv(d, filename=""): """ Preserve the csv column ordering before writing back out to CSV file. Keep column data consistent with JSONLD column number alignment. { "var1" : {"number": 1, "values": [] }, "var2": {"number": 1, "values": [] } } :param dict d: csv data :param str filenam...
python
def _reorder_csv(d, filename=""): """ Preserve the csv column ordering before writing back out to CSV file. Keep column data consistent with JSONLD column number alignment. { "var1" : {"number": 1, "values": [] }, "var2": {"number": 1, "values": [] } } :param dict d: csv data :param str filenam...
['def', '_reorder_csv', '(', 'd', ',', 'filename', '=', '""', ')', ':', '_ensemble', '=', 'is_ensemble', '(', 'd', ')', '_d2', '=', '[', ']', 'try', ':', 'if', '_ensemble', ':', '# 1 column ensemble: realizations', 'if', 'len', '(', 'd', ')', '==', '1', ':', 'for', 'var', ',', 'data', 'in', 'd', '.', 'items', '(', ')',...
Preserve the csv column ordering before writing back out to CSV file. Keep column data consistent with JSONLD column number alignment. { "var1" : {"number": 1, "values": [] }, "var2": {"number": 1, "values": [] } } :param dict d: csv data :param str filename: Filename :return dict: csv data
['Preserve', 'the', 'csv', 'column', 'ordering', 'before', 'writing', 'back', 'out', 'to', 'CSV', 'file', '.', 'Keep', 'column', 'data', 'consistent', 'with', 'JSONLD', 'column', 'number', 'alignment', '.', '{', 'var1', ':', '{', 'number', ':', '1', 'values', ':', '[]', '}', 'var2', ':', '{', 'number', ':', '1', 'value...
train
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/csvs.py#L470-L528
505
KelSolaar/Manager
manager/components_manager.py
Manager.list_components
def list_components(self, dependency_order=True): """ Lists the Components by dependency resolving. Usage:: >>> manager = Manager(("./manager/tests/tests_manager/resources/components/core",)) >>> manager.register_components() True >>> manager.lis...
python
def list_components(self, dependency_order=True): """ Lists the Components by dependency resolving. Usage:: >>> manager = Manager(("./manager/tests/tests_manager/resources/components/core",)) >>> manager.register_components() True >>> manager.lis...
['def', 'list_components', '(', 'self', ',', 'dependency_order', '=', 'True', ')', ':', 'if', 'dependency_order', ':', 'return', 'list', '(', 'itertools', '.', 'chain', '.', 'from_iterable', '(', '[', 'sorted', '(', 'list', '(', 'batch', ')', ')', 'for', 'batch', 'in', 'foundations', '.', 'common', '.', 'dependency_res...
Lists the Components by dependency resolving. Usage:: >>> manager = Manager(("./manager/tests/tests_manager/resources/components/core",)) >>> manager.register_components() True >>> manager.list_components() [u'core.tests_component_a', u'core.tests_co...
['Lists', 'the', 'Components', 'by', 'dependency', 'resolving', '.']
train
https://github.com/KelSolaar/Manager/blob/39c8153fc021fc8a76e345a6e336ec2644f089d1/manager/components_manager.py#L1217-L1238
506
twisted/txaws
txaws/wsdl.py
SequenceSchema.create
def create(self, root=None, namespace=None): """Create a sequence element with the given root. @param root: The C{etree.Element} to root the sequence at, if C{None} a new one will be created.. @result: A L{SequenceItem} with the given root. @raises L{ECResponseError}: If the...
python
def create(self, root=None, namespace=None): """Create a sequence element with the given root. @param root: The C{etree.Element} to root the sequence at, if C{None} a new one will be created.. @result: A L{SequenceItem} with the given root. @raises L{ECResponseError}: If the...
['def', 'create', '(', 'self', ',', 'root', '=', 'None', ',', 'namespace', '=', 'None', ')', ':', 'if', 'root', 'is', 'not', 'None', ':', 'tag', '=', 'root', '.', 'tag', 'if', 'root', '.', 'nsmap', ':', 'namespace', '=', 'root', '.', 'nsmap', '[', 'None', ']', 'tag', '=', 'tag', '[', 'len', '(', 'namespace', ')', '+', ...
Create a sequence element with the given root. @param root: The C{etree.Element} to root the sequence at, if C{None} a new one will be created.. @result: A L{SequenceItem} with the given root. @raises L{ECResponseError}: If the given C{root} has a bad tag.
['Create', 'a', 'sequence', 'element', 'with', 'the', 'given', 'root', '.']
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/wsdl.py#L316-L332
507
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/module.py
_ModuleContainer.split_label_fuzzy
def split_label_fuzzy(self, label): """ Splits a label entered as user input. It's more flexible in it's syntax parsing than the L{split_label_strict} method, as it allows the exclamation mark (B{C{!}}) to be omitted. The ambiguity is resolved by searching the modules in the sna...
python
def split_label_fuzzy(self, label): """ Splits a label entered as user input. It's more flexible in it's syntax parsing than the L{split_label_strict} method, as it allows the exclamation mark (B{C{!}}) to be omitted. The ambiguity is resolved by searching the modules in the sna...
['def', 'split_label_fuzzy', '(', 'self', ',', 'label', ')', ':', 'module', '=', 'function', '=', 'None', 'offset', '=', '0', '# Special case: None', 'if', 'not', 'label', ':', 'label', '=', 'compat', '.', 'b', '(', '"0x0"', ')', 'else', ':', '# Remove all blanks.', 'label', '=', 'label', '.', 'replace', '(', 'compat',...
Splits a label entered as user input. It's more flexible in it's syntax parsing than the L{split_label_strict} method, as it allows the exclamation mark (B{C{!}}) to be omitted. The ambiguity is resolved by searching the modules in the snapshot to guess if a label refers to a module or ...
['Splits', 'a', 'label', 'entered', 'as', 'user', 'input', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/module.py#L1317-L1450
508
odlgroup/odl
odl/ufunc_ops/ufunc_ops.py
find_min_signature
def find_min_signature(ufunc, dtypes_in): """Determine the minimum matching ufunc signature for given dtypes. Parameters ---------- ufunc : str or numpy.ufunc Ufunc whose signatures are to be considered. dtypes_in : Sequence of objects specifying input dtypes. Its length must match ...
python
def find_min_signature(ufunc, dtypes_in): """Determine the minimum matching ufunc signature for given dtypes. Parameters ---------- ufunc : str or numpy.ufunc Ufunc whose signatures are to be considered. dtypes_in : Sequence of objects specifying input dtypes. Its length must match ...
['def', 'find_min_signature', '(', 'ufunc', ',', 'dtypes_in', ')', ':', 'if', 'not', 'isinstance', '(', 'ufunc', ',', 'np', '.', 'ufunc', ')', ':', 'ufunc', '=', 'getattr', '(', 'np', ',', 'str', '(', 'ufunc', ')', ')', 'dtypes_in', '=', '[', 'np', '.', 'dtype', '(', 'dt_in', ')', 'for', 'dt_in', 'in', 'dtypes_in', ']'...
Determine the minimum matching ufunc signature for given dtypes. Parameters ---------- ufunc : str or numpy.ufunc Ufunc whose signatures are to be considered. dtypes_in : Sequence of objects specifying input dtypes. Its length must match the number of inputs of ``ufunc``, and it...
['Determine', 'the', 'minimum', 'matching', 'ufunc', 'signature', 'for', 'given', 'dtypes', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/ufunc_ops/ufunc_ops.py#L27-L77
509
knipknap/exscript
Exscript/util/mail.py
from_template_string
def from_template_string(string, **kwargs): """ Reads the given SMTP formatted template, and creates a new Mail object using the information. :type string: str :param string: The SMTP formatted template. :type kwargs: str :param kwargs: Variables to replace in the template. :rtype: M...
python
def from_template_string(string, **kwargs): """ Reads the given SMTP formatted template, and creates a new Mail object using the information. :type string: str :param string: The SMTP formatted template. :type kwargs: str :param kwargs: Variables to replace in the template. :rtype: M...
['def', 'from_template_string', '(', 'string', ',', '*', '*', 'kwargs', ')', ':', 'tmpl', '=', '_render_template', '(', 'string', ',', '*', '*', 'kwargs', ')', 'mail', '=', 'Mail', '(', ')', 'mail', '.', 'set_from_template_string', '(', 'tmpl', ')', 'return', 'mail']
Reads the given SMTP formatted template, and creates a new Mail object using the information. :type string: str :param string: The SMTP formatted template. :type kwargs: str :param kwargs: Variables to replace in the template. :rtype: Mail :return: The resulting mail.
['Reads', 'the', 'given', 'SMTP', 'formatted', 'template', 'and', 'creates', 'a', 'new', 'Mail', 'object', 'using', 'the', 'information', '.']
train
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/util/mail.py#L399-L414
510
inasafe/inasafe
safe/impact_function/provenance_utilities.py
get_multi_exposure_analysis_question
def get_multi_exposure_analysis_question(hazard, exposures): """Construct analysis question based on hazard and exposures. :param hazard: A hazard definition. :type hazard: dict :param exposure: A list of exposure definition. :type exposure: list :returns: Analysis question based on reporting...
python
def get_multi_exposure_analysis_question(hazard, exposures): """Construct analysis question based on hazard and exposures. :param hazard: A hazard definition. :type hazard: dict :param exposure: A list of exposure definition. :type exposure: list :returns: Analysis question based on reporting...
['def', 'get_multi_exposure_analysis_question', '(', 'hazard', ',', 'exposures', ')', ':', 'exposures_question', '=', "''", 'exposure_format', '=', "'{exposure_measure} {exposure_name}'", 'for', 'index', ',', 'exposure', 'in', 'enumerate', '(', 'exposures', ')', ':', 'if', 'index', '+', '1', '==', 'len', '(', 'exposure...
Construct analysis question based on hazard and exposures. :param hazard: A hazard definition. :type hazard: dict :param exposure: A list of exposure definition. :type exposure: list :returns: Analysis question based on reporting standards. :rtype: str
['Construct', 'analysis', 'question', 'based', 'on', 'hazard', 'and', 'exposures', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/provenance_utilities.py#L84-L120
511
wummel/linkchecker
third_party/dnspython/dns/tsig.py
get_algorithm
def get_algorithm(algorithm): """Returns the wire format string and the hash module to use for the specified TSIG algorithm @rtype: (string, hash constructor) @raises NotImplementedError: I{algorithm} is not supported """ global _hashes if _hashes is None: _setup_hashes() if i...
python
def get_algorithm(algorithm): """Returns the wire format string and the hash module to use for the specified TSIG algorithm @rtype: (string, hash constructor) @raises NotImplementedError: I{algorithm} is not supported """ global _hashes if _hashes is None: _setup_hashes() if i...
['def', 'get_algorithm', '(', 'algorithm', ')', ':', 'global', '_hashes', 'if', '_hashes', 'is', 'None', ':', '_setup_hashes', '(', ')', 'if', 'isinstance', '(', 'algorithm', ',', '(', 'str', ',', 'unicode', ')', ')', ':', 'algorithm', '=', 'dns', '.', 'name', '.', 'from_text', '(', 'algorithm', ')', 'if', 'sys', '.', ...
Returns the wire format string and the hash module to use for the specified TSIG algorithm @rtype: (string, hash constructor) @raises NotImplementedError: I{algorithm} is not supported
['Returns', 'the', 'wire', 'format', 'string', 'and', 'the', 'hash', 'module', 'to', 'use', 'for', 'the', 'specified', 'TSIG', 'algorithm']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/tsig.py#L199-L223
512
gem/oq-engine
openquake/baselib/datastore.py
extract_calc_id_datadir
def extract_calc_id_datadir(filename, datadir=None): """ Extract the calculation ID from the given filename or integer: >>> extract_calc_id_datadir('/mnt/ssd/oqdata/calc_25.hdf5') (25, '/mnt/ssd/oqdata') >>> extract_calc_id_datadir('/mnt/ssd/oqdata/wrong_name.hdf5') Traceback (most recent call ...
python
def extract_calc_id_datadir(filename, datadir=None): """ Extract the calculation ID from the given filename or integer: >>> extract_calc_id_datadir('/mnt/ssd/oqdata/calc_25.hdf5') (25, '/mnt/ssd/oqdata') >>> extract_calc_id_datadir('/mnt/ssd/oqdata/wrong_name.hdf5') Traceback (most recent call ...
['def', 'extract_calc_id_datadir', '(', 'filename', ',', 'datadir', '=', 'None', ')', ':', 'datadir', '=', 'datadir', 'or', 'get_datadir', '(', ')', 'try', ':', 'calc_id', '=', 'int', '(', 'filename', ')', 'except', 'ValueError', ':', 'filename', '=', 'os', '.', 'path', '.', 'abspath', '(', 'filename', ')', 'datadir', ...
Extract the calculation ID from the given filename or integer: >>> extract_calc_id_datadir('/mnt/ssd/oqdata/calc_25.hdf5') (25, '/mnt/ssd/oqdata') >>> extract_calc_id_datadir('/mnt/ssd/oqdata/wrong_name.hdf5') Traceback (most recent call last): ... ValueError: Cannot extract calc_id from /mn...
['Extract', 'the', 'calculation', 'ID', 'from', 'the', 'given', 'filename', 'or', 'integer', ':']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/datastore.py#L87-L108
513
gwastro/pycbc
pycbc/workflow/configuration.py
WorkflowConfigParser.perform_exe_expansion
def perform_exe_expansion(self): """ This function will look through the executables section of the ConfigParser object and replace any values using macros with full paths. For any values that look like ${which:lalapps_tmpltbank} will be replaced with the equivalent of...
python
def perform_exe_expansion(self): """ This function will look through the executables section of the ConfigParser object and replace any values using macros with full paths. For any values that look like ${which:lalapps_tmpltbank} will be replaced with the equivalent of...
['def', 'perform_exe_expansion', '(', 'self', ')', ':', '# Only works on executables section', 'if', 'self', '.', 'has_section', '(', "'executables'", ')', ':', 'for', 'option', ',', 'value', 'in', 'self', '.', 'items', '(', "'executables'", ')', ':', '# Check the value', 'newStr', '=', 'self', '.', 'interpolate_exe', ...
This function will look through the executables section of the ConfigParser object and replace any values using macros with full paths. For any values that look like ${which:lalapps_tmpltbank} will be replaced with the equivalent of which(lalapps_tmpltbank) Otherwise values w...
['This', 'function', 'will', 'look', 'through', 'the', 'executables', 'section', 'of', 'the', 'ConfigParser', 'object', 'and', 'replace', 'any', 'values', 'using', 'macros', 'with', 'full', 'paths', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/configuration.py#L520-L539
514
miguelgrinberg/slam
slam/cli.py
on_unexpected_error
def on_unexpected_error(e): # pragma: no cover """Catch-all error handler Unexpected errors will be handled by this function. """ sys.stderr.write('Unexpected error: {} ({})\n'.format( str(e), e.__class__.__name__)) sys.stderr.write('See file slam_error.log for additional details.\n') ...
python
def on_unexpected_error(e): # pragma: no cover """Catch-all error handler Unexpected errors will be handled by this function. """ sys.stderr.write('Unexpected error: {} ({})\n'.format( str(e), e.__class__.__name__)) sys.stderr.write('See file slam_error.log for additional details.\n') ...
['def', 'on_unexpected_error', '(', 'e', ')', ':', '# pragma: no cover', 'sys', '.', 'stderr', '.', 'write', '(', "'Unexpected error: {} ({})\\n'", '.', 'format', '(', 'str', '(', 'e', ')', ',', 'e', '.', '__class__', '.', '__name__', ')', ')', 'sys', '.', 'stderr', '.', 'write', '(', "'See file slam_error.log for addi...
Catch-all error handler Unexpected errors will be handled by this function.
['Catch', '-', 'all', 'error', 'handler']
train
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L60-L68
515
maartenbreddels/ipyvolume
ipyvolume/pylab.py
figure
def figure( key=None, width=400, height=500, lighting=True, controls=True, controls_vr=False, controls_light=False, debug=False, **kwargs ): """Create a new figure if no key is given, or return the figure associated with key. :param key: Python object that identifies this fi...
python
def figure( key=None, width=400, height=500, lighting=True, controls=True, controls_vr=False, controls_light=False, debug=False, **kwargs ): """Create a new figure if no key is given, or return the figure associated with key. :param key: Python object that identifies this fi...
['def', 'figure', '(', 'key', '=', 'None', ',', 'width', '=', '400', ',', 'height', '=', '500', ',', 'lighting', '=', 'True', ',', 'controls', '=', 'True', ',', 'controls_vr', '=', 'False', ',', 'controls_light', '=', 'False', ',', 'debug', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'if', 'key', 'is', 'not', 'Non...
Create a new figure if no key is given, or return the figure associated with key. :param key: Python object that identifies this figure :param int width: pixel width of WebGL canvas :param int height: .. height .. :param bool lighting: use lighting or not :param bool controls: show controls or not...
['Create', 'a', 'new', 'figure', 'if', 'no', 'key', 'is', 'given', 'or', 'return', 'the', 'figure', 'associated', 'with', 'key', '.']
train
https://github.com/maartenbreddels/ipyvolume/blob/e68b72852b61276f8e6793bc8811f5b2432a155f/ipyvolume/pylab.py#L168-L222
516
wummel/linkchecker
third_party/dnspython/dns/tokenizer.py
Tokenizer.get_string
def get_string(self, origin=None): """Read the next token and interpret it as a string. @raises dns.exception.SyntaxError: @rtype: string """ token = self.get().unescape() if not (token.is_identifier() or token.is_quoted_string()): raise dns.exception.Syntax...
python
def get_string(self, origin=None): """Read the next token and interpret it as a string. @raises dns.exception.SyntaxError: @rtype: string """ token = self.get().unescape() if not (token.is_identifier() or token.is_quoted_string()): raise dns.exception.Syntax...
['def', 'get_string', '(', 'self', ',', 'origin', '=', 'None', ')', ':', 'token', '=', 'self', '.', 'get', '(', ')', '.', 'unescape', '(', ')', 'if', 'not', '(', 'token', '.', 'is_identifier', '(', ')', 'or', 'token', '.', 'is_quoted_string', '(', ')', ')', ':', 'raise', 'dns', '.', 'exception', '.', 'SyntaxError', '('...
Read the next token and interpret it as a string. @raises dns.exception.SyntaxError: @rtype: string
['Read', 'the', 'next', 'token', 'and', 'interpret', 'it', 'as', 'a', 'string', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/tokenizer.py#L498-L508
517
saltstack/salt
salt/modules/pw_user.py
info
def info(name): ''' Return user information CLI Example: .. code-block:: bash salt '*' user.info root ''' ret = {} try: data = pwd.getpwnam(name) ret['gid'] = data.pw_gid ret['groups'] = list_groups(name) ret['home'] = data.pw_dir ret['name'...
python
def info(name): ''' Return user information CLI Example: .. code-block:: bash salt '*' user.info root ''' ret = {} try: data = pwd.getpwnam(name) ret['gid'] = data.pw_gid ret['groups'] = list_groups(name) ret['home'] = data.pw_dir ret['name'...
['def', 'info', '(', 'name', ')', ':', 'ret', '=', '{', '}', 'try', ':', 'data', '=', 'pwd', '.', 'getpwnam', '(', 'name', ')', 'ret', '[', "'gid'", ']', '=', 'data', '.', 'pw_gid', 'ret', '[', "'groups'", ']', '=', 'list_groups', '(', 'name', ')', 'ret', '[', "'home'", ']', '=', 'data', '.', 'pw_dir', 'ret', '[', "'na...
Return user information CLI Example: .. code-block:: bash salt '*' user.info root
['Return', 'user', 'information']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L428-L459
518
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
ScriptRetriever._DownloadAuthUrl
def _DownloadAuthUrl(self, url, dest_dir): """Download a Google Storage URL using an authentication token. If the token cannot be fetched, fallback to unauthenticated download. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. ...
python
def _DownloadAuthUrl(self, url, dest_dir): """Download a Google Storage URL using an authentication token. If the token cannot be fetched, fallback to unauthenticated download. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. ...
['def', '_DownloadAuthUrl', '(', 'self', ',', 'url', ',', 'dest_dir', ')', ':', 'dest_file', '=', 'tempfile', '.', 'NamedTemporaryFile', '(', 'dir', '=', 'dest_dir', ',', 'delete', '=', 'False', ')', 'dest_file', '.', 'close', '(', ')', 'dest', '=', 'dest_file', '.', 'name', 'self', '.', 'logger', '.', 'info', '(', "'D...
Download a Google Storage URL using an authentication token. If the token cannot be fetched, fallback to unauthenticated download. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storin...
['Download', 'a', 'Google', 'Storage', 'URL', 'using', 'an', 'authentication', 'token', '.']
train
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L48-L92
519
Metatab/metapack
metapack/cli/metaaws.py
get_iam_account
def get_iam_account(l, args, user_name): """Return the local Account for a user name, by fetching User and looking up the arn. """ iam = get_resource(args, 'iam') user = iam.User(user_name) user.load() return l.find_or_new_account(user.arn)
python
def get_iam_account(l, args, user_name): """Return the local Account for a user name, by fetching User and looking up the arn. """ iam = get_resource(args, 'iam') user = iam.User(user_name) user.load() return l.find_or_new_account(user.arn)
['def', 'get_iam_account', '(', 'l', ',', 'args', ',', 'user_name', ')', ':', 'iam', '=', 'get_resource', '(', 'args', ',', "'iam'", ')', 'user', '=', 'iam', '.', 'User', '(', 'user_name', ')', 'user', '.', 'load', '(', ')', 'return', 'l', '.', 'find_or_new_account', '(', 'user', '.', 'arn', ')']
Return the local Account for a user name, by fetching User and looking up the arn.
['Return', 'the', 'local', 'Account', 'for', 'a', 'user', 'name', 'by', 'fetching', 'User', 'and', 'looking', 'up', 'the', 'arn', '.']
train
https://github.com/Metatab/metapack/blob/8365f221fbeaa3c0be9091f2eaf3447fd8e2e8d6/metapack/cli/metaaws.py#L540-L548
520
codelv/enaml-native-barcode
src/zxing/android/android_barcode.py
IntentIntegrator.scan
def scan(cls, formats=ALL_CODE_TYPES, camera=-1): """ Shortcut only one at a time will work... """ app = AndroidApplication.instance() r = app.create_future() #: Initiate a scan pkg = BarcodePackage.instance() pkg.setBarcodeResultListener(pkg.getId()) pkg.onB...
python
def scan(cls, formats=ALL_CODE_TYPES, camera=-1): """ Shortcut only one at a time will work... """ app = AndroidApplication.instance() r = app.create_future() #: Initiate a scan pkg = BarcodePackage.instance() pkg.setBarcodeResultListener(pkg.getId()) pkg.onB...
['def', 'scan', '(', 'cls', ',', 'formats', '=', 'ALL_CODE_TYPES', ',', 'camera', '=', '-', '1', ')', ':', 'app', '=', 'AndroidApplication', '.', 'instance', '(', ')', 'r', '=', 'app', '.', 'create_future', '(', ')', '#: Initiate a scan', 'pkg', '=', 'BarcodePackage', '.', 'instance', '(', ')', 'pkg', '.', 'setBarcodeR...
Shortcut only one at a time will work...
['Shortcut', 'only', 'one', 'at', 'a', 'time', 'will', 'work', '...']
train
https://github.com/codelv/enaml-native-barcode/blob/dc3c4b41980c0f93d7fa828f48a751ae26daf297/src/zxing/android/android_barcode.py#L66-L83
521
Cognexa/cxflow
cxflow/utils/reflection.py
list_submodules
def list_submodules(module_name: str) -> List[str]: # pylint: disable=invalid-sequence-index """ List full names of all the submodules in the given module. :param module_name: name of the module of which the submodules will be listed """ _module = importlib.import_module(module_name) return [...
python
def list_submodules(module_name: str) -> List[str]: # pylint: disable=invalid-sequence-index """ List full names of all the submodules in the given module. :param module_name: name of the module of which the submodules will be listed """ _module = importlib.import_module(module_name) return [...
['def', 'list_submodules', '(', 'module_name', ':', 'str', ')', '->', 'List', '[', 'str', ']', ':', '# pylint: disable=invalid-sequence-index', '_module', '=', 'importlib', '.', 'import_module', '(', 'module_name', ')', 'return', '[', 'module_name', '+', "'.'", '+', 'submodule_name', 'for', '_', ',', 'submodule_name', ...
List full names of all the submodules in the given module. :param module_name: name of the module of which the submodules will be listed
['List', 'full', 'names', 'of', 'all', 'the', 'submodules', 'in', 'the', 'given', 'module', '.']
train
https://github.com/Cognexa/cxflow/blob/dd609e6b0bd854424a8f86781dd77801a13038f9/cxflow/utils/reflection.py#L64-L71
522
novopl/peltak
src/peltak/extra/gitflow/logic/common.py
get_base_branch
def get_base_branch(): # type: () -> str """ Return the base branch for the current branch. This function will first try to guess the base branch and if it can't it will let the user choose the branch from the list of all local branches. Returns: str: The name of the branch the current bra...
python
def get_base_branch(): # type: () -> str """ Return the base branch for the current branch. This function will first try to guess the base branch and if it can't it will let the user choose the branch from the list of all local branches. Returns: str: The name of the branch the current bra...
['def', 'get_base_branch', '(', ')', ':', '# type: () -> str', 'base_branch', '=', 'git', '.', 'guess_base_branch', '(', ')', 'if', 'base_branch', 'is', 'None', ':', 'log', '.', 'info', '(', '"Can\'t guess the base branch, you have to pick one yourself:"', ')', 'base_branch', '=', 'choose_branch', '(', ')', 'return', '...
Return the base branch for the current branch. This function will first try to guess the base branch and if it can't it will let the user choose the branch from the list of all local branches. Returns: str: The name of the branch the current branch is based on.
['Return', 'the', 'base', 'branch', 'for', 'the', 'current', 'branch', '.']
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/common.py#L178-L194
523
wummel/linkchecker
linkcheck/configuration/confparse.py
LCConfigParser.read
def read (self, files): """Read settings from given config files. @raises: LinkCheckerError on syntax errors in the config file(s) """ assert isinstance(files, list), "Invalid file list %r" % files try: self.read_ok = super(LCConfigParser, self).read(files) ...
python
def read (self, files): """Read settings from given config files. @raises: LinkCheckerError on syntax errors in the config file(s) """ assert isinstance(files, list), "Invalid file list %r" % files try: self.read_ok = super(LCConfigParser, self).read(files) ...
['def', 'read', '(', 'self', ',', 'files', ')', ':', 'assert', 'isinstance', '(', 'files', ',', 'list', ')', ',', '"Invalid file list %r"', '%', 'files', 'try', ':', 'self', '.', 'read_ok', '=', 'super', '(', 'LCConfigParser', ',', 'self', ')', '.', 'read', '(', 'files', ')', 'if', 'len', '(', 'self', '.', 'read_ok', '...
Read settings from given config files. @raises: LinkCheckerError on syntax errors in the config file(s)
['Read', 'settings', 'from', 'given', 'config', 'files', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/configuration/confparse.py#L43-L62
524
gem/oq-engine
openquake/calculators/ucerf_base.py
get_rupture_surface
def get_rupture_surface(mag, nodal_plane, hypocenter, msr, rupture_aspect_ratio, upper_seismogenic_depth, lower_seismogenic_depth, mesh_spacing=1.0): """ Create and return rupture surface object with given properties. :param mag: Magnitude value, used...
python
def get_rupture_surface(mag, nodal_plane, hypocenter, msr, rupture_aspect_ratio, upper_seismogenic_depth, lower_seismogenic_depth, mesh_spacing=1.0): """ Create and return rupture surface object with given properties. :param mag: Magnitude value, used...
['def', 'get_rupture_surface', '(', 'mag', ',', 'nodal_plane', ',', 'hypocenter', ',', 'msr', ',', 'rupture_aspect_ratio', ',', 'upper_seismogenic_depth', ',', 'lower_seismogenic_depth', ',', 'mesh_spacing', '=', '1.0', ')', ':', 'assert', '(', 'upper_seismogenic_depth', '<=', 'hypocenter', '.', 'depth', 'and', 'lower_...
Create and return rupture surface object with given properties. :param mag: Magnitude value, used to calculate rupture dimensions, see :meth:`_get_rupture_dimensions`. :param nodal_plane: Instance of :class:`openquake.hazardlib.geo.nodalplane.NodalPlane` describing the rupture o...
['Create', 'and', 'return', 'rupture', 'surface', 'object', 'with', 'given', 'properties', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/ucerf_base.py#L492-L593
525
Yelp/detect-secrets
detect_secrets/core/secrets_collection.py
SecretsCollection.json
def json(self): """Custom JSON encoder""" output = {} for filename in self.data: output[filename] = [] for secret_hash in self.data[filename]: tmp = self.data[filename][secret_hash].json() del tmp['filename'] # Because filename will map t...
python
def json(self): """Custom JSON encoder""" output = {} for filename in self.data: output[filename] = [] for secret_hash in self.data[filename]: tmp = self.data[filename][secret_hash].json() del tmp['filename'] # Because filename will map t...
['def', 'json', '(', 'self', ')', ':', 'output', '=', '{', '}', 'for', 'filename', 'in', 'self', '.', 'data', ':', 'output', '[', 'filename', ']', '=', '[', ']', 'for', 'secret_hash', 'in', 'self', '.', 'data', '[', 'filename', ']', ':', 'tmp', '=', 'self', '.', 'data', '[', 'filename', ']', '[', 'secret_hash', ']', '....
Custom JSON encoder
['Custom', 'JSON', 'encoder']
train
https://github.com/Yelp/detect-secrets/blob/473923ea71f1ac2b5ea1eacc49b98f97967e3d05/detect_secrets/core/secrets_collection.py#L336-L348
526
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
DirView.setup
def setup(self, name_filters=['*.py', '*.pyw'], show_all=False, single_click_to_open=False): """Setup tree widget""" self.setup_view() self.set_name_filters(name_filters) self.show_all = show_all self.single_click_to_open = single_click_to_open ...
python
def setup(self, name_filters=['*.py', '*.pyw'], show_all=False, single_click_to_open=False): """Setup tree widget""" self.setup_view() self.set_name_filters(name_filters) self.show_all = show_all self.single_click_to_open = single_click_to_open ...
['def', 'setup', '(', 'self', ',', 'name_filters', '=', '[', "'*.py'", ',', "'*.pyw'", ']', ',', 'show_all', '=', 'False', ',', 'single_click_to_open', '=', 'False', ')', ':', 'self', '.', 'setup_view', '(', ')', 'self', '.', 'set_name_filters', '(', 'name_filters', ')', 'self', '.', 'show_all', '=', 'show_all', 'self'...
Setup tree widget
['Setup', 'tree', 'widget']
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L238-L249
527
caesar0301/relogger
relogger/syslog.py
HEADER.timestamp
def timestamp(self, value): """ The local time when the message was written. Must follow the format 'Mmm DD HH:MM:SS'. If the day of the month is less than 10, then it MUST be represented as a space and then the number. """ if not self._timestamp_is_val...
python
def timestamp(self, value): """ The local time when the message was written. Must follow the format 'Mmm DD HH:MM:SS'. If the day of the month is less than 10, then it MUST be represented as a space and then the number. """ if not self._timestamp_is_val...
['def', 'timestamp', '(', 'self', ',', 'value', ')', ':', 'if', 'not', 'self', '.', '_timestamp_is_valid', '(', 'value', ')', ':', 'value', '=', 'self', '.', '_calculate_current_timestamp', '(', ')', 'self', '.', '_timestamp', '=', 'value']
The local time when the message was written. Must follow the format 'Mmm DD HH:MM:SS'. If the day of the month is less than 10, then it MUST be represented as a space and then the number.
['The', 'local', 'time', 'when', 'the', 'message', 'was', 'written', '.']
train
https://github.com/caesar0301/relogger/blob/40b722ad2115ac6a179e2cc4eb0c88333f5114de/relogger/syslog.py#L118-L130
528
ArchiveTeam/wpull
wpull/writer.py
BaseFileWriterSession._process_file_continue_request
def _process_file_continue_request(self, request: BaseRequest): '''Modify the request to resume downloading file.''' if os.path.exists(self._filename): size = os.path.getsize(self._filename) request.set_continue(size) self._file_continue_requested = True ...
python
def _process_file_continue_request(self, request: BaseRequest): '''Modify the request to resume downloading file.''' if os.path.exists(self._filename): size = os.path.getsize(self._filename) request.set_continue(size) self._file_continue_requested = True ...
['def', '_process_file_continue_request', '(', 'self', ',', 'request', ':', 'BaseRequest', ')', ':', 'if', 'os', '.', 'path', '.', 'exists', '(', 'self', '.', '_filename', ')', ':', 'size', '=', 'os', '.', 'path', '.', 'getsize', '(', 'self', '.', '_filename', ')', 'request', '.', 'set_continue', '(', 'size', ')', 'sel...
Modify the request to resume downloading file.
['Modify', 'the', 'request', 'to', 'resume', 'downloading', 'file', '.']
train
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/writer.py#L189-L198
529
DerMitch/fritzbox-smarthome
fritzhome/actor.py
Actor.get_target_temperature
def get_target_temperature(self): """ Returns the actual target temperature. Attention: Returns None if the value can't be queried or is unknown. """ value = self.box.homeautoswitch("gethkrtsoll", self.actor_id) self.target_temperature = self.__get_temp(value) ret...
python
def get_target_temperature(self): """ Returns the actual target temperature. Attention: Returns None if the value can't be queried or is unknown. """ value = self.box.homeautoswitch("gethkrtsoll", self.actor_id) self.target_temperature = self.__get_temp(value) ret...
['def', 'get_target_temperature', '(', 'self', ')', ':', 'value', '=', 'self', '.', 'box', '.', 'homeautoswitch', '(', '"gethkrtsoll"', ',', 'self', '.', 'actor_id', ')', 'self', '.', 'target_temperature', '=', 'self', '.', '__get_temp', '(', 'value', ')', 'return', 'self', '.', 'target_temperature']
Returns the actual target temperature. Attention: Returns None if the value can't be queried or is unknown.
['Returns', 'the', 'actual', 'target', 'temperature', '.', 'Attention', ':', 'Returns', 'None', 'if', 'the', 'value', 'can', 't', 'be', 'queried', 'or', 'is', 'unknown', '.']
train
https://github.com/DerMitch/fritzbox-smarthome/blob/84cbd7c1b33e6256add041b0395ff5fccc01f103/fritzhome/actor.py#L125-L132
530
OSSOS/MOP
src/ossos/core/ossos/mop_file.py
MOPFile.filename
def filename(self): """ Name if the MOP formatted file to parse. @rtype: basestring @return: filename """ if self._filename is None: self._filename = storage.get_file(self.basename, self.ccd, ...
python
def filename(self): """ Name if the MOP formatted file to parse. @rtype: basestring @return: filename """ if self._filename is None: self._filename = storage.get_file(self.basename, self.ccd, ...
['def', 'filename', '(', 'self', ')', ':', 'if', 'self', '.', '_filename', 'is', 'None', ':', 'self', '.', '_filename', '=', 'storage', '.', 'get_file', '(', 'self', '.', 'basename', ',', 'self', '.', 'ccd', ',', 'ext', '=', 'self', '.', 'extension', ',', 'version', '=', 'self', '.', 'type', ',', 'prefix', '=', 'self',...
Name if the MOP formatted file to parse. @rtype: basestring @return: filename
['Name', 'if', 'the', 'MOP', 'formatted', 'file', 'to', 'parse', '.']
train
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/mop_file.py#L28-L40
531
nerdvegas/rez
src/rez/utils/filesystem.py
safe_chmod
def safe_chmod(path, mode): """Set the permissions mode on path, but only if it differs from the current mode. """ if stat.S_IMODE(os.stat(path).st_mode) != mode: os.chmod(path, mode)
python
def safe_chmod(path, mode): """Set the permissions mode on path, but only if it differs from the current mode. """ if stat.S_IMODE(os.stat(path).st_mode) != mode: os.chmod(path, mode)
['def', 'safe_chmod', '(', 'path', ',', 'mode', ')', ':', 'if', 'stat', '.', 'S_IMODE', '(', 'os', '.', 'stat', '(', 'path', ')', '.', 'st_mode', ')', '!=', 'mode', ':', 'os', '.', 'chmod', '(', 'path', ',', 'mode', ')']
Set the permissions mode on path, but only if it differs from the current mode.
['Set', 'the', 'permissions', 'mode', 'on', 'path', 'but', 'only', 'if', 'it', 'differs', 'from', 'the', 'current', 'mode', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/utils/filesystem.py#L414-L418
532
google/fleetspeak
fleetspeak/src/server/grpcservice/client/client.py
OutgoingConnection._RetryLoop
def _RetryLoop(self, func, timeout=None): """Retries an operation until success or deadline. Args: func: The function to run. Must take a timeout, in seconds, as a single parameter. If it raises grpc.RpcError and deadline has not be reached, it will be run again. timeout: Retries ...
python
def _RetryLoop(self, func, timeout=None): """Retries an operation until success or deadline. Args: func: The function to run. Must take a timeout, in seconds, as a single parameter. If it raises grpc.RpcError and deadline has not be reached, it will be run again. timeout: Retries ...
['def', '_RetryLoop', '(', 'self', ',', 'func', ',', 'timeout', '=', 'None', ')', ':', 'timeout', '=', 'timeout', 'or', 'self', '.', 'DEFAULT_TIMEOUT', 'deadline', '=', 'time', '.', 'time', '(', ')', '+', 'timeout', 'sleep', '=', '1', 'while', 'True', ':', 'try', ':', 'return', 'func', '(', 'timeout', ')', 'except', 'g...
Retries an operation until success or deadline. Args: func: The function to run. Must take a timeout, in seconds, as a single parameter. If it raises grpc.RpcError and deadline has not be reached, it will be run again. timeout: Retries will continue until timeout seconds have passed.
['Retries', 'an', 'operation', 'until', 'success', 'or', 'deadline', '.']
train
https://github.com/google/fleetspeak/blob/bc95dd6941494461d2e5dff0a7f4c78a07ff724d/fleetspeak/src/server/grpcservice/client/client.py#L150-L172
533
astrocatalogs/astrocats
astrocats/catalog/spectrum.py
Spectrum._check
def _check(self): """Check that spectrum has legal combination of attributes.""" # Run the super method super(Spectrum, self)._check() err_str = None has_data = self._KEYS.DATA in self has_wave = self._KEYS.WAVELENGTHS in self has_flux = self._KEYS.FLUXES in self...
python
def _check(self): """Check that spectrum has legal combination of attributes.""" # Run the super method super(Spectrum, self)._check() err_str = None has_data = self._KEYS.DATA in self has_wave = self._KEYS.WAVELENGTHS in self has_flux = self._KEYS.FLUXES in self...
['def', '_check', '(', 'self', ')', ':', '# Run the super method', 'super', '(', 'Spectrum', ',', 'self', ')', '.', '_check', '(', ')', 'err_str', '=', 'None', 'has_data', '=', 'self', '.', '_KEYS', '.', 'DATA', 'in', 'self', 'has_wave', '=', 'self', '.', '_KEYS', '.', 'WAVELENGTHS', 'in', 'self', 'has_flux', '=', 'sel...
Check that spectrum has legal combination of attributes.
['Check', 'that', 'spectrum', 'has', 'legal', 'combination', 'of', 'attributes', '.']
train
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/spectrum.py#L112-L133
534
shichao-an/115wangpan
u115/api.py
File.reload
def reload(self): """ Reload file info and metadata * name * sha * pickcode """ res = self.api._req_file(self.fid) data = res['data'][0] self.name = data['file_name'] self.sha = data['sha1'] self.pickcode = data['pick_code']
python
def reload(self): """ Reload file info and metadata * name * sha * pickcode """ res = self.api._req_file(self.fid) data = res['data'][0] self.name = data['file_name'] self.sha = data['sha1'] self.pickcode = data['pick_code']
['def', 'reload', '(', 'self', ')', ':', 'res', '=', 'self', '.', 'api', '.', '_req_file', '(', 'self', '.', 'fid', ')', 'data', '=', 'res', '[', "'data'", ']', '[', '0', ']', 'self', '.', 'name', '=', 'data', '[', "'file_name'", ']', 'self', '.', 'sha', '=', 'data', '[', "'sha1'", ']', 'self', '.', 'pickcode', '=', 'd...
Reload file info and metadata * name * sha * pickcode
['Reload', 'file', 'info', 'and', 'metadata']
train
https://github.com/shichao-an/115wangpan/blob/e7cc935313f675e886bceca831fcffcdedf1e880/u115/api.py#L1302-L1315
535
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchyDesignSession.add_root_family
def add_root_family(self, family_id): """Adds a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: AlreadyExists - ``family_id`` is already in hierarchy raise: NotFound - ``family_id`` not found raise: NullArgument - ``family_id`` is ``null`` r...
python
def add_root_family(self, family_id): """Adds a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: AlreadyExists - ``family_id`` is already in hierarchy raise: NotFound - ``family_id`` not found raise: NullArgument - ``family_id`` is ``null`` r...
['def', 'add_root_family', '(', 'self', ',', 'family_id', ')', ':', '# Implemented from template for', '# osid.resource.BinHierarchyDesignSession.add_root_bin_template', 'if', 'self', '.', '_catalog_session', 'is', 'not', 'None', ':', 'return', 'self', '.', '_catalog_session', '.', 'add_root_catalog', '(', 'catalog_id'...
Adds a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: AlreadyExists - ``family_id`` is already in hierarchy raise: NotFound - ``family_id`` not found raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete reque...
['Adds', 'a', 'root', 'family', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2456-L2472
536
OCHA-DAP/hdx-python-api
src/hdx/data/hdxobject.py
HDXObject._read_from_hdx
def _read_from_hdx(self, object_type, value, fieldname='id', action=None, **kwargs): # type: (str, str, str, Optional[str], Any) -> Tuple[bool, Union[Dict, str]] """Makes a read call to HDX passing in given parameter. Args: object_type (str): Description of HD...
python
def _read_from_hdx(self, object_type, value, fieldname='id', action=None, **kwargs): # type: (str, str, str, Optional[str], Any) -> Tuple[bool, Union[Dict, str]] """Makes a read call to HDX passing in given parameter. Args: object_type (str): Description of HD...
['def', '_read_from_hdx', '(', 'self', ',', 'object_type', ',', 'value', ',', 'fieldname', '=', "'id'", ',', 'action', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', '# type: (str, str, str, Optional[str], Any) -> Tuple[bool, Union[Dict, str]]', 'if', 'not', 'fieldname', ':', 'raise', 'HDXError', '(', "'Empty %s field...
Makes a read call to HDX passing in given parameter. Args: object_type (str): Description of HDX object type (for messages) value (str): Value of HDX field fieldname (str): HDX field name. Defaults to id. action (Optional[str]): Replacement CKAN action url to use...
['Makes', 'a', 'read', 'call', 'to', 'HDX', 'passing', 'in', 'given', 'parameter', '.']
train
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/hdxobject.py#L95-L122
537
InQuest/python-sandboxapi
sandboxapi/fireeye.py
FireEyeAPI.analyze
def analyze(self, handle, filename): """Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File ID as a string """ ...
python
def analyze(self, handle, filename): """Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File ID as a string """ ...
['def', 'analyze', '(', 'self', ',', 'handle', ',', 'filename', ')', ':', '# multipart post files.', 'files', '=', '{', '"file"', ':', '(', 'filename', ',', 'handle', ')', '}', '# ensure the handle is at offset 0.', 'handle', '.', 'seek', '(', '0', ')', '# add submission options', 'data', '=', '{', '#FIXME: These may n...
Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File ID as a string
['Submit', 'a', 'file', 'for', 'analysis', '.']
train
https://github.com/InQuest/python-sandboxapi/blob/9bad73f453e25d7d23e7b4b1ae927f44a35a5bc3/sandboxapi/fireeye.py#L79-L114
538
limodou/uliweb
uliweb/core/dispatch.py
bind
def bind(topic, signal=None, kind=MIDDLE, nice=-1): """ This is a decorator function, so you should use it as: @bind('init') def process_init(a, b): ... """ def f(func): if not topic in _receivers: receivers = _receivers[topic] = [] ...
python
def bind(topic, signal=None, kind=MIDDLE, nice=-1): """ This is a decorator function, so you should use it as: @bind('init') def process_init(a, b): ... """ def f(func): if not topic in _receivers: receivers = _receivers[topic] = [] ...
['def', 'bind', '(', 'topic', ',', 'signal', '=', 'None', ',', 'kind', '=', 'MIDDLE', ',', 'nice', '=', '-', '1', ')', ':', 'def', 'f', '(', 'func', ')', ':', 'if', 'not', 'topic', 'in', '_receivers', ':', 'receivers', '=', '_receivers', '[', 'topic', ']', '=', '[', ']', 'else', ':', 'receivers', '=', '_receivers', '['...
This is a decorator function, so you should use it as: @bind('init') def process_init(a, b): ...
['This', 'is', 'a', 'decorator', 'function', 'so', 'you', 'should', 'use', 'it', 'as', ':']
train
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/core/dispatch.py#L20-L52
539
FNNDSC/med2image
med2image/error.py
fatal
def fatal( callingClass, astr_key, astr_extraMsg="" ): ''' Convenience dispatcher to the error_exit() method. Will raise "fatal" error, i.e. terminate script. ''' b_exitToOS = True report( callingClass, astr_key, b_exitToOS, astr_extraMsg )
python
def fatal( callingClass, astr_key, astr_extraMsg="" ): ''' Convenience dispatcher to the error_exit() method. Will raise "fatal" error, i.e. terminate script. ''' b_exitToOS = True report( callingClass, astr_key, b_exitToOS, astr_extraMsg )
['def', 'fatal', '(', 'callingClass', ',', 'astr_key', ',', 'astr_extraMsg', '=', '""', ')', ':', 'b_exitToOS', '=', 'True', 'report', '(', 'callingClass', ',', 'astr_key', ',', 'b_exitToOS', ',', 'astr_extraMsg', ')']
Convenience dispatcher to the error_exit() method. Will raise "fatal" error, i.e. terminate script.
['Convenience', 'dispatcher', 'to', 'the', 'error_exit', '()', 'method', '.']
train
https://github.com/FNNDSC/med2image/blob/638d5d230de47608af20f9764acf8e382c2bf2ff/med2image/error.py#L76-L83
540
insightindustry/validator-collection
validator_collection/checkers.py
are_equivalent
def are_equivalent(*args, **kwargs): """Indicate if arguments passed to this function are equivalent. .. hint:: This checker operates recursively on the members contained within iterables and :class:`dict <python:dict>` objects. .. caution:: If you only pass one argument to this checke...
python
def are_equivalent(*args, **kwargs): """Indicate if arguments passed to this function are equivalent. .. hint:: This checker operates recursively on the members contained within iterables and :class:`dict <python:dict>` objects. .. caution:: If you only pass one argument to this checke...
['def', 'are_equivalent', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'len', '(', 'args', ')', '==', '1', ':', 'return', 'True', 'first_item', '=', 'args', '[', '0', ']', 'for', 'item', 'in', 'args', '[', '1', ':', ']', ':', 'if', 'type', '(', 'item', ')', '!=', 'type', '(', 'first_item', ')', ':', '# py...
Indicate if arguments passed to this function are equivalent. .. hint:: This checker operates recursively on the members contained within iterables and :class:`dict <python:dict>` objects. .. caution:: If you only pass one argument to this checker - even if it is an iterable - the ch...
['Indicate', 'if', 'arguments', 'passed', 'to', 'this', 'function', 'are', 'equivalent', '.']
train
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/checkers.py#L89-L148
541
nicolargo/glances
glances/plugins/glances_sensors.py
GlancesGrabSensors.get
def get(self, sensor_type='temperature_core'): """Get sensors list.""" self.__update__() if sensor_type == 'temperature_core': ret = [s for s in self.sensors_list if s['unit'] == SENSOR_TEMP_UNIT] elif sensor_type == 'fan_speed': ret = [s for s in self.sensors_lis...
python
def get(self, sensor_type='temperature_core'): """Get sensors list.""" self.__update__() if sensor_type == 'temperature_core': ret = [s for s in self.sensors_list if s['unit'] == SENSOR_TEMP_UNIT] elif sensor_type == 'fan_speed': ret = [s for s in self.sensors_lis...
['def', 'get', '(', 'self', ',', 'sensor_type', '=', "'temperature_core'", ')', ':', 'self', '.', '__update__', '(', ')', 'if', 'sensor_type', '==', "'temperature_core'", ':', 'ret', '=', '[', 's', 'for', 's', 'in', 'self', '.', 'sensors_list', 'if', 's', '[', "'unit'", ']', '==', 'SENSOR_TEMP_UNIT', ']', 'elif', 'sens...
Get sensors list.
['Get', 'sensors', 'list', '.']
train
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_sensors.py#L311-L322
542
tuomas2/automate
src/automate/system.py
System.register_service
def register_service(self, service): """ Register service into the system. Called by Services. """ if service not in self.services: self.services.append(service)
python
def register_service(self, service): """ Register service into the system. Called by Services. """ if service not in self.services: self.services.append(service)
['def', 'register_service', '(', 'self', ',', 'service', ')', ':', 'if', 'service', 'not', 'in', 'self', '.', 'services', ':', 'self', '.', 'services', '.', 'append', '(', 'service', ')']
Register service into the system. Called by Services.
['Register', 'service', 'into', 'the', 'system', '.', 'Called', 'by', 'Services', '.']
train
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/system.py#L376-L381
543
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/Graph.py
Graph.get_hops
def get_hops(self, start, end=None, forward=True): """ Computes the hop distance to all nodes centered around a specified node. First order neighbours are at hop 1, their neigbours are at hop 2 etc. Uses :py:meth:`forw_bfs` or :py:meth:`back_bfs` depending on the value of the forward ...
python
def get_hops(self, start, end=None, forward=True): """ Computes the hop distance to all nodes centered around a specified node. First order neighbours are at hop 1, their neigbours are at hop 2 etc. Uses :py:meth:`forw_bfs` or :py:meth:`back_bfs` depending on the value of the forward ...
['def', 'get_hops', '(', 'self', ',', 'start', ',', 'end', '=', 'None', ',', 'forward', '=', 'True', ')', ':', 'if', 'forward', ':', 'return', 'list', '(', 'self', '.', '_iterbfs', '(', 'start', '=', 'start', ',', 'end', '=', 'end', ',', 'forward', '=', 'True', ')', ')', 'else', ':', 'return', 'list', '(', 'self', '.',...
Computes the hop distance to all nodes centered around a specified node. First order neighbours are at hop 1, their neigbours are at hop 2 etc. Uses :py:meth:`forw_bfs` or :py:meth:`back_bfs` depending on the value of the forward parameter. If the distance between all neighbouring nodes is 1 t...
['Computes', 'the', 'hop', 'distance', 'to', 'all', 'nodes', 'centered', 'around', 'a', 'specified', 'node', '.']
train
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/Graph.py#L647-L673
544
scnerd/miniutils
miniutils/progress_bar.py
iparallel_progbar
def iparallel_progbar(mapper, iterable, nprocs=None, starmap=False, flatmap=False, shuffle=False, verbose=True, verbose_flatmap=None, max_cache=-1, **kwargs): """Performs a parallel mapping of the given iterable, reporting a progress bar as values get returned. Yields objects as soon as th...
python
def iparallel_progbar(mapper, iterable, nprocs=None, starmap=False, flatmap=False, shuffle=False, verbose=True, verbose_flatmap=None, max_cache=-1, **kwargs): """Performs a parallel mapping of the given iterable, reporting a progress bar as values get returned. Yields objects as soon as th...
['def', 'iparallel_progbar', '(', 'mapper', ',', 'iterable', ',', 'nprocs', '=', 'None', ',', 'starmap', '=', 'False', ',', 'flatmap', '=', 'False', ',', 'shuffle', '=', 'False', ',', 'verbose', '=', 'True', ',', 'verbose_flatmap', '=', 'None', ',', 'max_cache', '=', '-', '1', ',', '*', '*', 'kwargs', ')', ':', 'result...
Performs a parallel mapping of the given iterable, reporting a progress bar as values get returned. Yields objects as soon as they're computed, but does not guarantee that they'll be in the correct order. :param mapper: The mapping function to apply to elements of the iterable :param iterable: The iterable...
['Performs', 'a', 'parallel', 'mapping', 'of', 'the', 'given', 'iterable', 'reporting', 'a', 'progress', 'bar', 'as', 'values', 'get', 'returned', '.', 'Yields', 'objects', 'as', 'soon', 'as', 'they', 're', 'computed', 'but', 'does', 'not', 'guarantee', 'that', 'they', 'll', 'be', 'in', 'the', 'correct', 'order', '.']
train
https://github.com/scnerd/miniutils/blob/fe927e26afc5877416dead28dabdf6604387f42c/miniutils/progress_bar.py#L144-L166
545
CivicSpleen/ckcache
ckcache/filesystem.py
FsLimitedCache.get
def get(self, rel_path, cb=None): '''Return the file path referenced but rel_path, or None if it can't be found. If an upstream is declared, it will try to get the file from the upstream before declaring failure. ''' import shutil global_logger.debug( "LC {} ...
python
def get(self, rel_path, cb=None): '''Return the file path referenced but rel_path, or None if it can't be found. If an upstream is declared, it will try to get the file from the upstream before declaring failure. ''' import shutil global_logger.debug( "LC {} ...
['def', 'get', '(', 'self', ',', 'rel_path', ',', 'cb', '=', 'None', ')', ':', 'import', 'shutil', 'global_logger', '.', 'debug', '(', '"LC {} get looking for {}"', '.', 'format', '(', 'self', '.', 'repo_id', ',', 'rel_path', ')', ')', 'path', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'cache_dir', ',', 're...
Return the file path referenced but rel_path, or None if it can't be found. If an upstream is declared, it will try to get the file from the upstream before declaring failure.
['Return', 'the', 'file', 'path', 'referenced', 'but', 'rel_path', 'or', 'None', 'if', 'it', 'can', 't', 'be', 'found', '.', 'If', 'an', 'upstream', 'is', 'declared', 'it', 'will', 'try', 'to', 'get', 'the', 'file', 'from', 'the', 'upstream', 'before', 'declaring', 'failure', '.']
train
https://github.com/CivicSpleen/ckcache/blob/0c699b6ba97ff164e9702504f0e1643dd4cd39e1/ckcache/filesystem.py#L597-L657
546
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
FabricBase.get_next_create_state
def get_next_create_state(self, state, ret): """Return the next create state from previous state. """ if ret: if state == fw_const.FABRIC_PREPARE_DONE_STATE: return state else: return state + 1 else: return state
python
def get_next_create_state(self, state, ret): """Return the next create state from previous state. """ if ret: if state == fw_const.FABRIC_PREPARE_DONE_STATE: return state else: return state + 1 else: return state
['def', 'get_next_create_state', '(', 'self', ',', 'state', ',', 'ret', ')', ':', 'if', 'ret', ':', 'if', 'state', '==', 'fw_const', '.', 'FABRIC_PREPARE_DONE_STATE', ':', 'return', 'state', 'else', ':', 'return', 'state', '+', '1', 'else', ':', 'return', 'state']
Return the next create state from previous state.
['Return', 'the', 'next', 'create', 'state', 'from', 'previous', 'state', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1463-L1471
547
metavee/batchproc
batchproc/core.py
BatchProcessor.load_tasks
def load_tasks(self, cmd, params, args): """implements loader interface, return (tasks, config)""" return generate_tasks('taskname that shows up in log', self._gen_tasks()), self.DOIT_CONFIG
python
def load_tasks(self, cmd, params, args): """implements loader interface, return (tasks, config)""" return generate_tasks('taskname that shows up in log', self._gen_tasks()), self.DOIT_CONFIG
['def', 'load_tasks', '(', 'self', ',', 'cmd', ',', 'params', ',', 'args', ')', ':', 'return', 'generate_tasks', '(', "'taskname that shows up in log'", ',', 'self', '.', '_gen_tasks', '(', ')', ')', ',', 'self', '.', 'DOIT_CONFIG']
implements loader interface, return (tasks, config)
['implements', 'loader', 'interface', 'return', '(', 'tasks', 'config', ')']
train
https://github.com/metavee/batchproc/blob/aa084a2ac8ab7950f7a7d3adb54b0cf010c6a935/batchproc/core.py#L100-L102
548
crytic/slither
slither/core/declarations/function.py
Function.functions_shadowed
def functions_shadowed(self): ''' Return the list of functions shadowed Returns: list(core.Function) ''' candidates = [c.functions_not_inherited for c in self.contract.inheritance] candidates = [candidate for sublist in candidates for candidate in sublist...
python
def functions_shadowed(self): ''' Return the list of functions shadowed Returns: list(core.Function) ''' candidates = [c.functions_not_inherited for c in self.contract.inheritance] candidates = [candidate for sublist in candidates for candidate in sublist...
['def', 'functions_shadowed', '(', 'self', ')', ':', 'candidates', '=', '[', 'c', '.', 'functions_not_inherited', 'for', 'c', 'in', 'self', '.', 'contract', '.', 'inheritance', ']', 'candidates', '=', '[', 'candidate', 'for', 'sublist', 'in', 'candidates', 'for', 'candidate', 'in', 'sublist', ']', 'return', '[', 'f', '...
Return the list of functions shadowed Returns: list(core.Function)
['Return', 'the', 'list', 'of', 'functions', 'shadowed', 'Returns', ':', 'list', '(', 'core', '.', 'Function', ')']
train
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/core/declarations/function.py#L553-L562
549
Kozea/pygal
pygal/graph/radar.py
Radar._set_view
def _set_view(self): """Assign a view to current graph""" if self.logarithmic: view_class = PolarLogView else: view_class = PolarView self.view = view_class( self.width - self.margin_box.x, self.height - self.margin_box.y, self._box ...
python
def _set_view(self): """Assign a view to current graph""" if self.logarithmic: view_class = PolarLogView else: view_class = PolarView self.view = view_class( self.width - self.margin_box.x, self.height - self.margin_box.y, self._box ...
['def', '_set_view', '(', 'self', ')', ':', 'if', 'self', '.', 'logarithmic', ':', 'view_class', '=', 'PolarLogView', 'else', ':', 'view_class', '=', 'PolarView', 'self', '.', 'view', '=', 'view_class', '(', 'self', '.', 'width', '-', 'self', '.', 'margin_box', '.', 'x', ',', 'self', '.', 'height', '-', 'self', '.', 'm...
Assign a view to current graph
['Assign', 'a', 'view', 'to', 'current', 'graph']
train
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/radar.py#L59-L69
550
MartinThoma/hwrt
hwrt/segmentation/segmentation.py
get_bb_intersections
def get_bb_intersections(recording): """ Get all intersections of the bounding boxes of strokes. Parameters ---------- recording : list of lists of integers Returns ------- A symmetrical matrix which indicates if two bounding boxes intersect. """ intersections = numpy.zeros((le...
python
def get_bb_intersections(recording): """ Get all intersections of the bounding boxes of strokes. Parameters ---------- recording : list of lists of integers Returns ------- A symmetrical matrix which indicates if two bounding boxes intersect. """ intersections = numpy.zeros((le...
['def', 'get_bb_intersections', '(', 'recording', ')', ':', 'intersections', '=', 'numpy', '.', 'zeros', '(', '(', 'len', '(', 'recording', ')', ',', 'len', '(', 'recording', ')', ')', ',', 'dtype', '=', 'bool', ')', 'for', 'i', 'in', 'range', '(', 'len', '(', 'recording', ')', '-', '1', ')', ':', 'a', '=', 'geometry',...
Get all intersections of the bounding boxes of strokes. Parameters ---------- recording : list of lists of integers Returns ------- A symmetrical matrix which indicates if two bounding boxes intersect.
['Get', 'all', 'intersections', 'of', 'the', 'bounding', 'boxes', 'of', 'strokes', '.']
train
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/segmentation/segmentation.py#L1006-L1026
551
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py
Entry.get_text_contents
def get_text_contents(self): """Fetch the decoded text contents of a Unicode encoded Entry. Since this should return the text contents from the file system, we check to see into what sort of subclass we should morph this Entry.""" try: self = self.disambiguate(must_e...
python
def get_text_contents(self): """Fetch the decoded text contents of a Unicode encoded Entry. Since this should return the text contents from the file system, we check to see into what sort of subclass we should morph this Entry.""" try: self = self.disambiguate(must_e...
['def', 'get_text_contents', '(', 'self', ')', ':', 'try', ':', 'self', '=', 'self', '.', 'disambiguate', '(', 'must_exist', '=', '1', ')', 'except', 'SCons', '.', 'Errors', '.', 'UserError', ':', '# There was nothing on disk with which to disambiguate', '# this entry. Leave it as an Entry, but return a null', '# stri...
Fetch the decoded text contents of a Unicode encoded Entry. Since this should return the text contents from the file system, we check to see into what sort of subclass we should morph this Entry.
['Fetch', 'the', 'decoded', 'text', 'contents', 'of', 'a', 'Unicode', 'encoded', 'Entry', '.']
train
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py#L989-L1005
552
mitsei/dlkit
dlkit/json_/repository/sessions.py
RepositoryQuerySession.get_repositories_by_query
def get_repositories_by_query(self, repository_query): """Gets a list of ``Repositories`` matching the given repository query. arg: repository_query (osid.repository.RepositoryQuery): the repository query return: (osid.repository.RepositoryList) - the returned ...
python
def get_repositories_by_query(self, repository_query): """Gets a list of ``Repositories`` matching the given repository query. arg: repository_query (osid.repository.RepositoryQuery): the repository query return: (osid.repository.RepositoryList) - the returned ...
['def', 'get_repositories_by_query', '(', 'self', ',', 'repository_query', ')', ':', '# Implemented from template for', '# osid.resource.BinQuerySession.get_bins_by_query_template', 'if', 'self', '.', '_catalog_session', 'is', 'not', 'None', ':', 'return', 'self', '.', '_catalog_session', '.', 'get_catalogs_by_query', ...
Gets a list of ``Repositories`` matching the given repository query. arg: repository_query (osid.repository.RepositoryQuery): the repository query return: (osid.repository.RepositoryList) - the returned ``RepositoryList`` raise: NullArgument - ``repository_qu...
['Gets', 'a', 'list', 'of', 'Repositories', 'matching', 'the', 'given', 'repository', 'query', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/sessions.py#L4903-L4928
553
RudolfCardinal/pythonlib
cardinal_pythonlib/modules.py
contains_c_extension
def contains_c_extension(module: ModuleType, import_all_submodules: bool = True, include_external_imports: bool = False, seen: List[ModuleType] = None) -> bool: """ Extends :func:`is_c_extension` by asking: is this module, or any of its ...
python
def contains_c_extension(module: ModuleType, import_all_submodules: bool = True, include_external_imports: bool = False, seen: List[ModuleType] = None) -> bool: """ Extends :func:`is_c_extension` by asking: is this module, or any of its ...
['def', 'contains_c_extension', '(', 'module', ':', 'ModuleType', ',', 'import_all_submodules', ':', 'bool', '=', 'True', ',', 'include_external_imports', ':', 'bool', '=', 'False', ',', 'seen', ':', 'List', '[', 'ModuleType', ']', '=', 'None', ')', '->', 'bool', ':', '# noqa', 'assert', 'inspect', '.', 'ismodule', '('...
Extends :func:`is_c_extension` by asking: is this module, or any of its submodules, a C extension? Args: module: Previously imported module object to be tested. import_all_submodules: explicitly import all submodules of this module? include_external_imports: check modules in other packa...
['Extends', ':', 'func', ':', 'is_c_extension', 'by', 'asking', ':', 'is', 'this', 'module', 'or', 'any', 'of', 'its', 'submodules', 'a', 'C', 'extension?']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/modules.py#L157-L308
554
trombastic/PyScada
pyscada/utils/scheduler.py
Scheduler.stop
def stop(self, sig=signal.SIGTERM): """ stop the scheduler and stop all processes """ if self.pid is None: self.pid = self.read_pid() if self.pid is None: sp = BackgroundProcess.objects.filter(pk=1).first() if sp: self.pid = sp...
python
def stop(self, sig=signal.SIGTERM): """ stop the scheduler and stop all processes """ if self.pid is None: self.pid = self.read_pid() if self.pid is None: sp = BackgroundProcess.objects.filter(pk=1).first() if sp: self.pid = sp...
['def', 'stop', '(', 'self', ',', 'sig', '=', 'signal', '.', 'SIGTERM', ')', ':', 'if', 'self', '.', 'pid', 'is', 'None', ':', 'self', '.', 'pid', '=', 'self', '.', 'read_pid', '(', ')', 'if', 'self', '.', 'pid', 'is', 'None', ':', 'sp', '=', 'BackgroundProcess', '.', 'objects', '.', 'filter', '(', 'pk', '=', '1', ')',...
stop the scheduler and stop all processes
['stop', 'the', 'scheduler', 'and', 'stop', 'all', 'processes']
train
https://github.com/trombastic/PyScada/blob/c5fc348a25f0df1340336f694ee9bc1aea62516a/pyscada/utils/scheduler.py#L443-L484
555
BerkeleyAutomation/perception
perception/image.py
ColorImage.foreground_mask
def foreground_mask( self, tolerance, ignore_black=True, use_hsv=False, scale=8, bgmodel=None): """Creates a binary image mask for the foreground of an image against a uniformly colored background. The background is assumed to be th...
python
def foreground_mask( self, tolerance, ignore_black=True, use_hsv=False, scale=8, bgmodel=None): """Creates a binary image mask for the foreground of an image against a uniformly colored background. The background is assumed to be th...
['def', 'foreground_mask', '(', 'self', ',', 'tolerance', ',', 'ignore_black', '=', 'True', ',', 'use_hsv', '=', 'False', ',', 'scale', '=', '8', ',', 'bgmodel', '=', 'None', ')', ':', '# get a background model', 'if', 'bgmodel', 'is', 'None', ':', 'bgmodel', '=', 'self', '.', 'background_model', '(', 'ignore_black', '...
Creates a binary image mask for the foreground of an image against a uniformly colored background. The background is assumed to be the mode value of the histogram for each of the color channels. Parameters ---------- tolerance : int A +/- level from the detected mean...
['Creates', 'a', 'binary', 'image', 'mask', 'for', 'the', 'foreground', 'of', 'an', 'image', 'against', 'a', 'uniformly', 'colored', 'background', '.', 'The', 'background', 'is', 'assumed', 'to', 'be', 'the', 'mode', 'value', 'of', 'the', 'histogram', 'for', 'each', 'of', 'the', 'color', 'channels', '.']
train
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L1147-L1205
556
GoogleCloudPlatform/appengine-pipelines
python/src/pipeline/pipeline.py
Pipeline._callback_internal
def _callback_internal(self, kwargs): """Used to execute callbacks on asynchronous pipelines.""" logging.debug('Callback %s(*%s, **%s)#%s with params: %r', self._class_path, _short_repr(self.args), _short_repr(self.kwargs), self._pipeline_key.name(), kwargs) return self.c...
python
def _callback_internal(self, kwargs): """Used to execute callbacks on asynchronous pipelines.""" logging.debug('Callback %s(*%s, **%s)#%s with params: %r', self._class_path, _short_repr(self.args), _short_repr(self.kwargs), self._pipeline_key.name(), kwargs) return self.c...
['def', '_callback_internal', '(', 'self', ',', 'kwargs', ')', ':', 'logging', '.', 'debug', '(', "'Callback %s(*%s, **%s)#%s with params: %r'", ',', 'self', '.', '_class_path', ',', '_short_repr', '(', 'self', '.', 'args', ')', ',', '_short_repr', '(', 'self', '.', 'kwargs', ')', ',', 'self', '.', '_pipeline_key', '.'...
Used to execute callbacks on asynchronous pipelines.
['Used', 'to', 'execute', 'callbacks', 'on', 'asynchronous', 'pipelines', '.']
train
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1091-L1096
557
totalgood/pugnlp
src/pugnlp/util.py
normalize_scientific_notation
def normalize_scientific_notation(s, ignore_commas=True, verbosity=1): """Produce a string convertable with float(s), if possible, fixing some common scientific notations Deletes commas and allows addition. >>> normalize_scientific_notation(' -123 x 10^-45 ') '-123e-45' >>> normalize_scientific_not...
python
def normalize_scientific_notation(s, ignore_commas=True, verbosity=1): """Produce a string convertable with float(s), if possible, fixing some common scientific notations Deletes commas and allows addition. >>> normalize_scientific_notation(' -123 x 10^-45 ') '-123e-45' >>> normalize_scientific_not...
['def', 'normalize_scientific_notation', '(', 's', ',', 'ignore_commas', '=', 'True', ',', 'verbosity', '=', '1', ')', ':', 's', '=', 's', '.', 'lstrip', '(', 'charlist', '.', 'not_digits_nor_sign', ')', 's', '=', 's', '.', 'rstrip', '(', 'charlist', '.', 'not_digits', ')', '# print s', '# TODO: substitute ** for ^ and...
Produce a string convertable with float(s), if possible, fixing some common scientific notations Deletes commas and allows addition. >>> normalize_scientific_notation(' -123 x 10^-45 ') '-123e-45' >>> normalize_scientific_notation(' -1+1,234 x 10^-5,678 ') '1233e-5678' >>> normalize_scientific_...
['Produce', 'a', 'string', 'convertable', 'with', 'float', '(', 's', ')', 'if', 'possible', 'fixing', 'some', 'common', 'scientific', 'notations']
train
https://github.com/totalgood/pugnlp/blob/c43445b14afddfdeadc5f3076675c9e8fc1ee67c/src/pugnlp/util.py#L1980-L2020
558
tallforasmurf/byteplay
byteplay3.py
Code._findlinestarts
def _findlinestarts(code_object): """ Find the offsets in a byte code which are the start of source lines. Generate pairs (offset, lineno) as described in Python/compile.c. This is a modified version of dis.findlinestarts. This version allows multiple "line starts" with the sam...
python
def _findlinestarts(code_object): """ Find the offsets in a byte code which are the start of source lines. Generate pairs (offset, lineno) as described in Python/compile.c. This is a modified version of dis.findlinestarts. This version allows multiple "line starts" with the sam...
['def', '_findlinestarts', '(', 'code_object', ')', ':', '# grab the even bytes as integer byte_increments:', 'byte_increments', '=', '[', 'c', 'for', 'c', 'in', 'code_object', '.', 'co_lnotab', '[', '0', ':', ':', '2', ']', ']', '# grab the odd bytes as integer line_increments:', 'line_increments', '=', '[', 'c', 'for...
Find the offsets in a byte code which are the start of source lines. Generate pairs (offset, lineno) as described in Python/compile.c. This is a modified version of dis.findlinestarts. This version allows multiple "line starts" with the same line number. (The dis version conditions its...
['Find', 'the', 'offsets', 'in', 'a', 'byte', 'code', 'which', 'are', 'the', 'start', 'of', 'source', 'lines', '.']
train
https://github.com/tallforasmurf/byteplay/blob/f6189df69dea763c83e857150244a8a89c082cc2/byteplay3.py#L808-L870
559
chovanecm/sacredboard
sacredboard/app/data/pymongo/rundao.py
MongoRunDAO._to_mongo_query
def _to_mongo_query(query): """ Convert the query received by the Sacred Web API to a MongoDB query. Takes a query in format {"type": "and", "filters": [ {"field": "host.hostname", "operator": "==", "value": "ntbacer"}, {"type": "or", "filters": [ {"field":...
python
def _to_mongo_query(query): """ Convert the query received by the Sacred Web API to a MongoDB query. Takes a query in format {"type": "and", "filters": [ {"field": "host.hostname", "operator": "==", "value": "ntbacer"}, {"type": "or", "filters": [ {"field":...
['def', '_to_mongo_query', '(', 'query', ')', ':', 'mongo_query', '=', '[', ']', 'for', 'clause', 'in', 'query', '[', '"filters"', ']', ':', 'if', 'clause', '.', 'get', '(', '"type"', ')', 'is', 'None', ':', 'mongo_clause', '=', 'MongoRunDAO', '.', '_simple_clause_to_query', '(', 'clause', ')', 'else', ':', "# It's a s...
Convert the query received by the Sacred Web API to a MongoDB query. Takes a query in format {"type": "and", "filters": [ {"field": "host.hostname", "operator": "==", "value": "ntbacer"}, {"type": "or", "filters": [ {"field": "result", "operator": "==", "value": 2403.52}, ...
['Convert', 'the', 'query', 'received', 'by', 'the', 'Sacred', 'Web', 'API', 'to', 'a', 'MongoDB', 'query', '.']
train
https://github.com/chovanecm/sacredboard/blob/47e1c99e3be3c1b099d3772bc077f5666020eb0b/sacredboard/app/data/pymongo/rundao.py#L114-L146
560
saltstack/salt
salt/modules/scp_mod.py
get
def get(remote_path, local_path='', recursive=False, preserve_times=False, **kwargs): ''' Transfer files and directories from remote host to the localhost of the Minion. remote_path Path to retrieve from remote host. Since this is evaluated by scp on the ...
python
def get(remote_path, local_path='', recursive=False, preserve_times=False, **kwargs): ''' Transfer files and directories from remote host to the localhost of the Minion. remote_path Path to retrieve from remote host. Since this is evaluated by scp on the ...
['def', 'get', '(', 'remote_path', ',', 'local_path', '=', "''", ',', 'recursive', '=', 'False', ',', 'preserve_times', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'scp_client', '=', '_prepare_connection', '(', '*', '*', 'kwargs', ')', 'get_kwargs', '=', '{', "'recursive'", ':', 'recursive', ',', "'preserve_times'...
Transfer files and directories from remote host to the localhost of the Minion. remote_path Path to retrieve from remote host. Since this is evaluated by scp on the remote host, shell wildcards and environment variables may be used. recursive: ``False`` Transfer files and directori...
['Transfer', 'files', 'and', 'directories', 'from', 'remote', 'host', 'to', 'the', 'localhost', 'of', 'the', 'Minion', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L69-L151
561
mwouts/jupytext
jupytext/languages.py
cell_language
def cell_language(source): """Return cell language and language options, if any""" if source: line = source[0] if line.startswith('%%'): magic = line[2:] if ' ' in magic: lang, magic_args = magic.split(' ', 1) else: lang = magic...
python
def cell_language(source): """Return cell language and language options, if any""" if source: line = source[0] if line.startswith('%%'): magic = line[2:] if ' ' in magic: lang, magic_args = magic.split(' ', 1) else: lang = magic...
['def', 'cell_language', '(', 'source', ')', ':', 'if', 'source', ':', 'line', '=', 'source', '[', '0', ']', 'if', 'line', '.', 'startswith', '(', "'%%'", ')', ':', 'magic', '=', 'line', '[', '2', ':', ']', 'if', "' '", 'in', 'magic', ':', 'lang', ',', 'magic_args', '=', 'magic', '.', 'split', '(', "' '", ',', '1', ')'...
Return cell language and language options, if any
['Return', 'cell', 'language', 'and', 'language', 'options', 'if', 'any']
train
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/languages.py#L68-L84
562
chimpler/pyhocon
pyhocon/converter.py
HOCONConverter.convert_from_file
def convert_from_file(cls, input_file=None, output_file=None, output_format='json', indent=2, compact=False): """Convert to json, properties or yaml :param input_file: input file, if not specified stdin :param output_file: output file, if not specified stdout :param output_format: json,...
python
def convert_from_file(cls, input_file=None, output_file=None, output_format='json', indent=2, compact=False): """Convert to json, properties or yaml :param input_file: input file, if not specified stdin :param output_file: output file, if not specified stdout :param output_format: json,...
['def', 'convert_from_file', '(', 'cls', ',', 'input_file', '=', 'None', ',', 'output_file', '=', 'None', ',', 'output_format', '=', "'json'", ',', 'indent', '=', '2', ',', 'compact', '=', 'False', ')', ':', 'if', 'input_file', 'is', 'None', ':', 'content', '=', 'sys', '.', 'stdin', '.', 'read', '(', ')', 'config', '='...
Convert to json, properties or yaml :param input_file: input file, if not specified stdin :param output_file: output file, if not specified stdout :param output_format: json, properties or yaml :return: json, properties or yaml string representation
['Convert', 'to', 'json', 'properties', 'or', 'yaml']
train
https://github.com/chimpler/pyhocon/blob/e5b22a8e74e8f88e43cf9e9140cca5f2cd0ab4a3/pyhocon/converter.py#L237-L257
563
thespacedoctor/polyglot
polyglot/markdown/translate.py
translate.definition
def definition( self, text, definition): """*genarate a MMD definition* **Key Arguments:** - ``text`` -- the text to define - ``definition`` -- the definition **Return:** - ``definition`` -- the MMD style definition ...
python
def definition( self, text, definition): """*genarate a MMD definition* **Key Arguments:** - ``text`` -- the text to define - ``definition`` -- the definition **Return:** - ``definition`` -- the MMD style definition ...
['def', 'definition', '(', 'self', ',', 'text', ',', 'definition', ')', ':', 'text', '=', 'text', '.', 'strip', '(', ')', 'definition', '=', 'definition', '.', 'strip', '(', ')', 'regex', '=', 're', '.', 'compile', '(', "r'\\n(\\S)'", ')', 'definition', '=', 'regex', '.', 'sub', '(', '"\\n \\g<1>"', ',', 'definition...
*genarate a MMD definition* **Key Arguments:** - ``text`` -- the text to define - ``definition`` -- the definition **Return:** - ``definition`` -- the MMD style definition **Usage:** To genarate a MMD definition: .. code-block:: py...
['*', 'genarate', 'a', 'MMD', 'definition', '*']
train
https://github.com/thespacedoctor/polyglot/blob/98038d746aa67e343b73b3ccee1e02d31dab81ec/polyglot/markdown/translate.py#L495-L531
564
frejanordsiek/hdf5storage
hdf5storage/__init__.py
find_thirdparty_marshaller_plugins
def find_thirdparty_marshaller_plugins(): """ Find, but don't load, all third party marshaller plugins. Third party marshaller plugins declare the entry point ``'hdf5storage.marshallers.plugins'`` with the name being the Marshaller API version and the target being a function that returns a ``tuple`...
python
def find_thirdparty_marshaller_plugins(): """ Find, but don't load, all third party marshaller plugins. Third party marshaller plugins declare the entry point ``'hdf5storage.marshallers.plugins'`` with the name being the Marshaller API version and the target being a function that returns a ``tuple`...
['def', 'find_thirdparty_marshaller_plugins', '(', ')', ':', 'all_plugins', '=', 'tuple', '(', 'pkg_resources', '.', 'iter_entry_points', '(', "'hdf5storage.marshallers.plugins'", ')', ')', 'return', '{', 'ver', ':', '{', 'p', '.', 'module_name', ':', 'p', 'for', 'p', 'in', 'all_plugins', 'if', 'p', '.', 'name', '==', ...
Find, but don't load, all third party marshaller plugins. Third party marshaller plugins declare the entry point ``'hdf5storage.marshallers.plugins'`` with the name being the Marshaller API version and the target being a function that returns a ``tuple`` or ``list`` of all the marshallers provided by t...
['Find', 'but', 'don', 't', 'load', 'all', 'third', 'party', 'marshaller', 'plugins', '.']
train
https://github.com/frejanordsiek/hdf5storage/blob/539275141dd3a4efbbbfd9bdb978f3ed59e3f05d/hdf5storage/__init__.py#L85-L115
565
wummel/linkchecker
linkcheck/logger/customxml.py
CustomXMLLogger.log_url
def log_url (self, url_data): """ Log URL data in custom XML format. """ self.xml_starttag(u'urldata') if self.has_part('url'): self.xml_tag(u"url", unicode(url_data.base_url)) if url_data.name and self.has_part('name'): self.xml_tag(u"name", unico...
python
def log_url (self, url_data): """ Log URL data in custom XML format. """ self.xml_starttag(u'urldata') if self.has_part('url'): self.xml_tag(u"url", unicode(url_data.base_url)) if url_data.name and self.has_part('name'): self.xml_tag(u"name", unico...
['def', 'log_url', '(', 'self', ',', 'url_data', ')', ':', 'self', '.', 'xml_starttag', '(', "u'urldata'", ')', 'if', 'self', '.', 'has_part', '(', "'url'", ')', ':', 'self', '.', 'xml_tag', '(', 'u"url"', ',', 'unicode', '(', 'url_data', '.', 'base_url', ')', ')', 'if', 'url_data', '.', 'name', 'and', 'self', '.', 'ha...
Log URL data in custom XML format.
['Log', 'URL', 'data', 'in', 'custom', 'XML', 'format', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/customxml.py#L45-L96
566
alexa/alexa-skills-kit-sdk-for-python
ask-sdk-dynamodb-persistence-adapter/ask_sdk_dynamodb/adapter.py
DynamoDbAdapter.__create_table_if_not_exists
def __create_table_if_not_exists(self): # type: () -> None """Creates table in Dynamodb resource if it doesn't exist and create_table is set as True. :rtype: None :raises: PersistenceException: When `create_table` fails on dynamodb resource. """ if se...
python
def __create_table_if_not_exists(self): # type: () -> None """Creates table in Dynamodb resource if it doesn't exist and create_table is set as True. :rtype: None :raises: PersistenceException: When `create_table` fails on dynamodb resource. """ if se...
['def', '__create_table_if_not_exists', '(', 'self', ')', ':', '# type: () -> None', 'if', 'self', '.', 'create_table', ':', 'try', ':', 'self', '.', 'dynamodb', '.', 'create_table', '(', 'TableName', '=', 'self', '.', 'table_name', ',', 'KeySchema', '=', '[', '{', "'AttributeName'", ':', 'self', '.', 'partition_key_na...
Creates table in Dynamodb resource if it doesn't exist and create_table is set as True. :rtype: None :raises: PersistenceException: When `create_table` fails on dynamodb resource.
['Creates', 'table', 'in', 'Dynamodb', 'resource', 'if', 'it', 'doesn', 't', 'exist', 'and', 'create_table', 'is', 'set', 'as', 'True', '.']
train
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/097b6406aa12d5ca0b825b00c936861b530cbf39/ask-sdk-dynamodb-persistence-adapter/ask_sdk_dynamodb/adapter.py#L207-L244
567
litters/shrew
shrew/utils/auth.py
FixedOSXKeychain.delete_password
def delete_password(service, username): """Delete the password for the username of the service. """ try: # set up the call for security. call = subprocess.Popen(['security', 'delete-generic-password', ...
python
def delete_password(service, username): """Delete the password for the username of the service. """ try: # set up the call for security. call = subprocess.Popen(['security', 'delete-generic-password', ...
['def', 'delete_password', '(', 'service', ',', 'username', ')', ':', 'try', ':', '# set up the call for security.', 'call', '=', 'subprocess', '.', 'Popen', '(', '[', "'security'", ',', "'delete-generic-password'", ',', "'-a'", ',', 'username', ',', "'-s'", ',', 'service', ']', ',', 'stderr', '=', 'subprocess', '.', '...
Delete the password for the username of the service.
['Delete', 'the', 'password', 'for', 'the', 'username', 'of', 'the', 'service', '.']
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/utils/auth.py#L60-L79
568
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
TcExRun.data_kva_compare
def data_kva_compare(db_data, user_data): """Validate key/value data in KeyValueArray. Args: db_data (list): The data store in Redis. user_data (dict): The user provided data. Returns: bool: True if the data passed validation. """ for kv_data...
python
def data_kva_compare(db_data, user_data): """Validate key/value data in KeyValueArray. Args: db_data (list): The data store in Redis. user_data (dict): The user provided data. Returns: bool: True if the data passed validation. """ for kv_data...
['def', 'data_kva_compare', '(', 'db_data', ',', 'user_data', ')', ':', 'for', 'kv_data', 'in', 'db_data', ':', 'if', 'kv_data', '.', 'get', '(', "'key'", ')', '==', 'user_data', '.', 'get', '(', "'key'", ')', ':', 'if', 'kv_data', '.', 'get', '(', "'value'", ')', '==', 'user_data', '.', 'get', '(', "'value'", ')', ':'...
Validate key/value data in KeyValueArray. Args: db_data (list): The data store in Redis. user_data (dict): The user provided data. Returns: bool: True if the data passed validation.
['Validate', 'key', '/', 'value', 'data', 'in', 'KeyValueArray', '.']
train
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L428-L442
569
miLibris/flask-rest-jsonapi
flask_rest_jsonapi/api.py
Api.oauth_manager
def oauth_manager(self, oauth_manager): """Use the oauth manager to enable oauth for API :param oauth_manager: the oauth manager """ @self.app.before_request def before_request(): endpoint = request.endpoint resource = self.app.view_functions[endpoint].vi...
python
def oauth_manager(self, oauth_manager): """Use the oauth manager to enable oauth for API :param oauth_manager: the oauth manager """ @self.app.before_request def before_request(): endpoint = request.endpoint resource = self.app.view_functions[endpoint].vi...
['def', 'oauth_manager', '(', 'self', ',', 'oauth_manager', ')', ':', '@', 'self', '.', 'app', '.', 'before_request', 'def', 'before_request', '(', ')', ':', 'endpoint', '=', 'request', '.', 'endpoint', 'resource', '=', 'self', '.', 'app', '.', 'view_functions', '[', 'endpoint', ']', '.', 'view_class', 'if', 'not', 'ge...
Use the oauth manager to enable oauth for API :param oauth_manager: the oauth manager
['Use', 'the', 'oauth', 'manager', 'to', 'enable', 'oauth', 'for', 'API']
train
https://github.com/miLibris/flask-rest-jsonapi/blob/ecc8f2cd2b54cc0bfae7acd6cffcda0ba1140c43/flask_rest_jsonapi/api.py#L93-L124
570
sixty-north/cosmic-ray
src/cosmic_ray/interceptors/spor.py
_item_in_context
def _item_in_context(lines, item, context): """Determines if a WorkItem falls within an anchor. This only returns True if a WorkItems start-/stop-pos range is *completely* within an anchor, not just if it overalaps. """ start_offset = _line_and_col_to_offset(lines, item.start_pos[0], ...
python
def _item_in_context(lines, item, context): """Determines if a WorkItem falls within an anchor. This only returns True if a WorkItems start-/stop-pos range is *completely* within an anchor, not just if it overalaps. """ start_offset = _line_and_col_to_offset(lines, item.start_pos[0], ...
['def', '_item_in_context', '(', 'lines', ',', 'item', ',', 'context', ')', ':', 'start_offset', '=', '_line_and_col_to_offset', '(', 'lines', ',', 'item', '.', 'start_pos', '[', '0', ']', ',', 'item', '.', 'start_pos', '[', '1', ']', ')', 'stop_offset', '=', '_line_and_col_to_offset', '(', 'lines', ',', 'item', '.', '...
Determines if a WorkItem falls within an anchor. This only returns True if a WorkItems start-/stop-pos range is *completely* within an anchor, not just if it overalaps.
['Determines', 'if', 'a', 'WorkItem', 'falls', 'within', 'an', 'anchor', '.']
train
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/interceptors/spor.py#L93-L105
571
fermiPy/fermipy
fermipy/diffuse/gt_srcmap_partial.py
SrcmapsDiffuse_SG._handle_component
def _handle_component(sourcekey, comp_dict): """Make the source objects and write the xml for a component """ if comp_dict.comp_key is None: fullkey = sourcekey else: fullkey = "%s_%s" % (sourcekey, comp_dict.comp_key) srcdict = make_sources(fullkey, comp_...
python
def _handle_component(sourcekey, comp_dict): """Make the source objects and write the xml for a component """ if comp_dict.comp_key is None: fullkey = sourcekey else: fullkey = "%s_%s" % (sourcekey, comp_dict.comp_key) srcdict = make_sources(fullkey, comp_...
['def', '_handle_component', '(', 'sourcekey', ',', 'comp_dict', ')', ':', 'if', 'comp_dict', '.', 'comp_key', 'is', 'None', ':', 'fullkey', '=', 'sourcekey', 'else', ':', 'fullkey', '=', '"%s_%s"', '%', '(', 'sourcekey', ',', 'comp_dict', '.', 'comp_key', ')', 'srcdict', '=', 'make_sources', '(', 'fullkey', ',', 'comp...
Make the source objects and write the xml for a component
['Make', 'the', 'source', 'objects', 'and', 'write', 'the', 'xml', 'for', 'a', 'component']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_srcmap_partial.py#L141-L159
572
mlperf/training
translation/tensorflow/transformer/transformer_main.py
get_learning_rate
def get_learning_rate(learning_rate, hidden_size, learning_rate_warmup_steps): """Calculate learning rate with linear warmup and rsqrt decay.""" with tf.name_scope("learning_rate"): warmup_steps = tf.to_float(learning_rate_warmup_steps) step = tf.to_float(tf.train.get_or_create_global_step()) learning_...
python
def get_learning_rate(learning_rate, hidden_size, learning_rate_warmup_steps): """Calculate learning rate with linear warmup and rsqrt decay.""" with tf.name_scope("learning_rate"): warmup_steps = tf.to_float(learning_rate_warmup_steps) step = tf.to_float(tf.train.get_or_create_global_step()) learning_...
['def', 'get_learning_rate', '(', 'learning_rate', ',', 'hidden_size', ',', 'learning_rate_warmup_steps', ')', ':', 'with', 'tf', '.', 'name_scope', '(', '"learning_rate"', ')', ':', 'warmup_steps', '=', 'tf', '.', 'to_float', '(', 'learning_rate_warmup_steps', ')', 'step', '=', 'tf', '.', 'to_float', '(', 'tf', '.', '...
Calculate learning rate with linear warmup and rsqrt decay.
['Calculate', 'learning', 'rate', 'with', 'linear', 'warmup', 'and', 'rsqrt', 'decay', '.']
train
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/transformer_main.py#L82-L97
573
zyga/guacamole
examples/rainbow.py
ANSIDemo.invoked
def invoked(self, ctx): """Method called when the command is invoked.""" if not ctx.ansi.is_enabled: print("You need color support to use this demo") else: print(ctx.ansi.cmd('erase_display')) self._demo_fg_color(ctx) self._demo_bg_color(ctx) ...
python
def invoked(self, ctx): """Method called when the command is invoked.""" if not ctx.ansi.is_enabled: print("You need color support to use this demo") else: print(ctx.ansi.cmd('erase_display')) self._demo_fg_color(ctx) self._demo_bg_color(ctx) ...
['def', 'invoked', '(', 'self', ',', 'ctx', ')', ':', 'if', 'not', 'ctx', '.', 'ansi', '.', 'is_enabled', ':', 'print', '(', '"You need color support to use this demo"', ')', 'else', ':', 'print', '(', 'ctx', '.', 'ansi', '.', 'cmd', '(', "'erase_display'", ')', ')', 'self', '.', '_demo_fg_color', '(', 'ctx', ')', 'sel...
Method called when the command is invoked.
['Method', 'called', 'when', 'the', 'command', 'is', 'invoked', '.']
train
https://github.com/zyga/guacamole/blob/105c10a798144e3b89659b500d7c2b84b0c76546/examples/rainbow.py#L45-L55
574
junaruga/rpm-py-installer
install.py
Cmd.tar_extract
def tar_extract(cls, tar_comp_file_path): """Extract tar.gz or tar bz2 file. It behaves like - tar xzf tar_gz_file_path - tar xjf tar_bz2_file_path It raises tarfile.ReadError if the file is broken. """ try: with contextlib.closing(tarfile.open(ta...
python
def tar_extract(cls, tar_comp_file_path): """Extract tar.gz or tar bz2 file. It behaves like - tar xzf tar_gz_file_path - tar xjf tar_bz2_file_path It raises tarfile.ReadError if the file is broken. """ try: with contextlib.closing(tarfile.open(ta...
['def', 'tar_extract', '(', 'cls', ',', 'tar_comp_file_path', ')', ':', 'try', ':', 'with', 'contextlib', '.', 'closing', '(', 'tarfile', '.', 'open', '(', 'tar_comp_file_path', ')', ')', 'as', 'tar', ':', 'tar', '.', 'extractall', '(', ')', 'except', 'tarfile', '.', 'ReadError', 'as', 'e', ':', 'message_format', '=', ...
Extract tar.gz or tar bz2 file. It behaves like - tar xzf tar_gz_file_path - tar xjf tar_bz2_file_path It raises tarfile.ReadError if the file is broken.
['Extract', 'tar', '.', 'gz', 'or', 'tar', 'bz2', 'file', '.']
train
https://github.com/junaruga/rpm-py-installer/blob/12f45feb0ba533dec8d0d16ef1e9b7fb8cfbd4ed/install.py#L1841-L1857
575
clusterpoint/python-client-api
pycps/converters.py
to_raw_xml
def to_raw_xml(source): """ Convert various representations of an XML structure to a normal XML string. Args: source -- The source object to be converted - ET.Element, dict or string. Returns: A rew xml string matching the source object. >>> to_raw_xml("<content/>") ...
python
def to_raw_xml(source): """ Convert various representations of an XML structure to a normal XML string. Args: source -- The source object to be converted - ET.Element, dict or string. Returns: A rew xml string matching the source object. >>> to_raw_xml("<content/>") ...
['def', 'to_raw_xml', '(', 'source', ')', ':', 'if', 'isinstance', '(', 'source', ',', 'basestring', ')', ':', 'return', 'source', 'elif', 'hasattr', '(', 'source', ',', "'getiterator'", ')', ':', '# Element or ElementTree.', 'return', 'ET', '.', 'tostring', '(', 'source', ',', 'encoding', '=', '"utf-8"', ')', 'elif', ...
Convert various representations of an XML structure to a normal XML string. Args: source -- The source object to be converted - ET.Element, dict or string. Returns: A rew xml string matching the source object. >>> to_raw_xml("<content/>") '<content/>' >>> to_raw_x...
['Convert', 'various', 'representations', 'of', 'an', 'XML', 'structure', 'to', 'a', 'normal', 'XML', 'string', '.']
train
https://github.com/clusterpoint/python-client-api/blob/fabf9bd8355aa54ba08fd6649e48f16e2c35eacd/pycps/converters.py#L178-L204
576
mozillazg/baidu-pcs-python-sdk
baidupcs/api.py
PCS.list_download_tasks
def list_download_tasks(self, need_task_info=1, start=0, limit=10, asc=0, create_time=None, status=None, source_url=None, remote_path=None, expires=None, **kwargs): """查询离线下载任务ID列表及任务信息. :param need_task_info: 是否需要返回任务信息: ...
python
def list_download_tasks(self, need_task_info=1, start=0, limit=10, asc=0, create_time=None, status=None, source_url=None, remote_path=None, expires=None, **kwargs): """查询离线下载任务ID列表及任务信息. :param need_task_info: 是否需要返回任务信息: ...
['def', 'list_download_tasks', '(', 'self', ',', 'need_task_info', '=', '1', ',', 'start', '=', '0', ',', 'limit', '=', '10', ',', 'asc', '=', '0', ',', 'create_time', '=', 'None', ',', 'status', '=', 'None', ',', 'source_url', '=', 'None', ',', 'remote_path', '=', 'None', ',', 'expires', '=', 'None', ',', '*', '*', 'k...
查询离线下载任务ID列表及任务信息. :param need_task_info: 是否需要返回任务信息: * 0:不需要 * 1:需要,默认为1 :param start: 查询任务起始位置,默认为0。 :param limit: 设定返回任务数量,默认为10。 :param asc: * 0:降序,默认值 * 1:升序 :param create_...
['查询离线下载任务ID列表及任务信息', '.']
train
https://github.com/mozillazg/baidu-pcs-python-sdk/blob/12fe3f13b2ecda8f8bdcc5334c876e934776a5cc/baidupcs/api.py#L791-L839
577
zrnsm/pyculiarity
pyculiarity/detect_vec.py
detect_vec
def detect_vec(df, max_anoms=0.10, direction='pos', alpha=0.05, period=None, only_last=False, threshold=None, e_value=False, longterm_period=None, plot=False, y_log=False, xlabel='', ylabel='count', title=None, verbose=False): """ Anomaly Detection Usi...
python
def detect_vec(df, max_anoms=0.10, direction='pos', alpha=0.05, period=None, only_last=False, threshold=None, e_value=False, longterm_period=None, plot=False, y_log=False, xlabel='', ylabel='count', title=None, verbose=False): """ Anomaly Detection Usi...
['def', 'detect_vec', '(', 'df', ',', 'max_anoms', '=', '0.10', ',', 'direction', '=', "'pos'", ',', 'alpha', '=', '0.05', ',', 'period', '=', 'None', ',', 'only_last', '=', 'False', ',', 'threshold', '=', 'None', ',', 'e_value', '=', 'False', ',', 'longterm_period', '=', 'None', ',', 'plot', '=', 'False', ',', 'y_log'...
Anomaly Detection Using Seasonal Hybrid ESD Test A technique for detecting anomalies in seasonal univariate time series where the input is a series of observations. Args: x: Time series as a column data frame, list, or vector, where the column consists of the observations. max_anoms: Maximum ...
['Anomaly', 'Detection', 'Using', 'Seasonal', 'Hybrid', 'ESD', 'Test']
train
https://github.com/zrnsm/pyculiarity/blob/a06f5977cbf60a8805fd364f834aa09be108f2f3/pyculiarity/detect_vec.py#L11-L293
578
sentinelsat/sentinelsat
sentinelsat/sentinel.py
SentinelAPI.download
def download(self, id, directory_path='.', checksum=True): """Download a product. Uses the filename on the server for the downloaded file, e.g. "S1A_EW_GRDH_1SDH_20141003T003840_20141003T003920_002658_002F54_4DD1.zip". Incomplete downloads are continued and complete files are skipped. ...
python
def download(self, id, directory_path='.', checksum=True): """Download a product. Uses the filename on the server for the downloaded file, e.g. "S1A_EW_GRDH_1SDH_20141003T003840_20141003T003920_002658_002F54_4DD1.zip". Incomplete downloads are continued and complete files are skipped. ...
['def', 'download', '(', 'self', ',', 'id', ',', 'directory_path', '=', "'.'", ',', 'checksum', '=', 'True', ')', ':', 'product_info', '=', 'self', '.', 'get_product_odata', '(', 'id', ')', 'path', '=', 'join', '(', 'directory_path', ',', 'product_info', '[', "'title'", ']', '+', "'.zip'", ')', 'product_info', '[', "'p...
Download a product. Uses the filename on the server for the downloaded file, e.g. "S1A_EW_GRDH_1SDH_20141003T003840_20141003T003920_002658_002F54_4DD1.zip". Incomplete downloads are continued and complete files are skipped. Parameters ---------- id : string ...
['Download', 'a', 'product', '.']
train
https://github.com/sentinelsat/sentinelsat/blob/eacfd79ff4e7e939147db9dfdd393c67d64eecaa/sentinelsat/sentinel.py#L463-L552
579
explosion/thinc
examples/spacy_tagger.py
Shape
def Shape(docs, drop=0.0): """Get word shapes.""" ids = numpy.zeros((sum(len(doc) for doc in docs),), dtype="i") i = 0 for doc in docs: for token in doc: ids[i] = token.shape i += 1 return ids, None
python
def Shape(docs, drop=0.0): """Get word shapes.""" ids = numpy.zeros((sum(len(doc) for doc in docs),), dtype="i") i = 0 for doc in docs: for token in doc: ids[i] = token.shape i += 1 return ids, None
['def', 'Shape', '(', 'docs', ',', 'drop', '=', '0.0', ')', ':', 'ids', '=', 'numpy', '.', 'zeros', '(', '(', 'sum', '(', 'len', '(', 'doc', ')', 'for', 'doc', 'in', 'docs', ')', ',', ')', ',', 'dtype', '=', '"i"', ')', 'i', '=', '0', 'for', 'doc', 'in', 'docs', ':', 'for', 'token', 'in', 'doc', ':', 'ids', '[', 'i', '...
Get word shapes.
['Get', 'word', 'shapes', '.']
train
https://github.com/explosion/thinc/blob/90129be5f0d6c665344245a7c37dbe1b8afceea2/examples/spacy_tagger.py#L58-L66
580
bitshares/uptick
uptick/wallet.py
addkey
def addkey(ctx, key): """ Add a private key to the wallet """ if not key: while True: key = click.prompt( "Private Key (wif) [Enter to quit]", hide_input=True, show_default=False, default="exit", ) if...
python
def addkey(ctx, key): """ Add a private key to the wallet """ if not key: while True: key = click.prompt( "Private Key (wif) [Enter to quit]", hide_input=True, show_default=False, default="exit", ) if...
['def', 'addkey', '(', 'ctx', ',', 'key', ')', ':', 'if', 'not', 'key', ':', 'while', 'True', ':', 'key', '=', 'click', '.', 'prompt', '(', '"Private Key (wif) [Enter to quit]"', ',', 'hide_input', '=', 'True', ',', 'show_default', '=', 'False', ',', 'default', '=', '"exit"', ',', ')', 'if', 'not', 'key', 'or', 'key', ...
Add a private key to the wallet
['Add', 'a', 'private', 'key', 'to', 'the', 'wallet']
train
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/wallet.py#L47-L83
581
nhoffman/fastalite
fastalite/fastalite.py
fastalite
def fastalite(handle): """Return a sequence of namedtuple objects from a fasta file with attributes (id, description, seq) given open file-like object ``handle`` """ Seq = namedtuple('Seq', ['id', 'description', 'seq']) header, seq = '', [] for line in handle: if line.startswith('...
python
def fastalite(handle): """Return a sequence of namedtuple objects from a fasta file with attributes (id, description, seq) given open file-like object ``handle`` """ Seq = namedtuple('Seq', ['id', 'description', 'seq']) header, seq = '', [] for line in handle: if line.startswith('...
['def', 'fastalite', '(', 'handle', ')', ':', 'Seq', '=', 'namedtuple', '(', "'Seq'", ',', '[', "'id'", ',', "'description'", ',', "'seq'", ']', ')', 'header', ',', 'seq', '=', "''", ',', '[', ']', 'for', 'line', 'in', 'handle', ':', 'if', 'line', '.', 'startswith', '(', "'>'", ')', ':', 'if', 'header', ':', 'yield', '...
Return a sequence of namedtuple objects from a fasta file with attributes (id, description, seq) given open file-like object ``handle``
['Return', 'a', 'sequence', 'of', 'namedtuple', 'objects', 'from', 'a', 'fasta', 'file', 'with', 'attributes', '(', 'id', 'description', 'seq', ')', 'given', 'open', 'file', '-', 'like', 'object', 'handle']
train
https://github.com/nhoffman/fastalite/blob/d544a9e2b5150cf59f0f9651f6f3d659caf13848/fastalite/fastalite.py#L52-L71
582
santoshphilip/eppy
eppy/modeleditor.py
IDF.newidfobject
def newidfobject(self, key, aname='', defaultvalues=True, **kwargs): """ Add a new idfobject to the model. If you don't specify a value for a field, the default value will be set. For example :: newidfobject("CONSTRUCTION") newidfobject("CONSTRUCTION", ...
python
def newidfobject(self, key, aname='', defaultvalues=True, **kwargs): """ Add a new idfobject to the model. If you don't specify a value for a field, the default value will be set. For example :: newidfobject("CONSTRUCTION") newidfobject("CONSTRUCTION", ...
['def', 'newidfobject', '(', 'self', ',', 'key', ',', 'aname', '=', "''", ',', 'defaultvalues', '=', 'True', ',', '*', '*', 'kwargs', ')', ':', 'obj', '=', 'newrawobject', '(', 'self', '.', 'model', ',', 'self', '.', 'idd_info', ',', 'key', ',', 'block', '=', 'self', '.', 'block', ',', 'defaultvalues', '=', 'defaultval...
Add a new idfobject to the model. If you don't specify a value for a field, the default value will be set. For example :: newidfobject("CONSTRUCTION") newidfobject("CONSTRUCTION", Name='Interior Ceiling_class', Outside_Layer='LW Concrete', ...
['Add', 'a', 'new', 'idfobject', 'to', 'the', 'model', '.', 'If', 'you', 'don', 't', 'specify', 'a', 'value', 'for', 'a', 'field', 'the', 'default', 'value', 'will', 'be', 'set', '.']
train
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L713-L755
583
KelSolaar/Umbra
umbra/components/factory/script_editor/models.py
ProjectsModel.register_file
def register_file(self, file, parent, ensure_uniqueness=False): """ Registers given file in the Model. :param file: File to register. :type file: unicode :param parent: FileNode parent. :type parent: GraphModelNode :param ensure_uniqueness: Ensure registrar uniqu...
python
def register_file(self, file, parent, ensure_uniqueness=False): """ Registers given file in the Model. :param file: File to register. :type file: unicode :param parent: FileNode parent. :type parent: GraphModelNode :param ensure_uniqueness: Ensure registrar uniqu...
['def', 'register_file', '(', 'self', ',', 'file', ',', 'parent', ',', 'ensure_uniqueness', '=', 'False', ')', ':', 'if', 'ensure_uniqueness', ':', 'if', 'self', '.', 'get_file_nodes', '(', 'file', ')', ':', 'raise', 'foundations', '.', 'exceptions', '.', 'ProgrammingError', '(', '"{0} | \'{1}\' file is already registe...
Registers given file in the Model. :param file: File to register. :type file: unicode :param parent: FileNode parent. :type parent: GraphModelNode :param ensure_uniqueness: Ensure registrar uniqueness. :type ensure_uniqueness: bool :return: FileNode. :rty...
['Registers', 'given', 'file', 'in', 'the', 'Model', '.']
train
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/components/factory/script_editor/models.py#L442-L472
584
twilio/twilio-python
twilio/rest/wireless/v1/sim/__init__.py
SimContext.usage_records
def usage_records(self): """ Access the usage_records :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList """ if self._usage_records is None: self._usage_records = UsageRecordList...
python
def usage_records(self): """ Access the usage_records :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList """ if self._usage_records is None: self._usage_records = UsageRecordList...
['def', 'usage_records', '(', 'self', ')', ':', 'if', 'self', '.', '_usage_records', 'is', 'None', ':', 'self', '.', '_usage_records', '=', 'UsageRecordList', '(', 'self', '.', '_version', ',', 'sim_sid', '=', 'self', '.', '_solution', '[', "'sid'", ']', ',', ')', 'return', 'self', '.', '_usage_records']
Access the usage_records :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList
['Access', 'the', 'usage_records']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/wireless/v1/sim/__init__.py#L345-L354
585
CI-WATER/gsshapy
gsshapy/orm/evt.py
ProjectFileEventManager._write
def _write(self, session, openFile, replaceParamFile=None): """ ProjectFileEvent Write to File Method """ openFile.write( text( yaml.dump([evt.as_yml() for evt in self.events.order_by(ProjectFileEvent.name, ...
python
def _write(self, session, openFile, replaceParamFile=None): """ ProjectFileEvent Write to File Method """ openFile.write( text( yaml.dump([evt.as_yml() for evt in self.events.order_by(ProjectFileEvent.name, ...
['def', '_write', '(', 'self', ',', 'session', ',', 'openFile', ',', 'replaceParamFile', '=', 'None', ')', ':', 'openFile', '.', 'write', '(', 'text', '(', 'yaml', '.', 'dump', '(', '[', 'evt', '.', 'as_yml', '(', ')', 'for', 'evt', 'in', 'self', '.', 'events', '.', 'order_by', '(', 'ProjectFileEvent', '.', 'name', ','...
ProjectFileEvent Write to File Method
['ProjectFileEvent', 'Write', 'to', 'File', 'Method']
train
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L48-L59
586
crate/crate-python
src/crate/client/blob.py
BlobContainer.exists
def exists(self, digest): """ Check if a blob exists :param digest: Hex digest of the blob :return: Boolean indicating existence of the blob """ return self.conn.client.blob_exists(self.container_name, digest)
python
def exists(self, digest): """ Check if a blob exists :param digest: Hex digest of the blob :return: Boolean indicating existence of the blob """ return self.conn.client.blob_exists(self.container_name, digest)
['def', 'exists', '(', 'self', ',', 'digest', ')', ':', 'return', 'self', '.', 'conn', '.', 'client', '.', 'blob_exists', '(', 'self', '.', 'container_name', ',', 'digest', ')']
Check if a blob exists :param digest: Hex digest of the blob :return: Boolean indicating existence of the blob
['Check', 'if', 'a', 'blob', 'exists']
train
https://github.com/crate/crate-python/blob/68e39c95f5bbe88b74bbfa26de4347fc644636a8/src/crate/client/blob.py#L93-L100
587
SFDO-Tooling/CumulusCI
cumulusci/cli/cci.py
timestamp_file
def timestamp_file(): """Opens a file for tracking the time of the last version check""" config_dir = os.path.join( os.path.expanduser("~"), BaseGlobalConfig.config_local_dir ) if not os.path.exists(config_dir): os.mkdir(config_dir) timestamp_file = os.path.join(config_dir, "cumulu...
python
def timestamp_file(): """Opens a file for tracking the time of the last version check""" config_dir = os.path.join( os.path.expanduser("~"), BaseGlobalConfig.config_local_dir ) if not os.path.exists(config_dir): os.mkdir(config_dir) timestamp_file = os.path.join(config_dir, "cumulu...
['def', 'timestamp_file', '(', ')', ':', 'config_dir', '=', 'os', '.', 'path', '.', 'join', '(', 'os', '.', 'path', '.', 'expanduser', '(', '"~"', ')', ',', 'BaseGlobalConfig', '.', 'config_local_dir', ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'config_dir', ')', ':', 'os', '.', 'mkdir', '(', 'config_dir'...
Opens a file for tracking the time of the last version check
['Opens', 'a', 'file', 'for', 'tracking', 'the', 'time', 'of', 'the', 'last', 'version', 'check']
train
https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/cli/cci.py#L53-L69
588
AustralianSynchrotron/lightflow
lightflow/models/signal.py
Client.send
def send(self, request): """ Send a request to the server and wait for its response. Args: request (Request): Reference to a request object that is sent to the server. Returns: Response: The response from the server to the request. """ self._connection.c...
python
def send(self, request): """ Send a request to the server and wait for its response. Args: request (Request): Reference to a request object that is sent to the server. Returns: Response: The response from the server to the request. """ self._connection.c...
['def', 'send', '(', 'self', ',', 'request', ')', ':', 'self', '.', '_connection', '.', 'connection', '.', 'rpush', '(', 'self', '.', '_request_key', ',', 'pickle', '.', 'dumps', '(', 'request', ')', ')', 'resp_key', '=', "'{}:{}'", '.', 'format', '(', 'SIGNAL_REDIS_PREFIX', ',', 'request', '.', 'uid', ')', 'while', 'T...
Send a request to the server and wait for its response. Args: request (Request): Reference to a request object that is sent to the server. Returns: Response: The response from the server to the request.
['Send', 'a', 'request', 'to', 'the', 'server', 'and', 'wait', 'for', 'its', 'response', '.']
train
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/signal.py#L171-L192
589
oceanprotocol/squid-py
squid_py/agreements/service_agreement_condition.py
Parameter.as_dictionary
def as_dictionary(self): """ Return the parameter as a dictionary. :return: dict """ return { "name": self.name, "type": self.type, "value": remove_0x_prefix(self.value) if self.type == 'bytes32' else self.value }
python
def as_dictionary(self): """ Return the parameter as a dictionary. :return: dict """ return { "name": self.name, "type": self.type, "value": remove_0x_prefix(self.value) if self.type == 'bytes32' else self.value }
['def', 'as_dictionary', '(', 'self', ')', ':', 'return', '{', '"name"', ':', 'self', '.', 'name', ',', '"type"', ':', 'self', '.', 'type', ',', '"value"', ':', 'remove_0x_prefix', '(', 'self', '.', 'value', ')', 'if', 'self', '.', 'type', '==', "'bytes32'", 'else', 'self', '.', 'value', '}']
Return the parameter as a dictionary. :return: dict
['Return', 'the', 'parameter', 'as', 'a', 'dictionary', '.']
train
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/service_agreement_condition.py#L21-L31
590
graphql-python/graphql-core
graphql/language/parser.py
loc
def loc(parser, start): # type: (Parser, int) -> Optional[Loc] """Returns a location object, used to identify the place in the source that created a given parsed object.""" if parser.options["no_location"]: return None if parser.options["no_source"]: return Loc(start, parser.prev_en...
python
def loc(parser, start): # type: (Parser, int) -> Optional[Loc] """Returns a location object, used to identify the place in the source that created a given parsed object.""" if parser.options["no_location"]: return None if parser.options["no_source"]: return Loc(start, parser.prev_en...
['def', 'loc', '(', 'parser', ',', 'start', ')', ':', '# type: (Parser, int) -> Optional[Loc]', 'if', 'parser', '.', 'options', '[', '"no_location"', ']', ':', 'return', 'None', 'if', 'parser', '.', 'options', '[', '"no_source"', ']', ':', 'return', 'Loc', '(', 'start', ',', 'parser', '.', 'prev_end', ')', 'return', 'L...
Returns a location object, used to identify the place in the source that created a given parsed object.
['Returns', 'a', 'location', 'object', 'used', 'to', 'identify', 'the', 'place', 'in', 'the', 'source', 'that', 'created', 'a', 'given', 'parsed', 'object', '.']
train
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L114-L124
591
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/debug.py
Debug.execl
def execl(self, lpCmdLine, **kwargs): """ Starts a new process for debugging. This method uses a command line string. To use a list of arguments instead, use L{execv}. @see: L{attach}, L{detach} @type lpCmdLine: str @param lpCmdLine: Command line string to exe...
python
def execl(self, lpCmdLine, **kwargs): """ Starts a new process for debugging. This method uses a command line string. To use a list of arguments instead, use L{execv}. @see: L{attach}, L{detach} @type lpCmdLine: str @param lpCmdLine: Command line string to exe...
['def', 'execl', '(', 'self', ',', 'lpCmdLine', ',', '*', '*', 'kwargs', ')', ':', 'if', 'type', '(', 'lpCmdLine', ')', 'not', 'in', '(', 'str', ',', 'compat', '.', 'unicode', ')', ':', 'warnings', '.', 'warn', '(', '"Debug.execl expects a string"', ')', '# Set the "debug" flag to True.', 'kwargs', '[', "'bDebug'", ']'...
Starts a new process for debugging. This method uses a command line string. To use a list of arguments instead, use L{execv}. @see: L{attach}, L{detach} @type lpCmdLine: str @param lpCmdLine: Command line string to execute. The first token must be the debugee exec...
['Starts', 'a', 'new', 'process', 'for', 'debugging', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/debug.py#L350-L534
592
nugget/python-insteonplm
insteonplm/__init__.py
Connection.dump_conndata
def dump_conndata(self): """Developer tool for debugging forensics.""" attrs = vars(self) return ', '.join("%s: %s" % item for item in attrs.items())
python
def dump_conndata(self): """Developer tool for debugging forensics.""" attrs = vars(self) return ', '.join("%s: %s" % item for item in attrs.items())
['def', 'dump_conndata', '(', 'self', ')', ':', 'attrs', '=', 'vars', '(', 'self', ')', 'return', "', '", '.', 'join', '(', '"%s: %s"', '%', 'item', 'for', 'item', 'in', 'attrs', '.', 'items', '(', ')', ')']
Developer tool for debugging forensics.
['Developer', 'tool', 'for', 'debugging', 'forensics', '.']
train
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/__init__.py#L220-L223
593
ets-labs/python-domain-models
domain_models/views.py
ContextViewMetaClass.get_properties
def get_properties(attributes): """Return tuple of names of defined properties. :type attributes: dict :rtype: list """ return [key for key, value in six.iteritems(attributes) if isinstance(value, property)]
python
def get_properties(attributes): """Return tuple of names of defined properties. :type attributes: dict :rtype: list """ return [key for key, value in six.iteritems(attributes) if isinstance(value, property)]
['def', 'get_properties', '(', 'attributes', ')', ':', 'return', '[', 'key', 'for', 'key', ',', 'value', 'in', 'six', '.', 'iteritems', '(', 'attributes', ')', 'if', 'isinstance', '(', 'value', ',', 'property', ')', ']']
Return tuple of names of defined properties. :type attributes: dict :rtype: list
['Return', 'tuple', 'of', 'names', 'of', 'defined', 'properties', '.']
train
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/views.py#L76-L83
594
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py
SchedulingBlockInstance.abort
def abort(self): """Abort the SBI (and associated PBs).""" self.set_status('aborted') DB.remove_from_list('{}:active'.format(self._type), self._id) DB.append_to_list('{}:aborted'.format(self._type), self._id) sbi_pb_ids = ast.literal_eval( DB.get_hash_value(self._key,...
python
def abort(self): """Abort the SBI (and associated PBs).""" self.set_status('aborted') DB.remove_from_list('{}:active'.format(self._type), self._id) DB.append_to_list('{}:aborted'.format(self._type), self._id) sbi_pb_ids = ast.literal_eval( DB.get_hash_value(self._key,...
['def', 'abort', '(', 'self', ')', ':', 'self', '.', 'set_status', '(', "'aborted'", ')', 'DB', '.', 'remove_from_list', '(', "'{}:active'", '.', 'format', '(', 'self', '.', '_type', ')', ',', 'self', '.', '_id', ')', 'DB', '.', 'append_to_list', '(', "'{}:aborted'", '.', 'format', '(', 'self', '.', '_type', ')', ',', ...
Abort the SBI (and associated PBs).
['Abort', 'the', 'SBI', '(', 'and', 'associated', 'PBs', ')', '.']
train
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/scheduling/scheduling_block_instance.py#L114-L124
595
cuihantao/andes
andes/models/jit.py
JIT.jit_load
def jit_load(self): """ Import and instantiate this JIT object Returns ------- """ try: model = importlib.import_module('.' + self.model, 'andes.models') device = getattr(model, self.device) self.system.__dict__[self.name] = device(se...
python
def jit_load(self): """ Import and instantiate this JIT object Returns ------- """ try: model = importlib.import_module('.' + self.model, 'andes.models') device = getattr(model, self.device) self.system.__dict__[self.name] = device(se...
['def', 'jit_load', '(', 'self', ')', ':', 'try', ':', 'model', '=', 'importlib', '.', 'import_module', '(', "'.'", '+', 'self', '.', 'model', ',', "'andes.models'", ')', 'device', '=', 'getattr', '(', 'model', ',', 'self', '.', 'device', ')', 'self', '.', 'system', '.', '__dict__', '[', 'self', '.', 'name', ']', '=', ...
Import and instantiate this JIT object Returns -------
['Import', 'and', 'instantiate', 'this', 'JIT', 'object']
train
https://github.com/cuihantao/andes/blob/7067898d4f26ce7534e968b8486c4aa8fe3a511a/andes/models/jit.py#L20-L49
596
saltstack/salt
salt/modules/cassandra_cql.py
_connect
def _connect(contact_points=None, port=None, cql_user=None, cql_pass=None, protocol_version=None): ''' Connect to a Cassandra cluster. :param contact_points: The Cassandra cluster addresses, can either be a string or a list of IPs. :type contact_points: str or list of str :param cql_u...
python
def _connect(contact_points=None, port=None, cql_user=None, cql_pass=None, protocol_version=None): ''' Connect to a Cassandra cluster. :param contact_points: The Cassandra cluster addresses, can either be a string or a list of IPs. :type contact_points: str or list of str :param cql_u...
['def', '_connect', '(', 'contact_points', '=', 'None', ',', 'port', '=', 'None', ',', 'cql_user', '=', 'None', ',', 'cql_pass', '=', 'None', ',', 'protocol_version', '=', 'None', ')', ':', '# Lazy load the Cassandra cluster and session for this module by creating a', '# cluster and session when cql_query is called the...
Connect to a Cassandra cluster. :param contact_points: The Cassandra cluster addresses, can either be a string or a list of IPs. :type contact_points: str or list of str :param cql_user: The Cassandra user if authentication is turned on. :type cql_user: str :param cql_pass: The ...
['Connect', 'to', 'a', 'Cassandra', 'cluster', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cassandra_cql.py#L201-L282
597
SHTOOLS/SHTOOLS
setup.py
build.run
def run(self): """Build the Fortran library, all python extensions and the docs.""" print('---- BUILDING ----') _build.run(self) # build documentation print('---- BUILDING DOCS ----') docdir = os.path.join(self.build_lib, 'pyshtools', 'doc') self.mkpath(docdir) ...
python
def run(self): """Build the Fortran library, all python extensions and the docs.""" print('---- BUILDING ----') _build.run(self) # build documentation print('---- BUILDING DOCS ----') docdir = os.path.join(self.build_lib, 'pyshtools', 'doc') self.mkpath(docdir) ...
['def', 'run', '(', 'self', ')', ':', 'print', '(', "'---- BUILDING ----'", ')', '_build', '.', 'run', '(', 'self', ')', '# build documentation', 'print', '(', "'---- BUILDING DOCS ----'", ')', 'docdir', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'build_lib', ',', "'pyshtools'", ',', "'doc'", ')', 'self', '...
Build the Fortran library, all python extensions and the docs.
['Build', 'the', 'Fortran', 'library', 'all', 'python', 'extensions', 'and', 'the', 'docs', '.']
train
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/setup.py#L98-L111
598
aparo/pyes
pyes/models.py
ElasticSearchModel.get_id
def get_id(self): """ Force the object saveing to get an id""" _id = self._meta.get("id", None) if _id is None: _id = self.save() return _id
python
def get_id(self): """ Force the object saveing to get an id""" _id = self._meta.get("id", None) if _id is None: _id = self.save() return _id
['def', 'get_id', '(', 'self', ')', ':', '_id', '=', 'self', '.', '_meta', '.', 'get', '(', '"id"', ',', 'None', ')', 'if', '_id', 'is', 'None', ':', '_id', '=', 'self', '.', 'save', '(', ')', 'return', '_id']
Force the object saveing to get an id
['Force', 'the', 'object', 'saveing', 'to', 'get', 'an', 'id']
train
https://github.com/aparo/pyes/blob/712eb6095961755067b2b5baa262008ade6584b3/pyes/models.py#L98-L103
599
honzajavorek/redis-collections
redis_collections/sortedsets.py
SortedSetCounter.discard_between
def discard_between( self, min_rank=None, max_rank=None, min_score=None, max_score=None, ): """ Remove members whose ranking is between *min_rank* and *max_rank* OR whose score is between *min_score* and *max_score* (both ranges inclusive). If ...
python
def discard_between( self, min_rank=None, max_rank=None, min_score=None, max_score=None, ): """ Remove members whose ranking is between *min_rank* and *max_rank* OR whose score is between *min_score* and *max_score* (both ranges inclusive). If ...
['def', 'discard_between', '(', 'self', ',', 'min_rank', '=', 'None', ',', 'max_rank', '=', 'None', ',', 'min_score', '=', 'None', ',', 'max_score', '=', 'None', ',', ')', ':', 'no_ranks', '=', '(', 'min_rank', 'is', 'None', ')', 'and', '(', 'max_rank', 'is', 'None', ')', 'no_scores', '=', '(', 'min_score', 'is', 'None...
Remove members whose ranking is between *min_rank* and *max_rank* OR whose score is between *min_score* and *max_score* (both ranges inclusive). If no bounds are specified, no members will be removed.
['Remove', 'members', 'whose', 'ranking', 'is', 'between', '*', 'min_rank', '*', 'and', '*', 'max_rank', '*', 'OR', 'whose', 'score', 'is', 'between', '*', 'min_score', '*', 'and', '*', 'max_score', '*', '(', 'both', 'ranges', 'inclusive', ')', '.', 'If', 'no', 'bounds', 'are', 'specified', 'no', 'members', 'will', 'be...
train
https://github.com/honzajavorek/redis-collections/blob/07ca8efe88fb128f7dc7319dfa6a26cd39b3776b/redis_collections/sortedsets.py#L204-L235