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
elastic/elasticsearch-py
elasticsearch/client/xpack/ml.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/xpack/ml.py#L153-L169
def delete_model_snapshot(self, job_id, snapshot_id, params=None): """ `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html>`_ :arg job_id: The ID of the job to fetch :arg snapshot_id: The ID of the snapshot to delete """ for param in ...
[ "def", "delete_model_snapshot", "(", "self", ",", "job_id", ",", "snapshot_id", ",", "params", "=", "None", ")", ":", "for", "param", "in", "(", "job_id", ",", "snapshot_id", ")", ":", "if", "param", "in", "SKIP_IN_PATH", ":", "raise", "ValueError", "(", ...
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html>`_ :arg job_id: The ID of the job to fetch :arg snapshot_id: The ID of the snapshot to delete
[ "<http", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "ml", "-", "delete", "-", "snapshot", ".", "html", ">", "_" ]
python
train
39.529412
holizz/hotpotato
hotpotato/profile/default.py
https://github.com/holizz/hotpotato/blob/39e48e4ce98f1147028be37741add6d6f5171a85/hotpotato/profile/default.py#L37-L41
def _static(self, target, value): """PHP's "static" """ return 'static ' + self.__p(ast.Assign(targets=[target],value=value))
[ "def", "_static", "(", "self", ",", "target", ",", "value", ")", ":", "return", "'static '", "+", "self", ".", "__p", "(", "ast", ".", "Assign", "(", "targets", "=", "[", "target", "]", ",", "value", "=", "value", ")", ")" ]
PHP's "static"
[ "PHP", "s", "static" ]
python
train
29.2
openearth/mmi-python
mmi/runner_legacy.py
https://github.com/openearth/mmi-python/blob/a2f4ac96b1e7f2fa903f668b3e05c4e86ad42e8d/mmi/runner_legacy.py#L50-L78
def parse_args(arguments, wrapper_kwargs={}): """ MMI Runner """ # make a socket that replies to message with the grid # if we are running mpi we want to know the rank args = {} positional = [ 'engine', 'configfile', ] for key in positional: args[key] = argum...
[ "def", "parse_args", "(", "arguments", ",", "wrapper_kwargs", "=", "{", "}", ")", ":", "# make a socket that replies to message with the grid", "# if we are running mpi we want to know the rank", "args", "=", "{", "}", "positional", "=", "[", "'engine'", ",", "'configfile...
MMI Runner
[ "MMI", "Runner" ]
python
train
26.482759
Becksteinlab/GromacsWrapper
gromacs/utilities.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L591-L640
def check_file_exists(self, filename, resolve='exception', force=None): """If a file exists then continue with the action specified in ``resolve``. ``resolve`` must be one of "ignore" always return ``False`` "indicate" return ``True`` if it exists "w...
[ "def", "check_file_exists", "(", "self", ",", "filename", ",", "resolve", "=", "'exception'", ",", "force", "=", "None", ")", ":", "def", "_warn", "(", "x", ")", ":", "msg", "=", "\"File {0!r} already exists.\"", ".", "format", "(", "x", ")", "logger", "...
If a file exists then continue with the action specified in ``resolve``. ``resolve`` must be one of "ignore" always return ``False`` "indicate" return ``True`` if it exists "warn" indicate and issue a :exc:`UserWarning` "exception" ...
[ "If", "a", "file", "exists", "then", "continue", "with", "the", "action", "specified", "in", "resolve", "." ]
python
valid
33.8
monarch-initiative/dipper
dipper/sources/AnimalQTLdb.py
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/AnimalQTLdb.py#L639-L687
def _process_trait_mappings(self, raw, limit=None): """ This method mapps traits from/to ... Triples created: :param limit: :return: """ if self.test_mode: graph = self.testgraph else: graph = self.graph line_counter = 0 ...
[ "def", "_process_trait_mappings", "(", "self", ",", "raw", ",", "limit", "=", "None", ")", ":", "if", "self", ".", "test_mode", ":", "graph", "=", "self", ".", "testgraph", "else", ":", "graph", "=", "self", ".", "graph", "line_counter", "=", "0", "mod...
This method mapps traits from/to ... Triples created: :param limit: :return:
[ "This", "method", "mapps", "traits", "from", "/", "to", "..." ]
python
train
34.897959
Shizmob/pydle
pydle/features/ircv3/sasl.py
https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/ircv3/sasl.py#L69-L74
async def _sasl_end(self): """ Finalize SASL authentication. """ if self._sasl_timer: self._sasl_timer.cancel() self._sasl_timer = None await self._capability_negotiated('sasl')
[ "async", "def", "_sasl_end", "(", "self", ")", ":", "if", "self", ".", "_sasl_timer", ":", "self", ".", "_sasl_timer", ".", "cancel", "(", ")", "self", ".", "_sasl_timer", "=", "None", "await", "self", ".", "_capability_negotiated", "(", "'sasl'", ")" ]
Finalize SASL authentication.
[ "Finalize", "SASL", "authentication", "." ]
python
train
36.666667
saltstack/salt
salt/minion.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1451-L1492
def _fire_master(self, data=None, tag=None, events=None, pretag=None, timeout=60, sync=True, timeout_handler=None): ''' Fire an event on the master, or drop message if unable to send. ''' load = {'id': self.opts['id'], 'cmd': '_minion_event', 'pretag': pre...
[ "def", "_fire_master", "(", "self", ",", "data", "=", "None", ",", "tag", "=", "None", ",", "events", "=", "None", ",", "pretag", "=", "None", ",", "timeout", "=", "60", ",", "sync", "=", "True", ",", "timeout_handler", "=", "None", ")", ":", "load...
Fire an event on the master, or drop message if unable to send.
[ "Fire", "an", "event", "on", "the", "master", "or", "drop", "message", "if", "unable", "to", "send", "." ]
python
train
42.880952
ewels/MultiQC
multiqc/modules/clipandmerge/clipandmerge.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/clipandmerge/clipandmerge.py#L78-L92
def clipandmerge_general_stats_table(self): """ Take the parsed stats from the ClipAndMerge report and add it to the basic stats table at the top of the report """ headers = OrderedDict() headers['percentage'] = { 'title': '% Merged', 'description': 'Percentage o...
[ "def", "clipandmerge_general_stats_table", "(", "self", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "'percentage'", "]", "=", "{", "'title'", ":", "'% Merged'", ",", "'description'", ":", "'Percentage of reads merged'", ",", "'min'", ":", ...
Take the parsed stats from the ClipAndMerge report and add it to the basic stats table at the top of the report
[ "Take", "the", "parsed", "stats", "from", "the", "ClipAndMerge", "report", "and", "add", "it", "to", "the", "basic", "stats", "table", "at", "the", "top", "of", "the", "report" ]
python
train
35.8
azogue/dataweb
dataweb/threadingtasks/__init__.py
https://github.com/azogue/dataweb/blob/085035855df7cef0fe7725bbe9a706832344d946/dataweb/threadingtasks/__init__.py#L19-L61
def procesa_tareas_paralelo(lista_tareas, dict_data, func_process, titulo=None, usar_multithread=True, max_threads=100, verbose=True): """ Procesa las tareas diarias en paralelo, limitando a un MAX de nº de threads. Especialmente útil para realizar requests simultáneos a un servi...
[ "def", "procesa_tareas_paralelo", "(", "lista_tareas", ",", "dict_data", ",", "func_process", ",", "titulo", "=", "None", ",", "usar_multithread", "=", "True", ",", "max_threads", "=", "100", ",", "verbose", "=", "True", ")", ":", "num_tareas", "=", "len", "...
Procesa las tareas diarias en paralelo, limitando a un MAX de nº de threads. Especialmente útil para realizar requests simultáneos a un servidor web concreto. :param lista_tareas: Recibe una lista de tareas únicas (key_tarea) a realizar :param dict_data: Diccionario de la forma '{key_tarea : variabl...
[ "Procesa", "las", "tareas", "diarias", "en", "paralelo", "limitando", "a", "un", "MAX", "de", "nº", "de", "threads", ".", "Especialmente", "útil", "para", "realizar", "requests", "simultáneos", "a", "un", "servidor", "web", "concreto", ".", ":", "param", "li...
python
train
56.674419
albahnsen/CostSensitiveClassification
costcla/models/cost_tree.py
https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/cost_tree.py#L515-L537
def predict(self, X): """ Predict class of X. The predicted class for each sample in X is returned. Parameters ---------- X : array-like of shape = [n_samples, n_features] The input samples. Returns ------- y : array of shape = [n_samples] ...
[ "def", "predict", "(", "self", ",", "X", ")", ":", "#TODO: Check consistency of X", "if", "self", ".", "pruned", ":", "tree_", "=", "self", ".", "tree_", ".", "tree_pruned", "else", ":", "tree_", "=", "self", ".", "tree_", ".", "tree", "return", "self", ...
Predict class of X. The predicted class for each sample in X is returned. Parameters ---------- X : array-like of shape = [n_samples, n_features] The input samples. Returns ------- y : array of shape = [n_samples] The predicted classes,
[ "Predict", "class", "of", "X", "." ]
python
train
24.043478
roclark/sportsreference
sportsreference/ncaaf/rankings.py
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/ncaaf/rankings.py#L136-L161
def current_extended(self): """ Returns a ``list`` of ``dictionaries`` of the most recent AP rankings. The list is ordered in terms of the ranking so the #1 team will be in the first element and the #25 team will be the last element. Each dictionary has the following structure:: ...
[ "def", "current_extended", "(", "self", ")", ":", "latest_week", "=", "max", "(", "self", ".", "_rankings", ".", "keys", "(", ")", ")", "ordered_dict", "=", "sorted", "(", "self", ".", "_rankings", "[", "latest_week", "]", ",", "key", "=", "lambda", "k...
Returns a ``list`` of ``dictionaries`` of the most recent AP rankings. The list is ordered in terms of the ranking so the #1 team will be in the first element and the #25 team will be the last element. Each dictionary has the following structure:: { 'abbreviation': T...
[ "Returns", "a", "list", "of", "dictionaries", "of", "the", "most", "recent", "AP", "rankings", ".", "The", "list", "is", "ordered", "in", "terms", "of", "the", "ranking", "so", "the", "#1", "team", "will", "be", "in", "the", "first", "element", "and", ...
python
train
52.615385
google/grr
grr/server/grr_response_server/aff4_objects/aff4_queue.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/aff4_queue.py#L51-L65
def Add(self, rdf_value, mutation_pool=None): """Adds an rdf value to the queue. Adds an rdf value to the queue. Does not require that the queue be locked. Args: rdf_value: The rdf value to add to the queue. mutation_pool: A MutationPool object to write to. Raises: ValueError: rdf_...
[ "def", "Add", "(", "self", ",", "rdf_value", ",", "mutation_pool", "=", "None", ")", ":", "self", ".", "StaticAdd", "(", "self", ".", "urn", ",", "rdf_value", ",", "mutation_pool", "=", "mutation_pool", ")" ]
Adds an rdf value to the queue. Adds an rdf value to the queue. Does not require that the queue be locked. Args: rdf_value: The rdf value to add to the queue. mutation_pool: A MutationPool object to write to. Raises: ValueError: rdf_value has unexpected type.
[ "Adds", "an", "rdf", "value", "to", "the", "queue", "." ]
python
train
27.333333
pypa/pipenv
pipenv/patched/piptools/sync.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/piptools/sync.py#L56-L66
def get_dists_to_ignore(installed): """ Returns a collection of package names to ignore when performing pip-sync, based on the currently installed environment. For example, when pip-tools is installed in the local environment, it should be ignored, including all of its dependencies (e.g. click). W...
[ "def", "get_dists_to_ignore", "(", "installed", ")", ":", "installed_keys", "=", "{", "key_from_req", "(", "r", ")", ":", "r", "for", "r", "in", "installed", "}", "return", "list", "(", "flat_map", "(", "lambda", "req", ":", "dependency_tree", "(", "instal...
Returns a collection of package names to ignore when performing pip-sync, based on the currently installed environment. For example, when pip-tools is installed in the local environment, it should be ignored, including all of its dependencies (e.g. click). When pip-tools is not installed locally, clic...
[ "Returns", "a", "collection", "of", "package", "names", "to", "ignore", "when", "performing", "pip", "-", "sync", "based", "on", "the", "currently", "installed", "environment", ".", "For", "example", "when", "pip", "-", "tools", "is", "installed", "in", "the...
python
train
54.727273
MisterY/price-database
pricedb/app.py
https://github.com/MisterY/price-database/blob/b4fd366b7763891c690fe3000b8840e656da023e/pricedb/app.py#L247-L280
def prune(self, symbol: SecuritySymbol): """ Delete all but the latest available price for the given symbol. Returns the number of items removed. """ from .repositories import PriceRepository assert isinstance(symbol, SecuritySymbol) self.logger.debug(f"pruning ...
[ "def", "prune", "(", "self", ",", "symbol", ":", "SecuritySymbol", ")", ":", "from", ".", "repositories", "import", "PriceRepository", "assert", "isinstance", "(", "symbol", ",", "SecuritySymbol", ")", "self", ".", "logger", ".", "debug", "(", "f\"pruning pric...
Delete all but the latest available price for the given symbol. Returns the number of items removed.
[ "Delete", "all", "but", "the", "latest", "available", "price", "for", "the", "given", "symbol", ".", "Returns", "the", "number", "of", "items", "removed", "." ]
python
test
30.382353
ulf1/oxyba
oxyba/jackknife_loop.py
https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/jackknife_loop.py#L2-L106
def jackknife_loop(func, data, d=1, combolimit=int(1e6)): """Generic Jackknife Subsampling procedure func : function A function pointer to a python function that - accept an <Observations x Features> matrix as input variable, and - returns an array/list or scalar value as ...
[ "def", "jackknife_loop", "(", "func", ",", "data", ",", "d", "=", "1", ",", "combolimit", "=", "int", "(", "1e6", ")", ")", ":", "# load modules", "import", "scipy", ".", "special", "import", "warnings", "import", "itertools", "import", "numpy", "as", "n...
Generic Jackknife Subsampling procedure func : function A function pointer to a python function that - accept an <Observations x Features> matrix as input variable, and - returns an array/list or scalar value as estimate, metric, model parameter, jackknif...
[ "Generic", "Jackknife", "Subsampling", "procedure" ]
python
train
30.666667
rlabbe/filterpy
filterpy/stats/stats.py
https://github.com/rlabbe/filterpy/blob/8123214de798ffb63db968bb0b9492ee74e77950/filterpy/stats/stats.py#L923-L1066
def plot_covariance( mean, cov=None, variance=1.0, std=None, interval=None, ellipse=None, title=None, axis_equal=True, show_semiaxis=False, show_center=True, facecolor=None, edgecolor=None, fc='none', ec='#004080', alpha=1.0, xlim=None, ylim=None, ls='solid'): ...
[ "def", "plot_covariance", "(", "mean", ",", "cov", "=", "None", ",", "variance", "=", "1.0", ",", "std", "=", "None", ",", "interval", "=", "None", ",", "ellipse", "=", "None", ",", "title", "=", "None", ",", "axis_equal", "=", "True", ",", "show_sem...
Plots the covariance ellipse for the 2D normal defined by (mean, cov) `variance` is the normal sigma^2 that we want to plot. If list-like, ellipses for all ellipses will be ploted. E.g. [1,2] will plot the sigma^2 = 1 and sigma^2 = 2 ellipses. Alternatively, use std for the standard deviation, in which...
[ "Plots", "the", "covariance", "ellipse", "for", "the", "2D", "normal", "defined", "by", "(", "mean", "cov", ")" ]
python
train
30.479167
GibbsConsulting/django-plotly-dash
django_plotly_dash/views.py
https://github.com/GibbsConsulting/django-plotly-dash/blob/773ed081fc2ea3cc7607590322a14686a7a79bc5/django_plotly_dash/views.py#L156-L164
def asset_redirection(request, path, ident=None, stateless=False, **kwargs): 'Redirect static assets for a component' X, app = DashApp.locate_item(ident, stateless) # Redirect to a location based on the import path of the module containing the DjangoDash app static_path = X.get_asset_static_url(path) ...
[ "def", "asset_redirection", "(", "request", ",", "path", ",", "ident", "=", "None", ",", "stateless", "=", "False", ",", "*", "*", "kwargs", ")", ":", "X", ",", "app", "=", "DashApp", ".", "locate_item", "(", "ident", ",", "stateless", ")", "# Redirect...
Redirect static assets for a component
[ "Redirect", "static", "assets", "for", "a", "component" ]
python
train
38.333333
jaredLunde/vital-tools
vital/debug/__init__.py
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/__init__.py#L103-L122
def line(separator="-·-", color=None, padding=None, num=1): """ Prints a line separator the full width of the terminal. @separator: the #str chars to create the line from @color: line color from :mod:vital.debug.colors @padding: adds extra lines to either the top, bottom or both ...
[ "def", "line", "(", "separator", "=", "\"-·-\",", " ", "olor=", "N", "one,", " ", "adding=", "N", "one,", " ", "um=", "1", ")", ":", "", "for", "x", "in", "range", "(", "num", ")", ":", "columns", "=", "get_terminal_width", "(", ")", "separator", "...
Prints a line separator the full width of the terminal. @separator: the #str chars to create the line from @color: line color from :mod:vital.debug.colors @padding: adds extra lines to either the top, bottom or both of the line via :func:padd @num: #int number of lines to pr...
[ "Prints", "a", "line", "separator", "the", "full", "width", "of", "the", "terminal", "." ]
python
train
39.3
SheffieldML/GPy
GPy/plotting/abstract_plotting_library.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L165-L178
def barplot(self, canvas, x, height, width=0.8, bottom=0, color=None, label=None, **kwargs): """ Plot vertical bar plot centered at x with height and width of bars. The y level is at bottom. the kwargs are plotting library specific kwargs! :param array-like x: the cent...
[ "def", "barplot", "(", "self", ",", "canvas", ",", "x", ",", "height", ",", "width", "=", "0.8", ",", "bottom", "=", "0", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", ...
Plot vertical bar plot centered at x with height and width of bars. The y level is at bottom. the kwargs are plotting library specific kwargs! :param array-like x: the center points of the bars :param array-like height: the height of the bars :param array-like width: t...
[ "Plot", "vertical", "bar", "plot", "centered", "at", "x", "with", "height", "and", "width", "of", "bars", ".", "The", "y", "level", "is", "at", "bottom", ".", "the", "kwargs", "are", "plotting", "library", "specific", "kwargs!" ]
python
train
51.5
ctuning/ck
ck/repo/module/repo/module.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/repo/module/repo/module.py#L757-L1005
def pull(i): """ Input: { (path) - repo UOA (where to create entry) (type) - type (url) - URL or (data_uoa) - repo UOA (clone) - if 'yes', clone repo instead of update (current_repos) - if r...
[ "def", "pull", "(", "i", ")", ":", "o", "=", "i", ".", "get", "(", "'out'", ",", "''", ")", "xrecache", "=", "False", "pp", "=", "[", "]", "px", "=", "i", ".", "get", "(", "'path'", ",", "''", ")", "t", "=", "i", ".", "get", "(", "'type'"...
Input: { (path) - repo UOA (where to create entry) (type) - type (url) - URL or (data_uoa) - repo UOA (clone) - if 'yes', clone repo instead of update (current_repos) - if resolving dependencies on ...
[ "Input", ":", "{", "(", "path", ")", "-", "repo", "UOA", "(", "where", "to", "create", "entry", ")", "(", "type", ")", "-", "type", "(", "url", ")", "-", "URL" ]
python
train
28.333333
honzamach/pynspect
pynspect/traversers.py
https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/traversers.py#L762-L770
def function(self, rule, args, **kwargs): """ Implementation of :py:func:`pynspect.traversers.RuleTreeTraverser.function` interface. """ fname = rule.function try: return self.functions[fname](args) except KeyError: raise FilteringRuleException("In...
[ "def", "function", "(", "self", ",", "rule", ",", "args", ",", "*", "*", "kwargs", ")", ":", "fname", "=", "rule", ".", "function", "try", ":", "return", "self", ".", "functions", "[", "fname", "]", "(", "args", ")", "except", "KeyError", ":", "rai...
Implementation of :py:func:`pynspect.traversers.RuleTreeTraverser.function` interface.
[ "Implementation", "of", ":", "py", ":", "func", ":", "pynspect", ".", "traversers", ".", "RuleTreeTraverser", ".", "function", "interface", "." ]
python
train
39.111111
raiden-network/raiden
raiden/network/proxies/token_network.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/token_network.py#L524-L541
def channel_is_closed( self, participant1: Address, participant2: Address, block_identifier: BlockSpecification, channel_identifier: ChannelID, ) -> bool: """ Returns true if the channel is in a closed state, false otherwise. """ try: ...
[ "def", "channel_is_closed", "(", "self", ",", "participant1", ":", "Address", ",", "participant2", ":", "Address", ",", "block_identifier", ":", "BlockSpecification", ",", "channel_identifier", ":", "ChannelID", ",", ")", "->", "bool", ":", "try", ":", "channel_...
Returns true if the channel is in a closed state, false otherwise.
[ "Returns", "true", "if", "the", "channel", "is", "in", "a", "closed", "state", "false", "otherwise", "." ]
python
train
37.333333
trisk/pysesame
pysesame/candyhouse.py
https://github.com/trisk/pysesame/blob/8f9df4a478cf8f328ec8185bcac7c8704cbd9c01/pysesame/candyhouse.py#L32-L62
def login(self, email=None, password=None, timeout=5): """Log in to CANDY HOUSE account. Return True on success.""" if email is not None: self.email = email if password is not None: self.password = password url = self.api_url + API_LOGIN_ENDPOINT data = j...
[ "def", "login", "(", "self", ",", "email", "=", "None", ",", "password", "=", "None", ",", "timeout", "=", "5", ")", ":", "if", "email", "is", "not", "None", ":", "self", ".", "email", "=", "email", "if", "password", "is", "not", "None", ":", "se...
Log in to CANDY HOUSE account. Return True on success.
[ "Log", "in", "to", "CANDY", "HOUSE", "account", ".", "Return", "True", "on", "success", "." ]
python
train
38.83871
wummel/linkchecker
third_party/dnspython/dns/rdataset.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/rdataset.py#L174-L222
def to_text(self, name=None, origin=None, relativize=True, override_rdclass=None, **kw): """Convert the rdataset into DNS master file format. @see: L{dns.name.Name.choose_relativity} for more information on how I{origin} and I{relativize} determine the way names are emit...
[ "def", "to_text", "(", "self", ",", "name", "=", "None", ",", "origin", "=", "None", ",", "relativize", "=", "True", ",", "override_rdclass", "=", "None", ",", "*", "*", "kw", ")", ":", "if", "not", "name", "is", "None", ":", "name", "=", "name", ...
Convert the rdataset into DNS master file format. @see: L{dns.name.Name.choose_relativity} for more information on how I{origin} and I{relativize} determine the way names are emitted. Any additional keyword arguments are passed on to the rdata to_text() method. @param ...
[ "Convert", "the", "rdataset", "into", "DNS", "master", "file", "format", "." ]
python
train
39.979592
juju/python-libjuju
juju/application.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/application.py#L234-L243
async def get_config(self): """Return the configuration settings dict for this application. """ app_facade = client.ApplicationFacade.from_connection(self.connection) log.debug( 'Getting config for %s', self.name) return (await app_facade.Get(self.name)).config
[ "async", "def", "get_config", "(", "self", ")", ":", "app_facade", "=", "client", ".", "ApplicationFacade", ".", "from_connection", "(", "self", ".", "connection", ")", "log", ".", "debug", "(", "'Getting config for %s'", ",", "self", ".", "name", ")", "retu...
Return the configuration settings dict for this application.
[ "Return", "the", "configuration", "settings", "dict", "for", "this", "application", "." ]
python
train
30.7
tensorflow/probability
tensorflow_probability/python/vi/csiszar_divergence.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/vi/csiszar_divergence.py#L1009-L1111
def csiszar_vimco_helper(logu, name=None): """Helper to `csiszar_vimco`; computes `log_avg_u`, `log_sooavg_u`. `axis = 0` of `logu` is presumed to correspond to iid samples from `q`, i.e., ```none logu[j] = log(u[j]) u[j] = p(x, h[j]) / q(h[j] | x) h[j] iid~ q(H | x) ``` Args: logu: Floating-type...
[ "def", "csiszar_vimco_helper", "(", "logu", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "name", ",", "\"csiszar_vimco_helper\"", ",", "[", "logu", "]", ")", ":", "logu", "=", "tf", ".", "convert_t...
Helper to `csiszar_vimco`; computes `log_avg_u`, `log_sooavg_u`. `axis = 0` of `logu` is presumed to correspond to iid samples from `q`, i.e., ```none logu[j] = log(u[j]) u[j] = p(x, h[j]) / q(h[j] | x) h[j] iid~ q(H | x) ``` Args: logu: Floating-type `Tensor` representing `log(p(x, h) / q(h | x))`...
[ "Helper", "to", "csiszar_vimco", ";", "computes", "log_avg_u", "log_sooavg_u", "." ]
python
test
41.68932
oanda/v20-python
src/v20/transaction.py
https://github.com/oanda/v20-python/blob/f28192f4a31bce038cf6dfa302f5878bec192fe5/src/v20/transaction.py#L984-L1064
def from_dict(data, ctx): """ Instantiate a new MarketOrderTransaction from a dict (generally from loading a JSON response). The data used to instantiate the MarketOrderTransaction is a shallow copy of the dict passed in, with any complex child types instantiated appropriately. ...
[ "def", "from_dict", "(", "data", ",", "ctx", ")", ":", "data", "=", "data", ".", "copy", "(", ")", "if", "data", ".", "get", "(", "'units'", ")", "is", "not", "None", ":", "data", "[", "'units'", "]", "=", "ctx", ".", "convert_decimal_number", "(",...
Instantiate a new MarketOrderTransaction from a dict (generally from loading a JSON response). The data used to instantiate the MarketOrderTransaction is a shallow copy of the dict passed in, with any complex child types instantiated appropriately.
[ "Instantiate", "a", "new", "MarketOrderTransaction", "from", "a", "dict", "(", "generally", "from", "loading", "a", "JSON", "response", ")", ".", "The", "data", "used", "to", "instantiate", "the", "MarketOrderTransaction", "is", "a", "shallow", "copy", "of", "...
python
train
36.444444
ergoithz/browsepy
browsepy/manager.py
https://github.com/ergoithz/browsepy/blob/1612a930ef220fae507e1b152c531707e555bd92/browsepy/manager.py#L272-L300
def iter_widgets(self, file=None, place=None): ''' Iterate registered widgets, optionally matching given criteria. :param file: optional file object will be passed to widgets' filter functions. :type file: browsepy.file.Node or None :param place: optional te...
[ "def", "iter_widgets", "(", "self", ",", "file", "=", "None", ",", "place", "=", "None", ")", ":", "for", "filter", ",", "dynamic", ",", "cwidget", "in", "self", ".", "_widgets", ":", "try", ":", "if", "file", "and", "filter", "and", "not", "filter",...
Iterate registered widgets, optionally matching given criteria. :param file: optional file object will be passed to widgets' filter functions. :type file: browsepy.file.Node or None :param place: optional template place hint. :type place: str :yields: widget...
[ "Iterate", "registered", "widgets", "optionally", "matching", "given", "criteria", "." ]
python
train
38.689655
openvax/isovar
isovar/variant_sequences.py
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequences.py#L180-L192
def coverage(self): """ Returns NumPy array indicating number of reads covering each nucleotides of this sequence. """ variant_start_index, variant_end_index = self.variant_indices() n_nucleotides = len(self) coverage_array = np.zeros(n_nucleotides, dtype="int32")...
[ "def", "coverage", "(", "self", ")", ":", "variant_start_index", ",", "variant_end_index", "=", "self", ".", "variant_indices", "(", ")", "n_nucleotides", "=", "len", "(", "self", ")", "coverage_array", "=", "np", ".", "zeros", "(", "n_nucleotides", ",", "dt...
Returns NumPy array indicating number of reads covering each nucleotides of this sequence.
[ "Returns", "NumPy", "array", "indicating", "number", "of", "reads", "covering", "each", "nucleotides", "of", "this", "sequence", "." ]
python
train
41.615385
pydata/pandas-gbq
pandas_gbq/gbq.py
https://github.com/pydata/pandas-gbq/blob/e590317b3325939ede7563f49aa6b163bb803b77/pandas_gbq/gbq.py#L624-L652
def schema_is_subset(self, dataset_id, table_id, schema): """Indicate whether the schema to be uploaded is a subset Compare the BigQuery table identified in the parameters with the schema passed in and indicate whether a subset of the fields in the former are present in the latter. Orde...
[ "def", "schema_is_subset", "(", "self", ",", "dataset_id", ",", "table_id", ",", "schema", ")", ":", "fields_remote", "=", "self", ".", "_clean_schema_fields", "(", "self", ".", "schema", "(", "dataset_id", ",", "table_id", ")", ")", "fields_local", "=", "se...
Indicate whether the schema to be uploaded is a subset Compare the BigQuery table identified in the parameters with the schema passed in and indicate whether a subset of the fields in the former are present in the latter. Order is not considered. Parameters ---------- d...
[ "Indicate", "whether", "the", "schema", "to", "be", "uploaded", "is", "a", "subset" ]
python
train
33.275862
wglass/lighthouse
lighthouse/pluggable.py
https://github.com/wglass/lighthouse/blob/f4ce6550895acc31e433ede0c05d366718a3ffe5/lighthouse/pluggable.py#L75-L95
def from_config(cls, name, config): """ Behaves like the base Configurable class's `from_config()` except this makes sure that the `Pluggable` subclass with the given name is actually a properly installed plugin first. """ installed_classes = cls.get_installed_classes() ...
[ "def", "from_config", "(", "cls", ",", "name", ",", "config", ")", ":", "installed_classes", "=", "cls", ".", "get_installed_classes", "(", ")", "if", "name", "not", "in", "installed_classes", ":", "raise", "ValueError", "(", "\"Unknown/unavailable %s\"", "%", ...
Behaves like the base Configurable class's `from_config()` except this makes sure that the `Pluggable` subclass with the given name is actually a properly installed plugin first.
[ "Behaves", "like", "the", "base", "Configurable", "class", "s", "from_config", "()", "except", "this", "makes", "sure", "that", "the", "Pluggable", "subclass", "with", "the", "given", "name", "is", "actually", "a", "properly", "installed", "plugin", "first", "...
python
train
32.52381
awslabs/aws-sam-cli
samcli/commands/local/lib/sam_api_provider.py
https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/sam_api_provider.py#L423-L445
def _get_properties(self, logical_id): """ Returns the properties of resource with given logical ID. If a resource is not found, then it returns an empty data. Parameters ---------- logical_id : str Logical ID of the resource Returns ------- ...
[ "def", "_get_properties", "(", "self", ",", "logical_id", ")", ":", "if", "logical_id", "not", "in", "self", ".", "by_resource", ":", "self", ".", "by_resource", "[", "logical_id", "]", "=", "self", ".", "Properties", "(", "apis", "=", "[", "]", ",", "...
Returns the properties of resource with given logical ID. If a resource is not found, then it returns an empty data. Parameters ---------- logical_id : str Logical ID of the resource Returns ------- samcli.commands.local.lib.sam_api_provider.ApiColle...
[ "Returns", "the", "properties", "of", "resource", "with", "given", "logical", "ID", ".", "If", "a", "resource", "is", "not", "found", "then", "it", "returns", "an", "empty", "data", "." ]
python
train
37
kmmbvnr/django-any
django_any/forms.py
https://github.com/kmmbvnr/django-any/blob/6f64ebd05476e2149e2e71deeefbb10f8edfc412/django_any/forms.py#L151-L164
def date_field_data(field, **kwargs): """ Return random value for DateField >>> result = any_form_field(forms.DateField()) >>> type(result) <type 'str'> """ from_date = kwargs.get('from_date', date(1990, 1, 1)) to_date = kwargs.get('to_date', date.today()) date_format = random....
[ "def", "date_field_data", "(", "field", ",", "*", "*", "kwargs", ")", ":", "from_date", "=", "kwargs", ".", "get", "(", "'from_date'", ",", "date", "(", "1990", ",", "1", ",", "1", ")", ")", "to_date", "=", "kwargs", ".", "get", "(", "'to_date'", "...
Return random value for DateField >>> result = any_form_field(forms.DateField()) >>> type(result) <type 'str'>
[ "Return", "random", "value", "for", "DateField" ]
python
test
35.5
loganasherjones/yapconf
yapconf/docs.py
https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/docs.py#L344-L393
def generate_markdown_doc(app_name, spec): """Generate Markdown Documentation for the given spec/app name. Args: app_name (str): The name of the application. spec (YapconfSpec): A yapconf specification with sources loaded. Returns (str): A valid, markdown string representation of t...
[ "def", "generate_markdown_doc", "(", "app_name", ",", "spec", ")", ":", "# Apply standard headers.", "sections", "=", "[", "HEADER", ".", "format", "(", "app_name", "=", "app_name", ")", ",", "SOURCES_HEADER", ".", "format", "(", "app_name", "=", "app_name", "...
Generate Markdown Documentation for the given spec/app name. Args: app_name (str): The name of the application. spec (YapconfSpec): A yapconf specification with sources loaded. Returns (str): A valid, markdown string representation of the documentation for the given specificati...
[ "Generate", "Markdown", "Documentation", "for", "the", "given", "spec", "/", "app", "name", "." ]
python
train
27.64
gwastro/pycbc
pycbc/filter/matchedfilter.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/filter/matchedfilter.py#L1366-L1393
def overlap(vec1, vec2, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None, normalized=True): """ Return the overlap between the two TimeSeries or FrequencySeries. Parameters ---------- vec1 : TimeSeries or FrequencySeries The input vector containing a waveform. vec2 ...
[ "def", "overlap", "(", "vec1", ",", "vec2", ",", "psd", "=", "None", ",", "low_frequency_cutoff", "=", "None", ",", "high_frequency_cutoff", "=", "None", ",", "normalized", "=", "True", ")", ":", "return", "overlap_cplx", "(", "vec1", ",", "vec2", ",", "...
Return the overlap between the two TimeSeries or FrequencySeries. Parameters ---------- vec1 : TimeSeries or FrequencySeries The input vector containing a waveform. vec2 : TimeSeries or FrequencySeries The input vector containing a waveform. psd : Frequency Series A power sp...
[ "Return", "the", "overlap", "between", "the", "two", "TimeSeries", "or", "FrequencySeries", "." ]
python
train
36.428571
CentOS/python-cicoclient
cicoclient/wrapper.py
https://github.com/CentOS/python-cicoclient/blob/ffee34f446ceb25348b13a500d5c545df202c182/cicoclient/wrapper.py#L84-L104
def self_inventory(self): """ Inventory output will only contain the server name and the session ID when a key is provided. Provide the same format as with the full inventory instead for consistency. """ if self.api_key is None: return {} if self._sel...
[ "def", "self_inventory", "(", "self", ")", ":", "if", "self", ".", "api_key", "is", "None", ":", "return", "{", "}", "if", "self", ".", "_self_inventory", ":", "return", "self", ".", "_self_inventory", "resp", ",", "self_inventory", "=", "self", ".", "ge...
Inventory output will only contain the server name and the session ID when a key is provided. Provide the same format as with the full inventory instead for consistency.
[ "Inventory", "output", "will", "only", "contain", "the", "server", "name", "and", "the", "session", "ID", "when", "a", "key", "is", "provided", ".", "Provide", "the", "same", "format", "as", "with", "the", "full", "inventory", "instead", "for", "consistency"...
python
train
31.571429
keflavich/plfit
plfit/plfit.py
https://github.com/keflavich/plfit/blob/7dafa6302b427ba8c89651148e3e9d29add436c3/plfit/plfit.py#L990-L997
def most_likely_alpha(data, xmin, alpharange=(1.5,3.5), n_alpha=201): """ Return the most likely alpha for the data given an xmin """ alpha_vector = np.linspace(alpharange[0],alpharange[1],n_alpha) return alpha_vector[discrete_max_likelihood_arg(data, xmin, ...
[ "def", "most_likely_alpha", "(", "data", ",", "xmin", ",", "alpharange", "=", "(", "1.5", ",", "3.5", ")", ",", "n_alpha", "=", "201", ")", ":", "alpha_vector", "=", "np", ".", "linspace", "(", "alpharange", "[", "0", "]", ",", "alpharange", "[", "1"...
Return the most likely alpha for the data given an xmin
[ "Return", "the", "most", "likely", "alpha", "for", "the", "data", "given", "an", "xmin" ]
python
test
51.875
libyal/dtfabric
dtfabric/data_types.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L562-L578
def GetByteSize(self): """Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined. """ if self._byte_size is None and self.members: self._byte_size = 0 for member_definition in self.members: byte_size = me...
[ "def", "GetByteSize", "(", "self", ")", ":", "if", "self", ".", "_byte_size", "is", "None", "and", "self", ".", "members", ":", "self", ".", "_byte_size", "=", "0", "for", "member_definition", "in", "self", ".", "members", ":", "byte_size", "=", "member_...
Retrieves the byte size of the data type definition. Returns: int: data type size in bytes or None if size cannot be determined.
[ "Retrieves", "the", "byte", "size", "of", "the", "data", "type", "definition", "." ]
python
train
29.352941
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_ras.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_ras.py#L157-L168
def logging_auditlog_class_class(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") logging = ET.SubElement(config, "logging", xmlns="urn:brocade.com:mgmt:brocade-ras") auditlog = ET.SubElement(logging, "auditlog") class_el = ET.SubElement(auditlog,...
[ "def", "logging_auditlog_class_class", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "logging", "=", "ET", ".", "SubElement", "(", "config", ",", "\"logging\"", ",", "xmlns", "=", "\"urn:brocad...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
42.083333
VasilyStepanov/pywidl
pywidl/grammar.py
https://github.com/VasilyStepanov/pywidl/blob/8d84b2e53157bfe276bf16301c19e8b6b32e861e/pywidl/grammar.py#L745-L748
def p_UnionMemberType_anyType(p): """UnionMemberType : any "[" "]" TypeSuffix""" p[0] = helper.unwrapTypeSuffix(model.Array(t=model.SimpleType( type=model.SimpleType.ANY)), p[4])
[ "def", "p_UnionMemberType_anyType", "(", "p", ")", ":", "p", "[", "0", "]", "=", "helper", ".", "unwrapTypeSuffix", "(", "model", ".", "Array", "(", "t", "=", "model", ".", "SimpleType", "(", "type", "=", "model", ".", "SimpleType", ".", "ANY", ")", ...
UnionMemberType : any "[" "]" TypeSuffix
[ "UnionMemberType", ":", "any", "[", "]", "TypeSuffix" ]
python
train
45.75
Jajcus/pyxmpp2
pyxmpp2/ext/vcard.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/vcard.py#L557-L578
def as_xml(self,parent): """Create vcard-tmp XML representation of the field. :Parameters: - `parent`: parent node for the element :Types: - `parent`: `libxml2.xmlNode` :return: xml node with the field data. :returntype: `libxml2.xmlNode`""" n=pa...
[ "def", "as_xml", "(", "self", ",", "parent", ")", ":", "n", "=", "parent", ".", "newChild", "(", "None", ",", "\"ADR\"", ",", "None", ")", "for", "t", "in", "(", "\"home\"", ",", "\"work\"", ",", "\"postal\"", ",", "\"parcel\"", ",", "\"dom\"", ",", ...
Create vcard-tmp XML representation of the field. :Parameters: - `parent`: parent node for the element :Types: - `parent`: `libxml2.xmlNode` :return: xml node with the field data. :returntype: `libxml2.xmlNode`
[ "Create", "vcard", "-", "tmp", "XML", "representation", "of", "the", "field", "." ]
python
valid
41.181818
thespacedoctor/sherlock
sherlock/imports/ned.py
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/imports/ned.py#L169-L203
def _create_dictionary_of_ned( self): """*Create a list of dictionaries containing all the object ids (NED names) in the ned stream* **Return:** - ``dictList`` - a list of dictionaries containing all the object ids (NED names) in the ned stream **Usage:** ....
[ "def", "_create_dictionary_of_ned", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_create_dictionary_of_ned`` method'", ")", "# GET THE NAMES (UNIQUE IDS) OF THE SOURCES WITHIN THE CONESEARCH FROM", "# NED", "names", ",", "searchParams", "=", ...
*Create a list of dictionaries containing all the object ids (NED names) in the ned stream* **Return:** - ``dictList`` - a list of dictionaries containing all the object ids (NED names) in the ned stream **Usage:** .. code-block:: python dictList = stream._cre...
[ "*", "Create", "a", "list", "of", "dictionaries", "containing", "all", "the", "object", "ids", "(", "NED", "names", ")", "in", "the", "ned", "stream", "*" ]
python
train
31.457143
edibledinos/pwnypack
pwnypack/shellcode/base.py
https://github.com/edibledinos/pwnypack/blob/e0a5a8e6ef3f4f1f7e1b91ee379711f4a49cb0e6/pwnypack/shellcode/base.py#L329-L372
def translate(cls, f=None, output=0, **kwargs): """translate(f=None, *, output=TranslateOutput.code, **kwargs) Decorator that turns a function into a shellcode emitting function. Arguments: f(callable): The function to decorate. If ``f`` is ``None`` a decorator will ...
[ "def", "translate", "(", "cls", ",", "f", "=", "None", ",", "output", "=", "0", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "proxy", "(", "*", "p_args", ",", ...
translate(f=None, *, output=TranslateOutput.code, **kwargs) Decorator that turns a function into a shellcode emitting function. Arguments: f(callable): The function to decorate. If ``f`` is ``None`` a decorator will be returned instead. output(~pwnypack.shellcode...
[ "translate", "(", "f", "=", "None", "*", "output", "=", "TranslateOutput", ".", "code", "**", "kwargs", ")", "Decorator", "that", "turns", "a", "function", "into", "a", "shellcode", "emitting", "function", "." ]
python
train
35.909091
cameronmaske/celery-once
celery_once/tasks.py
https://github.com/cameronmaske/celery-once/blob/ffd21cbdf486444b4b1fcc6f7354436b895285c6/celery_once/tasks.py#L69-L100
def apply_async(self, args=None, kwargs=None, **options): """ Attempts to queues a task. Will raises an AlreadyQueued exception if already queued. :param \*args: positional arguments passed on to the task. :param \*\*kwargs: keyword arguments passed on to the task. :keyw...
[ "def", "apply_async", "(", "self", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "*", "*", "options", ")", ":", "once_options", "=", "options", ".", "get", "(", "'once'", ",", "{", "}", ")", "once_graceful", "=", "once_options", ".", "ge...
Attempts to queues a task. Will raises an AlreadyQueued exception if already queued. :param \*args: positional arguments passed on to the task. :param \*\*kwargs: keyword arguments passed on to the task. :keyword \*\*once: (optional) :param: graceful: (optional) ...
[ "Attempts", "to", "queues", "a", "task", ".", "Will", "raises", "an", "AlreadyQueued", "exception", "if", "already", "queued", "." ]
python
train
42.46875
projecthamster/hamster
src/hamster/storage/storage.py
https://github.com/projecthamster/hamster/blob/ca5254eff53172796ddafc72226c394ed1858245/src/hamster/storage/storage.py#L75-L82
def remove_fact(self, fact_id): """Remove fact from storage by it's ID""" self.start_transaction() fact = self.__get_fact(fact_id) if fact: self.__remove_fact(fact_id) self.facts_changed() self.end_transaction()
[ "def", "remove_fact", "(", "self", ",", "fact_id", ")", ":", "self", ".", "start_transaction", "(", ")", "fact", "=", "self", ".", "__get_fact", "(", "fact_id", ")", "if", "fact", ":", "self", ".", "__remove_fact", "(", "fact_id", ")", "self", ".", "fa...
Remove fact from storage by it's ID
[ "Remove", "fact", "from", "storage", "by", "it", "s", "ID" ]
python
train
33.5
saltstack/salt
salt/utils/jid.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jid.py#L42-L54
def is_jid(jid): ''' Returns True if the passed in value is a job id ''' if not isinstance(jid, six.string_types): return False if len(jid) != 20 and (len(jid) <= 21 or jid[20] != '_'): return False try: int(jid[:20]) return True except ValueError: ret...
[ "def", "is_jid", "(", "jid", ")", ":", "if", "not", "isinstance", "(", "jid", ",", "six", ".", "string_types", ")", ":", "return", "False", "if", "len", "(", "jid", ")", "!=", "20", "and", "(", "len", "(", "jid", ")", "<=", "21", "or", "jid", "...
Returns True if the passed in value is a job id
[ "Returns", "True", "if", "the", "passed", "in", "value", "is", "a", "job", "id" ]
python
train
24.384615
wummel/linkchecker
third_party/dnspython/dns/rdata.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/rdata.py#L113-L125
def _truncate_bitmap(what): """Determine the index of greatest byte that isn't all zeros, and return the bitmap that contains all the bytes less than that index. @param what: a string of octets representing a bitmap. @type what: string @rtype: string """ for i in xrange(len(what) - 1, -1, ...
[ "def", "_truncate_bitmap", "(", "what", ")", ":", "for", "i", "in", "xrange", "(", "len", "(", "what", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "what", "[", "i", "]", "!=", "'\\x00'", ":", "break", "return", "''", ".", "jo...
Determine the index of greatest byte that isn't all zeros, and return the bitmap that contains all the bytes less than that index. @param what: a string of octets representing a bitmap. @type what: string @rtype: string
[ "Determine", "the", "index", "of", "greatest", "byte", "that", "isn", "t", "all", "zeros", "and", "return", "the", "bitmap", "that", "contains", "all", "the", "bytes", "less", "than", "that", "index", "." ]
python
train
30.461538
gem/oq-engine
openquake/calculators/getters.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/getters.py#L306-L326
def init(self): """ Initialize the computers. Should be called on the workers """ if hasattr(self, 'computers'): # init already called return with hdf5.File(self.rupgetter.filename, 'r') as parent: self.weights = parent['weights'].value self.compu...
[ "def", "init", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'computers'", ")", ":", "# init already called", "return", "with", "hdf5", ".", "File", "(", "self", ".", "rupgetter", ".", "filename", ",", "'r'", ")", "as", "parent", ":", "sel...
Initialize the computers. Should be called on the workers
[ "Initialize", "the", "computers", ".", "Should", "be", "called", "on", "the", "workers" ]
python
train
46.190476
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewwidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L550-L568
def unregisterViewType(self, cls, window=None): """ Unregisters the view at the given name. If the window option is \ supplied then the unregisterFromWindow method will be called for the \ inputed class. :param cls | <subclass of XView> ...
[ "def", "unregisterViewType", "(", "self", ",", "cls", ",", "window", "=", "None", ")", ":", "if", "(", "cls", "in", "self", ".", "_viewTypes", ")", ":", "self", ".", "_viewTypes", ".", "remove", "(", "cls", ")", "if", "(", "window", ")", ":", "cls"...
Unregisters the view at the given name. If the window option is \ supplied then the unregisterFromWindow method will be called for the \ inputed class. :param cls | <subclass of XView> window | <QMainWindow> || <QDialog> || None ...
[ "Unregisters", "the", "view", "at", "the", "given", "name", ".", "If", "the", "window", "option", "is", "\\", "supplied", "then", "the", "unregisterFromWindow", "method", "will", "be", "called", "for", "the", "\\", "inputed", "class", ".", ":", "param", "c...
python
train
33.578947
uw-it-aca/uw-restclients-graderoster
uw_sws_graderoster/__init__.py
https://github.com/uw-it-aca/uw-restclients-graderoster/blob/1e41553eb7363765af60e87223ca9d22cf6c9187/uw_sws_graderoster/__init__.py#L10-L31
def get_graderoster(section, instructor, requestor): """ Returns a restclients.GradeRoster for the passed Section model and instructor Person. """ label = GradeRoster(section=section, instructor=instructor).graderoster_label() url = "{}/{}".format(graderoster_url, encode_...
[ "def", "get_graderoster", "(", "section", ",", "instructor", ",", "requestor", ")", ":", "label", "=", "GradeRoster", "(", "section", "=", "section", ",", "instructor", "=", "instructor", ")", ".", "graderoster_label", "(", ")", "url", "=", "\"{}/{}\"", ".",...
Returns a restclients.GradeRoster for the passed Section model and instructor Person.
[ "Returns", "a", "restclients", ".", "GradeRoster", "for", "the", "passed", "Section", "model", "and", "instructor", "Person", "." ]
python
train
40.045455
Infinidat/infi.traceback
src/infi/traceback/__init__.py
https://github.com/Infinidat/infi.traceback/blob/ae25455ec451c136458d2781fea876964375bf8b/src/infi/traceback/__init__.py#L85-L98
def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() ...
[ "def", "print_tb", "(", "tb", ",", "limit", "=", "None", ",", "file", "=", "None", ")", ":", "if", "file", "is", "None", ":", "file", "=", "sys", ".", "stderr", "if", "limit", "is", "None", ":", "if", "hasattr", "(", "sys", ",", "'tracebacklimit'",...
Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method.
[ "Print", "up", "to", "limit", "stack", "trace", "entries", "from", "the", "traceback", "tb", "." ]
python
train
37.928571
vpelletier/python-hidraw
hidraw/__init__.py
https://github.com/vpelletier/python-hidraw/blob/af6527160d2c0c0f61d737f383e35fd767ce25be/hidraw/__init__.py#L77-L86
def getInfo(self): """ Returns a DevInfo instance, a named tuple with the following items: - bustype: one of BUS_USB, BUS_HIL, BUS_BLUETOOTH or BUS_VIRTUAL - vendor: device's vendor number - product: device's product number """ devinfo = _hidraw_devinfo() ...
[ "def", "getInfo", "(", "self", ")", ":", "devinfo", "=", "_hidraw_devinfo", "(", ")", "self", ".", "_ioctl", "(", "_HIDIOCGRAWINFO", ",", "devinfo", ",", "True", ")", "return", "DevInfo", "(", "devinfo", ".", "bustype", ",", "devinfo", ".", "vendor", ","...
Returns a DevInfo instance, a named tuple with the following items: - bustype: one of BUS_USB, BUS_HIL, BUS_BLUETOOTH or BUS_VIRTUAL - vendor: device's vendor number - product: device's product number
[ "Returns", "a", "DevInfo", "instance", "a", "named", "tuple", "with", "the", "following", "items", ":", "-", "bustype", ":", "one", "of", "BUS_USB", "BUS_HIL", "BUS_BLUETOOTH", "or", "BUS_VIRTUAL", "-", "vendor", ":", "device", "s", "vendor", "number", "-", ...
python
train
42.7
PGower/PyCanvas
builder.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/builder.py#L71-L87
def service_param_string(params): """Takes a param section from a metadata class and returns a param string for the service method""" p = [] k = [] for param in params: name = fix_param_name(param['name']) if 'required' in param and param['required'] is True: p.append(...
[ "def", "service_param_string", "(", "params", ")", ":", "p", "=", "[", "]", "k", "=", "[", "]", "for", "param", "in", "params", ":", "name", "=", "fix_param_name", "(", "param", "[", "'name'", "]", ")", "if", "'required'", "in", "param", "and", "para...
Takes a param section from a metadata class and returns a param string for the service method
[ "Takes", "a", "param", "section", "from", "a", "metadata", "class", "and", "returns", "a", "param", "string", "for", "the", "service", "method" ]
python
train
36.705882
ome/omego
omego/fileutils.py
https://github.com/ome/omego/blob/2dadbf3c6342b6c995f9e0dceaf3c0b7fab030fb/omego/fileutils.py#L47-L92
def open_url(url, httpuser=None, httppassword=None, method=None): """ Open a URL using an opener that will simulate a browser user-agent url: The URL httpuser, httppassword: HTTP authentication credentials (either both or neither must be provided) method: The HTTP method Caller is reponsi...
[ "def", "open_url", "(", "url", ",", "httpuser", "=", "None", ",", "httppassword", "=", "None", ",", "method", "=", "None", ")", ":", "if", "os", ".", "getenv", "(", "'OMEGO_SSL_NO_VERIFY'", ")", "==", "'1'", ":", "# This needs to come first to override the def...
Open a URL using an opener that will simulate a browser user-agent url: The URL httpuser, httppassword: HTTP authentication credentials (either both or neither must be provided) method: The HTTP method Caller is reponsible for calling close() on the returned object
[ "Open", "a", "URL", "using", "an", "opener", "that", "will", "simulate", "a", "browser", "user", "-", "agent", "url", ":", "The", "URL", "httpuser", "httppassword", ":", "HTTP", "authentication", "credentials", "(", "either", "both", "or", "neither", "must",...
python
train
40.108696
i3visio/osrframework
osrframework/usufy.py
https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/usufy.py#L190-L316
def processNickList(nicks, platforms=None, rutaDescarga="./", avoidProcessing=True, avoidDownload=True, nThreads=12, verbosity=1, logFolder="./logs"): """ Process a list of nicks to check whether they exist. This method receives as a parameter a series of nicks and verifies whether those nicks have a p...
[ "def", "processNickList", "(", "nicks", ",", "platforms", "=", "None", ",", "rutaDescarga", "=", "\"./\"", ",", "avoidProcessing", "=", "True", ",", "avoidDownload", "=", "True", ",", "nThreads", "=", "12", ",", "verbosity", "=", "1", ",", "logFolder", "="...
Process a list of nicks to check whether they exist. This method receives as a parameter a series of nicks and verifies whether those nicks have a profile associated in different social networks. Args: ----- nicks: List of nicks to process. platforms: List of <Platform> objects to be p...
[ "Process", "a", "list", "of", "nicks", "to", "check", "whether", "they", "exist", "." ]
python
train
44.76378
aleju/imgaug
imgaug/external/poly_point_isect_py2py3.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L844-L851
def min_item(self): """Get item with min key of tree, raises ValueError if tree is empty.""" if self.is_empty(): raise ValueError("Tree is empty") node = self._root while node.left is not None: node = node.left return node.key, node.value
[ "def", "min_item", "(", "self", ")", ":", "if", "self", ".", "is_empty", "(", ")", ":", "raise", "ValueError", "(", "\"Tree is empty\"", ")", "node", "=", "self", ".", "_root", "while", "node", ".", "left", "is", "not", "None", ":", "node", "=", "nod...
Get item with min key of tree, raises ValueError if tree is empty.
[ "Get", "item", "with", "min", "key", "of", "tree", "raises", "ValueError", "if", "tree", "is", "empty", "." ]
python
valid
36.875
rossdylan/sham
sham/__init__.py
https://github.com/rossdylan/sham/blob/d938ae3da43814c3c45ae95b6116bd87282c8691/sham/__init__.py#L51-L62
def find_vm(self, name): """ Try and find a VM by name :param name: Name of the VM :type name: str """ try: domain = self.hyper.lookupByName(name) VM = VirtualMachine(domain, self) except libvirtError: VM = None return V...
[ "def", "find_vm", "(", "self", ",", "name", ")", ":", "try", ":", "domain", "=", "self", ".", "hyper", ".", "lookupByName", "(", "name", ")", "VM", "=", "VirtualMachine", "(", "domain", ",", "self", ")", "except", "libvirtError", ":", "VM", "=", "Non...
Try and find a VM by name :param name: Name of the VM :type name: str
[ "Try", "and", "find", "a", "VM", "by", "name", ":", "param", "name", ":", "Name", "of", "the", "VM", ":", "type", "name", ":", "str" ]
python
train
25.833333
klmitch/policies
policies/parser.py
https://github.com/klmitch/policies/blob/edf26c5707a5a0cc8e9f59a209a64dee7f79b7a4/policies/parser.py#L369-L401
def parse_rule(name, rule_text, do_raise=False): """ Parses the given rule text. :param name: The name of the rule. Used when emitting log messages regarding a failure to parse the rule. :param rule_text: The text of the rule to parse. :param do_raise: If ``False`` and the rule fa...
[ "def", "parse_rule", "(", "name", ",", "rule_text", ",", "do_raise", "=", "False", ")", ":", "try", ":", "return", "rule", ".", "parseString", "(", "rule_text", ",", "parseAll", "=", "True", ")", "[", "0", "]", "except", "pyparsing", ".", "ParseException...
Parses the given rule text. :param name: The name of the rule. Used when emitting log messages regarding a failure to parse the rule. :param rule_text: The text of the rule to parse. :param do_raise: If ``False`` and the rule fails to parse, a log message is emitted t...
[ "Parses", "the", "given", "rule", "text", "." ]
python
train
39.909091
tBuLi/symfit
symfit/core/objectives.py
https://github.com/tBuLi/symfit/blob/759dd3d1d4270510d651f40b23dd26b1b10eee83/symfit/core/objectives.py#L272-L298
def eval_jacobian(self, ordered_parameters=[], **parameters): """ Jacobian of :math:`S` in the :class:`~symfit.core.argument.Parameter`'s (:math:`\\nabla_\\vec{p} S`). :param parameters: values of the :class:`~symfit.core.argument.Parameter`'s to evaluate :math:`\\nabla_\\ve...
[ "def", "eval_jacobian", "(", "self", ",", "ordered_parameters", "=", "[", "]", ",", "*", "*", "parameters", ")", ":", "evaluated_func", "=", "super", "(", "LeastSquares", ",", "self", ")", ".", "__call__", "(", "ordered_parameters", ",", "*", "*", "paramet...
Jacobian of :math:`S` in the :class:`~symfit.core.argument.Parameter`'s (:math:`\\nabla_\\vec{p} S`). :param parameters: values of the :class:`~symfit.core.argument.Parameter`'s to evaluate :math:`\\nabla_\\vec{p} S` at. :return: ``np.array`` of length equal to the number of paramet...
[ "Jacobian", "of", ":", "math", ":", "S", "in", "the", ":", "class", ":", "~symfit", ".", "core", ".", "argument", ".", "Parameter", "s", "(", ":", "math", ":", "\\\\", "nabla_", "\\\\", "vec", "{", "p", "}", "S", ")", "." ]
python
train
44.851852
ucbvislab/radiotool
radiotool/composer/composition.py
https://github.com/ucbvislab/radiotool/blob/01c9d878a811cf400b1482896d641d9c95e83ded/radiotool/composer/composition.py#L175-L203
def extended_fade_in(self, segment, duration): """Add a fade-in to a segment that extends the beginning of the segment. :param segment: Segment to fade in :type segment: :py:class:`radiotool.composer.Segment` :param duration: Duration of fade-in (in seconds) :returns: Th...
[ "def", "extended_fade_in", "(", "self", ",", "segment", ",", "duration", ")", ":", "dur", "=", "int", "(", "duration", "*", "segment", ".", "track", ".", "samplerate", ")", "if", "segment", ".", "start", "-", "dur", ">=", "0", ":", "segment", ".", "s...
Add a fade-in to a segment that extends the beginning of the segment. :param segment: Segment to fade in :type segment: :py:class:`radiotool.composer.Segment` :param duration: Duration of fade-in (in seconds) :returns: The fade that has been added to the composition :rty...
[ "Add", "a", "fade", "-", "in", "to", "a", "segment", "that", "extends", "the", "beginning", "of", "the", "segment", "." ]
python
train
35.896552
Deepwalker/trafaret
trafaret/base.py
https://github.com/Deepwalker/trafaret/blob/4cbe4226e7f65133ba184b946faa2d3cd0e39d17/trafaret/base.py#L942-L956
def _clone_args(self): """ return args to create new Dict clone """ keys = list(self.keys) kw = {} if self.allow_any or self.extras: kw['allow_extra'] = list(self.extras) if self.allow_any: kw['allow_extra'].append('*') kw['allo...
[ "def", "_clone_args", "(", "self", ")", ":", "keys", "=", "list", "(", "self", ".", "keys", ")", "kw", "=", "{", "}", "if", "self", ".", "allow_any", "or", "self", ".", "extras", ":", "kw", "[", "'allow_extra'", "]", "=", "list", "(", "self", "."...
return args to create new Dict clone
[ "return", "args", "to", "create", "new", "Dict", "clone" ]
python
train
36.133333
O365/python-o365
O365/account.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/account.py#L151-L167
def sharepoint(self, *, resource=''): """ Get an instance to read information from Sharepoint sites for the specified account resource :param str resource: Custom resource to be used in this sharepoint object (Defaults to parent main_resource) :return: a representation of Share...
[ "def", "sharepoint", "(", "self", ",", "*", ",", "resource", "=", "''", ")", ":", "if", "not", "isinstance", "(", "self", ".", "protocol", ",", "MSGraphProtocol", ")", ":", "# TODO: Custom protocol accessing OneDrive/Sharepoint Api fails here", "raise", "RuntimeErro...
Get an instance to read information from Sharepoint sites for the specified account resource :param str resource: Custom resource to be used in this sharepoint object (Defaults to parent main_resource) :return: a representation of Sharepoint Sites :rtype: Sharepoint :ra...
[ "Get", "an", "instance", "to", "read", "information", "from", "Sharepoint", "sites", "for", "the", "specified", "account", "resource" ]
python
train
42.882353
ggravlingen/pytradfri
pytradfri/resource.py
https://github.com/ggravlingen/pytradfri/blob/63750fa8fb27158c013d24865cdaa7fb82b3ab53/pytradfri/resource.py#L37-L51
def observe(self, callback, err_callback, duration=60): """Observe resource and call callback when updated.""" def observe_callback(value): """ Called when end point is updated. Returns a Command. """ self.raw = value callback(self...
[ "def", "observe", "(", "self", ",", "callback", ",", "err_callback", ",", "duration", "=", "60", ")", ":", "def", "observe_callback", "(", "value", ")", ":", "\"\"\"\n Called when end point is updated.\n\n Returns a Command.\n \"\"\"", "self...
Observe resource and call callback when updated.
[ "Observe", "resource", "and", "call", "callback", "when", "updated", "." ]
python
train
34.6
fracpete/python-weka-wrapper3
python/weka/core/classes.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/classes.py#L90-L105
def get_classname(obj): """ Returns the classname of the JB_Object, Python class or object. :param obj: the java object or Python class/object to get the classname for :type obj: object :return: the classname :rtype: str """ if isinstance(obj, javabridge.JB_Object): cls = javabr...
[ "def", "get_classname", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "javabridge", ".", "JB_Object", ")", ":", "cls", "=", "javabridge", ".", "call", "(", "obj", ",", "\"getClass\"", ",", "\"()Ljava/lang/Class;\"", ")", "return", "javabridge", ...
Returns the classname of the JB_Object, Python class or object. :param obj: the java object or Python class/object to get the classname for :type obj: object :return: the classname :rtype: str
[ "Returns", "the", "classname", "of", "the", "JB_Object", "Python", "class", "or", "object", "." ]
python
train
35.0625
pybel/pybel
src/pybel/io/extras.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/io/extras.py#L71-L74
def to_csv_path(graph: BELGraph, path: str, sep: Optional[str] = None) -> None: """Write the graph as a tab-separated edge list to a file at the given path.""" with open(path, 'w') as file: to_csv(graph, file, sep=sep)
[ "def", "to_csv_path", "(", "graph", ":", "BELGraph", ",", "path", ":", "str", ",", "sep", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "None", ":", "with", "open", "(", "path", ",", "'w'", ")", "as", "file", ":", "to_csv", "(", "grap...
Write the graph as a tab-separated edge list to a file at the given path.
[ "Write", "the", "graph", "as", "a", "tab", "-", "separated", "edge", "list", "to", "a", "file", "at", "the", "given", "path", "." ]
python
train
57.75
SmartDeveloperHub/agora-service-provider
agora/provider/jobs/collect.py
https://github.com/SmartDeveloperHub/agora-service-provider/blob/3962207e5701c659c74c8cfffcbc4b0a63eac4b4/agora/provider/jobs/collect.py#L88-L108
def collect_fragment(event, agora_host): """ Execute a search plan for the declared graph pattern and sends all obtained triples to the corresponding collector functions (config """ agora = Agora(agora_host) graph_pattern = "" for tp in __triple_patterns: graph_pattern += '{} . '.for...
[ "def", "collect_fragment", "(", "event", ",", "agora_host", ")", ":", "agora", "=", "Agora", "(", "agora_host", ")", "graph_pattern", "=", "\"\"", "for", "tp", "in", "__triple_patterns", ":", "graph_pattern", "+=", "'{} . '", ".", "format", "(", "tp", ")", ...
Execute a search plan for the declared graph pattern and sends all obtained triples to the corresponding collector functions (config
[ "Execute", "a", "search", "plan", "for", "the", "declared", "graph", "pattern", "and", "sends", "all", "obtained", "triples", "to", "the", "corresponding", "collector", "functions", "(", "config" ]
python
train
47.380952
manns/pyspread
pyspread/src/lib/selection.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/selection.py#L296-L352
def get_bbox(self): """Returns ((top, left), (bottom, right)) of bounding box A bounding box is the smallest rectangle that contains all selections. Non-specified boundaries are None. """ bb_top, bb_left, bb_bottom, bb_right = [None] * 4 # Block selections fo...
[ "def", "get_bbox", "(", "self", ")", ":", "bb_top", ",", "bb_left", ",", "bb_bottom", ",", "bb_right", "=", "[", "None", "]", "*", "4", "# Block selections", "for", "top_left", ",", "bottom_right", "in", "zip", "(", "self", ".", "block_tl", ",", "self", ...
Returns ((top, left), (bottom, right)) of bounding box A bounding box is the smallest rectangle that contains all selections. Non-specified boundaries are None.
[ "Returns", "((", "top", "left", ")", "(", "bottom", "right", "))", "of", "bounding", "box" ]
python
train
31.22807
sirfoga/pyhal
hal/internet/services/github.py
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/services/github.py#L152-L164
def get_email(self): """Gets email :return: Email of user """ api_url = self.api_url + "/events/public" api_content = GithubRawApi( api_url, get_api_content_now=True ).api_content for event in api_content: if event["type"] == "...
[ "def", "get_email", "(", "self", ")", ":", "api_url", "=", "self", ".", "api_url", "+", "\"/events/public\"", "api_content", "=", "GithubRawApi", "(", "api_url", ",", "get_api_content_now", "=", "True", ")", ".", "api_content", "for", "event", "in", "api_conte...
Gets email :return: Email of user
[ "Gets", "email", ":", "return", ":", "Email", "of", "user" ]
python
train
30.153846
jantman/awslimitchecker
awslimitchecker/services/route53.py
https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L74-L82
def _update_limits_from_api(self): """ Query Route53's GetHostedZoneLimit API action, and update limits with the quotas returned. Updates ``self.limits``. """ logger.info("Querying Route53 GetHostedZoneLimits for limits") self.connect() self._find_limit_hosted_zon...
[ "def", "_update_limits_from_api", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Querying Route53 GetHostedZoneLimits for limits\"", ")", "self", ".", "connect", "(", ")", "self", ".", "_find_limit_hosted_zone", "(", ")", "logger", ".", "debug", "(", "'Done...
Query Route53's GetHostedZoneLimit API action, and update limits with the quotas returned. Updates ``self.limits``.
[ "Query", "Route53", "s", "GetHostedZoneLimit", "API", "action", "and", "update", "limits", "with", "the", "quotas", "returned", ".", "Updates", "self", ".", "limits", "." ]
python
train
41
shapiromatron/bmds
bmds/batch.py
https://github.com/shapiromatron/bmds/blob/395c6ce84ad82876fd9fa4a89a3497fb61616de0/bmds/batch.py#L86-L111
def to_df(self, recommended_only=False, include_io=True): """ Return a pandas DataFrame for each model and dataset. Parameters ---------- recommended_only : bool, optional If True, only recommended models for each session are included. If no model is reco...
[ "def", "to_df", "(", "self", ",", "recommended_only", "=", "False", ",", "include_io", "=", "True", ")", ":", "od", "=", "BMDS", ".", "_df_ordered_dict", "(", "include_io", ")", "[", "session", ".", "_add_to_to_ordered_dict", "(", "od", ",", "i", ",", "r...
Return a pandas DataFrame for each model and dataset. Parameters ---------- recommended_only : bool, optional If True, only recommended models for each session are included. If no model is recommended, then a row with it's ID will be included, but all fields ...
[ "Return", "a", "pandas", "DataFrame", "for", "each", "model", "and", "dataset", "." ]
python
train
35.038462
pyinvoke/invocations
invocations/packaging/release.py
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L277-L325
def prepare(c): """ Edit changelog & version, git commit, and git tag, to set up for release. """ # Print dry-run/status/actions-to-take data & grab programmatic result # TODO: maybe expand the enum-based stuff to have values that split up # textual description, command string, etc. See the TODO...
[ "def", "prepare", "(", "c", ")", ":", "# Print dry-run/status/actions-to-take data & grab programmatic result", "# TODO: maybe expand the enum-based stuff to have values that split up", "# textual description, command string, etc. See the TODO up by their", "# definition too, re: just making them ...
Edit changelog & version, git commit, and git tag, to set up for release.
[ "Edit", "changelog", "&", "version", "git", "commit", "and", "git", "tag", "to", "set", "up", "for", "release", "." ]
python
train
47.44898
vaexio/vaex
packages/vaex-core/vaex/dataframe.py
https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-core/vaex/dataframe.py#L3021-L3043
def add_virtual_columns_cartesian_velocities_to_spherical(self, x="x", y="y", z="z", vx="vx", vy="vy", vz="vz", vr="vr", vlong="vlong", vlat="vlat", distance=None): """Concert velocities from a cartesian to a spherical coordinate system TODO: errors :param x: name of x column (input) :...
[ "def", "add_virtual_columns_cartesian_velocities_to_spherical", "(", "self", ",", "x", "=", "\"x\"", ",", "y", "=", "\"y\"", ",", "z", "=", "\"z\"", ",", "vx", "=", "\"vx\"", ",", "vy", "=", "\"vy\"", ",", "vz", "=", "\"vz\"", ",", "vr", "=", "\"vr\"", ...
Concert velocities from a cartesian to a spherical coordinate system TODO: errors :param x: name of x column (input) :param y: y :param z: z :param vx: vx :param vy: vy :param vz: vz :param vr: name of the column for the...
[ "Concert", "velocities", "from", "a", "cartesian", "to", "a", "spherical", "coordinate", "system" ]
python
test
65.173913
inveniosoftware/invenio-migrator
invenio_migrator/legacy/userexts.py
https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/legacy/userexts.py#L40-L48
def dump(u, from_date, with_json=True, latest_only=False, **kwargs): """Dump the UserEXt objects as a list of dictionaries. :param u: UserEXT to be dumped. :type u: `invenio_accounts.models.UserEXT [Invenio2.x]` :returns: User serialized to dictionary. :rtype: dict """ return dict(id=u.id, ...
[ "def", "dump", "(", "u", ",", "from_date", ",", "with_json", "=", "True", ",", "latest_only", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "dict", "(", "id", "=", "u", ".", "id", ",", "method", "=", "u", ".", "method", ",", "id_user...
Dump the UserEXt objects as a list of dictionaries. :param u: UserEXT to be dumped. :type u: `invenio_accounts.models.UserEXT [Invenio2.x]` :returns: User serialized to dictionary. :rtype: dict
[ "Dump", "the", "UserEXt", "objects", "as", "a", "list", "of", "dictionaries", "." ]
python
test
38.555556
fredRos/pypmc
pypmc/tools/_plot.py
https://github.com/fredRos/pypmc/blob/9138b67c976f0d58edd080353d16769a47794d09/pypmc/tools/_plot.py#L132-L183
def plot_responsibility(data, responsibility, cmap='nipy_spectral'): '''Classify the 2D ``data`` according to the ``responsibility`` and make a scatter plot of each data point with the color of the component it is most likely from. The ``responsibility`` is normalized internally ...
[ "def", "plot_responsibility", "(", "data", ",", "responsibility", ",", "cmap", "=", "'nipy_spectral'", ")", ":", "import", "numpy", "as", "np", "from", "matplotlib", "import", "pyplot", "as", "plt", "from", "matplotlib", ".", "cm", "import", "get_cmap", "data"...
Classify the 2D ``data`` according to the ``responsibility`` and make a scatter plot of each data point with the color of the component it is most likely from. The ``responsibility`` is normalized internally such that each row sums to unity. :param data: matrix-like; one row = one 2D sample ...
[ "Classify", "the", "2D", "data", "according", "to", "the", "responsibility", "and", "make", "a", "scatter", "plot", "of", "each", "data", "point", "with", "the", "color", "of", "the", "component", "it", "is", "most", "likely", "from", ".", "The", "responsi...
python
train
30.134615
python-rope/rope
rope/base/resources.py
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/base/resources.py#L147-L161
def get_children(self): """Return the children of this folder""" try: children = os.listdir(self.real_path) except OSError: return [] result = [] for name in children: try: child = self.get_child(name) except excepti...
[ "def", "get_children", "(", "self", ")", ":", "try", ":", "children", "=", "os", ".", "listdir", "(", "self", ".", "real_path", ")", "except", "OSError", ":", "return", "[", "]", "result", "=", "[", "]", "for", "name", "in", "children", ":", "try", ...
Return the children of this folder
[ "Return", "the", "children", "of", "this", "folder" ]
python
train
32.133333
danijar/layered
layered/plot.py
https://github.com/danijar/layered/blob/c1c09d95f90057a91ae24c80b74f415680b97338/layered/plot.py#L111-L122
def update(self): """ Redraw the figure to show changed data. This is automatically called after `start()` was run. """ assert threading.current_thread() == threading.main_thread() for axis, line, interface in self.interfaces: line.set_xdata(interface.xdata) ...
[ "def", "update", "(", "self", ")", ":", "assert", "threading", ".", "current_thread", "(", ")", "==", "threading", ".", "main_thread", "(", ")", "for", "axis", ",", "line", ",", "interface", "in", "self", ".", "interfaces", ":", "line", ".", "set_xdata",...
Redraw the figure to show changed data. This is automatically called after `start()` was run.
[ "Redraw", "the", "figure", "to", "show", "changed", "data", ".", "This", "is", "automatically", "called", "after", "start", "()", "was", "run", "." ]
python
train
42.666667
hovren/crisp
crisp/calibration.py
https://github.com/hovren/crisp/blob/65cae19e7cfae5a397859096c9ef666e0f4e7f1b/crisp/calibration.py#L137-L157
def video_time_to_gyro_sample(self, t): """Convert video time to gyroscope sample index and interpolation factor Parameters ------------------- t : float Video timestamp Returns -------------------- n : int Sample index that precedes t ...
[ "def", "video_time_to_gyro_sample", "(", "self", ",", "t", ")", ":", "f_g", "=", "self", ".", "parameter", "[", "'gyro_rate'", "]", "d_c", "=", "self", ".", "parameter", "[", "'time_offset'", "]", "n", "=", "f_g", "*", "(", "t", "+", "d_c", ")", "n0"...
Convert video time to gyroscope sample index and interpolation factor Parameters ------------------- t : float Video timestamp Returns -------------------- n : int Sample index that precedes t tau : float Interpolation factor ...
[ "Convert", "video", "time", "to", "gyroscope", "sample", "index", "and", "interpolation", "factor" ]
python
train
30.238095
hatemile/hatemile-for-python
hatemile/implementation/css.py
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L903-L922
def _speak_header_always_inherit(self, element): """ The cells headers will be spoken for every data cell for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._speak_header_once_inheri...
[ "def", "_speak_header_always_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_speak_header_once_inherit", "(", "element", ")", "cell_elements", "=", "self", ".", "html_parser", ".", "find", "(", "element", ")", ".", "find_descendants", "(", "'td[h...
The cells headers will be spoken for every data cell for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "The", "cells", "headers", "will", "be", "spoken", "for", "every", "data", "cell", "for", "element", "and", "descendants", "." ]
python
train
34.25
tonysimpson/nanomsg-python
nanomsg/__init__.py
https://github.com/tonysimpson/nanomsg-python/blob/3acd9160f90f91034d4a43ce603aaa19fbaf1f2e/nanomsg/__init__.py#L340-L348
def close(self): """Close the socket""" if self.is_open(): fd = self._fd self._fd = -1 if self.uses_nanoconfig: wrapper.nc_close(fd) else: _nn_check_positive_rtn(wrapper.nn_close(fd))
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "is_open", "(", ")", ":", "fd", "=", "self", ".", "_fd", "self", ".", "_fd", "=", "-", "1", "if", "self", ".", "uses_nanoconfig", ":", "wrapper", ".", "nc_close", "(", "fd", ")", "else", ...
Close the socket
[ "Close", "the", "socket" ]
python
train
30.111111
spyder-ide/spyder
spyder/config/user.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L340-L350
def _check_section_option(self, section, option): """ Private method to check section and option types """ if section is None: section = self.DEFAULT_SECTION_NAME elif not is_text_string(section): raise RuntimeError("Argument 'section' must be a str...
[ "def", "_check_section_option", "(", "self", ",", "section", ",", "option", ")", ":", "if", "section", "is", "None", ":", "section", "=", "self", ".", "DEFAULT_SECTION_NAME", "elif", "not", "is_text_string", "(", "section", ")", ":", "raise", "RuntimeError", ...
Private method to check section and option types
[ "Private", "method", "to", "check", "section", "and", "option", "types" ]
python
train
40.818182
OSSOS/MOP
src/jjk/preproc/MOPplot.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/MOPplot.py#L634-L695
def load_pointings(self): """Load some pointings""" import os,re,ephem import tkFileDialog,tkMessageBox filename=tkFileDialog.askopenfilename() if filename is None: return f=open(filename) lines=f.readlines() f.close() points=[] if lines[0][0:5]=="<?xml": #...
[ "def", "load_pointings", "(", "self", ")", ":", "import", "os", ",", "re", ",", "ephem", "import", "tkFileDialog", ",", "tkMessageBox", "filename", "=", "tkFileDialog", ".", "askopenfilename", "(", ")", "if", "filename", "is", "None", ":", "return", "f", "...
Load some pointings
[ "Load", "some", "pointings" ]
python
train
30.741935
gvalkov/python-ansimarkup
ansimarkup/markup.py
https://github.com/gvalkov/python-ansimarkup/blob/92611bec49e8fdfaea0c77d63b758d8643398fdf/ansimarkup/markup.py#L71-L74
def strip(self, text): '''Return string with markup tags removed.''' tags, results = [], [] return self.re_tag.sub(lambda m: self.clear_tag(m, tags, results), text)
[ "def", "strip", "(", "self", ",", "text", ")", ":", "tags", ",", "results", "=", "[", "]", ",", "[", "]", "return", "self", ".", "re_tag", ".", "sub", "(", "lambda", "m", ":", "self", ".", "clear_tag", "(", "m", ",", "tags", ",", "results", ")"...
Return string with markup tags removed.
[ "Return", "string", "with", "markup", "tags", "removed", "." ]
python
train
46.25
ray-project/ray
python/ray/rllib/models/model.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/models/model.py#L208-L229
def restore_original_dimensions(obs, obs_space, tensorlib=tf): """Unpacks Dict and Tuple space observations into their original form. This is needed since we flatten Dict and Tuple observations in transit. Before sending them to the model though, we should unflatten them into Dicts or Tuples of tensors...
[ "def", "restore_original_dimensions", "(", "obs", ",", "obs_space", ",", "tensorlib", "=", "tf", ")", ":", "if", "hasattr", "(", "obs_space", ",", "\"original_space\"", ")", ":", "return", "_unpack_obs", "(", "obs", ",", "obs_space", ".", "original_space", ","...
Unpacks Dict and Tuple space observations into their original form. This is needed since we flatten Dict and Tuple observations in transit. Before sending them to the model though, we should unflatten them into Dicts or Tuples of tensors. Arguments: obs: The flattened observation tensor. ...
[ "Unpacks", "Dict", "and", "Tuple", "space", "observations", "into", "their", "original", "form", "." ]
python
train
39
saltstack/salt
salt/states/zone.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zone.py#L256-L414
def resource_present(name, resource_type, resource_selector_property, resource_selector_value, **kwargs): ''' Ensure resource exists with provided properties name : string name of the zone resource_type : string type of resource resource_selector_property : string unique res...
[ "def", "resource_present", "(", "name", ",", "resource_type", ",", "resource_selector_property", ",", "resource_selector_value", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":",...
Ensure resource exists with provided properties name : string name of the zone resource_type : string type of resource resource_selector_property : string unique resource identifier resource_selector_value : string value for resource selection kwargs : string|int|......
[ "Ensure", "resource", "exists", "with", "provided", "properties" ]
python
train
44.937107
r4fek/django-cassandra-engine
django_cassandra_engine/utils.py
https://github.com/r4fek/django-cassandra-engine/blob/b43f8fddd4bba143f03f73f8bbfc09e6b32c699b/django_cassandra_engine/utils.py#L101-L111
def get_cassandra_connections(): """ :return: List of tuples (db_alias, connection) for all cassandra connections in DATABASES dict. """ from django.db import connections for alias in connections: engine = connections[alias].settings_dict.get('ENGINE', '') if engine == 'django_c...
[ "def", "get_cassandra_connections", "(", ")", ":", "from", "django", ".", "db", "import", "connections", "for", "alias", "in", "connections", ":", "engine", "=", "connections", "[", "alias", "]", ".", "settings_dict", ".", "get", "(", "'ENGINE'", ",", "''", ...
:return: List of tuples (db_alias, connection) for all cassandra connections in DATABASES dict.
[ ":", "return", ":", "List", "of", "tuples", "(", "db_alias", "connection", ")", "for", "all", "cassandra", "connections", "in", "DATABASES", "dict", "." ]
python
train
33.727273
skoczen/will
will/plugins/chat_room/rooms.py
https://github.com/skoczen/will/blob/778a6a78571e3ae4656b307f9e5d4d184b25627d/will/plugins/chat_room/rooms.py#L8-L11
def list_rooms(self, message): """what are the rooms?: List all the rooms I know about.""" context = {"rooms": self.available_rooms.values(), } self.say(rendered_template("rooms.html", context), message=message, html=True)
[ "def", "list_rooms", "(", "self", ",", "message", ")", ":", "context", "=", "{", "\"rooms\"", ":", "self", ".", "available_rooms", ".", "values", "(", ")", ",", "}", "self", ".", "say", "(", "rendered_template", "(", "\"rooms.html\"", ",", "context", ")"...
what are the rooms?: List all the rooms I know about.
[ "what", "are", "the", "rooms?", ":", "List", "all", "the", "rooms", "I", "know", "about", "." ]
python
train
60.75
saltstack/salt
salt/runners/spacewalk.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/spacewalk.py#L117-L135
def _get_session(server): ''' Get session and key ''' if server in _sessions: return _sessions[server] config = _get_spacewalk_configuration(server) if not config: raise Exception('No config for \'{0}\' found on master'.format(server)) session = _get_client_and_key(config['...
[ "def", "_get_session", "(", "server", ")", ":", "if", "server", "in", "_sessions", ":", "return", "_sessions", "[", "server", "]", "config", "=", "_get_spacewalk_configuration", "(", "server", ")", "if", "not", "config", ":", "raise", "Exception", "(", "'No ...
Get session and key
[ "Get", "session", "and", "key" ]
python
train
27.421053
google/mobly
mobly/controllers/android_device.py
https://github.com/google/mobly/blob/38ba2cf7d29a20e6a2fca1718eecb337df38db26/mobly/controllers/android_device.py#L785-L811
def load_snippet(self, name, package): """Starts the snippet apk with the given package name and connects. Examples: .. code-block:: python ad.load_snippet( name='maps', package='com.google.maps.snippets') ad.maps.activateZoom('3') Args: ...
[ "def", "load_snippet", "(", "self", ",", "name", ",", "package", ")", ":", "# Should not load snippet with an existing attribute.", "if", "hasattr", "(", "self", ",", "name", ")", ":", "raise", "SnippetError", "(", "self", ",", "'Attribute \"%s\" already exists, pleas...
Starts the snippet apk with the given package name and connects. Examples: .. code-block:: python ad.load_snippet( name='maps', package='com.google.maps.snippets') ad.maps.activateZoom('3') Args: name: string, the attribute name to whic...
[ "Starts", "the", "snippet", "apk", "with", "the", "given", "package", "name", "and", "connects", "." ]
python
train
35.444444
UDST/urbansim
urbansim/models/util.py
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/util.py#L230-L255
def sorted_groupby(df, groupby): """ Perform a groupby on a DataFrame using a specific column and assuming that that column is sorted. Parameters ---------- df : pandas.DataFrame groupby : object Column name on which to groupby. This column must be sorted. Returns ------- ...
[ "def", "sorted_groupby", "(", "df", ",", "groupby", ")", ":", "start", "=", "0", "prev", "=", "df", "[", "groupby", "]", ".", "iloc", "[", "start", "]", "for", "i", ",", "x", "in", "enumerate", "(", "df", "[", "groupby", "]", ")", ":", "if", "x...
Perform a groupby on a DataFrame using a specific column and assuming that that column is sorted. Parameters ---------- df : pandas.DataFrame groupby : object Column name on which to groupby. This column must be sorted. Returns ------- generator Yields pairs of group_na...
[ "Perform", "a", "groupby", "on", "a", "DataFrame", "using", "a", "specific", "column", "and", "assuming", "that", "that", "column", "is", "sorted", "." ]
python
train
24.192308
dhocker/udmx-pyusb
pyudmx/pyudmx.py
https://github.com/dhocker/udmx-pyusb/blob/ee7d10604ecd83857154ed6739793de3b7bd5fc1/pyudmx/pyudmx.py#L69-L78
def close(self): """ Close and release the current usb device. :return: None """ # This may not be absolutely necessary, but it is safe. # It's the closest thing to a close() method. if self._dev is not None: usb.util.dispose_resources(self._dev) ...
[ "def", "close", "(", "self", ")", ":", "# This may not be absolutely necessary, but it is safe.", "# It's the closest thing to a close() method.", "if", "self", ".", "_dev", "is", "not", "None", ":", "usb", ".", "util", ".", "dispose_resources", "(", "self", ".", "_de...
Close and release the current usb device. :return: None
[ "Close", "and", "release", "the", "current", "usb", "device", ".", ":", "return", ":", "None" ]
python
train
33.4
threeML/astromodels
astromodels/core/parameter.py
https://github.com/threeML/astromodels/blob/9aac365a372f77603039533df9a6b694c1e360d5/astromodels/core/parameter.py#L916-L946
def _set_prior(self, prior): """Set prior for this parameter. The prior must be a function accepting the current value of the parameter as input and giving the probability density as output.""" if prior is None: # Removing prior self._prior = None else: ...
[ "def", "_set_prior", "(", "self", ",", "prior", ")", ":", "if", "prior", "is", "None", ":", "# Removing prior", "self", ".", "_prior", "=", "None", "else", ":", "# Try and call the prior with the current value of the parameter", "try", ":", "_", "=", "prior", "(...
Set prior for this parameter. The prior must be a function accepting the current value of the parameter as input and giving the probability density as output.
[ "Set", "prior", "for", "this", "parameter", ".", "The", "prior", "must", "be", "a", "function", "accepting", "the", "current", "value", "of", "the", "parameter", "as", "input", "and", "giving", "the", "probability", "density", "as", "output", "." ]
python
train
29.387097
robmoggach/django-token-auth
src/token_auth/models.py
https://github.com/robmoggach/django-token-auth/blob/7ef6e10c27b0168c1272347d0169cdbd96232ed3/src/token_auth/models.py#L60-L67
def generate_hash(self): """ Create a unique SHA token/hash using the project SECRET_KEY, URL, email address and current datetime. """ from django.utils.hashcompat import sha_constructor hash = sha_constructor(settings.SECRET_KEY + self.url + self.email + unicode(datetime...
[ "def", "generate_hash", "(", "self", ")", ":", "from", "django", ".", "utils", ".", "hashcompat", "import", "sha_constructor", "hash", "=", "sha_constructor", "(", "settings", ".", "SECRET_KEY", "+", "self", ".", "url", "+", "self", ".", "email", "+", "uni...
Create a unique SHA token/hash using the project SECRET_KEY, URL, email address and current datetime.
[ "Create", "a", "unique", "SHA", "token", "/", "hash", "using", "the", "project", "SECRET_KEY", "URL", "email", "address", "and", "current", "datetime", "." ]
python
train
44.875
readbeyond/aeneas
aeneas/executetask.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/executetask.py#L460-L505
def _compute_head_process_tail(self, audio_file_mfcc): """ Set the audio file head or tail, by either reading the explicit values from the Task configuration, or using SD to determine them. This function returns the lengths, in seconds, of the (head, process, tai...
[ "def", "_compute_head_process_tail", "(", "self", ",", "audio_file_mfcc", ")", ":", "head_length", "=", "self", ".", "task", ".", "configuration", "[", "\"i_a_head\"", "]", "process_length", "=", "self", ".", "task", ".", "configuration", "[", "\"i_a_process\"", ...
Set the audio file head or tail, by either reading the explicit values from the Task configuration, or using SD to determine them. This function returns the lengths, in seconds, of the (head, process, tail). :rtype: tuple (float, float, float)
[ "Set", "the", "audio", "file", "head", "or", "tail", "by", "either", "reading", "the", "explicit", "values", "from", "the", "Task", "configuration", "or", "using", "SD", "to", "determine", "them", "." ]
python
train
46.673913
inasafe/inasafe
safe/impact_function/style.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/style.py#L267-L331
def _format_label( hazard_class, value, exposure_unit, hazard_unit=None, minimum=None, maximum=None): """Helper function to format the label in the legend. :param hazard_class: The main name of the label. :type hazard_class: basestring :param value: The ...
[ "def", "_format_label", "(", "hazard_class", ",", "value", ",", "exposure_unit", ",", "hazard_unit", "=", "None", ",", "minimum", "=", "None", ",", "maximum", "=", "None", ")", ":", "# If the exposure unit is not null, we need to add a space.", "if", "exposure_unit", ...
Helper function to format the label in the legend. :param hazard_class: The main name of the label. :type hazard_class: basestring :param value: The number of features affected by this hazard class. :type value: float :param exposure_unit: The exposure unit. :type exposure_unit: basestring ...
[ "Helper", "function", "to", "format", "the", "label", "in", "the", "legend", "." ]
python
train
29.846154
LonamiWebs/Telethon
telethon/network/mtprotosender.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L396-L445
async def _recv_loop(self): """ This loop is responsible for reading all incoming responses from the network, decrypting and handling or dispatching them. Besides `connect`, only this method ever receives data. """ while self._user_connected and not self._reconnecting: ...
[ "async", "def", "_recv_loop", "(", "self", ")", ":", "while", "self", ".", "_user_connected", "and", "not", "self", ".", "_reconnecting", ":", "self", ".", "_log", ".", "debug", "(", "'Receiving items from the network...'", ")", "try", ":", "body", "=", "awa...
This loop is responsible for reading all incoming responses from the network, decrypting and handling or dispatching them. Besides `connect`, only this method ever receives data.
[ "This", "loop", "is", "responsible", "for", "reading", "all", "incoming", "responses", "from", "the", "network", "decrypting", "and", "handling", "or", "dispatching", "them", "." ]
python
train
42.12
Murali-group/halp
halp/directed_hypergraph.py
https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L346-L399
def trim_node(self, node): """Removes a node from the hypergraph. Modifies hypredges with the trimmed node in their head or tail so that they no longer include the trimmed node. If a hyperedge has solely the trimmed node in its head or tail, that hyperedge is removed. ...
[ "def", "trim_node", "(", "self", ",", "node", ")", ":", "fs", "=", "self", ".", "get_forward_star", "(", "node", ")", "bs", "=", "self", ".", "get_backward_star", "(", "node", ")", "remove_set", "=", "set", "(", ")", "def", "get_attrs", "(", "H", ","...
Removes a node from the hypergraph. Modifies hypredges with the trimmed node in their head or tail so that they no longer include the trimmed node. If a hyperedge has solely the trimmed node in its head or tail, that hyperedge is removed. Note: hyperedges modified this way wil...
[ "Removes", "a", "node", "from", "the", "hypergraph", ".", "Modifies", "hypredges", "with", "the", "trimmed", "node", "in", "their", "head", "or", "tail", "so", "that", "they", "no", "longer", "include", "the", "trimmed", "node", ".", "If", "a", "hyperedge"...
python
train
36.018519
SpriteLink/NIPAP
nipap-cli/nipap_cli/nipap_cli.py
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/nipap-cli/nipap_cli/nipap_cli.py#L1626-L1703
def modify_prefix(arg, opts, shell_opts): """ Modify the prefix 'arg' with the options 'opts' """ modify_confirmed = shell_opts.force spec = { 'prefix': arg } v = get_vrf(opts.get('vrf_rt'), abort=True) spec['vrf_rt'] = v.rt res = Prefix.list(spec) if len(res) == 0: print("Pre...
[ "def", "modify_prefix", "(", "arg", ",", "opts", ",", "shell_opts", ")", ":", "modify_confirmed", "=", "shell_opts", ".", "force", "spec", "=", "{", "'prefix'", ":", "arg", "}", "v", "=", "get_vrf", "(", "opts", ".", "get", "(", "'vrf_rt'", ")", ",", ...
Modify the prefix 'arg' with the options 'opts'
[ "Modify", "the", "prefix", "arg", "with", "the", "options", "opts" ]
python
train
30.897436
twitterdev/twitter-python-ads-sdk
twitter_ads/resource.py
https://github.com/twitterdev/twitter-python-ads-sdk/blob/b4488333ac2a794b85b7f16ded71e98b60e51c74/twitter_ads/resource.py#L262-L270
def all_stats(klass, account, ids, metric_groups, **kwargs): """ Pulls a list of metrics for a specified set of object IDs. """ params = klass._standard_params(ids, metric_groups, **kwargs) resource = klass.RESOURCE_SYNC.format(account_id=account.id) response = Request(a...
[ "def", "all_stats", "(", "klass", ",", "account", ",", "ids", ",", "metric_groups", ",", "*", "*", "kwargs", ")", ":", "params", "=", "klass", ".", "_standard_params", "(", "ids", ",", "metric_groups", ",", "*", "*", "kwargs", ")", "resource", "=", "kl...
Pulls a list of metrics for a specified set of object IDs.
[ "Pulls", "a", "list", "of", "metrics", "for", "a", "specified", "set", "of", "object", "IDs", "." ]
python
train
45
cocaine/cocaine-tools
cocaine/tools/dispatch.py
https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1653-L1660
def auth_list(**kwargs): """ Shows available authorization groups. """ ctx = Context(**kwargs) ctx.execute_action('auth:group:list', **{ 'storage': ctx.repo.create_secure_service('storage'), })
[ "def", "auth_list", "(", "*", "*", "kwargs", ")", ":", "ctx", "=", "Context", "(", "*", "*", "kwargs", ")", "ctx", ".", "execute_action", "(", "'auth:group:list'", ",", "*", "*", "{", "'storage'", ":", "ctx", ".", "repo", ".", "create_secure_service", ...
Shows available authorization groups.
[ "Shows", "available", "authorization", "groups", "." ]
python
train
27.25
pywbem/pywbem
pywbem/_statistics.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_statistics.py#L383-L396
def start_timer(self): """ This is a low-level method that is called by pywbem at the begin of an operation. It starts the measurement for that operation, if statistics is enabled for the connection. A subsequent invocation of :meth:`~pywbem.OperationStatistic.stop_timer` ...
[ "def", "start_timer", "(", "self", ")", ":", "if", "self", ".", "container", ".", "enabled", ":", "self", ".", "_start_time", "=", "time", ".", "time", "(", ")", "if", "not", "self", ".", "_stat_start_time", ":", "self", ".", "_stat_start_time", "=", "...
This is a low-level method that is called by pywbem at the begin of an operation. It starts the measurement for that operation, if statistics is enabled for the connection. A subsequent invocation of :meth:`~pywbem.OperationStatistic.stop_timer` will complete the measurement for that op...
[ "This", "is", "a", "low", "-", "level", "method", "that", "is", "called", "by", "pywbem", "at", "the", "begin", "of", "an", "operation", ".", "It", "starts", "the", "measurement", "for", "that", "operation", "if", "statistics", "is", "enabled", "for", "t...
python
train
42.214286