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
pjuren/pyokit
src/pyokit/io/genomeAlignment.py
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/genomeAlignment.py#L75-L92
def __split_genomic_interval_filename(fn): """ Split a filename of the format chrom:start-end.ext or chrom.ext (full chrom). :return: tuple of (chrom, start, end) -- 'start' and 'end' are None if not present in the filename. """ if fn is None or fn == "": raise ValueError("invalid filename: " ...
[ "def", "__split_genomic_interval_filename", "(", "fn", ")", ":", "if", "fn", "is", "None", "or", "fn", "==", "\"\"", ":", "raise", "ValueError", "(", "\"invalid filename: \"", "+", "str", "(", "fn", ")", ")", "fn", "=", "\".\"", ".", "join", "(", "fn", ...
Split a filename of the format chrom:start-end.ext or chrom.ext (full chrom). :return: tuple of (chrom, start, end) -- 'start' and 'end' are None if not present in the filename.
[ "Split", "a", "filename", "of", "the", "format", "chrom", ":", "start", "-", "end", ".", "ext", "or", "chrom", ".", "ext", "(", "full", "chrom", ")", "." ]
python
train
simoninireland/epyc
epyc/clusterlab.py
https://github.com/simoninireland/epyc/blob/b3b61007741a0ab3de64df89070a6f30de8ec268/epyc/clusterlab.py#L367-L378
def cancelAllPendingResults( self ): """Cancel all pending results.""" # grab all the pending job ids jobs = self.pendingResults() if len(jobs) > 0: # abort in the cluster self._abortJobs(jobs) # cancel in the notebook ...
[ "def", "cancelAllPendingResults", "(", "self", ")", ":", "# grab all the pending job ids", "jobs", "=", "self", ".", "pendingResults", "(", ")", "if", "len", "(", "jobs", ")", ">", "0", ":", "# abort in the cluster", "self", ".", "_abortJobs", "(", "jobs", ")"...
Cancel all pending results.
[ "Cancel", "all", "pending", "results", "." ]
python
train
escaped/django-video-encoding
video_encoding/files.py
https://github.com/escaped/django-video-encoding/blob/50d228dd91aca40acc7f9293808b1e87cb645e5d/video_encoding/files.py#L35-L46
def _get_video_info(self): """ Returns basic information about the video as dictionary. """ if not hasattr(self, '_info_cache'): encoding_backend = get_backend() try: path = os.path.abspath(self.path) except AttributeError: ...
[ "def", "_get_video_info", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_info_cache'", ")", ":", "encoding_backend", "=", "get_backend", "(", ")", "try", ":", "path", "=", "os", ".", "path", ".", "abspath", "(", "self", ".", "path"...
Returns basic information about the video as dictionary.
[ "Returns", "basic", "information", "about", "the", "video", "as", "dictionary", "." ]
python
train
myaooo/pysbrl
pysbrl/rule_list.py
https://github.com/myaooo/pysbrl/blob/74bba8c6913a7f82e32313108f8c3e025b89d9c7/pysbrl/rule_list.py#L268-L285
def caught_matrix(self, x): # type: (np.ndarray) -> np.ndarray """ compute the caught matrix of x Each rule has an array of bools, showing whether each instances is caught by this rule :param x: 2D np.ndarray (n_instances, n_features) should be categorical data, must be of type i...
[ "def", "caught_matrix", "(", "self", ",", "x", ")", ":", "# type: (np.ndarray) -> np.ndarray", "un_satisfied", "=", "np", ".", "ones", "(", "(", "x", ".", "shape", "[", "0", "]", ",", ")", ",", "dtype", "=", "np", ".", "bool", ")", "supports", "=", "...
compute the caught matrix of x Each rule has an array of bools, showing whether each instances is caught by this rule :param x: 2D np.ndarray (n_instances, n_features) should be categorical data, must be of type int :return: a bool np.ndarray of shape (n_rules, n_instances)
[ "compute", "the", "caught", "matrix", "of", "x", "Each", "rule", "has", "an", "array", "of", "bools", "showing", "whether", "each", "instances", "is", "caught", "by", "this", "rule", ":", "param", "x", ":", "2D", "np", ".", "ndarray", "(", "n_instances",...
python
train
gwastro/pycbc
pycbc/tmpltbank/option_utils.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/tmpltbank/option_utils.py#L296-L314
def evals(self): """ The eigenvalues of the parameter space. This is a Dictionary of numpy.array Each entry in the dictionary corresponds to the different frequency ranges described in vary_fmax. If vary_fmax = False, the only entry will be f_upper, this corresponds to in...
[ "def", "evals", "(", "self", ")", ":", "if", "self", ".", "_evals", "is", "None", ":", "errMsg", "=", "\"The metric eigenvalues have not been set in the \"", "errMsg", "+=", "\"metricParameters instance.\"", "raise", "ValueError", "(", "errMsg", ")", "return", "self...
The eigenvalues of the parameter space. This is a Dictionary of numpy.array Each entry in the dictionary corresponds to the different frequency ranges described in vary_fmax. If vary_fmax = False, the only entry will be f_upper, this corresponds to integrals in [f_low,f_upper). This ...
[ "The", "eigenvalues", "of", "the", "parameter", "space", ".", "This", "is", "a", "Dictionary", "of", "numpy", ".", "array", "Each", "entry", "in", "the", "dictionary", "corresponds", "to", "the", "different", "frequency", "ranges", "described", "in", "vary_fma...
python
train
inveniosoftware/invenio-records-rest
invenio_records_rest/serializers/datacite.py
https://github.com/inveniosoftware/invenio-records-rest/blob/e7b63c5f72cef03d06d3f1b4c12c0d37e3a628b9/invenio_records_rest/serializers/datacite.py#L44-L60
def serialize_search(self, pid_fetcher, search_result, links=None, item_links_factory=None): """Serialize a search result. :param pid_fetcher: Persistent identifier fetcher. :param search_result: Elasticsearch search result. :param links: Dictionary of links to ...
[ "def", "serialize_search", "(", "self", ",", "pid_fetcher", ",", "search_result", ",", "links", "=", "None", ",", "item_links_factory", "=", "None", ")", ":", "records", "=", "[", "]", "for", "hit", "in", "search_result", "[", "'hits'", "]", "[", "'hits'",...
Serialize a search result. :param pid_fetcher: Persistent identifier fetcher. :param search_result: Elasticsearch search result. :param links: Dictionary of links to add to response.
[ "Serialize", "a", "search", "result", "." ]
python
train
mrname/haralyzer
haralyzer/assets.py
https://github.com/mrname/haralyzer/blob/5ef38b8cfc044d2dfeacf2dd4d1efb810228309d/haralyzer/assets.py#L449-L468
def time_to_first_byte(self): """ Time to first byte of the page request in ms """ # The unknown page is just a placeholder for entries with no page ID. # As such, it would not have a TTFB if self.page_id == 'unknown': return None ttfb = 0 for ...
[ "def", "time_to_first_byte", "(", "self", ")", ":", "# The unknown page is just a placeholder for entries with no page ID.", "# As such, it would not have a TTFB", "if", "self", ".", "page_id", "==", "'unknown'", ":", "return", "None", "ttfb", "=", "0", "for", "entry", "i...
Time to first byte of the page request in ms
[ "Time", "to", "first", "byte", "of", "the", "page", "request", "in", "ms" ]
python
train
xtrementl/focus
focus/plugin/modules/apps.py
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/apps.py#L188-L195
def parse_option(self, option, block_name, *values): """ Parse app path values for option. """ if option == 'run': option = 'start_' + option key = option.split('_', 1)[0] self.paths[key] = set(common.extract_app_paths(values))
[ "def", "parse_option", "(", "self", ",", "option", ",", "block_name", ",", "*", "values", ")", ":", "if", "option", "==", "'run'", ":", "option", "=", "'start_'", "+", "option", "key", "=", "option", ".", "split", "(", "'_'", ",", "1", ")", "[", "0...
Parse app path values for option.
[ "Parse", "app", "path", "values", "for", "option", "." ]
python
train
spotify/snakebite
snakebite/minicluster.py
https://github.com/spotify/snakebite/blob/6a456e6100b0c1be66cc1f7f9d7f50494f369da3/snakebite/minicluster.py#L116-L118
def is_zero_bytes_file(self, path): """Return True if file <path> is zero bytes in size, else return False""" return self._getReturnCodeCmd([self._hadoop_cmd, 'fs', '-test', '-z', self._full_hdfs_path(path)]) == 0
[ "def", "is_zero_bytes_file", "(", "self", ",", "path", ")", ":", "return", "self", ".", "_getReturnCodeCmd", "(", "[", "self", ".", "_hadoop_cmd", ",", "'fs'", ",", "'-test'", ",", "'-z'", ",", "self", ".", "_full_hdfs_path", "(", "path", ")", "]", ")", ...
Return True if file <path> is zero bytes in size, else return False
[ "Return", "True", "if", "file", "<path", ">", "is", "zero", "bytes", "in", "size", "else", "return", "False" ]
python
train
qiniu/python-sdk
qiniu/services/storage/bucket.py
https://github.com/qiniu/python-sdk/blob/a69fbef4e3e6ea1ebe09f4610a5b18bb2c17de59/qiniu/services/storage/bucket.py#L67-L89
def stat(self, bucket, key): """获取文件信息: 获取资源的元信息,但不返回文件内容,具体规格参考: https://developer.qiniu.com/kodo/api/1308/stat Args: bucket: 待获取信息资源所在的空间 key: 待获取资源的文件名 Returns: 一个dict变量,类似: { "fsize": 5122935...
[ "def", "stat", "(", "self", ",", "bucket", ",", "key", ")", ":", "resource", "=", "entry", "(", "bucket", ",", "key", ")", "return", "self", ".", "__rs_do", "(", "'stat'", ",", "resource", ")" ]
获取文件信息: 获取资源的元信息,但不返回文件内容,具体规格参考: https://developer.qiniu.com/kodo/api/1308/stat Args: bucket: 待获取信息资源所在的空间 key: 待获取资源的文件名 Returns: 一个dict变量,类似: { "fsize": 5122935, "hash": "l...
[ "获取文件信息", ":" ]
python
train
dddomodossola/remi
remi/gui.py
https://github.com/dddomodossola/remi/blob/85206f62220662bb7ecd471042268def71ccad28/remi/gui.py#L315-L340
def repr(self, changed_widgets=None): """It is used to automatically represent the object to HTML format packs all the attributes, children and so on. Args: changed_widgets (dict): A dictionary containing a collection of tags that have to be updated. The tag that hav...
[ "def", "repr", "(", "self", ",", "changed_widgets", "=", "None", ")", ":", "if", "changed_widgets", "is", "None", ":", "changed_widgets", "=", "{", "}", "local_changed_widgets", "=", "{", "}", "_innerHTML", "=", "self", ".", "innerHTML", "(", "local_changed_...
It is used to automatically represent the object to HTML format packs all the attributes, children and so on. Args: changed_widgets (dict): A dictionary containing a collection of tags that have to be updated. The tag that have to be updated is the key, and the value is its ...
[ "It", "is", "used", "to", "automatically", "represent", "the", "object", "to", "HTML", "format", "packs", "all", "the", "attributes", "children", "and", "so", "on", "." ]
python
train
openstax/cnx-publishing
cnxpublishing/db.py
https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/db.py#L1251-L1289
def _upsert_persons(cursor, person_ids, lookup_func): """Upsert's user info into the database. The model contains the user info as part of the role values. """ person_ids = list(set(person_ids)) # cleanse data # Check for existing records to update. cursor.execute("SELECT personid from persons...
[ "def", "_upsert_persons", "(", "cursor", ",", "person_ids", ",", "lookup_func", ")", ":", "person_ids", "=", "list", "(", "set", "(", "person_ids", ")", ")", "# cleanse data", "# Check for existing records to update.", "cursor", ".", "execute", "(", "\"SELECT person...
Upsert's user info into the database. The model contains the user info as part of the role values.
[ "Upsert", "s", "user", "info", "into", "the", "database", ".", "The", "model", "contains", "the", "user", "info", "as", "part", "of", "the", "role", "values", "." ]
python
valid
rsheftel/raccoon
raccoon/series.py
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L418-L428
def sort_index(self): """ Sort the Series by the index. The sort modifies the Series inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in...
[ "def", "sort_index", "(", "self", ")", ":", "sort", "=", "sorted_list_indexes", "(", "self", ".", "_index", ")", "# sort index", "self", ".", "_index", "=", "blist", "(", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "sort", "]", ")", ...
Sort the Series by the index. The sort modifies the Series inplace :return: nothing
[ "Sort", "the", "Series", "by", "the", "index", ".", "The", "sort", "modifies", "the", "Series", "inplace" ]
python
train
chriso/gauged
gauged/gauged.py
https://github.com/chriso/gauged/blob/cda3bba2f3e92ce2fb4aa92132dcc0e689bf7976/gauged/gauged.py#L135-L154
def check_schema(self): """Check the schema exists and matches configuration""" if self.valid_schema: return config = self.config metadata = self.metadata() if 'current_version' not in metadata: raise GaugedSchemaError('Gauged schema not found, ' ...
[ "def", "check_schema", "(", "self", ")", ":", "if", "self", ".", "valid_schema", ":", "return", "config", "=", "self", ".", "config", "metadata", "=", "self", ".", "metadata", "(", ")", "if", "'current_version'", "not", "in", "metadata", ":", "raise", "G...
Check the schema exists and matches configuration
[ "Check", "the", "schema", "exists", "and", "matches", "configuration" ]
python
train
angr/pyvex
pyvex/block.py
https://github.com/angr/pyvex/blob/c418edc1146982b2a0579bf56e5993c1c7046b19/pyvex/block.py#L372-L378
def size(self): """ The size of this block, in bytes """ if self._size is None: self._size = sum(s.len for s in self.statements if type(s) is stmt.IMark) return self._size
[ "def", "size", "(", "self", ")", ":", "if", "self", ".", "_size", "is", "None", ":", "self", ".", "_size", "=", "sum", "(", "s", ".", "len", "for", "s", "in", "self", ".", "statements", "if", "type", "(", "s", ")", "is", "stmt", ".", "IMark", ...
The size of this block, in bytes
[ "The", "size", "of", "this", "block", "in", "bytes" ]
python
train
mlperf/training
translation/tensorflow/transformer/utils/metrics.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/translation/tensorflow/transformer/utils/metrics.py#L176-L179
def padded_neg_log_perplexity(logits, labels, vocab_size): """Average log-perplexity excluding padding 0s. No smoothing.""" num, den = padded_cross_entropy_loss(logits, labels, 0, vocab_size) return -num, den
[ "def", "padded_neg_log_perplexity", "(", "logits", ",", "labels", ",", "vocab_size", ")", ":", "num", ",", "den", "=", "padded_cross_entropy_loss", "(", "logits", ",", "labels", ",", "0", ",", "vocab_size", ")", "return", "-", "num", ",", "den" ]
Average log-perplexity excluding padding 0s. No smoothing.
[ "Average", "log", "-", "perplexity", "excluding", "padding", "0s", ".", "No", "smoothing", "." ]
python
train
ctuning/ck
ck/kernel.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/kernel.py#L3268-L3491
def perform_action(i): """ Input: { all parameters from function 'access' (web) - if 'yes', called from the web (common_func) - if 'yes', ignore search for modules and call common func from the CK kernel ...
[ "def", "perform_action", "(", "i", ")", ":", "# Check action", "action", "=", "i", ".", "get", "(", "'action'", ",", "''", ")", "if", "action", "==", "''", ":", "action", "=", "'short_help'", "elif", "action", "==", "'-?'", "or", "action", "==", "'-h'"...
Input: { all parameters from function 'access' (web) - if 'yes', called from the web (common_func) - if 'yes', ignore search for modules and call common func from the CK kernel (local) - if 'yes', run loca...
[ "Input", ":", "{", "all", "parameters", "from", "function", "access" ]
python
train
vberlier/nbtlib
nbtlib/literal/serializer.py
https://github.com/vberlier/nbtlib/blob/9c9d58b5c4a530b0f1ffd76dda176f00406c3547/nbtlib/literal/serializer.py#L71-L81
def depth(self): """Increase the level of indentation by one.""" if self.indentation is None: yield else: previous = self.previous_indent self.previous_indent = self.indent self.indent += self.indentation yield self.indent =...
[ "def", "depth", "(", "self", ")", ":", "if", "self", ".", "indentation", "is", "None", ":", "yield", "else", ":", "previous", "=", "self", ".", "previous_indent", "self", ".", "previous_indent", "=", "self", ".", "indent", "self", ".", "indent", "+=", ...
Increase the level of indentation by one.
[ "Increase", "the", "level", "of", "indentation", "by", "one", "." ]
python
train
rehandalal/therapist
therapist/utils/hook.py
https://github.com/rehandalal/therapist/blob/1995a7e396eea2ec8685bb32a779a4110b459b1f/therapist/utils/hook.py#L6-L12
def identify_hook(path): """Verify that the file at path is the therapist hook and return the hash""" with open(path, 'r') as f: f.readline() # Discard the shebang line version_line = f.readline() if version_line.startswith('# THERAPIST'): return version_line.split()[2]
[ "def", "identify_hook", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "f", ".", "readline", "(", ")", "# Discard the shebang line", "version_line", "=", "f", ".", "readline", "(", ")", "if", "version_line", ".", "...
Verify that the file at path is the therapist hook and return the hash
[ "Verify", "that", "the", "file", "at", "path", "is", "the", "therapist", "hook", "and", "return", "the", "hash" ]
python
train
Faylixe/pygame_vkeyboard
pygame_vkeyboard/vkeyboard.py
https://github.com/Faylixe/pygame_vkeyboard/blob/72753a47b4d1d8bf22c9c51ca877aef742481d2a/pygame_vkeyboard/vkeyboard.py#L647-L654
def set_key_state(self, key, state): """Sets the key state and redraws it. :param key: Key to update state for. :param state: New key state. """ key.state = state self.renderer.draw_key(self.surface, key)
[ "def", "set_key_state", "(", "self", ",", "key", ",", "state", ")", ":", "key", ".", "state", "=", "state", "self", ".", "renderer", ".", "draw_key", "(", "self", ".", "surface", ",", "key", ")" ]
Sets the key state and redraws it. :param key: Key to update state for. :param state: New key state.
[ "Sets", "the", "key", "state", "and", "redraws", "it", "." ]
python
train
quantopian/zipline
zipline/algorithm.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/algorithm.py#L1566-L1585
def set_cancel_policy(self, cancel_policy): """Sets the order cancellation policy for the simulation. Parameters ---------- cancel_policy : CancelPolicy The cancellation policy to use. See Also -------- :class:`zipline.api.EODCancel` :class:`...
[ "def", "set_cancel_policy", "(", "self", ",", "cancel_policy", ")", ":", "if", "not", "isinstance", "(", "cancel_policy", ",", "CancelPolicy", ")", ":", "raise", "UnsupportedCancelPolicy", "(", ")", "if", "self", ".", "initialized", ":", "raise", "SetCancelPolic...
Sets the order cancellation policy for the simulation. Parameters ---------- cancel_policy : CancelPolicy The cancellation policy to use. See Also -------- :class:`zipline.api.EODCancel` :class:`zipline.api.NeverCancel`
[ "Sets", "the", "order", "cancellation", "policy", "for", "the", "simulation", "." ]
python
train
joke2k/faker
faker/providers/__init__.py
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/__init__.py#L313-L320
def bothify(self, text='## ??', letters=string.ascii_letters): """ Replaces all placeholders with random numbers and letters. :param text: string to be parsed :returns: string with all numerical and letter placeholders filled in """ return self.lexify(self.numerify(text)...
[ "def", "bothify", "(", "self", ",", "text", "=", "'## ??'", ",", "letters", "=", "string", ".", "ascii_letters", ")", ":", "return", "self", ".", "lexify", "(", "self", ".", "numerify", "(", "text", ")", ",", "letters", "=", "letters", ")" ]
Replaces all placeholders with random numbers and letters. :param text: string to be parsed :returns: string with all numerical and letter placeholders filled in
[ "Replaces", "all", "placeholders", "with", "random", "numbers", "and", "letters", "." ]
python
train
guaix-ucm/numina
numina/core/recipes.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/core/recipes.py#L161-L164
def save_intermediate_img(self, img, name): """Save intermediate FITS objects.""" if self.intermediate_results: img.writeto(name, overwrite=True)
[ "def", "save_intermediate_img", "(", "self", ",", "img", ",", "name", ")", ":", "if", "self", ".", "intermediate_results", ":", "img", ".", "writeto", "(", "name", ",", "overwrite", "=", "True", ")" ]
Save intermediate FITS objects.
[ "Save", "intermediate", "FITS", "objects", "." ]
python
train
jonathanj/txspinneret
txspinneret/resource.py
https://github.com/jonathanj/txspinneret/blob/717008a2c313698984a23e3f3fc62ea3675ed02d/txspinneret/resource.py#L150-L175
def _handleRenderResult(self, request, result): """ Handle the result from `IResource.render`. If the result is a `Deferred` then return `NOT_DONE_YET` and add a callback to write the result to the request when it arrives. """ def _requestFinished(result, cancel): ...
[ "def", "_handleRenderResult", "(", "self", ",", "request", ",", "result", ")", ":", "def", "_requestFinished", "(", "result", ",", "cancel", ")", ":", "cancel", "(", ")", "return", "result", "if", "not", "isinstance", "(", "result", ",", "Deferred", ")", ...
Handle the result from `IResource.render`. If the result is a `Deferred` then return `NOT_DONE_YET` and add a callback to write the result to the request when it arrives.
[ "Handle", "the", "result", "from", "IResource", ".", "render", "." ]
python
valid
zblz/naima
naima/plot.py
https://github.com/zblz/naima/blob/d6a6781d73bf58fd8269e8b0e3b70be22723cd5b/naima/plot.py#L628-L700
def plot_samples( ax, sampler, modelidx=0, sed=True, n_samples=100, e_unit=u.eV, e_range=None, e_npoints=100, threads=None, label=None, last_step=False, ): """Plot a number of samples from the sampler chain. Parameters ---------- ax : `matplotlib.Axes` ...
[ "def", "plot_samples", "(", "ax", ",", "sampler", ",", "modelidx", "=", "0", ",", "sed", "=", "True", ",", "n_samples", "=", "100", ",", "e_unit", "=", "u", ".", "eV", ",", "e_range", "=", "None", ",", "e_npoints", "=", "100", ",", "threads", "=", ...
Plot a number of samples from the sampler chain. Parameters ---------- ax : `matplotlib.Axes` Axes to plot on. sampler : `emcee.EnsembleSampler` Sampler modelidx : int, optional Model index. Default is 0 sed : bool, optional Whether to plot SED or differential sp...
[ "Plot", "a", "number", "of", "samples", "from", "the", "sampler", "chain", "." ]
python
train
SUSE-Enceladus/ipa
ipa/ipa_cloud.py
https://github.com/SUSE-Enceladus/ipa/blob/0845eed0ea25a27dbb059ad1016105fa60002228/ipa/ipa_cloud.py#L197-L204
def _get_ssh_client(self): """Return a new or existing SSH client for given ip.""" return ipa_utils.get_ssh_client( self.instance_ip, self.ssh_private_key_file, self.ssh_user, timeout=self.timeout )
[ "def", "_get_ssh_client", "(", "self", ")", ":", "return", "ipa_utils", ".", "get_ssh_client", "(", "self", ".", "instance_ip", ",", "self", ".", "ssh_private_key_file", ",", "self", ".", "ssh_user", ",", "timeout", "=", "self", ".", "timeout", ")" ]
Return a new or existing SSH client for given ip.
[ "Return", "a", "new", "or", "existing", "SSH", "client", "for", "given", "ip", "." ]
python
train
merll/docker-map
dockermap/map/runner/utils.py
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/runner/utils.py#L170-L220
def get_host_binds(container_map, config_name, config, instance, policy, named_volumes): """ Generates the list of host volumes and named volumes (where applicable) for the host config ``bind`` argument during container creation. :param container_map: Container map. :type container_map: dockermap.m...
[ "def", "get_host_binds", "(", "container_map", ",", "config_name", ",", "config", ",", "instance", ",", "policy", ",", "named_volumes", ")", ":", "def", "volume_str", "(", "paths", ",", "readonly", ")", ":", "return", "'{0[1]}:{0[0]}:{1}'", ".", "format", "(",...
Generates the list of host volumes and named volumes (where applicable) for the host config ``bind`` argument during container creation. :param container_map: Container map. :type container_map: dockermap.map.config.main.ContainerMap :param config: Container configuration. :type config: dockermap.m...
[ "Generates", "the", "list", "of", "host", "volumes", "and", "named", "volumes", "(", "where", "applicable", ")", "for", "the", "host", "config", "bind", "argument", "during", "container", "creation", "." ]
python
train
davidcarboni/Flask-B3
b3/__init__.py
https://github.com/davidcarboni/Flask-B3/blob/55092cb1070568aeecfd2c07c5ad6122e15ca345/b3/__init__.py#L20-L39
def values(): """Get the full current set of B3 values. :return: A dict containing the keys "X-B3-TraceId", "X-B3-ParentSpanId", "X-B3-SpanId", "X-B3-Sampled" and "X-B3-Flags" for the current span or subspan. NB some of the values are likely be None, but all keys will be present. """ result = {}...
[ "def", "values", "(", ")", ":", "result", "=", "{", "}", "try", ":", "# Check if there's a sub-span in progress, otherwise use the main span:", "span", "=", "g", ".", "get", "(", "\"subspan\"", ")", "if", "\"subspan\"", "in", "g", "else", "g", "for", "header", ...
Get the full current set of B3 values. :return: A dict containing the keys "X-B3-TraceId", "X-B3-ParentSpanId", "X-B3-SpanId", "X-B3-Sampled" and "X-B3-Flags" for the current span or subspan. NB some of the values are likely be None, but all keys will be present.
[ "Get", "the", "full", "current", "set", "of", "B3", "values", ".", ":", "return", ":", "A", "dict", "containing", "the", "keys", "X", "-", "B3", "-", "TraceId", "X", "-", "B3", "-", "ParentSpanId", "X", "-", "B3", "-", "SpanId", "X", "-", "B3", "...
python
train
pyQode/pyqode.core
pyqode/core/api/code_edit.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/code_edit.py#L509-L528
def split(self): """ Split the code editor widget, return a clone of the widget ready to be used (and synchronised with its original). Splitting the widget is done in 2 steps: - first we clone the widget, you can override ``clone`` if your widget needs addition...
[ "def", "split", "(", "self", ")", ":", "# cache cursor position so that the clone open at the current cursor", "# pos", "l", ",", "c", "=", "TextHelper", "(", "self", ")", ".", "cursor_position", "(", ")", "clone", "=", "self", ".", "clone", "(", ")", "self", ...
Split the code editor widget, return a clone of the widget ready to be used (and synchronised with its original). Splitting the widget is done in 2 steps: - first we clone the widget, you can override ``clone`` if your widget needs additional arguments. - then we ...
[ "Split", "the", "code", "editor", "widget", "return", "a", "clone", "of", "the", "widget", "ready", "to", "be", "used", "(", "and", "synchronised", "with", "its", "original", ")", "." ]
python
train
jasonlaska/spherecluster
spherecluster/von_mises_fisher_mixture.py
https://github.com/jasonlaska/spherecluster/blob/701b0b1909088a56e353b363b2672580d4fe9d93/spherecluster/von_mises_fisher_mixture.py#L296-L354
def _maximization(X, posterior, force_weights=None): """Estimate new centers, weights, and concentrations from Parameters ---------- posterior : array, [n_centers, n_examples] The posterior matrix from the expectation step. force_weights : None or array, [n_centers, ] If None is pa...
[ "def", "_maximization", "(", "X", ",", "posterior", ",", "force_weights", "=", "None", ")", ":", "n_examples", ",", "n_features", "=", "X", ".", "shape", "n_clusters", ",", "n_examples", "=", "posterior", ".", "shape", "concentrations", "=", "np", ".", "ze...
Estimate new centers, weights, and concentrations from Parameters ---------- posterior : array, [n_centers, n_examples] The posterior matrix from the expectation step. force_weights : None or array, [n_centers, ] If None is passed, will estimate weights. If an array is passed, ...
[ "Estimate", "new", "centers", "weights", "and", "concentrations", "from" ]
python
train
silver-castle/mach9
mach9/websocket.py
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/websocket.py#L88-L105
def get_receive_message(self, data): ''' http://channels.readthedocs.io/en/stable/asgi/www.html#receive ''' self.order += 1 message = { 'channel': 'websocket.receive', 'reply_channel': None, 'path': self.path, 'order': self.order, ...
[ "def", "get_receive_message", "(", "self", ",", "data", ")", ":", "self", ".", "order", "+=", "1", "message", "=", "{", "'channel'", ":", "'websocket.receive'", ",", "'reply_channel'", ":", "None", ",", "'path'", ":", "self", ".", "path", ",", "'order'", ...
http://channels.readthedocs.io/en/stable/asgi/www.html#receive
[ "http", ":", "//", "channels", ".", "readthedocs", ".", "io", "/", "en", "/", "stable", "/", "asgi", "/", "www", ".", "html#receive" ]
python
train
aws/sagemaker-python-sdk
src/sagemaker/estimator.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L473-L513
def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None, output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None, max_payload=None, tags=None, role=None, volume_kms_key=None): """Return a ``Transformer`` ...
[ "def", "transformer", "(", "self", ",", "instance_count", ",", "instance_type", ",", "strategy", "=", "None", ",", "assemble_with", "=", "None", ",", "output_path", "=", "None", ",", "output_kms_key", "=", "None", ",", "accept", "=", "None", ",", "env", "=...
Return a ``Transformer`` that uses a SageMaker Model based on the training job. It reuses the SageMaker Session and base job name used by the Estimator. Args: instance_count (int): Number of EC2 instances to use. instance_type (str): Type of EC2 instance to use, for example, 'ml...
[ "Return", "a", "Transformer", "that", "uses", "a", "SageMaker", "Model", "based", "on", "the", "training", "job", ".", "It", "reuses", "the", "SageMaker", "Session", "and", "base", "job", "name", "used", "by", "the", "Estimator", "." ]
python
train
oasiswork/zimsoap
zimsoap/client.py
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L393-L420
def get_signature(self, signature): """Retrieve one signature, discriminated by name or id. Note that signature name is not case sensitive. :param: a zobjects.Signature describing the signature like "Signature(name='my-sig')" :returns: a zobjects.Signature object, fille...
[ "def", "get_signature", "(", "self", ",", "signature", ")", ":", "resp", "=", "self", ".", "request_list", "(", "'GetSignatures'", ")", "# GetSignature does not allow to filter the results, so we do it by", "# hand...", "if", "resp", "and", "(", "len", "(", "resp", ...
Retrieve one signature, discriminated by name or id. Note that signature name is not case sensitive. :param: a zobjects.Signature describing the signature like "Signature(name='my-sig')" :returns: a zobjects.Signature object, filled with the signature if no sig...
[ "Retrieve", "one", "signature", "discriminated", "by", "name", "or", "id", "." ]
python
train
PatrikValkovic/grammpy
grammpy/transforms/UnitRulesRemove/remove_unit_rules.py
https://github.com/PatrikValkovic/grammpy/blob/879ce0ef794ac2823acc19314fcd7a8aba53e50f/grammpy/transforms/UnitRulesRemove/remove_unit_rules.py#L48-L74
def remove_unit_rules(grammar, inplace=False): # type: (Grammar, bool) -> Grammar """ Remove unit rules from the grammar. :param grammar: Grammar where remove the rules. :param inplace: True if transformation should be performed in place. False by default. :return: Grammar without unit rules. ...
[ "def", "remove_unit_rules", "(", "grammar", ",", "inplace", "=", "False", ")", ":", "# type: (Grammar, bool) -> Grammar", "# copy if needed", "if", "inplace", "is", "False", ":", "grammar", "=", "copy", "(", "grammar", ")", "# get connections", "res", "=", "find_n...
Remove unit rules from the grammar. :param grammar: Grammar where remove the rules. :param inplace: True if transformation should be performed in place. False by default. :return: Grammar without unit rules.
[ "Remove", "unit", "rules", "from", "the", "grammar", ".", ":", "param", "grammar", ":", "Grammar", "where", "remove", "the", "rules", ".", ":", "param", "inplace", ":", "True", "if", "transformation", "should", "be", "performed", "in", "place", ".", "False...
python
train
COALAIP/pycoalaip
coalaip/model_validators.py
https://github.com/COALAIP/pycoalaip/blob/cecc8f6ff4733f0525fafcee63647753e832f0be/coalaip/model_validators.py#L85-L101
def is_right_model(instance, attribute, value): """Must include at least the ``source`` and ``license`` keys, but not a ``rightsOf`` key (``source`` indicates that the Right is derived from and allowed by a source Right; it cannot contain the full rights to a Creation). """ for key in ['source'...
[ "def", "is_right_model", "(", "instance", ",", "attribute", ",", "value", ")", ":", "for", "key", "in", "[", "'source'", ",", "'license'", "]", ":", "key_value", "=", "value", ".", "get", "(", "key", ")", "if", "not", "isinstance", "(", "key_value", ",...
Must include at least the ``source`` and ``license`` keys, but not a ``rightsOf`` key (``source`` indicates that the Right is derived from and allowed by a source Right; it cannot contain the full rights to a Creation).
[ "Must", "include", "at", "least", "the", "source", "and", "license", "keys", "but", "not", "a", "rightsOf", "key", "(", "source", "indicates", "that", "the", "Right", "is", "derived", "from", "and", "allowed", "by", "a", "source", "Right", ";", "it", "ca...
python
train
f3at/feat
src/feat/common/decorator.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/common/decorator.py#L147-L179
def parametrized_function(decorator): '''Decorator used to create decorators with arguments. Should be used with function returning another function that will be called with the original function has the first parameter. No difference are made between method and function, so the wrapper function...
[ "def", "parametrized_function", "(", "decorator", ")", ":", "def", "meta_decorator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_NormalMetaDecorator", "(", "decorator", ",", "args", ",", "kwargs", ")", "return", "meta_decorator" ]
Decorator used to create decorators with arguments. Should be used with function returning another function that will be called with the original function has the first parameter. No difference are made between method and function, so the wrapper function will have to know if the first argument ...
[ "Decorator", "used", "to", "create", "decorators", "with", "arguments", ".", "Should", "be", "used", "with", "function", "returning", "another", "function", "that", "will", "be", "called", "with", "the", "original", "function", "has", "the", "first", "parameter"...
python
train
androguard/androguard
androguard/core/bytecodes/dvm.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/dvm.py#L388-L443
def determineException(vm, m): """ Returns try-catch handler inside the method. :param vm: a :class:`~DalvikVMFormat` :param m: a :class:`~EncodedMethod` :return: """ # no exceptions ! if m.get_code().get_tries_size() <= 0: return [] h_off = {} handler_catch_list = m.g...
[ "def", "determineException", "(", "vm", ",", "m", ")", ":", "# no exceptions !", "if", "m", ".", "get_code", "(", ")", ".", "get_tries_size", "(", ")", "<=", "0", ":", "return", "[", "]", "h_off", "=", "{", "}", "handler_catch_list", "=", "m", ".", "...
Returns try-catch handler inside the method. :param vm: a :class:`~DalvikVMFormat` :param m: a :class:`~EncodedMethod` :return:
[ "Returns", "try", "-", "catch", "handler", "inside", "the", "method", "." ]
python
train
srossross/rpmfile
rpmfile/cpiofile.py
https://github.com/srossross/rpmfile/blob/3ab96f211da7b56f5e99d8cc248f714a6e542d31/rpmfile/cpiofile.py#L252-L258
def get_member(self, name): """return a member by *name*""" for member in self.members: if member.name == name: return member return None
[ "def", "get_member", "(", "self", ",", "name", ")", ":", "for", "member", "in", "self", ".", "members", ":", "if", "member", ".", "name", "==", "name", ":", "return", "member", "return", "None" ]
return a member by *name*
[ "return", "a", "member", "by", "*", "name", "*" ]
python
train
owncloud/pyocclient
owncloud/owncloud.py
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1834-L1849
def _xml_to_dict(self, element): """ Take an XML element, iterate over it and build a dict :param element: An xml.etree.ElementTree.Element, or a list of the same :returns: A dictionary """ return_dict = {} for el in element: return_dict[el.tag] = Non...
[ "def", "_xml_to_dict", "(", "self", ",", "element", ")", ":", "return_dict", "=", "{", "}", "for", "el", "in", "element", ":", "return_dict", "[", "el", ".", "tag", "]", "=", "None", "children", "=", "el", ".", "getchildren", "(", ")", "if", "childre...
Take an XML element, iterate over it and build a dict :param element: An xml.etree.ElementTree.Element, or a list of the same :returns: A dictionary
[ "Take", "an", "XML", "element", "iterate", "over", "it", "and", "build", "a", "dict" ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/decimal128.py#L266-L307
def to_decimal(self): """Returns an instance of :class:`decimal.Decimal` for this :class:`Decimal128`. """ high = self.__high low = self.__low sign = 1 if (high & _SIGN) else 0 if (high & _SNAN) == _SNAN: return decimal.Decimal((sign, (), 'N')) ...
[ "def", "to_decimal", "(", "self", ")", ":", "high", "=", "self", ".", "__high", "low", "=", "self", ".", "__low", "sign", "=", "1", "if", "(", "high", "&", "_SIGN", ")", "else", "0", "if", "(", "high", "&", "_SNAN", ")", "==", "_SNAN", ":", "re...
Returns an instance of :class:`decimal.Decimal` for this :class:`Decimal128`.
[ "Returns", "an", "instance", "of", ":", "class", ":", "decimal", ".", "Decimal", "for", "this", ":", "class", ":", "Decimal128", "." ]
python
train
boriel/zxbasic
arch/zx48k/optimizer.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/optimizer.py#L966-L1027
def destroys(self): """ Returns which single registers (including f, flag) this instruction changes. Registers are: a, b, c, d, e, i, h, l, ixh, ixl, iyh, iyl, r LD a, X => Destroys a LD a, a => Destroys nothing INC a => Destroys a, f POP af => Destroys a, f, s...
[ "def", "destroys", "(", "self", ")", ":", "if", "self", ".", "asm", "in", "arch", ".", "zx48k", ".", "backend", ".", "ASMS", ":", "return", "ALL_REGS", "res", "=", "set", "(", "[", "]", ")", "i", "=", "self", ".", "inst", "o", "=", "self", ".",...
Returns which single registers (including f, flag) this instruction changes. Registers are: a, b, c, d, e, i, h, l, ixh, ixl, iyh, iyl, r LD a, X => Destroys a LD a, a => Destroys nothing INC a => Destroys a, f POP af => Destroys a, f, sp PUSH af => Destroys sp...
[ "Returns", "which", "single", "registers", "(", "including", "f", "flag", ")", "this", "instruction", "changes", "." ]
python
train
louib/confirm
confirm/generator.py
https://github.com/louib/confirm/blob/0acd1eccda6cd71c69d2ae33166a16a257685811/confirm/generator.py#L73-L123
def generate_documentation(schema): """ Generates reStructuredText documentation from a Confirm file. :param schema: Dictionary representing the Confirm schema. :returns: String representing the reStructuredText documentation. """ documentation_title = "Configuration documentation" docume...
[ "def", "generate_documentation", "(", "schema", ")", ":", "documentation_title", "=", "\"Configuration documentation\"", "documentation", "=", "documentation_title", "+", "\"\\n\"", "documentation", "+=", "\"=\"", "*", "len", "(", "documentation_title", ")", "+", "'\\n'...
Generates reStructuredText documentation from a Confirm file. :param schema: Dictionary representing the Confirm schema. :returns: String representing the reStructuredText documentation.
[ "Generates", "reStructuredText", "documentation", "from", "a", "Confirm", "file", "." ]
python
train
scot-dev/scot
scot/plotting.py
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plotting.py#L35-L61
def prepare_topoplots(topo, values): """Prepare multiple topo maps for cached plotting. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_values`. Parameters ---------- topo : :class:`~eegtopo.topoplot.Topoplot` Scalp maps are created w...
[ "def", "prepare_topoplots", "(", "topo", ",", "values", ")", ":", "values", "=", "np", ".", "atleast_2d", "(", "values", ")", "topomaps", "=", "[", "]", "for", "i", "in", "range", "(", "values", ".", "shape", "[", "0", "]", ")", ":", "topo", ".", ...
Prepare multiple topo maps for cached plotting. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_values`. Parameters ---------- topo : :class:`~eegtopo.topoplot.Topoplot` Scalp maps are created with this class values : array, shape = [...
[ "Prepare", "multiple", "topo", "maps", "for", "cached", "plotting", "." ]
python
train
google/pyringe
pyringe/payload/gdb_service.py
https://github.com/google/pyringe/blob/76dff5d1ac29cd5e7bf32677654a83291a15ad8a/pyringe/payload/gdb_service.py#L313-L326
def _UnpackGdbVal(self, gdb_value): """Unpacks gdb.Value objects and returns the best-matched python object.""" val_type = gdb_value.type.code if val_type == gdb.TYPE_CODE_INT or val_type == gdb.TYPE_CODE_ENUM: return int(gdb_value) if val_type == gdb.TYPE_CODE_VOID: return None if val_t...
[ "def", "_UnpackGdbVal", "(", "self", ",", "gdb_value", ")", ":", "val_type", "=", "gdb_value", ".", "type", ".", "code", "if", "val_type", "==", "gdb", ".", "TYPE_CODE_INT", "or", "val_type", "==", "gdb", ".", "TYPE_CODE_ENUM", ":", "return", "int", "(", ...
Unpacks gdb.Value objects and returns the best-matched python object.
[ "Unpacks", "gdb", ".", "Value", "objects", "and", "returns", "the", "best", "-", "matched", "python", "object", "." ]
python
train
portantier/habu
habu/cli/cmd_shodan_open.py
https://github.com/portantier/habu/blob/87091e389dc6332fe1b82830c22b2eefc55816f2/habu/cli/cmd_shodan_open.py#L22-L60
def cmd_shodan_open(ip, no_cache, json_output, nmap_command, verbose, output): """Output the open ports for an IP against shodan (nmap format). Example: \b $ habu.shodan.open 8.8.8.8 T:53,U:53 """ habucfg = loadcfg() if 'SHODAN_APIKEY' not in habucfg: print('You must provide ...
[ "def", "cmd_shodan_open", "(", "ip", ",", "no_cache", ",", "json_output", ",", "nmap_command", ",", "verbose", ",", "output", ")", ":", "habucfg", "=", "loadcfg", "(", ")", "if", "'SHODAN_APIKEY'", "not", "in", "habucfg", ":", "print", "(", "'You must provid...
Output the open ports for an IP against shodan (nmap format). Example: \b $ habu.shodan.open 8.8.8.8 T:53,U:53
[ "Output", "the", "open", "ports", "for", "an", "IP", "against", "shodan", "(", "nmap", "format", ")", "." ]
python
train
weblyzard/inscriptis
src/inscriptis/table_engine.py
https://github.com/weblyzard/inscriptis/blob/0d04f81e69d643bb5f470f33b4ca67b62fc1037c/src/inscriptis/table_engine.py#L31-L35
def get_format_spec(self): ''' The format specification according to the values of `align` and `width` ''' return u"{{:{align}{width}}}".format(align=self.align, width=self.width)
[ "def", "get_format_spec", "(", "self", ")", ":", "return", "u\"{{:{align}{width}}}\"", ".", "format", "(", "align", "=", "self", ".", "align", ",", "width", "=", "self", ".", "width", ")" ]
The format specification according to the values of `align` and `width`
[ "The", "format", "specification", "according", "to", "the", "values", "of", "align", "and", "width" ]
python
train
elifesciences/proofreader-python
proofreader/utils/print_table.py
https://github.com/elifesciences/proofreader-python/blob/387b3c65ee7777e26b3a7340179dc4ed68f24f58/proofreader/utils/print_table.py#L41-L57
def _marker_line(self): # type: () -> str """Generate a correctly sized marker line. e.g. '+------------------+---------+----------+---------+' :return: str """ output = '' for col in sorted(self.col_widths): line = self.COLUMN_MARK + (self....
[ "def", "_marker_line", "(", "self", ")", ":", "# type: () -> str", "output", "=", "''", "for", "col", "in", "sorted", "(", "self", ".", "col_widths", ")", ":", "line", "=", "self", ".", "COLUMN_MARK", "+", "(", "self", ".", "DASH", "*", "(", "self", ...
Generate a correctly sized marker line. e.g. '+------------------+---------+----------+---------+' :return: str
[ "Generate", "a", "correctly", "sized", "marker", "line", "." ]
python
train
saltstack/salt
salt/utils/smb.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/smb.py#L176-L192
def get_conn(host='', username=None, password=None, port=445): ''' Get an SMB connection ''' if HAS_IMPACKET and not HAS_SMBPROTOCOL: salt.utils.versions.warn_until( 'Sodium', 'Support of impacket has been depricated and will be ' 'removed in Sodium. Please in...
[ "def", "get_conn", "(", "host", "=", "''", ",", "username", "=", "None", ",", "password", "=", "None", ",", "port", "=", "445", ")", ":", "if", "HAS_IMPACKET", "and", "not", "HAS_SMBPROTOCOL", ":", "salt", ".", "utils", ".", "versions", ".", "warn_unti...
Get an SMB connection
[ "Get", "an", "SMB", "connection" ]
python
train
apache/incubator-mxnet
python/mxnet/autograd.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/autograd.py#L52-L68
def set_training(train_mode): #pylint: disable=redefined-outer-name """Set status to training/predicting. This affects ctx.is_train in operator running context. For example, Dropout will drop inputs randomly when train_mode=True while simply passing through if train_mode=False. Parameters ---------...
[ "def", "set_training", "(", "train_mode", ")", ":", "#pylint: disable=redefined-outer-name", "prev", "=", "ctypes", ".", "c_int", "(", ")", "check_call", "(", "_LIB", ".", "MXAutogradSetIsTraining", "(", "ctypes", ".", "c_int", "(", "train_mode", ")", ",", "ctyp...
Set status to training/predicting. This affects ctx.is_train in operator running context. For example, Dropout will drop inputs randomly when train_mode=True while simply passing through if train_mode=False. Parameters ---------- train_mode: bool Returns ------- previous state before t...
[ "Set", "status", "to", "training", "/", "predicting", ".", "This", "affects", "ctx", ".", "is_train", "in", "operator", "running", "context", ".", "For", "example", "Dropout", "will", "drop", "inputs", "randomly", "when", "train_mode", "=", "True", "while", ...
python
train
grabbles/grabbit
grabbit/core.py
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L557-L570
def _find_entity(self, entity): ''' Find an Entity instance by name. Checks both name and id fields.''' if entity in self.entities: return self.entities[entity] _ent = [e for e in self.entities.values() if e.name == entity] if len(_ent) > 1: raise ValueError("Enti...
[ "def", "_find_entity", "(", "self", ",", "entity", ")", ":", "if", "entity", "in", "self", ".", "entities", ":", "return", "self", ".", "entities", "[", "entity", "]", "_ent", "=", "[", "e", "for", "e", "in", "self", ".", "entities", ".", "values", ...
Find an Entity instance by name. Checks both name and id fields.
[ "Find", "an", "Entity", "instance", "by", "name", ".", "Checks", "both", "name", "and", "id", "fields", "." ]
python
train
python-openxml/python-docx
docx/opc/package.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L66-L85
def iter_parts(self): """ Generate exactly one reference to each of the parts in the package by performing a depth-first traversal of the rels graph. """ def walk_parts(source, visited=list()): for rel in source.rels.values(): if rel.is_external: ...
[ "def", "iter_parts", "(", "self", ")", ":", "def", "walk_parts", "(", "source", ",", "visited", "=", "list", "(", ")", ")", ":", "for", "rel", "in", "source", ".", "rels", ".", "values", "(", ")", ":", "if", "rel", ".", "is_external", ":", "continu...
Generate exactly one reference to each of the parts in the package by performing a depth-first traversal of the rels graph.
[ "Generate", "exactly", "one", "reference", "to", "each", "of", "the", "parts", "in", "the", "package", "by", "performing", "a", "depth", "-", "first", "traversal", "of", "the", "rels", "graph", "." ]
python
train
NoneGG/aredis
aredis/nodemanager.py
https://github.com/NoneGG/aredis/blob/204caad740ac13e5760d46444a2ba7632982a046/aredis/nodemanager.py#L234-L246
def set_node(self, host, port, server_type=None): """ Update data for a node. """ node_name = "{0}:{1}".format(host, port) node = { 'host': host, 'port': port, 'name': node_name, 'server_type': server_type } self.nod...
[ "def", "set_node", "(", "self", ",", "host", ",", "port", ",", "server_type", "=", "None", ")", ":", "node_name", "=", "\"{0}:{1}\"", ".", "format", "(", "host", ",", "port", ")", "node", "=", "{", "'host'", ":", "host", ",", "'port'", ":", "port", ...
Update data for a node.
[ "Update", "data", "for", "a", "node", "." ]
python
train
pybel/pybel
src/pybel/parser/parse_bel.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/parser/parse_bel.py#L845-L854
def handle_activity_legacy(_: str, __: int, tokens: ParseResults) -> ParseResults: """Handle BEL 1.0 activities.""" legacy_cls = language.activity_labels[tokens[MODIFIER]] tokens[MODIFIER] = ACTIVITY tokens[EFFECT] = { NAME: legacy_cls, NAMESPACE: BEL_DEFAULT_NAMESPACE } log.log(...
[ "def", "handle_activity_legacy", "(", "_", ":", "str", ",", "__", ":", "int", ",", "tokens", ":", "ParseResults", ")", "->", "ParseResults", ":", "legacy_cls", "=", "language", ".", "activity_labels", "[", "tokens", "[", "MODIFIER", "]", "]", "tokens", "["...
Handle BEL 1.0 activities.
[ "Handle", "BEL", "1", ".", "0", "activities", "." ]
python
train
troeger/opensubmit
web/opensubmit/cmdline.py
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/cmdline.py#L229-L244
def check_web_config(config_fname): ''' Try to load the Django settings. If this does not work, than settings file does not exist. Returns: Loaded configuration, or None. ''' print("Looking for config file at {0} ...".format(config_fname)) config = RawConfigParser() ...
[ "def", "check_web_config", "(", "config_fname", ")", ":", "print", "(", "\"Looking for config file at {0} ...\"", ".", "format", "(", "config_fname", ")", ")", "config", "=", "RawConfigParser", "(", ")", "try", ":", "config", ".", "readfp", "(", "open", "(", "...
Try to load the Django settings. If this does not work, than settings file does not exist. Returns: Loaded configuration, or None.
[ "Try", "to", "load", "the", "Django", "settings", ".", "If", "this", "does", "not", "work", "than", "settings", "file", "does", "not", "exist", "." ]
python
train
SylvanasSun/FishFishJump
fish_dashboard/scrapyd/scrapyd_agent.py
https://github.com/SylvanasSun/FishFishJump/blob/696212d242d8d572f3f1b43925f3d8ab8acc6a2d/fish_dashboard/scrapyd/scrapyd_agent.py#L214-L233
def get_job_list(self, project_name): """ Get the list of pending, running and finished jobs of some project. :param project_name: the project name :return: a dictionary that list inculde job name and status example: {"status": "ok", ...
[ "def", "get_job_list", "(", "self", ",", "project_name", ")", ":", "url", ",", "method", "=", "self", ".", "command_set", "[", "'listjobs'", "]", "[", "0", "]", ",", "self", ".", "command_set", "[", "'listjobs'", "]", "[", "1", "]", "data", "=", "{",...
Get the list of pending, running and finished jobs of some project. :param project_name: the project name :return: a dictionary that list inculde job name and status example: {"status": "ok", "pending": [{"id": "78391cc0fcaf11e1b0090800272a6d06", "sp...
[ "Get", "the", "list", "of", "pending", "running", "and", "finished", "jobs", "of", "some", "project", ".", ":", "param", "project_name", ":", "the", "project", "name", ":", "return", ":", "a", "dictionary", "that", "list", "inculde", "job", "name", "and", ...
python
train
pawelad/pymonzo
src/pymonzo/api_objects.py
https://github.com/pawelad/pymonzo/blob/b5c8d4f46dcb3a2f475797a8b8ef1c15f6493fb9/src/pymonzo/api_objects.py#L102-L117
def _parse_special_fields(self, data): """ Helper method that parses special fields to Python objects :param data: response from Monzo API request :type data: dict """ self.created = parse_date(data.pop('created')) if data.get('settled'): # Not always returned ...
[ "def", "_parse_special_fields", "(", "self", ",", "data", ")", ":", "self", ".", "created", "=", "parse_date", "(", "data", ".", "pop", "(", "'created'", ")", ")", "if", "data", ".", "get", "(", "'settled'", ")", ":", "# Not always returned", "self", "."...
Helper method that parses special fields to Python objects :param data: response from Monzo API request :type data: dict
[ "Helper", "method", "that", "parses", "special", "fields", "to", "Python", "objects" ]
python
train
nicolargo/glances
glances/exports/glances_export.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L187-L223
def __build_export(self, stats): """Build the export lists.""" export_names = [] export_values = [] if isinstance(stats, dict): # Stats is a dict # Is there a key ? if 'key' in iterkeys(stats) and stats['key'] in iterkeys(stats): pre_k...
[ "def", "__build_export", "(", "self", ",", "stats", ")", ":", "export_names", "=", "[", "]", "export_values", "=", "[", "]", "if", "isinstance", "(", "stats", ",", "dict", ")", ":", "# Stats is a dict", "# Is there a key ?", "if", "'key'", "in", "iterkeys", ...
Build the export lists.
[ "Build", "the", "export", "lists", "." ]
python
train
senaite/senaite.core
bika/lims/exportimport/instruments/generic/two_dimension.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/generic/two_dimension.py#L112-L124
def find_analysis_interims(ar_or_sample): """ This function is used to find keywords that are not on the analysis but keywords that are on the interim fields. This function and is is_keyword function should probably be in resultsimport.py or somewhere central where it can be used by other ...
[ "def", "find_analysis_interims", "(", "ar_or_sample", ")", ":", "interim_fields", "=", "list", "(", ")", "for", "analysis", "in", "find_analyses", "(", "ar_or_sample", ")", ":", "keywords", "=", "get_interims_keywords", "(", "analysis", ")", "interim_fields", ".",...
This function is used to find keywords that are not on the analysis but keywords that are on the interim fields. This function and is is_keyword function should probably be in resultsimport.py or somewhere central where it can be used by other instrument interfaces.
[ "This", "function", "is", "used", "to", "find", "keywords", "that", "are", "not", "on", "the", "analysis", "but", "keywords", "that", "are", "on", "the", "interim", "fields", "." ]
python
train
denisenkom/pytds
src/pytds/tds_types.py
https://github.com/denisenkom/pytds/blob/7d875cab29134afdef719406831c1c6a0d7af48a/src/pytds/tds_types.py#L29-L34
def _decode_num(buf): """ Decodes little-endian integer from buffer Buffer can be of any size """ return functools.reduce(lambda acc, val: acc * 256 + tds_base.my_ord(val), reversed(buf), 0)
[ "def", "_decode_num", "(", "buf", ")", ":", "return", "functools", ".", "reduce", "(", "lambda", "acc", ",", "val", ":", "acc", "*", "256", "+", "tds_base", ".", "my_ord", "(", "val", ")", ",", "reversed", "(", "buf", ")", ",", "0", ")" ]
Decodes little-endian integer from buffer Buffer can be of any size
[ "Decodes", "little", "-", "endian", "integer", "from", "buffer" ]
python
train
Kraymer/high
high/__init__.py
https://github.com/Kraymer/high/blob/11bb86733875ec708264ffb92bf5ef09a9d2f08c/high/__init__.py#L72-L85
def fetch_logins(roles, repo): """Fetch logins for users with given roles. """ users = set() if 'stargazer' in roles: printmp('Fetching stargazers') users |= set(repo.stargazers()) if 'collaborator' in roles: printmp('Fetching collaborators') users |= set(repo.collabo...
[ "def", "fetch_logins", "(", "roles", ",", "repo", ")", ":", "users", "=", "set", "(", ")", "if", "'stargazer'", "in", "roles", ":", "printmp", "(", "'Fetching stargazers'", ")", "users", "|=", "set", "(", "repo", ".", "stargazers", "(", ")", ")", "if",...
Fetch logins for users with given roles.
[ "Fetch", "logins", "for", "users", "with", "given", "roles", "." ]
python
train
Guake/guake
guake/prefs.py
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/prefs.py#L696-L699
def on_window_horizontal_displacement_value_changed(self, spin): """Changes the value of window-horizontal-displacement """ self.settings.general.set_int('window-horizontal-displacement', int(spin.get_value()))
[ "def", "on_window_horizontal_displacement_value_changed", "(", "self", ",", "spin", ")", ":", "self", ".", "settings", ".", "general", ".", "set_int", "(", "'window-horizontal-displacement'", ",", "int", "(", "spin", ".", "get_value", "(", ")", ")", ")" ]
Changes the value of window-horizontal-displacement
[ "Changes", "the", "value", "of", "window", "-", "horizontal", "-", "displacement" ]
python
train
Chilipp/docrep
docrep/__init__.py
https://github.com/Chilipp/docrep/blob/637971f76e1a6e1c70e36dcd1b02bbc37ba02487/docrep/__init__.py#L945-L966
def get_extended_summaryf(self, *args, **kwargs): """Extract the extended summary from a function docstring This function can be used as a decorator to extract the extended summary of a function docstring (similar to :meth:`get_sectionsf`). Parameters ---------- ``*args...
[ "def", "get_extended_summaryf", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "func", "(", "f", ")", ":", "doc", "=", "f", ".", "__doc__", "self", ".", "get_extended_summary", "(", "doc", "or", "''", ",", "*", "args", ","...
Extract the extended summary from a function docstring This function can be used as a decorator to extract the extended summary of a function docstring (similar to :meth:`get_sectionsf`). Parameters ---------- ``*args`` and ``**kwargs`` See the :meth:`get_extended_s...
[ "Extract", "the", "extended", "summary", "from", "a", "function", "docstring" ]
python
train
CityOfZion/neo-python
neo/Wallets/Wallet.py
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Wallets/Wallet.py#L428-L472
def FindUnspentCoinsByAssetAndTotal(self, asset_id, amount, from_addr=None, use_standard=False, watch_only_val=0, reverse=False): """ Finds unspent coin objects totalling a requested value in the wallet limited to those of a certain asset type. Args: asset_id (UInt256): a bytearray ...
[ "def", "FindUnspentCoinsByAssetAndTotal", "(", "self", ",", "asset_id", ",", "amount", ",", "from_addr", "=", "None", ",", "use_standard", "=", "False", ",", "watch_only_val", "=", "0", ",", "reverse", "=", "False", ")", ":", "coins", "=", "self", ".", "Fi...
Finds unspent coin objects totalling a requested value in the wallet limited to those of a certain asset type. Args: asset_id (UInt256): a bytearray (len 32) representing an asset on the blockchain. amount (int): the amount of unspent coins that are being requested. from_add...
[ "Finds", "unspent", "coin", "objects", "totalling", "a", "requested", "value", "in", "the", "wallet", "limited", "to", "those", "of", "a", "certain", "asset", "type", "." ]
python
train
quasipedia/swaggery
swaggery/api.py
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/api.py#L186-L194
def implemented_methods(cls): '''Return a mapping of implemented HTTP methods vs. their callbacks.''' if cls.__implemented_methods: return cls.__implemented_methods cls.__implemented_methods = {} for method in cls.callbacks: for op in getattr(method, 'swagger_ops'...
[ "def", "implemented_methods", "(", "cls", ")", ":", "if", "cls", ".", "__implemented_methods", ":", "return", "cls", ".", "__implemented_methods", "cls", ".", "__implemented_methods", "=", "{", "}", "for", "method", "in", "cls", ".", "callbacks", ":", "for", ...
Return a mapping of implemented HTTP methods vs. their callbacks.
[ "Return", "a", "mapping", "of", "implemented", "HTTP", "methods", "vs", ".", "their", "callbacks", "." ]
python
train
lemieuxl/pyGenClean
pyGenClean/SexCheck/gender_plot.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/gender_plot.py#L206-L228
def read_bim(file_name): """Reads the BIM file to gather marker names. :param file_name: the name of the ``bim`` file. :type file_name: str :returns: a :py:class:`dict` containing the chromosomal location of each marker on the sexual chromosomes. It uses the :py:func:`encode_chr` t...
[ "def", "read_bim", "(", "file_name", ")", ":", "marker_names_chr", "=", "None", "with", "open", "(", "file_name", ",", "'r'", ")", "as", "input_file", ":", "marker_names_chr", "=", "dict", "(", "[", "(", "i", "[", "1", "]", ",", "encode_chr", "(", "i",...
Reads the BIM file to gather marker names. :param file_name: the name of the ``bim`` file. :type file_name: str :returns: a :py:class:`dict` containing the chromosomal location of each marker on the sexual chromosomes. It uses the :py:func:`encode_chr` to encode the chromosomes from ``...
[ "Reads", "the", "BIM", "file", "to", "gather", "marker", "names", "." ]
python
train
rdussurget/py-altimetry
altimetry/data/alti_data.py
https://github.com/rdussurget/py-altimetry/blob/57ce7f2d63c6bbc4993821af0bbe46929e3a2d98/altimetry/data/alti_data.py#L678-L683
def track_list(self,*args): ''' return the list of tracks contained if the dataset ''' noargs = len(args) == 0 return np.unique(self.track) if noargs else np.unique(self.track.compress(args[0]))
[ "def", "track_list", "(", "self", ",", "*", "args", ")", ":", "noargs", "=", "len", "(", "args", ")", "==", "0", "return", "np", ".", "unique", "(", "self", ".", "track", ")", "if", "noargs", "else", "np", ".", "unique", "(", "self", ".", "track"...
return the list of tracks contained if the dataset
[ "return", "the", "list", "of", "tracks", "contained", "if", "the", "dataset" ]
python
train
bitesofcode/projexui
projexui/widgets/xserialedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xserialedit.py#L125-L204
def eventFilter(self, object, event): """ Filters the events for the editors to control how the cursor flows between them. :param object | <QtCore.QObject> event | <QtCore.QEvent> :return <bool> | consumed """ inde...
[ "def", "eventFilter", "(", "self", ",", "object", ",", "event", ")", ":", "index", "=", "self", ".", "indexOf", "(", "object", ")", "pressed", "=", "event", ".", "type", "(", ")", "==", "event", ".", "KeyPress", "released", "=", "event", ".", "type",...
Filters the events for the editors to control how the cursor flows between them. :param object | <QtCore.QObject> event | <QtCore.QEvent> :return <bool> | consumed
[ "Filters", "the", "events", "for", "the", "editors", "to", "control", "how", "the", "cursor", "flows", "between", "them", ".", ":", "param", "object", "|", "<QtCore", ".", "QObject", ">", "event", "|", "<QtCore", ".", "QEvent", ">", ":", "return", "<bool...
python
train
saltstack/salt
salt/modules/boto3_sns.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto3_sns.py#L198-L217
def set_topic_attributes(TopicArn, AttributeName, AttributeValue, region=None, key=None, keyid=None, profile=None): ''' Set an attribute of a topic to a new value. CLI example:: salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue ''' ...
[ "def", "set_topic_attributes", "(", "TopicArn", ",", "AttributeName", ",", "AttributeValue", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "...
Set an attribute of a topic to a new value. CLI example:: salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue
[ "Set", "an", "attribute", "of", "a", "topic", "to", "a", "new", "value", "." ]
python
train
underworldcode/stripy
stripy-src/stripy/cartesian.py
https://github.com/underworldcode/stripy/blob/d4c3480c3e58c88489ded695eadbe7cd5bf94b48/stripy-src/stripy/cartesian.py#L889-L905
def edge_lengths(self): """ Compute the edge-lengths of each triangle in the triangulation. """ simplex = self.simplices.T # simplex is vectors a, b, c defining the corners a = self.points[simplex[0]] b = self.points[simplex[1]] c = self.points[simplex[2]...
[ "def", "edge_lengths", "(", "self", ")", ":", "simplex", "=", "self", ".", "simplices", ".", "T", "# simplex is vectors a, b, c defining the corners", "a", "=", "self", ".", "points", "[", "simplex", "[", "0", "]", "]", "b", "=", "self", ".", "points", "["...
Compute the edge-lengths of each triangle in the triangulation.
[ "Compute", "the", "edge", "-", "lengths", "of", "each", "triangle", "in", "the", "triangulation", "." ]
python
train
googleapis/google-cloud-python
bigquery/noxfile.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/noxfile.py#L137-L149
def lint(session): """Run linters. Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ session.install("black", "flake8", *LOCAL_DEPS) session.install(".") session.run("flake8", os.path.join("google", "cloud", "bigquery")) session.run("...
[ "def", "lint", "(", "session", ")", ":", "session", ".", "install", "(", "\"black\"", ",", "\"flake8\"", ",", "*", "LOCAL_DEPS", ")", "session", ".", "install", "(", "\".\"", ")", "session", ".", "run", "(", "\"flake8\"", ",", "os", ".", "path", ".", ...
Run linters. Returns a failure if the linters find linting errors or sufficiently serious code quality issues.
[ "Run", "linters", "." ]
python
train
PMBio/limix-backup
limix/deprecated/archive/varianceDecompositionOld.py
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/archive/varianceDecompositionOld.py#L633-L644
def getVariances(self): """ Returns the estimated variances as a n_terms x P matrix each row of the output represents a term and its P values represent the variance corresponding variance in each trait """ if self.P>1: RV=SP.zeros((self.n_terms,self.P)) fo...
[ "def", "getVariances", "(", "self", ")", ":", "if", "self", ".", "P", ">", "1", ":", "RV", "=", "SP", ".", "zeros", "(", "(", "self", ".", "n_terms", ",", "self", ".", "P", ")", ")", "for", "term_i", "in", "range", "(", "self", ".", "n_terms", ...
Returns the estimated variances as a n_terms x P matrix each row of the output represents a term and its P values represent the variance corresponding variance in each trait
[ "Returns", "the", "estimated", "variances", "as", "a", "n_terms", "x", "P", "matrix", "each", "row", "of", "the", "output", "represents", "a", "term", "and", "its", "P", "values", "represent", "the", "variance", "corresponding", "variance", "in", "each", "tr...
python
train
bslatkin/dpxdt
dpxdt/server/api.py
https://github.com/bslatkin/dpxdt/blob/9f860de1731021d99253670429e5f2157e1f6297/dpxdt/server/api.py#L157-L197
def _check_release_done_processing(release): """Moves a release candidate to reviewing if all runs are done.""" if release.status != models.Release.PROCESSING: # NOTE: This statement also guards for situations where the user has # prematurely specified that the release is good or bad. Once the u...
[ "def", "_check_release_done_processing", "(", "release", ")", ":", "if", "release", ".", "status", "!=", "models", ".", "Release", ".", "PROCESSING", ":", "# NOTE: This statement also guards for situations where the user has", "# prematurely specified that the release is good or ...
Moves a release candidate to reviewing if all runs are done.
[ "Moves", "a", "release", "candidate", "to", "reviewing", "if", "all", "runs", "are", "done", "." ]
python
train
infothrill/python-dyndnsc
dyndnsc/updater/dyndns2.py
https://github.com/infothrill/python-dyndnsc/blob/2196d48aa6098da9835a7611fbdb0b5f0fbf51e4/dyndnsc/updater/dyndns2.py#L36-L49
def update(self, ip): """Update the IP on the remote service.""" timeout = 60 LOG.debug("Updating '%s' to '%s' at service '%s'", self.hostname, ip, self._updateurl) params = {"myip": ip, "hostname": self.hostname} req = requests.get(self._updateurl, params=params, headers=constan...
[ "def", "update", "(", "self", ",", "ip", ")", ":", "timeout", "=", "60", "LOG", ".", "debug", "(", "\"Updating '%s' to '%s' at service '%s'\"", ",", "self", ".", "hostname", ",", "ip", ",", "self", ".", "_updateurl", ")", "params", "=", "{", "\"myip\"", ...
Update the IP on the remote service.
[ "Update", "the", "IP", "on", "the", "remote", "service", "." ]
python
train
TrafficSenseMSD/SumoTools
traci/_trafficlight.py
https://github.com/TrafficSenseMSD/SumoTools/blob/8607b4f885f1d1798e43240be643efe6dccccdaa/traci/_trafficlight.py#L179-L186
def setRedYellowGreenState(self, tlsID, state): """setRedYellowGreenState(string, string) -> None Sets the named tl's state as a tuple of light definitions from rugGyYuoO, for red, red-yellow, green, yellow, off, where lower case letters mean that the stream has to decelerate. """ ...
[ "def", "setRedYellowGreenState", "(", "self", ",", "tlsID", ",", "state", ")", ":", "self", ".", "_connection", ".", "_sendStringCmd", "(", "tc", ".", "CMD_SET_TL_VARIABLE", ",", "tc", ".", "TL_RED_YELLOW_GREEN_STATE", ",", "tlsID", ",", "state", ")" ]
setRedYellowGreenState(string, string) -> None Sets the named tl's state as a tuple of light definitions from rugGyYuoO, for red, red-yellow, green, yellow, off, where lower case letters mean that the stream has to decelerate.
[ "setRedYellowGreenState", "(", "string", "string", ")", "-", ">", "None" ]
python
train
twisted/vertex
vertex/ptcp.py
https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/ptcp.py#L249-L264
def segmentAcceptable(RCV_NXT, RCV_WND, SEG_SEQ, SEG_LEN): """ An acceptable segment: RFC 793 page 26. """ if SEG_LEN == 0 and RCV_WND == 0: return SEG_SEQ == RCV_NXT if SEG_LEN == 0 and RCV_WND > 0: return ((RCV_NXT <= SEG_SEQ) and (SEG_SEQ < RCV_NXT + RCV_WND)) if SEG_LEN > 0 a...
[ "def", "segmentAcceptable", "(", "RCV_NXT", ",", "RCV_WND", ",", "SEG_SEQ", ",", "SEG_LEN", ")", ":", "if", "SEG_LEN", "==", "0", "and", "RCV_WND", "==", "0", ":", "return", "SEG_SEQ", "==", "RCV_NXT", "if", "SEG_LEN", "==", "0", "and", "RCV_WND", ">", ...
An acceptable segment: RFC 793 page 26.
[ "An", "acceptable", "segment", ":", "RFC", "793", "page", "26", "." ]
python
train
alerta/python-alerta-client
alertaclient/commands/cmd_login.py
https://github.com/alerta/python-alerta-client/blob/7eb367b5fe87d5fc20b54dea8cddd7f09e251afa/alertaclient/commands/cmd_login.py#L15-L53
def cli(obj, username): """Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or Basic Auth username/password instead of using an API key.""" client = obj['client'] provider = obj['provider'] client_id = obj['client_id'] try: if provider == 'azure': token = azur...
[ "def", "cli", "(", "obj", ",", "username", ")", ":", "client", "=", "obj", "[", "'client'", "]", "provider", "=", "obj", "[", "'provider'", "]", "client_id", "=", "obj", "[", "'client_id'", "]", "try", ":", "if", "provider", "==", "'azure'", ":", "to...
Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or Basic Auth username/password instead of using an API key.
[ "Authenticate", "using", "Azure", "Github", "Gitlab", "Google", "OAuth2", "OpenID", "or", "Basic", "Auth", "username", "/", "password", "instead", "of", "using", "an", "API", "key", "." ]
python
train
zhmcclient/python-zhmcclient
zhmcclient_mock/_idpool.py
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient_mock/_idpool.py#L67-L83
def _expand(self): """ Expand the free pool, if possible. If out of capacity w.r.t. the defined ID value range, ValueError is raised. """ assert not self._free # free pool is empty expand_end = self._expand_start + self._expand_len if expand_end > self._...
[ "def", "_expand", "(", "self", ")", ":", "assert", "not", "self", ".", "_free", "# free pool is empty", "expand_end", "=", "self", ".", "_expand_start", "+", "self", ".", "_expand_len", "if", "expand_end", ">", "self", ".", "_range_end", ":", "# This happens i...
Expand the free pool, if possible. If out of capacity w.r.t. the defined ID value range, ValueError is raised.
[ "Expand", "the", "free", "pool", "if", "possible", "." ]
python
train
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/Graph.py
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/altgraph/Graph.py#L318-L324
def inc_nbrs(self, node): """ List of nodes connected by incoming edges """ l = map(self.head, self.inc_edges(node)) #l.sort() return l
[ "def", "inc_nbrs", "(", "self", ",", "node", ")", ":", "l", "=", "map", "(", "self", ".", "head", ",", "self", ".", "inc_edges", "(", "node", ")", ")", "#l.sort()", "return", "l" ]
List of nodes connected by incoming edges
[ "List", "of", "nodes", "connected", "by", "incoming", "edges" ]
python
train
foremast/foremast
src/foremast/runner.py
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/runner.py#L191-L195
def create_elb(self): """Create the ELB for the defined environment.""" utils.banner("Creating ELB") elbobj = elb.SpinnakerELB(app=self.app, env=self.env, region=self.region, prop_path=self.json_path) elbobj.create_elb()
[ "def", "create_elb", "(", "self", ")", ":", "utils", ".", "banner", "(", "\"Creating ELB\"", ")", "elbobj", "=", "elb", ".", "SpinnakerELB", "(", "app", "=", "self", ".", "app", ",", "env", "=", "self", ".", "env", ",", "region", "=", "self", ".", ...
Create the ELB for the defined environment.
[ "Create", "the", "ELB", "for", "the", "defined", "environment", "." ]
python
train
uogbuji/versa
tools/py/writer/rdfs.py
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/writer/rdfs.py#L86-L101
def write(models, base=None, graph=None, rdfsonly=False, prefixes=None, logger=logging): ''' See the command line help ''' prefixes = prefixes or {} g = graph or rdflib.Graph() #g.bind('bf', BFNS) #g.bind('bfc', BFCNS) #g.bind('bfd', BFDNS) g.bind('v', VNS) for k, v in prefixes.i...
[ "def", "write", "(", "models", ",", "base", "=", "None", ",", "graph", "=", "None", ",", "rdfsonly", "=", "False", ",", "prefixes", "=", "None", ",", "logger", "=", "logging", ")", ":", "prefixes", "=", "prefixes", "or", "{", "}", "g", "=", "graph"...
See the command line help
[ "See", "the", "command", "line", "help" ]
python
train
lltk/lltk
lltk/nl/scrapers/mijnwoordenboek.py
https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/mijnwoordenboek.py#L26-L39
def pos(self): ''' Tries to decide about the part of speech. ''' tags = [] if self.tree.xpath('//div[@class="grad733100"]/h2[@class="inline"]//text()'): info = self.tree.xpath('//div[@class="grad733100"]/h2[@class="inline"]')[0].text_content() info = info.strip('I ') if info.startswith(('de', 'het')): ...
[ "def", "pos", "(", "self", ")", ":", "tags", "=", "[", "]", "if", "self", ".", "tree", ".", "xpath", "(", "'//div[@class=\"grad733100\"]/h2[@class=\"inline\"]//text()'", ")", ":", "info", "=", "self", ".", "tree", ".", "xpath", "(", "'//div[@class=\"grad733100...
Tries to decide about the part of speech.
[ "Tries", "to", "decide", "about", "the", "part", "of", "speech", "." ]
python
train
datapythonista/mnist
mnist/__init__.py
https://github.com/datapythonista/mnist/blob/d91df2b27ee62d07396b5b64c7cfead59833b563/mnist/__init__.py#L64-L120
def parse_idx(fd): """Parse an IDX file, and return it as a numpy array. Parameters ---------- fd : file File descriptor of the IDX file to parse endian : str Byte order of the IDX file. See [1] for available options Returns ------- data : numpy.ndarray Numpy a...
[ "def", "parse_idx", "(", "fd", ")", ":", "DATA_TYPES", "=", "{", "0x08", ":", "'B'", ",", "# unsigned byte", "0x09", ":", "'b'", ",", "# signed byte", "0x0b", ":", "'h'", ",", "# short (2 bytes)", "0x0c", ":", "'i'", ",", "# int (4 bytes)", "0x0d", ":", ...
Parse an IDX file, and return it as a numpy array. Parameters ---------- fd : file File descriptor of the IDX file to parse endian : str Byte order of the IDX file. See [1] for available options Returns ------- data : numpy.ndarray Numpy array with the dimensions a...
[ "Parse", "an", "IDX", "file", "and", "return", "it", "as", "a", "numpy", "array", "." ]
python
train
jaraco/jaraco.packaging
jaraco/packaging/depends.py
https://github.com/jaraco/jaraco.packaging/blob/c84fd1282b222bc262a2bab7a2e668c947472f46/jaraco/packaging/depends.py#L117-L123
def check_dependencies_remote(args): """ Invoke this command on a remote Python. """ cmd = [args.python, '-m', 'depends', args.requirement] env = dict(PYTHONPATH=os.path.dirname(__file__)) return subprocess.check_call(cmd, env=env)
[ "def", "check_dependencies_remote", "(", "args", ")", ":", "cmd", "=", "[", "args", ".", "python", ",", "'-m'", ",", "'depends'", ",", "args", ".", "requirement", "]", "env", "=", "dict", "(", "PYTHONPATH", "=", "os", ".", "path", ".", "dirname", "(", ...
Invoke this command on a remote Python.
[ "Invoke", "this", "command", "on", "a", "remote", "Python", "." ]
python
train
psss/did
did/plugins/bugzilla.py
https://github.com/psss/did/blob/04e4ee6f1aa14c0cae3ba9f9803871f3f98279cb/did/plugins/bugzilla.py#L258-L264
def subscribed(self, user): """ True if CC was added in given time frame """ for who, record in self.logs: if (record["field_name"] == "cc" and user.email in record["added"]): return True return False
[ "def", "subscribed", "(", "self", ",", "user", ")", ":", "for", "who", ",", "record", "in", "self", ".", "logs", ":", "if", "(", "record", "[", "\"field_name\"", "]", "==", "\"cc\"", "and", "user", ".", "email", "in", "record", "[", "\"added\"", "]",...
True if CC was added in given time frame
[ "True", "if", "CC", "was", "added", "in", "given", "time", "frame" ]
python
train
datastore/datastore
datastore/core/basic.py
https://github.com/datastore/datastore/blob/7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3/datastore/core/basic.py#L377-L382
def get(self, key): '''Return the object named by key or None if it does not exist. CacheShimDatastore first checks its ``cache_datastore``. ''' value = self.cache_datastore.get(key) return value if value is not None else self.child_datastore.get(key)
[ "def", "get", "(", "self", ",", "key", ")", ":", "value", "=", "self", ".", "cache_datastore", ".", "get", "(", "key", ")", "return", "value", "if", "value", "is", "not", "None", "else", "self", ".", "child_datastore", ".", "get", "(", "key", ")" ]
Return the object named by key or None if it does not exist. CacheShimDatastore first checks its ``cache_datastore``.
[ "Return", "the", "object", "named", "by", "key", "or", "None", "if", "it", "does", "not", "exist", ".", "CacheShimDatastore", "first", "checks", "its", "cache_datastore", "." ]
python
train
Azure/azure-cli-extensions
src/alias/azext_alias/_validators.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/alias/azext_alias/_validators.py#L188-L206
def _validate_alias_file_content(alias_file_path, url=''): """ Make sure the alias name and alias command in the alias file is in valid format. Args: The alias file path to import aliases from. """ alias_table = get_config_parser() try: alias_table.read(alias_file_path) ...
[ "def", "_validate_alias_file_content", "(", "alias_file_path", ",", "url", "=", "''", ")", ":", "alias_table", "=", "get_config_parser", "(", ")", "try", ":", "alias_table", ".", "read", "(", "alias_file_path", ")", "for", "alias_name", ",", "alias_command", "in...
Make sure the alias name and alias command in the alias file is in valid format. Args: The alias file path to import aliases from.
[ "Make", "sure", "the", "alias", "name", "and", "alias", "command", "in", "the", "alias", "file", "is", "in", "valid", "format", "." ]
python
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L353-L374
def close(self): """ Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler. """ if self.file is None: return # Close the pickle file. self.file.close() self.file = ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "file", "is", "None", ":", "return", "# Close the pickle file.", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "for", "f", "in", "self", ".", "mark_for_delete", ...
Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler.
[ "Close", "the", "pickle", "file", "and", "the", "zip", "archive", "file", ".", "The", "single", "zip", "archive", "file", "can", "now", "be", "shipped", "around", "to", "be", "loaded", "by", "the", "unpickler", "." ]
python
train
saltstack/salt
salt/grains/minion_process.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/minion_process.py#L34-L43
def _username(): ''' Grain for the minion username ''' if pwd: username = pwd.getpwuid(os.getuid()).pw_name else: username = getpass.getuser() return username
[ "def", "_username", "(", ")", ":", "if", "pwd", ":", "username", "=", "pwd", ".", "getpwuid", "(", "os", ".", "getuid", "(", ")", ")", ".", "pw_name", "else", ":", "username", "=", "getpass", ".", "getuser", "(", ")", "return", "username" ]
Grain for the minion username
[ "Grain", "for", "the", "minion", "username" ]
python
train
ManiacalLabs/BiblioPixel
bibliopixel/drivers/serial/devices.py
https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/drivers/serial/devices.py#L71-L94
def get_device(self, id=None): """Returns details of either the first or specified device :param int id: Identifier of desired device. If not given, first device found will be returned :returns tuple: Device ID, Device Address, Firmware Version """ if id is None: ...
[ "def", "get_device", "(", "self", ",", "id", "=", "None", ")", ":", "if", "id", "is", "None", ":", "if", "not", "self", ".", "devices", ":", "raise", "ValueError", "(", "'No default device for %s'", "%", "self", ".", "hardware_id", ")", "id", ",", "(",...
Returns details of either the first or specified device :param int id: Identifier of desired device. If not given, first device found will be returned :returns tuple: Device ID, Device Address, Firmware Version
[ "Returns", "details", "of", "either", "the", "first", "or", "specified", "device" ]
python
valid
Diaoul/pyextdirect
pyextdirect/router.py
https://github.com/Diaoul/pyextdirect/blob/34ddfe882d467b3769644e8131fb90fe472eff80/pyextdirect/router.py#L117-L133
def create_instances(configuration): """Create necessary class instances from a configuration with no argument to the constructor :param dict configuration: configuration dict like in :attr:`~pyextdirect.configuration.Base.configuration` :return: a class-instance mapping :rtype: dict """ insta...
[ "def", "create_instances", "(", "configuration", ")", ":", "instances", "=", "{", "}", "for", "methods", "in", "configuration", ".", "itervalues", "(", ")", ":", "for", "element", "in", "methods", ".", "itervalues", "(", ")", ":", "if", "not", "isinstance"...
Create necessary class instances from a configuration with no argument to the constructor :param dict configuration: configuration dict like in :attr:`~pyextdirect.configuration.Base.configuration` :return: a class-instance mapping :rtype: dict
[ "Create", "necessary", "class", "instances", "from", "a", "configuration", "with", "no", "argument", "to", "the", "constructor" ]
python
train
senaite/senaite.core.supermodel
src/senaite/core/supermodel/model.py
https://github.com/senaite/senaite.core.supermodel/blob/1819154332b8776f187aa98a2e299701983a0119/src/senaite/core/supermodel/model.py#L312-L342
def stringify(self, value): """Convert value to string This method is used to generate a simple JSON representation of the object (without dereferencing objects etc.) """ # SuperModel -> UID if ISuperModel.providedBy(value): return str(value) # DateTi...
[ "def", "stringify", "(", "self", ",", "value", ")", ":", "# SuperModel -> UID", "if", "ISuperModel", ".", "providedBy", "(", "value", ")", ":", "return", "str", "(", "value", ")", "# DateTime -> ISO8601 format", "elif", "isinstance", "(", "value", ",", "(", ...
Convert value to string This method is used to generate a simple JSON representation of the object (without dereferencing objects etc.)
[ "Convert", "value", "to", "string" ]
python
train
frmdstryr/enamlx
enamlx/qt/qt_occ_viewer.py
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_occ_viewer.py#L160-L182
def GetHandle(self): ''' returns an the identifier of the GUI widget. It must be an integer ''' win_id = self.winId() # this returns either an int or voitptr if "%s"%type(win_id) == "<type 'PyCObject'>": # PySide ### with PySide, self.winId() does not return...
[ "def", "GetHandle", "(", "self", ")", ":", "win_id", "=", "self", ".", "winId", "(", ")", "# this returns either an int or voitptr\r", "if", "\"%s\"", "%", "type", "(", "win_id", ")", "==", "\"<type 'PyCObject'>\"", ":", "# PySide\r", "### with PySide, self.winId() ...
returns an the identifier of the GUI widget. It must be an integer
[ "returns", "an", "the", "identifier", "of", "the", "GUI", "widget", ".", "It", "must", "be", "an", "integer" ]
python
train
holgern/pyedflib
pyedflib/edfwriter.py
https://github.com/holgern/pyedflib/blob/0f787fc1202b84a6f30d098296acf72666eaeeb4/pyedflib/edfwriter.py#L364-L381
def set_number_of_annotation_signals(self, number_of_annotations): """ Sets the number of annotation signals. The default value is 1 This function is optional and can be called only after opening a file in writemode and before the first sample write action Normally you don't need...
[ "def", "set_number_of_annotation_signals", "(", "self", ",", "number_of_annotations", ")", ":", "number_of_annotations", "=", "max", "(", "(", "min", "(", "(", "int", "(", "number_of_annotations", ")", ",", "64", ")", ")", ",", "1", ")", ")", "self", ".", ...
Sets the number of annotation signals. The default value is 1 This function is optional and can be called only after opening a file in writemode and before the first sample write action Normally you don't need to change the default value. Only when the number of annotations you want to w...
[ "Sets", "the", "number", "of", "annotation", "signals", ".", "The", "default", "value", "is", "1", "This", "function", "is", "optional", "and", "can", "be", "called", "only", "after", "opening", "a", "file", "in", "writemode", "and", "before", "the", "firs...
python
train
josuebrunel/myql
myql/contrib/table/base.py
https://github.com/josuebrunel/myql/blob/891bad29cc83a81b3f5ebc4d0401d6f2c22f119e/myql/contrib/table/base.py#L68-L84
def addUrl(self, url): """Add url to binder """ if url not in self.urls: self.urls.append(url) root = self.etree t_urls = root.find('urls') if not t_urls: t_urls = ctree.SubElement(root, 'urls') t_url = ctree.SubElement(t_urls, 'url') ...
[ "def", "addUrl", "(", "self", ",", "url", ")", ":", "if", "url", "not", "in", "self", ".", "urls", ":", "self", ".", "urls", ".", "append", "(", "url", ")", "root", "=", "self", ".", "etree", "t_urls", "=", "root", ".", "find", "(", "'urls'", "...
Add url to binder
[ "Add", "url", "to", "binder" ]
python
train
hyperledger/indy-sdk
wrappers/python/indy/did.py
https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/wrappers/python/indy/did.py#L408-L445
async def get_endpoint_for_did(wallet_handle: int, pool_handle: int, did: str) -> (str, Optional[str]): """ Returns endpoint information for the given DID. :param wallet_handle: Wallet handle (created by open_wallet). :param pool_handle: Poo...
[ "async", "def", "get_endpoint_for_did", "(", "wallet_handle", ":", "int", ",", "pool_handle", ":", "int", ",", "did", ":", "str", ")", "->", "(", "str", ",", "Optional", "[", "str", "]", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__nam...
Returns endpoint information for the given DID. :param wallet_handle: Wallet handle (created by open_wallet). :param pool_handle: Pool handle (created by open_pool). :param did: The DID to resolve endpoint. :return: (endpoint, transport_vk)
[ "Returns", "endpoint", "information", "for", "the", "given", "DID", "." ]
python
train
secure-systems-lab/securesystemslib
securesystemslib/interface.py
https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L527-L572
def import_ed25519_publickey_from_file(filepath): """ <Purpose> Load the ED25519 public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format. If the key object in 'filepath' contains a private ...
[ "def", "import_ed25519_publickey_from_file", "(", "filepath", ")", ":", "# Does 'filepath' have the correct format?", "# Ensure the arguments have the appropriate number of objects and object", "# types, and that all dict keys are properly named.", "# Raise 'securesystemslib.exceptions.FormatError...
<Purpose> Load the ED25519 public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format. If the key object in 'filepath' contains a private key, it is discarded. <Arguments> filepath: <...
[ "<Purpose", ">", "Load", "the", "ED25519", "public", "key", "object", "(", "conformant", "to", "securesystemslib", ".", "formats", ".", "KEY_SCHEMA", ")", "stored", "in", "filepath", ".", "Return", "filepath", "in", "securesystemslib", ".", "formats", ".", "ED...
python
train
boppreh/keyboard
keyboard/__init__.py
https://github.com/boppreh/keyboard/blob/dbb73dfff484f733d5fed8dbc53301af5b6c7f50/keyboard/__init__.py#L480-L502
def hook_key(key, callback, suppress=False): """ Hooks key up and key down events for a single key. Returns the event handler created. To remove a hooked key use `unhook_key(key)` or `unhook_key(handler)`. Note: this function shares state with hotkeys, so `clear_all_hotkeys` affects it aswell. ...
[ "def", "hook_key", "(", "key", ",", "callback", ",", "suppress", "=", "False", ")", ":", "_listener", ".", "start_if_necessary", "(", ")", "store", "=", "_listener", ".", "blocking_keys", "if", "suppress", "else", "_listener", ".", "nonblocking_keys", "scan_co...
Hooks key up and key down events for a single key. Returns the event handler created. To remove a hooked key use `unhook_key(key)` or `unhook_key(handler)`. Note: this function shares state with hotkeys, so `clear_all_hotkeys` affects it aswell.
[ "Hooks", "key", "up", "and", "key", "down", "events", "for", "a", "single", "key", ".", "Returns", "the", "event", "handler", "created", ".", "To", "remove", "a", "hooked", "key", "use", "unhook_key", "(", "key", ")", "or", "unhook_key", "(", "handler", ...
python
train
CalebBell/ht
ht/insulation.py
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/insulation.py#L628-L673
def k_material(ID, T=298.15): r'''Returns thermal conductivity of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Thermal conductivity may or may not be dependent on temperature depending on the source used. Function must be provided with either a key to one of the d...
[ "def", "k_material", "(", "ID", ",", "T", "=", "298.15", ")", ":", "if", "ID", "not", "in", "materials_dict", ":", "ID", "=", "nearest_material", "(", "ID", ")", "if", "ID", "in", "refractories", ":", "return", "refractory_VDI_k", "(", "ID", ",", "T", ...
r'''Returns thermal conductivity of a building, insulating, or refractory material from tables in [1]_, [2]_, and [3]_. Thermal conductivity may or may not be dependent on temperature depending on the source used. Function must be provided with either a key to one of the dictionaries `refractories`, `A...
[ "r", "Returns", "thermal", "conductivity", "of", "a", "building", "insulating", "or", "refractory", "material", "from", "tables", "in", "[", "1", "]", "_", "[", "2", "]", "_", "and", "[", "3", "]", "_", ".", "Thermal", "conductivity", "may", "or", "may...
python
train
fracpete/python-weka-wrapper3
python/weka/core/capabilities.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/capabilities.py#L181-L192
def dependencies(self): """ Returns all the dependencies. :return: the dependency list :rtype: list """ result = [] iterator = javabridge.iterate_java(javabridge.call(self.jobject, "dependencies", "()Ljava/util/Iterator;")) for c in iterator: ...
[ "def", "dependencies", "(", "self", ")", ":", "result", "=", "[", "]", "iterator", "=", "javabridge", ".", "iterate_java", "(", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"dependencies\"", ",", "\"()Ljava/util/Iterator;\"", ")", ")", "for...
Returns all the dependencies. :return: the dependency list :rtype: list
[ "Returns", "all", "the", "dependencies", "." ]
python
train
OpenKMIP/PyKMIP
kmip/core/primitives.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/primitives.py#L357-L369
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the encoding of the LongInteger to the output stream. Args: ostream (stream): A buffer to contain the encoded bytes of a LongInteger. Usually a BytearrayStream object. Required. ...
[ "def", "write", "(", "self", ",", "ostream", ",", "kmip_version", "=", "enums", ".", "KMIPVersion", ".", "KMIP_1_0", ")", ":", "super", "(", "LongInteger", ",", "self", ")", ".", "write", "(", "ostream", ",", "kmip_version", "=", "kmip_version", ")", "os...
Write the encoding of the LongInteger to the output stream. Args: ostream (stream): A buffer to contain the encoded bytes of a LongInteger. Usually a BytearrayStream object. Required. kmip_version (KMIPVersion): An enumeration defining the KMIP version wi...
[ "Write", "the", "encoding", "of", "the", "LongInteger", "to", "the", "output", "stream", "." ]
python
test