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
linkedin/pyexchange
pyexchange/exchange2010/__init__.py
https://github.com/linkedin/pyexchange/blob/d568f4edd326adb451b915ddf66cf1a37820e3ca/pyexchange/exchange2010/__init__.py#L293-L336
def update(self, calendar_item_update_operation_type=u'SendToAllAndSaveCopy', **kwargs): """ Updates an event in Exchange. :: event = service.calendar().get_event(id='KEY HERE') event.location = u'New location' event.update() If no changes to the event have been made, this method ...
[ "def", "update", "(", "self", ",", "calendar_item_update_operation_type", "=", "u'SendToAllAndSaveCopy'", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "id", ":", "raise", "TypeError", "(", "u\"You can't update an event that hasn't been created yet.\"", ...
Updates an event in Exchange. :: event = service.calendar().get_event(id='KEY HERE') event.location = u'New location' event.update() If no changes to the event have been made, this method does nothing. Notification of the change event is sent to all users. If you wish to just notify ...
[ "Updates", "an", "event", "in", "Exchange", ".", "::" ]
python
train
39.409091
mitsei/dlkit
dlkit/json_/relationship/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2533-L2548
def remove_child_families(self, family_id): """Removes all children from a family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not in hierarchy raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to comple...
[ "def", "remove_child_families", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catal...
Removes all children from a family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not in hierarchy raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authoriza...
[ "Removes", "all", "children", "from", "a", "family", "." ]
python
train
48.125
jazzband/sorl-thumbnail
sorl/thumbnail/kvstores/base.py
https://github.com/jazzband/sorl-thumbnail/blob/22ccd9781462a820f963f57018ad3dcef85053ed/sorl/thumbnail/kvstores/base.py#L141-L153
def _get(self, key, identity='image'): """ Deserializing, prefix wrapper for _get_raw """ value = self._get_raw(add_prefix(key, identity)) if not value: return None if identity == 'image': return deserialize_image_file(value) return dese...
[ "def", "_get", "(", "self", ",", "key", ",", "identity", "=", "'image'", ")", ":", "value", "=", "self", ".", "_get_raw", "(", "add_prefix", "(", "key", ",", "identity", ")", ")", "if", "not", "value", ":", "return", "None", "if", "identity", "==", ...
Deserializing, prefix wrapper for _get_raw
[ "Deserializing", "prefix", "wrapper", "for", "_get_raw" ]
python
train
24.769231
SheffieldML/GPy
GPy/inference/latent_function_inference/posterior.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L199-L209
def woodbury_vector(self): """ Woodbury vector in the gaussian likelihood case only is defined as $$ (K_{xx} + \Sigma)^{-1}Y \Sigma := \texttt{Likelihood.variance / Approximate likelihood covariance} $$ """ if self._woodbury_vector is None: sel...
[ "def", "woodbury_vector", "(", "self", ")", ":", "if", "self", ".", "_woodbury_vector", "is", "None", ":", "self", ".", "_woodbury_vector", ",", "_", "=", "dpotrs", "(", "self", ".", "K_chol", ",", "self", ".", "mean", "-", "self", ".", "_prior_mean", ...
Woodbury vector in the gaussian likelihood case only is defined as $$ (K_{xx} + \Sigma)^{-1}Y \Sigma := \texttt{Likelihood.variance / Approximate likelihood covariance} $$
[ "Woodbury", "vector", "in", "the", "gaussian", "likelihood", "case", "only", "is", "defined", "as", "$$", "(", "K_", "{", "xx", "}", "+", "\\", "Sigma", ")", "^", "{", "-", "1", "}", "Y", "\\", "Sigma", ":", "=", "\\", "texttt", "{", "Likelihood", ...
python
train
38.181818
edx/edx-submissions
submissions/api.py
https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/api.py#L827-L920
def set_score(submission_uuid, points_earned, points_possible, annotation_creator=None, annotation_type=None, annotation_reason=None): """Set a score for a particular submission. Sets the score for a particular submission. This score is calculated externally to the API. Args: sub...
[ "def", "set_score", "(", "submission_uuid", ",", "points_earned", ",", "points_possible", ",", "annotation_creator", "=", "None", ",", "annotation_type", "=", "None", ",", "annotation_reason", "=", "None", ")", ":", "try", ":", "submission_model", "=", "_get_submi...
Set a score for a particular submission. Sets the score for a particular submission. This score is calculated externally to the API. Args: submission_uuid (str): UUID for the submission (must exist). points_earned (int): The earned points for this submission. points_possible (int):...
[ "Set", "a", "score", "for", "a", "particular", "submission", "." ]
python
train
38.712766
wummel/linkchecker
linkcheck/checker/telneturl.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/telneturl.py#L57-L73
def check_connection (self): """ Open a telnet connection and try to login. Expected login label is "login: ", expected password label is "Password: ". """ self.url_connection = telnetlib.Telnet(timeout=self.aggregate.config["timeout"]) if log.is_debug(LOG_CHECK): ...
[ "def", "check_connection", "(", "self", ")", ":", "self", ".", "url_connection", "=", "telnetlib", ".", "Telnet", "(", "timeout", "=", "self", ".", "aggregate", ".", "config", "[", "\"timeout\"", "]", ")", "if", "log", ".", "is_debug", "(", "LOG_CHECK", ...
Open a telnet connection and try to login. Expected login label is "login: ", expected password label is "Password: ".
[ "Open", "a", "telnet", "connection", "and", "try", "to", "login", ".", "Expected", "login", "label", "is", "login", ":", "expected", "password", "label", "is", "Password", ":", "." ]
python
train
47.529412
tnkteja/myhelp
virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/parser.py#L403-L413
def _find_statements(self): """Find the statements in `self.code`. Produce a sequence of line numbers that start statements. Recurses into all code objects reachable from `self.code`. """ for bp in self.child_parsers(): # Get all of the lineno information from this...
[ "def", "_find_statements", "(", "self", ")", ":", "for", "bp", "in", "self", ".", "child_parsers", "(", ")", ":", "# Get all of the lineno information from this code.", "for", "_", ",", "l", "in", "bp", ".", "_bytes_lines", "(", ")", ":", "yield", "l" ]
Find the statements in `self.code`. Produce a sequence of line numbers that start statements. Recurses into all code objects reachable from `self.code`.
[ "Find", "the", "statements", "in", "self", ".", "code", "." ]
python
test
34.818182
spyder-ide/spyder
spyder/app/mainwindow.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1351-L1374
def set_window_title(self): """Set window title.""" if DEV is not None: title = u"Spyder %s (Python %s.%s)" % (__version__, sys.version_info[0], sys.version_info[1]) else: ...
[ "def", "set_window_title", "(", "self", ")", ":", "if", "DEV", "is", "not", "None", ":", "title", "=", "u\"Spyder %s (Python %s.%s)\"", "%", "(", "__version__", ",", "sys", ".", "version_info", "[", "0", "]", ",", "sys", ".", "version_info", "[", "1", "]...
Set window title.
[ "Set", "window", "title", "." ]
python
train
39.958333
python-gitlab/python-gitlab
gitlab/v4/objects.py
https://github.com/python-gitlab/python-gitlab/blob/16de1b03fde3dbbe8f851614dd1d8c09de102fe5/gitlab/v4/objects.py#L2667-L2682
def delete(self, file_path, branch, commit_message, **kwargs): """Delete a file on the server. Args: file_path (str): Path of the file to remove branch (str): Branch from which the file will be removed commit_message (str): Commit message for the deletion ...
[ "def", "delete", "(", "self", ",", "file_path", ",", "branch", ",", "commit_message", ",", "*", "*", "kwargs", ")", ":", "path", "=", "'%s/%s'", "%", "(", "self", ".", "path", ",", "file_path", ".", "replace", "(", "'/'", ",", "'%2F'", ")", ")", "d...
Delete a file on the server. Args: file_path (str): Path of the file to remove branch (str): Branch from which the file will be removed commit_message (str): Commit message for the deletion **kwargs: Extra options to send to the server (e.g. sudo) Raises...
[ "Delete", "a", "file", "on", "the", "server", "." ]
python
train
46.0625
alantygel/ckanext-semantictags
ckanext/semantictags/db.py
https://github.com/alantygel/ckanext-semantictags/blob/10bb31d29f34b2b5a6feae693961842f93007ce1/ckanext/semantictags/db.py#L352-L360
def get(self,id): '''Return all the semantic tag related to the given tag id :returns: a semantic tag or None :rtype: list of ckan.model.semantictag.SemanticTag object ''' query = meta.Session.query(TagSemanticTag).filter(TagSemanticTag.id==id) return query.first()
[ "def", "get", "(", "self", ",", "id", ")", ":", "query", "=", "meta", ".", "Session", ".", "query", "(", "TagSemanticTag", ")", ".", "filter", "(", "TagSemanticTag", ".", "id", "==", "id", ")", "return", "query", ".", "first", "(", ")" ]
Return all the semantic tag related to the given tag id :returns: a semantic tag or None :rtype: list of ckan.model.semantictag.SemanticTag object
[ "Return", "all", "the", "semantic", "tag", "related", "to", "the", "given", "tag", "id" ]
python
train
30.111111
gatkin/declxml
declxml.py
https://github.com/gatkin/declxml/blob/3a2324b43aee943e82a04587fbb68932c6f392ba/declxml.py#L1234-L1249
def serialize( self, value, # type: Any state # type: _ProcessorState ): # type: (...) -> ET.Element """ Serialize the value into a new element object and return the element. If the omit_empty option was specified and the value is falsey, then t...
[ "def", "serialize", "(", "self", ",", "value", ",", "# type: Any", "state", "# type: _ProcessorState", ")", ":", "# type: (...) -> ET.Element", "# For primitive values, this is only called when the value is part of an array,", "# in which case we do not need to check for missing or omitt...
Serialize the value into a new element object and return the element. If the omit_empty option was specified and the value is falsey, then this will return None.
[ "Serialize", "the", "value", "into", "a", "new", "element", "object", "and", "return", "the", "element", "." ]
python
train
41.625
bird-house/birdhousebuilder.recipe.conda
birdhousebuilder/recipe/conda/__init__.py
https://github.com/bird-house/birdhousebuilder.recipe.conda/blob/a5c0224ca4424c0c5cb1c302ba220c43cbc7ab3d/birdhousebuilder/recipe/conda/__init__.py#L172-L211
def install_pkgs(self, offline=False): """ TODO: maybe use conda as python package """ if not offline and self.pkgs: self.logger.info("Installing conda packages ...") cmd = [join(self.anaconda_home, 'bin', 'conda')] cmd.append('install') # ...
[ "def", "install_pkgs", "(", "self", ",", "offline", "=", "False", ")", ":", "if", "not", "offline", "and", "self", ".", "pkgs", ":", "self", ".", "logger", ".", "info", "(", "\"Installing conda packages ...\"", ")", "cmd", "=", "[", "join", "(", "self", ...
TODO: maybe use conda as python package
[ "TODO", ":", "maybe", "use", "conda", "as", "python", "package" ]
python
train
43.075
shaldengeki/python-mal
myanimelist/user.py
https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L622-L631
def load_clubs(self): """Fetches the MAL user clubs page and sets the current user's clubs attributes. :rtype: :class:`.User` :return: Current user object. """ user_clubs = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/clubs').text self.s...
[ "def", "load_clubs", "(", "self", ")", ":", "user_clubs", "=", "self", ".", "session", ".", "session", ".", "get", "(", "u'http://myanimelist.net/profile/'", "+", "utilities", ".", "urlencode", "(", "self", ".", "username", ")", "+", "u'/clubs'", ")", ".", ...
Fetches the MAL user clubs page and sets the current user's clubs attributes. :rtype: :class:`.User` :return: Current user object.
[ "Fetches", "the", "MAL", "user", "clubs", "page", "and", "sets", "the", "current", "user", "s", "clubs", "attributes", "." ]
python
train
38.4
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/oinspect.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L85-L89
def object_info(**kw): """Make an object info dict with all fields present.""" infodict = dict(izip_longest(info_fields, [None])) infodict.update(kw) return infodict
[ "def", "object_info", "(", "*", "*", "kw", ")", ":", "infodict", "=", "dict", "(", "izip_longest", "(", "info_fields", ",", "[", "None", "]", ")", ")", "infodict", ".", "update", "(", "kw", ")", "return", "infodict" ]
Make an object info dict with all fields present.
[ "Make", "an", "object", "info", "dict", "with", "all", "fields", "present", "." ]
python
test
35.4
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1541-L1573
def _find_instance(iname, instance_repo): """ Find an instance in the instance repo by iname and return the index of that instance. Parameters: iname: CIMInstancename to find instance_repo: the instance repo to search Return (None, None if not found. Other...
[ "def", "_find_instance", "(", "iname", ",", "instance_repo", ")", ":", "rtn_inst", "=", "None", "rtn_index", "=", "None", "for", "index", ",", "inst", "in", "enumerate", "(", "instance_repo", ")", ":", "if", "iname", "==", "inst", ".", "path", ":", "if",...
Find an instance in the instance repo by iname and return the index of that instance. Parameters: iname: CIMInstancename to find instance_repo: the instance repo to search Return (None, None if not found. Otherwise return tuple of index, instance R...
[ "Find", "an", "instance", "in", "the", "instance", "repo", "by", "iname", "and", "return", "the", "index", "of", "that", "instance", "." ]
python
train
31.787879
odlgroup/odl
odl/solvers/smooth/newton.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/solvers/smooth/newton.py#L127-L243
def newtons_method(f, x, line_search=1.0, maxiter=1000, tol=1e-16, cg_iter=None, callback=None): r"""Newton's method for minimizing a functional. Notes ----- This is a general and optimized implementation of Newton's method for solving the problem: .. math:: \min f(x...
[ "def", "newtons_method", "(", "f", ",", "x", ",", "line_search", "=", "1.0", ",", "maxiter", "=", "1000", ",", "tol", "=", "1e-16", ",", "cg_iter", "=", "None", ",", "callback", "=", "None", ")", ":", "# TODO: update doc", "grad", "=", "f", ".", "gra...
r"""Newton's method for minimizing a functional. Notes ----- This is a general and optimized implementation of Newton's method for solving the problem: .. math:: \min f(x) for a differentiable function :math:`f: \mathcal{X}\to \mathbb{R}` on a Hilbert space :math:`\mathcal{X}`...
[ "r", "Newton", "s", "method", "for", "minimizing", "a", "functional", "." ]
python
train
32.837607
michael-lazar/rtv
rtv/submission_page.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/submission_page.py#L53-L70
def refresh_content(self, order=None, name=None): """ Re-download comments and reset the page index """ order = order or self.content.order url = name or self.content.name # Hack to allow an order specified in the name by prompt_subreddit() to # override the curr...
[ "def", "refresh_content", "(", "self", ",", "order", "=", "None", ",", "name", "=", "None", ")", ":", "order", "=", "order", "or", "self", ".", "content", ".", "order", "url", "=", "name", "or", "self", ".", "content", ".", "name", "# Hack to allow an ...
Re-download comments and reset the page index
[ "Re", "-", "download", "comments", "and", "reset", "the", "page", "index" ]
python
train
39.722222
markovmodel/PyEMMA
pyemma/coordinates/data/featurization/util.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/coordinates/data/featurization/util.py#L71-L88
def cmp_traj(traj_a, traj_b): """ Parameters ---------- traj_a, traj_b: mdtraj.Trajectory """ if traj_a is None and traj_b is None: return True if traj_a is None and traj_b is not None: return False if traj_a is not None and traj_b is None: return False equal_...
[ "def", "cmp_traj", "(", "traj_a", ",", "traj_b", ")", ":", "if", "traj_a", "is", "None", "and", "traj_b", "is", "None", ":", "return", "True", "if", "traj_a", "is", "None", "and", "traj_b", "is", "not", "None", ":", "return", "False", "if", "traj_a", ...
Parameters ---------- traj_a, traj_b: mdtraj.Trajectory
[ "Parameters", "----------", "traj_a", "traj_b", ":", "mdtraj", ".", "Trajectory" ]
python
train
40.833333
pgjones/hypercorn
hypercorn/asgi/wsproto.py
https://github.com/pgjones/hypercorn/blob/ef93d741fe246846a127f9318b54505ac65f1ae7/hypercorn/asgi/wsproto.py#L108-L151
async def asgi_send(self, message: dict) -> None: """Called by the ASGI instance to send a message.""" if message["type"] == "websocket.accept" and self.state == ASGIWebsocketState.HANDSHAKE: headers = build_and_validate_headers(message.get("headers", [])) raise_if_subprotocol_pr...
[ "async", "def", "asgi_send", "(", "self", ",", "message", ":", "dict", ")", "->", "None", ":", "if", "message", "[", "\"type\"", "]", "==", "\"websocket.accept\"", "and", "self", ".", "state", "==", "ASGIWebsocketState", ".", "HANDSHAKE", ":", "headers", "...
Called by the ASGI instance to send a message.
[ "Called", "by", "the", "ASGI", "instance", "to", "send", "a", "message", "." ]
python
test
50.636364
KelSolaar/Umbra
umbra/engine.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/engine.py#L1727-L1750
def stop_processing(self, warning=True): """ Registers the end of a processing operation. :param warning: Emit warning message. :type warning: int :return: Method success. :rtype: bool """ if not self.__is_processing: warning and LOGGER.warni...
[ "def", "stop_processing", "(", "self", ",", "warning", "=", "True", ")", ":", "if", "not", "self", ".", "__is_processing", ":", "warning", "and", "LOGGER", ".", "warning", "(", "\"!> {0} | Engine is not processing, 'stop_processing' request has been ignored!\"", ".", ...
Registers the end of a processing operation. :param warning: Emit warning message. :type warning: int :return: Method success. :rtype: bool
[ "Registers", "the", "end", "of", "a", "processing", "operation", "." ]
python
train
38.25
Rapptz/discord.py
discord/ext/commands/help.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L336-L343
def clean_prefix(self): """The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``.""" user = self.context.guild.me if self.context.guild else self.context.bot.user # this breaks if the prefix mention is not the bot itself but I # consider this to be an *incredibly...
[ "def", "clean_prefix", "(", "self", ")", ":", "user", "=", "self", ".", "context", ".", "guild", ".", "me", "if", "self", ".", "context", ".", "guild", "else", "self", ".", "context", ".", "bot", ".", "user", "# this breaks if the prefix mention is not the b...
The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``.
[ "The", "cleaned", "up", "invoke", "prefix", ".", "i", ".", "e", ".", "mentions", "are" ]
python
train
65
mozilla/amo-validator
validator/opensearch.py
https://github.com/mozilla/amo-validator/blob/0251bfbd7d93106e01ecdb6de5fcd1dc1a180664/validator/opensearch.py#L9-L218
def detect_opensearch(err, package, listed=False): 'Detect, parse, and validate an OpenSearch provider' # Parse the file. try: # Check if it is a file object. if hasattr(package, 'read'): srch_prov = parse(package) else: # It's not a file object; open it (the...
[ "def", "detect_opensearch", "(", "err", ",", "package", ",", "listed", "=", "False", ")", ":", "# Parse the file.", "try", ":", "# Check if it is a file object.", "if", "hasattr", "(", "package", ",", "'read'", ")", ":", "srch_prov", "=", "parse", "(", "packag...
Detect, parse, and validate an OpenSearch provider
[ "Detect", "parse", "and", "validate", "an", "OpenSearch", "provider" ]
python
train
46.438095
snipsco/snipsmanagercore
snipsmanagercore/sound_service.py
https://github.com/snipsco/snipsmanagercore/blob/93eaaa665887f790a30ba86af5ffee394bfd8ede/snipsmanagercore/sound_service.py#L23-L41
def play(state): """ Play sound for a given state. :param state: a State value. """ filename = None if state == SoundService.State.welcome: filename = "pad_glow_welcome1.wav" elif state == SoundService.State.goodbye: filename = "pad_glow_power_off...
[ "def", "play", "(", "state", ")", ":", "filename", "=", "None", "if", "state", "==", "SoundService", ".", "State", ".", "welcome", ":", "filename", "=", "\"pad_glow_welcome1.wav\"", "elif", "state", "==", "SoundService", ".", "State", ".", "goodbye", ":", ...
Play sound for a given state. :param state: a State value.
[ "Play", "sound", "for", "a", "given", "state", "." ]
python
train
38.157895
pudo-attic/scrapekit
scrapekit/tasks.py
https://github.com/pudo-attic/scrapekit/blob/cfd258120922fcd571430cdf00ba50f3cf18dc15/scrapekit/tasks.py#L57-L67
def put(self, task, args, kwargs): """ Add a new item to the queue. An item is a task and the arguments needed to call it. Do not call this directly, use Task.queue/Task.run instead. """ if self.num_threads == 0: return task(*args, **kwargs) if self.queue is ...
[ "def", "put", "(", "self", ",", "task", ",", "args", ",", "kwargs", ")", ":", "if", "self", ".", "num_threads", "==", "0", ":", "return", "task", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "queue", "is", "None", ":", "se...
Add a new item to the queue. An item is a task and the arguments needed to call it. Do not call this directly, use Task.queue/Task.run instead.
[ "Add", "a", "new", "item", "to", "the", "queue", ".", "An", "item", "is", "a", "task", "and", "the", "arguments", "needed", "to", "call", "it", "." ]
python
train
35.090909
emichael/PyREM
pyrem/host.py
https://github.com/emichael/PyREM/blob/2609249ead197cd9496d164f4998ca9985503579/pyrem/host.py#L68-L90
def send_file(self, file_name, remote_destination=None, **kwargs): """Send a file to a remote host with rsync. Args: file_name (str): The relative location of the file on the local host. remote_destination (str): The destination for the file on the remote ...
[ "def", "send_file", "(", "self", ",", "file_name", ",", "remote_destination", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "remote_destination", ":", "remote_destination", "=", "file_name", "return", "SubprocessTask", "(", "self", ".", "_rsync_...
Send a file to a remote host with rsync. Args: file_name (str): The relative location of the file on the local host. remote_destination (str): The destination for the file on the remote host. If `None`, will be assumed to be the same as *...
[ "Send", "a", "file", "to", "a", "remote", "host", "with", "rsync", "." ]
python
train
35.086957
CalebBell/thermo
thermo/joback.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/joback.py#L733-L769
def Hvap(counts): r'''Estimates the enthalpy of vaporization of an organic compound at its normal boiling point using the Joback method as a function of chemical structure only. .. math:: \Delta H_{vap} = 15.30 + \sum_i H_{vap,i} In the abov...
[ "def", "Hvap", "(", "counts", ")", ":", "tot", "=", "0.0", "for", "group", ",", "count", "in", "counts", ".", "items", "(", ")", ":", "tot", "+=", "joback_groups_id_dict", "[", "group", "]", ".", "Hvap", "*", "count", "Hvap", "=", "15.3", "+", "tot...
r'''Estimates the enthalpy of vaporization of an organic compound at its normal boiling point using the Joback method as a function of chemical structure only. .. math:: \Delta H_{vap} = 15.30 + \sum_i H_{vap,i} In the above equation, enthalpy of fu...
[ "r", "Estimates", "the", "enthalpy", "of", "vaporization", "of", "an", "organic", "compound", "at", "its", "normal", "boiling", "point", "using", "the", "Joback", "method", "as", "a", "function", "of", "chemical", "structure", "only", ".", "..", "math", "::"...
python
valid
32.405405
saltstack/salt
salt/modules/x509.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L647-L672
def read_crl(crl): ''' Returns a dict containing details of a certificate revocation list. Input can be a PEM string or file path. :depends: - OpenSSL command line tool csl: A path or PEM encoded string containing the CSL to read. CLI Example: .. code-block:: bash salt...
[ "def", "read_crl", "(", "crl", ")", ":", "text", "=", "_text_or_file", "(", "crl", ")", "text", "=", "get_pem_entry", "(", "text", ",", "pem_type", "=", "'X509 CRL'", ")", "crltempfile", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "crltempfile", ...
Returns a dict containing details of a certificate revocation list. Input can be a PEM string or file path. :depends: - OpenSSL command line tool csl: A path or PEM encoded string containing the CSL to read. CLI Example: .. code-block:: bash salt '*' x509.read_crl /etc/pki/myc...
[ "Returns", "a", "dict", "containing", "details", "of", "a", "certificate", "revocation", "list", ".", "Input", "can", "be", "a", "PEM", "string", "or", "file", "path", "." ]
python
train
25.115385
GNS3/gns3-server
gns3server/run.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/run.py#L82-L131
def parse_arguments(argv): """ Parse command line arguments and override local configuration :params args: Array of command line arguments """ parser = argparse.ArgumentParser(description="GNS3 server version {}".format(__version__)) parser.add_argument("-v", "--version", help="show the versio...
[ "def", "parse_arguments", "(", "argv", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"GNS3 server version {}\"", ".", "format", "(", "__version__", ")", ")", "parser", ".", "add_argument", "(", "\"-v\"", ",", "\"--version...
Parse command line arguments and override local configuration :params args: Array of command line arguments
[ "Parse", "command", "line", "arguments", "and", "override", "local", "configuration" ]
python
train
54.28
metric-learn/metric-learn
metric_learn/base_metric.py
https://github.com/metric-learn/metric-learn/blob/d945df1342c69012608bb70b92520392a0853de6/metric_learn/base_metric.py#L549-L566
def _validate_calibration_params(strategy='accuracy', min_rate=None, beta=1.): """Ensure that calibration parameters have allowed values""" if strategy not in ('accuracy', 'f_beta', 'max_tpr', 'max_tnr'): raise ValueError('Strategy can either be "...
[ "def", "_validate_calibration_params", "(", "strategy", "=", "'accuracy'", ",", "min_rate", "=", "None", ",", "beta", "=", "1.", ")", ":", "if", "strategy", "not", "in", "(", "'accuracy'", ",", "'f_beta'", ",", "'max_tpr'", ",", "'max_tnr'", ")", ":", "rai...
Ensure that calibration parameters have allowed values
[ "Ensure", "that", "calibration", "parameters", "have", "allowed", "values" ]
python
train
55.555556
chaoss/grimoirelab-sortinghat
sortinghat/cmd/unify.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/unify.py#L90-L99
def run(self, *args): """Merge unique identities using a matching algorithm.""" params = self.parser.parse_args(args) code = self.unify(params.matching, params.sources, params.fast_matching, params.no_strict, params.interactive, params.recove...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "code", "=", "self", ".", "unify", "(", "params", ".", "matching", ",", "params", ".", "sources", ",", "params", ".", ...
Merge unique identities using a matching algorithm.
[ "Merge", "unique", "identities", "using", "a", "matching", "algorithm", "." ]
python
train
33.5
log2timeline/dfvfs
dfvfs/vfs/apfs_file_entry.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/apfs_file_entry.py#L166-L169
def access_time(self): """dfdatetime.DateTimeValues: access time or None if not available.""" timestamp = self._fsapfs_file_entry.get_access_time_as_integer() return dfdatetime_apfs_time.APFSTime(timestamp=timestamp)
[ "def", "access_time", "(", "self", ")", ":", "timestamp", "=", "self", ".", "_fsapfs_file_entry", ".", "get_access_time_as_integer", "(", ")", "return", "dfdatetime_apfs_time", ".", "APFSTime", "(", "timestamp", "=", "timestamp", ")" ]
dfdatetime.DateTimeValues: access time or None if not available.
[ "dfdatetime", ".", "DateTimeValues", ":", "access", "time", "or", "None", "if", "not", "available", "." ]
python
train
56.25
Qiskit/qiskit-terra
qiskit/qasm/qasmparser.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmparser.py#L975-L984
def p_expression_0(self, program): """ expression : expression '*' expression | expression '/' expression | expression '+' expression | expression '-' expression | expression '^' expression """ program[0] = n...
[ "def", "p_expression_0", "(", "self", ",", "program", ")", ":", "program", "[", "0", "]", "=", "node", ".", "BinaryOp", "(", "[", "node", ".", "BinaryOperator", "(", "program", "[", "2", "]", ")", ",", "program", "[", "1", "]", ",", "program", "[",...
expression : expression '*' expression | expression '/' expression | expression '+' expression | expression '-' expression | expression '^' expression
[ "expression", ":", "expression", "*", "expression", "|", "expression", "/", "expression", "|", "expression", "+", "expression", "|", "expression", "-", "expression", "|", "expression", "^", "expression" ]
python
test
41.8
facelessuser/soupsieve
soupsieve/css_parser.py
https://github.com/facelessuser/soupsieve/blob/24859cc3e756ebf46b75547d49c6b4a7bf35ee82/soupsieve/css_parser.py#L348-L361
def match(self, selector, index): """Match the selector.""" pseudo = None m = self.re_pseudo_name.match(selector, index) if m: name = util.lower(css_unescape(m.group('name'))) pattern = self.patterns.get(name) if pattern: pseudo = patt...
[ "def", "match", "(", "self", ",", "selector", ",", "index", ")", ":", "pseudo", "=", "None", "m", "=", "self", ".", "re_pseudo_name", ".", "match", "(", "selector", ",", "index", ")", "if", "m", ":", "name", "=", "util", ".", "lower", "(", "css_une...
Match the selector.
[ "Match", "the", "selector", "." ]
python
train
30.785714
refenv/cijoe
modules/cij/runner.py
https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L251-L264
def trun_emph(trun): """Print essential info on""" if trun["conf"]["VERBOSE"] > 1: # Print environment variables cij.emph("rnr:CONF {") for cvar in sorted(trun["conf"].keys()): cij.emph(" % 16s: %r" % (cvar, trun["conf"][cvar])) cij.emph("}") if trun["con...
[ "def", "trun_emph", "(", "trun", ")", ":", "if", "trun", "[", "\"conf\"", "]", "[", "\"VERBOSE\"", "]", ">", "1", ":", "# Print environment variables", "cij", ".", "emph", "(", "\"rnr:CONF {\"", ")", "for", "cvar", "in", "sorted", "(", "trun", "[", "\"co...
Print essential info on
[ "Print", "essential", "info", "on" ]
python
valid
36.071429
stephan-mclean/KickassTorrentsAPI
kat.py
https://github.com/stephan-mclean/KickassTorrentsAPI/blob/4d867a090c06ce95b9ed996b48092cb5bfe28bbd/kat.py#L161-L183
def search(self, term=None, category=None, pages=1, url=search_url, sort=None, order=None): """Search a given URL for torrent results.""" if not self.current_url: self.current_url = url if self.current_url == Search.base_url: # Searching home page so no formatting results = self._get_results(self.c...
[ "def", "search", "(", "self", ",", "term", "=", "None", ",", "category", "=", "None", ",", "pages", "=", "1", ",", "url", "=", "search_url", ",", "sort", "=", "None", ",", "order", "=", "None", ")", ":", "if", "not", "self", ".", "current_url", "...
Search a given URL for torrent results.
[ "Search", "a", "given", "URL", "for", "torrent", "results", "." ]
python
train
29.478261
robotools/fontParts
Lib/fontParts/base/glyph.py
https://github.com/robotools/fontParts/blob/d2ff106fe95f9d566161d936a645157626568712/Lib/fontParts/base/glyph.py#L428-L439
def _set_rightMargin(self, value): """ value will be an int or float. Subclasses may override this method. """ bounds = self.bounds if bounds is None: self.width = value else: xMin, yMin, xMax, yMax = bounds self.width = xMax +...
[ "def", "_set_rightMargin", "(", "self", ",", "value", ")", ":", "bounds", "=", "self", ".", "bounds", "if", "bounds", "is", "None", ":", "self", ".", "width", "=", "value", "else", ":", "xMin", ",", "yMin", ",", "xMax", ",", "yMax", "=", "bounds", ...
value will be an int or float. Subclasses may override this method.
[ "value", "will", "be", "an", "int", "or", "float", "." ]
python
train
26.25
beregond/jsonmodels
jsonmodels/validators.py
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L157-L173
def validate(self, value): """Validate value.""" len_ = len(value) if self.minimum_value is not None and len_ < self.minimum_value: tpl = "Value '{val}' length is lower than allowed minimum '{min}'." raise ValidationError(tpl.format( val=value, min=self.m...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "len_", "=", "len", "(", "value", ")", "if", "self", ".", "minimum_value", "is", "not", "None", "and", "len_", "<", "self", ".", "minimum_value", ":", "tpl", "=", "\"Value '{val}' length is lower than...
Validate value.
[ "Validate", "value", "." ]
python
train
37.647059
NLeSC/scriptcwl
scriptcwl/workflow.py
https://github.com/NLeSC/scriptcwl/blob/33bb847a875379da3a5702c7a98dfa585306b960/scriptcwl/workflow.py#L425-L473
def to_script(self, wf_name='wf'): """Generated and print the scriptcwl script for the currunt workflow. Args: wf_name (str): string used for the WorkflowGenerator object in the generated script (default: ``wf``). """ self._closed() script = [] ...
[ "def", "to_script", "(", "self", ",", "wf_name", "=", "'wf'", ")", ":", "self", ".", "_closed", "(", ")", "script", "=", "[", "]", "# Workflow documentation", "# if self.documentation:", "# if is_multiline(self.documentation):", "# print('doc = \"\"\"')", "# ...
Generated and print the scriptcwl script for the currunt workflow. Args: wf_name (str): string used for the WorkflowGenerator object in the generated script (default: ``wf``).
[ "Generated", "and", "print", "the", "scriptcwl", "script", "for", "the", "currunt", "workflow", "." ]
python
train
36.346939
Karaage-Cluster/python-tldap
tldap/database/__init__.py
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/database/__init__.py#L392-L404
def _db_to_python(db_data: dict, table: LdapObjectClass, dn: str) -> LdapObject: """ Convert a DbDate object to a LdapObject. """ fields = table.get_fields() python_data = table({ name: field.to_python(db_data[name]) for name, field in fields.items() if field.db_field }) pyt...
[ "def", "_db_to_python", "(", "db_data", ":", "dict", ",", "table", ":", "LdapObjectClass", ",", "dn", ":", "str", ")", "->", "LdapObject", ":", "fields", "=", "table", ".", "get_fields", "(", ")", "python_data", "=", "table", "(", "{", "name", ":", "fi...
Convert a DbDate object to a LdapObject.
[ "Convert", "a", "DbDate", "object", "to", "a", "LdapObject", "." ]
python
train
29.692308
numenta/nupic
src/nupic/regions/knn_anomaly_classifier_region.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/regions/knn_anomaly_classifier_region.py#L355-L405
def _classifyState(self, state): """ Reclassifies given state. """ # Record is before wait period do not classifiy if state.ROWID < self.getParameter('trainRecords'): if not state.setByUser: state.anomalyLabel = [] self._deleteRecordsFromKNN([state]) return label = K...
[ "def", "_classifyState", "(", "self", ",", "state", ")", ":", "# Record is before wait period do not classifiy", "if", "state", ".", "ROWID", "<", "self", ".", "getParameter", "(", "'trainRecords'", ")", ":", "if", "not", "state", ".", "setByUser", ":", "state",...
Reclassifies given state.
[ "Reclassifies", "given", "state", "." ]
python
valid
31.803922
novopl/peltak
src/peltak/core/git.py
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/git.py#L528-L539
def protected_branches(): # type: () -> list[str] """ Return branches protected by deletion. By default those are master and devel branches as configured in pelconf. Returns: list[str]: Names of important branches that should not be deleted. """ master = conf.get('git.master_branch', '...
[ "def", "protected_branches", "(", ")", ":", "# type: () -> list[str]", "master", "=", "conf", ".", "get", "(", "'git.master_branch'", ",", "'master'", ")", "develop", "=", "conf", ".", "get", "(", "'git.devel_branch'", ",", "'develop'", ")", "return", "conf", ...
Return branches protected by deletion. By default those are master and devel branches as configured in pelconf. Returns: list[str]: Names of important branches that should not be deleted.
[ "Return", "branches", "protected", "by", "deletion", "." ]
python
train
36.333333
geertj/gruvi
lib/gruvi/address.py
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/address.py#L19-L34
def saddr(address): """Return a string representation for an address. The *address* paramater can be a pipe name, an IP address tuple, or a socket address. The return value is always a ``str`` instance. """ if isinstance(address, six.string_types): return address elif isinstance(ad...
[ "def", "saddr", "(", "address", ")", ":", "if", "isinstance", "(", "address", ",", "six", ".", "string_types", ")", ":", "return", "address", "elif", "isinstance", "(", "address", ",", "tuple", ")", "and", "len", "(", "address", ")", ">=", "2", "and", ...
Return a string representation for an address. The *address* paramater can be a pipe name, an IP address tuple, or a socket address. The return value is always a ``str`` instance.
[ "Return", "a", "string", "representation", "for", "an", "address", "." ]
python
train
37.75
saltstack/salt
salt/utils/gitfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L2327-L2347
def clear_lock(self, remote=None, lock_type='update'): ''' Clear update.lk for all remotes ''' cleared = [] errors = [] for repo in self.remotes: if remote: # Specific remote URL/pattern was passed, ensure that the URL # matches...
[ "def", "clear_lock", "(", "self", ",", "remote", "=", "None", ",", "lock_type", "=", "'update'", ")", ":", "cleared", "=", "[", "]", "errors", "=", "[", "]", "for", "repo", "in", "self", ".", "remotes", ":", "if", "remote", ":", "# Specific remote URL/...
Clear update.lk for all remotes
[ "Clear", "update", ".", "lk", "for", "all", "remotes" ]
python
train
38.333333
andycasey/sick
sick/models/base.py
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/base.py#L376-L398
def _initial_proposal_distribution(self, parameters, theta, size, default_std=1e-4): """ Generate an initial proposal distribution around the point theta. """ missing_parameters = set(parameters).difference(theta) if missing_parameters: raise ValueError("cann...
[ "def", "_initial_proposal_distribution", "(", "self", ",", "parameters", ",", "theta", ",", "size", ",", "default_std", "=", "1e-4", ")", ":", "missing_parameters", "=", "set", "(", "parameters", ")", ".", "difference", "(", "theta", ")", "if", "missing_parame...
Generate an initial proposal distribution around the point theta.
[ "Generate", "an", "initial", "proposal", "distribution", "around", "the", "point", "theta", "." ]
python
train
39.26087
SmokinCaterpillar/pypet
pypet/storageservice.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2150-L2172
def _trj_check_version(self, version, python, force): """Checks for version mismatch Raises a VersionMismatchError if version of loaded trajectory and current pypet version do not match. In case of `force=True` error is not raised only a warning is emitted. """ curr_python = py...
[ "def", "_trj_check_version", "(", "self", ",", "version", ",", "python", ",", "force", ")", ":", "curr_python", "=", "pypetconstants", ".", "python_version_string", "if", "(", "version", "!=", "VERSION", "or", "curr_python", "!=", "python", ")", "and", "not", ...
Checks for version mismatch Raises a VersionMismatchError if version of loaded trajectory and current pypet version do not match. In case of `force=True` error is not raised only a warning is emitted.
[ "Checks", "for", "version", "mismatch" ]
python
test
61.608696
asweigart/pyautogui
pyautogui/_window_win.py
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_window_win.py#L84-L97
def getWindows(): #https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/ """Return dict: {'window title' : window handle} for all visible windows""" titles = {} def foreach_window(hwnd, lparam): if IsWindowVisible(hwnd): length = GetWindowTextLength(hwnd)...
[ "def", "getWindows", "(", ")", ":", "#https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/", "titles", "=", "{", "}", "def", "foreach_window", "(", "hwnd", ",", "lparam", ")", ":", "if", "IsWindowVisible", "(", "hwnd", ")", ":", "length",...
Return dict: {'window title' : window handle} for all visible windows
[ "Return", "dict", ":", "{", "window", "title", ":", "window", "handle", "}", "for", "all", "visible", "windows" ]
python
train
39
pycontribs/jira
jira/client.py
https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L2305-L2317
def get_project_version_by_name(self, project, version_name): """Get a version Resource by its name present on a project. :param project: ID or key of the project to get versions from :type project: str :param version_name: name of the version to search for :type version_name: s...
[ "def", "get_project_version_by_name", "(", "self", ",", "project", ",", "version_name", ")", ":", "versions", "=", "self", ".", "project_versions", "(", "project", ")", "for", "version", "in", "versions", ":", "if", "version", ".", "name", "==", "version_name"...
Get a version Resource by its name present on a project. :param project: ID or key of the project to get versions from :type project: str :param version_name: name of the version to search for :type version_name: str :rtype: Optional[Version]
[ "Get", "a", "version", "Resource", "by", "its", "name", "present", "on", "a", "project", "." ]
python
train
39.615385
openstack/networking-cisco
networking_cisco/apps/saf/server/cisco_dfa_rest.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/cisco_dfa_rest.py#L286-L323
def update_partition_static_route(self, org_name, part_name, static_ip_list, vrf_prof=None, service_node_ip=None): """Send static route update requests to DCNM. :param org_name: name of organization :param part_name: na...
[ "def", "update_partition_static_route", "(", "self", ",", "org_name", ",", "part_name", ",", "static_ip_list", ",", "vrf_prof", "=", "None", ",", "service_node_ip", "=", "None", ")", ":", "if", "part_name", "is", "None", ":", "part_name", "=", "self", ".", "...
Send static route update requests to DCNM. :param org_name: name of organization :param part_name: name of partition :static_ip_list: List of static IP addresses :vrf_prof: VRF Profile :service_node_ip: Service Node IP address
[ "Send", "static", "route", "update", "requests", "to", "DCNM", "." ]
python
train
39.921053
sashs/filebytes
filebytes/ctypes_helper.py
https://github.com/sashs/filebytes/blob/41ee009832aba19603f33d1fd3483b84d6684ebf/filebytes/ctypes_helper.py#L48-L53
def to_ubyte_array(barray): """Returns a c_ubyte_array filled with the given data of a bytearray or bytes""" bs = (ctypes.c_ubyte * len(barray))() pack_into('%ds' % len(barray), bs, 0, barray) return bs
[ "def", "to_ubyte_array", "(", "barray", ")", ":", "bs", "=", "(", "ctypes", ".", "c_ubyte", "*", "len", "(", "barray", ")", ")", "(", ")", "pack_into", "(", "'%ds'", "%", "len", "(", "barray", ")", ",", "bs", ",", "0", ",", "barray", ")", "return...
Returns a c_ubyte_array filled with the given data of a bytearray or bytes
[ "Returns", "a", "c_ubyte_array", "filled", "with", "the", "given", "data", "of", "a", "bytearray", "or", "bytes" ]
python
train
35.666667
yyuu/botornado
boto/sns/connection.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sns/connection.py#L331-L362
def confirm_subscription(self, topic, token, authenticate_on_unsubscribe=False): """ Get properties of a Topic :type topic: string :param topic: The ARN of the new topic. :type token: string :param token: Short-lived token sent to and endpoi...
[ "def", "confirm_subscription", "(", "self", ",", "topic", ",", "token", ",", "authenticate_on_unsubscribe", "=", "False", ")", ":", "params", "=", "{", "'ContentType'", ":", "'JSON'", ",", "'TopicArn'", ":", "topic", ",", "'Token'", ":", "token", "}", "if", ...
Get properties of a Topic :type topic: string :param topic: The ARN of the new topic. :type token: string :param token: Short-lived token sent to and endpoint during the Subscribe operation. :type authenticate_on_unsubscribe: bool :param authentic...
[ "Get", "properties", "of", "a", "Topic" ]
python
train
40.25
tdryer/hangups
hangups/client.py
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/client.py#L594-L599
async def modify_otr_status(self, modify_otr_status_request): """Enable or disable message history in a conversation.""" response = hangouts_pb2.ModifyOTRStatusResponse() await self._pb_request('conversations/modifyotrstatus', modify_otr_status_request, response) ...
[ "async", "def", "modify_otr_status", "(", "self", ",", "modify_otr_status_request", ")", ":", "response", "=", "hangouts_pb2", ".", "ModifyOTRStatusResponse", "(", ")", "await", "self", ".", "_pb_request", "(", "'conversations/modifyotrstatus'", ",", "modify_otr_status_...
Enable or disable message history in a conversation.
[ "Enable", "or", "disable", "message", "history", "in", "a", "conversation", "." ]
python
valid
56.166667
HazyResearch/fonduer
src/fonduer/utils/data_model_utils/tabular.py
https://github.com/HazyResearch/fonduer/blob/4520f86a716f03dcca458a9f4bddac75b4e7068f/src/fonduer/utils/data_model_utils/tabular.py#L59-L68
def same_col(c): """Return True if all Mentions in the given candidate are from the same Col. :param c: The candidate whose Mentions are being compared :rtype: boolean """ return same_table(c) and all( is_col_aligned(_to_span(c[i]).sentence, _to_span(c[0]).sentence) for i in range(l...
[ "def", "same_col", "(", "c", ")", ":", "return", "same_table", "(", "c", ")", "and", "all", "(", "is_col_aligned", "(", "_to_span", "(", "c", "[", "i", "]", ")", ".", "sentence", ",", "_to_span", "(", "c", "[", "0", "]", ")", ".", "sentence", ")"...
Return True if all Mentions in the given candidate are from the same Col. :param c: The candidate whose Mentions are being compared :rtype: boolean
[ "Return", "True", "if", "all", "Mentions", "in", "the", "given", "candidate", "are", "from", "the", "same", "Col", "." ]
python
train
32.3
calston/tensor
tensor/protocol/riemann.py
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/riemann.py#L55-L58
def sendEvents(self, events): """Send a Tensor Event to Riemann""" self.pressure += 1 self.sendString(self.encodeMessage(events))
[ "def", "sendEvents", "(", "self", ",", "events", ")", ":", "self", ".", "pressure", "+=", "1", "self", ".", "sendString", "(", "self", ".", "encodeMessage", "(", "events", ")", ")" ]
Send a Tensor Event to Riemann
[ "Send", "a", "Tensor", "Event", "to", "Riemann" ]
python
test
37.5
rocky/python-xdis
xdis/std.py
https://github.com/rocky/python-xdis/blob/46a2902ae8f5d8eee495eed67ac0690fd545453d/xdis/std.py#L143-L151
def distb(self, tb=None, file=None): """Disassemble a traceback (default: last traceback).""" if tb is None: try: tb = sys.last_traceback except AttributeError: raise RuntimeError("no last traceback to disassemble") while tb.tb_next: tb...
[ "def", "distb", "(", "self", ",", "tb", "=", "None", ",", "file", "=", "None", ")", ":", "if", "tb", "is", "None", ":", "try", ":", "tb", "=", "sys", ".", "last_traceback", "except", "AttributeError", ":", "raise", "RuntimeError", "(", "\"no last trace...
Disassemble a traceback (default: last traceback).
[ "Disassemble", "a", "traceback", "(", "default", ":", "last", "traceback", ")", "." ]
python
train
43.777778
fumitoh/modelx
modelx/core/cells.py
https://github.com/fumitoh/modelx/blob/0180da34d052c44fb94dab9e115e218bbebfc9c3/modelx/core/cells.py#L323-L328
def _baseattrs(self): """A dict of members expressed in literals""" result = super()._baseattrs result["params"] = ", ".join(self.parameters) return result
[ "def", "_baseattrs", "(", "self", ")", ":", "result", "=", "super", "(", ")", ".", "_baseattrs", "result", "[", "\"params\"", "]", "=", "\", \"", ".", "join", "(", "self", ".", "parameters", ")", "return", "result" ]
A dict of members expressed in literals
[ "A", "dict", "of", "members", "expressed", "in", "literals" ]
python
valid
30.5
dylanaraps/pywal
pywal/image.py
https://github.com/dylanaraps/pywal/blob/c823e3c9dbd0100ca09caf824e77d296685a1c1e/pywal/image.py#L41-L59
def get_next_image(img_dir): """Get the next image in a dir.""" images, current_wall = get_image_dir(img_dir) images.sort(key=lambda img: [int(x) if x.isdigit() else x for x in re.split('([0-9]+)', img)]) try: next_index = images.index(current_wall) + 1 exc...
[ "def", "get_next_image", "(", "img_dir", ")", ":", "images", ",", "current_wall", "=", "get_image_dir", "(", "img_dir", ")", "images", ".", "sort", "(", "key", "=", "lambda", "img", ":", "[", "int", "(", "x", ")", "if", "x", ".", "isdigit", "(", ")",...
Get the next image in a dir.
[ "Get", "the", "next", "image", "in", "a", "dir", "." ]
python
train
25.052632
splitkeycoffee/pyhottop
pyhottop/pyhottop.py
https://github.com/splitkeycoffee/pyhottop/blob/2986bbb2d848f7e41fa3ece5ebb1b33c8882219c/pyhottop/pyhottop.py#L86-L90
def now_date(str=False): """Get the current date.""" if str: return datetime.datetime.now().strftime("%Y-%m-%d") return datetime.date.today()
[ "def", "now_date", "(", "str", "=", "False", ")", ":", "if", "str", ":", "return", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "return", "datetime", ".", "date", ".", "today", "(", ")" ]
Get the current date.
[ "Get", "the", "current", "date", "." ]
python
train
31.4
moonso/loqusdb
loqusdb/utils/migrate.py
https://github.com/moonso/loqusdb/blob/792dcd0d461aff5adc703c49eebf58964913a513/loqusdb/utils/migrate.py#L7-L47
def migrate_database(adapter): """Migrate an old loqusdb instance to 1.0 Args: adapter Returns: nr_updated(int): Number of variants that where updated """ all_variants = adapter.get_variants() nr_variants = all_variants.count() nr_updated = 0 with progressb...
[ "def", "migrate_database", "(", "adapter", ")", ":", "all_variants", "=", "adapter", ".", "get_variants", "(", ")", "nr_variants", "=", "all_variants", ".", "count", "(", ")", "nr_updated", "=", "0", "with", "progressbar", "(", "all_variants", ",", "label", ...
Migrate an old loqusdb instance to 1.0 Args: adapter Returns: nr_updated(int): Number of variants that where updated
[ "Migrate", "an", "old", "loqusdb", "instance", "to", "1", ".", "0", "Args", ":", "adapter", "Returns", ":", "nr_updated", "(", "int", ")", ":", "Number", "of", "variants", "that", "where", "updated" ]
python
train
28.97561
hatemile/hatemile-for-python
hatemile/implementation/css.py
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L543-L566
def _create_content_element(self, content, data_property_value): """ Create a element to show the content. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identi...
[ "def", "_create_content_element", "(", "self", ",", "content", ",", "data_property_value", ")", ":", "content_element", "=", "self", ".", "html_parser", ".", "create_element", "(", "'span'", ")", "content_element", ".", "set_attribute", "(", "AccessibleCSSImplementati...
Create a element to show the content. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identify the fix. :type data_property_value: str :return: The element to sh...
[ "Create", "a", "element", "to", "show", "the", "content", "." ]
python
train
36.833333
QuantEcon/QuantEcon.py
quantecon/lss.py
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lss.py#L284-L336
def stationary_distributions(self, max_iter=200, tol=1e-5): r""" Compute the moments of the stationary distributions of :math:`x_t` and :math:`y_t` if possible. Computation is by iteration, starting from the initial conditions self.mu_0 and self.Sigma_0 Parameters -----...
[ "def", "stationary_distributions", "(", "self", ",", "max_iter", "=", "200", ",", "tol", "=", "1e-5", ")", ":", "# == Initialize iteration == #", "m", "=", "self", ".", "moment_sequence", "(", ")", "mu_x", ",", "mu_y", ",", "Sigma_x", ",", "Sigma_y", "=", ...
r""" Compute the moments of the stationary distributions of :math:`x_t` and :math:`y_t` if possible. Computation is by iteration, starting from the initial conditions self.mu_0 and self.Sigma_0 Parameters ---------- max_iter : scalar(int), optional(default=200) ...
[ "r", "Compute", "the", "moments", "of", "the", "stationary", "distributions", "of", ":", "math", ":", "x_t", "and", ":", "math", ":", "y_t", "if", "possible", ".", "Computation", "is", "by", "iteration", "starting", "from", "the", "initial", "conditions", ...
python
train
37.150943
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L153-L158
def is_fw_present(self, fw_id): """Returns if firewall index by ID is present in dictionary. """ if self.fw_id is None or self.fw_id != fw_id: return False else: return True
[ "def", "is_fw_present", "(", "self", ",", "fw_id", ")", ":", "if", "self", ".", "fw_id", "is", "None", "or", "self", ".", "fw_id", "!=", "fw_id", ":", "return", "False", "else", ":", "return", "True" ]
Returns if firewall index by ID is present in dictionary.
[ "Returns", "if", "firewall", "index", "by", "ID", "is", "present", "in", "dictionary", "." ]
python
train
36
gagneurlab/concise
concise/utils/position.py
https://github.com/gagneurlab/concise/blob/d15262eb1e590008bc96ba31e93bfbdbfa1a9fd4/concise/utils/position.py#L131-L139
def _validate_pos(df): """Validates the returned positional object """ assert isinstance(df, pd.DataFrame) assert ["seqname", "position", "strand"] == df.columns.tolist() assert df.position.dtype == np.dtype("int64") assert df.strand.dtype == np.dtype("O") assert df.seqname.dtype == np.dtype...
[ "def", "_validate_pos", "(", "df", ")", ":", "assert", "isinstance", "(", "df", ",", "pd", ".", "DataFrame", ")", "assert", "[", "\"seqname\"", ",", "\"position\"", ",", "\"strand\"", "]", "==", "df", ".", "columns", ".", "tolist", "(", ")", "assert", ...
Validates the returned positional object
[ "Validates", "the", "returned", "positional", "object" ]
python
train
36.777778
BD2KGenomics/toil-scripts
src/toil_scripts/bwa_alignment/bwa_alignment.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/bwa_alignment.py#L215-L292
def main(): """ Computational Genomics Lab, Genomics Institute, UC Santa Cruz Toil BWA pipeline Alignment of fastq reads via BWA-kit General usage: 1. Type "toil-bwa generate" to create an editable manifest and config in the current working directory. 2. Parameterize the pipeline by editin...
[ "def", "main", "(", ")", ":", "# Define Parser object and add to Toil", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ",", "formatter_class", "=", "argparse", ".", "RawTextHelpFormatter", ")", "subparsers", "=", ...
Computational Genomics Lab, Genomics Institute, UC Santa Cruz Toil BWA pipeline Alignment of fastq reads via BWA-kit General usage: 1. Type "toil-bwa generate" to create an editable manifest and config in the current working directory. 2. Parameterize the pipeline by editing the config. 3. Fil...
[ "Computational", "Genomics", "Lab", "Genomics", "Institute", "UC", "Santa", "Cruz", "Toil", "BWA", "pipeline" ]
python
train
52.333333
ultrabug/uhashring
uhashring/ring.py
https://github.com/ultrabug/uhashring/blob/2297471a392e28ed913b3276c2f48d0c01523375/uhashring/ring.py#L44-L94
def _configure_nodes(self, nodes): """Parse and set up the given nodes. :param nodes: nodes used to create the continuum (see doc for format). """ if isinstance(nodes, str): nodes = [nodes] elif not isinstance(nodes, (dict, list)): raise ValueError( ...
[ "def", "_configure_nodes", "(", "self", ",", "nodes", ")", ":", "if", "isinstance", "(", "nodes", ",", "str", ")", ":", "nodes", "=", "[", "nodes", "]", "elif", "not", "isinstance", "(", "nodes", ",", "(", "dict", ",", "list", ")", ")", ":", "raise...
Parse and set up the given nodes. :param nodes: nodes used to create the continuum (see doc for format).
[ "Parse", "and", "set", "up", "the", "given", "nodes", "." ]
python
train
40.098039
pytorch/text
torchtext/data/batch.py
https://github.com/pytorch/text/blob/26bfce6869dc704f1d86792f9a681d453d7e7bb8/torchtext/data/batch.py#L37-L45
def fromvars(cls, dataset, batch_size, train=None, **kwargs): """Create a Batch directly from a number of Variables.""" batch = cls() batch.batch_size = batch_size batch.dataset = dataset batch.fields = dataset.fields.keys() for k, v in kwargs.items(): setattr...
[ "def", "fromvars", "(", "cls", ",", "dataset", ",", "batch_size", ",", "train", "=", "None", ",", "*", "*", "kwargs", ")", ":", "batch", "=", "cls", "(", ")", "batch", ".", "batch_size", "=", "batch_size", "batch", ".", "dataset", "=", "dataset", "ba...
Create a Batch directly from a number of Variables.
[ "Create", "a", "Batch", "directly", "from", "a", "number", "of", "Variables", "." ]
python
train
38.444444
jantman/pypi-download-stats
pypi_download_stats/projectstats.py
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/projectstats.py#L330-L354
def per_distro_data(self): """ Return download data by distro name and version. :return: dict of cache data; keys are datetime objects, values are dict of distro name/version (str) to count (int). :rtype: dict """ ret = {} for cache_date in self.cache_d...
[ "def", "per_distro_data", "(", "self", ")", ":", "ret", "=", "{", "}", "for", "cache_date", "in", "self", ".", "cache_dates", ":", "data", "=", "self", ".", "_cache_get", "(", "cache_date", ")", "ret", "[", "cache_date", "]", "=", "{", "}", "for", "d...
Return download data by distro name and version. :return: dict of cache data; keys are datetime objects, values are dict of distro name/version (str) to count (int). :rtype: dict
[ "Return", "download", "data", "by", "distro", "name", "and", "version", "." ]
python
train
44.92
refinery29/chassis
chassis/services/dependency_injection/resolver.py
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L177-L193
def _init_nodes(self, config): """ Gathers dependency sets onto _nodes """ if not isinstance(config, dict): raise TypeError('"config" must be a dictionary') for (name, conf) in six.iteritems(config): args = [] if 'args' not in conf else conf['args'] kwargs = ...
[ "def", "_init_nodes", "(", "self", ",", "config", ")", ":", "if", "not", "isinstance", "(", "config", ",", "dict", ")", ":", "raise", "TypeError", "(", "'\"config\" must be a dictionary'", ")", "for", "(", "name", ",", "conf", ")", "in", "six", ".", "ite...
Gathers dependency sets onto _nodes
[ "Gathers", "dependency", "sets", "onto", "_nodes" ]
python
train
38.058824
mfcloud/python-zvm-sdk
zvmsdk/api.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L84-L93
def guest_start(self, userid): """Power on a virtual machine. :param str userid: the id of the virtual machine to be power on :returns: None """ action = "start guest '%s'" % userid with zvmutils.log_and_reraise_sdkbase_error(action): self._vmops.guest_start...
[ "def", "guest_start", "(", "self", ",", "userid", ")", ":", "action", "=", "\"start guest '%s'\"", "%", "userid", "with", "zvmutils", ".", "log_and_reraise_sdkbase_error", "(", "action", ")", ":", "self", ".", "_vmops", ".", "guest_start", "(", "userid", ")" ]
Power on a virtual machine. :param str userid: the id of the virtual machine to be power on :returns: None
[ "Power", "on", "a", "virtual", "machine", "." ]
python
train
31.9
aloetesting/aloe_webdriver
aloe_webdriver/__init__.py
https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L508-L518
def submit_form_id(self, id_): """ Submit the form with given id (used to disambiguate between multiple forms). """ form = ElementSelector( world.browser, str('id("{id}")'.format(id=id_)), ) assert form, "Cannot find a form with ID '{}' on the page.".format(id_) form.subm...
[ "def", "submit_form_id", "(", "self", ",", "id_", ")", ":", "form", "=", "ElementSelector", "(", "world", ".", "browser", ",", "str", "(", "'id(\"{id}\")'", ".", "format", "(", "id", "=", "id_", ")", ")", ",", ")", "assert", "form", ",", "\"Cannot find...
Submit the form with given id (used to disambiguate between multiple forms).
[ "Submit", "the", "form", "with", "given", "id", "(", "used", "to", "disambiguate", "between", "multiple", "forms", ")", "." ]
python
train
28.545455
penguinmenac3/opendatalake
opendatalake/detection/utils.py
https://github.com/penguinmenac3/opendatalake/blob/77c888377095e1812a16982c8efbd2f6b1697a33/opendatalake/detection/utils.py#L771-L784
def move_detections(label, dy, dx): """ Move detections in direction dx, dy. :param label: The label dict containing all detection lists. :param dy: The delta in y direction as a number. :param dx: The delta in x direction as a number. :return: """ for k in label.keys(): if k.st...
[ "def", "move_detections", "(", "label", ",", "dy", ",", "dx", ")", ":", "for", "k", "in", "label", ".", "keys", "(", ")", ":", "if", "k", ".", "startswith", "(", "\"detection\"", ")", ":", "detections", "=", "label", "[", "k", "]", "for", "detectio...
Move detections in direction dx, dy. :param label: The label dict containing all detection lists. :param dy: The delta in y direction as a number. :param dx: The delta in x direction as a number. :return:
[ "Move", "detections", "in", "direction", "dx", "dy", "." ]
python
test
32.214286
inasafe/inasafe
safe/impact_function/impact_function.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L909-L928
def console_progress_callback(current, maximum, message=None): """Simple console based callback implementation for tests. :param current: Current progress. :type current: int :param maximum: Maximum range (point at which task is complete. :type maximum: int :param mess...
[ "def", "console_progress_callback", "(", "current", ",", "maximum", ",", "message", "=", "None", ")", ":", "# noinspection PyChainedComparisons", "if", "maximum", ">", "1000", "and", "current", "%", "1000", "!=", "0", "and", "current", "!=", "maximum", ":", "r...
Simple console based callback implementation for tests. :param current: Current progress. :type current: int :param maximum: Maximum range (point at which task is complete. :type maximum: int :param message: Optional message dictionary to containing content we can ...
[ "Simple", "console", "based", "callback", "implementation", "for", "tests", "." ]
python
train
40.3
chaoss/grimoirelab-perceval
perceval/backends/core/launchpad.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/launchpad.py#L238-L246
def __fetch_issue_messages(self, issue_id): """Get messages of an issue""" for messages_raw in self.client.issue_collection(issue_id, "messages"): messages = json.loads(messages_raw) for msg in messages['entries']: msg['owner_data'] = self.__fetch_user_data('{OW...
[ "def", "__fetch_issue_messages", "(", "self", ",", "issue_id", ")", ":", "for", "messages_raw", "in", "self", ".", "client", ".", "issue_collection", "(", "issue_id", ",", "\"messages\"", ")", ":", "messages", "=", "json", ".", "loads", "(", "messages_raw", ...
Get messages of an issue
[ "Get", "messages", "of", "an", "issue" ]
python
test
40.333333
oceanprotocol/squid-py
squid_py/ocean/ocean_templates.py
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_templates.py#L42-L73
def approve(self, template_address, account): """ Approve a template already proposed. The account needs to be owner of the templateManager contract to be able of approve the template. :param template_address: Address of the template contract, str :param account: account approvi...
[ "def", "approve", "(", "self", ",", "template_address", ",", "account", ")", ":", "try", ":", "approved", "=", "self", ".", "_keeper", ".", "template_manager", ".", "approve_template", "(", "template_address", ",", "account", ")", "return", "approved", "except...
Approve a template already proposed. The account needs to be owner of the templateManager contract to be able of approve the template. :param template_address: Address of the template contract, str :param account: account approving the template, Account :return: bool
[ "Approve", "a", "template", "already", "proposed", ".", "The", "account", "needs", "to", "be", "owner", "of", "the", "templateManager", "contract", "to", "be", "able", "of", "approve", "the", "template", "." ]
python
train
39.375
twilio/twilio-python
twilio/rest/preview/sync/service/sync_map/sync_map_item.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/preview/sync/service/sync_map/sync_map_item.py#L391-L406
def _proxy(self): """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: SyncMapItemContext for this SyncMapItemInstance :rtype: twilio.rest.preview.sync.service.sync_map...
[ "def", "_proxy", "(", "self", ")", ":", "if", "self", ".", "_context", "is", "None", ":", "self", ".", "_context", "=", "SyncMapItemContext", "(", "self", ".", "_version", ",", "service_sid", "=", "self", ".", "_solution", "[", "'service_sid'", "]", ",",...
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: SyncMapItemContext for this SyncMapItemInstance :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext
[ "Generate", "an", "instance", "context", "for", "the", "instance", "the", "context", "is", "capable", "of", "performing", "various", "actions", ".", "All", "instance", "actions", "are", "proxied", "to", "the", "context" ]
python
train
41.1875
ejeschke/ginga
ginga/ImageView.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L2450-L2486
def get_pan(self, coord='data'): """Get pan positions. Parameters ---------- coord : {'data', 'wcs'} Indicates whether the pan positions are returned in data or WCS space. Returns ------- positions : tuple X and Y positions, i...
[ "def", "get_pan", "(", "self", ",", "coord", "=", "'data'", ")", ":", "pan_x", ",", "pan_y", "=", "self", ".", "t_", "[", "'pan'", "]", "[", ":", "2", "]", "if", "coord", "==", "'wcs'", ":", "if", "self", ".", "t_", "[", "'pan_coord'", "]", "==...
Get pan positions. Parameters ---------- coord : {'data', 'wcs'} Indicates whether the pan positions are returned in data or WCS space. Returns ------- positions : tuple X and Y positions, in that order.
[ "Get", "pan", "positions", "." ]
python
train
29.297297
python-openxml/python-docx
docx/oxml/section.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L139-L145
def get_footerReference(self, type_): """Return footerReference element of *type_* or None if not present.""" path = "./w:footerReference[@w:type='%s']" % WD_HEADER_FOOTER.to_xml(type_) footerReferences = self.xpath(path) if not footerReferences: return None return fo...
[ "def", "get_footerReference", "(", "self", ",", "type_", ")", ":", "path", "=", "\"./w:footerReference[@w:type='%s']\"", "%", "WD_HEADER_FOOTER", ".", "to_xml", "(", "type_", ")", "footerReferences", "=", "self", ".", "xpath", "(", "path", ")", "if", "not", "f...
Return footerReference element of *type_* or None if not present.
[ "Return", "footerReference", "element", "of", "*", "type_", "*", "or", "None", "if", "not", "present", "." ]
python
train
47.285714
napalm-automation/napalm
napalm/base/netmiko_helpers.py
https://github.com/napalm-automation/napalm/blob/c11ae8bb5ce395698704a0051cdf8d144fbb150d/napalm/base/netmiko_helpers.py#L17-L49
def netmiko_args(optional_args): """Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call. """ fields = py23_compat.argspec(BaseConnection.__init__) args = fields[0] ...
[ "def", "netmiko_args", "(", "optional_args", ")", ":", "fields", "=", "py23_compat", ".", "argspec", "(", "BaseConnection", ".", "__init__", ")", "args", "=", "fields", "[", "0", "]", "defaults", "=", "fields", "[", "3", "]", "check_self", "=", "args", "...
Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call.
[ "Check", "for", "Netmiko", "arguments", "that", "were", "passed", "in", "as", "NAPALM", "optional", "arguments", "." ]
python
train
34.818182
publysher/rdflib-django
src/rdflib_django/store.py
https://github.com/publysher/rdflib-django/blob/e26992af75f96ef27a6ceaf820574e3bca645953/src/rdflib_django/store.py#L178-L200
def triples(self, (s, p, o), context=None): """ Returns all triples in the current store. """ named_graph = _get_named_graph(context) query_sets = _get_query_sets_for_object(o) filter_parameters = dict() if named_graph is not None: filter_parameters['...
[ "def", "triples", "(", "self", ",", "(", "s", ",", "p", ",", "o", ")", ",", "context", "=", "None", ")", ":", "named_graph", "=", "_get_named_graph", "(", "context", ")", "query_sets", "=", "_get_query_sets_for_object", "(", "o", ")", "filter_parameters", ...
Returns all triples in the current store.
[ "Returns", "all", "triples", "in", "the", "current", "store", "." ]
python
train
32.826087
Stewori/pytypes
pytypes/util.py
https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/util.py#L128-L152
def getargnames(argspecs, with_unbox=False): """Resembles list of arg-names as would be seen in a function signature, including var-args, var-keywords and keyword-only args. """ # todo: We can maybe make use of inspect.formatargspec args = argspecs.args vargs = argspecs.varargs try: ...
[ "def", "getargnames", "(", "argspecs", ",", "with_unbox", "=", "False", ")", ":", "# todo: We can maybe make use of inspect.formatargspec", "args", "=", "argspecs", ".", "args", "vargs", "=", "argspecs", ".", "varargs", "try", ":", "kw", "=", "argspecs", ".", "k...
Resembles list of arg-names as would be seen in a function signature, including var-args, var-keywords and keyword-only args.
[ "Resembles", "list", "of", "arg", "-", "names", "as", "would", "be", "seen", "in", "a", "function", "signature", "including", "var", "-", "args", "var", "-", "keywords", "and", "keyword", "-", "only", "args", "." ]
python
train
30.16
basho/riak-python-client
riak/transports/transport.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/transports/transport.py#L70-L75
def get(self, robj, r=None, pr=None, timeout=None, basic_quorum=None, notfound_ok=None, head_only=False): """ Fetches an object. """ raise NotImplementedError
[ "def", "get", "(", "self", ",", "robj", ",", "r", "=", "None", ",", "pr", "=", "None", ",", "timeout", "=", "None", ",", "basic_quorum", "=", "None", ",", "notfound_ok", "=", "None", ",", "head_only", "=", "False", ")", ":", "raise", "NotImplementedE...
Fetches an object.
[ "Fetches", "an", "object", "." ]
python
train
32.833333
eventbrite/rebar
src/rebar/validators.py
https://github.com/eventbrite/rebar/blob/32f8914a2c5529519009d21c85f0d47cc6601901/src/rebar/validators.py#L95-L118
def _validate(self, data): """Helper to run validators on the field data.""" errors = {} # if the validator is not enabled, return the empty error dict if not self._enabled: return errors for field in self.validators: field_errors = [] for...
[ "def", "_validate", "(", "self", ",", "data", ")", ":", "errors", "=", "{", "}", "# if the validator is not enabled, return the empty error dict", "if", "not", "self", ".", "_enabled", ":", "return", "errors", "for", "field", "in", "self", ".", "validators", ":"...
Helper to run validators on the field data.
[ "Helper", "to", "run", "validators", "on", "the", "field", "data", "." ]
python
train
28.583333
mongodb/mongo-python-driver
pymongo/collection.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/collection.py#L1625-L1702
def count_documents(self, filter, session=None, **kwargs): """Count the number of documents in this collection. The :meth:`count_documents` method is supported in a transaction. All optional parameters should be passed as keyword arguments to this method. Valid options include: ...
[ "def", "count_documents", "(", "self", ",", "filter", ",", "session", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pipeline", "=", "[", "{", "'$match'", ":", "filter", "}", "]", "if", "'skip'", "in", "kwargs", ":", "pipeline", ".", "append", "(",...
Count the number of documents in this collection. The :meth:`count_documents` method is supported in a transaction. All optional parameters should be passed as keyword arguments to this method. Valid options include: - `skip` (int): The number of matching documents to skip before ...
[ "Count", "the", "number", "of", "documents", "in", "this", "collection", "." ]
python
train
48.589744
oasiswork/zimsoap
zimsoap/client.py
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1570-L1575
def delete_mountpoints(self, paths=None, folder_ids=None): """ :param folder_ids: list of ids :param path: list of folder's paths """ self.delete_folders(paths=paths, folder_ids=folder_ids, f_type='link')
[ "def", "delete_mountpoints", "(", "self", ",", "paths", "=", "None", ",", "folder_ids", "=", "None", ")", ":", "self", ".", "delete_folders", "(", "paths", "=", "paths", ",", "folder_ids", "=", "folder_ids", ",", "f_type", "=", "'link'", ")" ]
:param folder_ids: list of ids :param path: list of folder's paths
[ ":", "param", "folder_ids", ":", "list", "of", "ids", ":", "param", "path", ":", "list", "of", "folder", "s", "paths" ]
python
train
39.833333
vertexproject/synapse
synapse/lib/link.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/link.py#L26-L37
async def listen(host, port, onlink, ssl=None): ''' Listen on the given host/port and fire onlink(Link). Returns a server object that contains the listening sockets ''' async def onconn(reader, writer): link = await Link.anit(reader, writer) link.schedCoro(onlink(link)) server ...
[ "async", "def", "listen", "(", "host", ",", "port", ",", "onlink", ",", "ssl", "=", "None", ")", ":", "async", "def", "onconn", "(", "reader", ",", "writer", ")", ":", "link", "=", "await", "Link", ".", "anit", "(", "reader", ",", "writer", ")", ...
Listen on the given host/port and fire onlink(Link). Returns a server object that contains the listening sockets
[ "Listen", "on", "the", "given", "host", "/", "port", "and", "fire", "onlink", "(", "Link", ")", "." ]
python
train
32.833333
Kentzo/Power
power/linux.py
https://github.com/Kentzo/Power/blob/2c99b156546225e448f7030681af3df5cd345e4b/power/linux.py#L88-L110
def get_providing_power_source_type(self): """ Looks through all power supplies in POWER_SUPPLY_PATH. If there is an AC adapter online returns POWER_TYPE_AC. If there is a discharging battery, returns POWER_TYPE_BATTERY. Since the order of supplies is arbitrary, whatever found fi...
[ "def", "get_providing_power_source_type", "(", "self", ")", ":", "for", "supply", "in", "os", ".", "listdir", "(", "POWER_SUPPLY_PATH", ")", ":", "supply_path", "=", "os", ".", "path", ".", "join", "(", "POWER_SUPPLY_PATH", ",", "supply", ")", "try", ":", ...
Looks through all power supplies in POWER_SUPPLY_PATH. If there is an AC adapter online returns POWER_TYPE_AC. If there is a discharging battery, returns POWER_TYPE_BATTERY. Since the order of supplies is arbitrary, whatever found first is returned.
[ "Looks", "through", "all", "power", "supplies", "in", "POWER_SUPPLY_PATH", ".", "If", "there", "is", "an", "AC", "adapter", "online", "returns", "POWER_TYPE_AC", ".", "If", "there", "is", "a", "discharging", "battery", "returns", "POWER_TYPE_BATTERY", ".", "Sinc...
python
train
51.391304
dhermes/bezier
src/bezier/_surface_intersection.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_intersection.py#L632-L667
def classify_coincident(st_vals, coincident): r"""Determine if coincident parameters are "unused". .. note:: This is a helper for :func:`surface_intersections`. In the case that ``coincident`` is :data:`True`, then we'll have two sets of parameters :math:`(s_1, t_1)` and :math:`(s_2, t_2)`. ...
[ "def", "classify_coincident", "(", "st_vals", ",", "coincident", ")", ":", "if", "not", "coincident", ":", "return", "None", "if", "st_vals", "[", "0", ",", "0", "]", ">=", "st_vals", "[", "0", ",", "1", "]", "or", "st_vals", "[", "1", ",", "0", "]...
r"""Determine if coincident parameters are "unused". .. note:: This is a helper for :func:`surface_intersections`. In the case that ``coincident`` is :data:`True`, then we'll have two sets of parameters :math:`(s_1, t_1)` and :math:`(s_2, t_2)`. If one of :math:`s1 < s2` or :math:`t1 < t2` is...
[ "r", "Determine", "if", "coincident", "parameters", "are", "unused", "." ]
python
train
31.333333
PmagPy/PmagPy
programs/agm_magic2.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/agm_magic2.py#L10-L250
def main(): """ NAME agm_magic.py DESCRIPTION converts Micromag agm files to magic format SYNTAX agm_magic.py [-h] [command line options] OPTIONS -usr USER: identify user, default is "" - put in quotation marks! -bak: this is a IRM backfield curve ...
[ "def", "main", "(", ")", ":", "citation", "=", "'This study'", "MeasRecs", "=", "[", "]", "units", "=", "'cgs'", "meth", "=", "\"LP-HYS\"", "version_num", "=", "pmag", ".", "get_version", "(", ")", "args", "=", "sys", ".", "argv", "fmt", "=", "'old'", ...
NAME agm_magic.py DESCRIPTION converts Micromag agm files to magic format SYNTAX agm_magic.py [-h] [command line options] OPTIONS -usr USER: identify user, default is "" - put in quotation marks! -bak: this is a IRM backfield curve -f FILE, specify input...
[ "NAME", "agm_magic", ".", "py" ]
python
train
38.518672
edx/edx-enterprise
enterprise/messages.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/messages.py#L47-L74
def add_missing_price_information_message(request, item): """ Add a message to the Django messages store indicating that we failed to retrieve price information about an item. :param request: The current request. :param item: The item for which price information is missing. Example: a program title, or...
[ "def", "add_missing_price_information_message", "(", "request", ",", "item", ")", ":", "messages", ".", "warning", "(", "request", ",", "_", "(", "'{strong_start}We could not gather price information for {em_start}{item}{em_end}.{strong_end} '", "'{span_start}If you continue to hav...
Add a message to the Django messages store indicating that we failed to retrieve price information about an item. :param request: The current request. :param item: The item for which price information is missing. Example: a program title, or a course.
[ "Add", "a", "message", "to", "the", "Django", "messages", "store", "indicating", "that", "we", "failed", "to", "retrieve", "price", "information", "about", "an", "item", "." ]
python
valid
42.75
miguelgrinberg/Flask-SocketIO
example/app.py
https://github.com/miguelgrinberg/Flask-SocketIO/blob/4bef800d5e7ba7d98a6f4cd94191ff0b4496c334/example/app.py#L19-L27
def background_thread(): """Example of how to send server generated events to clients.""" count = 0 while True: socketio.sleep(10) count += 1 socketio.emit('my_response', {'data': 'Server generated event', 'count': count}, namespace='/test'...
[ "def", "background_thread", "(", ")", ":", "count", "=", "0", "while", "True", ":", "socketio", ".", "sleep", "(", "10", ")", "count", "+=", "1", "socketio", ".", "emit", "(", "'my_response'", ",", "{", "'data'", ":", "'Server generated event'", ",", "'c...
Example of how to send server generated events to clients.
[ "Example", "of", "how", "to", "send", "server", "generated", "events", "to", "clients", "." ]
python
train
34.777778
mozilla/configman
demo/advanced_demo3.py
https://github.com/mozilla/configman/blob/83159fed61cc4cbbe5a4a6a00d3acad8a0c39c96/demo/advanced_demo3.py#L354-L363
def responsive_sleep(self, seconds, wait_reason=''): """Sleep for the specified number of seconds, logging every 'wait_log_interval' seconds with progress info.""" for x in range(int(seconds)): if (self.config.wait_log_interval and not x % self.config.wait_log_interva...
[ "def", "responsive_sleep", "(", "self", ",", "seconds", ",", "wait_reason", "=", "''", ")", ":", "for", "x", "in", "range", "(", "int", "(", "seconds", ")", ")", ":", "if", "(", "self", ".", "config", ".", "wait_log_interval", "and", "not", "x", "%",...
Sleep for the specified number of seconds, logging every 'wait_log_interval' seconds with progress info.
[ "Sleep", "for", "the", "specified", "number", "of", "seconds", "logging", "every", "wait_log_interval", "seconds", "with", "progress", "info", "." ]
python
train
50.6
saltstack/salt
salt/modules/mssql.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mssql.py#L303-L359
def login_create(login, new_login_password=None, new_login_domain='', new_login_roles=None, new_login_options=None, **kwargs): ''' Creates a new login. Does not update password of existing logins. For Windows authentication, provide ``new_login_domain``. For SQL Server authentication, prvide ``new_lo...
[ "def", "login_create", "(", "login", ",", "new_login_password", "=", "None", ",", "new_login_domain", "=", "''", ",", "new_login_roles", "=", "None", ",", "new_login_options", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# One and only one of password and doma...
Creates a new login. Does not update password of existing logins. For Windows authentication, provide ``new_login_domain``. For SQL Server authentication, prvide ``new_login_password``. Since hashed passwords are *varbinary* values, if the ``new_login_password`` is 'int / long', it will be considere...
[ "Creates", "a", "new", "login", ".", "Does", "not", "update", "password", "of", "existing", "logins", ".", "For", "Windows", "authentication", "provide", "new_login_domain", ".", "For", "SQL", "Server", "authentication", "prvide", "new_login_password", ".", "Since...
python
train
36.105263
aws/aws-dynamodb-encryption-python
src/dynamodb_encryption_sdk/internal/utils.py
https://github.com/aws/aws-dynamodb-encryption-python/blob/8de3bbe13df39c59b21bf431010f7acfcf629a2f/src/dynamodb_encryption_sdk/internal/utils.py#L347-L365
def _item_keys_match(crypto_config, item1, item2): # type: (CryptoConfig, Dict, Dict) -> Bool """Determines whether the values in the primary and sort keys (if they exist) are the same :param CryptoConfig crypto_config: CryptoConfig used in encrypting the given items :param dict item1: The first item t...
[ "def", "_item_keys_match", "(", "crypto_config", ",", "item1", ",", "item2", ")", ":", "# type: (CryptoConfig, Dict, Dict) -> Bool", "partition_key_name", "=", "crypto_config", ".", "encryption_context", ".", "partition_key_name", "sort_key_name", "=", "crypto_config", ".",...
Determines whether the values in the primary and sort keys (if they exist) are the same :param CryptoConfig crypto_config: CryptoConfig used in encrypting the given items :param dict item1: The first item to compare :param dict item2: The second item to compare :return: Bool response, True if the key a...
[ "Determines", "whether", "the", "values", "in", "the", "primary", "and", "sort", "keys", "(", "if", "they", "exist", ")", "are", "the", "same" ]
python
train
43.315789
peterbe/gg
gg/builtins/start/gg_start.py
https://github.com/peterbe/gg/blob/2aace5bdb4a9b1cb65bea717784edf54c63b7bad/gg/builtins/start/gg_start.py#L68-L136
def get_summary(config, bugnumber): """return a summary for this bug/issue. If it can't be found, return None.""" bugzilla_url_regex = re.compile( re.escape("https://bugzilla.mozilla.org/show_bug.cgi?id=") + r"(\d+)$" ) # The user could have pasted in a bugzilla ID or a bugzilla URL if...
[ "def", "get_summary", "(", "config", ",", "bugnumber", ")", ":", "bugzilla_url_regex", "=", "re", ".", "compile", "(", "re", ".", "escape", "(", "\"https://bugzilla.mozilla.org/show_bug.cgi?id=\"", ")", "+", "r\"(\\d+)$\"", ")", "# The user could have pasted in a bugzil...
return a summary for this bug/issue. If it can't be found, return None.
[ "return", "a", "summary", "for", "this", "bug", "/", "issue", ".", "If", "it", "can", "t", "be", "found", "return", "None", "." ]
python
train
40.014493
neo4j/neo4j-python-driver
neo4j/types/spatial.py
https://github.com/neo4j/neo4j-python-driver/blob/0c641e826765e86ff5454dae57c99521db8ca45c/neo4j/types/spatial.py#L122-L135
def dehydrate_point(value): """ Dehydrator for Point data. :param value: :type value: Point :return: """ dim = len(value) if dim == 2: return Structure(b"X", value.srid, *value) elif dim == 3: return Structure(b"Y", value.srid, *value) else: raise ValueError(...
[ "def", "dehydrate_point", "(", "value", ")", ":", "dim", "=", "len", "(", "value", ")", "if", "dim", "==", "2", ":", "return", "Structure", "(", "b\"X\"", ",", "value", ".", "srid", ",", "*", "value", ")", "elif", "dim", "==", "3", ":", "return", ...
Dehydrator for Point data. :param value: :type value: Point :return:
[ "Dehydrator", "for", "Point", "data", "." ]
python
train
25.5
zxylvlp/PingPHP
pingphp/grammar.py
https://github.com/zxylvlp/PingPHP/blob/2e9a5f1ef4b5b13310e3f8ff350fa91032357bc5/pingphp/grammar.py#L1329-L1338
def p_InDecrement(p): ''' InDecrement : INDECREMENT Expression | Expression INDECREMENT ''' from .helper import isString if isString(p[1]): p[0] = InDecrement(p[1], p[2], False) else: p[0] = InDecrement(p[2], p[1], True)
[ "def", "p_InDecrement", "(", "p", ")", ":", "from", ".", "helper", "import", "isString", "if", "isString", "(", "p", "[", "1", "]", ")", ":", "p", "[", "0", "]", "=", "InDecrement", "(", "p", "[", "1", "]", ",", "p", "[", "2", "]", ",", "Fals...
InDecrement : INDECREMENT Expression | Expression INDECREMENT
[ "InDecrement", ":", "INDECREMENT", "Expression", "|", "Expression", "INDECREMENT" ]
python
train
26.7
pyinvoke/invocations
invocations/docs.py
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/docs.py#L27-L32
def _browse(c): """ Open build target's index.html in a browser (using 'open'). """ index = join(c.sphinx.target, c.sphinx.target_file) c.run("open {0}".format(index))
[ "def", "_browse", "(", "c", ")", ":", "index", "=", "join", "(", "c", ".", "sphinx", ".", "target", ",", "c", ".", "sphinx", ".", "target_file", ")", "c", ".", "run", "(", "\"open {0}\"", ".", "format", "(", "index", ")", ")" ]
Open build target's index.html in a browser (using 'open').
[ "Open", "build", "target", "s", "index", ".", "html", "in", "a", "browser", "(", "using", "open", ")", "." ]
python
train
30.333333
fracpete/python-weka-wrapper3
python/weka/classifiers.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/classifiers.py#L1221-L1237
def summary(self, title=None, complexity=False): """ Generates a summary. :param title: optional title :type title: str :param complexity: whether to print the complexity information as well :type complexity: bool :return: the summary :rtype: str ...
[ "def", "summary", "(", "self", ",", "title", "=", "None", ",", "complexity", "=", "False", ")", ":", "if", "title", "is", "None", ":", "return", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"toSummaryString\"", ",", "\"()Ljava/lang/String...
Generates a summary. :param title: optional title :type title: str :param complexity: whether to print the complexity information as well :type complexity: bool :return: the summary :rtype: str
[ "Generates", "a", "summary", "." ]
python
train
35.470588
RedHatInsights/insights-core
insights/parsers/ethtool.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/parsers/ethtool.py#L48-L72
def extract_iface_name_from_path(path, name): """ Extract the 'real' interface name from the path name. Basically this puts the '@' back in the name in place of the underscore, where the name contains a '.' or contains 'macvtap' or 'macvlan'. Examples: +------------------+-----------------+ ...
[ "def", "extract_iface_name_from_path", "(", "path", ",", "name", ")", ":", "if", "name", "in", "path", ":", "ifname", "=", "os", ".", "path", ".", "basename", "(", "path", ")", ".", "split", "(", "\"_\"", ",", "2", ")", "[", "-", "1", "]", ".", "...
Extract the 'real' interface name from the path name. Basically this puts the '@' back in the name in place of the underscore, where the name contains a '.' or contains 'macvtap' or 'macvlan'. Examples: +------------------+-----------------+ | real name | path name | +===========...
[ "Extract", "the", "real", "interface", "name", "from", "the", "path", "name", ".", "Basically", "this", "puts", "the", "@", "back", "in", "the", "name", "in", "place", "of", "the", "underscore", "where", "the", "name", "contains", "a", ".", "or", "contai...
python
train
38.36
pytroll/posttroll
posttroll/subscriber.py
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/subscriber.py#L306-L343
def start(self): """Start the subscriber. """ def _get_addr_loop(service, timeout): """Try to get the address of *service* until for *timeout* seconds. """ then = datetime.now() + timedelta(seconds=timeout) while datetime.now() < then: ...
[ "def", "start", "(", "self", ")", ":", "def", "_get_addr_loop", "(", "service", ",", "timeout", ")", ":", "\"\"\"Try to get the address of *service* until for *timeout* seconds.\n \"\"\"", "then", "=", "datetime", ".", "now", "(", ")", "+", "timedelta", "("...
Start the subscriber.
[ "Start", "the", "subscriber", "." ]
python
train
40.921053
cqparts/cqparts
src/cqparts_fasteners/solidtypes/threads/base.py
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/threads/base.py#L298-L304
def profile(self): """ Buffered result of :meth:`build_profile` """ if self._profile is None: self._profile = self.build_profile() return self._profile
[ "def", "profile", "(", "self", ")", ":", "if", "self", ".", "_profile", "is", "None", ":", "self", ".", "_profile", "=", "self", ".", "build_profile", "(", ")", "return", "self", ".", "_profile" ]
Buffered result of :meth:`build_profile`
[ "Buffered", "result", "of", ":", "meth", ":", "build_profile" ]
python
train
28.142857