repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
blockstack/virtualchain
virtualchain/lib/config.py
https://github.com/blockstack/virtualchain/blob/fcfc970064ca7dfcab26ebd3ab955870a763ea39/virtualchain/lib/config.py#L64-L91
def get_logger(name=None): """ Get virtualchain's logger """ level = logging.CRITICAL if DEBUG: logging.disable(logging.NOTSET) level = logging.DEBUG if name is None: name = "<unknown>" log = logging.getLogger(name=name) log.setLevel( level ) console = logg...
[ "def", "get_logger", "(", "name", "=", "None", ")", ":", "level", "=", "logging", ".", "CRITICAL", "if", "DEBUG", ":", "logging", ".", "disable", "(", "logging", ".", "NOTSET", ")", "level", "=", "logging", ".", "DEBUG", "if", "name", "is", "None", "...
Get virtualchain's logger
[ "Get", "virtualchain", "s", "logger" ]
python
train
27.25
delfick/harpoon
harpoon/option_spec/harpoon_specs.py
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/option_spec/harpoon_specs.py#L142-L157
def wait_condition_spec(self): """Spec for a wait_condition block""" from harpoon.option_spec import image_objs formatted_string = formatted(string_spec(), formatter=MergedOptionStringFormatter) return create_spec(image_objs.WaitCondition , harpoon = formatted(overridden("{ha...
[ "def", "wait_condition_spec", "(", "self", ")", ":", "from", "harpoon", ".", "option_spec", "import", "image_objs", "formatted_string", "=", "formatted", "(", "string_spec", "(", ")", ",", "formatter", "=", "MergedOptionStringFormatter", ")", "return", "create_spec"...
Spec for a wait_condition block
[ "Spec", "for", "a", "wait_condition", "block" ]
python
train
58.4375
Microsoft/nni
tools/nni_cmd/launcher.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L178-L200
def set_remote_config(experiment_config, port, config_file_name): '''Call setClusterMetadata to pass trial''' #set machine_list request_data = dict() request_data['machine_list'] = experiment_config['machineList'] if request_data['machine_list']: for i in range(len(request_data['machine_list...
[ "def", "set_remote_config", "(", "experiment_config", ",", "port", ",", "config_file_name", ")", ":", "#set machine_list", "request_data", "=", "dict", "(", ")", "request_data", "[", "'machine_list'", "]", "=", "experiment_config", "[", "'machineList'", "]", "if", ...
Call setClusterMetadata to pass trial
[ "Call", "setClusterMetadata", "to", "pass", "trial" ]
python
train
54.304348
edx/django-config-models
config_models/models.py
https://github.com/edx/django-config-models/blob/f22c05fe3ccb182a6be4dbe313e9d6749dffd3e4/config_models/models.py#L168-L171
def key_values_cache_key_name(cls, *key_fields): """ Key for fetching unique key values from the cache """ key_fields = key_fields or cls.KEY_FIELDS return 'configuration/{}/key_values/{}'.format(cls.__name__, ','.join(key_fields))
[ "def", "key_values_cache_key_name", "(", "cls", ",", "*", "key_fields", ")", ":", "key_fields", "=", "key_fields", "or", "cls", ".", "KEY_FIELDS", "return", "'configuration/{}/key_values/{}'", ".", "format", "(", "cls", ".", "__name__", ",", "','", ".", "join", ...
Key for fetching unique key values from the cache
[ "Key", "for", "fetching", "unique", "key", "values", "from", "the", "cache" ]
python
train
63
Garee/pytodoist
pytodoist/todoist.py
https://github.com/Garee/pytodoist/blob/3359cbff485ebdbbb4ffbd58d71e21a817874dd7/pytodoist/todoist.py#L806-L821
def get_productivity_stats(self): """Return the user's productivity stats. :return: A JSON-encoded representation of the user's productivity stats. :rtype: A JSON-encoded object. >>> from pytodoist import todoist >>> user = todoist.login('john.doe@gmail.com', 'passw...
[ "def", "get_productivity_stats", "(", "self", ")", ":", "response", "=", "API", ".", "get_productivity_stats", "(", "self", ".", "api_token", ")", "_fail_if_contains_errors", "(", "response", ")", "return", "response", ".", "json", "(", ")" ]
Return the user's productivity stats. :return: A JSON-encoded representation of the user's productivity stats. :rtype: A JSON-encoded object. >>> from pytodoist import todoist >>> user = todoist.login('john.doe@gmail.com', 'password') >>> stats = user.get_productivi...
[ "Return", "the", "user", "s", "productivity", "stats", "." ]
python
train
37.25
SuperCowPowers/workbench
workbench/workers/mem_dlllist.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/workers/mem_dlllist.py#L32-L64
def execute(self, input_data): ''' Execute method ''' # Spin up the rekall adapter adapter = RekallAdapter() adapter.set_plugin_name(self.plugin_name) rekall_output = adapter.execute(input_data) # Process the output data for line in rekall_output: i...
[ "def", "execute", "(", "self", ",", "input_data", ")", ":", "# Spin up the rekall adapter", "adapter", "=", "RekallAdapter", "(", ")", "adapter", ".", "set_plugin_name", "(", "self", ".", "plugin_name", ")", "rekall_output", "=", "adapter", ".", "execute", "(", ...
Execute method
[ "Execute", "method" ]
python
train
39.727273
pywbem/pywbem
pywbem/mof_compiler.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/mof_compiler.py#L975-L979
def p_propertyDeclaration_7(p): """propertyDeclaration_7 : qualifierList dataType propertyName array ';'""" quals = OrderedDict([(x.name, x) for x in p[1]]) p[0] = CIMProperty(p[3], None, type=p[2], qualifiers=quals, is_array=True, array_size=p[4])
[ "def", "p_propertyDeclaration_7", "(", "p", ")", ":", "quals", "=", "OrderedDict", "(", "[", "(", "x", ".", "name", ",", "x", ")", "for", "x", "in", "p", "[", "1", "]", "]", ")", "p", "[", "0", "]", "=", "CIMProperty", "(", "p", "[", "3", "]"...
propertyDeclaration_7 : qualifierList dataType propertyName array ';
[ "propertyDeclaration_7", ":", "qualifierList", "dataType", "propertyName", "array", ";" ]
python
train
55.8
sanger-pathogens/circlator
circlator/clean.py
https://github.com/sanger-pathogens/circlator/blob/a4befb8c9dbbcd4b3ad1899a95aa3e689d58b638/circlator/clean.py#L101-L109
def _contains(self, hit): '''Returns True iff (the query contig is contained in the reference contig and the query contig is not flagged to be kept)''' return ( hit.qry_name not in self.contigs_to_keep and hit.qry_name != hit.ref_name and (100 * hit.hit_len...
[ "def", "_contains", "(", "self", ",", "hit", ")", ":", "return", "(", "hit", ".", "qry_name", "not", "in", "self", ".", "contigs_to_keep", "and", "hit", ".", "qry_name", "!=", "hit", ".", "ref_name", "and", "(", "100", "*", "hit", ".", "hit_length_qry"...
Returns True iff (the query contig is contained in the reference contig and the query contig is not flagged to be kept)
[ "Returns", "True", "iff", "(", "the", "query", "contig", "is", "contained", "in", "the", "reference", "contig", "and", "the", "query", "contig", "is", "not", "flagged", "to", "be", "kept", ")" ]
python
train
48.777778
aouyar/PyMunin
pysysinfo/asterisk.py
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L339-L348
def hasApplication(self, app): """Returns True if app is among the loaded modules. @param app: Module name. @return: Boolean """ if self._applications is None: self._initApplicationList() return app in self._applications
[ "def", "hasApplication", "(", "self", ",", "app", ")", ":", "if", "self", ".", "_applications", "is", "None", ":", "self", ".", "_initApplicationList", "(", ")", "return", "app", "in", "self", ".", "_applications" ]
Returns True if app is among the loaded modules. @param app: Module name. @return: Boolean
[ "Returns", "True", "if", "app", "is", "among", "the", "loaded", "modules", "." ]
python
train
29.3
pywbem/pywbem
wbemcli.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/wbemcli.py#L1533-L1619
def irip(ip, rc=None, r=None, fl=None, fs=None, ot=None, coe=None, moc=DEFAULT_ITER_MAXOBJECTCOUNT): # pylint: disable=too-many-arguments, redefined-outer-name, invalid-name """ *New in pywbem 0.10 as experimental and finalized in 0.12.* This function is a wrapper for :meth:`~pywbem.WBEMCo...
[ "def", "irip", "(", "ip", ",", "rc", "=", "None", ",", "r", "=", "None", ",", "fl", "=", "None", ",", "fs", "=", "None", ",", "ot", "=", "None", ",", "coe", "=", "None", ",", "moc", "=", "DEFAULT_ITER_MAXOBJECTCOUNT", ")", ":", "# pylint: disable=t...
*New in pywbem 0.10 as experimental and finalized in 0.12.* This function is a wrapper for :meth:`~pywbem.WBEMConnection.IterReferenceInstancePaths`. Retrieve the instance paths of the association instances that reference a source instance, using the corresponding pull operations if supported by t...
[ "*", "New", "in", "pywbem", "0", ".", "10", "as", "experimental", "and", "finalized", "in", "0", ".", "12", ".", "*" ]
python
train
37.218391
idlesign/django-sitegate
sitegate/templatetags/sitegate.py
https://github.com/idlesign/django-sitegate/blob/0e58de91605071833d75a7c21f2d0de2f2e3c896/sitegate/templatetags/sitegate.py#L47-L61
def tag_builder(parser, token, cls, flow_type): """Helper function handling flow form tags.""" tokens = token.split_contents() tokens_num = len(tokens) if tokens_num == 1 or (tokens_num == 3 and tokens[1] == 'for'): flow_name = None if tokens_num == 3: flow_name = tokens[2] ...
[ "def", "tag_builder", "(", "parser", ",", "token", ",", "cls", ",", "flow_type", ")", ":", "tokens", "=", "token", ".", "split_contents", "(", ")", "tokens_num", "=", "len", "(", "tokens", ")", "if", "tokens_num", "==", "1", "or", "(", "tokens_num", "=...
Helper function handling flow form tags.
[ "Helper", "function", "handling", "flow", "form", "tags", "." ]
python
train
40.4
phoikoi/sisy
src/sisy/models.py
https://github.com/phoikoi/sisy/blob/840c5463ab65488d34e99531f230e61f755d2d69/src/sisy/models.py#L295-L311
def run_iterations(cls, the_callable, iterations=1, label=None, schedule='* * * * * *', userdata = None, run_immediately=False, delay_until=None): """Class method to run a callable with a specified number of iterations""" task = task_with_callable(the_callable, label=label, schedule=schedule, userdata=u...
[ "def", "run_iterations", "(", "cls", ",", "the_callable", ",", "iterations", "=", "1", ",", "label", "=", "None", ",", "schedule", "=", "'* * * * * *'", ",", "userdata", "=", "None", ",", "run_immediately", "=", "False", ",", "delay_until", "=", "None", ")...
Class method to run a callable with a specified number of iterations
[ "Class", "method", "to", "run", "a", "callable", "with", "a", "specified", "number", "of", "iterations" ]
python
test
51.647059
wbond/certbuilder
certbuilder/__init__.py
https://github.com/wbond/certbuilder/blob/969dae884fa7f73988bbf1dcbec4fb51e234a3c5/certbuilder/__init__.py#L195-L208
def begin_date(self, value): """ A datetime.datetime object of when the certificate becomes valid. """ if not isinstance(value, datetime): raise TypeError(_pretty_message( ''' begin_date must be an instance of datetime.datetime, not %s ...
[ "def", "begin_date", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "datetime", ")", ":", "raise", "TypeError", "(", "_pretty_message", "(", "'''\n begin_date must be an instance of datetime.datetime, not %s\n ...
A datetime.datetime object of when the certificate becomes valid.
[ "A", "datetime", ".", "datetime", "object", "of", "when", "the", "certificate", "becomes", "valid", "." ]
python
train
28.785714
ejhigson/nestcheck
nestcheck/io_utils.py
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/io_utils.py#L146-L164
def pickle_load(name, extension='.pkl'): """Load data with pickle. Parameters ---------- name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. Returns ------- Contents of file path. """ filename = name + extension...
[ "def", "pickle_load", "(", "name", ",", "extension", "=", "'.pkl'", ")", ":", "filename", "=", "name", "+", "extension", "infile", "=", "open", "(", "filename", ",", "'rb'", ")", "data", "=", "pickle", ".", "load", "(", "infile", ")", "infile", ".", ...
Load data with pickle. Parameters ---------- name: str Path to save to (includes dir, excludes extension). extension: str, optional File extension. Returns ------- Contents of file path.
[ "Load", "data", "with", "pickle", "." ]
python
train
21.157895
abilian/abilian-core
abilian/web/jinja.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/web/jinja.py#L84-L91
def jinja_loader(self): """Search templates in custom app templates dir (default Flask behaviour), fallback on abilian templates.""" loaders = self._jinja_loaders del self._jinja_loaders loaders.append(Flask.jinja_loader.func(self)) loaders.reverse() return jinja2...
[ "def", "jinja_loader", "(", "self", ")", ":", "loaders", "=", "self", ".", "_jinja_loaders", "del", "self", ".", "_jinja_loaders", "loaders", ".", "append", "(", "Flask", ".", "jinja_loader", ".", "func", "(", "self", ")", ")", "loaders", ".", "reverse", ...
Search templates in custom app templates dir (default Flask behaviour), fallback on abilian templates.
[ "Search", "templates", "in", "custom", "app", "templates", "dir", "(", "default", "Flask", "behaviour", ")", "fallback", "on", "abilian", "templates", "." ]
python
train
41.875
RedHatQE/python-stitches
stitches/expect.py
https://github.com/RedHatQE/python-stitches/blob/957e9895e64ffd3b8157b38b9cce414969509288/stitches/expect.py#L153-L176
def ping_pong(connection, command, strexp, timeout=10): ''' Enter a command and wait for something to happen (enter + expect combined) @param connection: connection to the host @type connection: L{Connection} @param command: command to execute @type command: str...
[ "def", "ping_pong", "(", "connection", ",", "command", ",", "strexp", ",", "timeout", "=", "10", ")", ":", "Expect", ".", "enter", "(", "connection", ",", "command", ")", "return", "Expect", ".", "expect", "(", "connection", ",", "strexp", ",", "timeout"...
Enter a command and wait for something to happen (enter + expect combined) @param connection: connection to the host @type connection: L{Connection} @param command: command to execute @type command: str @param strexp: string to convert to expression (.*string.*) ...
[ "Enter", "a", "command", "and", "wait", "for", "something", "to", "happen", "(", "enter", "+", "expect", "combined", ")" ]
python
train
28.5
cackharot/suds-py3
suds/mx/basic.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/mx/basic.py#L33-L47
def process(self, value, tag=None): """ Process (marshal) the tag with the specified value using the optional type information. @param value: The value (content) of the XML node. @type value: (L{Object}|any) @param tag: The (optional) tag name for the value. The default ...
[ "def", "process", "(", "self", ",", "value", ",", "tag", "=", "None", ")", ":", "content", "=", "Content", "(", "tag", "=", "tag", ",", "value", "=", "value", ")", "result", "=", "Core", ".", "process", "(", "self", ",", "content", ")", "return", ...
Process (marshal) the tag with the specified value using the optional type information. @param value: The value (content) of the XML node. @type value: (L{Object}|any) @param tag: The (optional) tag name for the value. The default is value.__class__.__name__ @type ta...
[ "Process", "(", "marshal", ")", "the", "tag", "with", "the", "specified", "value", "using", "the", "optional", "type", "information", "." ]
python
train
36.8
IdentityPython/pysaml2
src/saml2/mdbcache.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/mdbcache.py#L140-L151
def entities(self, subject_id): """ Returns all the entities of assertions for a subject, disregarding whether the assertion still is valid or not. :param subject_id: The identifier of the subject :return: A possibly empty list of entity identifiers """ try: ...
[ "def", "entities", "(", "self", ",", "subject_id", ")", ":", "try", ":", "return", "[", "i", "[", "\"entity_id\"", "]", "for", "i", "in", "self", ".", "_cache", ".", "find", "(", "{", "\"subject_id\"", ":", "subject_id", "}", ")", "]", "except", "Val...
Returns all the entities of assertions for a subject, disregarding whether the assertion still is valid or not. :param subject_id: The identifier of the subject :return: A possibly empty list of entity identifiers
[ "Returns", "all", "the", "entities", "of", "assertions", "for", "a", "subject", "disregarding", "whether", "the", "assertion", "still", "is", "valid", "or", "not", "." ]
python
train
37.916667
Nukesor/pueue
pueue/daemon/daemon.py
https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/daemon.py#L346-L354
def reset_everything(self, payload): """Kill all processes, delete the queue and clean everything up.""" kill_signal = signals['9'] self.process_handler.kill_all(kill_signal, True) self.process_handler.wait_for_finish() self.reset = True answer = {'message': 'Resetting c...
[ "def", "reset_everything", "(", "self", ",", "payload", ")", ":", "kill_signal", "=", "signals", "[", "'9'", "]", "self", ".", "process_handler", ".", "kill_all", "(", "kill_signal", ",", "True", ")", "self", ".", "process_handler", ".", "wait_for_finish", "...
Kill all processes, delete the queue and clean everything up.
[ "Kill", "all", "processes", "delete", "the", "queue", "and", "clean", "everything", "up", "." ]
python
train
41
stefanfoulis/django-sendsms
sendsms/api.py
https://github.com/stefanfoulis/django-sendsms/blob/375f469789866853253eceba936ebcff98e83c07/sendsms/api.py#L31-L48
def send_mass_sms(datatuple, fail_silently=False, auth_user=None, auth_password=None, connection=None): """ Given a datatuple of (message, from_phone, to, flash), sends each message to each recipient list. :returns: the number of SMSs sent. """ from sendsms.message import SmsMessa...
[ "def", "send_mass_sms", "(", "datatuple", ",", "fail_silently", "=", "False", ",", "auth_user", "=", "None", ",", "auth_password", "=", "None", ",", "connection", "=", "None", ")", ":", "from", "sendsms", ".", "message", "import", "SmsMessage", "connection", ...
Given a datatuple of (message, from_phone, to, flash), sends each message to each recipient list. :returns: the number of SMSs sent.
[ "Given", "a", "datatuple", "of", "(", "message", "from_phone", "to", "flash", ")", "sends", "each", "message", "to", "each", "recipient", "list", "." ]
python
train
36.166667
andreikop/qutepart
qutepart/indenter/ruby.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L90-L96
def _isLastCodeColumn(self, block, column): """Return true if the given column is at least equal to the column that contains the last non-whitespace character at the given line, or if the rest of the line is a comment. """ return column >= self._lastColumn(block) or \ ...
[ "def", "_isLastCodeColumn", "(", "self", ",", "block", ",", "column", ")", ":", "return", "column", ">=", "self", ".", "_lastColumn", "(", "block", ")", "or", "self", ".", "_isComment", "(", "block", ",", "self", ".", "_nextNonSpaceColumn", "(", "block", ...
Return true if the given column is at least equal to the column that contains the last non-whitespace character at the given line, or if the rest of the line is a comment.
[ "Return", "true", "if", "the", "given", "column", "is", "at", "least", "equal", "to", "the", "column", "that", "contains", "the", "last", "non", "-", "whitespace", "character", "at", "the", "given", "line", "or", "if", "the", "rest", "of", "the", "line",...
python
train
55
basecrm/basecrm-python
basecrm/services.py
https://github.com/basecrm/basecrm-python/blob/7c1cf97dbaba8aeb9ff89f8a54f945a8702349f6/basecrm/services.py#L1764-L1778
def retrieve(self, id) : """ Retrieve a single tag Returns a single tag available to the user according to the unique ID provided If the specified tag does not exist, this query will return an error :calls: ``get /tags/{id}`` :param int id: Unique identifier of a Tag. ...
[ "def", "retrieve", "(", "self", ",", "id", ")", ":", "_", ",", "_", ",", "tag", "=", "self", ".", "http_client", ".", "get", "(", "\"/tags/{id}\"", ".", "format", "(", "id", "=", "id", ")", ")", "return", "tag" ]
Retrieve a single tag Returns a single tag available to the user according to the unique ID provided If the specified tag does not exist, this query will return an error :calls: ``get /tags/{id}`` :param int id: Unique identifier of a Tag. :return: Dictionary that support attri...
[ "Retrieve", "a", "single", "tag" ]
python
train
34.533333
ethereum/web3.py
web3/contract.py
https://github.com/ethereum/web3.py/blob/71b8bf03dc6d332dd97d8902a38ffab6f8b5a5ab/web3/contract.py#L1370-L1395
def transact_with_contract_function( address, web3, function_name=None, transaction=None, contract_abi=None, fn_abi=None, *args, **kwargs): """ Helper function for interacting with a contract function by sending a transaction. """ trans...
[ "def", "transact_with_contract_function", "(", "address", ",", "web3", ",", "function_name", "=", "None", ",", "transaction", "=", "None", ",", "contract_abi", "=", "None", ",", "fn_abi", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", ...
Helper function for interacting with a contract function by sending a transaction.
[ "Helper", "function", "for", "interacting", "with", "a", "contract", "function", "by", "sending", "a", "transaction", "." ]
python
train
24.192308
dmlc/gluon-nlp
scripts/question_answering/data_processing.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/question_answering/data_processing.py#L130-L142
def get_word_level_vocab(self): """Provides word level vocabulary Returns ------- Vocab Word level vocabulary """ def simple_tokenize(source_str, token_delim=' ', seq_delim='\n'): return list(filter(None, re.split(token_delim + '|' + seq_delim, s...
[ "def", "get_word_level_vocab", "(", "self", ")", ":", "def", "simple_tokenize", "(", "source_str", ",", "token_delim", "=", "' '", ",", "seq_delim", "=", "'\\n'", ")", ":", "return", "list", "(", "filter", "(", "None", ",", "re", ".", "split", "(", "toke...
Provides word level vocabulary Returns ------- Vocab Word level vocabulary
[ "Provides", "word", "level", "vocabulary" ]
python
train
30.923077
sbarham/dsrt
build/lib/dsrt/application/Application.py
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L69-L90
def corpus(self): '''Command to add a corpus to the dsrt library''' # Initialize the addcorpus subcommand's argparser description = '''The corpus subcommand has a number of subcommands of its own, including: list\t-\tlists all available corpora in dsrt's library add\t-\t...
[ "def", "corpus", "(", "self", ")", ":", "# Initialize the addcorpus subcommand's argparser", "description", "=", "'''The corpus subcommand has a number of subcommands of its own, including:\n list\\t-\\tlists all available corpora in dsrt's library\n add\\t-\\tadds a corpus t...
Command to add a corpus to the dsrt library
[ "Command", "to", "add", "a", "corpus", "to", "the", "dsrt", "library" ]
python
train
34.863636
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L320-L356
def process_input(self, stream, value, rpc_executor): """Process an input through this sensor graph. The tick information in value should be correct and is transfered to all results produced by nodes acting on this tick. Args: stream (DataStream): The stream the input is pa...
[ "def", "process_input", "(", "self", ",", "stream", ",", "value", ",", "rpc_executor", ")", ":", "self", ".", "sensor_log", ".", "push", "(", "stream", ",", "value", ")", "# FIXME: This should be specified in our device model", "if", "stream", ".", "important", ...
Process an input through this sensor graph. The tick information in value should be correct and is transfered to all results produced by nodes acting on this tick. Args: stream (DataStream): The stream the input is part of value (IOTileReading): The value to process ...
[ "Process", "an", "input", "through", "this", "sensor", "graph", "." ]
python
train
41.540541
cltk/cltk
cltk/corpus/sanskrit/itrans/langinfo.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/corpus/sanskrit/itrans/langinfo.py#L175-L180
def is_labial(c,lang): """ Is the character a labial """ o=get_offset(c,lang) return (o>=LABIAL_RANGE[0] and o<=LABIAL_RANGE[1])
[ "def", "is_labial", "(", "c", ",", "lang", ")", ":", "o", "=", "get_offset", "(", "c", ",", "lang", ")", "return", "(", "o", ">=", "LABIAL_RANGE", "[", "0", "]", "and", "o", "<=", "LABIAL_RANGE", "[", "1", "]", ")" ]
Is the character a labial
[ "Is", "the", "character", "a", "labial" ]
python
train
24
PGower/PyCanvas
pycanvas/apis/users.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/users.py#L808-L874
def edit_user(self, id, user_avatar_token=None, user_avatar_url=None, user_email=None, user_locale=None, user_name=None, user_short_name=None, user_sortable_name=None, user_time_zone=None): """ Edit a user. Modify an existing user. To modify a user's login, see the documentation for logins....
[ "def", "edit_user", "(", "self", ",", "id", ",", "user_avatar_token", "=", "None", ",", "user_avatar_url", "=", "None", ",", "user_email", "=", "None", ",", "user_locale", "=", "None", ",", "user_name", "=", "None", ",", "user_short_name", "=", "None", ","...
Edit a user. Modify an existing user. To modify a user's login, see the documentation for logins.
[ "Edit", "a", "user", ".", "Modify", "an", "existing", "user", ".", "To", "modify", "a", "user", "s", "login", "see", "the", "documentation", "for", "logins", "." ]
python
train
46.835821
Anaconda-Platform/anaconda-client
binstar_client/__init__.py
https://github.com/Anaconda-Platform/anaconda-client/blob/b276f0572744c73c184a8b43a897cfa7fc1dc523/binstar_client/__init__.py#L497-L562
def upload(self, login, package_name, release, basename, fd, distribution_type, description='', md5=None, size=None, dependencies=None, attrs=None, channels=('main',), callback=None): ''' Upload a new distribution to a package release. :param login: the login of the package owner...
[ "def", "upload", "(", "self", ",", "login", ",", "package_name", ",", "release", ",", "basename", ",", "fd", ",", "distribution_type", ",", "description", "=", "''", ",", "md5", "=", "None", ",", "size", "=", "None", ",", "dependencies", "=", "None", "...
Upload a new distribution to a package release. :param login: the login of the package owner :param package_name: the name of the package :param version: the version string of the release :param basename: the basename of the distribution to download :param fd: a file like object...
[ "Upload", "a", "new", "distribution", "to", "a", "package", "release", "." ]
python
train
40.257576
mapbox/rio-mucho
riomucho/utils.py
https://github.com/mapbox/rio-mucho/blob/b2267bda2a7ac8557c9328742aeaab6adc825315/riomucho/utils.py#L14-L17
def getWindows(input): """Get a source's windows""" with rasterio.open(input) as src: return [[window, ij] for ij, window in src.block_windows()]
[ "def", "getWindows", "(", "input", ")", ":", "with", "rasterio", ".", "open", "(", "input", ")", "as", "src", ":", "return", "[", "[", "window", ",", "ij", "]", "for", "ij", ",", "window", "in", "src", ".", "block_windows", "(", ")", "]" ]
Get a source's windows
[ "Get", "a", "source", "s", "windows" ]
python
train
39.5
pandas-dev/pandas
pandas/core/frame.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/frame.py#L1117-L1170
def to_numpy(self, dtype=None, copy=False): """ Convert the DataFrame to a NumPy array. .. versionadded:: 0.24.0 By default, the dtype of the returned array will be the common NumPy dtype of all types in the DataFrame. For example, if the dtypes are ``float16`` and ``fl...
[ "def", "to_numpy", "(", "self", ",", "dtype", "=", "None", ",", "copy", "=", "False", ")", ":", "result", "=", "np", ".", "array", "(", "self", ".", "values", ",", "dtype", "=", "dtype", ",", "copy", "=", "copy", ")", "return", "result" ]
Convert the DataFrame to a NumPy array. .. versionadded:: 0.24.0 By default, the dtype of the returned array will be the common NumPy dtype of all types in the DataFrame. For example, if the dtypes are ``float16`` and ``float32``, the results dtype will be ``float32``. This may...
[ "Convert", "the", "DataFrame", "to", "a", "NumPy", "array", "." ]
python
train
33.203704
knagra/farnsworth
managers/views.py
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/managers/views.py#L459-L557
def request_view(request, request_pk): ''' The view of a single request. ''' if request.is_ajax(): if not request.user.is_authenticated(): return HttpResponse(json.dumps(dict()), content_type="application/json") try: relevant_reque...
[ "def", "request_view", "(", "request", ",", "request_pk", ")", ":", "if", "request", ".", "is_ajax", "(", ")", ":", "if", "not", "request", ".", "user", ".", "is_authenticated", "(", ")", ":", "return", "HttpResponse", "(", "json", ".", "dumps", "(", "...
The view of a single request.
[ "The", "view", "of", "a", "single", "request", "." ]
python
train
40.515152
cdgriffith/Reusables
reusables/file_operations.py
https://github.com/cdgriffith/Reusables/blob/bc32f72e4baee7d76a6d58b88fcb23dd635155cd/reusables/file_operations.py#L35-L92
def extract(archive_file, path=".", delete_on_success=False, enable_rar=False): """ Automatically detect archive type and extract all files to specified path. .. code:: python import os os.listdir(".") # ['test_structure.zip'] reusables.extract("test_structure...
[ "def", "extract", "(", "archive_file", ",", "path", "=", "\".\"", ",", "delete_on_success", "=", "False", ",", "enable_rar", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "archive_file", ")", "or", "not", "os", ".", "path"...
Automatically detect archive type and extract all files to specified path. .. code:: python import os os.listdir(".") # ['test_structure.zip'] reusables.extract("test_structure.zip") os.listdir(".") # [ 'test_structure', 'test_structure.zip'] :param archive...
[ "Automatically", "detect", "archive", "type", "and", "extract", "all", "files", "to", "specified", "path", "." ]
python
train
31.034483
saltstack/salt
salt/transport/tcp.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/tcp.py#L1479-L1520
def publish(self, load): ''' Publish "load" to minions ''' payload = {'enc': 'aes'} crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster.secrets['aes']['secret'].value) payload['load'] = crypticle.dumps(load) if self.opts['sign_pub_messages']: ...
[ "def", "publish", "(", "self", ",", "load", ")", ":", "payload", "=", "{", "'enc'", ":", "'aes'", "}", "crypticle", "=", "salt", ".", "crypt", ".", "Crypticle", "(", "self", ".", "opts", ",", "salt", ".", "master", ".", "SMaster", ".", "secrets", "...
Publish "load" to minions
[ "Publish", "load", "to", "minions" ]
python
train
43.571429
sdispater/pendulum
pendulum/tz/timezone.py
https://github.com/sdispater/pendulum/blob/94d28b0d3cb524ae02361bd1ed7ea03e2e655e4e/pendulum/tz/timezone.py#L68-L82
def datetime( self, year, month, day, hour=0, minute=0, second=0, microsecond=0 ): # type: (int, int, int, int, int, int, int) -> datetime """ Return a normalized datetime for the current timezone. """ if _HAS_FOLD: return self.convert( datetime(y...
[ "def", "datetime", "(", "self", ",", "year", ",", "month", ",", "day", ",", "hour", "=", "0", ",", "minute", "=", "0", ",", "second", "=", "0", ",", "microsecond", "=", "0", ")", ":", "# type: (int, int, int, int, int, int, int) -> datetime", "if", "_HAS_F...
Return a normalized datetime for the current timezone.
[ "Return", "a", "normalized", "datetime", "for", "the", "current", "timezone", "." ]
python
train
35.466667
ANTsX/ANTsPy
ants/core/ants_transform_io.py
https://github.com/ANTsX/ANTsPy/blob/638020af2cdfc5ff4bdb9809ffe67aa505727a3b/ants/core/ants_transform_io.py#L38-L187
def create_ants_transform(transform_type='AffineTransform', precision='float', dimension=3, matrix=None, offset=None, center=None, translation=None, ...
[ "def", "create_ants_transform", "(", "transform_type", "=", "'AffineTransform'", ",", "precision", "=", "'float'", ",", "dimension", "=", "3", ",", "matrix", "=", "None", ",", "offset", "=", "None", ",", "center", "=", "None", ",", "translation", "=", "None"...
Create and initialize an ANTsTransform ANTsR function: `createAntsrTransform` Arguments --------- transform_type : string type of transform(s) precision : string numerical precision dimension : integer spatial dimension of transform matrix : ndarra...
[ "Create", "and", "initialize", "an", "ANTsTransform" ]
python
train
33.973333
rfk/threading2
threading2/t2_base.py
https://github.com/rfk/threading2/blob/7ec234ddd8c0d7e683b1a5c4a79a3d001143189f/threading2/t2_base.py#L39-L68
def acquire(self,blocking=True,timeout=None): """Attempt to acquire this lock. If the optional argument "blocking" is True and "timeout" is None, this methods blocks until is successfully acquires the lock. If "blocking" is False, it returns immediately if the lock could not be...
[ "def", "acquire", "(", "self", ",", "blocking", "=", "True", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "None", ":", "return", "self", ".", "__lock", ".", "acquire", "(", "blocking", ")", "else", ":", "# Simulated timeout using progress...
Attempt to acquire this lock. If the optional argument "blocking" is True and "timeout" is None, this methods blocks until is successfully acquires the lock. If "blocking" is False, it returns immediately if the lock could not be acquired. Otherwise, it blocks for at most "timeout" se...
[ "Attempt", "to", "acquire", "this", "lock", "." ]
python
train
45.9
juju/charm-helpers
charmhelpers/core/services/helpers.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/services/helpers.py#L86-L121
def get_data(self): """ Retrieve the relation data for each unit involved in a relation and, if complete, store it in a list under `self[self.name]`. This is automatically called when the RelationContext is instantiated. The units are sorted lexographically first by the service...
[ "def", "get_data", "(", "self", ")", ":", "if", "not", "hookenv", ".", "relation_ids", "(", "self", ".", "name", ")", ":", "return", "ns", "=", "self", ".", "setdefault", "(", "self", ".", "name", ",", "[", "]", ")", "for", "rid", "in", "sorted", ...
Retrieve the relation data for each unit involved in a relation and, if complete, store it in a list under `self[self.name]`. This is automatically called when the RelationContext is instantiated. The units are sorted lexographically first by the service ID, then by the unit ID. Thus,...
[ "Retrieve", "the", "relation", "data", "for", "each", "unit", "involved", "in", "a", "relation", "and", "if", "complete", "store", "it", "in", "a", "list", "under", "self", "[", "self", ".", "name", "]", ".", "This", "is", "automatically", "called", "whe...
python
train
47.555556
awacha/sastool
sastool/fitting/fitfunctions/saspolymer.py
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/saspolymer.py#L71-L104
def BorueErukhimovich_Powerlaw(q, C, r0, s, t, nu): """Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensi...
[ "def", "BorueErukhimovich_Powerlaw", "(", "q", ",", "C", ",", "r0", ",", "s", ",", "t", ",", "nu", ")", ":", "def", "get_xsep", "(", "alpha", ",", "s", ",", "t", ")", ":", "A", "=", "alpha", "+", "2", "B", "=", "2", "*", "s", "*", "alpha", ...
Borue-Erukhimovich model ending in a power-law. Inputs: ------- ``q``: independent variable ``C``: scaling factor ``r0``: typical el.stat. screening length ``s``: dimensionless charge concentration ``t``: dimensionless temperature ``nu``: excluded volume paramete...
[ "Borue", "-", "Erukhimovich", "model", "ending", "in", "a", "power", "-", "law", "." ]
python
train
39.264706
saltstack/salt
salt/states/grafana.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana.py#L372-L416
def dashboard_absent( name, hosts=None, profile='grafana'): ''' Ensure the named grafana dashboard is deleted. name Name of the grafana dashboard. profile A pillar key or dict that contains a list of hosts and an elasticsearch index to use. ''' r...
[ "def", "dashboard_absent", "(", "name", ",", "hosts", "=", "None", ",", "profile", "=", "'grafana'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", ...
Ensure the named grafana dashboard is deleted. name Name of the grafana dashboard. profile A pillar key or dict that contains a list of hosts and an elasticsearch index to use.
[ "Ensure", "the", "named", "grafana", "dashboard", "is", "deleted", "." ]
python
train
28.666667
Azure/azure-cosmos-python
azure/cosmos/cosmos_client.py
https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1620-L1655
def ReplaceItem(self, document_link, new_document, options=None): """Replaces a document and returns it. :param str document_link: The link to the document. :param dict new_document: :param dict options: The request options for the request. :return: ...
[ "def", "ReplaceItem", "(", "self", ",", "document_link", ",", "new_document", ",", "options", "=", "None", ")", ":", "CosmosClient", ".", "__ValidateResource", "(", "new_document", ")", "path", "=", "base", ".", "GetPathFromLink", "(", "document_link", ")", "d...
Replaces a document and returns it. :param str document_link: The link to the document. :param dict new_document: :param dict options: The request options for the request. :return: The new Document. :rtype: dict
[ "Replaces", "a", "document", "and", "returns", "it", "." ]
python
train
45.305556
tanghaibao/jcvi
jcvi/formats/gff.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/gff.py#L978-L1056
def filter(args): """ %prog filter gffile > filtered.gff Filter the gff file based on criteria below: (1) feature attribute values: [Identity, Coverage]. You can get this type of gff by using gmap $ gmap -f 2 .... (2) Total bp length of child features """ p = OptionParser(filter.__...
[ "def", "filter", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "filter", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--type\"", ",", "default", "=", "\"mRNA\"", ",", "help", "=", "\"The feature to scan for the attributes [default: %default]\"", ...
%prog filter gffile > filtered.gff Filter the gff file based on criteria below: (1) feature attribute values: [Identity, Coverage]. You can get this type of gff by using gmap $ gmap -f 2 .... (2) Total bp length of child features
[ "%prog", "filter", "gffile", ">", "filtered", ".", "gff" ]
python
train
38.367089
facetoe/zenpy
zenpy/lib/api.py
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api.py#L160-L189
def _ratelimit(self, http_method, url, **kwargs): """ Ensure we do not hit the rate limit. """ def time_since_last_call(): if self.callsafety['lastcalltime'] is not None: return int(time() - self.callsafety['lastcalltime']) else: return None ...
[ "def", "_ratelimit", "(", "self", ",", "http_method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "def", "time_since_last_call", "(", ")", ":", "if", "self", ".", "callsafety", "[", "'lastcalltime'", "]", "is", "not", "None", ":", "return", "int", "...
Ensure we do not hit the rate limit.
[ "Ensure", "we", "do", "not", "hit", "the", "rate", "limit", "." ]
python
train
48.3
tensorflow/tensor2tensor
tensor2tensor/utils/data_reader.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/data_reader.py#L194-L218
def pad_for_tpu(shapes_dict, hparams, max_length): """Pads unknown features' dimensions for TPU.""" padded_shapes = {} def get_filler(specified_max_length): if not specified_max_length: return max_length return min(specified_max_length, max_length) inputs_none_filler = get_filler(hparams.max_inp...
[ "def", "pad_for_tpu", "(", "shapes_dict", ",", "hparams", ",", "max_length", ")", ":", "padded_shapes", "=", "{", "}", "def", "get_filler", "(", "specified_max_length", ")", ":", "if", "not", "specified_max_length", ":", "return", "max_length", "return", "min", ...
Pads unknown features' dimensions for TPU.
[ "Pads", "unknown", "features", "dimensions", "for", "TPU", "." ]
python
train
33.76
ponty/eagexp
eagexp/cmd.py
https://github.com/ponty/eagexp/blob/1dd5108c1d8112cc87d1bda64fa6c2784ccf0ff2/eagexp/cmd.py#L20-L35
def accept_freeware_license(): '''different Eagle versions need differnt TAB count. 6.5 -> 2 6.6 -> 3 7.4 -> 2 ''' ntab = 3 if version().startswith('6.6.') else 2 for _ in range(ntab): EasyProcess('xdotool key KP_Tab').call() time.sleep(0.5) EasyProcess('xdotool key KP...
[ "def", "accept_freeware_license", "(", ")", ":", "ntab", "=", "3", "if", "version", "(", ")", ".", "startswith", "(", "'6.6.'", ")", "else", "2", "for", "_", "in", "range", "(", "ntab", ")", ":", "EasyProcess", "(", "'xdotool key KP_Tab'", ")", ".", "c...
different Eagle versions need differnt TAB count. 6.5 -> 2 6.6 -> 3 7.4 -> 2
[ "different", "Eagle", "versions", "need", "differnt", "TAB", "count", ".", "6", ".", "5", "-", ">", "2", "6", ".", "6", "-", ">", "3", "7", ".", "4", "-", ">", "2" ]
python
train
26.6875
joke2k/django-environ
environ/environ.py
https://github.com/joke2k/django-environ/blob/c2620021614557abe197578f99deeef42af3e082/environ/environ.py#L687-L694
def path(self, *paths, **kwargs): """Create new Path based on self.root and provided paths. :param paths: List of sub paths :param kwargs: required=False :rtype: Path """ return self.__class__(self.__root__, *paths, **kwargs)
[ "def", "path", "(", "self", ",", "*", "paths", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "__root__", ",", "*", "paths", ",", "*", "*", "kwargs", ")" ]
Create new Path based on self.root and provided paths. :param paths: List of sub paths :param kwargs: required=False :rtype: Path
[ "Create", "new", "Path", "based", "on", "self", ".", "root", "and", "provided", "paths", "." ]
python
train
33.375
merll/docker-map
dockermap/shortcuts.py
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/shortcuts.py#L78-L94
def get_user_group(user_group): """ Formats a user and group in the format ``user:group``, as needed for `chown`. If user_group is a tuple, this is used for the fomatting. If a string or integer is given, it will be formatted as ``user:user``. Otherwise the input is returned - this method does not perfo...
[ "def", "get_user_group", "(", "user_group", ")", ":", "if", "isinstance", "(", "user_group", ",", "tuple", ")", ":", "return", "'{0}:{1}'", ".", "format", "(", "*", "user_group", ")", "elif", "isinstance", "(", "user_group", ",", "six", ".", "integer_types",...
Formats a user and group in the format ``user:group``, as needed for `chown`. If user_group is a tuple, this is used for the fomatting. If a string or integer is given, it will be formatted as ``user:user``. Otherwise the input is returned - this method does not perform any more checks. :param user_group: ...
[ "Formats", "a", "user", "and", "group", "in", "the", "format", "user", ":", "group", "as", "needed", "for", "chown", ".", "If", "user_group", "is", "a", "tuple", "this", "is", "used", "for", "the", "fomatting", ".", "If", "a", "string", "or", "integer"...
python
train
49.529412
OnroerendErfgoed/crabpy
crabpy/gateway/capakey.py
https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/capakey.py#L26-L50
def capakey_rest_gateway_request(url, headers={}, params={}): ''' Utility function that helps making requests to the CAPAKEY REST service. :param string url: URL to request. :param dict headers: Headers to send with the URL. :param dict params: Parameters to send with the URL. :returns: Result ...
[ "def", "capakey_rest_gateway_request", "(", "url", ",", "headers", "=", "{", "}", ",", "params", "=", "{", "}", ")", ":", "try", ":", "res", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "headers", ",", "params", "=", "params", ")", ...
Utility function that helps making requests to the CAPAKEY REST service. :param string url: URL to request. :param dict headers: Headers to send with the URL. :param dict params: Parameters to send with the URL. :returns: Result of the call.
[ "Utility", "function", "that", "helps", "making", "requests", "to", "the", "CAPAKEY", "REST", "service", "." ]
python
train
35.52
polyaxon/polyaxon
polyaxon/docker_images/image_info.py
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/docker_images/image_info.py#L22-L32
def get_job_image_info(project: 'Project', job: Any) -> Tuple[str, str]: """Return the image name and image tag for a job""" project_name = project.name repo_name = project_name image_name = '{}/{}'.format(conf.get('REGISTRY_URI'), repo_name) try: last_commit = project.repo.last_commit ...
[ "def", "get_job_image_info", "(", "project", ":", "'Project'", ",", "job", ":", "Any", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "project_name", "=", "project", ".", "name", "repo_name", "=", "project_name", "image_name", "=", "'{}/{}'", ".", ...
Return the image name and image tag for a job
[ "Return", "the", "image", "name", "and", "image", "tag", "for", "a", "job" ]
python
train
40.636364
sassoo/goldman
goldman/middleware/deserializer/__init__.py
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/middleware/deserializer/__init__.py#L44-L62
def process_resource(self, req, resp, resource): """ Process the request after routing. Deserializer selection needs a resource to determine which deserializers are allowed. If a deserializer is required then it will be initialized & added to the request object for further proce...
[ "def", "process_resource", "(", "self", ",", "req", ",", "resp", ",", "resource", ")", ":", "if", "req", ".", "content_required", "and", "resource", ":", "allowed", "=", "resource", ".", "deserializer_mimetypes", "if", "req", ".", "content_length", "in", "("...
Process the request after routing. Deserializer selection needs a resource to determine which deserializers are allowed. If a deserializer is required then it will be initialized & added to the request object for further processing.
[ "Process", "the", "request", "after", "routing", "." ]
python
train
40.210526
alexa/alexa-skills-kit-sdk-for-python
ask-sdk-webservice-support/ask_sdk_webservice_support/verifier.py
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/097b6406aa12d5ca0b825b00c936861b530cbf39/ask-sdk-webservice-support/ask_sdk_webservice_support/verifier.py#L200-L218
def _retrieve_and_validate_certificate_chain(self, cert_url): # type: (str) -> Certificate """Retrieve and validate certificate chain. This method validates if the URL is valid and loads and validates the certificate chain, before returning it. :param cert_url: URL for retrievi...
[ "def", "_retrieve_and_validate_certificate_chain", "(", "self", ",", "cert_url", ")", ":", "# type: (str) -> Certificate", "self", ".", "_validate_certificate_url", "(", "cert_url", ")", "cert_chain", "=", "self", ".", "_load_cert_chain", "(", "cert_url", ")", "self", ...
Retrieve and validate certificate chain. This method validates if the URL is valid and loads and validates the certificate chain, before returning it. :param cert_url: URL for retrieving certificate chain :type cert_url: str :return The certificate chain loaded from the URL ...
[ "Retrieve", "and", "validate", "certificate", "chain", "." ]
python
train
40.473684
adrn/gala
gala/potential/common.py
https://github.com/adrn/gala/blob/ea95575a0df1581bb4b0986aebd6eea8438ab7eb/gala/potential/common.py#L60-L66
def _get_c_valid_arr(self, x): """ Warning! Interpretation of axes is different for C code. """ orig_shape = x.shape x = np.ascontiguousarray(x.reshape(orig_shape[0], -1).T) return orig_shape, x
[ "def", "_get_c_valid_arr", "(", "self", ",", "x", ")", ":", "orig_shape", "=", "x", ".", "shape", "x", "=", "np", ".", "ascontiguousarray", "(", "x", ".", "reshape", "(", "orig_shape", "[", "0", "]", ",", "-", "1", ")", ".", "T", ")", "return", "...
Warning! Interpretation of axes is different for C code.
[ "Warning!", "Interpretation", "of", "axes", "is", "different", "for", "C", "code", "." ]
python
train
33.714286
pybel/pybel-tools
src/pybel_tools/utils.py
https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/utils.py#L162-L171
def barh(d, plt, title=None): """A convenience function for plotting a horizontal bar plot from a Counter""" labels = sorted(d, key=d.get) index = range(len(labels)) plt.yticks(index, labels) plt.barh(index, [d[v] for v in labels]) if title is not None: plt.title(title)
[ "def", "barh", "(", "d", ",", "plt", ",", "title", "=", "None", ")", ":", "labels", "=", "sorted", "(", "d", ",", "key", "=", "d", ".", "get", ")", "index", "=", "range", "(", "len", "(", "labels", ")", ")", "plt", ".", "yticks", "(", "index"...
A convenience function for plotting a horizontal bar plot from a Counter
[ "A", "convenience", "function", "for", "plotting", "a", "horizontal", "bar", "plot", "from", "a", "Counter" ]
python
valid
29.5
Dallinger/Dallinger
dallinger/experiment_server/experiment_server.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/experiment_server/experiment_server.py#L1315-L1336
def tracking_event_post(node_id): """Enqueue a TrackingEvent worker for the specified Node. """ details = request_parameter(parameter="details", optional=True) if details: details = loads(details) # check the node exists node = models.Node.query.get(node_id) if node is None: ...
[ "def", "tracking_event_post", "(", "node_id", ")", ":", "details", "=", "request_parameter", "(", "parameter", "=", "\"details\"", ",", "optional", "=", "True", ")", "if", "details", ":", "details", "=", "loads", "(", "details", ")", "# check the node exists", ...
Enqueue a TrackingEvent worker for the specified Node.
[ "Enqueue", "a", "TrackingEvent", "worker", "for", "the", "specified", "Node", "." ]
python
train
29.818182
biocommons/hgvs
hgvs/utils/altseqbuilder.py
https://github.com/biocommons/hgvs/blob/4d16efb475e1802b2531a2f1c373e8819d8e533b/hgvs/utils/altseqbuilder.py#L295-L331
def _setup_incorporate(self): """Helper to setup incorporate functions :return (transcript sequence, cds start [1-based], cds stop [1-based], cds start index in seq [inc, 0-based], cds end index in seq [excl, 0-based]) :rtype (list, int, int, int, int) """ seq = list(self...
[ "def", "_setup_incorporate", "(", "self", ")", ":", "seq", "=", "list", "(", "self", ".", "_transcript_data", ".", "transcript_sequence", ")", "# get initial start/end points; will modify these based on the variant length", "cds_start", "=", "self", ".", "_transcript_data",...
Helper to setup incorporate functions :return (transcript sequence, cds start [1-based], cds stop [1-based], cds start index in seq [inc, 0-based], cds end index in seq [excl, 0-based]) :rtype (list, int, int, int, int)
[ "Helper", "to", "setup", "incorporate", "functions", ":", "return", "(", "transcript", "sequence", "cds", "start", "[", "1", "-", "based", "]", "cds", "stop", "[", "1", "-", "based", "]", "cds", "start", "index", "in", "seq", "[", "inc", "0", "-", "b...
python
train
42.837838
qntm/greenery
greenery/lego.py
https://github.com/qntm/greenery/blob/f4dc7fb483825459d26e8fe9f417764469c56ee8/greenery/lego.py#L1571-L1598
def dock(self, other): ''' Subtract another conc from this one. This is the opposite of concatenation. For example, if ABC + DEF = ABCDEF, then logically ABCDEF - DEF = ABC. ''' # e.g. self has mults at indices [0, 1, 2, 3, 4, 5, 6] len=7 # e.g. other has mults at indices [0, 1, 2] len=3 new = list(...
[ "def", "dock", "(", "self", ",", "other", ")", ":", "# e.g. self has mults at indices [0, 1, 2, 3, 4, 5, 6] len=7", "# e.g. other has mults at indices [0, 1, 2] len=3", "new", "=", "list", "(", "self", ".", "mults", ")", "for", "i", "in", "reversed", "(", "range", "("...
Subtract another conc from this one. This is the opposite of concatenation. For example, if ABC + DEF = ABCDEF, then logically ABCDEF - DEF = ABC.
[ "Subtract", "another", "conc", "from", "this", "one", ".", "This", "is", "the", "opposite", "of", "concatenation", ".", "For", "example", "if", "ABC", "+", "DEF", "=", "ABCDEF", "then", "logically", "ABCDEF", "-", "DEF", "=", "ABC", "." ]
python
train
34.571429
ValvePython/steam
steam/client/builtins/leaderboards.py
https://github.com/ValvePython/steam/blob/2de1364c47598410b572114e6129eab8fff71d5b/steam/client/builtins/leaderboards.py#L102-L137
def get_entries(self, start=0, end=0, data_request=None, steam_ids=None): """Get leaderboard entries. :param start: start entry, not index (e.g. rank 1 is ``start=1``) :type start: :class:`int` :param end: end entry, not index (e.g. only one entry then ``start=1,end=1``) :type e...
[ "def", "get_entries", "(", "self", ",", "start", "=", "0", ",", "end", "=", "0", ",", "data_request", "=", "None", ",", "steam_ids", "=", "None", ")", ":", "message", "=", "MsgProto", "(", "EMsg", ".", "ClientLBSGetLBEntries", ")", "message", ".", "bod...
Get leaderboard entries. :param start: start entry, not index (e.g. rank 1 is ``start=1``) :type start: :class:`int` :param end: end entry, not index (e.g. only one entry then ``start=1,end=1``) :type end: :class:`int` :param data_request: data being requested :type data...
[ "Get", "leaderboard", "entries", "." ]
python
train
43.166667
political-memory/django-representatives
representatives/contrib/francedata/import_representatives.py
https://github.com/political-memory/django-representatives/blob/811c90d0250149e913e6196f0ab11c97d396be39/representatives/contrib/francedata/import_representatives.py#L218-L270
def add_mandates(self, representative, rep_json): ''' Create mandates from rep data based on variant configuration ''' # Mandate in country group for party constituency if rep_json.get('parti_ratt_financier'): constituency, _ = Constituency.objects.get_or_create( ...
[ "def", "add_mandates", "(", "self", ",", "representative", ",", "rep_json", ")", ":", "# Mandate in country group for party constituency", "if", "rep_json", ".", "get", "(", "'parti_ratt_financier'", ")", ":", "constituency", ",", "_", "=", "Constituency", ".", "obj...
Create mandates from rep data based on variant configuration
[ "Create", "mandates", "from", "rep", "data", "based", "on", "variant", "configuration" ]
python
train
40.037736
saltstack/salt
salt/cache/localfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L103-L118
def updated(bank, key, cachedir): ''' Return the epoch of the mtime for this cache file ''' key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key)) if not os.path.isfile(key_file): log.warning('Cache file "%s" does not exist', key_file) return None try: ...
[ "def", "updated", "(", "bank", ",", "key", ",", "cachedir", ")", ":", "key_file", "=", "os", ".", "path", ".", "join", "(", "cachedir", ",", "os", ".", "path", ".", "normpath", "(", "bank", ")", ",", "'{0}.p'", ".", "format", "(", "key", ")", ")"...
Return the epoch of the mtime for this cache file
[ "Return", "the", "epoch", "of", "the", "mtime", "for", "this", "cache", "file" ]
python
train
33.3125
LuminosoInsight/luminoso-api-client-python
luminoso_api/v4_client.py
https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_client.py#L412-L419
def upload(self, path, docs, **params): """ A convenience method for uploading a set of dictionaries representing documents. You still need to specify the URL to upload to, which will look like ROOT_URL/projects/myaccount/project_id/docs. """ json_data = json.dumps(list(d...
[ "def", "upload", "(", "self", ",", "path", ",", "docs", ",", "*", "*", "params", ")", ":", "json_data", "=", "json", ".", "dumps", "(", "list", "(", "docs", ")", ")", "return", "self", ".", "post_data", "(", "path", ",", "json_data", ",", "'applica...
A convenience method for uploading a set of dictionaries representing documents. You still need to specify the URL to upload to, which will look like ROOT_URL/projects/myaccount/project_id/docs.
[ "A", "convenience", "method", "for", "uploading", "a", "set", "of", "dictionaries", "representing", "documents", ".", "You", "still", "need", "to", "specify", "the", "URL", "to", "upload", "to", "which", "will", "look", "like", "ROOT_URL", "/", "projects", "...
python
test
49.375
buguroo/pyknow
pyknow/matchers/rete/utils.py
https://github.com/buguroo/pyknow/blob/48818336f2e9a126f1964f2d8dc22d37ff800fe8/pyknow/matchers/rete/utils.py#L83-L104
def generate_checks(fact): """Given a fact, generate a list of Check objects for checking it.""" yield TypeCheck(type(fact)) fact_captured = False for key, value in fact.items(): if (isinstance(key, str) and key.startswith('__') and key.endswith('__')): ...
[ "def", "generate_checks", "(", "fact", ")", ":", "yield", "TypeCheck", "(", "type", "(", "fact", ")", ")", "fact_captured", "=", "False", "for", "key", ",", "value", "in", "fact", ".", "items", "(", ")", ":", "if", "(", "isinstance", "(", "key", ",",...
Given a fact, generate a list of Check objects for checking it.
[ "Given", "a", "fact", "generate", "a", "list", "of", "Check", "objects", "for", "checking", "it", "." ]
python
train
32.136364
gccxml/pygccxml
pygccxml/declarations/calldef_types.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/calldef_types.py#L38-L47
def extract(text, default=UNKNOWN): """extracts calling convention from the text. If the calling convention could not be found, the "default"is used""" if not text: return default found = CALLING_CONVENTION_TYPES.pattern.match(text) if found: return found....
[ "def", "extract", "(", "text", ",", "default", "=", "UNKNOWN", ")", ":", "if", "not", "text", ":", "return", "default", "found", "=", "CALLING_CONVENTION_TYPES", ".", "pattern", ".", "match", "(", "text", ")", "if", "found", ":", "return", "found", ".", ...
extracts calling convention from the text. If the calling convention could not be found, the "default"is used
[ "extracts", "calling", "convention", "from", "the", "text", ".", "If", "the", "calling", "convention", "could", "not", "be", "found", "the", "default", "is", "used" ]
python
train
34.6
gccxml/pygccxml
pygccxml/declarations/cpptypes.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/cpptypes.py#L696-L711
def create_decl_string( return_type, arguments_types, with_defaults=True): """ Returns free function type :param return_type: function return type :type return_type: :class:`type_t` :param arguments_types: list of argument :class:`type <type_t>` :rtype: :clas...
[ "def", "create_decl_string", "(", "return_type", ",", "arguments_types", ",", "with_defaults", "=", "True", ")", ":", "return", "free_function_type_t", ".", "NAME_TEMPLATE", "%", "{", "'return_type'", ":", "return_type", ".", "build_decl_string", "(", "with_defaults",...
Returns free function type :param return_type: function return type :type return_type: :class:`type_t` :param arguments_types: list of argument :class:`type <type_t>` :rtype: :class:`free_function_type_t`
[ "Returns", "free", "function", "type" ]
python
train
35.6875
cthoyt/onto2nx
src/onto2nx/nx2onto.py
https://github.com/cthoyt/onto2nx/blob/94c86e5e187cca67534afe0260097177b66e02c8/src/onto2nx/nx2onto.py#L8-L31
def nx_to_ontology(graph, source_node, output_path, base_iri): """Graph nodes are ID's, and have a 'label' in the node data with the right label :param graph: :param source_node: :param str output_path: :param base_iri: """ ontology = owlready.Ontology(base_iri) parent_lookup = { ...
[ "def", "nx_to_ontology", "(", "graph", ",", "source_node", ",", "output_path", ",", "base_iri", ")", ":", "ontology", "=", "owlready", ".", "Ontology", "(", "base_iri", ")", "parent_lookup", "=", "{", "source_node", ":", "types", ".", "new_class", "(", "sour...
Graph nodes are ID's, and have a 'label' in the node data with the right label :param graph: :param source_node: :param str output_path: :param base_iri:
[ "Graph", "nodes", "are", "ID", "s", "and", "have", "a", "label", "in", "the", "node", "data", "with", "the", "right", "label" ]
python
train
33.666667
mabuchilab/QNET
src/qnet/algebra/core/scalar_algebra.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/core/scalar_algebra.py#L907-L910
def conjugate(self): """Complex conjugate of of the product""" return self.__class__.create( *[arg.conjugate() for arg in reversed(self.args)])
[ "def", "conjugate", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "create", "(", "*", "[", "arg", ".", "conjugate", "(", ")", "for", "arg", "in", "reversed", "(", "self", ".", "args", ")", "]", ")" ]
Complex conjugate of of the product
[ "Complex", "conjugate", "of", "of", "the", "product" ]
python
train
42
openstax/cnx-epub
cnxepub/adapters.py
https://github.com/openstax/cnx-epub/blob/f648a309eff551b0a68a115a98ddf7858149a2ea/cnxepub/adapters.py#L102-L118
def make_publication_epub(binders, publisher, publication_message, file): """Creates an epub file from a binder(s). Also requires publication information, meant to be used in a EPUB publication request. """ if not isinstance(binders, (list, set, tuple,)): binders = [binders] packages = [...
[ "def", "make_publication_epub", "(", "binders", ",", "publisher", ",", "publication_message", ",", "file", ")", ":", "if", "not", "isinstance", "(", "binders", ",", "(", "list", ",", "set", ",", "tuple", ",", ")", ")", ":", "binders", "=", "[", "binders"...
Creates an epub file from a binder(s). Also requires publication information, meant to be used in a EPUB publication request.
[ "Creates", "an", "epub", "file", "from", "a", "binder", "(", "s", ")", ".", "Also", "requires", "publication", "information", "meant", "to", "be", "used", "in", "a", "EPUB", "publication", "request", "." ]
python
train
40.117647
lpantano/seqcluster
seqcluster/libs/thinkbayes.py
https://github.com/lpantano/seqcluster/blob/774e23add8cd4fdc83d626cea3bd1f458e7d060d/seqcluster/libs/thinkbayes.py#L194-L206
def Copy(self, name=None): """Returns a copy. Make a shallow copy of d. If you want a deep copy of d, use copy.deepcopy on the whole object. Args: name: string name for the new Hist """ new = copy.copy(self) new.d = copy.copy(self.d) new.nam...
[ "def", "Copy", "(", "self", ",", "name", "=", "None", ")", ":", "new", "=", "copy", ".", "copy", "(", "self", ")", "new", ".", "d", "=", "copy", ".", "copy", "(", "self", ".", "d", ")", "new", ".", "name", "=", "name", "if", "name", "is", "...
Returns a copy. Make a shallow copy of d. If you want a deep copy of d, use copy.deepcopy on the whole object. Args: name: string name for the new Hist
[ "Returns", "a", "copy", "." ]
python
train
28.461538
argaen/aiocache
aiocache/base.py
https://github.com/argaen/aiocache/blob/fdd282f37283ca04e22209f4d2ae4900f29e1688/aiocache/base.py#L204-L233
async def multi_get(self, keys, loads_fn=None, namespace=None, _conn=None): """ Get multiple values from the cache, values not found are Nones. :param keys: list of str :param loads_fn: callable alternative to use as loads function :param namespace: str alternative namespace to ...
[ "async", "def", "multi_get", "(", "self", ",", "keys", ",", "loads_fn", "=", "None", ",", "namespace", "=", "None", ",", "_conn", "=", "None", ")", ":", "start", "=", "time", ".", "monotonic", "(", ")", "loads", "=", "loads_fn", "or", "self", ".", ...
Get multiple values from the cache, values not found are Nones. :param keys: list of str :param loads_fn: callable alternative to use as loads function :param namespace: str alternative namespace to use :param timeout: int or float in seconds specifying maximum timeout for t...
[ "Get", "multiple", "values", "from", "the", "cache", "values", "not", "found", "are", "Nones", "." ]
python
train
36.766667
saltstack/salt
salt/utils/docker/translate/helpers.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/helpers.py#L26-L59
def get_port_def(port_num, proto='tcp'): ''' Given a port number and protocol, returns the port definition expected by docker-py. For TCP ports this is simply an integer, for UDP ports this is (port_num, 'udp'). port_num can also be a string in the format 'port_num/udp'. If so, the "proto" argu...
[ "def", "get_port_def", "(", "port_num", ",", "proto", "=", "'tcp'", ")", ":", "try", ":", "port_num", ",", "_", ",", "port_num_proto", "=", "port_num", ".", "partition", "(", "'/'", ")", "except", "AttributeError", ":", "pass", "else", ":", "if", "port_n...
Given a port number and protocol, returns the port definition expected by docker-py. For TCP ports this is simply an integer, for UDP ports this is (port_num, 'udp'). port_num can also be a string in the format 'port_num/udp'. If so, the "proto" argument will be ignored. The reason we need to be able t...
[ "Given", "a", "port", "number", "and", "protocol", "returns", "the", "port", "definition", "expected", "by", "docker", "-", "py", ".", "For", "TCP", "ports", "this", "is", "simply", "an", "integer", "for", "UDP", "ports", "this", "is", "(", "port_num", "...
python
train
43.235294
miLibris/flask-rest-jsonapi
flask_rest_jsonapi/data_layers/alchemy.py
https://github.com/miLibris/flask-rest-jsonapi/blob/ecc8f2cd2b54cc0bfae7acd6cffcda0ba1140c43/flask_rest_jsonapi/data_layers/alchemy.py#L490-L503
def filter_query(self, query, filter_info, model): """Filter query according to jsonapi 1.0 :param Query query: sqlalchemy query to sort :param filter_info: filter information :type filter_info: dict or None :param DeclarativeMeta model: an sqlalchemy model :return Query...
[ "def", "filter_query", "(", "self", ",", "query", ",", "filter_info", ",", "model", ")", ":", "if", "filter_info", ":", "filters", "=", "create_filters", "(", "model", ",", "filter_info", ",", "self", ".", "resource", ")", "query", "=", "query", ".", "fi...
Filter query according to jsonapi 1.0 :param Query query: sqlalchemy query to sort :param filter_info: filter information :type filter_info: dict or None :param DeclarativeMeta model: an sqlalchemy model :return Query: the sorted query
[ "Filter", "query", "according", "to", "jsonapi", "1", ".", "0" ]
python
train
35.571429
CQCL/pytket
pytket/qiskit/tket_pass.py
https://github.com/CQCL/pytket/blob/ae68f7402dcb5fb45221832cc6185d267bdd7a71/pytket/qiskit/tket_pass.py#L51-L68
def run(self, dag:DAGCircuit) -> DAGCircuit: """ Run one pass of optimisation on the circuit and route for the given backend. :param dag: The circuit to optimise and route :return: The modified circuit """ circ = dagcircuit_to_tk(dag, _DROP_CONDS=self.DROP_CONDS,_BO...
[ "def", "run", "(", "self", ",", "dag", ":", "DAGCircuit", ")", "->", "DAGCircuit", ":", "circ", "=", "dagcircuit_to_tk", "(", "dag", ",", "_DROP_CONDS", "=", "self", ".", "DROP_CONDS", ",", "_BOX_UNKNOWN", "=", "self", ".", "BOX_UNKNOWN", ")", "circ", ",...
Run one pass of optimisation on the circuit and route for the given backend. :param dag: The circuit to optimise and route :return: The modified circuit
[ "Run", "one", "pass", "of", "optimisation", "on", "the", "circuit", "and", "route", "for", "the", "given", "backend", "." ]
python
train
34.166667
cykl/infoqscraper
infoqscraper/client.py
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/client.py#L62-L79
def login(self, username, password): """ Log in. AuthenticationFailedException exception is raised if authentication fails. """ url = get_url("/login.action", scheme="https") params = { 'username': username, 'password': password, 'submit-login...
[ "def", "login", "(", "self", ",", "username", ",", "password", ")", ":", "url", "=", "get_url", "(", "\"/login.action\"", ",", "scheme", "=", "\"https\"", ")", "params", "=", "{", "'username'", ":", "username", ",", "'password'", ":", "password", ",", "'...
Log in. AuthenticationFailedException exception is raised if authentication fails.
[ "Log", "in", "." ]
python
train
40.444444
aiogram/aiogram
aiogram/types/auth_widget_data.py
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/auth_widget_data.py#L19-L35
def parse(cls, request: web.Request) -> AuthWidgetData: """ Parse request as Telegram auth widget data. :param request: :return: :obj:`AuthWidgetData` :raise: :obj:`aiohttp.web.HTTPBadRequest` """ try: query = dict(request.query) query['id...
[ "def", "parse", "(", "cls", ",", "request", ":", "web", ".", "Request", ")", "->", "AuthWidgetData", ":", "try", ":", "query", "=", "dict", "(", "request", ".", "query", ")", "query", "[", "'id'", "]", "=", "int", "(", "query", "[", "'id'", "]", ...
Parse request as Telegram auth widget data. :param request: :return: :obj:`AuthWidgetData` :raise: :obj:`aiohttp.web.HTTPBadRequest`
[ "Parse", "request", "as", "Telegram", "auth", "widget", "data", "." ]
python
train
33.470588
GNS3/gns3-server
gns3server/compute/iou/__init__.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/__init__.py#L45-L58
def create_node(self, *args, **kwargs): """ Creates a new IOU VM. :returns: IOUVM instance """ with (yield from self._iou_id_lock): # wait for a node to be completely created before adding a new one # this is important otherwise we allocate the same appl...
[ "def", "create_node", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "(", "yield", "from", "self", ".", "_iou_id_lock", ")", ":", "# wait for a node to be completely created before adding a new one", "# this is important otherwise we allocate ...
Creates a new IOU VM. :returns: IOUVM instance
[ "Creates", "a", "new", "IOU", "VM", "." ]
python
train
40.214286
authomatic/authomatic
authomatic/providers/__init__.py
https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/__init__.py#L754-L771
def type_id(self): """ A short string representing the provider implementation id used for serialization of :class:`.Credentials` and to identify the type of provider in JavaScript. The part before hyphen denotes the type of the provider, the part after hyphen denotes th...
[ "def", "type_id", "(", "self", ")", ":", "cls", "=", "self", ".", "__class__", "mod", "=", "sys", ".", "modules", ".", "get", "(", "cls", ".", "__module__", ")", "return", "str", "(", "self", ".", "PROVIDER_TYPE_ID", ")", "+", "'-'", "+", "str", "(...
A short string representing the provider implementation id used for serialization of :class:`.Credentials` and to identify the type of provider in JavaScript. The part before hyphen denotes the type of the provider, the part after hyphen denotes the class id e.g. ``oauth2.Facebo...
[ "A", "short", "string", "representing", "the", "provider", "implementation", "id", "used", "for", "serialization", "of", ":", "class", ":", ".", "Credentials", "and", "to", "identify", "the", "type", "of", "provider", "in", "JavaScript", "." ]
python
test
33.166667
StellarCN/py-stellar-base
stellar_base/stellarxdr/xdrgen.py
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/stellarxdr/xdrgen.py#L414-L437
def p_optional_value(t): """optional_value : value | empty""" # return value or None. t[0] = t[1] # Note this must be unsigned value = t[0] if value is None or value[0].isdigit(): return msg = '' if value[0] == '-': msg = "Can't use negative index %s...
[ "def", "p_optional_value", "(", "t", ")", ":", "# return value or None.", "t", "[", "0", "]", "=", "t", "[", "1", "]", "# Note this must be unsigned", "value", "=", "t", "[", "0", "]", "if", "value", "is", "None", "or", "value", "[", "0", "]", ".", "...
optional_value : value | empty
[ "optional_value", ":", "value", "|", "empty" ]
python
train
32.291667
chinapnr/fishbase
fishbase/fish_date.py
https://github.com/chinapnr/fishbase/blob/23c5147a6bc0d8ed36409e55352ffb2c5b0edc82/fishbase/fish_date.py#L283-L329
def get_time_interval(start_time, end_time): """ 获取两个unix时间戳之间的时间间隔 :param: * start_time: (int) 开始时间,unix 时间戳 * end_time: (int) 结束时间,unix 时间戳 :return: * interval_dict: (dict) 时间间隔字典 举例如下:: print('--- get_time_interval demo ---') import time start = ...
[ "def", "get_time_interval", "(", "start_time", ",", "end_time", ")", ":", "if", "not", "isinstance", "(", "start_time", ",", "int", ")", "or", "not", "isinstance", "(", "end_time", ",", "int", ")", ":", "raise", "TypeError", "(", "'start_time and end_time shou...
获取两个unix时间戳之间的时间间隔 :param: * start_time: (int) 开始时间,unix 时间戳 * end_time: (int) 结束时间,unix 时间戳 :return: * interval_dict: (dict) 时间间隔字典 举例如下:: print('--- get_time_interval demo ---') import time start = int(time.time()) end = start - 98908 prin...
[ "获取两个unix时间戳之间的时间间隔" ]
python
train
24.553191
opencobra/memote
memote/support/helpers.py
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L781-L809
def find_bounds(model): """ Return the median upper and lower bound of the metabolic model. Bounds can vary from model to model. Cobrapy defaults to (-1000, 1000) but this may not be the case for merged or autogenerated models. In these cases, this function is used to iterate over all the bounds of...
[ "def", "find_bounds", "(", "model", ")", ":", "lower_bounds", "=", "np", ".", "asarray", "(", "[", "rxn", ".", "lower_bound", "for", "rxn", "in", "model", ".", "reactions", "]", ",", "dtype", "=", "float", ")", "upper_bounds", "=", "np", ".", "asarray"...
Return the median upper and lower bound of the metabolic model. Bounds can vary from model to model. Cobrapy defaults to (-1000, 1000) but this may not be the case for merged or autogenerated models. In these cases, this function is used to iterate over all the bounds of all the reactions and find the ...
[ "Return", "the", "median", "upper", "and", "lower", "bound", "of", "the", "metabolic", "model", "." ]
python
train
40.896552
odlgroup/odl
odl/discr/grid.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/discr/grid.py#L642-L711
def insert(self, index, *grids): """Return a copy with ``grids`` inserted before ``index``. The given grids are inserted (as a block) into ``self``, yielding a new grid whose number of dimensions is the sum of the numbers of dimensions of all involved grids. Note that no changes...
[ "def", "insert", "(", "self", ",", "index", ",", "*", "grids", ")", ":", "index", ",", "index_in", "=", "safe_int_conv", "(", "index", ")", ",", "index", "if", "not", "-", "self", ".", "ndim", "<=", "index", "<=", "self", ".", "ndim", ":", "raise",...
Return a copy with ``grids`` inserted before ``index``. The given grids are inserted (as a block) into ``self``, yielding a new grid whose number of dimensions is the sum of the numbers of dimensions of all involved grids. Note that no changes are made in-place. Parameters ...
[ "Return", "a", "copy", "with", "grids", "inserted", "before", "index", "." ]
python
train
31.957143
minhhoit/yacms
yacms/utils/urls.py
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/urls.py#L91-L97
def next_url(request): """ Returns URL to redirect to from the ``next`` param in the request. """ next = request.GET.get("next", request.POST.get("next", "")) host = request.get_host() return next if next and is_safe_url(next, host=host) else None
[ "def", "next_url", "(", "request", ")", ":", "next", "=", "request", ".", "GET", ".", "get", "(", "\"next\"", ",", "request", ".", "POST", ".", "get", "(", "\"next\"", ",", "\"\"", ")", ")", "host", "=", "request", ".", "get_host", "(", ")", "retur...
Returns URL to redirect to from the ``next`` param in the request.
[ "Returns", "URL", "to", "redirect", "to", "from", "the", "next", "param", "in", "the", "request", "." ]
python
train
37.857143
Duke-GCB/DukeDSClient
ddsc/cmdparser.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L421-L443
def register_deliver_command(self, deliver_func): """ Add 'deliver' command for transferring a project to another user., :param deliver_func: function to run when user choses this option """ description = "Initiate delivery of a project to another user. Removes other user's curre...
[ "def", "register_deliver_command", "(", "self", ",", "deliver_func", ")", ":", "description", "=", "\"Initiate delivery of a project to another user. Removes other user's current permissions. \"", "\"Send message to D4S2 service to send email and allow access to the project once user \"", "\...
Add 'deliver' command for transferring a project to another user., :param deliver_func: function to run when user choses this option
[ "Add", "deliver", "command", "for", "transferring", "a", "project", "to", "another", "user", ".", ":", "param", "deliver_func", ":", "function", "to", "run", "when", "user", "choses", "this", "option" ]
python
train
60.434783
google/grumpy
third_party/pythonparser/parser.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L1050-L1075
def import_from(self, from_loc, module_name, import_loc, names): """ (2.6, 2.7) import_from: ('from' ('.'* dotted_name | '.'+) 'import' ('*' | '(' import_as_names ')' | import_as_names)) (3.0-) # note below: the ('.' | '...') is necessary because '...' is to...
[ "def", "import_from", "(", "self", ",", "from_loc", ",", "module_name", ",", "import_loc", ",", "names", ")", ":", "(", "dots_loc", ",", "dots_count", ")", ",", "dotted_name_opt", "=", "module_name", "module_loc", "=", "module", "=", "None", "if", "dotted_na...
(2.6, 2.7) import_from: ('from' ('.'* dotted_name | '.'+) 'import' ('*' | '(' import_as_names ')' | import_as_names)) (3.0-) # note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS import_from: ('from' (('.' | '...')* dotted_name | ('.' |...
[ "(", "2", ".", "6", "2", ".", "7", ")", "import_from", ":", "(", "from", "(", ".", "*", "dotted_name", "|", ".", "+", ")", "import", "(", "*", "|", "(", "import_as_names", ")", "|", "import_as_names", "))", "(", "3", ".", "0", "-", ")", "#", ...
python
valid
46.346154
delph-in/pydelphin
delphin/repp.py
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L410-L424
def apply(self, s, active=None): """ Apply the REPP's rewrite rules to the input string *s*. Args: s (str): the input string to process active (optional): a collection of external module names that may be applied if called Returns: a :...
[ "def", "apply", "(", "self", ",", "s", ",", "active", "=", "None", ")", ":", "if", "active", "is", "None", ":", "active", "=", "self", ".", "active", "return", "self", ".", "group", ".", "apply", "(", "s", ",", "active", "=", "active", ")" ]
Apply the REPP's rewrite rules to the input string *s*. Args: s (str): the input string to process active (optional): a collection of external module names that may be applied if called Returns: a :class:`REPPResult` object containing the processed ...
[ "Apply", "the", "REPP", "s", "rewrite", "rules", "to", "the", "input", "string", "*", "s", "*", "." ]
python
train
35.133333
PythonCharmers/python-future
src/libpasteurize/fixes/fix_imports2.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/libpasteurize/fixes/fix_imports2.py#L145-L164
def build_import_pattern(mapping1, mapping2): u""" mapping1: A dict mapping py3k modules to all possible py2k replacements mapping2: A dict mapping py2k modules to the things they do This builds a HUGE pattern to match all ways that things can be imported """ # py3k: urllib.request, py2k: ('urll...
[ "def", "build_import_pattern", "(", "mapping1", ",", "mapping2", ")", ":", "# py3k: urllib.request, py2k: ('urllib2', 'urllib')", "yield", "from_import", "%", "(", "all_modules_subpattern", "(", ")", ")", "for", "py3k", ",", "py2k", "in", "mapping1", ".", "items", "...
u""" mapping1: A dict mapping py3k modules to all possible py2k replacements mapping2: A dict mapping py2k modules to the things they do This builds a HUGE pattern to match all ways that things can be imported
[ "u", "mapping1", ":", "A", "dict", "mapping", "py3k", "modules", "to", "all", "possible", "py2k", "replacements", "mapping2", ":", "A", "dict", "mapping", "py2k", "modules", "to", "the", "things", "they", "do", "This", "builds", "a", "HUGE", "pattern", "to...
python
train
44.45
buriburisuri/sugartensor
sugartensor/sg_main.py
https://github.com/buriburisuri/sugartensor/blob/d2c039954777c7fbe3eb0c2ae40c45c9854deb40/sugartensor/sg_main.py#L135-L149
def sg_get_context(): r"""Get current context information Returns: tf.sg_opt class object which contains all context information """ global _context # merge current context res = tf.sg_opt() for c in _context: res += c return res
[ "def", "sg_get_context", "(", ")", ":", "global", "_context", "# merge current context", "res", "=", "tf", ".", "sg_opt", "(", ")", "for", "c", "in", "_context", ":", "res", "+=", "c", "return", "res" ]
r"""Get current context information Returns: tf.sg_opt class object which contains all context information
[ "r", "Get", "current", "context", "information" ]
python
train
17.666667
epfl-lts2/pygsp
pygsp/learning.py
https://github.com/epfl-lts2/pygsp/blob/8ce5bde39206129287375af24fdbcd7edddca8c5/pygsp/learning.py#L182-L251
def classification_tikhonov(G, y, M, tau=0): r"""Solve a classification problem on graph via Tikhonov minimization. The function first transforms :math:`y` in logits :math:`Y`, then solves .. math:: \operatorname*{arg min}_X \| M X - Y \|_2^2 + \tau \ tr(X^T L X) if :math:`\tau > 0`, and .. math...
[ "def", "classification_tikhonov", "(", "G", ",", "y", ",", "M", ",", "tau", "=", "0", ")", ":", "y", "[", "M", "==", "False", "]", "=", "0", "Y", "=", "_to_logits", "(", "y", ".", "astype", "(", "np", ".", "int", ")", ")", "return", "regression...
r"""Solve a classification problem on graph via Tikhonov minimization. The function first transforms :math:`y` in logits :math:`Y`, then solves .. math:: \operatorname*{arg min}_X \| M X - Y \|_2^2 + \tau \ tr(X^T L X) if :math:`\tau > 0`, and .. math:: \operatorname*{arg min}_X tr(X^T L X) \ \text{...
[ "r", "Solve", "a", "classification", "problem", "on", "graph", "via", "Tikhonov", "minimization", "." ]
python
train
31.557143
dottedmag/pychm
chm/chm.py
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L432-L442
def GetDWORD(self, buff, idx=0): '''Internal method. Reads a double word (4 bytes) from a buffer. ''' result = buff[idx] + (buff[idx+1] << 8) + (buff[idx+2] << 16) + \ (buff[idx+3] << 24) if result == 0xFFFFFFFF: result = 0 return result
[ "def", "GetDWORD", "(", "self", ",", "buff", ",", "idx", "=", "0", ")", ":", "result", "=", "buff", "[", "idx", "]", "+", "(", "buff", "[", "idx", "+", "1", "]", "<<", "8", ")", "+", "(", "buff", "[", "idx", "+", "2", "]", "<<", "16", ")"...
Internal method. Reads a double word (4 bytes) from a buffer.
[ "Internal", "method", ".", "Reads", "a", "double", "word", "(", "4", "bytes", ")", "from", "a", "buffer", "." ]
python
train
27.363636
atlassian-api/atlassian-python-api
atlassian/bitbucket.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/bitbucket.py#L9-L18
def project_list(self, limit=None): """ Provide the project list :param limit: OPTIONAL 25 is default :return: """ params = {} if limit: params['limit'] = limit return (self.get('rest/api/1.0/projects', params=params) or {}).get('values')
[ "def", "project_list", "(", "self", ",", "limit", "=", "None", ")", ":", "params", "=", "{", "}", "if", "limit", ":", "params", "[", "'limit'", "]", "=", "limit", "return", "(", "self", ".", "get", "(", "'rest/api/1.0/projects'", ",", "params", "=", ...
Provide the project list :param limit: OPTIONAL 25 is default :return:
[ "Provide", "the", "project", "list", ":", "param", "limit", ":", "OPTIONAL", "25", "is", "default", ":", "return", ":" ]
python
train
30.5
ccubed/PyMoe
Pymoe/Anidb/dump.py
https://github.com/ccubed/PyMoe/blob/5b2a2591bb113bd80d838e65aaa06f3a97ff3670/Pymoe/Anidb/dump.py#L40-L52
def save(url, destination): """ This is just the thread target. It's actually responsible for downloading and saving. :param str url: which dump to download :param str destination: a file path to save to """ r = requests.get(url, stream=True) with open(destination, 'wb') as fd: ...
[ "def", "save", "(", "url", ",", "destination", ")", ":", "r", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "with", "open", "(", "destination", ",", "'wb'", ")", "as", "fd", ":", "for", "chunk", "in", "r", ".", "iter_c...
This is just the thread target. It's actually responsible for downloading and saving. :param str url: which dump to download :param str destination: a file path to save to
[ "This", "is", "just", "the", "thread", "target", ".", "It", "s", "actually", "responsible", "for", "downloading", "and", "saving", "." ]
python
train
29.307692
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L26606-L26616
def unload_plug_in(self, name): """Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins. """ if not isinstance(name, basestring): raise TypeError("name can only be an instance of type basestring") s...
[ "def", "unload_plug_in", "(", "self", ",", "name", ")", ":", "if", "not", "isinstance", "(", "name", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"name can only be an instance of type basestring\"", ")", "self", ".", "_call", "(", "\"unloadPlugIn\"", ...
Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins.
[ "Unloads", "a", "DBGF", "plug", "-", "in", "." ]
python
train
33.545455
projectatomic/atomic-reactor
atomic_reactor/plugins/post_koji_upload.py
https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/post_koji_upload.py#L296-L314
def get_image_output(self): """ Create the output for the image This is the Koji Content Generator metadata, along with the 'docker save' output to upload. :return: tuple, (metadata dict, Output instance) """ saved_image = self.workflow.exported_image_sequence...
[ "def", "get_image_output", "(", "self", ")", ":", "saved_image", "=", "self", ".", "workflow", ".", "exported_image_sequence", "[", "-", "1", "]", ".", "get", "(", "'path'", ")", "image_name", "=", "get_image_upload_filename", "(", "self", ".", "workflow", "...
Create the output for the image This is the Koji Content Generator metadata, along with the 'docker save' output to upload. :return: tuple, (metadata dict, Output instance)
[ "Create", "the", "output", "for", "the", "image" ]
python
train
37.789474
epfl-lts2/pygsp
pygsp/filters/modulation.py
https://github.com/epfl-lts2/pygsp/blob/8ce5bde39206129287375af24fdbcd7edddca8c5/pygsp/filters/modulation.py#L146-L162
def evaluate(self, x): """TODO: will become _evaluate once polynomial filtering is merged.""" if not hasattr(self, '_coefficients'): # Graph Fourier transform -> modulation -> inverse GFT. c = self.G.igft(self._kernels.evaluate(self.G.e).squeeze()) c = np.sqrt(self.G...
[ "def", "evaluate", "(", "self", ",", "x", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_coefficients'", ")", ":", "# Graph Fourier transform -> modulation -> inverse GFT.", "c", "=", "self", ".", "G", ".", "igft", "(", "self", ".", "_kernels", ".", ...
TODO: will become _evaluate once polynomial filtering is merged.
[ "TODO", ":", "will", "become", "_evaluate", "once", "polynomial", "filtering", "is", "merged", "." ]
python
train
42
appknox/google-chartwrapper
GChartWrapper/GChart.py
https://github.com/appknox/google-chartwrapper/blob/3769aecbef6c83b6cd93ee72ece478ffe433ac57/GChartWrapper/GChart.py#L438-L449
def size(self,*args): """ Set the size of the chart, args are width,height and can be tuple APIPARAM: chs """ if len(args) == 2: x,y = map(int,args) else: x,y = map(int,args[0]) self.check_size(x,y) self['chs'] = '%dx%d'%(x,y) ...
[ "def", "size", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "2", ":", "x", ",", "y", "=", "map", "(", "int", ",", "args", ")", "else", ":", "x", ",", "y", "=", "map", "(", "int", ",", "args", "[", "0", "...
Set the size of the chart, args are width,height and can be tuple APIPARAM: chs
[ "Set", "the", "size", "of", "the", "chart", "args", "are", "width", "height", "and", "can", "be", "tuple", "APIPARAM", ":", "chs" ]
python
test
26.916667
materialsproject/pymatgen
pymatgen/io/abinit/qadapters.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L309-L339
def make_qadapter(**kwargs): """ Return the concrete :class:`QueueAdapter` class from a string. Note that one can register a customized version with: .. example:: from qadapters import SlurmAdapter class MyAdapter(SlurmAdapter): QTYPE = "myslurm" # Add your cus...
[ "def", "make_qadapter", "(", "*", "*", "kwargs", ")", ":", "# Get all known subclasses of QueueAdapter.", "d", "=", "{", "c", ".", "QTYPE", ":", "c", "for", "c", "in", "all_subclasses", "(", "QueueAdapter", ")", "}", "# Preventive copy before pop", "kwargs", "="...
Return the concrete :class:`QueueAdapter` class from a string. Note that one can register a customized version with: .. example:: from qadapters import SlurmAdapter class MyAdapter(SlurmAdapter): QTYPE = "myslurm" # Add your customized code here # Register you...
[ "Return", "the", "concrete", ":", "class", ":", "QueueAdapter", "class", "from", "a", "string", ".", "Note", "that", "one", "can", "register", "a", "customized", "version", "with", ":" ]
python
train
27.193548
OCHA-DAP/hdx-python-api
src/hdx/data/resource_view.py
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource_view.py#L124-L147
def _update_resource_view(self, log=False): # type: () -> bool """Check if resource view exists in HDX and if so, update resource view Returns: bool: True if updated and False if not """ update = False if 'id' in self.data and self._load_from_hdx('resource vi...
[ "def", "_update_resource_view", "(", "self", ",", "log", "=", "False", ")", ":", "# type: () -> bool", "update", "=", "False", "if", "'id'", "in", "self", ".", "data", "and", "self", ".", "_load_from_hdx", "(", "'resource view'", ",", "self", ".", "data", ...
Check if resource view exists in HDX and if so, update resource view Returns: bool: True if updated and False if not
[ "Check", "if", "resource", "view", "exists", "in", "HDX", "and", "if", "so", "update", "resource", "view" ]
python
train
41.125
log2timeline/plaso
plaso/parsers/esedb_plugins/msie_webcache.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/esedb_plugins/msie_webcache.py#L358-L395
def ParsePartitionsTable( self, parser_mediator, database=None, table=None, **unused_kwargs): """Parses the Partitions table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. database (Optional[pyesedb.fil...
[ "def", "ParsePartitionsTable", "(", "self", ",", "parser_mediator", ",", "database", "=", "None", ",", "table", "=", "None", ",", "*", "*", "unused_kwargs", ")", ":", "if", "database", "is", "None", ":", "raise", "ValueError", "(", "'Missing database value.'",...
Parses the Partitions table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. database (Optional[pyesedb.file]): ESE database. table (Optional[pyesedb.table]): table. Raises: ValueError: if the data...
[ "Parses", "the", "Partitions", "table", "." ]
python
train
37.368421
Alignak-monitoring/alignak
alignak/objects/contact.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/contact.py#L481-L528
def explode(self, contactgroups, notificationways): """Explode all contact for each contactsgroup :param contactgroups: contactgroups to explode :type contactgroups: alignak.objects.contactgroup.Contactgroups :param notificationways: notificationways to explode :type notificatio...
[ "def", "explode", "(", "self", ",", "contactgroups", ",", "notificationways", ")", ":", "# Contactgroups property need to be fulfill for got the information", "self", ".", "apply_partial_inheritance", "(", "'contactgroups'", ")", "# _special properties maybe came from a template, s...
Explode all contact for each contactsgroup :param contactgroups: contactgroups to explode :type contactgroups: alignak.objects.contactgroup.Contactgroups :param notificationways: notificationways to explode :type notificationways: alignak.objects.notificationway.Notificationways ...
[ "Explode", "all", "contact", "for", "each", "contactsgroup" ]
python
train
46.979167
openpermissions/koi
koi/commands.py
https://github.com/openpermissions/koi/blob/d721f8e1dfa8f07ad265d9dec32e8aaf80a9f281/koi/commands.py#L163-L183
def _get_client_secret(client, service_id): """ Get client secret for service :param client: Accounts Service API Client :param service_id: Service ID :return: Client secret (if available) """ try: response = client.accounts.services[service_id].secrets.get() except httpclient.HT...
[ "def", "_get_client_secret", "(", "client", ",", "service_id", ")", ":", "try", ":", "response", "=", "client", ".", "accounts", ".", "services", "[", "service_id", "]", ".", "secrets", ".", "get", "(", ")", "except", "httpclient", ".", "HTTPError", "as", ...
Get client secret for service :param client: Accounts Service API Client :param service_id: Service ID :return: Client secret (if available)
[ "Get", "client", "secret", "for", "service", ":", "param", "client", ":", "Accounts", "Service", "API", "Client", ":", "param", "service_id", ":", "Service", "ID", ":", "return", ":", "Client", "secret", "(", "if", "available", ")" ]
python
train
35.095238
pschmitt/zhue
zhue/model/bridge.py
https://github.com/pschmitt/zhue/blob/4a3f4ddf12ceeedcb2157f92d93ff1c6438a7d59/zhue/model/bridge.py#L311-L321
def __find_new(self, hueobjecttype): ''' Starts a search for new Hue objects ''' assert hueobjecttype in ['lights', 'sensors'], \ 'Unsupported object type {}'.format(hueobjecttype) url = '{}/{}'.format(self.API, hueobjecttype) return self._request( ...
[ "def", "__find_new", "(", "self", ",", "hueobjecttype", ")", ":", "assert", "hueobjecttype", "in", "[", "'lights'", ",", "'sensors'", "]", ",", "'Unsupported object type {}'", ".", "format", "(", "hueobjecttype", ")", "url", "=", "'{}/{}'", ".", "format", "(",...
Starts a search for new Hue objects
[ "Starts", "a", "search", "for", "new", "Hue", "objects" ]
python
train
32.272727
hyperledger/sawtooth-core
cli/sawtooth_cli/parent_parsers.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/cli/sawtooth_cli/parent_parsers.py#L61-L81
def base_show_parser(): """Creates a parser with arguments specific to formatting a single resource. Returns: {ArgumentParser}: Base parser with default show args """ base_parser = ArgumentParser(add_help=False) base_parser.add_argument( '-k', '--key', type=str, ...
[ "def", "base_show_parser", "(", ")", ":", "base_parser", "=", "ArgumentParser", "(", "add_help", "=", "False", ")", "base_parser", ".", "add_argument", "(", "'-k'", ",", "'--key'", ",", "type", "=", "str", ",", "help", "=", "'show a single property from the bloc...
Creates a parser with arguments specific to formatting a single resource. Returns: {ArgumentParser}: Base parser with default show args
[ "Creates", "a", "parser", "with", "arguments", "specific", "to", "formatting", "a", "single", "resource", "." ]
python
train
27.380952