repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
pydanny/watdarepo
watdarepo/main.py
https://github.com/pydanny/watdarepo/blob/e252a7ed7e6d9888b127c8865d28230f41847897/watdarepo/main.py#L90-L124
def watdarepo(repo_url, mode='d', guess=False, repo_aliases=REPO_ALIASES, hosting_services=HOSTING_SERVICES): """ Gets vcs and hosting service for repo_urls :param repo_url: Repo URL of unknown type. :param mode: Return dictionary (default) or object :param guess: Whether or not to make guesses ...
[ "def", "watdarepo", "(", "repo_url", ",", "mode", "=", "'d'", ",", "guess", "=", "False", ",", "repo_aliases", "=", "REPO_ALIASES", ",", "hosting_services", "=", "HOSTING_SERVICES", ")", ":", "repo_url", "=", "unicode", "(", "repo_url", ")", "# Set the repo_ur...
Gets vcs and hosting service for repo_urls :param repo_url: Repo URL of unknown type. :param mode: Return dictionary (default) or object :param guess: Whether or not to make guesses :returns: Hosting service or raises UnknownHostingService exception.
[ "Gets", "vcs", "and", "hosting", "service", "for", "repo_urls", ":", "param", "repo_url", ":", "Repo", "URL", "of", "unknown", "type", ".", ":", "param", "mode", ":", "Return", "dictionary", "(", "default", ")", "or", "object", ":", "param", "guess", ":"...
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py#L374-L387
def qos_map_cos_traffic_class_cos5(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") qos = ET.SubElement(config, "qos", xmlns="urn:brocade.com:mgmt:brocade-qos") map = ET.SubElement(qos, "map") cos_traffic_class = ET.SubElement(map, "cos-traffic-cl...
[ "def", "qos_map_cos_traffic_class_cos5", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "qos", "=", "ET", ".", "SubElement", "(", "config", ",", "\"qos\"", ",", "xmlns", "=", "\"urn:brocade.com:...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
bcbio/bcbio-nextgen
bcbio/utils.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/utils.py#L782-L789
def get_perl_exports(tmpdir=None): """Environmental exports to use conda installed perl. """ perl_path = os.path.dirname(perl_cmd()) out = "unset PERL5LIB && export PATH=%s:\"$PATH\"" % (perl_path) if tmpdir: out += " && export TMPDIR=%s" % (tmpdir) return out
[ "def", "get_perl_exports", "(", "tmpdir", "=", "None", ")", ":", "perl_path", "=", "os", ".", "path", ".", "dirname", "(", "perl_cmd", "(", ")", ")", "out", "=", "\"unset PERL5LIB && export PATH=%s:\\\"$PATH\\\"\"", "%", "(", "perl_path", ")", "if", "tmpdir", ...
Environmental exports to use conda installed perl.
[ "Environmental", "exports", "to", "use", "conda", "installed", "perl", "." ]
python
train
jut-io/jut-python-tools
jut/api/integrations.py
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/integrations.py#L11-L33
def get_webhook_url(deployment_name, space='default', data_source='webhook', token_manager=None, app_url=defaults.APP_URL, **fields): """ return the webhook URL for posting webhook data to """ import_ur...
[ "def", "get_webhook_url", "(", "deployment_name", ",", "space", "=", "'default'", ",", "data_source", "=", "'webhook'", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ",", "*", "*", "fields", ")", ":", "import_url", "=", ...
return the webhook URL for posting webhook data to
[ "return", "the", "webhook", "URL", "for", "posting", "webhook", "data", "to" ]
python
train
docker/docker-py
docker/models/volumes.py
https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/volumes.py#L14-L25
def remove(self, force=False): """ Remove this volume. Args: force (bool): Force removal of volumes that were already removed out of band by the volume driver plugin. Raises: :py:class:`docker.errors.APIError` If volume failed to r...
[ "def", "remove", "(", "self", ",", "force", "=", "False", ")", ":", "return", "self", ".", "client", ".", "api", ".", "remove_volume", "(", "self", ".", "id", ",", "force", "=", "force", ")" ]
Remove this volume. Args: force (bool): Force removal of volumes that were already removed out of band by the volume driver plugin. Raises: :py:class:`docker.errors.APIError` If volume failed to remove.
[ "Remove", "this", "volume", "." ]
python
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L232-L245
def disconnect(self): """Disconnect from the device that we are currently connected to.""" if not self.connected: raise HardwareError("Cannot disconnect when we are not connected") # Close the streaming and tracing interfaces when we disconnect self._reports = None ...
[ "def", "disconnect", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot disconnect when we are not connected\"", ")", "# Close the streaming and tracing interfaces when we disconnect", "self", ".", "_reports", "=", ...
Disconnect from the device that we are currently connected to.
[ "Disconnect", "from", "the", "device", "that", "we", "are", "currently", "connected", "to", "." ]
python
train
ibis-project/ibis
ibis/expr/api.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/api.py#L2449-L2479
def _array_slice(array, index): """Slice or index `array` at `index`. Parameters ---------- index : int or ibis.expr.types.IntegerValue or slice Returns ------- sliced_array : ibis.expr.types.ValueExpr If `index` is an ``int`` or :class:`~ibis.expr.types.IntegerValue` then ...
[ "def", "_array_slice", "(", "array", ",", "index", ")", ":", "if", "isinstance", "(", "index", ",", "slice", ")", ":", "start", "=", "index", ".", "start", "stop", "=", "index", ".", "stop", "if", "(", "start", "is", "not", "None", "and", "start", ...
Slice or index `array` at `index`. Parameters ---------- index : int or ibis.expr.types.IntegerValue or slice Returns ------- sliced_array : ibis.expr.types.ValueExpr If `index` is an ``int`` or :class:`~ibis.expr.types.IntegerValue` then the return type is the element type of ...
[ "Slice", "or", "index", "array", "at", "index", "." ]
python
train
uw-it-cte/uw-restclients-wheniwork
uw_wheniwork/__init__.py
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/__init__.py#L57-L70
def _post_resource(self, url, body): """ When I Work POST method. """ headers = {"Content-Type": "application/json", "Accept": "application/json"} if self.token: headers["W-Token"] = "%s" % self.token response = WhenIWork_DAO().postURL(url, ...
[ "def", "_post_resource", "(", "self", ",", "url", ",", "body", ")", ":", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/json\"", ",", "\"Accept\"", ":", "\"application/json\"", "}", "if", "self", ".", "token", ":", "headers", "[", "\"W-Token\"", ...
When I Work POST method.
[ "When", "I", "Work", "POST", "method", "." ]
python
valid
barrust/mediawiki
mediawiki/utilities.py
https://github.com/barrust/mediawiki/blob/292e0be6c752409062dceed325d74839caf16a9b/mediawiki/utilities.py#L78-L83
def str_or_unicode(text): """ handle python 3 unicode and python 2.7 byte strings """ encoding = sys.stdout.encoding if sys.version_info > (3, 0): return text.encode(encoding).decode(encoding) return text.encode(encoding)
[ "def", "str_or_unicode", "(", "text", ")", ":", "encoding", "=", "sys", ".", "stdout", ".", "encoding", "if", "sys", ".", "version_info", ">", "(", "3", ",", "0", ")", ":", "return", "text", ".", "encode", "(", "encoding", ")", ".", "decode", "(", ...
handle python 3 unicode and python 2.7 byte strings
[ "handle", "python", "3", "unicode", "and", "python", "2", ".", "7", "byte", "strings" ]
python
train
joke2k/faker
faker/providers/__init__.py
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/__init__.py#L96-L105
def random_int(self, min=0, max=9999, step=1): """ Returns a random integer between two values. :param min: lower bound value (inclusive; default=0) :param max: upper bound value (inclusive; default=9999) :param step: range step (default=1) :returns: random integer betwe...
[ "def", "random_int", "(", "self", ",", "min", "=", "0", ",", "max", "=", "9999", ",", "step", "=", "1", ")", ":", "return", "self", ".", "generator", ".", "random", ".", "randrange", "(", "min", ",", "max", "+", "1", ",", "step", ")" ]
Returns a random integer between two values. :param min: lower bound value (inclusive; default=0) :param max: upper bound value (inclusive; default=9999) :param step: range step (default=1) :returns: random integer between min and max
[ "Returns", "a", "random", "integer", "between", "two", "values", "." ]
python
train
wakatime/wakatime
wakatime/stats.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/stats.py#L136-L162
def guess_lexer_using_modeline(text): """Guess lexer for given text using Vim modeline. Returns a tuple of (lexer, accuracy). """ lexer, accuracy = None, None file_type = None try: file_type = get_filetype_from_buffer(text) except: # pragma: nocover log.traceback(logging....
[ "def", "guess_lexer_using_modeline", "(", "text", ")", ":", "lexer", ",", "accuracy", "=", "None", ",", "None", "file_type", "=", "None", "try", ":", "file_type", "=", "get_filetype_from_buffer", "(", "text", ")", "except", ":", "# pragma: nocover", "log", "."...
Guess lexer for given text using Vim modeline. Returns a tuple of (lexer, accuracy).
[ "Guess", "lexer", "for", "given", "text", "using", "Vim", "modeline", "." ]
python
train
justquick/django-native-tags
native_tags/nodes.py
https://github.com/justquick/django-native-tags/blob/d40b976ee1cb13faeb04f0dedf02933d4274abf2/native_tags/nodes.py#L55-L77
def get_signature(token, contextable=False, comparison=False): """ Gets the signature tuple for any native tag contextable searchs for ``as`` variable to update context comparison if true uses ``negate`` (p) to ``not`` the result (~p) returns (``tag_name``, ``args``, ``kwargs``) """ bits = s...
[ "def", "get_signature", "(", "token", ",", "contextable", "=", "False", ",", "comparison", "=", "False", ")", ":", "bits", "=", "split", "(", "token", ".", "contents", ")", "args", ",", "kwargs", "=", "(", ")", ",", "{", "}", "if", "comparison", "and...
Gets the signature tuple for any native tag contextable searchs for ``as`` variable to update context comparison if true uses ``negate`` (p) to ``not`` the result (~p) returns (``tag_name``, ``args``, ``kwargs``)
[ "Gets", "the", "signature", "tuple", "for", "any", "native", "tag", "contextable", "searchs", "for", "as", "variable", "to", "update", "context", "comparison", "if", "true", "uses", "negate", "(", "p", ")", "to", "not", "the", "result", "(", "~p", ")", "...
python
train
Kortemme-Lab/klab
klab/bio/pdb.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L1014-L1056
def get_DB_references(self): ''' "The DBREF record provides cross-reference links between PDB sequences (what appears in SEQRES record) and a corresponding database sequence." - http://www.wwpdb.org/documentation/format33/sect3.html#DBREF ''' _database_names = { 'GB'...
[ "def", "get_DB_references", "(", "self", ")", ":", "_database_names", "=", "{", "'GB'", ":", "'GenBank'", ",", "'PDB'", ":", "'Protein Data Bank'", ",", "'UNP'", ":", "'UNIPROT'", ",", "'NORINE'", ":", "'Norine'", ",", "'TREMBL'", ":", "'UNIPROT'", ",", "}",...
"The DBREF record provides cross-reference links between PDB sequences (what appears in SEQRES record) and a corresponding database sequence." - http://www.wwpdb.org/documentation/format33/sect3.html#DBREF
[ "The", "DBREF", "record", "provides", "cross", "-", "reference", "links", "between", "PDB", "sequences", "(", "what", "appears", "in", "SEQRES", "record", ")", "and", "a", "corresponding", "database", "sequence", ".", "-", "http", ":", "//", "www", ".", "w...
python
train
mosdef-hub/mbuild
mbuild/compound.py
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/compound.py#L775-L804
def _remove_references(self, removed_part): """Remove labels pointing to this part and vice versa. """ removed_part.parent = None # Remove labels in the hierarchy pointing to this part. referrers_to_remove = set() for referrer in removed_part.referrers: if removed_pa...
[ "def", "_remove_references", "(", "self", ",", "removed_part", ")", ":", "removed_part", ".", "parent", "=", "None", "# Remove labels in the hierarchy pointing to this part.", "referrers_to_remove", "=", "set", "(", ")", "for", "referrer", "in", "removed_part", ".", "...
Remove labels pointing to this part and vice versa.
[ "Remove", "labels", "pointing", "to", "this", "part", "and", "vice", "versa", "." ]
python
train
abourget/gevent-socketio
socketio/namespace.py
https://github.com/abourget/gevent-socketio/blob/1cdb1594a315326987a17ce0924ea448a82fab01/socketio/namespace.py#L365-L378
def error(self, error_name, error_message, msg_id=None, quiet=False): """Use this to use the configured ``error_handler`` yield an error message to your application. :param error_name: is a short string, to associate messages to recovery methods :param error_m...
[ "def", "error", "(", "self", ",", "error_name", ",", "error_message", ",", "msg_id", "=", "None", ",", "quiet", "=", "False", ")", ":", "self", ".", "socket", ".", "error", "(", "error_name", ",", "error_message", ",", "endpoint", "=", "self", ".", "ns...
Use this to use the configured ``error_handler`` yield an error message to your application. :param error_name: is a short string, to associate messages to recovery methods :param error_message: is some human-readable text, describing the error :param msg_id: ...
[ "Use", "this", "to", "use", "the", "configured", "error_handler", "yield", "an", "error", "message", "to", "your", "application", "." ]
python
valid
contentful/contentful-management.py
contentful_management/webhook.py
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L62-L76
def calls(self): """ Provides access to call overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls :return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_prox...
[ "def", "calls", "(", "self", ")", ":", "return", "WebhookWebhooksCallProxy", "(", "self", ".", "_client", ",", "self", ".", "sys", "[", "'space'", "]", ".", "id", ",", "self", ".", "sys", "[", "'id'", "]", ")" ]
Provides access to call overview for the given webhook. API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls :return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_proxy.WebhookWebhooksCallProxy>` object. ...
[ "Provides", "access", "to", "call", "overview", "for", "the", "given", "webhook", "." ]
python
train
openstates/billy
billy/web/public/views/bills.py
https://github.com/openstates/billy/blob/5fc795347f12a949e410a8cfad0c911ea6bced67/billy/web/public/views/bills.py#L29-L123
def get_context_data(self, *args, **kwargs): ''' Context: If GET parameters are given: - search_text - form (FilterBillsForm) - long_description - description - get_params Otherwise, the only context item is an unbound F...
[ "def", "get_context_data", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "RelatedBillsList", ",", "self", ")", ".", "get_context_data", "(", "*", "args", ",", "*", "*", "kwargs", ")", "metadata", "=", ...
Context: If GET parameters are given: - search_text - form (FilterBillsForm) - long_description - description - get_params Otherwise, the only context item is an unbound FilterBillsForm. Templates: - Are specified i...
[ "Context", ":", "If", "GET", "parameters", "are", "given", ":", "-", "search_text", "-", "form", "(", "FilterBillsForm", ")", "-", "long_description", "-", "description", "-", "get_params", "Otherwise", "the", "only", "context", "item", "is", "an", "unbound", ...
python
train
orbingol/NURBS-Python
geomdl/compatibility.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L257-L281
def generate_ctrlptsw2d_file(file_in='', file_out='ctrlptsw.txt'): """ Generates weighted control points from unweighted ones in 2-D. This function #. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format #. Converts into (x*w, y*w, z*w, w) format #. Saves the r...
[ "def", "generate_ctrlptsw2d_file", "(", "file_in", "=", "''", ",", "file_out", "=", "'ctrlptsw.txt'", ")", ":", "# Read control points", "ctrlpts2d", ",", "size_u", ",", "size_v", "=", "_read_ctrltps2d_file", "(", "file_in", ")", "# Multiply control points by weight", ...
Generates weighted control points from unweighted ones in 2-D. This function #. Takes in a 2-D control points file whose coordinates are organized in (x, y, z, w) format #. Converts into (x*w, y*w, z*w, w) format #. Saves the result to a file Therefore, the resultant file could be a direct input ...
[ "Generates", "weighted", "control", "points", "from", "unweighted", "ones", "in", "2", "-", "D", "." ]
python
train
mozilla/elasticutils
elasticutils/__init__.py
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/__init__.py#L1320-L1371
def _process_query(self, query): """Takes a key/val pair and returns the Elasticsearch code for it""" key, val = query field_name, field_action = split_field_action(key) # Boost by name__action overrides boost by name. boost = self.field_boosts.get(key) if boost is None:...
[ "def", "_process_query", "(", "self", ",", "query", ")", ":", "key", ",", "val", "=", "query", "field_name", ",", "field_action", "=", "split_field_action", "(", "key", ")", "# Boost by name__action overrides boost by name.", "boost", "=", "self", ".", "field_boos...
Takes a key/val pair and returns the Elasticsearch code for it
[ "Takes", "a", "key", "/", "val", "pair", "and", "returns", "the", "Elasticsearch", "code", "for", "it" ]
python
train
nicolargo/glances
glances/plugins/glances_sensors.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_sensors.py#L168-L217
def msg_curse(self, args=None, max_width=None): """Return the dict to display in the curse interface.""" # Init the return message ret = [] # Only process if stats exist and display plugin enable... if not self.stats or self.is_disable(): return ret # Max si...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if stats exist and display plugin enable...", "if", "not", "self", ".", "stats", "or", "self", ...
Return the dict to display in the curse interface.
[ "Return", "the", "dict", "to", "display", "in", "the", "curse", "interface", "." ]
python
train
glyph/automat
automat/_core.py
https://github.com/glyph/automat/blob/80c6eb925eeef120443f4f9c81398bea629884b8/automat/_core.py#L69-L83
def addTransition(self, inState, inputSymbol, outState, outputSymbols): """ Add the given transition to the outputSymbol. Raise ValueError if there is already a transition with the same inState and inputSymbol. """ # keeping self._transitions in a flat list makes addTransition ...
[ "def", "addTransition", "(", "self", ",", "inState", ",", "inputSymbol", ",", "outState", ",", "outputSymbols", ")", ":", "# keeping self._transitions in a flat list makes addTransition", "# O(n^2), but state machines don't tend to have hundreds of", "# transitions.", "for", "(",...
Add the given transition to the outputSymbol. Raise ValueError if there is already a transition with the same inState and inputSymbol.
[ "Add", "the", "given", "transition", "to", "the", "outputSymbol", ".", "Raise", "ValueError", "if", "there", "is", "already", "a", "transition", "with", "the", "same", "inState", "and", "inputSymbol", "." ]
python
train
joke2k/django-environ
environ/environ.py
https://github.com/joke2k/django-environ/blob/c2620021614557abe197578f99deeef42af3e082/environ/environ.py#L163-L167
def float(self, var, default=NOTSET): """ :rtype: float """ return self.get_value(var, cast=float, default=default)
[ "def", "float", "(", "self", ",", "var", ",", "default", "=", "NOTSET", ")", ":", "return", "self", ".", "get_value", "(", "var", ",", "cast", "=", "float", ",", "default", "=", "default", ")" ]
:rtype: float
[ ":", "rtype", ":", "float" ]
python
train
Gandi/gandi.cli
gandi/cli/modules/webacc.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L211-L217
def vhost_remove(cls, name): """ Delete a vhost in a webaccelerator """ oper = cls.call('hosting.rproxy.vhost.delete', name) cls.echo('Deleting your virtual host %s' % name) cls.display_progress(oper) cls.echo('Your virtual host have been removed') return oper
[ "def", "vhost_remove", "(", "cls", ",", "name", ")", ":", "oper", "=", "cls", ".", "call", "(", "'hosting.rproxy.vhost.delete'", ",", "name", ")", "cls", ".", "echo", "(", "'Deleting your virtual host %s'", "%", "name", ")", "cls", ".", "display_progress", "...
Delete a vhost in a webaccelerator
[ "Delete", "a", "vhost", "in", "a", "webaccelerator" ]
python
train
salu133445/pypianoroll
pypianoroll/track.py
https://github.com/salu133445/pypianoroll/blob/6224dc1e29222de2124d249acb80f3d072166917/pypianoroll/track.py#L239-L250
def pad(self, pad_length): """ Pad the pianoroll with zeros at the end along the time axis. Parameters ---------- pad_length : int The length to pad with zeros along the time axis. """ self.pianoroll = np.pad( self.pianoroll, ((0, pad_len...
[ "def", "pad", "(", "self", ",", "pad_length", ")", ":", "self", ".", "pianoroll", "=", "np", ".", "pad", "(", "self", ".", "pianoroll", ",", "(", "(", "0", ",", "pad_length", ")", ",", "(", "0", ",", "0", ")", ")", ",", "'constant'", ")" ]
Pad the pianoroll with zeros at the end along the time axis. Parameters ---------- pad_length : int The length to pad with zeros along the time axis.
[ "Pad", "the", "pianoroll", "with", "zeros", "at", "the", "end", "along", "the", "time", "axis", "." ]
python
train
davidsoncasey/quiver
plotter/plotter.py
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L172-L186
def make_plot(self): """Draw the plot on the figure attribute Uses matplotlib to draw and format the chart """ X, Y, DX, DY = self._calc_partials() # Plot the values self.figure = plt.Figure() axes = self.figure.add_subplot(1, 1, 1) axes....
[ "def", "make_plot", "(", "self", ")", ":", "X", ",", "Y", ",", "DX", ",", "DY", "=", "self", ".", "_calc_partials", "(", ")", "# Plot the values", "self", ".", "figure", "=", "plt", ".", "Figure", "(", ")", "axes", "=", "self", ".", "figure", ".", ...
Draw the plot on the figure attribute Uses matplotlib to draw and format the chart
[ "Draw", "the", "plot", "on", "the", "figure", "attribute", "Uses", "matplotlib", "to", "draw", "and", "format", "the", "chart" ]
python
train
cedricbonhomme/Stegano
stegano/tools.py
https://github.com/cedricbonhomme/Stegano/blob/502e6303791d348e479290c22108551ba3be254f/stegano/tools.py#L71-L74
def bs(s: int) -> str: """Converts an int to its bits representation as a string of 0's and 1's. """ return str(s) if s <= 1 else bs(s >> 1) + str(s & 1)
[ "def", "bs", "(", "s", ":", "int", ")", "->", "str", ":", "return", "str", "(", "s", ")", "if", "s", "<=", "1", "else", "bs", "(", "s", ">>", "1", ")", "+", "str", "(", "s", "&", "1", ")" ]
Converts an int to its bits representation as a string of 0's and 1's.
[ "Converts", "an", "int", "to", "its", "bits", "representation", "as", "a", "string", "of", "0", "s", "and", "1", "s", "." ]
python
train
osrg/ryu
ryu/services/protocols/bgp/processor.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/processor.py#L292-L316
def _cmp_by_local_pref(path1, path2): """Selects a path with highest local-preference. Unlike the weight attribute, which is only relevant to the local router, local preference is an attribute that routers exchange in the same AS. Highest local-pref is preferred. If we cannot decide, we return None...
[ "def", "_cmp_by_local_pref", "(", "path1", ",", "path2", ")", ":", "# TODO(PH): Revisit this when BGPS has concept of policy to be applied to", "# in-bound NLRIs.", "# Default local-pref values is 100", "lp1", "=", "path1", ".", "get_pattr", "(", "BGP_ATTR_TYPE_LOCAL_PREF", ")", ...
Selects a path with highest local-preference. Unlike the weight attribute, which is only relevant to the local router, local preference is an attribute that routers exchange in the same AS. Highest local-pref is preferred. If we cannot decide, we return None.
[ "Selects", "a", "path", "with", "highest", "local", "-", "preference", "." ]
python
train
PyCQA/pylint
pylint/message/message_handler_mix_in.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/message/message_handler_mix_in.py#L350-L400
def print_full_documentation(self, stream=None): """output a full documentation in ReST format""" if not stream: stream = sys.stdout print("Pylint global options and switches", file=stream) print("----------------------------------", file=stream) print("", file=strea...
[ "def", "print_full_documentation", "(", "self", ",", "stream", "=", "None", ")", ":", "if", "not", "stream", ":", "stream", "=", "sys", ".", "stdout", "print", "(", "\"Pylint global options and switches\"", ",", "file", "=", "stream", ")", "print", "(", "\"-...
output a full documentation in ReST format
[ "output", "a", "full", "documentation", "in", "ReST", "format" ]
python
test
obriencj/python-javatools
javatools/__init__.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/__init__.py#L1376-L1389
def get_arg_type_descriptors(self): """ The parameter type descriptor list for a method, or None for a field. Type descriptors are shorthand identifiers for the builtin java types. """ if not self.is_method: return tuple() tp = _typeseq(self.get_des...
[ "def", "get_arg_type_descriptors", "(", "self", ")", ":", "if", "not", "self", ".", "is_method", ":", "return", "tuple", "(", ")", "tp", "=", "_typeseq", "(", "self", ".", "get_descriptor", "(", ")", ")", "tp", "=", "_typeseq", "(", "tp", "[", "0", "...
The parameter type descriptor list for a method, or None for a field. Type descriptors are shorthand identifiers for the builtin java types.
[ "The", "parameter", "type", "descriptor", "list", "for", "a", "method", "or", "None", "for", "a", "field", ".", "Type", "descriptors", "are", "shorthand", "identifiers", "for", "the", "builtin", "java", "types", "." ]
python
train
tango-controls/pytango
tango/server.py
https://github.com/tango-controls/pytango/blob/9cf78c517c9cdc1081ff6d080a9646a740cc1d36/tango/server.py#L220-L237
def __patch_attr_methods(tango_device_klass, attribute): """ Checks if the read and write methods have the correct signature. If a read/write method doesn't have a parameter (the traditional Attribute), then the method is wrapped into another method to make this work. :param tango_device_klass:...
[ "def", "__patch_attr_methods", "(", "tango_device_klass", ",", "attribute", ")", ":", "if", "attribute", ".", "attr_write", "in", "(", "AttrWriteType", ".", "READ", ",", "AttrWriteType", ".", "READ_WRITE", ")", ":", "__patch_read_method", "(", "tango_device_klass", ...
Checks if the read and write methods have the correct signature. If a read/write method doesn't have a parameter (the traditional Attribute), then the method is wrapped into another method to make this work. :param tango_device_klass: a DeviceImpl class :type tango_device_klass: class :param at...
[ "Checks", "if", "the", "read", "and", "write", "methods", "have", "the", "correct", "signature", ".", "If", "a", "read", "/", "write", "method", "doesn", "t", "have", "a", "parameter", "(", "the", "traditional", "Attribute", ")", "then", "the", "method", ...
python
train
mitsei/dlkit
dlkit/json_/authorization/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/sessions.py#L1823-L1837
def use_plenary_vault_view(self): """A complete view of the ``Authorization`` and ``Vault`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mand...
[ "def", "use_plenary_vault_view", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.BinLookupSession.use_plenary_bin_view", "self", ".", "_catalog_view", "=", "PLENARY", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "self", ".", ...
A complete view of the ``Authorization`` and ``Vault`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.*
[ "A", "complete", "view", "of", "the", "Authorization", "and", "Vault", "returns", "is", "desired", "." ]
python
train
molmod/molmod
molmod/binning.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/binning.py#L116-L152
def _setup_grid(self, cutoff, unit_cell, grid): """Choose a proper grid for the binning process""" if grid is None: # automatically choose a decent grid if unit_cell is None: grid = cutoff/2.9 else: # The following would be faster, but ...
[ "def", "_setup_grid", "(", "self", ",", "cutoff", ",", "unit_cell", ",", "grid", ")", ":", "if", "grid", "is", "None", ":", "# automatically choose a decent grid", "if", "unit_cell", "is", "None", ":", "grid", "=", "cutoff", "/", "2.9", "else", ":", "# The...
Choose a proper grid for the binning process
[ "Choose", "a", "proper", "grid", "for", "the", "binning", "process" ]
python
train
google/grr
grr/server/grr_response_server/hunts/implementation.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/hunts/implementation.py#L899-L909
def Pause(self): """Pauses the hunt (removes Foreman rules, does not touch expiry time).""" if not self.IsHuntStarted(): return self._RemoveForemanRule() self.hunt_obj.Set(self.hunt_obj.Schema.STATE("PAUSED")) self.hunt_obj.Flush() self._CreateAuditEvent("HUNT_PAUSED")
[ "def", "Pause", "(", "self", ")", ":", "if", "not", "self", ".", "IsHuntStarted", "(", ")", ":", "return", "self", ".", "_RemoveForemanRule", "(", ")", "self", ".", "hunt_obj", ".", "Set", "(", "self", ".", "hunt_obj", ".", "Schema", ".", "STATE", "(...
Pauses the hunt (removes Foreman rules, does not touch expiry time).
[ "Pauses", "the", "hunt", "(", "removes", "Foreman", "rules", "does", "not", "touch", "expiry", "time", ")", "." ]
python
train
franciscogarate/pyliferisk
pyliferisk/__init__.py
https://github.com/franciscogarate/pyliferisk/blob/8d906bed04df1ba00fa1cacc6f31030ce5ab6233/pyliferisk/__init__.py#L268-L270
def Cx(mt, x): """ Return the Cx """ return ((1 / (1 + mt.i)) ** (x + 1)) * mt.dx[x] * ((1 + mt.i) ** 0.5)
[ "def", "Cx", "(", "mt", ",", "x", ")", ":", "return", "(", "(", "1", "/", "(", "1", "+", "mt", ".", "i", ")", ")", "**", "(", "x", "+", "1", ")", ")", "*", "mt", ".", "dx", "[", "x", "]", "*", "(", "(", "1", "+", "mt", ".", "i", "...
Return the Cx
[ "Return", "the", "Cx" ]
python
train
cltk/cltk
cltk/inflection/old_norse/nouns.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/inflection/old_norse/nouns.py#L494-L601
def decline_strong_neuter_noun(ns: str, gs: str, np: str): """ Gives the full declension of strong neuter nouns. a-stem Most of strong neuter nouns follow the declensions of skip, land and herað. >>> decline_strong_neuter_noun("skip", "skips", "skip") skip skip skipi skips skip...
[ "def", "decline_strong_neuter_noun", "(", "ns", ":", "str", ",", "gs", ":", "str", ",", "np", ":", "str", ")", ":", "# nominative singular", "print", "(", "ns", ")", "# accusative singular", "print", "(", "ns", ")", "# dative singular", "if", "ns", "[", "-...
Gives the full declension of strong neuter nouns. a-stem Most of strong neuter nouns follow the declensions of skip, land and herað. >>> decline_strong_neuter_noun("skip", "skips", "skip") skip skip skipi skips skip skip skipum skipa >>> decline_strong_neuter_noun("lan...
[ "Gives", "the", "full", "declension", "of", "strong", "neuter", "nouns", "." ]
python
train
lowandrew/OLCTools
spadespipeline/mMLST.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mMLST.py#L748-L809
def reprofiler(self, header, genome, sample): """ Creates and appends new profiles as required :param header: :param genome: :param sample: """ # Iterate through mlstseqtype - it contains genomes with partial matches to current reference profiles # Reset :...
[ "def", "reprofiler", "(", "self", ",", "header", ",", "genome", ",", "sample", ")", ":", "# Iterate through mlstseqtype - it contains genomes with partial matches to current reference profiles", "# Reset :newprofile", "newprofile", "=", "\"\"", "# Find the last profile entry in the...
Creates and appends new profiles as required :param header: :param genome: :param sample:
[ "Creates", "and", "appends", "new", "profiles", "as", "required", ":", "param", "header", ":", ":", "param", "genome", ":", ":", "param", "sample", ":" ]
python
train
requests/requests-kerberos
requests_kerberos/kerberos_.py
https://github.com/requests/requests-kerberos/blob/d459afcd20d921f18bc435e8df0f120f3d2ea6a2/requests_kerberos/kerberos_.py#L374-L413
def handle_response(self, response, **kwargs): """Takes the given response and tries kerberos-auth, as needed.""" num_401s = kwargs.pop('num_401s', 0) # Check if we have already tried to get the CBT data value if not self.cbt_binding_tried and self.send_cbt: # If we haven't ...
[ "def", "handle_response", "(", "self", ",", "response", ",", "*", "*", "kwargs", ")", ":", "num_401s", "=", "kwargs", ".", "pop", "(", "'num_401s'", ",", "0", ")", "# Check if we have already tried to get the CBT data value", "if", "not", "self", ".", "cbt_bindi...
Takes the given response and tries kerberos-auth, as needed.
[ "Takes", "the", "given", "response", "and", "tries", "kerberos", "-", "auth", "as", "needed", "." ]
python
train
ikumen/flask-cfg
flask_cfg/core.py
https://github.com/ikumen/flask-cfg/blob/28f3370121419d22b6a5a3713ab3cb8bb2da6e43/flask_cfg/core.py#L48-L77
def process_loaded_configs(self, values): """Takes the loaded config values (from YAML files) and performs the following clean up steps: 1. remove all value keys that are not uppercase 2. resolve any keys with missing values Note: resolving missing values does not fail ...
[ "def", "process_loaded_configs", "(", "self", ",", "values", ")", ":", "unresolved_value_keys", "=", "self", ".", "_process_config_values", "(", "[", "]", ",", "values", ",", "[", "]", ")", "if", "len", "(", "unresolved_value_keys", ")", ">", "0", ":", "ms...
Takes the loaded config values (from YAML files) and performs the following clean up steps: 1. remove all value keys that are not uppercase 2. resolve any keys with missing values Note: resolving missing values does not fail fast, we will collect all missing values and ...
[ "Takes", "the", "loaded", "config", "values", "(", "from", "YAML", "files", ")", "and", "performs", "the", "following", "clean", "up", "steps", ":", "1", ".", "remove", "all", "value", "keys", "that", "are", "not", "uppercase", "2", ".", "resolve", "any"...
python
train
nmdp-bioinformatics/SeqAnn
seqann/gfe.py
https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/gfe.py#L100-L119
def load_features(self): """ Loads all the known features from the feature service """ # Loading all loci that # are in self.loci variable defined # when the pyGFE object is created for loc in self.loci: if self.verbose: self.logger.inf...
[ "def", "load_features", "(", "self", ")", ":", "# Loading all loci that", "# are in self.loci variable defined", "# when the pyGFE object is created", "for", "loc", "in", "self", ".", "loci", ":", "if", "self", ".", "verbose", ":", "self", ".", "logger", ".", "info"...
Loads all the known features from the feature service
[ "Loads", "all", "the", "known", "features", "from", "the", "feature", "service" ]
python
train
MrYsLab/pymata-aio
pymata_aio/pymata3.py
https://github.com/MrYsLab/pymata-aio/blob/015081a4628b9d47dfe3f8d6c698ff903f107810/pymata_aio/pymata3.py#L277-L298
def get_capability_report(self, raw=True, cb=None): """ This method retrieves the Firmata capability report :param raw: If True, it either stores or provides the callback with a report as list. If False, prints a formatted report to the console :...
[ "def", "get_capability_report", "(", "self", ",", "raw", "=", "True", ",", "cb", "=", "None", ")", ":", "task", "=", "asyncio", ".", "ensure_future", "(", "self", ".", "core", ".", "get_capability_report", "(", ")", ")", "report", "=", "self", ".", "lo...
This method retrieves the Firmata capability report :param raw: If True, it either stores or provides the callback with a report as list. If False, prints a formatted report to the console :param cb: Optional callback reference to receive a raw report :...
[ "This", "method", "retrieves", "the", "Firmata", "capability", "report" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py#L88-L104
def qos_map_dscp_traffic_class_mark_to(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") qos = ET.SubElement(config, "qos", xmlns="urn:brocade.com:mgmt:brocade-qos") map = ET.SubElement(qos, "map") dscp_traffic_class = ET.SubElement(map, "dscp-traf...
[ "def", "qos_map_dscp_traffic_class_mark_to", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "qos", "=", "ET", ".", "SubElement", "(", "config", ",", "\"qos\"", ",", "xmlns", "=", "\"urn:brocade....
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
mikusjelly/apkutils
apkutils/__init__.py
https://github.com/mikusjelly/apkutils/blob/2db1ed0cdb610dfc55bfd77266e9a91e4764bba4/apkutils/__init__.py#L214-L246
def _init_methods(self, limit=10000): """初始化方法 某些APK可能存在大量的方法,可能会相当耗时,根据情况加限制 Args: limit (int, optional): 方法数量限制,超过该值,则不获取方法 Returns: TYPE: 方法集合 """ methods = set() if not self.dex_files: self._init_dex_files() coun...
[ "def", "_init_methods", "(", "self", ",", "limit", "=", "10000", ")", ":", "methods", "=", "set", "(", ")", "if", "not", "self", ".", "dex_files", ":", "self", ".", "_init_dex_files", "(", ")", "count", "=", "0", "for", "dex_file", "in", "self", ".",...
初始化方法 某些APK可能存在大量的方法,可能会相当耗时,根据情况加限制 Args: limit (int, optional): 方法数量限制,超过该值,则不获取方法 Returns: TYPE: 方法集合
[ "初始化方法" ]
python
train
meyersj/geotweet
geotweet/osm.py
https://github.com/meyersj/geotweet/blob/1a6b55f98adf34d1b91f172d9187d599616412d9/geotweet/osm.py#L67-L81
def extract(self, pbf, output): """ extract POI nodes from osm pbf extract """ logging.info("Extracting POI nodes from {0} to {1}".format(pbf, output)) with open(output, 'w') as f: # define callback for each node that is processed def nodes_callback(nodes): ...
[ "def", "extract", "(", "self", ",", "pbf", ",", "output", ")", ":", "logging", ".", "info", "(", "\"Extracting POI nodes from {0} to {1}\"", ".", "format", "(", "pbf", ",", "output", ")", ")", "with", "open", "(", "output", ",", "'w'", ")", "as", "f", ...
extract POI nodes from osm pbf extract
[ "extract", "POI", "nodes", "from", "osm", "pbf", "extract" ]
python
train
hyperledger/indy-sdk
vcx/wrappers/python3/vcx/api/issuer_credential.py
https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/issuer_credential.py#L132-L160
async def send_offer(self, connection: Connection): """ Sends an offer to a prover. Once accepted, a request will be recieved. :param connection: vcx.api.connection.Connection :return: None Example: source_id = '1' cred_def_id = 'cred_def_id1' attrs = {'...
[ "async", "def", "send_offer", "(", "self", ",", "connection", ":", "Connection", ")", ":", "if", "not", "hasattr", "(", "IssuerCredential", ".", "send_offer", ",", "\"cb\"", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"vcx_issuer_send_credential_offe...
Sends an offer to a prover. Once accepted, a request will be recieved. :param connection: vcx.api.connection.Connection :return: None Example: source_id = '1' cred_def_id = 'cred_def_id1' attrs = {'key': 'value', 'key2': 'value2', 'key3': 'value3'} name = 'Crede...
[ "Sends", "an", "offer", "to", "a", "prover", ".", "Once", "accepted", "a", "request", "will", "be", "recieved", ".", ":", "param", "connection", ":", "vcx", ".", "api", ".", "connection", ".", "Connection", ":", "return", ":", "None" ]
python
train
fabioz/PyDev.Debugger
pydevd.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd.py#L586-L610
def get_file_type(self, abs_real_path_and_basename, _cache_file_type=_CACHE_FILE_TYPE): ''' :param abs_real_path_and_basename: The result from get_abs_path_real_path_and_base_from_file or get_abs_path_real_path_and_base_from_frame. :return _pydevd_bundle.pyde...
[ "def", "get_file_type", "(", "self", ",", "abs_real_path_and_basename", ",", "_cache_file_type", "=", "_CACHE_FILE_TYPE", ")", ":", "try", ":", "return", "_cache_file_type", "[", "abs_real_path_and_basename", "[", "0", "]", "]", "except", ":", "file_type", "=", "s...
:param abs_real_path_and_basename: The result from get_abs_path_real_path_and_base_from_file or get_abs_path_real_path_and_base_from_frame. :return _pydevd_bundle.pydevd_dont_trace_files.PYDEV_FILE: If it's a file internal to the debugger which shouldn't be ...
[ ":", "param", "abs_real_path_and_basename", ":", "The", "result", "from", "get_abs_path_real_path_and_base_from_file", "or", "get_abs_path_real_path_and_base_from_frame", "." ]
python
train
MozillaSecurity/laniakea
laniakea/core/providers/gce/manager.py
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/providers/gce/manager.py#L274-L297
def start(self, nodes=None): """Start one or many nodes. :param nodes: Nodes to be started. :type nodes: ``list`` """ if not self.is_connected(): return None nodes = nodes or self.nodes result = [] for node in nodes: if node...
[ "def", "start", "(", "self", ",", "nodes", "=", "None", ")", ":", "if", "not", "self", ".", "is_connected", "(", ")", ":", "return", "None", "nodes", "=", "nodes", "or", "self", ".", "nodes", "result", "=", "[", "]", "for", "node", "in", "nodes", ...
Start one or many nodes. :param nodes: Nodes to be started. :type nodes: ``list``
[ "Start", "one", "or", "many", "nodes", "." ]
python
train
lk-geimfari/mimesis
mimesis/providers/base.py
https://github.com/lk-geimfari/mimesis/blob/4b16ee7a8dba6281a904654a88dbb4b052869fc5/mimesis/providers/base.py#L178-L197
def override_locale(self, locale: str = locales.EN, ) -> Generator['BaseDataProvider', None, None]: """Context manager which allows overriding current locale. Temporarily overrides current locale for locale-dependent providers. :param locale: Locale. :re...
[ "def", "override_locale", "(", "self", ",", "locale", ":", "str", "=", "locales", ".", "EN", ",", ")", "->", "Generator", "[", "'BaseDataProvider'", ",", "None", ",", "None", "]", ":", "try", ":", "origin_locale", "=", "self", ".", "locale", "self", "....
Context manager which allows overriding current locale. Temporarily overrides current locale for locale-dependent providers. :param locale: Locale. :return: Provider with overridden locale.
[ "Context", "manager", "which", "allows", "overriding", "current", "locale", "." ]
python
train
atmos-python/atmos
atmos/solve.py
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L217-L257
def _get_module_methods(module): ''' Returns a methods list corresponding to the equations in the given module. Each entry is a dictionary with keys 'output', 'args', and 'func' corresponding to the output, arguments, and function of the method. The entries may optionally include 'assumptions' and ...
[ "def", "_get_module_methods", "(", "module", ")", ":", "# Set up the methods dict we will eventually return", "methods", "=", "[", "]", "funcs", "=", "[", "]", "for", "item", "in", "inspect", ".", "getmembers", "(", "equations", ")", ":", "if", "(", "item", "[...
Returns a methods list corresponding to the equations in the given module. Each entry is a dictionary with keys 'output', 'args', and 'func' corresponding to the output, arguments, and function of the method. The entries may optionally include 'assumptions' and 'overridden_by_assumptions' as keys, stati...
[ "Returns", "a", "methods", "list", "corresponding", "to", "the", "equations", "in", "the", "given", "module", ".", "Each", "entry", "is", "a", "dictionary", "with", "keys", "output", "args", "and", "func", "corresponding", "to", "the", "output", "arguments", ...
python
train
sdispater/cachy
cachy/repository.py
https://github.com/sdispater/cachy/blob/ee4b044d6aafa80125730a00b1f679a7bd852b8a/cachy/repository.py#L90-L113
def add(self, key, val, minutes): """ Store an item in the cache if it does not exist. :param key: The cache key :type key: str :param val: The cache value :type val: mixed :param minutes: The lifetime in minutes of the cached value :type minutes: int|d...
[ "def", "add", "(", "self", ",", "key", ",", "val", ",", "minutes", ")", ":", "if", "hasattr", "(", "self", ".", "_store", ",", "'add'", ")", ":", "return", "self", ".", "_store", ".", "add", "(", "key", ",", "val", ",", "self", ".", "_get_minutes...
Store an item in the cache if it does not exist. :param key: The cache key :type key: str :param val: The cache value :type val: mixed :param minutes: The lifetime in minutes of the cached value :type minutes: int|datetime :rtype: bool
[ "Store", "an", "item", "in", "the", "cache", "if", "it", "does", "not", "exist", "." ]
python
train
sammchardy/python-binance
binance/client.py
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/client.py#L1312-L1336
def order_market_sell(self, **params): """Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type ne...
[ "def", "order_market_sell", "(", "self", ",", "*", "*", "params", ")", ":", "params", ".", "update", "(", "{", "'side'", ":", "self", ".", "SIDE_SELL", "}", ")", "return", "self", ".", "order_market", "(", "*", "*", "params", ")" ]
Send in a new market sell order :param symbol: required :type symbol: str :param quantity: required :type quantity: decimal :param newClientOrderId: A unique id for the order. Automatically generated if not sent. :type newClientOrderId: str :param newOrderRespTyp...
[ "Send", "in", "a", "new", "market", "sell", "order" ]
python
train
MartinThoma/hwrt
hwrt/preprocessing.py
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/preprocessing.py#L382-L426
def _space(self, hwr_obj, stroke, kind): """Do the interpolation of 'kind' for 'stroke'""" new_stroke = [] stroke = sorted(stroke, key=lambda p: p['time']) x, y, t = [], [], [] for point in stroke: x.append(point['x']) y.append(point['y']) t....
[ "def", "_space", "(", "self", ",", "hwr_obj", ",", "stroke", ",", "kind", ")", ":", "new_stroke", "=", "[", "]", "stroke", "=", "sorted", "(", "stroke", ",", "key", "=", "lambda", "p", ":", "p", "[", "'time'", "]", ")", "x", ",", "y", ",", "t",...
Do the interpolation of 'kind' for 'stroke
[ "Do", "the", "interpolation", "of", "kind", "for", "stroke" ]
python
train
pyviz/holoviews
holoviews/plotting/mpl/chart.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L495-L540
def _update_plot(self, key, element, bars, lims, ranges): """ Process the bars and draw the offset line as necessary. If a color map is set in the style of the 'main' ViewableElement object, color the bars appropriately, respecting the required normalization settings. """...
[ "def", "_update_plot", "(", "self", ",", "key", ",", "element", ",", "bars", ",", "lims", ",", "ranges", ")", ":", "main", "=", "self", ".", "adjoined", ".", "main", "_", ",", "y1", "=", "element", ".", "range", "(", "1", ")", "offset", "=", "sel...
Process the bars and draw the offset line as necessary. If a color map is set in the style of the 'main' ViewableElement object, color the bars appropriately, respecting the required normalization settings.
[ "Process", "the", "bars", "and", "draw", "the", "offset", "line", "as", "necessary", ".", "If", "a", "color", "map", "is", "set", "in", "the", "style", "of", "the", "main", "ViewableElement", "object", "color", "the", "bars", "appropriately", "respecting", ...
python
train
numenta/htmresearch
htmresearch/regions/TemporalPoolerRegion.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/regions/TemporalPoolerRegion.py#L439-L451
def getSpec(cls): """ Return the Spec for TemporalPoolerRegion. The parameters collection is constructed based on the parameters specified by the various components (poolerSpec and otherSpec) """ spec = cls.getBaseSpec() p, o = _getAdditionalSpecs() spec["parameters"].update(p) spec...
[ "def", "getSpec", "(", "cls", ")", ":", "spec", "=", "cls", ".", "getBaseSpec", "(", ")", "p", ",", "o", "=", "_getAdditionalSpecs", "(", ")", "spec", "[", "\"parameters\"", "]", ".", "update", "(", "p", ")", "spec", "[", "\"parameters\"", "]", ".", ...
Return the Spec for TemporalPoolerRegion. The parameters collection is constructed based on the parameters specified by the various components (poolerSpec and otherSpec)
[ "Return", "the", "Spec", "for", "TemporalPoolerRegion", "." ]
python
train
jilljenn/tryalgo
tryalgo/trie.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/trie.py#L46-L60
def spell_check(T, w): """Spellchecker :param T: trie encoding the dictionary :param w: given word :returns: a closest word from the dictionary :complexity: linear if distance was constant """ assert T is not None dist = 0 while True: # Try increasing distances u = search(...
[ "def", "spell_check", "(", "T", ",", "w", ")", ":", "assert", "T", "is", "not", "None", "dist", "=", "0", "while", "True", ":", "# Try increasing distances", "u", "=", "search", "(", "T", ",", "dist", ",", "w", ")", "if", "u", "is", "not", "None", ...
Spellchecker :param T: trie encoding the dictionary :param w: given word :returns: a closest word from the dictionary :complexity: linear if distance was constant
[ "Spellchecker" ]
python
train
pantsbuild/pants
src/python/pants/pantsd/service/pants_service.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/pantsd/service/pants_service.py#L190-L196
def mark_running(self): """Moves the service to the Running state. Raises if the service is not currently in the Paused state. """ with self._lock: self._set_state(self._RUNNING, self._PAUSED)
[ "def", "mark_running", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_set_state", "(", "self", ".", "_RUNNING", ",", "self", ".", "_PAUSED", ")" ]
Moves the service to the Running state. Raises if the service is not currently in the Paused state.
[ "Moves", "the", "service", "to", "the", "Running", "state", "." ]
python
train
twilio/twilio-python
twilio/rest/taskrouter/v1/workspace/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/taskrouter/v1/workspace/__init__.py#L369-L378
def task_queues(self): """ Access the task_queues :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList """ if self._task_queues is None: self._task_queues = TaskQueueList(s...
[ "def", "task_queues", "(", "self", ")", ":", "if", "self", ".", "_task_queues", "is", "None", ":", "self", ".", "_task_queues", "=", "TaskQueueList", "(", "self", ".", "_version", ",", "workspace_sid", "=", "self", ".", "_solution", "[", "'sid'", "]", ",...
Access the task_queues :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList
[ "Access", "the", "task_queues" ]
python
train
GNS3/gns3-server
gns3server/compute/vmware/vmware_vm.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/vmware_vm.py#L426-L472
def start(self): """ Starts this VMware VM. """ if self.status == "started": return if (yield from self.is_running()): raise VMwareError("The VM is already running in VMware") ubridge_path = self.ubridge_path if not ubridge_path or not o...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "status", "==", "\"started\"", ":", "return", "if", "(", "yield", "from", "self", ".", "is_running", "(", ")", ")", ":", "raise", "VMwareError", "(", "\"The VM is already running in VMware\"", ")", ...
Starts this VMware VM.
[ "Starts", "this", "VMware", "VM", "." ]
python
train
cjdrake/pyeda
pyeda/boolalg/boolfunc.py
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/boolalg/boolfunc.py#L268-L277
def iter_terms(fs, conj=False): """Iterate through all min/max terms in an N-dimensional Boolean space. The *fs* argument is a sequence of :math:`N` Boolean functions. If *conj* is ``False``, yield minterms. Otherwise, yield maxterms. """ for num in range(1 << len(fs)): yield num2term(...
[ "def", "iter_terms", "(", "fs", ",", "conj", "=", "False", ")", ":", "for", "num", "in", "range", "(", "1", "<<", "len", "(", "fs", ")", ")", ":", "yield", "num2term", "(", "num", ",", "fs", ",", "conj", ")" ]
Iterate through all min/max terms in an N-dimensional Boolean space. The *fs* argument is a sequence of :math:`N` Boolean functions. If *conj* is ``False``, yield minterms. Otherwise, yield maxterms.
[ "Iterate", "through", "all", "min", "/", "max", "terms", "in", "an", "N", "-", "dimensional", "Boolean", "space", "." ]
python
train
graphql-python/graphql-core-next
graphql/type/scalars.py
https://github.com/graphql-python/graphql-core-next/blob/073dce3f002f897d40f9348ffd8f107815160540/graphql/type/scalars.py#L113-L117
def parse_float_literal(ast, _variables=None): """Parse a float value node in the AST.""" if isinstance(ast, (FloatValueNode, IntValueNode)): return float(ast.value) return INVALID
[ "def", "parse_float_literal", "(", "ast", ",", "_variables", "=", "None", ")", ":", "if", "isinstance", "(", "ast", ",", "(", "FloatValueNode", ",", "IntValueNode", ")", ")", ":", "return", "float", "(", "ast", ".", "value", ")", "return", "INVALID" ]
Parse a float value node in the AST.
[ "Parse", "a", "float", "value", "node", "in", "the", "AST", "." ]
python
train
ceph/ceph-deploy
ceph_deploy/pkg.py
https://github.com/ceph/ceph-deploy/blob/86943fcc454cd4c99a86e3493e9e93a59c661fef/ceph_deploy/pkg.py#L60-L86
def make(parser): """ Manage packages on remote hosts. """ action = parser.add_mutually_exclusive_group() action.add_argument( '--install', metavar='PKG(s)', help='Comma-separated package(s) to install', ) action.add_argument( '--remove', metavar='P...
[ "def", "make", "(", "parser", ")", ":", "action", "=", "parser", ".", "add_mutually_exclusive_group", "(", ")", "action", ".", "add_argument", "(", "'--install'", ",", "metavar", "=", "'PKG(s)'", ",", "help", "=", "'Comma-separated package(s) to install'", ",", ...
Manage packages on remote hosts.
[ "Manage", "packages", "on", "remote", "hosts", "." ]
python
train
hotdoc/hotdoc
hotdoc/utils/setup_utils.py
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/utils/setup_utils.py#L75-L79
def _update_submodules(repo_dir): """update submodules in a repo""" subprocess.check_call("git submodule init", cwd=repo_dir, shell=True) subprocess.check_call( "git submodule update --recursive", cwd=repo_dir, shell=True)
[ "def", "_update_submodules", "(", "repo_dir", ")", ":", "subprocess", ".", "check_call", "(", "\"git submodule init\"", ",", "cwd", "=", "repo_dir", ",", "shell", "=", "True", ")", "subprocess", ".", "check_call", "(", "\"git submodule update --recursive\"", ",", ...
update submodules in a repo
[ "update", "submodules", "in", "a", "repo" ]
python
train
horazont/aioxmpp
aioxmpp/disco/service.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L812-L821
def set_info_cache(self, jid, node, info): """ This is a wrapper around :meth:`set_info_future` which creates a future and immediately assigns `info` as its result. .. versionadded:: 0.5 """ fut = asyncio.Future() fut.set_result(info) self.set_info_future...
[ "def", "set_info_cache", "(", "self", ",", "jid", ",", "node", ",", "info", ")", ":", "fut", "=", "asyncio", ".", "Future", "(", ")", "fut", ".", "set_result", "(", "info", ")", "self", ".", "set_info_future", "(", "jid", ",", "node", ",", "fut", "...
This is a wrapper around :meth:`set_info_future` which creates a future and immediately assigns `info` as its result. .. versionadded:: 0.5
[ "This", "is", "a", "wrapper", "around", ":", "meth", ":", "set_info_future", "which", "creates", "a", "future", "and", "immediately", "assigns", "info", "as", "its", "result", "." ]
python
train
KelSolaar/Umbra
umbra/exceptions.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/exceptions.py#L53-L67
def notify_exception_handler(*args): """ Provides a notifier exception handler. :param \*args: Arguments. :type \*args: \* :return: Definition success. :rtype: bool """ callback = RuntimeGlobals.components_manager["factory.script_editor"].restore_development_layout foundations.exce...
[ "def", "notify_exception_handler", "(", "*", "args", ")", ":", "callback", "=", "RuntimeGlobals", ".", "components_manager", "[", "\"factory.script_editor\"", "]", ".", "restore_development_layout", "foundations", ".", "exceptions", ".", "base_exception_handler", "(", "...
Provides a notifier exception handler. :param \*args: Arguments. :type \*args: \* :return: Definition success. :rtype: bool
[ "Provides", "a", "notifier", "exception", "handler", "." ]
python
train
konstantint/PassportEye
passporteye/util/pipeline.py
https://github.com/konstantint/PassportEye/blob/b32afba0f5dc4eb600c4edc4f49e5d49959c5415/passporteye/util/pipeline.py#L68-L78
def remove_component(self, name): """Removes an existing component with a given name, invalidating all the values computed by the previous component.""" if name not in self.components: raise Exception("No component named %s" % name) del self.components[name] del self....
[ "def", "remove_component", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "components", ":", "raise", "Exception", "(", "\"No component named %s\"", "%", "name", ")", "del", "self", ".", "components", "[", "name", "]", "del", ...
Removes an existing component with a given name, invalidating all the values computed by the previous component.
[ "Removes", "an", "existing", "component", "with", "a", "given", "name", "invalidating", "all", "the", "values", "computed", "by", "the", "previous", "component", "." ]
python
train
tomekwojcik/envelopes
envelopes/conn.py
https://github.com/tomekwojcik/envelopes/blob/8ad190a55d0d8b805b6ae545b896e719467253b7/envelopes/conn.py#L53-L61
def is_connected(self): """Returns *True* if the SMTP connection is initialized and connected. Otherwise returns *False*""" try: self._conn.noop() except (AttributeError, smtplib.SMTPServerDisconnected): return False else: return True
[ "def", "is_connected", "(", "self", ")", ":", "try", ":", "self", ".", "_conn", ".", "noop", "(", ")", "except", "(", "AttributeError", ",", "smtplib", ".", "SMTPServerDisconnected", ")", ":", "return", "False", "else", ":", "return", "True" ]
Returns *True* if the SMTP connection is initialized and connected. Otherwise returns *False*
[ "Returns", "*", "True", "*", "if", "the", "SMTP", "connection", "is", "initialized", "and", "connected", ".", "Otherwise", "returns", "*", "False", "*" ]
python
train
timmahrt/ProMo
promo/f0_morph.py
https://github.com/timmahrt/ProMo/blob/99d9f5cc01ff328a62973c5a5da910cc905ae4d5/promo/f0_morph.py#L35-L43
def getPitchForIntervals(data, tgFN, tierName): ''' Preps data for use in f0Morph ''' tg = tgio.openTextgrid(tgFN) data = tg.tierDict[tierName].getValuesInIntervals(data) data = [dataList for _, dataList in data] return data
[ "def", "getPitchForIntervals", "(", "data", ",", "tgFN", ",", "tierName", ")", ":", "tg", "=", "tgio", ".", "openTextgrid", "(", "tgFN", ")", "data", "=", "tg", ".", "tierDict", "[", "tierName", "]", ".", "getValuesInIntervals", "(", "data", ")", "data",...
Preps data for use in f0Morph
[ "Preps", "data", "for", "use", "in", "f0Morph" ]
python
train
kovacsbalu/WazeRouteCalculator
WazeRouteCalculator/WazeRouteCalculator.py
https://github.com/kovacsbalu/WazeRouteCalculator/blob/13ddb064571bb2bc0ceec51b5b317640b2bc3fb2/WazeRouteCalculator/WazeRouteCalculator.py#L76-L80
def already_coords(self, address): """test used to see if we have coordinates or address""" m = re.search(self.COORD_MATCH, address) return (m != None)
[ "def", "already_coords", "(", "self", ",", "address", ")", ":", "m", "=", "re", ".", "search", "(", "self", ".", "COORD_MATCH", ",", "address", ")", "return", "(", "m", "!=", "None", ")" ]
test used to see if we have coordinates or address
[ "test", "used", "to", "see", "if", "we", "have", "coordinates", "or", "address" ]
python
train
libtcod/python-tcod
tdl/__init__.py
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L593-L611
def get_cursor(self): """Return the virtual cursor position. The cursor can be moved with the :any:`move` method. Returns: Tuple[int, int]: The (x, y) coordinate of where :any:`print_str` will continue from. .. seealso:: :any:move` """ x, y ...
[ "def", "get_cursor", "(", "self", ")", ":", "x", ",", "y", "=", "self", ".", "_cursor", "width", ",", "height", "=", "self", ".", "parent", ".", "get_size", "(", ")", "while", "x", ">=", "width", ":", "x", "-=", "width", "y", "+=", "1", "if", "...
Return the virtual cursor position. The cursor can be moved with the :any:`move` method. Returns: Tuple[int, int]: The (x, y) coordinate of where :any:`print_str` will continue from. .. seealso:: :any:move`
[ "Return", "the", "virtual", "cursor", "position", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/structural/regions.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/regions.py#L215-L229
def _calculate_sv_coverage_cnvkit(data, work_dir): """Calculate coverage in an CNVkit ready format using mosdepth. """ from bcbio.variation import coverage from bcbio.structural import annotate out_target_file = os.path.join(work_dir, "%s-target-coverage.cnn" % dd.get_sample_name(data)) out_anti...
[ "def", "_calculate_sv_coverage_cnvkit", "(", "data", ",", "work_dir", ")", ":", "from", "bcbio", ".", "variation", "import", "coverage", "from", "bcbio", ".", "structural", "import", "annotate", "out_target_file", "=", "os", ".", "path", ".", "join", "(", "wor...
Calculate coverage in an CNVkit ready format using mosdepth.
[ "Calculate", "coverage", "in", "an", "CNVkit", "ready", "format", "using", "mosdepth", "." ]
python
train
Rapptz/discord.py
discord/iterators.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L325-L333
async def _retrieve_messages_before_strategy(self, retrieve): """Retrieve messages using before parameter.""" before = self.before.id if self.before else None data = await self.logs_from(self.channel.id, retrieve, before=before) if len(data): if self.limit is not None: ...
[ "async", "def", "_retrieve_messages_before_strategy", "(", "self", ",", "retrieve", ")", ":", "before", "=", "self", ".", "before", ".", "id", "if", "self", ".", "before", "else", "None", "data", "=", "await", "self", ".", "logs_from", "(", "self", ".", ...
Retrieve messages using before parameter.
[ "Retrieve", "messages", "using", "before", "parameter", "." ]
python
train
MrYsLab/pymata-aio
pymata_aio/pymata3.py
https://github.com/MrYsLab/pymata-aio/blob/015081a4628b9d47dfe3f8d6c698ff903f107810/pymata_aio/pymata3.py#L575-L593
def set_pin_mode(self, pin_number, pin_state, callback=None, cb_type=None): """ This method sets the pin mode for the specified pin. :param pin_number: Arduino Pin Number :param pin_state: INPUT/OUTPUT/ANALOG/PWM/PULLUP - for SERVO use servo_config() ...
[ "def", "set_pin_mode", "(", "self", ",", "pin_number", ",", "pin_state", ",", "callback", "=", "None", ",", "cb_type", "=", "None", ")", ":", "task", "=", "asyncio", ".", "ensure_future", "(", "self", ".", "core", ".", "set_pin_mode", "(", "pin_number", ...
This method sets the pin mode for the specified pin. :param pin_number: Arduino Pin Number :param pin_state: INPUT/OUTPUT/ANALOG/PWM/PULLUP - for SERVO use servo_config() :param callback: Optional: A reference to a call back function to be c...
[ "This", "method", "sets", "the", "pin", "mode", "for", "the", "specified", "pin", "." ]
python
train
pkkid/python-plexapi
plexapi/server.py
https://github.com/pkkid/python-plexapi/blob/9efbde96441c2bfbf410eacfb46e811e108e8bbc/plexapi/server.py#L151-L157
def _headers(self, **kwargs): """ Returns dict containing base headers for all requests to the server. """ headers = BASE_HEADERS.copy() if self._token: headers['X-Plex-Token'] = self._token headers.update(kwargs) return headers
[ "def", "_headers", "(", "self", ",", "*", "*", "kwargs", ")", ":", "headers", "=", "BASE_HEADERS", ".", "copy", "(", ")", "if", "self", ".", "_token", ":", "headers", "[", "'X-Plex-Token'", "]", "=", "self", ".", "_token", "headers", ".", "update", "...
Returns dict containing base headers for all requests to the server.
[ "Returns", "dict", "containing", "base", "headers", "for", "all", "requests", "to", "the", "server", "." ]
python
train
edx/edx-django-utils
edx_django_utils/monitoring/middleware.py
https://github.com/edx/edx-django-utils/blob/16cb4ac617e53c572bf68ccd19d24afeff1ca769/edx_django_utils/monitoring/middleware.py#L66-L78
def _batch_report(cls, request): """ Report the collected custom metrics to New Relic. """ if not newrelic: return metrics_cache = cls._get_metrics_cache() try: newrelic.agent.add_custom_parameter('user_id', request.user.id) except Attribut...
[ "def", "_batch_report", "(", "cls", ",", "request", ")", ":", "if", "not", "newrelic", ":", "return", "metrics_cache", "=", "cls", ".", "_get_metrics_cache", "(", ")", "try", ":", "newrelic", ".", "agent", ".", "add_custom_parameter", "(", "'user_id'", ",", ...
Report the collected custom metrics to New Relic.
[ "Report", "the", "collected", "custom", "metrics", "to", "New", "Relic", "." ]
python
train
20c/twentyc.database
twentyc/database/couchdb/client.py
https://github.com/20c/twentyc.database/blob/c6b7184d66dddafb306c94c4f98234bef1df1291/twentyc/database/couchdb/client.py#L433-L447
def result(self, couchdb_response_text): """ Return whether a REST couchdb operation was successful or not. On error will raise a RESTException """ result = json.loads(couchdb_response_text) if result.get("ok"): return True elif result.get("error"): raise RESTException( ...
[ "def", "result", "(", "self", ",", "couchdb_response_text", ")", ":", "result", "=", "json", ".", "loads", "(", "couchdb_response_text", ")", "if", "result", ".", "get", "(", "\"ok\"", ")", ":", "return", "True", "elif", "result", ".", "get", "(", "\"err...
Return whether a REST couchdb operation was successful or not. On error will raise a RESTException
[ "Return", "whether", "a", "REST", "couchdb", "operation", "was", "successful", "or", "not", "." ]
python
train
ConsenSys/mythril-classic
mythril/laser/ethereum/svm.py
https://github.com/ConsenSys/mythril-classic/blob/27af71c34b2ce94f4fae5613ec457f93df1a8f56/mythril/laser/ethereum/svm.py#L483-L500
def register_laser_hooks(self, hook_type: str, hook: Callable): """registers the hook with this Laser VM""" if hook_type == "add_world_state": self._add_world_state_hooks.append(hook) elif hook_type == "execute_state": self._execute_state_hooks.append(hook) elif h...
[ "def", "register_laser_hooks", "(", "self", ",", "hook_type", ":", "str", ",", "hook", ":", "Callable", ")", ":", "if", "hook_type", "==", "\"add_world_state\"", ":", "self", ".", "_add_world_state_hooks", ".", "append", "(", "hook", ")", "elif", "hook_type", ...
registers the hook with this Laser VM
[ "registers", "the", "hook", "with", "this", "Laser", "VM" ]
python
train
mitsei/dlkit
dlkit/json_/repository/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/managers.py#L1762-L1779
def get_composition_repository_session(self, proxy): """Gets the session for retrieving composition to repository mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.repository.CompositionRepositorySession) - a ``CompositionRepositorySession`` raise: NullA...
[ "def", "get_composition_repository_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_composition_repository", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".",...
Gets the session for retrieving composition to repository mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.repository.CompositionRepositorySession) - a ``CompositionRepositorySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed ...
[ "Gets", "the", "session", "for", "retrieving", "composition", "to", "repository", "mappings", "." ]
python
train
ella/ella
ella/core/managers.py
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/managers.py#L83-L97
def collect_related(self, finder_funcs, obj, count, *args, **kwargs): """ Collects objects related to ``obj`` using a list of ``finder_funcs``. Stops when required count is collected or the function list is exhausted. """ collected = [] for func in finder_funcs: ...
[ "def", "collect_related", "(", "self", ",", "finder_funcs", ",", "obj", ",", "count", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "collected", "=", "[", "]", "for", "func", "in", "finder_funcs", ":", "gathered", "=", "func", "(", "obj", ",",...
Collects objects related to ``obj`` using a list of ``finder_funcs``. Stops when required count is collected or the function list is exhausted.
[ "Collects", "objects", "related", "to", "obj", "using", "a", "list", "of", "finder_funcs", ".", "Stops", "when", "required", "count", "is", "collected", "or", "the", "function", "list", "is", "exhausted", "." ]
python
train
yyuu/botornado
boto/ec2/volume.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/volume.py#L122-L144
def detach(self, force=False): """ Detach this EBS volume from an EC2 instance. :type force: bool :param force: Forces detachment if the previous detachment attempt did not occur cleanly. This option can lead to data loss or a corrupted file ...
[ "def", "detach", "(", "self", ",", "force", "=", "False", ")", ":", "instance_id", "=", "None", "if", "self", ".", "attach_data", ":", "instance_id", "=", "self", ".", "attach_data", ".", "instance_id", "device", "=", "None", "if", "self", ".", "attach_d...
Detach this EBS volume from an EC2 instance. :type force: bool :param force: Forces detachment if the previous detachment attempt did not occur cleanly. This option can lead to data loss or a corrupted file system. Use this option only as a last ...
[ "Detach", "this", "EBS", "volume", "from", "an", "EC2", "instance", "." ]
python
train
pkgw/pwkit
pwkit/environments/casa/util.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/util.py#L221-L306
def forkandlog(function, filter='INFO5', debug=False): """Fork a child process and read its CASA log output. function A function to run in the child process filter The CASA log level filter to apply in the child process: less urgent messages will not be shown. Valid values are strings: "D...
[ "def", "forkandlog", "(", "function", ",", "filter", "=", "'INFO5'", ",", "debug", "=", "False", ")", ":", "import", "sys", ",", "os", "readfd", ",", "writefd", "=", "os", ".", "pipe", "(", ")", "pid", "=", "os", ".", "fork", "(", ")", "if", "pid...
Fork a child process and read its CASA log output. function A function to run in the child process filter The CASA log level filter to apply in the child process: less urgent messages will not be shown. Valid values are strings: "DEBUG1", "INFO5", ... "INFO1", "INFO", "WARN", "SEVERE". ...
[ "Fork", "a", "child", "process", "and", "read", "its", "CASA", "log", "output", "." ]
python
train
MillionIntegrals/vel
vel/rl/models/q_noisy_model.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/models/q_noisy_model.py#L67-L75
def instantiate(self, **extra_args): """ Instantiate the model """ input_block = self.input_block.instantiate() backbone = self.backbone.instantiate(**extra_args) return NoisyQModel( input_block, backbone, extra_args['action_space'], initial_std_dev=self.initial_std_dev, ...
[ "def", "instantiate", "(", "self", ",", "*", "*", "extra_args", ")", ":", "input_block", "=", "self", ".", "input_block", ".", "instantiate", "(", ")", "backbone", "=", "self", ".", "backbone", ".", "instantiate", "(", "*", "*", "extra_args", ")", "retur...
Instantiate the model
[ "Instantiate", "the", "model" ]
python
train
peterjc/flake8-rst-docstrings
flake8_rst_docstrings.py
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L265-L288
def dequote_docstring(text): """Remove the quotes delimiting a docstring.""" # TODO: Process escaped characters unless raw mode? text = text.strip() if len(text) > 6 and text[:3] == text[-3:] == '"""': # Standard case, """...""" return text[3:-3] if len(text) > 7 and text[:4] in ('u"...
[ "def", "dequote_docstring", "(", "text", ")", ":", "# TODO: Process escaped characters unless raw mode?", "text", "=", "text", ".", "strip", "(", ")", "if", "len", "(", "text", ")", ">", "6", "and", "text", "[", ":", "3", "]", "==", "text", "[", "-", "3"...
Remove the quotes delimiting a docstring.
[ "Remove", "the", "quotes", "delimiting", "a", "docstring", "." ]
python
valid
senaite/senaite.core
bika/lims/browser/worksheet/views/results.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/worksheet/views/results.py#L117-L124
def is_assignment_allowed(self): """Check if analyst assignment is allowed """ if not self.is_manage_allowed(): return False review_state = api.get_workflow_status_of(self.context) edit_states = ["open", "attachment_due", "to_be_verified"] return review_state ...
[ "def", "is_assignment_allowed", "(", "self", ")", ":", "if", "not", "self", ".", "is_manage_allowed", "(", ")", ":", "return", "False", "review_state", "=", "api", ".", "get_workflow_status_of", "(", "self", ".", "context", ")", "edit_states", "=", "[", "\"o...
Check if analyst assignment is allowed
[ "Check", "if", "analyst", "assignment", "is", "allowed" ]
python
train
pavelsof/ipalint
ipalint/read.py
https://github.com/pavelsof/ipalint/blob/763e5979ede6980cbfc746b06fd007b379762eeb/ipalint/read.py#L136-L174
def get_dialect(self): """ Returns a Dialect named tuple or None if the dataset file comprises a single column of data. If the dialect is not already known, then tries to determine it. Raises ValueError if it fails in the latter case. """ if self.is_single_col: return None if self.delimiter and self.q...
[ "def", "get_dialect", "(", "self", ")", ":", "if", "self", ".", "is_single_col", ":", "return", "None", "if", "self", ".", "delimiter", "and", "self", ".", "quotechar", ":", "return", "Dialect", "(", "self", ".", "delimiter", ",", "self", ".", "quotechar...
Returns a Dialect named tuple or None if the dataset file comprises a single column of data. If the dialect is not already known, then tries to determine it. Raises ValueError if it fails in the latter case.
[ "Returns", "a", "Dialect", "named", "tuple", "or", "None", "if", "the", "dataset", "file", "comprises", "a", "single", "column", "of", "data", ".", "If", "the", "dialect", "is", "not", "already", "known", "then", "tries", "to", "determine", "it", ".", "R...
python
train
SmartTeleMax/iktomi
iktomi/db/sqla/declarative.py
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/db/sqla/declarative.py#L66-L118
def TableArgsMeta(table_args): '''Declarative metaclass automatically adding (merging) __table_args__ to mapped classes. Example: Meta = TableArgsMeta({ 'mysql_engine': 'InnoDB', 'mysql_default charset': 'utf8', } Base = declarative_base(name='Base', metaclass=M...
[ "def", "TableArgsMeta", "(", "table_args", ")", ":", "class", "_TableArgsMeta", "(", "declarative", ".", "DeclarativeMeta", ")", ":", "def", "__init__", "(", "cls", ",", "name", ",", "bases", ",", "dict_", ")", ":", "if", "(", "# Do not extend base class", "...
Declarative metaclass automatically adding (merging) __table_args__ to mapped classes. Example: Meta = TableArgsMeta({ 'mysql_engine': 'InnoDB', 'mysql_default charset': 'utf8', } Base = declarative_base(name='Base', metaclass=Meta) class MyClass(Base): ...
[ "Declarative", "metaclass", "automatically", "adding", "(", "merging", ")", "__table_args__", "to", "mapped", "classes", ".", "Example", ":" ]
python
train
teepark/greenhouse
greenhouse/scheduler.py
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L662-L682
def global_exception_handler(handler): """add a callback for when an exception goes uncaught in any greenlet :param handler: the callback function. must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` the traceback obj...
[ "def", "global_exception_handler", "(", "handler", ")", ":", "if", "not", "hasattr", "(", "handler", ",", "\"__call__\"", ")", ":", "raise", "TypeError", "(", "\"exception handlers must be callable\"", ")", "log", ".", "info", "(", "\"setting a new global exception ha...
add a callback for when an exception goes uncaught in any greenlet :param handler: the callback function. must be a function taking 3 arguments: - ``klass`` the exception class - ``exc`` the exception instance - ``tb`` the traceback object :type handler: function Note also...
[ "add", "a", "callback", "for", "when", "an", "exception", "goes", "uncaught", "in", "any", "greenlet" ]
python
train
payu-org/payu
payu/cli.py
https://github.com/payu-org/payu/blob/1442a9a226012eff248b8097cc1eaabc3e224867/payu/cli.py#L124-L200
def submit_job(pbs_script, pbs_config, pbs_vars=None): """Submit a userscript the scheduler.""" # Initialisation if pbs_vars is None: pbs_vars = {} pbs_flags = [] pbs_queue = pbs_config.get('queue', 'normal') pbs_flags.append('-q {queue}'.format(queue=pbs_queue)) pbs_project = pb...
[ "def", "submit_job", "(", "pbs_script", ",", "pbs_config", ",", "pbs_vars", "=", "None", ")", ":", "# Initialisation", "if", "pbs_vars", "is", "None", ":", "pbs_vars", "=", "{", "}", "pbs_flags", "=", "[", "]", "pbs_queue", "=", "pbs_config", ".", "get", ...
Submit a userscript the scheduler.
[ "Submit", "a", "userscript", "the", "scheduler", "." ]
python
train
PrefPy/prefpy
prefpy/gmm_mixpl.py
https://github.com/PrefPy/prefpy/blob/f395ba3782f05684fa5de0cece387a6da9391d02/prefpy/gmm_mixpl.py#L33-L49
def calcMomentsMatlabEmpirical(params): """Top 3 alternatives 20 empirical moment conditions""" alpha = params[0] a = params[1:5] b = params[5:] p1 = alpha*a+(1-alpha)*b p21 = alpha*a[0]*a[1:]/(1-a[0])+(1-alpha)*b[0]*b[1:]/(1-b[0]) p22 = alpha*a[1]*np.hstack((a[0],a[2:]))/(1-a[1])+(1-alpha)*...
[ "def", "calcMomentsMatlabEmpirical", "(", "params", ")", ":", "alpha", "=", "params", "[", "0", "]", "a", "=", "params", "[", "1", ":", "5", "]", "b", "=", "params", "[", "5", ":", "]", "p1", "=", "alpha", "*", "a", "+", "(", "1", "-", "alpha",...
Top 3 alternatives 20 empirical moment conditions
[ "Top", "3", "alternatives", "20", "empirical", "moment", "conditions" ]
python
train
awslabs/sockeye
docs/tutorials/cpu_process_per_core_translation.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/docs/tutorials/cpu_process_per_core_translation.py#L37-L58
def benchmark(cores, args): """ benchmark is used for Processing per core translation. Each core translates the whole input file. Return after all translations done. :param cores: the number of cores used for translation, each core will launch a thread to translate :param args: input parameters ...
[ "def", "benchmark", "(", "cores", ",", "args", ")", ":", "model", "=", "args", ".", "module", "fileInput", "=", "args", ".", "input_file", "fileOutput", "=", "args", ".", "output_file", "batchsize", "=", "args", ".", "batch_size", "thread", "=", "[", "]"...
benchmark is used for Processing per core translation. Each core translates the whole input file. Return after all translations done. :param cores: the number of cores used for translation, each core will launch a thread to translate :param args: input parameters
[ "benchmark", "is", "used", "for", "Processing", "per", "core", "translation", ".", "Each", "core", "translates", "the", "whole", "input", "file", ".", "Return", "after", "all", "translations", "done", "." ]
python
train
jmgilman/Neolib
neolib/pyamf/remoting/client/__init__.py
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/remoting/client/__init__.py#L253-L260
def addHeader(self, name, value, must_understand=False): """ Sets a persistent header to send with each request. @param name: Header name. """ self.headers[name] = value self.headers.set_required(name, must_understand)
[ "def", "addHeader", "(", "self", ",", "name", ",", "value", ",", "must_understand", "=", "False", ")", ":", "self", ".", "headers", "[", "name", "]", "=", "value", "self", ".", "headers", ".", "set_required", "(", "name", ",", "must_understand", ")" ]
Sets a persistent header to send with each request. @param name: Header name.
[ "Sets", "a", "persistent", "header", "to", "send", "with", "each", "request", "." ]
python
train
apriha/lineage
src/lineage/snps.py
https://github.com/apriha/lineage/blob/13106a62a959a80ac26c68d1566422de08aa877b/src/lineage/snps.py#L597-L613
def get_chromosomes(snps): """ Get the chromosomes of SNPs. Parameters ---------- snps : pandas.DataFrame Returns ------- list list of str chromosomes (e.g., ['1', '2', '3', 'MT'], empty list if no chromosomes """ if isinstance(snps, pd.DataFrame): return list(pd.u...
[ "def", "get_chromosomes", "(", "snps", ")", ":", "if", "isinstance", "(", "snps", ",", "pd", ".", "DataFrame", ")", ":", "return", "list", "(", "pd", ".", "unique", "(", "snps", "[", "\"chrom\"", "]", ")", ")", "else", ":", "return", "[", "]" ]
Get the chromosomes of SNPs. Parameters ---------- snps : pandas.DataFrame Returns ------- list list of str chromosomes (e.g., ['1', '2', '3', 'MT'], empty list if no chromosomes
[ "Get", "the", "chromosomes", "of", "SNPs", "." ]
python
train
bwohlberg/sporco
sporco/admm/admm.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/admm.py#L604-L616
def display_status(self, fmtstr, itst): """Display current iteration status as selection of fields from iteration stats tuple. """ if self.opt['Verbose']: hdrtxt = type(self).hdrtxt() hdrval = type(self).hdrval() itdsp = tuple([getattr(itst, hdrval[co...
[ "def", "display_status", "(", "self", ",", "fmtstr", ",", "itst", ")", ":", "if", "self", ".", "opt", "[", "'Verbose'", "]", ":", "hdrtxt", "=", "type", "(", "self", ")", ".", "hdrtxt", "(", ")", "hdrval", "=", "type", "(", "self", ")", ".", "hdr...
Display current iteration status as selection of fields from iteration stats tuple.
[ "Display", "current", "iteration", "status", "as", "selection", "of", "fields", "from", "iteration", "stats", "tuple", "." ]
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/Usuario.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Usuario.py#L121-L146
def list_with_usergroup(self): """List all users and their user groups. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, ...
[ "def", "list_with_usergroup", "(", "self", ")", ":", "url", "=", "'usuario/get/'", "code", ",", "xml", "=", "self", ".", "submit", "(", "None", ",", "'GET'", ",", "url", ")", "return", "self", ".", "response", "(", "code", ",", "xml", ")" ]
List all users and their user groups. is_more -If more than 3 of groups of users or no, to control expansion Screen. :return: Dictionary with the following structure: :: {'usuario': [{'nome': < nome >, 'id': < id >, 'pwd': < pwd >, 'user': < us...
[ "List", "all", "users", "and", "their", "user", "groups", ".", "is_more", "-", "If", "more", "than", "3", "of", "groups", "of", "users", "or", "no", "to", "control", "expansion", "Screen", "." ]
python
train
nakagami/pyfirebirdsql
firebirdsql/srp.py
https://github.com/nakagami/pyfirebirdsql/blob/5ce366c2fc8318510444f4a89801442f3e9e52ca/firebirdsql/srp.py#L218-L249
def client_session(user, password, salt, A, B, a): """ Client session secret Both: u = H(A, B) User: x = H(s, p) (user enters password) User: S = (B - kg^x) ^ (a + ux) (computes session key) User: K = H(S) """ N, g, k = get_prime() u = get_scram...
[ "def", "client_session", "(", "user", ",", "password", ",", "salt", ",", "A", ",", "B", ",", "a", ")", ":", "N", ",", "g", ",", "k", "=", "get_prime", "(", ")", "u", "=", "get_scramble", "(", "A", ",", "B", ")", "x", "=", "getUserHash", "(", ...
Client session secret Both: u = H(A, B) User: x = H(s, p) (user enters password) User: S = (B - kg^x) ^ (a + ux) (computes session key) User: K = H(S)
[ "Client", "session", "secret", "Both", ":", "u", "=", "H", "(", "A", "B", ")" ]
python
train
mushkevych/scheduler
synergy/system/time_helper.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/time_helper.py#L138-L155
def cast_to_time_qualifier(time_qualifier, timeperiod): """ method casts given timeperiod accordingly to time qualifier. For example, will cast session time format of 20100101193412 to 2010010119 with QUALIFIER_HOURLY """ if time_qualifier == QUALIFIER_HOURLY: date_format = SYNERGY_HOURLY_PATTERN ...
[ "def", "cast_to_time_qualifier", "(", "time_qualifier", ",", "timeperiod", ")", ":", "if", "time_qualifier", "==", "QUALIFIER_HOURLY", ":", "date_format", "=", "SYNERGY_HOURLY_PATTERN", "elif", "time_qualifier", "==", "QUALIFIER_DAILY", ":", "date_format", "=", "SYNERGY...
method casts given timeperiod accordingly to time qualifier. For example, will cast session time format of 20100101193412 to 2010010119 with QUALIFIER_HOURLY
[ "method", "casts", "given", "timeperiod", "accordingly", "to", "time", "qualifier", ".", "For", "example", "will", "cast", "session", "time", "format", "of", "20100101193412", "to", "2010010119", "with", "QUALIFIER_HOURLY" ]
python
train
zeaphoo/reston
reston/core/dvm.py
https://github.com/zeaphoo/reston/blob/96502487b2259572df55237c9526f92627465088/reston/core/dvm.py#L6655-L6662
def show(self, m_a): """ Display (with a pretty print) this object :param m_a: :class:`MethodAnalysis` object """ bytecode.PrettyShow(m_a, m_a.basic_blocks.gets(), self.notes) bytecode.PrettyShowEx(m_a.exceptions.gets())
[ "def", "show", "(", "self", ",", "m_a", ")", ":", "bytecode", ".", "PrettyShow", "(", "m_a", ",", "m_a", ".", "basic_blocks", ".", "gets", "(", ")", ",", "self", ".", "notes", ")", "bytecode", ".", "PrettyShowEx", "(", "m_a", ".", "exceptions", ".", ...
Display (with a pretty print) this object :param m_a: :class:`MethodAnalysis` object
[ "Display", "(", "with", "a", "pretty", "print", ")", "this", "object" ]
python
train
RRZE-HPC/kerncraft
kerncraft/kerncraft.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kerncraft.py#L205-L305
def run(parser, args, output_file=sys.stdout): """Run command line interface.""" # Try loading results file (if requested) result_storage = {} if args.store: args.store.seek(0) try: result_storage = pickle.load(args.store) except EOFError: pass arg...
[ "def", "run", "(", "parser", ",", "args", ",", "output_file", "=", "sys", ".", "stdout", ")", ":", "# Try loading results file (if requested)", "result_storage", "=", "{", "}", "if", "args", ".", "store", ":", "args", ".", "store", ".", "seek", "(", "0", ...
Run command line interface.
[ "Run", "command", "line", "interface", "." ]
python
test
apple/turicreate
src/unity/python/turicreate/_sys_util.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L452-L463
def get_library_name(): """ Returns either sframe or turicreate depending on which library this file is bundled with. """ from os.path import split, abspath __lib_name = split(split(abspath(sys.modules[__name__].__file__))[0])[1] assert __lib_name in ["sframe", "turicreate"] return __...
[ "def", "get_library_name", "(", ")", ":", "from", "os", ".", "path", "import", "split", ",", "abspath", "__lib_name", "=", "split", "(", "split", "(", "abspath", "(", "sys", ".", "modules", "[", "__name__", "]", ".", "__file__", ")", ")", "[", "0", "...
Returns either sframe or turicreate depending on which library this file is bundled with.
[ "Returns", "either", "sframe", "or", "turicreate", "depending", "on", "which", "library", "this", "file", "is", "bundled", "with", "." ]
python
train
Erotemic/utool
utool/util_hash.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_hash.py#L511-L655
def hashstr(data, hashlen=HASH_LEN, alphabet=ALPHABET): """ python -c "import utool as ut; print(ut.hashstr('abcd'))" Args: data (hashable): hashlen (int): (default = 16) alphabet (list): list of characters: Returns: str: hashstr CommandLine: python -m utoo...
[ "def", "hashstr", "(", "data", ",", "hashlen", "=", "HASH_LEN", ",", "alphabet", "=", "ALPHABET", ")", ":", "if", "util_type", ".", "HAVE_NUMPY", "and", "isinstance", "(", "data", ",", "np", ".", "ndarray", ")", ":", "if", "data", ".", "dtype", ".", ...
python -c "import utool as ut; print(ut.hashstr('abcd'))" Args: data (hashable): hashlen (int): (default = 16) alphabet (list): list of characters: Returns: str: hashstr CommandLine: python -m utool.util_hash --test-hashstr python3 -m utool.util_hash --test...
[ "python", "-", "c", "import", "utool", "as", "ut", ";", "print", "(", "ut", ".", "hashstr", "(", "abcd", "))" ]
python
train
tcalmant/ipopo
pelix/rsa/__init__.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L860-L888
def fromimportupdate(cls, bundle, import_reg): # type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent """ Creates a RemoteServiceAdminEvent object from the update of an ImportRegistration """ exc = import_reg.get_exception() if exc: return Rem...
[ "def", "fromimportupdate", "(", "cls", ",", "bundle", ",", "import_reg", ")", ":", "# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent", "exc", "=", "import_reg", ".", "get_exception", "(", ")", "if", "exc", ":", "return", "RemoteServiceAdminEvent", "(", ...
Creates a RemoteServiceAdminEvent object from the update of an ImportRegistration
[ "Creates", "a", "RemoteServiceAdminEvent", "object", "from", "the", "update", "of", "an", "ImportRegistration" ]
python
train
pystorm/pystorm
pystorm/bolt.py
https://github.com/pystorm/pystorm/blob/0f853e007c79e03cefdb4a0794423f84dce4c2f3/pystorm/bolt.py#L217-L226
def _handle_run_exception(self, exc): """Process an exception encountered while running the ``run()`` loop. Called right before program exits. """ if len(self._current_tups) == 1: tup = self._current_tups[0] self.raise_exception(exc, tup) if self.auto...
[ "def", "_handle_run_exception", "(", "self", ",", "exc", ")", ":", "if", "len", "(", "self", ".", "_current_tups", ")", "==", "1", ":", "tup", "=", "self", ".", "_current_tups", "[", "0", "]", "self", ".", "raise_exception", "(", "exc", ",", "tup", "...
Process an exception encountered while running the ``run()`` loop. Called right before program exits.
[ "Process", "an", "exception", "encountered", "while", "running", "the", "run", "()", "loop", "." ]
python
train