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
modin-project/modin
modin/pandas/io.py
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/io.py#L286-L324
def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize=None, ): """ Read SQL query or database table into a DataFrame. Args: sql: string or SQLAlchemy Selectable (select or text object) SQL query to be executed o...
[ "def", "read_sql", "(", "sql", ",", "con", ",", "index_col", "=", "None", ",", "coerce_float", "=", "True", ",", "params", "=", "None", ",", "parse_dates", "=", "None", ",", "columns", "=", "None", ",", "chunksize", "=", "None", ",", ")", ":", "_", ...
Read SQL query or database table into a DataFrame. Args: sql: string or SQLAlchemy Selectable (select or text object) SQL query to be executed or a table name. con: SQLAlchemy connectable (engine/connection) or database string URI or DBAPI2 connection (fallback mode) index_col: Column(s) to...
[ "Read", "SQL", "query", "or", "database", "table", "into", "a", "DataFrame", "." ]
python
train
50.846154
r4fek/django-cassandra-engine
django_cassandra_engine/utils.py
https://github.com/r4fek/django-cassandra-engine/blob/b43f8fddd4bba143f03f73f8bbfc09e6b32c699b/django_cassandra_engine/utils.py#L70-L98
def get_cql_models(app, connection=None, keyspace=None): """ :param app: django models module :param connection: connection name :param keyspace: keyspace :return: list of all cassandra.cqlengine.Model within app that should be synced to keyspace. """ from .models import DjangoCassandraM...
[ "def", "get_cql_models", "(", "app", ",", "connection", "=", "None", ",", "keyspace", "=", "None", ")", ":", "from", ".", "models", "import", "DjangoCassandraModel", "models", "=", "[", "]", "single_cassandra_connection", "=", "len", "(", "list", "(", "get_c...
:param app: django models module :param connection: connection name :param keyspace: keyspace :return: list of all cassandra.cqlengine.Model within app that should be synced to keyspace.
[ ":", "param", "app", ":", "django", "models", "module", ":", "param", "connection", ":", "connection", "name", ":", "param", "keyspace", ":", "keyspace", ":", "return", ":", "list", "of", "all", "cassandra", ".", "cqlengine", ".", "Model", "within", "app",...
python
train
37.103448
gmr/rejected
rejected/log.py
https://github.com/gmr/rejected/blob/610a3e1401122ecb98d891b6795cca0255e5b044/rejected/log.py#L104-L117
def process(self, msg, kwargs): """Process the logging message and keyword arguments passed in to a logging call to insert contextual information. :param str msg: The message to process :param dict kwargs: The kwargs to append :rtype: (str, dict) """ kwargs['ext...
[ "def", "process", "(", "self", ",", "msg", ",", "kwargs", ")", ":", "kwargs", "[", "'extra'", "]", "=", "{", "'correlation_id'", ":", "self", ".", "parent", ".", "correlation_id", ",", "'parent'", ":", "self", ".", "parent", ".", "name", "}", "return",...
Process the logging message and keyword arguments passed in to a logging call to insert contextual information. :param str msg: The message to process :param dict kwargs: The kwargs to append :rtype: (str, dict)
[ "Process", "the", "logging", "message", "and", "keyword", "arguments", "passed", "in", "to", "a", "logging", "call", "to", "insert", "contextual", "information", "." ]
python
train
32.071429
GoogleCloudPlatform/appengine-pipelines
python/src/pipeline/pipeline.py
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1279-L1332
def _dereference_args(pipeline_name, args, kwargs): """Dereference a Pipeline's arguments that are slots, validating them. Each argument value passed in is assumed to be a dictionary with the format: {'type': 'value', 'value': 'serializable'} # A resolved value. {'type': 'slot', 'slot_key': 'str() on a db...
[ "def", "_dereference_args", "(", "pipeline_name", ",", "args", ",", "kwargs", ")", ":", "lookup_slots", "=", "set", "(", ")", "for", "arg", "in", "itertools", ".", "chain", "(", "args", ",", "kwargs", ".", "itervalues", "(", ")", ")", ":", "if", "arg",...
Dereference a Pipeline's arguments that are slots, validating them. Each argument value passed in is assumed to be a dictionary with the format: {'type': 'value', 'value': 'serializable'} # A resolved value. {'type': 'slot', 'slot_key': 'str() on a db.Key'} # A pending Slot. Args: pipeline_name: The...
[ "Dereference", "a", "Pipeline", "s", "arguments", "that", "are", "slots", "validating", "them", "." ]
python
train
39.055556
tobgu/pyrsistent
pyrsistent/_pdeque.py
https://github.com/tobgu/pyrsistent/blob/c84dab0daaa44973cbe83830d14888827b307632/pyrsistent/_pdeque.py#L263-L280
def remove(self, elem): """ Return new deque with first element from left equal to elem removed. If no such element is found a ValueError is raised. >>> pdeque([2, 1, 2]).remove(2) pdeque([1, 2]) """ try: return PDeque(self._left_list.remove(elem), se...
[ "def", "remove", "(", "self", ",", "elem", ")", ":", "try", ":", "return", "PDeque", "(", "self", ".", "_left_list", ".", "remove", "(", "elem", ")", ",", "self", ".", "_right_list", ",", "self", ".", "_length", "-", "1", ")", "except", "ValueError",...
Return new deque with first element from left equal to elem removed. If no such element is found a ValueError is raised. >>> pdeque([2, 1, 2]).remove(2) pdeque([1, 2])
[ "Return", "new", "deque", "with", "first", "element", "from", "left", "equal", "to", "elem", "removed", ".", "If", "no", "such", "element", "is", "found", "a", "ValueError", "is", "raised", "." ]
python
train
44.777778
alvinwan/TexSoup
TexSoup/data.py
https://github.com/alvinwan/TexSoup/blob/63323ed71510fd2351102b8c36660a3b7703cead/TexSoup/data.py#L1019-L1033
def remove(self, item): """Remove either an unparsed argument string or an argument object. :param Union[str,Arg] item: Item to remove >>> arguments = TexArgs([RArg('arg0'), '[arg2]', '{arg3}']) >>> arguments.remove('{arg0}') >>> len(arguments) 2 >>> arguments[0...
[ "def", "remove", "(", "self", ",", "item", ")", ":", "item", "=", "self", ".", "__coerce", "(", "item", ")", "self", ".", "all", ".", "remove", "(", "item", ")", "super", "(", ")", ".", "remove", "(", "item", ")" ]
Remove either an unparsed argument string or an argument object. :param Union[str,Arg] item: Item to remove >>> arguments = TexArgs([RArg('arg0'), '[arg2]', '{arg3}']) >>> arguments.remove('{arg0}') >>> len(arguments) 2 >>> arguments[0] OArg('arg2')
[ "Remove", "either", "an", "unparsed", "argument", "string", "or", "an", "argument", "object", "." ]
python
train
28.933333
tensorflow/tensor2tensor
tensor2tensor/data_generators/cipher.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/cipher.py#L180-L200
def encipher_shift(plaintext, plain_vocab, shift): """Encrypt plain text with a single shift layer. Args: plaintext (list of list of Strings): a list of plain text to encrypt. plain_vocab (list of Integer): unique vocabularies being used. shift (Integer): number of shift, shift to the right if shift is...
[ "def", "encipher_shift", "(", "plaintext", ",", "plain_vocab", ",", "shift", ")", ":", "ciphertext", "=", "[", "]", "cipher", "=", "ShiftEncryptionLayer", "(", "plain_vocab", ",", "shift", ")", "for", "_", ",", "sentence", "in", "enumerate", "(", "plaintext"...
Encrypt plain text with a single shift layer. Args: plaintext (list of list of Strings): a list of plain text to encrypt. plain_vocab (list of Integer): unique vocabularies being used. shift (Integer): number of shift, shift to the right if shift is positive. Returns: ciphertext (list of Strings): ...
[ "Encrypt", "plain", "text", "with", "a", "single", "shift", "layer", "." ]
python
train
34.809524
nok/sklearn-porter
sklearn_porter/estimator/classifier/MLPClassifier/__init__.py
https://github.com/nok/sklearn-porter/blob/04673f768310bde31f9747a68a5e070592441ef2/sklearn_porter/estimator/classifier/MLPClassifier/__init__.py#L89-L156
def export(self, class_name, method_name, export_data=False, export_dir='.', export_filename='data.json', export_append_checksum=False, **kwargs): """ Port a trained estimator to the syntax of a chosen programming language. Parameters ---------- :pa...
[ "def", "export", "(", "self", ",", "class_name", ",", "method_name", ",", "export_data", "=", "False", ",", "export_dir", "=", "'.'", ",", "export_filename", "=", "'data.json'", ",", "export_append_checksum", "=", "False", ",", "*", "*", "kwargs", ")", ":", ...
Port a trained estimator to the syntax of a chosen programming language. Parameters ---------- :param class_name : string The name of the class in the returned result. :param method_name : string The name of the method in the returned result. :param expor...
[ "Port", "a", "trained", "estimator", "to", "the", "syntax", "of", "a", "chosen", "programming", "language", "." ]
python
train
36.014706
SiLab-Bonn/pyBAR
pybar/fei4_run_base.py
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4_run_base.py#L466-L563
def init_modules(self): ''' Initialize all modules consecutively''' for module_id, module_cfg in self._module_cfgs.items(): if module_id in self._modules or module_id in self._tx_module_groups: if module_id in self._modules: module_id_str = "module " + mod...
[ "def", "init_modules", "(", "self", ")", ":", "for", "module_id", ",", "module_cfg", "in", "self", ".", "_module_cfgs", ".", "items", "(", ")", ":", "if", "module_id", "in", "self", ".", "_modules", "or", "module_id", "in", "self", ".", "_tx_module_groups"...
Initialize all modules consecutively
[ "Initialize", "all", "modules", "consecutively" ]
python
train
65.112245
wmayner/pyphi
pyphi/jsonify.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/jsonify.py#L233-L248
def _load_model(self, dct): """Load a serialized PyPhi model. The object is memoized for reuse elsewhere in the object graph. """ classname, version, _ = _pop_metadata(dct) _check_version(version) cls = self._models[classname] # Use `from_json` if available ...
[ "def", "_load_model", "(", "self", ",", "dct", ")", ":", "classname", ",", "version", ",", "_", "=", "_pop_metadata", "(", "dct", ")", "_check_version", "(", "version", ")", "cls", "=", "self", ".", "_models", "[", "classname", "]", "# Use `from_json` if a...
Load a serialized PyPhi model. The object is memoized for reuse elsewhere in the object graph.
[ "Load", "a", "serialized", "PyPhi", "model", "." ]
python
train
27.75
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L2237-L2278
def _extract_member(self, tarinfo, targetpath, set_attrs=True): """Extract the TarInfo object tarinfo to a physical file called targetpath. """ # Fetch the TarInfo object for the given name # and build the destination pathname, replacing # forward slashes to platform s...
[ "def", "_extract_member", "(", "self", ",", "tarinfo", ",", "targetpath", ",", "set_attrs", "=", "True", ")", ":", "# Fetch the TarInfo object for the given name", "# and build the destination pathname, replacing", "# forward slashes to platform specific separators.", "targetpath",...
Extract the TarInfo object tarinfo to a physical file called targetpath.
[ "Extract", "the", "TarInfo", "object", "tarinfo", "to", "a", "physical", "file", "called", "targetpath", "." ]
python
train
38.928571
KnowledgeLinks/rdfframework
rdfframework/connections/blazegraph.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/blazegraph.py#L585-L604
def reset_namespace(self, namespace=None, params=None): """ Will delete and recreate specified namespace args: namespace(str): Namespace to reset params(dict): params used to reset the namespace """ log = logging.getLogger("%s.%s" % (self.log_name, ...
[ "def", "reset_namespace", "(", "self", ",", "namespace", "=", "None", ",", "params", "=", "None", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "\"%s.%s\"", "%", "(", "self", ".", "log_name", ",", "inspect", ".", "stack", "(", ")", "[", "0"...
Will delete and recreate specified namespace args: namespace(str): Namespace to reset params(dict): params used to reset the namespace
[ "Will", "delete", "and", "recreate", "specified", "namespace" ]
python
train
38.15
laysakura/relshell
relshell/daemon_shelloperator.py
https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/daemon_shelloperator.py#L82-L118
def run(self, in_batches): """Run shell operator synchronously to eat `in_batches` :param in_batches: `tuple` of batches to process """ if len(in_batches) != len(self._batcmd.batch_to_file_s): BaseShellOperator._rm_process_input_tmpfiles(self._batcmd.batch_to_file_s) # [tod...
[ "def", "run", "(", "self", ",", "in_batches", ")", ":", "if", "len", "(", "in_batches", ")", "!=", "len", "(", "self", ".", "_batcmd", ".", "batch_to_file_s", ")", ":", "BaseShellOperator", ".", "_rm_process_input_tmpfiles", "(", "self", ".", "_batcmd", "....
Run shell operator synchronously to eat `in_batches` :param in_batches: `tuple` of batches to process
[ "Run", "shell", "operator", "synchronously", "to", "eat", "in_batches" ]
python
train
54.108108
allenai/allennlp
allennlp/models/semantic_parsing/wikitables/wikitables_semantic_parser.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/models/semantic_parsing/wikitables/wikitables_semantic_parser.py#L140-L296
def _get_initial_rnn_and_grammar_state(self, question: Dict[str, torch.LongTensor], table: Dict[str, torch.LongTensor], world: List[WikiTablesWorld], ...
[ "def", "_get_initial_rnn_and_grammar_state", "(", "self", ",", "question", ":", "Dict", "[", "str", ",", "torch", ".", "LongTensor", "]", ",", "table", ":", "Dict", "[", "str", ",", "torch", ".", "LongTensor", "]", ",", "world", ":", "List", "[", "WikiTa...
Encodes the question and table, computes a linking between the two, and constructs an initial RnnStatelet and LambdaGrammarStatelet for each batch instance to pass to the decoder. We take ``outputs`` as a parameter here and `modify` it, adding things that we want to visualize in a demo.
[ "Encodes", "the", "question", "and", "table", "computes", "a", "linking", "between", "the", "two", "and", "constructs", "an", "initial", "RnnStatelet", "and", "LambdaGrammarStatelet", "for", "each", "batch", "instance", "to", "pass", "to", "the", "decoder", "." ...
python
train
62.369427
JoeVirtual/KonFoo
konfoo/providers.py
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/providers.py#L102-L113
def flush(self, file=str()): """ Flushes the updated file content to the given *file*. .. note:: Overwrites an existing file. :param str file: name and location of the file. Default is the original file. """ if file: Path(file).write_bytes(self._cache) ...
[ "def", "flush", "(", "self", ",", "file", "=", "str", "(", ")", ")", ":", "if", "file", ":", "Path", "(", "file", ")", ".", "write_bytes", "(", "self", ".", "_cache", ")", "else", ":", "self", ".", "path", ".", "write_bytes", "(", "self", ".", ...
Flushes the updated file content to the given *file*. .. note:: Overwrites an existing file. :param str file: name and location of the file. Default is the original file.
[ "Flushes", "the", "updated", "file", "content", "to", "the", "given", "*", "file", "*", "." ]
python
train
30.75
GoogleCloudPlatform/appengine-pipelines
python/src/pipeline/pipeline.py
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/python/src/pipeline/pipeline.py#L1452-L1458
def from_environ(cls, environ=os.environ): """Constructs a _PipelineContext from the task queue environment.""" base_path, unused = (environ['PATH_INFO'].rsplit('/', 1) + [''])[:2] return cls( environ['HTTP_X_APPENGINE_TASKNAME'], environ['HTTP_X_APPENGINE_QUEUENAME'], base_path)
[ "def", "from_environ", "(", "cls", ",", "environ", "=", "os", ".", "environ", ")", ":", "base_path", ",", "unused", "=", "(", "environ", "[", "'PATH_INFO'", "]", ".", "rsplit", "(", "'/'", ",", "1", ")", "+", "[", "''", "]", ")", "[", ":", "2", ...
Constructs a _PipelineContext from the task queue environment.
[ "Constructs", "a", "_PipelineContext", "from", "the", "task", "queue", "environment", "." ]
python
train
44.285714
fake-name/ChromeController
ChromeController/Generator/Generated.py
https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L5230-L5248
def Input_setIgnoreInputEvents(self, ignore): """ Function path: Input.setIgnoreInputEvents Domain: Input Method name: setIgnoreInputEvents Parameters: Required arguments: 'ignore' (type: boolean) -> Ignores input events processing when set to true. No return value. Description: Ignore...
[ "def", "Input_setIgnoreInputEvents", "(", "self", ",", "ignore", ")", ":", "assert", "isinstance", "(", "ignore", ",", "(", "bool", ",", ")", ")", ",", "\"Argument 'ignore' must be of type '['bool']'. Received type: '%s'\"", "%", "type", "(", "ignore", ")", "subdom_...
Function path: Input.setIgnoreInputEvents Domain: Input Method name: setIgnoreInputEvents Parameters: Required arguments: 'ignore' (type: boolean) -> Ignores input events processing when set to true. No return value. Description: Ignores input events (useful while auditing page).
[ "Function", "path", ":", "Input", ".", "setIgnoreInputEvents", "Domain", ":", "Input", "Method", "name", ":", "setIgnoreInputEvents", "Parameters", ":", "Required", "arguments", ":", "ignore", "(", "type", ":", "boolean", ")", "-", ">", "Ignores", "input", "ev...
python
train
31.684211
google/grr
grr/server/grr_response_server/gui/api_value_renderers.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_value_renderers.py#L554-L564
def AdjustDescriptor(self, fields): """Payload-aware metadata processor.""" for f in fields: if f.name == "args_rdf_name": f.name = "payload_type" if f.name == "args": f.name = "payload" return fields
[ "def", "AdjustDescriptor", "(", "self", ",", "fields", ")", ":", "for", "f", "in", "fields", ":", "if", "f", ".", "name", "==", "\"args_rdf_name\"", ":", "f", ".", "name", "=", "\"payload_type\"", "if", "f", ".", "name", "==", "\"args\"", ":", "f", "...
Payload-aware metadata processor.
[ "Payload", "-", "aware", "metadata", "processor", "." ]
python
train
21.181818
Kensuke-Mitsuzawa/JapaneseTokenizers
JapaneseTokenizer/common/juman_utils.py
https://github.com/Kensuke-Mitsuzawa/JapaneseTokenizers/blob/3bdfb6be73de0f78e5c08f3a51376ad3efa00b6c/JapaneseTokenizer/common/juman_utils.py#L42-L65
def feature_parser(uni_feature, word_surface): # type: (text_type, text_type) -> Tuple[Tuple[text_type, text_type, text_type], text_type] """ Parse the POS feature output by Mecab :param uni_feature unicode: :return ( (pos1, pos2, pos3), word_stem ): """ list_feature_items = uni_feature.spli...
[ "def", "feature_parser", "(", "uni_feature", ",", "word_surface", ")", ":", "# type: (text_type, text_type) -> Tuple[Tuple[text_type, text_type, text_type], text_type]", "list_feature_items", "=", "uni_feature", ".", "split", "(", "','", ")", "# if word has no feature at all", "i...
Parse the POS feature output by Mecab :param uni_feature unicode: :return ( (pos1, pos2, pos3), word_stem ):
[ "Parse", "the", "POS", "feature", "output", "by", "Mecab", ":", "param", "uni_feature", "unicode", ":", ":", "return", "(", "(", "pos1", "pos2", "pos3", ")", "word_stem", ")", ":" ]
python
train
34.083333
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L976-L981
def dragEnterEvent(self, event): """Allow user to drag files""" if mimedata2url(event.mimeData()): event.accept() else: event.ignore()
[ "def", "dragEnterEvent", "(", "self", ",", "event", ")", ":", "if", "mimedata2url", "(", "event", ".", "mimeData", "(", ")", ")", ":", "event", ".", "accept", "(", ")", "else", ":", "event", ".", "ignore", "(", ")" ]
Allow user to drag files
[ "Allow", "user", "to", "drag", "files" ]
python
train
30.333333
armet/python-armet
armet/resources/resource/base.py
https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/resource/base.py#L551-L566
def route(self, request, response): """Processes every request. Directs control flow to the appropriate HTTP/1.1 method. """ # Ensure that we're allowed to use this HTTP method. self.require_http_allowed_method(request) # Retrieve the function corresponding to this HTTP...
[ "def", "route", "(", "self", ",", "request", ",", "response", ")", ":", "# Ensure that we're allowed to use this HTTP method.", "self", ".", "require_http_allowed_method", "(", "request", ")", "# Retrieve the function corresponding to this HTTP method.", "function", "=", "get...
Processes every request. Directs control flow to the appropriate HTTP/1.1 method.
[ "Processes", "every", "request", "." ]
python
valid
39
onecodex/onecodex
onecodex/models/__init__.py
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/models/__init__.py#L535-L560
def save(self): """Either create or persist changes on this object back to the One Codex server.""" check_bind(self) creating = self.id is None if creating and not self.__class__._has_schema_method("create"): raise MethodNotSupported("{} do not support creating.".format(self...
[ "def", "save", "(", "self", ")", ":", "check_bind", "(", "self", ")", "creating", "=", "self", ".", "id", "is", "None", "if", "creating", "and", "not", "self", ".", "__class__", ".", "_has_schema_method", "(", "\"create\"", ")", ":", "raise", "MethodNotS...
Either create or persist changes on this object back to the One Codex server.
[ "Either", "create", "or", "persist", "changes", "on", "this", "object", "back", "to", "the", "One", "Codex", "server", "." ]
python
train
46.769231
GoogleCloudPlatform/datastore-ndb-python
ndb/query.py
https://github.com/GoogleCloudPlatform/datastore-ndb-python/blob/cf4cab3f1f69cd04e1a9229871be466b53729f3f/ndb/query.py#L912-L927
def _fix_namespace(self): """Internal helper to fix the namespace. This is called to ensure that for queries without an explicit namespace, the namespace used by async calls is the one in effect at the time the async call is made, not the one in effect when the the request is actually generated. ...
[ "def", "_fix_namespace", "(", "self", ")", ":", "if", "self", ".", "namespace", "is", "not", "None", ":", "return", "self", "namespace", "=", "namespace_manager", ".", "get_namespace", "(", ")", "return", "self", ".", "__class__", "(", "kind", "=", "self",...
Internal helper to fix the namespace. This is called to ensure that for queries without an explicit namespace, the namespace used by async calls is the one in effect at the time the async call is made, not the one in effect when the the request is actually generated.
[ "Internal", "helper", "to", "fix", "the", "namespace", "." ]
python
train
46.875
rackerlabs/rackspace-python-neutronclient
neutronclient/v2_0/client.py
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/v2_0/client.py#L765-L768
def add_gateway_router(self, router, body=None): """Adds an external network gateway to the specified router.""" return self.put((self.router_path % router), body={'router': {'external_gateway_info': body}})
[ "def", "add_gateway_router", "(", "self", ",", "router", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "(", "self", ".", "router_path", "%", "router", ")", ",", "body", "=", "{", "'router'", ":", "{", "'external_gateway_info'", ...
Adds an external network gateway to the specified router.
[ "Adds", "an", "external", "network", "gateway", "to", "the", "specified", "router", "." ]
python
train
61
hotdoc/hotdoc
hotdoc/utils/setup_utils.py
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L33-L72
def _check_submodule_status(root, submodules): """check submodule status Has three return values: 'missing' - submodules are absent 'unclean' - submodules have unstaged changes 'clean' - all submodules are up to date """ if hasattr(sys, "frozen"): # frozen via py2exe or similar, don...
[ "def", "_check_submodule_status", "(", "root", ",", "submodules", ")", ":", "if", "hasattr", "(", "sys", ",", "\"frozen\"", ")", ":", "# frozen via py2exe or similar, don't bother", "return", "'clean'", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ...
check submodule status Has three return values: 'missing' - submodules are absent 'unclean' - submodules have unstaged changes 'clean' - all submodules are up to date
[ "check", "submodule", "status", "Has", "three", "return", "values", ":", "missing", "-", "submodules", "are", "absent", "unclean", "-", "submodules", "have", "unstaged", "changes", "clean", "-", "all", "submodules", "are", "up", "to", "date" ]
python
train
32.525
google/python_portpicker
src/portserver.py
https://github.com/google/python_portpicker/blob/f737189ea7a2d4b97048a2f4e37609e293b03546/src/portserver.py#L168-L197
def get_port_for_process(self, pid): """Allocates and returns port for pid or 0 if none could be allocated.""" if not self._port_queue: raise RuntimeError('No ports being managed.') # Avoid an infinite loop if all ports are currently assigned. check_count = 0 max_por...
[ "def", "get_port_for_process", "(", "self", ",", "pid", ")", ":", "if", "not", "self", ".", "_port_queue", ":", "raise", "RuntimeError", "(", "'No ports being managed.'", ")", "# Avoid an infinite loop if all ports are currently assigned.", "check_count", "=", "0", "max...
Allocates and returns port for pid or 0 if none could be allocated.
[ "Allocates", "and", "returns", "port", "for", "pid", "or", "0", "if", "none", "could", "be", "allocated", "." ]
python
train
46.666667
kpdyer/regex2dfa
third_party/re2/lib/codereview/codereview.py
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/lib/codereview/codereview.py#L3260-L3344
def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options, files): """Uploads the base files (and if necessary, the current ones as well).""" def UploadFile(filename, file_id, content, is_binary, status, is_base): """Uploads a file to the server.""" set_status("uploading " + filen...
[ "def", "UploadBaseFiles", "(", "self", ",", "issue", ",", "rpc_server", ",", "patch_list", ",", "patchset", ",", "options", ",", "files", ")", ":", "def", "UploadFile", "(", "filename", ",", "file_id", ",", "content", ",", "is_binary", ",", "status", ",", ...
Uploads the base files (and if necessary, the current ones as well).
[ "Uploads", "the", "base", "files", "(", "and", "if", "necessary", "the", "current", "ones", "as", "well", ")", "." ]
python
train
32.964706
loli/medpy
medpy/metric/image.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/medpy/metric/image.py#L112-L119
def __entropy(data): '''Compute entropy of the flattened data set (e.g. a density distribution).''' # normalize and convert to float data = data/float(numpy.sum(data)) # for each grey-value g with a probability p(g) = 0, the entropy is defined as 0, therefore we remove these values and also flatten the ...
[ "def", "__entropy", "(", "data", ")", ":", "# normalize and convert to float", "data", "=", "data", "/", "float", "(", "numpy", ".", "sum", "(", "data", ")", ")", "# for each grey-value g with a probability p(g) = 0, the entropy is defined as 0, therefore we remove these valu...
Compute entropy of the flattened data set (e.g. a density distribution).
[ "Compute", "entropy", "of", "the", "flattened", "data", "set", "(", "e", ".", "g", ".", "a", "density", "distribution", ")", "." ]
python
train
54.125
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/worker.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/worker.py#L116-L129
def sudo_remove_dirtree(dir_name): """Removes directory tree as a superuser. Args: dir_name: name of the directory to remove. This function is necessary to cleanup directories created from inside a Docker, since they usually written as a root, thus have to be removed as a root. """ try: subproce...
[ "def", "sudo_remove_dirtree", "(", "dir_name", ")", ":", "try", ":", "subprocess", ".", "check_output", "(", "[", "'sudo'", ",", "'rm'", ",", "'-rf'", ",", "dir_name", "]", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "raise", "W...
Removes directory tree as a superuser. Args: dir_name: name of the directory to remove. This function is necessary to cleanup directories created from inside a Docker, since they usually written as a root, thus have to be removed as a root.
[ "Removes", "directory", "tree", "as", "a", "superuser", "." ]
python
train
33.785714
hsolbrig/PyShEx
pyshex/shape_expressions_language/p5_5_shapes_and_triple_expressions.py
https://github.com/hsolbrig/PyShEx/blob/9d659cc36e808afd66d4a6d60e8ea21cb12eb744/pyshex/shape_expressions_language/p5_5_shapes_and_triple_expressions.py#L110-L153
def valid_remainder(cntxt: Context, n: Node, matchables: RDFGraph, S: ShExJ.Shape) -> bool: """ Let **outs** be the arcsOut in remainder: `outs = remainder ∩ arcsOut(G, n)`. Let **matchables** be the triples in outs whose predicate appears in a TripleConstraint in `expression`. If `expression` is absen...
[ "def", "valid_remainder", "(", "cntxt", ":", "Context", ",", "n", ":", "Node", ",", "matchables", ":", "RDFGraph", ",", "S", ":", "ShExJ", ".", "Shape", ")", "->", "bool", ":", "# TODO: Update this and satisfies to address the new algorithm", "# Let **outs** be the ...
Let **outs** be the arcsOut in remainder: `outs = remainder ∩ arcsOut(G, n)`. Let **matchables** be the triples in outs whose predicate appears in a TripleConstraint in `expression`. If `expression` is absent, matchables = Ø (the empty set). * There is no triple in **matchables** which matches a TripleCon...
[ "Let", "**", "outs", "**", "be", "the", "arcsOut", "in", "remainder", ":", "outs", "=", "remainder", "∩", "arcsOut", "(", "G", "n", ")", "." ]
python
train
44.522727
i3visio/entify
entify/lib/processing.py
https://github.com/i3visio/entify/blob/51c5b89cebee3a39d44d0918e2798739361f337c/entify/lib/processing.py#L73-L123
def scanFolderForRegexp(folder = None, listRegexp = None, recursive = False, verbosity=1, logFolder= "./logs"): ''' [Optionally] recursive method to scan the files in a given folder. :param folder: the folder to be scanned. :param listRegexp: listRegexp is an array of <RegexpObject>. :param recursive: when T...
[ "def", "scanFolderForRegexp", "(", "folder", "=", "None", ",", "listRegexp", "=", "None", ",", "recursive", "=", "False", ",", "verbosity", "=", "1", ",", "logFolder", "=", "\"./logs\"", ")", ":", "i3visiotools", ".", "logger", ".", "setupLogger", "(", "lo...
[Optionally] recursive method to scan the files in a given folder. :param folder: the folder to be scanned. :param listRegexp: listRegexp is an array of <RegexpObject>. :param recursive: when True, it performs a recursive search on the subfolders. :return: a list of the available objects containing the expre...
[ "[", "Optionally", "]", "recursive", "method", "to", "scan", "the", "files", "in", "a", "given", "folder", "." ]
python
train
33.705882
redcap-tools/PyCap
redcap/project.py
https://github.com/redcap-tools/PyCap/blob/f44c9b62a4f62675aa609c06608663f37e12097e/redcap/project.py#L196-L236
def export_metadata(self, fields=None, forms=None, format='json', df_kwargs=None): """ Export the project's metadata Parameters ---------- fields : list Limit exported metadata to these fields forms : list Limit exported metadata to th...
[ "def", "export_metadata", "(", "self", ",", "fields", "=", "None", ",", "forms", "=", "None", ",", "format", "=", "'json'", ",", "df_kwargs", "=", "None", ")", ":", "ret_format", "=", "format", "if", "format", "==", "'df'", ":", "from", "pandas", "impo...
Export the project's metadata Parameters ---------- fields : list Limit exported metadata to these fields forms : list Limit exported metadata to these forms format : (``'json'``), ``'csv'``, ``'xml'``, ``'df'`` Return the metadata in native o...
[ "Export", "the", "project", "s", "metadata" ]
python
train
35.682927
hydraplatform/hydra-base
hydra_base/lib/template.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/template.py#L349-L355
def get_template_as_json(template_id, **kwargs): """ Get a template (including attribute and dataset definitions) as a JSON string. This is just a wrapper around the get_template_as_dict function. """ user_id = kwargs['user_id'] return json.dumps(get_template_as_dict(template_id, user_id...
[ "def", "get_template_as_json", "(", "template_id", ",", "*", "*", "kwargs", ")", ":", "user_id", "=", "kwargs", "[", "'user_id'", "]", "return", "json", ".", "dumps", "(", "get_template_as_dict", "(", "template_id", ",", "user_id", "=", "user_id", ")", ")" ]
Get a template (including attribute and dataset definitions) as a JSON string. This is just a wrapper around the get_template_as_dict function.
[ "Get", "a", "template", "(", "including", "attribute", "and", "dataset", "definitions", ")", "as", "a", "JSON", "string", ".", "This", "is", "just", "a", "wrapper", "around", "the", "get_template_as_dict", "function", "." ]
python
train
46.285714
loli/medpy
bin/medpy_grid.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/bin/medpy_grid.py#L146-L182
def getParser(): "Creates and returns the argparse parser object." # text epilog =""" examples: %(prog)s -e example.nii grid.nii 10 Generates an empty image with the same attributes as example.nii, overlays it with a regular grid of width 10 voxels and saves it as grid.nii. %(prog)s -e examp...
[ "def", "getParser", "(", ")", ":", "# text", "epilog", "=", "\"\"\"\nexamples:\n %(prog)s -e example.nii grid.nii 10\n Generates an empty image with the same attributes as example.nii, overlays it\n with a regular grid of width 10 voxels and saves it as grid.nii.\n %(prog)s -e example.ni...
Creates and returns the argparse parser object.
[ "Creates", "and", "returns", "the", "argparse", "parser", "object", "." ]
python
train
76.783784
GearPlug/payu-python
payu/recurring.py
https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L502-L516
def get_recurring_bill_by_subscription(self, subscription_id): """ Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente, por suscripción o por rango de fechas. Args: subscription_id: Returns: """ params =...
[ "def", "get_recurring_bill_by_subscription", "(", "self", ",", "subscription_id", ")", ":", "params", "=", "{", "\"subscriptionId\"", ":", "subscription_id", ",", "}", "return", "self", ".", "client", ".", "_get", "(", "self", ".", "url", "+", "'recurringBill'",...
Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente, por suscripción o por rango de fechas. Args: subscription_id: Returns:
[ "Consulta", "de", "las", "facturas", "que", "están", "pagadas", "o", "pendientes", "por", "pagar", ".", "Se", "puede", "consultar", "por", "cliente", "por", "suscripción", "o", "por", "rango", "de", "fechas", "." ]
python
train
31.2
watson-developer-cloud/python-sdk
ibm_watson/compare_comply_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L848-L861
def _from_dict(cls, _dict): """Initialize a AlignedElement object from a json dictionary.""" args = {} if 'element_pair' in _dict: args['element_pair'] = [ ElementPair._from_dict(x) for x in (_dict.get('element_pair')) ] if 'identical_text' in _dic...
[ "def", "_from_dict", "(", "cls", ",", "_dict", ")", ":", "args", "=", "{", "}", "if", "'element_pair'", "in", "_dict", ":", "args", "[", "'element_pair'", "]", "=", "[", "ElementPair", ".", "_from_dict", "(", "x", ")", "for", "x", "in", "(", "_dict",...
Initialize a AlignedElement object from a json dictionary.
[ "Initialize", "a", "AlignedElement", "object", "from", "a", "json", "dictionary", "." ]
python
train
44.642857
biolink/ontobio
ontobio/lexmap.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/lexmap.py#L714-L725
def grouped_mappings(self,id): """ return all mappings for a node, grouped by ID prefix """ g = self.get_xref_graph() m = {} for n in g.neighbors(id): [prefix, local] = n.split(':') if prefix not in m: m[prefix] = [] m[p...
[ "def", "grouped_mappings", "(", "self", ",", "id", ")", ":", "g", "=", "self", ".", "get_xref_graph", "(", ")", "m", "=", "{", "}", "for", "n", "in", "g", ".", "neighbors", "(", "id", ")", ":", "[", "prefix", ",", "local", "]", "=", "n", ".", ...
return all mappings for a node, grouped by ID prefix
[ "return", "all", "mappings", "for", "a", "node", "grouped", "by", "ID", "prefix" ]
python
train
28.5
dossier/dossier.web
dossier/web/config.py
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/config.py#L22-L43
def safe_service(attr, default_value=None): '''A **method** decorator for creating safe services. Given an attribute name, this returns a decorator for creating safe services. Namely, if a service that is not yet available is requested (like a database connection), then ``safe_service`` will log an...
[ "def", "safe_service", "(", "attr", ",", "default_value", "=", "None", ")", ":", "def", "_", "(", "fun", ")", ":", "@", "functools", ".", "wraps", "(", "fun", ")", "def", "run", "(", "self", ")", ":", "try", ":", "return", "fun", "(", "self", ")"...
A **method** decorator for creating safe services. Given an attribute name, this returns a decorator for creating safe services. Namely, if a service that is not yet available is requested (like a database connection), then ``safe_service`` will log any errors and set the given attribute to ``default_v...
[ "A", "**", "method", "**", "decorator", "for", "creating", "safe", "services", "." ]
python
train
34.227273
Nic30/hwt
hwt/serializer/ip_packager.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/ip_packager.py#L132-L142
def serializeType(self, hdlType: HdlType) -> str: """ :see: doc of method on parent class """ def createTmpVar(suggestedName, dtype): raise NotImplementedError( "Can not seraialize hdl type %r into" "ipcore format" % (hdlType)) return...
[ "def", "serializeType", "(", "self", ",", "hdlType", ":", "HdlType", ")", "->", "str", ":", "def", "createTmpVar", "(", "suggestedName", ",", "dtype", ")", ":", "raise", "NotImplementedError", "(", "\"Can not seraialize hdl type %r into\"", "\"ipcore format\"", "%",...
:see: doc of method on parent class
[ ":", "see", ":", "doc", "of", "method", "on", "parent", "class" ]
python
test
34.090909
tBaxter/python-card-me
card_me/base.py
https://github.com/tBaxter/python-card-me/blob/ffebc7fed44f83983b7438e57263dcda67207664/card_me/base.py#L136-L161
def transformToNative(self): """ Transform this object into a custom VBase subclass. transformToNative should always return a representation of this object. It may do so by modifying self in place then returning self, or by creating a new object. """ if self.isN...
[ "def", "transformToNative", "(", "self", ")", ":", "if", "self", ".", "isNative", "or", "not", "self", ".", "behavior", "or", "not", "self", ".", "behavior", ".", "hasNative", ":", "return", "self", "else", ":", "try", ":", "return", "self", ".", "beha...
Transform this object into a custom VBase subclass. transformToNative should always return a representation of this object. It may do so by modifying self in place then returning self, or by creating a new object.
[ "Transform", "this", "object", "into", "a", "custom", "VBase", "subclass", "." ]
python
train
40.346154
NYUCCL/psiTurk
psiturk/psiturk_shell.py
https://github.com/NYUCCL/psiTurk/blob/7170b992a0b5f56c165929cf87b3d3a1f3336c36/psiturk/psiturk_shell.py#L178-L181
def postcmd(self, stop, line): ''' Exit cmd cleanly. ''' self.color_prompt() return Cmd.postcmd(self, stop, line)
[ "def", "postcmd", "(", "self", ",", "stop", ",", "line", ")", ":", "self", ".", "color_prompt", "(", ")", "return", "Cmd", ".", "postcmd", "(", "self", ",", "stop", ",", "line", ")" ]
Exit cmd cleanly.
[ "Exit", "cmd", "cleanly", "." ]
python
train
33.5
timothyb0912/pylogit
pylogit/bootstrap.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/bootstrap.py#L78-L135
def get_param_list_for_prediction(model_obj, replicates): """ Create the `param_list` argument for use with `model_obj.predict`. Parameters ---------- model_obj : an instance of an MNDC object. Should have the following attributes: `['ind_var_names', 'intercept_names', 'shape_names'...
[ "def", "get_param_list_for_prediction", "(", "model_obj", ",", "replicates", ")", ":", "# Check the validity of the passed arguments", "ensure_samples_is_ndim_ndarray", "(", "replicates", ",", "ndim", "=", "2", ",", "name", "=", "'replicates'", ")", "# Determine the number ...
Create the `param_list` argument for use with `model_obj.predict`. Parameters ---------- model_obj : an instance of an MNDC object. Should have the following attributes: `['ind_var_names', 'intercept_names', 'shape_names', 'nest_names']`. This model should have already undergone a c...
[ "Create", "the", "param_list", "argument", "for", "use", "with", "model_obj", ".", "predict", "." ]
python
train
42.344828
coin-or/GiMPy
src/gimpy/graph.py
https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L338-L370
def add_edge(self, name1, name2, **attr): ''' API: add_edge(self, name1, name2, **attr) Description: Adds edge to the graph. Sets edge attributes using attr argument. Input: name1: Name of the source node (if directed). name2: Name of the sink node (if dir...
[ "def", "add_edge", "(", "self", ",", "name1", ",", "name2", ",", "*", "*", "attr", ")", ":", "if", "(", "name1", ",", "name2", ")", "in", "self", ".", "edge_attr", ":", "raise", "MultipleEdgeException", "if", "self", ".", "graph_type", "is", "UNDIRECTE...
API: add_edge(self, name1, name2, **attr) Description: Adds edge to the graph. Sets edge attributes using attr argument. Input: name1: Name of the source node (if directed). name2: Name of the sink node (if directed). attr: Edge attributes. Pre: ...
[ "API", ":", "add_edge", "(", "self", "name1", "name2", "**", "attr", ")", "Description", ":", "Adds", "edge", "to", "the", "graph", ".", "Sets", "edge", "attributes", "using", "attr", "argument", ".", "Input", ":", "name1", ":", "Name", "of", "the", "s...
python
train
41.878788
jxtech/wechatpy
wechatpy/client/api/message.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/message.py#L148-L180
def send_music(self, user_id, url, hq_url, thumb_media_id, title=None, description=None, account=None): """ 发送音乐消息 详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html :param user_id: 用户 ID 。 就是你收到的 `Message` 的 source :param url:...
[ "def", "send_music", "(", "self", ",", "user_id", ",", "url", ",", "hq_url", ",", "thumb_media_id", ",", "title", "=", "None", ",", "description", "=", "None", ",", "account", "=", "None", ")", ":", "music_data", "=", "{", "'musicurl'", ":", "url", ","...
发送音乐消息 详情请参考 http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html :param user_id: 用户 ID 。 就是你收到的 `Message` 的 source :param url: 音乐链接 :param hq_url: 高品质音乐链接,wifi环境优先使用该链接播放音乐 :param thumb_media_id: 缩略图的媒体ID。 可以通过 :func:`upload_media` 上传。 :param ti...
[ "发送音乐消息" ]
python
train
30.575758
videntity/django-djmongo
djmongo/search/views.py
https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/search/views.py#L835-L847
def delete_simple_httpauth_read_api( request, database_name, collection_name, slug): """Delete Simple PublicReadAPI""" ss = get_object_or_404(HTTPAuthReadAPI, database_name=database_name, collection_name=collection_name, slug=slug) ss.delete() m...
[ "def", "delete_simple_httpauth_read_api", "(", "request", ",", "database_name", ",", "collection_name", ",", "slug", ")", ":", "ss", "=", "get_object_or_404", "(", "HTTPAuthReadAPI", ",", "database_name", "=", "database_name", ",", "collection_name", "=", "collection_...
Delete Simple PublicReadAPI
[ "Delete", "Simple", "PublicReadAPI" ]
python
train
38.846154
spyder-ide/spyder
spyder/config/gui.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L116-L127
def config_shortcut(action, context, name, parent): """ Create a Shortcut namedtuple for a widget The data contained in this tuple will be registered in our shortcuts preferences page """ keystr = get_shortcut(context, name) qsc = QShortcut(QKeySequence(keystr), parent, action) qsc....
[ "def", "config_shortcut", "(", "action", ",", "context", ",", "name", ",", "parent", ")", ":", "keystr", "=", "get_shortcut", "(", "context", ",", "name", ")", "qsc", "=", "QShortcut", "(", "QKeySequence", "(", "keystr", ")", ",", "parent", ",", "action"...
Create a Shortcut namedtuple for a widget The data contained in this tuple will be registered in our shortcuts preferences page
[ "Create", "a", "Shortcut", "namedtuple", "for", "a", "widget", "The", "data", "contained", "in", "this", "tuple", "will", "be", "registered", "in", "our", "shortcuts", "preferences", "page" ]
python
train
34.083333
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3203-L3223
def disable_all_breakpoints(self): """ Disables all breakpoints in all processes. @see: disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint """ # disable code breakpoints for (pid, bp) in self.get_all_code_br...
[ "def", "disable_all_breakpoints", "(", "self", ")", ":", "# disable code breakpoints", "for", "(", "pid", ",", "bp", ")", "in", "self", ".", "get_all_code_breakpoints", "(", ")", ":", "self", ".", "disable_code_breakpoint", "(", "pid", ",", "bp", ".", "get_add...
Disables all breakpoints in all processes. @see: disable_code_breakpoint, disable_page_breakpoint, disable_hardware_breakpoint
[ "Disables", "all", "breakpoints", "in", "all", "processes", "." ]
python
train
33.52381
saltstack/salt
salt/config/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/config/__init__.py#L2370-L2381
def insert_system_path(opts, paths): ''' Inserts path into python path taking into consideration 'root_dir' option. ''' if isinstance(paths, six.string_types): paths = [paths] for path in paths: path_options = {'path': path, 'root_dir': opts['root_dir']} prepend_root_dir(path...
[ "def", "insert_system_path", "(", "opts", ",", "paths", ")", ":", "if", "isinstance", "(", "paths", ",", "six", ".", "string_types", ")", ":", "paths", "=", "[", "paths", "]", "for", "path", "in", "paths", ":", "path_options", "=", "{", "'path'", ":", ...
Inserts path into python path taking into consideration 'root_dir' option.
[ "Inserts", "path", "into", "python", "path", "taking", "into", "consideration", "root_dir", "option", "." ]
python
train
41
ahwillia/tensortools
tensortools/operations.py
https://github.com/ahwillia/tensortools/blob/f375633ec621caa96665a56205dcf932590d4a6e/tensortools/operations.py#L31-L58
def khatri_rao(matrices): """Khatri-Rao product of a list of matrices. Parameters ---------- matrices : list of ndarray Returns ------- khatri_rao_product: matrix of shape ``(prod(n_i), m)`` where ``prod(n_i) = prod([m.shape[0] for m in matrices])`` i.e. the product of the ...
[ "def", "khatri_rao", "(", "matrices", ")", ":", "n_columns", "=", "matrices", "[", "0", "]", ".", "shape", "[", "1", "]", "n_factors", "=", "len", "(", "matrices", ")", "start", "=", "ord", "(", "'a'", ")", "common_dim", "=", "'z'", "target", "=", ...
Khatri-Rao product of a list of matrices. Parameters ---------- matrices : list of ndarray Returns ------- khatri_rao_product: matrix of shape ``(prod(n_i), m)`` where ``prod(n_i) = prod([m.shape[0] for m in matrices])`` i.e. the product of the number of rows of all the matrice...
[ "Khatri", "-", "Rao", "product", "of", "a", "list", "of", "matrices", "." ]
python
train
27.5
gwastro/pycbc
pycbc/tmpltbank/em_progenitors.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/tmpltbank/em_progenitors.py#L413-L490
def remnant_mass(eta, ns_g_mass, ns_sequence, chi, incl, shift): """ Function that determines the remnant disk mass of an NS-BH system using the fit to numerical-relativity results discussed in Foucart PRD 86, 124007 (2012). Parameters ----------- eta: float the symmetric mass ratio...
[ "def", "remnant_mass", "(", "eta", ",", "ns_g_mass", ",", "ns_sequence", ",", "chi", ",", "incl", ",", "shift", ")", ":", "# Sanity checks", "if", "not", "(", "eta", ">", "0.", "and", "eta", "<=", "0.25", "and", "abs", "(", "chi", ")", "<=", "1", "...
Function that determines the remnant disk mass of an NS-BH system using the fit to numerical-relativity results discussed in Foucart PRD 86, 124007 (2012). Parameters ----------- eta: float the symmetric mass ratio of the binary ns_g_mass: float NS gravitational mass (in solar m...
[ "Function", "that", "determines", "the", "remnant", "disk", "mass", "of", "an", "NS", "-", "BH", "system", "using", "the", "fit", "to", "numerical", "-", "relativity", "results", "discussed", "in", "Foucart", "PRD", "86", "124007", "(", "2012", ")", "." ]
python
train
40.24359
jazzband/django-mongonaut
mongonaut/views.py
https://github.com/jazzband/django-mongonaut/blob/5485b2e029dff8ae267a4cb39c92d0a72cb5b144/mongonaut/views.py#L55-L71
def get_qset(self, queryset, q): """Performs filtering against the default queryset returned by mongoengine. """ if self.mongoadmin.search_fields and q: params = {} for field in self.mongoadmin.search_fields: if field == 'id': ...
[ "def", "get_qset", "(", "self", ",", "queryset", ",", "q", ")", ":", "if", "self", ".", "mongoadmin", ".", "search_fields", "and", "q", ":", "params", "=", "{", "}", "for", "field", "in", "self", ".", "mongoadmin", ".", "search_fields", ":", "if", "f...
Performs filtering against the default queryset returned by mongoengine.
[ "Performs", "filtering", "against", "the", "default", "queryset", "returned", "by", "mongoengine", "." ]
python
valid
40.294118
HydrelioxGitHub/pybbox
pybbox/bboxApiCall.py
https://github.com/HydrelioxGitHub/pybbox/blob/bedcdccab5d18d36890ef8bf414845f2dec18b5c/pybbox/bboxApiCall.py#L32-L57
def execute_api_request(self): """ Execute the request and return json data as a dict :return: data dict """ if not self.auth.check_auth(): raise Exception('Authentification needed or API not available with your type of connection') if self.auth.is_authentifie...
[ "def", "execute_api_request", "(", "self", ")", ":", "if", "not", "self", ".", "auth", ".", "check_auth", "(", ")", ":", "raise", "Exception", "(", "'Authentification needed or API not available with your type of connection'", ")", "if", "self", ".", "auth", ".", ...
Execute the request and return json data as a dict :return: data dict
[ "Execute", "the", "request", "and", "return", "json", "data", "as", "a", "dict", ":", "return", ":", "data", "dict" ]
python
train
44.384615
O365/python-o365
O365/utils/token.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/token.py#L192-L209
def save_token(self): """ Saves the token dict in the store :return bool: Success / Failure """ if self.token is None: raise ValueError('You have to set the "token" first.') try: # set token will overwrite previous data self.doc_ref.se...
[ "def", "save_token", "(", "self", ")", ":", "if", "self", ".", "token", "is", "None", ":", "raise", "ValueError", "(", "'You have to set the \"token\" first.'", ")", "try", ":", "# set token will overwrite previous data", "self", ".", "doc_ref", ".", "set", "(", ...
Saves the token dict in the store :return bool: Success / Failure
[ "Saves", "the", "token", "dict", "in", "the", "store", ":", "return", "bool", ":", "Success", "/", "Failure" ]
python
train
29.666667
ergoithz/browsepy
browsepy/compat.py
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/compat.py#L236-L259
def pathconf(path, os_name=os.name, isdir_fnc=os.path.isdir, pathconf_fnc=getattr(os, 'pathconf', None), pathconf_names=getattr(os, 'pathconf_names', ())): ''' Get all pathconf variables for given path. :param path: absolute fs path :type path: str ...
[ "def", "pathconf", "(", "path", ",", "os_name", "=", "os", ".", "name", ",", "isdir_fnc", "=", "os", ".", "path", ".", "isdir", ",", "pathconf_fnc", "=", "getattr", "(", "os", ",", "'pathconf'", ",", "None", ")", ",", "pathconf_names", "=", "getattr", ...
Get all pathconf variables for given path. :param path: absolute fs path :type path: str :returns: dictionary containing pathconf keys and their values (both str) :rtype: dict
[ "Get", "all", "pathconf", "variables", "for", "given", "path", "." ]
python
train
31.791667
klmitch/tendril
tendril/connection.py
https://github.com/klmitch/tendril/blob/207102c83e88f8f1fa7ba605ef0aab2ae9078b36/tendril/connection.py#L169-L183
def closed(self, error=None): """ Notify the application that the connection has been closed. :param error: The exception which has caused the connection to be closed. If the connection has been closed due to an EOF, pass ``None``. """ ...
[ "def", "closed", "(", "self", ",", "error", "=", "None", ")", ":", "if", "self", ".", "_application", ":", "try", ":", "self", ".", "_application", ".", "closed", "(", "error", ")", "except", "Exception", ":", "# Ignore exceptions from the notification", "pa...
Notify the application that the connection has been closed. :param error: The exception which has caused the connection to be closed. If the connection has been closed due to an EOF, pass ``None``.
[ "Notify", "the", "application", "that", "the", "connection", "has", "been", "closed", "." ]
python
train
33.6
m0n5t3r/sentry-zabbix
src/sentry_zabbix/plugin.py
https://github.com/m0n5t3r/sentry-zabbix/blob/3dc6e245b3d67de54e4bd41d2bc9b715fee2dbd2/src/sentry_zabbix/plugin.py#L45-L50
def is_configured(self, project, **kwargs): """ Check if plugin is configured. """ params = self.get_option return bool(params('server_host', project) and params('server_port', project))
[ "def", "is_configured", "(", "self", ",", "project", ",", "*", "*", "kwargs", ")", ":", "params", "=", "self", ".", "get_option", "return", "bool", "(", "params", "(", "'server_host'", ",", "project", ")", "and", "params", "(", "'server_port'", ",", "pro...
Check if plugin is configured.
[ "Check", "if", "plugin", "is", "configured", "." ]
python
valid
36.833333
nitely/django-hooks
hooks/templatehook.py
https://github.com/nitely/django-hooks/blob/26ea2150c9be110e90b9ee60fbfd1065ac30ab1d/hooks/templatehook.py#L99-L115
def register(self, name, func): """ Register a new callback.\ When the name/id is not found\ a new hook is created under its name,\ meaning the hook is usually created by\ the first registered callback :param str name: Hook name :param callable func: A fu...
[ "def", "register", "(", "self", ",", "name", ",", "func", ")", ":", "try", ":", "templatehook", "=", "self", ".", "_registry", "[", "name", "]", "except", "KeyError", ":", "templatehook", "=", "self", ".", "_register", "(", "name", ")", "templatehook", ...
Register a new callback.\ When the name/id is not found\ a new hook is created under its name,\ meaning the hook is usually created by\ the first registered callback :param str name: Hook name :param callable func: A func reference (callback)
[ "Register", "a", "new", "callback", ".", "\\", "When", "the", "name", "/", "id", "is", "not", "found", "\\", "a", "new", "hook", "is", "created", "under", "its", "name", "\\", "meaning", "the", "hook", "is", "usually", "created", "by", "\\", "the", "...
python
train
30
HttpRunner/HttpRunner
httprunner/report.py
https://github.com/HttpRunner/HttpRunner/blob/f259551bf9c8ba905eae5c1afcf2efea20ae0871/httprunner/report.py#L92-L106
def stringify_summary(summary): """ stringify summary, in order to dump json file and generate html report. """ for index, suite_summary in enumerate(summary["details"]): if not suite_summary.get("name"): suite_summary["name"] = "testcase {}".format(index) for record in suite_s...
[ "def", "stringify_summary", "(", "summary", ")", ":", "for", "index", ",", "suite_summary", "in", "enumerate", "(", "summary", "[", "\"details\"", "]", ")", ":", "if", "not", "suite_summary", ".", "get", "(", "\"name\"", ")", ":", "suite_summary", "[", "\"...
stringify summary, in order to dump json file and generate html report.
[ "stringify", "summary", "in", "order", "to", "dump", "json", "file", "and", "generate", "html", "report", "." ]
python
train
44.8
johntruckenbrodt/spatialist
spatialist/auxil.py
https://github.com/johntruckenbrodt/spatialist/blob/007f49296a156de8d7168ad235b5a5b8e8d3633d/spatialist/auxil.py#L113-L134
def gdalwarp(src, dst, options): """ a simple wrapper for :osgeo:func:`gdal.Warp` Parameters ---------- src: str, :osgeo:class:`ogr.DataSource` or :osgeo:class:`gdal.Dataset` the input data set dst: str the output data set options: dict additional parameters passed t...
[ "def", "gdalwarp", "(", "src", ",", "dst", ",", "options", ")", ":", "try", ":", "out", "=", "gdal", ".", "Warp", "(", "dst", ",", "src", ",", "options", "=", "gdal", ".", "WarpOptions", "(", "*", "*", "options", ")", ")", "except", "RuntimeError",...
a simple wrapper for :osgeo:func:`gdal.Warp` Parameters ---------- src: str, :osgeo:class:`ogr.DataSource` or :osgeo:class:`gdal.Dataset` the input data set dst: str the output data set options: dict additional parameters passed to gdal.Warp; see :osgeo:func:`gdal.WarpOption...
[ "a", "simple", "wrapper", "for", ":", "osgeo", ":", "func", ":", "gdal", ".", "Warp" ]
python
train
27.727273
saltstack/salt
salt/states/user.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/user.py#L225-L872
def present(name, uid=None, gid=None, usergroup=None, groups=None, optional_groups=None, remove_groups=True, home=None, createhome=True, password=None, hash_password=False, enforce_passwor...
[ "def", "present", "(", "name", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "usergroup", "=", "None", ",", "groups", "=", "None", ",", "optional_groups", "=", "None", ",", "remove_groups", "=", "True", ",", "home", "=", "None", ",", "create...
Ensure that the named user is present with the specified properties name The name of the user to manage uid The user id to assign. If not specified, and the user does not exist, then the next available uid will be assigned. gid The id of the default group to assign to the ...
[ "Ensure", "that", "the", "named", "user", "is", "present", "with", "the", "specified", "properties" ]
python
train
39.888889
RedHatInsights/insights-core
insights/core/marshalling.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/marshalling.py#L19-L37
def marshal(self, o, use_value_list=False): """ Packages the return from a parser for easy use in a rule. """ if o is None: return elif isinstance(o, dict): if use_value_list: for k, v in o.items(): o[k] = [v] ...
[ "def", "marshal", "(", "self", ",", "o", ",", "use_value_list", "=", "False", ")", ":", "if", "o", "is", "None", ":", "return", "elif", "isinstance", "(", "o", ",", "dict", ")", ":", "if", "use_value_list", ":", "for", "k", ",", "v", "in", "o", "...
Packages the return from a parser for easy use in a rule.
[ "Packages", "the", "return", "from", "a", "parser", "for", "easy", "use", "in", "a", "rule", "." ]
python
train
30.105263
blockstack/blockstack-core
blockstack/lib/nameset/db.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/db.py#L2546-L2559
def namedb_get_all_namespace_ids( cur ): """ Get a list of all READY namespace IDs. """ query = "SELECT namespace_id FROM namespaces WHERE op = ?;" args = (NAMESPACE_READY,) namespace_rows = namedb_query_execute( cur, query, args ) ret = [] for namespace_row in namespace_rows: ...
[ "def", "namedb_get_all_namespace_ids", "(", "cur", ")", ":", "query", "=", "\"SELECT namespace_id FROM namespaces WHERE op = ?;\"", "args", "=", "(", "NAMESPACE_READY", ",", ")", "namespace_rows", "=", "namedb_query_execute", "(", "cur", ",", "query", ",", "args", ")"...
Get a list of all READY namespace IDs.
[ "Get", "a", "list", "of", "all", "READY", "namespace", "IDs", "." ]
python
train
26.142857
noirbizarre/django.js
djangojs/utils.py
https://github.com/noirbizarre/django.js/blob/65b267b04ffc0f969b9f8e2f8ce2f922397c8af1/djangojs/utils.py#L54-L69
def glob(cls, files=None): ''' Glob a pattern or a list of pattern static storage relative(s). ''' files = files or [] if isinstance(files, str): files = os.path.normpath(files) matches = lambda path: matches_patterns(path, [files]) return [pat...
[ "def", "glob", "(", "cls", ",", "files", "=", "None", ")", ":", "files", "=", "files", "or", "[", "]", "if", "isinstance", "(", "files", ",", "str", ")", ":", "files", "=", "os", ".", "path", ".", "normpath", "(", "files", ")", "matches", "=", ...
Glob a pattern or a list of pattern static storage relative(s).
[ "Glob", "a", "pattern", "or", "a", "list", "of", "pattern", "static", "storage", "relative", "(", "s", ")", "." ]
python
train
43.9375
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/mech_cisco_nexus.py#L1121-L1166
def _get_compressed_vlan_list(self, pvlan_ids): """Generate a compressed vlan list ready for XML using a vlan set. Sample Use Case: Input vlan set: -------------- 1 - s = set([11, 50, 25, 30, 15, 16, 3, 8, 2, 1]) 2 - s = set([87, 11, 50, 25, 30, 15, 16, 3, 8, 2, 1, 88])...
[ "def", "_get_compressed_vlan_list", "(", "self", ",", "pvlan_ids", ")", ":", "if", "not", "pvlan_ids", ":", "return", "[", "]", "pvlan_list", "=", "list", "(", "pvlan_ids", ")", "pvlan_list", ".", "sort", "(", ")", "compressed_list", "=", "[", "]", "begin"...
Generate a compressed vlan list ready for XML using a vlan set. Sample Use Case: Input vlan set: -------------- 1 - s = set([11, 50, 25, 30, 15, 16, 3, 8, 2, 1]) 2 - s = set([87, 11, 50, 25, 30, 15, 16, 3, 8, 2, 1, 88]) Returned compressed XML list: -----------...
[ "Generate", "a", "compressed", "vlan", "list", "ready", "for", "XML", "using", "a", "vlan", "set", "." ]
python
train
33.043478
arne-cl/discoursegraphs
src/discoursegraphs/relabel.py
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/relabel.py#L152-L207
def convert_node_labels_to_integers(G, first_label=0, ordering="default", label_attribute=None): """Return a copy of the graph G with the nodes relabeled with integers. Parameters ---------- G : graph A NetworkX graph first_label : int, optional (default=...
[ "def", "convert_node_labels_to_integers", "(", "G", ",", "first_label", "=", "0", ",", "ordering", "=", "\"default\"", ",", "label_attribute", "=", "None", ")", ":", "N", "=", "G", ".", "number_of_nodes", "(", ")", "+", "first_label", "if", "ordering", "==",...
Return a copy of the graph G with the nodes relabeled with integers. Parameters ---------- G : graph A NetworkX graph first_label : int, optional (default=0) An integer specifying the offset in numbering nodes. The n new integer labels are numbered first_label, ..., n-1+first_labe...
[ "Return", "a", "copy", "of", "the", "graph", "G", "with", "the", "nodes", "relabeled", "with", "integers", "." ]
python
train
38.589286
saltstack/salt
salt/modules/smf_service.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smf_service.py#L267-L278
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' cmd = '/usr/sbin/svcadm enable {0}'.format(name) return not __salt__['cmd.retcode'](cmd, python_shell=False)
[ "def", "enable", "(", "name", ",", "*", "*", "kwargs", ")", ":", "cmd", "=", "'/usr/sbin/svcadm enable {0}'", ".", "format", "(", "name", ")", "return", "not", "__salt__", "[", "'cmd.retcode'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")" ]
Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name>
[ "Enable", "the", "named", "service", "to", "start", "at", "boot" ]
python
train
23.916667
ultrabug/py3status
py3status/parse_config.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/parse_config.py#L290-L303
def remove_quotes(self, value): """ Remove any surrounding quotes from a value and unescape any contained quotes of that type. """ # beware the empty string if not value: return value if value[0] == value[-1] == '"': return value[1:-1].rep...
[ "def", "remove_quotes", "(", "self", ",", "value", ")", ":", "# beware the empty string", "if", "not", "value", ":", "return", "value", "if", "value", "[", "0", "]", "==", "value", "[", "-", "1", "]", "==", "'\"'", ":", "return", "value", "[", "1", "...
Remove any surrounding quotes from a value and unescape any contained quotes of that type.
[ "Remove", "any", "surrounding", "quotes", "from", "a", "value", "and", "unescape", "any", "contained", "quotes", "of", "that", "type", "." ]
python
train
31.142857
juju-solutions/charms.reactive
charms/reactive/decorators.py
https://github.com/juju-solutions/charms.reactive/blob/e37e781432e77c12b63d2c739bd6cd70d3230c3a/charms/reactive/decorators.py#L248-L256
def collect_metrics(): """ Register the decorated function to run for the collect_metrics hook. """ def _register(action): handler = Handler.get(action) handler.add_predicate(partial(_restricted_hook, 'collect-metrics')) return action return _register
[ "def", "collect_metrics", "(", ")", ":", "def", "_register", "(", "action", ")", ":", "handler", "=", "Handler", ".", "get", "(", "action", ")", "handler", ".", "add_predicate", "(", "partial", "(", "_restricted_hook", ",", "'collect-metrics'", ")", ")", "...
Register the decorated function to run for the collect_metrics hook.
[ "Register", "the", "decorated", "function", "to", "run", "for", "the", "collect_metrics", "hook", "." ]
python
train
31.888889
jonhadfield/creds
lib/creds/users.py
https://github.com/jonhadfield/creds/blob/b2053b43516cf742c6e4c2b79713bc625592f47c/lib/creds/users.py#L182-L205
def from_passwd(uid_min=None, uid_max=None): """Create collection from locally discovered data, e.g. /etc/passwd.""" import pwd users = Users(oktypes=User) passwd_list = pwd.getpwall() if not uid_min: uid_min = UID_MIN if not uid_max: uid_max = UID...
[ "def", "from_passwd", "(", "uid_min", "=", "None", ",", "uid_max", "=", "None", ")", ":", "import", "pwd", "users", "=", "Users", "(", "oktypes", "=", "User", ")", "passwd_list", "=", "pwd", ".", "getpwall", "(", ")", "if", "not", "uid_min", ":", "ui...
Create collection from locally discovered data, e.g. /etc/passwd.
[ "Create", "collection", "from", "locally", "discovered", "data", "e", ".", "g", ".", "/", "etc", "/", "passwd", "." ]
python
train
49.541667
kwarunek/file2py
file2py/conv.py
https://github.com/kwarunek/file2py/blob/f94730b6d4f40ea22b5f048126f60fa14c0e2bf0/file2py/conv.py#L60-L72
def add_file(self, filename): """ Read and adds given file's content to data array that will be used to generate output :param filename File name to add :type str or unicode """ with (open(filename, 'rb')) as f: data = f.read() # below won't handle th...
[ "def", "add_file", "(", "self", ",", "filename", ")", ":", "with", "(", "open", "(", "filename", ",", "'rb'", ")", ")", "as", "f", ":", "data", "=", "f", ".", "read", "(", ")", "# below won't handle the same name files", "# in different paths", "fname", "=...
Read and adds given file's content to data array that will be used to generate output :param filename File name to add :type str or unicode
[ "Read", "and", "adds", "given", "file", "s", "content", "to", "data", "array", "that", "will", "be", "used", "to", "generate", "output" ]
python
train
34.461538
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/sandbox.py#L224-L240
def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" setup_dir = os.path.abspath(os.path.dirname(setup_script)) with setup_context(setup_dir): try: sys.argv[:] = [setup_script]+list(args) sys.path.insert(0, setup_dir) #...
[ "def", "run_setup", "(", "setup_script", ",", "args", ")", ":", "setup_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "setup_script", ")", ")", "with", "setup_context", "(", "setup_dir", ")", ":", "try", ":",...
Run a distutils setup script, sandboxed in its directory
[ "Run", "a", "distutils", "setup", "script", "sandboxed", "in", "its", "directory" ]
python
test
43.647059
quiltdata/quilt
compiler/quilt/tools/command.py
https://github.com/quiltdata/quilt/blob/651853e7e89a8af86e0ff26167e752efa5878c12/compiler/quilt/tools/command.py#L620-L646
def build_from_path(package, path, dry_run=False, env='default', outfilename=DEFAULT_BUILDFILE): """ Compile a Quilt data package from a build file. Path can be a directory, in which case the build file will be generated automatically. """ team, owner, pkg, subpath = parse_package(package, allow_sub...
[ "def", "build_from_path", "(", "package", ",", "path", ",", "dry_run", "=", "False", ",", "env", "=", "'default'", ",", "outfilename", "=", "DEFAULT_BUILDFILE", ")", ":", "team", ",", "owner", ",", "pkg", ",", "subpath", "=", "parse_package", "(", "package...
Compile a Quilt data package from a build file. Path can be a directory, in which case the build file will be generated automatically.
[ "Compile", "a", "Quilt", "data", "package", "from", "a", "build", "file", ".", "Path", "can", "be", "a", "directory", "in", "which", "case", "the", "build", "file", "will", "be", "generated", "automatically", "." ]
python
train
42.185185
tgsmith61591/pmdarima
pmdarima/pipeline.py
https://github.com/tgsmith61591/pmdarima/blob/a133de78ba5bd68da9785b061f519ba28cd514cc/pmdarima/pipeline.py#L273-L322
def update(self, y, exogenous=None, maxiter=None, **kwargs): """Update an ARIMA or auto-ARIMA as well as any necessary transformers Passes the newly observed values through the appropriate endog transformations, and the exogenous array through the exog transformers (updating where neces...
[ "def", "update", "(", "self", ",", "y", ",", "exogenous", "=", "None", ",", "maxiter", "=", "None", ",", "*", "*", "kwargs", ")", ":", "check_is_fitted", "(", "self", ",", "\"steps_\"", ")", "# Push the arrays through all of the transformer steps that have the", ...
Update an ARIMA or auto-ARIMA as well as any necessary transformers Passes the newly observed values through the appropriate endog transformations, and the exogenous array through the exog transformers (updating where necessary) before finally updating the ARIMA model. Parameters ...
[ "Update", "an", "ARIMA", "or", "auto", "-", "ARIMA", "as", "well", "as", "any", "necessary", "transformers" ]
python
train
44.9
jaredLunde/redis_structures
redis_structures/__init__.py
https://github.com/jaredLunde/redis_structures/blob/b9cce5f5c85db5e12c292633ff8d04e3ae053294/redis_structures/__init__.py#L1511-L1526
def iter(self, start=0, count=1000): """ @start: #int cursor start position @stop: #int cursor stop position @count: #int buffer limit -> yields all of the items in the list """ cursor = '0' _loads = self._loads stop = start + count wh...
[ "def", "iter", "(", "self", ",", "start", "=", "0", ",", "count", "=", "1000", ")", ":", "cursor", "=", "'0'", "_loads", "=", "self", ".", "_loads", "stop", "=", "start", "+", "count", "while", "cursor", ":", "cursor", "=", "self", ".", "_client", ...
@start: #int cursor start position @stop: #int cursor stop position @count: #int buffer limit -> yields all of the items in the list
[ "@start", ":", "#int", "cursor", "start", "position", "@stop", ":", "#int", "cursor", "stop", "position", "@count", ":", "#int", "buffer", "limit" ]
python
train
32.4375
mwgielen/jackal
jackal/core.py
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L434-L441
def get_domains(self): """ Retrieves the domains of the users from elastic. """ search = User.search() search.aggs.bucket('domains', 'terms', field='domain', order={'_count': 'desc'}, size=100) response = search.execute() return [entry.key for entry in respons...
[ "def", "get_domains", "(", "self", ")", ":", "search", "=", "User", ".", "search", "(", ")", "search", ".", "aggs", ".", "bucket", "(", "'domains'", ",", "'terms'", ",", "field", "=", "'domain'", ",", "order", "=", "{", "'_count'", ":", "'desc'", "}"...
Retrieves the domains of the users from elastic.
[ "Retrieves", "the", "domains", "of", "the", "users", "from", "elastic", "." ]
python
valid
43
aleju/imgaug
imgaug/augmentables/polys.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1776-L1810
def from_shapely(geometry, label=None): """ Create a MultiPolygon from a Shapely MultiPolygon, a Shapely Polygon or a Shapely GeometryCollection. This also creates all necessary Polygons contained by this MultiPolygon. Parameters ---------- geometry : shapely.geometry.M...
[ "def", "from_shapely", "(", "geometry", ",", "label", "=", "None", ")", ":", "# load shapely lazily, which makes the dependency more optional", "import", "shapely", ".", "geometry", "if", "isinstance", "(", "geometry", ",", "shapely", ".", "geometry", ".", "MultiPolyg...
Create a MultiPolygon from a Shapely MultiPolygon, a Shapely Polygon or a Shapely GeometryCollection. This also creates all necessary Polygons contained by this MultiPolygon. Parameters ---------- geometry : shapely.geometry.MultiPolygon or shapely.geometry.Polygon\ ...
[ "Create", "a", "MultiPolygon", "from", "a", "Shapely", "MultiPolygon", "a", "Shapely", "Polygon", "or", "a", "Shapely", "GeometryCollection", "." ]
python
valid
46.771429
zetaops/zengine
zengine/messaging/views.py
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/messaging/views.py#L531-L563
def search_user(current): """ Search users for adding to a public room or creating one to one direct messaging .. code-block:: python # request: { 'view':'_zops_search_user', 'query': string, } # res...
[ "def", "search_user", "(", "current", ")", ":", "current", ".", "output", "=", "{", "'results'", ":", "[", "]", ",", "'status'", ":", "'OK'", ",", "'code'", ":", "201", "}", "qs", "=", "UserModel", "(", "current", ")", ".", "objects", ".", "exclude",...
Search users for adding to a public room or creating one to one direct messaging .. code-block:: python # request: { 'view':'_zops_search_user', 'query': string, } # response: { '...
[ "Search", "users", "for", "adding", "to", "a", "public", "room", "or", "creating", "one", "to", "one", "direct", "messaging" ]
python
train
29.151515
hubo1016/vlcp
vlcp/utils/http.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/http.py#L492-L511
def basicauth(self, realm = b'all', nofail = False): "Try to get the basic authorize info, return (username, password) if succeeded, return 401 otherwise" if b'authorization' in self.headerdict: auth = self.headerdict[b'authorization'] auth_pair = auth.split(b' ', 1) ...
[ "def", "basicauth", "(", "self", ",", "realm", "=", "b'all'", ",", "nofail", "=", "False", ")", ":", "if", "b'authorization'", "in", "self", ".", "headerdict", ":", "auth", "=", "self", ".", "headerdict", "[", "b'authorization'", "]", "auth_pair", "=", "...
Try to get the basic authorize info, return (username, password) if succeeded, return 401 otherwise
[ "Try", "to", "get", "the", "basic", "authorize", "info", "return", "(", "username", "password", ")", "if", "succeeded", "return", "401", "otherwise" ]
python
train
48
bsolomon1124/pyfinance
pyfinance/general.py
https://github.com/bsolomon1124/pyfinance/blob/c95925209a809b4e648e79cbeaf7711d8e5ff1a6/pyfinance/general.py#L715-L722
def loadings(self): """Loadings = eigenvectors times sqrt(eigenvalues).""" loadings = self.v[:, : self.keep] * np.sqrt(self.eigenvalues) cols = ["PC%s" % i for i in range(1, self.keep + 1)] loadings = pd.DataFrame( loadings, columns=cols, index=self.feature_names ...
[ "def", "loadings", "(", "self", ")", ":", "loadings", "=", "self", ".", "v", "[", ":", ",", ":", "self", ".", "keep", "]", "*", "np", ".", "sqrt", "(", "self", ".", "eigenvalues", ")", "cols", "=", "[", "\"PC%s\"", "%", "i", "for", "i", "in", ...
Loadings = eigenvectors times sqrt(eigenvalues).
[ "Loadings", "=", "eigenvectors", "times", "sqrt", "(", "eigenvalues", ")", "." ]
python
train
42.625
ansible/ansible-container
container/core.py
https://github.com/ansible/ansible-container/blob/d031c1a6133d5482a5d054fcbdbecafb923f8b4b/container/core.py#L1038-L1069
def conductorcmd_push(engine_name, project_name, services, **kwargs): """ Push images to a registry """ username = kwargs.pop('username') password = kwargs.pop('password') email = kwargs.pop('email') url = kwargs.pop('url') namespace = kwargs.pop('namespace') tag = kwargs.pop('tag') conf...
[ "def", "conductorcmd_push", "(", "engine_name", ",", "project_name", ",", "services", ",", "*", "*", "kwargs", ")", ":", "username", "=", "kwargs", ".", "pop", "(", "'username'", ")", "password", "=", "kwargs", ".", "pop", "(", "'password'", ")", "email", ...
Push images to a registry
[ "Push", "images", "to", "a", "registry" ]
python
train
50.5625
6809/MC6809
MC6809/example6809.py
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/example6809.py#L65-L127
def crc32(self, data): """ Calculate a ZIP 32-bit CRC from data in memory. Origin code by Johann E. Klasek, j AT klasek at """ data_address = 0x1000 # position of the test data self.cpu.memory.load(data_address, data) # write test data into RAM self.cpu.index_x.s...
[ "def", "crc32", "(", "self", ",", "data", ")", ":", "data_address", "=", "0x1000", "# position of the test data", "self", ".", "cpu", ".", "memory", ".", "load", "(", "data_address", ",", "data", ")", "# write test data into RAM", "self", ".", "cpu", ".", "i...
Calculate a ZIP 32-bit CRC from data in memory. Origin code by Johann E. Klasek, j AT klasek at
[ "Calculate", "a", "ZIP", "32", "-", "bit", "CRC", "from", "data", "in", "memory", ".", "Origin", "code", "by", "Johann", "E", ".", "Klasek", "j", "AT", "klasek", "at" ]
python
train
69.333333
google/grumpy
third_party/pypy/_sha.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pypy/_sha.py#L261-L307
def digest(self): """Terminate the message-digest computation and return digest. Return the digest of the strings passed to the update() method so far. This is a 16-byte string which may contain non-ASCII characters, including null bytes. """ H0 = self.H0 H1 = s...
[ "def", "digest", "(", "self", ")", ":", "H0", "=", "self", ".", "H0", "H1", "=", "self", ".", "H1", "H2", "=", "self", ".", "H2", "H3", "=", "self", ".", "H3", "H4", "=", "self", ".", "H4", "input", "=", "[", "]", "+", "self", ".", "input",...
Terminate the message-digest computation and return digest. Return the digest of the strings passed to the update() method so far. This is a 16-byte string which may contain non-ASCII characters, including null bytes.
[ "Terminate", "the", "message", "-", "digest", "computation", "and", "return", "digest", "." ]
python
valid
26.765957
guinslym/pyexifinfo
setup.py
https://github.com/guinslym/pyexifinfo/blob/56e5b44e77ee17b018a530ec858f19a9c6c07018/setup.py#L35-L59
def check_if_exiftool_is_already_installed(): """Requirements This function will check if Exiftool is installed on your system Return: True if Exiftool is Installed False if not """ result = 1; command = ["exiftool", "-ver"] with open(os.devnull, "w") as fnull: res...
[ "def", "check_if_exiftool_is_already_installed", "(", ")", ":", "result", "=", "1", "command", "=", "[", "\"exiftool\"", ",", "\"-ver\"", "]", "with", "open", "(", "os", ".", "devnull", ",", "\"w\"", ")", "as", "fnull", ":", "result", "=", "subprocess", "....
Requirements This function will check if Exiftool is installed on your system Return: True if Exiftool is Installed False if not
[ "Requirements" ]
python
train
26.24
jacebrowning/comparable
comparable/compound.py
https://github.com/jacebrowning/comparable/blob/48455e613650e22412d31109681368fcc479298d/comparable/compound.py#L48-L75
def similarity(self, other): """Calculate similarity based on best matching permutation of items.""" # Select the longer list as the basis for comparison if len(self.items) > len(other.items): first, second = self, other else: first, second = other, self i...
[ "def", "similarity", "(", "self", ",", "other", ")", ":", "# Select the longer list as the basis for comparison", "if", "len", "(", "self", ".", "items", ")", ">", "len", "(", "other", ".", "items", ")", ":", "first", ",", "second", "=", "self", ",", "othe...
Calculate similarity based on best matching permutation of items.
[ "Calculate", "similarity", "based", "on", "best", "matching", "permutation", "of", "items", "." ]
python
train
39.5
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L624-L632
def _readline_insert(self, char, echo, insptr, line): """Deal properly with inserted chars in a line.""" if not self._readline_do_echo(echo): return # Write out the remainder of the line self.write(char + ''.join(line[insptr:])) # Cursor Left to the current insert poi...
[ "def", "_readline_insert", "(", "self", ",", "char", ",", "echo", ",", "insptr", ",", "line", ")", ":", "if", "not", "self", ".", "_readline_do_echo", "(", "echo", ")", ":", "return", "# Write out the remainder of the line", "self", ".", "write", "(", "char"...
Deal properly with inserted chars in a line.
[ "Deal", "properly", "with", "inserted", "chars", "in", "a", "line", "." ]
python
train
45.444444
mozilla/funfactory
funfactory/helpers.py
https://github.com/mozilla/funfactory/blob/c9bbf1c534eaa15641265bc75fa87afca52b7dd6/funfactory/helpers.py#L34-L52
def urlparams(url_, hash=None, **query): """Add a fragment and/or query paramaters to a URL. New query params will be appended to exising parameters, except duplicate names, which will be replaced. """ url = urlparse.urlparse(url_) fragment = hash if hash is not None else url.fragment # Us...
[ "def", "urlparams", "(", "url_", ",", "hash", "=", "None", ",", "*", "*", "query", ")", ":", "url", "=", "urlparse", ".", "urlparse", "(", "url_", ")", "fragment", "=", "hash", "if", "hash", "is", "not", "None", "else", "url", ".", "fragment", "# U...
Add a fragment and/or query paramaters to a URL. New query params will be appended to exising parameters, except duplicate names, which will be replaced.
[ "Add", "a", "fragment", "and", "/", "or", "query", "paramaters", "to", "a", "URL", "." ]
python
train
40.578947
stefanfoulis/django-sendsms
sendsms/backends/smspubli.py
https://github.com/stefanfoulis/django-sendsms/blob/375f469789866853253eceba936ebcff98e83c07/sendsms/backends/smspubli.py#L59-L113
def _send(self, message): """ Private method for send one message. :param SmsMessage message: SmsMessage class instance. :returns: True if message is sended else False :rtype: bool """ params = { 'V': SMSPUBLI_API_VERSION, 'UN': SMSPUBLI...
[ "def", "_send", "(", "self", ",", "message", ")", ":", "params", "=", "{", "'V'", ":", "SMSPUBLI_API_VERSION", ",", "'UN'", ":", "SMSPUBLI_USERNAME", ",", "'PWD'", ":", "SMSPUBLI_PASSWORD", ",", "'R'", ":", "SMSPUBLI_ROUTE", ",", "'SA'", ":", "message", "....
Private method for send one message. :param SmsMessage message: SmsMessage class instance. :returns: True if message is sended else False :rtype: bool
[ "Private", "method", "for", "send", "one", "message", "." ]
python
train
29.927273
babab/pycommand
pycommand/pycommand.py
https://github.com/babab/pycommand/blob/07237cd3a624e7b5688edca17ae38bf8b28b74d4/pycommand/pycommand.py#L216-L223
def run_and_exit(command_class): '''A shortcut for reading from sys.argv and exiting the interpreter''' cmd = command_class(sys.argv[1:]) if cmd.error: print('error: {0}'.format(cmd.error)) sys.exit(1) else: sys.exit(cmd.run())
[ "def", "run_and_exit", "(", "command_class", ")", ":", "cmd", "=", "command_class", "(", "sys", ".", "argv", "[", "1", ":", "]", ")", "if", "cmd", ".", "error", ":", "print", "(", "'error: {0}'", ".", "format", "(", "cmd", ".", "error", ")", ")", "...
A shortcut for reading from sys.argv and exiting the interpreter
[ "A", "shortcut", "for", "reading", "from", "sys", ".", "argv", "and", "exiting", "the", "interpreter" ]
python
train
32.5
trailofbits/manticore
manticore/native/memory.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/memory.py#L1026-L1098
def read(self, address, size, force=False): """ Read a stream of potentially symbolic bytes from a potentially symbolic address :param address: Where to read from :param size: How many bytes :param force: Whether to ignore permissions :rtype: list """ ...
[ "def", "read", "(", "self", ",", "address", ",", "size", ",", "force", "=", "False", ")", ":", "size", "=", "self", ".", "_get_size", "(", "size", ")", "assert", "not", "issymbolic", "(", "size", ")", "if", "issymbolic", "(", "address", ")", ":", "...
Read a stream of potentially symbolic bytes from a potentially symbolic address :param address: Where to read from :param size: How many bytes :param force: Whether to ignore permissions :rtype: list
[ "Read", "a", "stream", "of", "potentially", "symbolic", "bytes", "from", "a", "potentially", "symbolic", "address" ]
python
valid
49.205479
zeaphoo/reston
reston/core/dvm.py
https://github.com/zeaphoo/reston/blob/96502487b2259572df55237c9526f92627465088/reston/core/dvm.py#L2142-L2151
def get_parameters_off_value(self): """ Return the string associated to the parameters_off :rtype: string """ if self.parameters_off_value == None: params = self.CM.get_type_list(self.parameters_off) self.parameters_off_value = '({})'.format(' '.j...
[ "def", "get_parameters_off_value", "(", "self", ")", ":", "if", "self", ".", "parameters_off_value", "==", "None", ":", "params", "=", "self", ".", "CM", ".", "get_type_list", "(", "self", ".", "parameters_off", ")", "self", ".", "parameters_off_value", "=", ...
Return the string associated to the parameters_off :rtype: string
[ "Return", "the", "string", "associated", "to", "the", "parameters_off" ]
python
train
36.4
apache/spark
python/pyspark/streaming/dstream.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/streaming/dstream.py#L128-L134
def reduceByKey(self, func, numPartitions=None): """ Return a new DStream by applying reduceByKey to each RDD. """ if numPartitions is None: numPartitions = self._sc.defaultParallelism return self.combineByKey(lambda x: x, func, func, numPartitions)
[ "def", "reduceByKey", "(", "self", ",", "func", ",", "numPartitions", "=", "None", ")", ":", "if", "numPartitions", "is", "None", ":", "numPartitions", "=", "self", ".", "_sc", ".", "defaultParallelism", "return", "self", ".", "combineByKey", "(", "lambda", ...
Return a new DStream by applying reduceByKey to each RDD.
[ "Return", "a", "new", "DStream", "by", "applying", "reduceByKey", "to", "each", "RDD", "." ]
python
train
42.142857
reingart/pyafipws
utils.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/utils.py#L617-L649
def escribir(dic, formato, contraer_fechas=False): "Genera una cadena dado un formato y un diccionario de claves/valores" linea = " " * sum([fmt[1] for fmt in formato]) comienzo = 1 for fmt in formato: clave, longitud, tipo = fmt[0:3] try: dec = (len(fmt)>3 and isinstance(fmt...
[ "def", "escribir", "(", "dic", ",", "formato", ",", "contraer_fechas", "=", "False", ")", ":", "linea", "=", "\" \"", "*", "sum", "(", "[", "fmt", "[", "1", "]", "for", "fmt", "in", "formato", "]", ")", "comienzo", "=", "1", "for", "fmt", "in", "...
Genera una cadena dado un formato y un diccionario de claves/valores
[ "Genera", "una", "cadena", "dado", "un", "formato", "y", "un", "diccionario", "de", "claves", "/", "valores" ]
python
train
45.969697
markovmodel/PyEMMA
pyemma/_ext/variational/estimators/moments.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/_ext/variational/estimators/moments.py#L699-L839
def moments_XXXY(X, Y, remove_mean=False, symmetrize=False, weights=None, modify_data=False, sparse_mode='auto', sparse_tol=0.0, column_selection=None, diag_only=False): """ Computes the first two unnormalized moments of X and Y If symmetrize is False, computes .. math: ...
[ "def", "moments_XXXY", "(", "X", ",", "Y", ",", "remove_mean", "=", "False", ",", "symmetrize", "=", "False", ",", "weights", "=", "None", ",", "modify_data", "=", "False", ",", "sparse_mode", "=", "'auto'", ",", "sparse_tol", "=", "0.0", ",", "column_se...
Computes the first two unnormalized moments of X and Y If symmetrize is False, computes .. math: s_x &=& \sum_t x_t s_y &=& \sum_t y_t C_XX &=& X^\top X C_XY &=& X^\top Y If symmetrize is True, computes .. math: s_x = s_y &=& \frac{1}{2} \sum_t(x_t + y_t) ...
[ "Computes", "the", "first", "two", "unnormalized", "moments", "of", "X", "and", "Y" ]
python
train
47.255319
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1251-L1261
def add_ignore(self, depend): """Adds dependencies to ignore.""" try: self._add_child(self.ignore, self.ignore_set, depend) except TypeError as e: e = e.args[0] if SCons.Util.is_List(e): s = list(map(str, e)) else: s...
[ "def", "add_ignore", "(", "self", ",", "depend", ")", ":", "try", ":", "self", ".", "_add_child", "(", "self", ".", "ignore", ",", "self", ".", "ignore_set", ",", "depend", ")", "except", "TypeError", "as", "e", ":", "e", "=", "e", ".", "args", "["...
Adds dependencies to ignore.
[ "Adds", "dependencies", "to", "ignore", "." ]
python
train
42.181818
saltstack/salt
salt/modules/boto_apigateway.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_apigateway.py#L427-L443
def describe_api_key(apiKey, region=None, key=None, keyid=None, profile=None): ''' Gets info about the given api key CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_key apigw_api_key ''' try: conn = _get_conn(region=region, key=key, keyid=keyid, p...
[ "def", "describe_api_key", "(", "apiKey", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "k...
Gets info about the given api key CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_key apigw_api_key
[ "Gets", "info", "about", "the", "given", "api", "key" ]
python
train
30.352941
numenta/nupic
src/nupic/regions/knn_anomaly_classifier_region.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_anomaly_classifier_region.py#L697-L757
def addLabel(self, start, end, labelName): """ Add the label labelName to each record with record ROWID in range from ``start`` to ``end``, noninclusive of end. This will recalculate all points from end to the last record stored in the internal cache of this classifier. :param start: (int) sta...
[ "def", "addLabel", "(", "self", ",", "start", ",", "end", ",", "labelName", ")", ":", "if", "len", "(", "self", ".", "_recordsCache", ")", "==", "0", ":", "raise", "HTMPredictionModelInvalidRangeError", "(", "\"Invalid supplied range for 'addLabel'. \"", "\"Model ...
Add the label labelName to each record with record ROWID in range from ``start`` to ``end``, noninclusive of end. This will recalculate all points from end to the last record stored in the internal cache of this classifier. :param start: (int) start index :param end: (int) end index (noninclusive...
[ "Add", "the", "label", "labelName", "to", "each", "record", "with", "record", "ROWID", "in", "range", "from", "start", "to", "end", "noninclusive", "of", "end", "." ]
python
valid
31.704918
tjcsl/ion
intranet/apps/announcements/notifications.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/announcements/notifications.py#L76-L113
def announcement_approved_email(request, obj, req): """Email the requested teachers and submitter whenever an administrator approves an announcement request. obj: the Announcement object req: the AnnouncementRequest object """ if not settings.PRODUCTION: logger.debug("Not in productio...
[ "def", "announcement_approved_email", "(", "request", ",", "obj", ",", "req", ")", ":", "if", "not", "settings", ".", "PRODUCTION", ":", "logger", ".", "debug", "(", "\"Not in production. Ignoring email for approved announcement.\"", ")", "return", "subject", "=", "...
Email the requested teachers and submitter whenever an administrator approves an announcement request. obj: the Announcement object req: the AnnouncementRequest object
[ "Email", "the", "requested", "teachers", "and", "submitter", "whenever", "an", "administrator", "approves", "an", "announcement", "request", "." ]
python
train
45.289474
luckydonald/pytgbot
pytgbot/api_types/sendable/inline.py
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/pytgbot/api_types/sendable/inline.py#L3850-L3875
def from_array(array): """ Deserialize a new InlineQueryResultCachedAudio from a given dictionary. :return: new InlineQueryResultCachedAudio instance. :rtype: InlineQueryResultCachedAudio """ if array is None or not array: return None # end if ...
[ "def", "from_array", "(", "array", ")", ":", "if", "array", "is", "None", "or", "not", "array", ":", "return", "None", "# end if", "assert_type_or_raise", "(", "array", ",", "dict", ",", "parameter_name", "=", "\"array\"", ")", "from", "pytgbot", ".", "api...
Deserialize a new InlineQueryResultCachedAudio from a given dictionary. :return: new InlineQueryResultCachedAudio instance. :rtype: InlineQueryResultCachedAudio
[ "Deserialize", "a", "new", "InlineQueryResultCachedAudio", "from", "a", "given", "dictionary", "." ]
python
train
46.769231
wummel/linkchecker
linkcheck/logger/gxml.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/gxml.py#L84-L90
def end_output (self, **kwargs): """Finish graph output, and print end of checking info as xml comment.""" self.xml_endtag(u"graph") self.xml_endtag(u"GraphXML") self.xml_end_output() self.close_fileoutput()
[ "def", "end_output", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "xml_endtag", "(", "u\"graph\"", ")", "self", ".", "xml_endtag", "(", "u\"GraphXML\"", ")", "self", ".", "xml_end_output", "(", ")", "self", ".", "close_fileoutput", "(", "...
Finish graph output, and print end of checking info as xml comment.
[ "Finish", "graph", "output", "and", "print", "end", "of", "checking", "info", "as", "xml", "comment", "." ]
python
train
35.571429
saltstack/salt
salt/cloud/libcloudfuncs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L302-L316
def get_size(conn, vm_): ''' Return the VM's size object ''' sizes = conn.list_sizes() vm_size = config.get_cloud_config_value('size', vm_, __opts__) if not vm_size: return sizes[0] for size in sizes: if vm_size and str(vm_size) in (str(size.id), str(size.name)): # pylint: ...
[ "def", "get_size", "(", "conn", ",", "vm_", ")", ":", "sizes", "=", "conn", ".", "list_sizes", "(", ")", "vm_size", "=", "config", ".", "get_cloud_config_value", "(", "'size'", ",", "vm_", ",", "__opts__", ")", "if", "not", "vm_size", ":", "return", "s...
Return the VM's size object
[ "Return", "the", "VM", "s", "size", "object" ]
python
train
31.2