repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
codelv/enaml-native
src/enamlnative/android/app.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/app.py#L153-L171
def show_toast(self, msg, long=True): """ Show a toast message for the given duration. This is an android specific api. Parameters ----------- msg: str Text to display in the toast message long: bool Display for a long or short (system defined) du...
[ "def", "show_toast", "(", "self", ",", "msg", ",", "long", "=", "True", ")", ":", "from", ".", "android_toast", "import", "Toast", "def", "on_toast", "(", "ref", ")", ":", "t", "=", "Toast", "(", "__id__", "=", "ref", ")", "t", ".", "show", "(", ...
Show a toast message for the given duration. This is an android specific api. Parameters ----------- msg: str Text to display in the toast message long: bool Display for a long or short (system defined) duration
[ "Show", "a", "toast", "message", "for", "the", "given", "duration", ".", "This", "is", "an", "android", "specific", "api", "." ]
python
train
27
idlesign/uwsgiconf
uwsgiconf/config.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/config.py#L363-L375
def set_fallback(self, target): """Sets a fallback configuration for section. Re-exec uWSGI with the specified config when exit code is 1. :param str|unicode|Section target: File path or Section to include. """ if isinstance(target, Section): target = ':' + target.n...
[ "def", "set_fallback", "(", "self", ",", "target", ")", ":", "if", "isinstance", "(", "target", ",", "Section", ")", ":", "target", "=", "':'", "+", "target", ".", "name", "self", ".", "_set", "(", "'fallback-config'", ",", "target", ")", "return", "se...
Sets a fallback configuration for section. Re-exec uWSGI with the specified config when exit code is 1. :param str|unicode|Section target: File path or Section to include.
[ "Sets", "a", "fallback", "configuration", "for", "section", "." ]
python
train
29.076923
trec-kba/streamcorpus-pipeline
streamcorpus_pipeline/_pipeline.py
https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_pipeline.py#L352-L371
def _init_all_stages(self, config): '''Create stages that are used for the pipeline. :param dict config: `streamcorpus_pipeline` configuration :return: tuple of (reader, incremental transforms, batch transforms, post-batch incremental transforms, writers, temporary directory...
[ "def", "_init_all_stages", "(", "self", ",", "config", ")", ":", "reader", "=", "self", ".", "_init_stage", "(", "config", ",", "'reader'", ")", "incremental_transforms", "=", "self", ".", "_init_stages", "(", "config", ",", "'incremental_transforms'", ")", "b...
Create stages that are used for the pipeline. :param dict config: `streamcorpus_pipeline` configuration :return: tuple of (reader, incremental transforms, batch transforms, post-batch incremental transforms, writers, temporary directory)
[ "Create", "stages", "that", "are", "used", "for", "the", "pipeline", "." ]
python
test
48.5
DarkEnergySurvey/ugali
ugali/isochrone/model.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/isochrone/model.py#L350-L381
def absolute_magnitude(self, richness=1, steps=1e4): """ Calculate the absolute visual magnitude (Mv) from the richness by transforming the isochrone in the SDSS system and using the g,r -> V transform equations from Jester 2005 [astro-ph/0506022]. Parameters: -...
[ "def", "absolute_magnitude", "(", "self", ",", "richness", "=", "1", ",", "steps", "=", "1e4", ")", ":", "# Using the SDSS g,r -> V from Jester 2005 [astro-ph/0506022]", "# for stars with R-I < 1.15", "# V = g_sdss - 0.59*(g_sdss - r_sdss) - 0.01", "# Create a copy of the isochrone...
Calculate the absolute visual magnitude (Mv) from the richness by transforming the isochrone in the SDSS system and using the g,r -> V transform equations from Jester 2005 [astro-ph/0506022]. Parameters: ----------- richness : isochrone normalization parameter s...
[ "Calculate", "the", "absolute", "visual", "magnitude", "(", "Mv", ")", "from", "the", "richness", "by", "transforming", "the", "isochrone", "in", "the", "SDSS", "system", "and", "using", "the", "g", "r", "-", ">", "V", "transform", "equations", "from", "Je...
python
train
35.53125
jtwhite79/pyemu
pyemu/utils/helpers.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/helpers.py#L3628-L3677
def write_const_tpl(name, tpl_file, suffix, zn_array=None, shape=None, spatial_reference=None, longnames=False): """ write a constant (uniform) template file Parameters ---------- name : str the base parameter name tpl_file : str the template file to write - incl...
[ "def", "write_const_tpl", "(", "name", ",", "tpl_file", ",", "suffix", ",", "zn_array", "=", "None", ",", "shape", "=", "None", ",", "spatial_reference", "=", "None", ",", "longnames", "=", "False", ")", ":", "if", "shape", "is", "None", "and", "zn_array...
write a constant (uniform) template file Parameters ---------- name : str the base parameter name tpl_file : str the template file to write - include path zn_array : numpy.ndarray an array used to skip inactive cells Returns ------- df : pandas.DataFrame ...
[ "write", "a", "constant", "(", "uniform", ")", "template", "file" ]
python
train
32.96
pri22296/beautifultable
beautifultable/beautifultable.py
https://github.com/pri22296/beautifultable/blob/c9638f73dff4bb1f341c9ee783e4e47f26efba0b/beautifultable/beautifultable.py#L629-L701
def _calculate_column_widths(self): """Calculate width of column automatically based on data.""" table_width = self.get_table_width() lpw, rpw = self._left_padding_widths, self._right_padding_widths pad_widths = [(lpw[i] + rpw[i]) for i in range(self._column_count)] max_widths = ...
[ "def", "_calculate_column_widths", "(", "self", ")", ":", "table_width", "=", "self", ".", "get_table_width", "(", ")", "lpw", ",", "rpw", "=", "self", ".", "_left_padding_widths", ",", "self", ".", "_right_padding_widths", "pad_widths", "=", "[", "(", "lpw", ...
Calculate width of column automatically based on data.
[ "Calculate", "width", "of", "column", "automatically", "based", "on", "data", "." ]
python
train
45.246575
ScriptSmith/socialreaper
socialreaper/tools.py
https://github.com/ScriptSmith/socialreaper/blob/87fcc3b74bbed6c4f8e7f49a5f0eb8a616cf38da/socialreaper/tools.py#L31-L49
def fill_gaps(list_dicts): """ Fill gaps in a list of dictionaries. Add empty keys to dictionaries in the list that don't contain other entries' keys :param list_dicts: A list of dictionaries :return: A list of field names, a list of dictionaries with identical keys """ field_name...
[ "def", "fill_gaps", "(", "list_dicts", ")", ":", "field_names", "=", "[", "]", "# != set bc. preserving order is better for output\r", "for", "datum", "in", "list_dicts", ":", "for", "key", "in", "datum", ".", "keys", "(", ")", ":", "if", "key", "not", "in", ...
Fill gaps in a list of dictionaries. Add empty keys to dictionaries in the list that don't contain other entries' keys :param list_dicts: A list of dictionaries :return: A list of field names, a list of dictionaries with identical keys
[ "Fill", "gaps", "in", "a", "list", "of", "dictionaries", ".", "Add", "empty", "keys", "to", "dictionaries", "in", "the", "list", "that", "don", "t", "contain", "other", "entries", "keys", ":", "param", "list_dicts", ":", "A", "list", "of", "dictionaries", ...
python
valid
35.631579
Microsoft/LightGBM
python-package/lightgbm/basic.py
https://github.com/Microsoft/LightGBM/blob/8d2ec69f4f685b0ab1c4624d59ee2d3287bb3147/python-package/lightgbm/basic.py#L1114-L1160
def set_field(self, field_name, data): """Set property into the Dataset. Parameters ---------- field_name : string The field name of the information. data : list, numpy 1-D array, pandas Series or None The array of data to be set. Returns ...
[ "def", "set_field", "(", "self", ",", "field_name", ",", "data", ")", ":", "if", "self", ".", "handle", "is", "None", ":", "raise", "Exception", "(", "\"Cannot set %s before construct dataset\"", "%", "field_name", ")", "if", "data", "is", "None", ":", "# se...
Set property into the Dataset. Parameters ---------- field_name : string The field name of the information. data : list, numpy 1-D array, pandas Series or None The array of data to be set. Returns ------- self : Dataset Datase...
[ "Set", "property", "into", "the", "Dataset", "." ]
python
train
35.425532
twisted/axiom
axiom/item.py
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/item.py#L517-L525
def _schemaPrepareInsert(self, store): """ Prepare each attribute in my schema for insertion into a given store, either by upgrade or by creation. This makes sure all references point to this store and all relative paths point to this store's files directory. """ ...
[ "def", "_schemaPrepareInsert", "(", "self", ",", "store", ")", ":", "for", "name", ",", "atr", "in", "self", ".", "getSchema", "(", ")", ":", "atr", ".", "prepareInsert", "(", "self", ",", "store", ")" ]
Prepare each attribute in my schema for insertion into a given store, either by upgrade or by creation. This makes sure all references point to this store and all relative paths point to this store's files directory.
[ "Prepare", "each", "attribute", "in", "my", "schema", "for", "insertion", "into", "a", "given", "store", "either", "by", "upgrade", "or", "by", "creation", ".", "This", "makes", "sure", "all", "references", "point", "to", "this", "store", "and", "all", "re...
python
train
43.333333
google/grr
grr/server/grr_response_server/file_store.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/file_store.py#L211-L304
def AddFilesWithUnknownHashes( client_path_blob_refs, use_external_stores = True ): """Adds new files consisting of given blob references. Args: client_path_blob_refs: A dictionary mapping `db.ClientPath` instances to lists of blob references. use_external_stores: A flag indicating if the fil...
[ "def", "AddFilesWithUnknownHashes", "(", "client_path_blob_refs", ",", "use_external_stores", "=", "True", ")", ":", "hash_id_blob_refs", "=", "dict", "(", ")", "client_path_hash_id", "=", "dict", "(", ")", "metadatas", "=", "dict", "(", ")", "all_client_path_blob_r...
Adds new files consisting of given blob references. Args: client_path_blob_refs: A dictionary mapping `db.ClientPath` instances to lists of blob references. use_external_stores: A flag indicating if the files should also be added to external file stores. Returns: A dictionary mapping `db.C...
[ "Adds", "new", "files", "consisting", "of", "given", "blob", "references", "." ]
python
train
37.244681
gwastro/pycbc
pycbc/workflow/psdfiles.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/psdfiles.py#L91-L151
def setup_psd_pregenerated(workflow, tags=None): ''' Setup CBC workflow to use pregenerated psd files. The file given in cp.get('workflow','pregenerated-psd-file-(ifo)') will be used as the --psd-file argument to geom_nonspinbank, geom_aligned_bank and pycbc_plot_psd_file. Parameters ------...
[ "def", "setup_psd_pregenerated", "(", "workflow", ",", "tags", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "[", "]", "psd_files", "=", "FileList", "(", "[", "]", ")", "cp", "=", "workflow", ".", "cp", "global_seg", "=", "work...
Setup CBC workflow to use pregenerated psd files. The file given in cp.get('workflow','pregenerated-psd-file-(ifo)') will be used as the --psd-file argument to geom_nonspinbank, geom_aligned_bank and pycbc_plot_psd_file. Parameters ---------- workflow: pycbc.workflow.core.Workflow An in...
[ "Setup", "CBC", "workflow", "to", "use", "pregenerated", "psd", "files", ".", "The", "file", "given", "in", "cp", ".", "get", "(", "workflow", "pregenerated", "-", "psd", "-", "file", "-", "(", "ifo", ")", ")", "will", "be", "used", "as", "the", "--"...
python
train
38.836066
ibis-project/ibis
ibis/clickhouse/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/clickhouse/client.py#L317-L336
def list_databases(self, like=None): """ List databases in the Clickhouse cluster. Like the SHOW DATABASES command in the clickhouse-shell. Parameters ---------- like : string, default None e.g. 'foo*' to match all tables starting with 'foo' Returns ...
[ "def", "list_databases", "(", "self", ",", "like", "=", "None", ")", ":", "statement", "=", "'SELECT name FROM system.databases'", "if", "like", ":", "statement", "+=", "\" WHERE name LIKE '{0}'\"", ".", "format", "(", "like", ")", "data", ",", "_", ",", "_", ...
List databases in the Clickhouse cluster. Like the SHOW DATABASES command in the clickhouse-shell. Parameters ---------- like : string, default None e.g. 'foo*' to match all tables starting with 'foo' Returns ------- databases : list of strings
[ "List", "databases", "in", "the", "Clickhouse", "cluster", ".", "Like", "the", "SHOW", "DATABASES", "command", "in", "the", "clickhouse", "-", "shell", "." ]
python
train
29.05
shazow/workerpool
samples/blockingworker.py
https://github.com/shazow/workerpool/blob/2c5b29ec64ffbc94fc3623a4531eaf7c7c1a9ab5/samples/blockingworker.py#L16-L20
def put(self, job, result): "Perform a job by a member in the pool and return the result." self.job.put(job) r = result.get() return r
[ "def", "put", "(", "self", ",", "job", ",", "result", ")", ":", "self", ".", "job", ".", "put", "(", "job", ")", "r", "=", "result", ".", "get", "(", ")", "return", "r" ]
Perform a job by a member in the pool and return the result.
[ "Perform", "a", "job", "by", "a", "member", "in", "the", "pool", "and", "return", "the", "result", "." ]
python
train
32.4
pallets/flask-sqlalchemy
examples/flaskr/flaskr/blog/views.py
https://github.com/pallets/flask-sqlalchemy/blob/3d3261f4fc6d28f5bf407cf7d523e36a09a8c144/examples/flaskr/flaskr/blog/views.py#L46-L63
def create(): """Create a new post for the current user.""" if request.method == "POST": title = request.form["title"] body = request.form["body"] error = None if not title: error = "Title is required." if error is not None: flash(error) ...
[ "def", "create", "(", ")", ":", "if", "request", ".", "method", "==", "\"POST\"", ":", "title", "=", "request", ".", "form", "[", "\"title\"", "]", "body", "=", "request", ".", "form", "[", "\"body\"", "]", "error", "=", "None", "if", "not", "title",...
Create a new post for the current user.
[ "Create", "a", "new", "post", "for", "the", "current", "user", "." ]
python
train
28.388889
cyrus-/cypy
cypy/cg.py
https://github.com/cyrus-/cypy/blob/04bb59e91fa314e8cf987743189c77a9b6bc371d/cypy/cg.py#L298-L308
def pop_context(self): """Pops the last set of keyword arguments provided to the processor.""" processor = getattr(self, 'processor', None) if processor is not None: pop_context = getattr(processor, 'pop_context', None) if pop_context is None: pop_context ...
[ "def", "pop_context", "(", "self", ")", ":", "processor", "=", "getattr", "(", "self", ",", "'processor'", ",", "None", ")", "if", "processor", "is", "not", "None", ":", "pop_context", "=", "getattr", "(", "processor", ",", "'pop_context'", ",", "None", ...
Pops the last set of keyword arguments provided to the processor.
[ "Pops", "the", "last", "set", "of", "keyword", "arguments", "provided", "to", "the", "processor", "." ]
python
train
43.818182
mozilla-releng/scriptworker
scriptworker/artifacts.py
https://github.com/mozilla-releng/scriptworker/blob/8e97bbd83b9b578565ec57904c966dd6ae4ef0ae/scriptworker/artifacts.py#L111-L129
def guess_content_type_and_encoding(path): """Guess the content type of a path, using ``mimetypes``. Falls back to "application/binary" if no content type is found. Args: path (str): the path to guess the mimetype of Returns: str: the content type of the file """ for ext, con...
[ "def", "guess_content_type_and_encoding", "(", "path", ")", ":", "for", "ext", ",", "content_type", "in", "_EXTENSION_TO_MIME_TYPE", ".", "items", "(", ")", ":", "if", "path", ".", "endswith", "(", "ext", ")", ":", "return", "content_type", "content_type", ","...
Guess the content type of a path, using ``mimetypes``. Falls back to "application/binary" if no content type is found. Args: path (str): the path to guess the mimetype of Returns: str: the content type of the file
[ "Guess", "the", "content", "type", "of", "a", "path", "using", "mimetypes", "." ]
python
train
29.315789
spencerahill/aospy
aospy/data_loader.py
https://github.com/spencerahill/aospy/blob/2f6e775b9b9956c54af117fdcdce2c87196afb6c/aospy/data_loader.py#L277-L324
def load_variable(self, var=None, start_date=None, end_date=None, time_offset=None, grid_attrs=None, **DataAttrs): """Load a DataArray for requested variable and time range. Automatically renames all grid attributes to match aospy conventions. Parameters ---------...
[ "def", "load_variable", "(", "self", ",", "var", "=", "None", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ",", "time_offset", "=", "None", ",", "grid_attrs", "=", "None", ",", "*", "*", "DataAttrs", ")", ":", "file_set", "=", "self", ...
Load a DataArray for requested variable and time range. Automatically renames all grid attributes to match aospy conventions. Parameters ---------- var : Var aospy Var object start_date : datetime.datetime start date for interval end_date : datet...
[ "Load", "a", "DataArray", "for", "requested", "variable", "and", "time", "range", "." ]
python
train
42.479167
yaz/yaz
examples/02_food.py
https://github.com/yaz/yaz/blob/48c842fe053bf9cd6446c4b33fb081c65339aa48/examples/02_food.py#L46-L48
def breakfast(self, message="Breakfast is ready", shout: bool = False): """Say something in the morning""" return self.helper.output(message, shout)
[ "def", "breakfast", "(", "self", ",", "message", "=", "\"Breakfast is ready\"", ",", "shout", ":", "bool", "=", "False", ")", ":", "return", "self", ".", "helper", ".", "output", "(", "message", ",", "shout", ")" ]
Say something in the morning
[ "Say", "something", "in", "the", "morning" ]
python
valid
54
manahl/arctic
arctic/store/_pandas_ndarray_store.py
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L74-L90
def _index_range(self, version, symbol, date_range=None, **kwargs): """ Given a version, read the segment_index and return the chunks associated with the date_range. As the segment index is (id -> last datetime) we need to take care in choosing the correct chunks. """ if date_range and '...
[ "def", "_index_range", "(", "self", ",", "version", ",", "symbol", ",", "date_range", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "date_range", "and", "'segment_index'", "in", "version", ":", "# index is read-only but it's never written to", "index", "...
Given a version, read the segment_index and return the chunks associated with the date_range. As the segment index is (id -> last datetime) we need to take care in choosing the correct chunks.
[ "Given", "a", "version", "read", "the", "segment_index", "and", "return", "the", "chunks", "associated", "with", "the", "date_range", ".", "As", "the", "segment", "index", "is", "(", "id", "-", ">", "last", "datetime", ")", "we", "need", "to", "take", "c...
python
train
61.941176
miguelgrinberg/Flask-MarrowMailer
flask_marrowmailer.py
https://github.com/miguelgrinberg/Flask-MarrowMailer/blob/daf1ac0745fb31db2f43f4f7dc24c6f50ae96764/flask_marrowmailer.py#L11-L25
def render_template(self, plain, rich = None, **context): '''Render the body of the message from a template. The plain body will be rendered from a template named ``plain`` or ``plain + '.txt'`` (in that order of preference). The rich body will be rendered from ``rich`` if given, or el...
[ "def", "render_template", "(", "self", ",", "plain", ",", "rich", "=", "None", ",", "*", "*", "context", ")", ":", "self", ".", "plain", "=", "render_template", "(", "[", "plain", ",", "plain", "+", "'.txt'", "]", ",", "*", "*", "context", ")", "if...
Render the body of the message from a template. The plain body will be rendered from a template named ``plain`` or ``plain + '.txt'`` (in that order of preference). The rich body will be rendered from ``rich`` if given, or else from ``plain + '.html'``. If neither exists, then the mes...
[ "Render", "the", "body", "of", "the", "message", "from", "a", "template", ".", "The", "plain", "body", "will", "be", "rendered", "from", "a", "template", "named", "plain", "or", "plain", "+", ".", "txt", "(", "in", "that", "order", "of", "preference", ...
python
train
48.933333
praekelt/vumi-http-api
vumi_http_api/concurrency_limiter.py
https://github.com/praekelt/vumi-http-api/blob/0d7cf1cb71794c93272c19095cf8c37f4c250a59/vumi_http_api/concurrency_limiter.py#L143-L152
def stop(self, key): """ Stop a concurrent operation. This gets the concurrency limiter for the given key (creating it if necessary) and stops a concurrent operation on it. If the concurrency limiter is empty, it is deleted. """ self._get_limiter(key).stop() ...
[ "def", "stop", "(", "self", ",", "key", ")", ":", "self", ".", "_get_limiter", "(", "key", ")", ".", "stop", "(", ")", "self", ".", "_cleanup_limiter", "(", "key", ")" ]
Stop a concurrent operation. This gets the concurrency limiter for the given key (creating it if necessary) and stops a concurrent operation on it. If the concurrency limiter is empty, it is deleted.
[ "Stop", "a", "concurrent", "operation", "." ]
python
train
34.1
fhs/pyhdf
pyhdf/SD.py
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2939-L2956
def setname(self, dim_name): """Set the dimension name. Args:: dim_name dimension name; setting 2 dimensions to the same name make the dimensions "shared"; in order to be shared, the dimesions must be deined similarly. Returns:: ...
[ "def", "setname", "(", "self", ",", "dim_name", ")", ":", "status", "=", "_C", ".", "SDsetdimname", "(", "self", ".", "_id", ",", "dim_name", ")", "_checkErr", "(", "'setname'", ",", "status", ",", "'cannot execute'", ")" ]
Set the dimension name. Args:: dim_name dimension name; setting 2 dimensions to the same name make the dimensions "shared"; in order to be shared, the dimesions must be deined similarly. Returns:: None C library equivalent :...
[ "Set", "the", "dimension", "name", "." ]
python
train
29.388889
eerimoq/bincopy
bincopy.py
https://github.com/eerimoq/bincopy/blob/5e02cd001c3e9b54729425db6bffad5f03e1beac/bincopy.py#L146-L156
def pack_ihex(type_, address, size, data): """Create a Intel HEX record of given data. """ line = '{:02X}{:04X}{:02X}'.format(size, address, type_) if data: line += binascii.hexlify(data).decode('ascii').upper() return ':{}{:02X}'.format(line, crc_ihex(line))
[ "def", "pack_ihex", "(", "type_", ",", "address", ",", "size", ",", "data", ")", ":", "line", "=", "'{:02X}{:04X}{:02X}'", ".", "format", "(", "size", ",", "address", ",", "type_", ")", "if", "data", ":", "line", "+=", "binascii", ".", "hexlify", "(", ...
Create a Intel HEX record of given data.
[ "Create", "a", "Intel", "HEX", "record", "of", "given", "data", "." ]
python
train
25.545455
fastai/fastai
old/fastai/nlp.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/old/fastai/nlp.py#L263-L279
def get_model(self, opt_fn, emb_sz, n_hid, n_layers, **kwargs): """ Method returns a RNN_Learner object, that wraps an instance of the RNN_Encoder module. Args: opt_fn (Optimizer): the torch optimizer function to use emb_sz (int): embedding size n_hid (int): number o...
[ "def", "get_model", "(", "self", ",", "opt_fn", ",", "emb_sz", ",", "n_hid", ",", "n_layers", ",", "*", "*", "kwargs", ")", ":", "m", "=", "get_language_model", "(", "self", ".", "nt", ",", "emb_sz", ",", "n_hid", ",", "n_layers", ",", "self", ".", ...
Method returns a RNN_Learner object, that wraps an instance of the RNN_Encoder module. Args: opt_fn (Optimizer): the torch optimizer function to use emb_sz (int): embedding size n_hid (int): number of hidden inputs n_layers (int): number of hidden layers ...
[ "Method", "returns", "a", "RNN_Learner", "object", "that", "wraps", "an", "instance", "of", "the", "RNN_Encoder", "module", "." ]
python
train
39.470588
dossier/dossier.fc
python/dossier/fc/feature_tokens.py
https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_tokens.py#L45-L55
def tokens(self, si, k): '''`si` is a stream item and `k` is a key in this feature. The purpose of this method is to dereference the token pointers with respect to the given stream item. That is, it translates each sequence of token pointers to a sequence of `Token`. ''' ...
[ "def", "tokens", "(", "self", ",", "si", ",", "k", ")", ":", "for", "tokens", "in", "self", "[", "k", "]", ":", "yield", "[", "si", ".", "body", ".", "sentences", "[", "tagid", "]", "[", "sid", "]", ".", "tokens", "[", "tid", "]", "for", "tag...
`si` is a stream item and `k` is a key in this feature. The purpose of this method is to dereference the token pointers with respect to the given stream item. That is, it translates each sequence of token pointers to a sequence of `Token`.
[ "si", "is", "a", "stream", "item", "and", "k", "is", "a", "key", "in", "this", "feature", ".", "The", "purpose", "of", "this", "method", "is", "to", "dereference", "the", "token", "pointers", "with", "respect", "to", "the", "given", "stream", "item", "...
python
train
40.454545
quintusdias/glymur
glymur/codestream.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L451-L489
def _parse_plt_segment(self, fptr): """Parse the PLT segment. The packet headers are not parsed, i.e. they remain uninterpreted raw data buffers. Parameters ---------- fptr : file Open file object. Returns ------- PLTSegment ...
[ "def", "_parse_plt_segment", "(", "self", ",", "fptr", ")", ":", "offset", "=", "fptr", ".", "tell", "(", ")", "-", "2", "read_buffer", "=", "fptr", ".", "read", "(", "3", ")", "length", ",", "zplt", "=", "struct", ".", "unpack", "(", "'>HB'", ",",...
Parse the PLT segment. The packet headers are not parsed, i.e. they remain uninterpreted raw data buffers. Parameters ---------- fptr : file Open file object. Returns ------- PLTSegment The current PLT segment.
[ "Parse", "the", "PLT", "segment", "." ]
python
train
24.512821
flyingrub/scdl
scdl/scdl.py
https://github.com/flyingrub/scdl/blob/e833a22dd6676311b72fadd8a1c80f4a06acfad9/scdl/scdl.py#L591-L613
def in_download_archive(track): """ Returns True if a track_id exists in the download archive """ global arguments if not arguments['--download-archive']: return archive_filename = arguments.get('--download-archive') try: with open(archive_filename, 'a+', encoding='utf-8') a...
[ "def", "in_download_archive", "(", "track", ")", ":", "global", "arguments", "if", "not", "arguments", "[", "'--download-archive'", "]", ":", "return", "archive_filename", "=", "arguments", ".", "get", "(", "'--download-archive'", ")", "try", ":", "with", "open"...
Returns True if a track_id exists in the download archive
[ "Returns", "True", "if", "a", "track_id", "exists", "in", "the", "download", "archive" ]
python
train
32.304348
google/grr
grr/server/grr_response_server/databases/mysql_hunts.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_hunts.py#L401-L409
def CountHuntLogEntries(self, hunt_id, cursor=None): """Returns number of hunt log entries of a given hunt.""" hunt_id_int = db_utils.HuntIDToInt(hunt_id) query = ("SELECT COUNT(*) FROM flow_log_entries " "FORCE INDEX(flow_log_entries_by_hunt) " "WHERE hunt_id = %s AND flow_id = h...
[ "def", "CountHuntLogEntries", "(", "self", ",", "hunt_id", ",", "cursor", "=", "None", ")", ":", "hunt_id_int", "=", "db_utils", ".", "HuntIDToInt", "(", "hunt_id", ")", "query", "=", "(", "\"SELECT COUNT(*) FROM flow_log_entries \"", "\"FORCE INDEX(flow_log_entries_b...
Returns number of hunt log entries of a given hunt.
[ "Returns", "number", "of", "hunt", "log", "entries", "of", "a", "given", "hunt", "." ]
python
train
43.666667
materialsproject/pymatgen
pymatgen/io/abinit/works.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L903-L911
def plot_ebands(self, **kwargs): """ Plot the band structure. kwargs are passed to the plot method of :class:`ElectronBands`. Returns: `matplotlib` figure """ with self.nscf_task.open_gsr() as gsr: return gsr.ebands.plot(**kwargs)
[ "def", "plot_ebands", "(", "self", ",", "*", "*", "kwargs", ")", ":", "with", "self", ".", "nscf_task", ".", "open_gsr", "(", ")", "as", "gsr", ":", "return", "gsr", ".", "ebands", ".", "plot", "(", "*", "*", "kwargs", ")" ]
Plot the band structure. kwargs are passed to the plot method of :class:`ElectronBands`. Returns: `matplotlib` figure
[ "Plot", "the", "band", "structure", ".", "kwargs", "are", "passed", "to", "the", "plot", "method", "of", ":", "class", ":", "ElectronBands", "." ]
python
train
31.888889
wglass/lighthouse
lighthouse/haproxy/control.py
https://github.com/wglass/lighthouse/blob/f4ce6550895acc31e433ede0c05d366718a3ffe5/lighthouse/haproxy/control.py#L152-L160
def enable_node(self, service_name, node_name): """ Enables a given node name for the given service name via the "enable server" HAProxy command. """ logger.info("Enabling server %s/%s", service_name, node_name) return self.send_command( "enable server %s/%s" ...
[ "def", "enable_node", "(", "self", ",", "service_name", ",", "node_name", ")", ":", "logger", ".", "info", "(", "\"Enabling server %s/%s\"", ",", "service_name", ",", "node_name", ")", "return", "self", ".", "send_command", "(", "\"enable server %s/%s\"", "%", "...
Enables a given node name for the given service name via the "enable server" HAProxy command.
[ "Enables", "a", "given", "node", "name", "for", "the", "given", "service", "name", "via", "the", "enable", "server", "HAProxy", "command", "." ]
python
train
38.777778
jessevdk/cldoc
cldoc/clang/cindex.py
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L1569-L1574
def linkage(self): """Return the linkage of this cursor.""" if not hasattr(self, '_linkage'): self._linkage = conf.lib.clang_getCursorLinkage(self) return LinkageKind.from_id(self._linkage)
[ "def", "linkage", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_linkage'", ")", ":", "self", ".", "_linkage", "=", "conf", ".", "lib", ".", "clang_getCursorLinkage", "(", "self", ")", "return", "LinkageKind", ".", "from_id", "(", ...
Return the linkage of this cursor.
[ "Return", "the", "linkage", "of", "this", "cursor", "." ]
python
train
36.833333
ChrisBeaumont/smother
smother/python.py
https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/python.py#L210-L221
def context(self, line): """ Return the context for a given 1-offset line number. """ # XXX due to a limitation in Visitor, # non-python code after the last python code # in a file is not added to self.lines, so we # have to guard against IndexErrors. idx ...
[ "def", "context", "(", "self", ",", "line", ")", ":", "# XXX due to a limitation in Visitor,", "# non-python code after the last python code", "# in a file is not added to self.lines, so we", "# have to guard against IndexErrors.", "idx", "=", "line", "-", "1", "if", "idx", ">=...
Return the context for a given 1-offset line number.
[ "Return", "the", "context", "for", "a", "given", "1", "-", "offset", "line", "number", "." ]
python
train
34.666667
djgagne/hagelslag
hagelslag/processing/STObject.py
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L187-L195
def max_size(self): """ Gets the largest size of the object over all timesteps. Returns: Maximum size of the object in pixels """ sizes = np.array([m.sum() for m in self.masks]) return sizes.max()
[ "def", "max_size", "(", "self", ")", ":", "sizes", "=", "np", ".", "array", "(", "[", "m", ".", "sum", "(", ")", "for", "m", "in", "self", ".", "masks", "]", ")", "return", "sizes", ".", "max", "(", ")" ]
Gets the largest size of the object over all timesteps. Returns: Maximum size of the object in pixels
[ "Gets", "the", "largest", "size", "of", "the", "object", "over", "all", "timesteps", ".", "Returns", ":", "Maximum", "size", "of", "the", "object", "in", "pixels" ]
python
train
28.555556
yolothreat/utilitybelt
utilitybelt/utilitybelt.py
https://github.com/yolothreat/utilitybelt/blob/55ac6c31f87963d5e97be0402a4343c84846d118/utilitybelt/utilitybelt.py#L202-L226
def ip_to_geojson(ipaddress, name="Point"): """Generate GeoJSON for given IP address""" geo = ip_to_geo(ipaddress) point = { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "name": name ...
[ "def", "ip_to_geojson", "(", "ipaddress", ",", "name", "=", "\"Point\"", ")", ":", "geo", "=", "ip_to_geo", "(", "ipaddress", ")", "point", "=", "{", "\"type\"", ":", "\"FeatureCollection\"", ",", "\"features\"", ":", "[", "{", "\"type\"", ":", "\"Feature\""...
Generate GeoJSON for given IP address
[ "Generate", "GeoJSON", "for", "given", "IP", "address" ]
python
train
23.2
h2oai/h2o-3
h2o-py/h2o/frame.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/frame.py#L3205-L3216
def match(self, table, nomatch=0): """ Make a vector of the positions of (first) matches of its first argument in its second. Only applicable to single-column categorical/string frames. :param List table: the list of items to match against :param int nomatch: value that should ...
[ "def", "match", "(", "self", ",", "table", ",", "nomatch", "=", "0", ")", ":", "return", "H2OFrame", ".", "_expr", "(", "expr", "=", "ExprNode", "(", "\"match\"", ",", "self", ",", "table", ",", "nomatch", ",", "None", ")", ")" ]
Make a vector of the positions of (first) matches of its first argument in its second. Only applicable to single-column categorical/string frames. :param List table: the list of items to match against :param int nomatch: value that should be returned when there is no match. :returns: a...
[ "Make", "a", "vector", "of", "the", "positions", "of", "(", "first", ")", "matches", "of", "its", "first", "argument", "in", "its", "second", "." ]
python
test
49.916667
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/instance.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/instance.py#L164-L180
def copy(self): """Make a copy of this instance. Copies the local data stored as simple types and copies the client attached to this instance. :rtype: :class:`~google.cloud.spanner_v1.instance.Instance` :returns: A copy of the current instance. """ new_client = ...
[ "def", "copy", "(", "self", ")", ":", "new_client", "=", "self", ".", "_client", ".", "copy", "(", ")", "return", "self", ".", "__class__", "(", "self", ".", "instance_id", ",", "new_client", ",", "self", ".", "configuration_name", ",", "node_count", "="...
Make a copy of this instance. Copies the local data stored as simple types and copies the client attached to this instance. :rtype: :class:`~google.cloud.spanner_v1.instance.Instance` :returns: A copy of the current instance.
[ "Make", "a", "copy", "of", "this", "instance", "." ]
python
train
31.705882
llazzaro/analyzerdam
analyzerdam/yahooDAM.py
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/yahooDAM.py#L20-L26
def readQuotes(self, start, end): ''' read quotes from Yahoo Financial''' if self.symbol is None: LOG.debug('Symbol is None') return [] return self.__yf.getQuotes(self.symbol, start, end)
[ "def", "readQuotes", "(", "self", ",", "start", ",", "end", ")", ":", "if", "self", ".", "symbol", "is", "None", ":", "LOG", ".", "debug", "(", "'Symbol is None'", ")", "return", "[", "]", "return", "self", ".", "__yf", ".", "getQuotes", "(", "self",...
read quotes from Yahoo Financial
[ "read", "quotes", "from", "Yahoo", "Financial" ]
python
train
33.714286
briancappello/flask-unchained
flask_unchained/bundles/security/services/security_service.py
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/security/services/security_service.py#L229-L247
def send_reset_password_instructions(self, user): """ Sends the reset password instructions email for the specified user. Sends signal `reset_password_instructions_sent`. :param user: The user to send the instructions to. """ token = self.security_utils_service.generate...
[ "def", "send_reset_password_instructions", "(", "self", ",", "user", ")", ":", "token", "=", "self", ".", "security_utils_service", ".", "generate_reset_password_token", "(", "user", ")", "reset_link", "=", "url_for", "(", "'security_controller.reset_password'", ",", ...
Sends the reset password instructions email for the specified user. Sends signal `reset_password_instructions_sent`. :param user: The user to send the instructions to.
[ "Sends", "the", "reset", "password", "instructions", "email", "for", "the", "specified", "user", "." ]
python
train
45.842105
Jajcus/pyxmpp2
pyxmpp2/roster.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/roster.py#L237-L260
def as_xml(self, parent = None): """Make an XML element from self. :Parameters: - `parent`: Parent element :Types: - `parent`: :etree:`ElementTree.Element` """ if parent is not None: element = ElementTree.SubElement(parent, ITEM_TAG) e...
[ "def", "as_xml", "(", "self", ",", "parent", "=", "None", ")", ":", "if", "parent", "is", "not", "None", ":", "element", "=", "ElementTree", ".", "SubElement", "(", "parent", ",", "ITEM_TAG", ")", "else", ":", "element", "=", "ElementTree", ".", "Eleme...
Make an XML element from self. :Parameters: - `parent`: Parent element :Types: - `parent`: :etree:`ElementTree.Element`
[ "Make", "an", "XML", "element", "from", "self", "." ]
python
valid
34.75
quantopian/metautils
metautils/compat.py
https://github.com/quantopian/metautils/blob/10e11c5bd8bd7ded52b97261f61c3186607bd617/metautils/compat.py#L72-L96
def compose(*fs): """ Compose functions together in order: compose(f, g, h) = lambda n: f(g(h(n))) """ # Pull the iterator out into a tuple so we can call `composed` # more than once. rs = tuple(reversed(fs)) def composed(n): return reduce(lambda a, b: b(a), rs, n) # Attem...
[ "def", "compose", "(", "*", "fs", ")", ":", "# Pull the iterator out into a tuple so we can call `composed`", "# more than once.", "rs", "=", "tuple", "(", "reversed", "(", "fs", ")", ")", "def", "composed", "(", "n", ")", ":", "return", "reduce", "(", "lambda",...
Compose functions together in order: compose(f, g, h) = lambda n: f(g(h(n)))
[ "Compose", "functions", "together", "in", "order", ":" ]
python
train
28.84
Parsely/birding
src/birding/search.py
https://github.com/Parsely/birding/blob/c7f6eee56424234e361b1a455595de202e744dac/src/birding/search.py#L8-L19
def search_manager_from_config(config, **default_init): """Get a `SearchManager` instance dynamically based on config. `config` is a dictionary containing ``class`` and ``init`` keys as defined in :mod:`birding.config`. """ manager_cls = import_name(config['class'], default_ns='birding.search') ...
[ "def", "search_manager_from_config", "(", "config", ",", "*", "*", "default_init", ")", ":", "manager_cls", "=", "import_name", "(", "config", "[", "'class'", "]", ",", "default_ns", "=", "'birding.search'", ")", "init", "=", "{", "}", "init", ".", "update",...
Get a `SearchManager` instance dynamically based on config. `config` is a dictionary containing ``class`` and ``init`` keys as defined in :mod:`birding.config`.
[ "Get", "a", "SearchManager", "instance", "dynamically", "based", "on", "config", "." ]
python
train
36.166667
rkhleics/wagtailmenus
wagtailmenus/models/menus.py
https://github.com/rkhleics/wagtailmenus/blob/a41f240bed0d362e0d4dd4ef04a230f2b1827a93/wagtailmenus/models/menus.py#L451-L463
def _replace_with_specific_page(page, menu_item): """ If ``page`` is a vanilla ``Page` object, replace it with a 'specific' version of itself. Also update ``menu_item``, depending on whether it's a ``MenuItem`` object or a ``Page`` object. """ if type(page) is Page: ...
[ "def", "_replace_with_specific_page", "(", "page", ",", "menu_item", ")", ":", "if", "type", "(", "page", ")", "is", "Page", ":", "page", "=", "page", ".", "specific", "if", "isinstance", "(", "menu_item", ",", "MenuItem", ")", ":", "menu_item", ".", "li...
If ``page`` is a vanilla ``Page` object, replace it with a 'specific' version of itself. Also update ``menu_item``, depending on whether it's a ``MenuItem`` object or a ``Page`` object.
[ "If", "page", "is", "a", "vanilla", "Page", "object", "replace", "it", "with", "a", "specific", "version", "of", "itself", ".", "Also", "update", "menu_item", "depending", "on", "whether", "it", "s", "a", "MenuItem", "object", "or", "a", "Page", "object", ...
python
train
39.076923
spyder-ide/spyder
spyder/plugins/console/widgets/shell.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/shell.py#L768-L777
def _key_question(self, text): """Action for '?'""" if self.get_current_line_to_cursor(): last_obj = self.get_last_obj() if last_obj and not last_obj.isdigit(): self.show_object_info(last_obj) self.insert_text(text) # In case calltip and com...
[ "def", "_key_question", "(", "self", ",", "text", ")", ":", "if", "self", ".", "get_current_line_to_cursor", "(", ")", ":", "last_obj", "=", "self", ".", "get_last_obj", "(", ")", "if", "last_obj", "and", "not", "last_obj", ".", "isdigit", "(", ")", ":",...
Action for '?
[ "Action", "for", "?" ]
python
train
43.6
RJT1990/pyflux
pyflux/inference/bbvi.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/inference/bbvi.py#L138-L147
def get_means_and_scales_from_q(self): """ Gets the mean and scales for normal approximating parameters """ means = np.zeros(len(self.q)) scale = np.zeros(len(self.q)) for i in range(len(self.q)): means[i] = self.q[i].mu0 scale[i] = self.q[i].sigma...
[ "def", "get_means_and_scales_from_q", "(", "self", ")", ":", "means", "=", "np", ".", "zeros", "(", "len", "(", "self", ".", "q", ")", ")", "scale", "=", "np", ".", "zeros", "(", "len", "(", "self", ".", "q", ")", ")", "for", "i", "in", "range", ...
Gets the mean and scales for normal approximating parameters
[ "Gets", "the", "mean", "and", "scales", "for", "normal", "approximating", "parameters" ]
python
train
34.1
project-rig/rig
rig/place_and_route/wrapper.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/place_and_route/wrapper.py#L171-L296
def wrapper(vertices_resources, vertices_applications, nets, net_keys, machine, constraints=[], reserve_monitor=True, align_sdram=True, place=default_place, place_kwargs={}, allocate=default_allocate, allocate_kwargs={}, route=default_route, route_...
[ "def", "wrapper", "(", "vertices_resources", ",", "vertices_applications", ",", "nets", ",", "net_keys", ",", "machine", ",", "constraints", "=", "[", "]", ",", "reserve_monitor", "=", "True", ",", "align_sdram", "=", "True", ",", "place", "=", "default_place"...
Wrapper for core place-and-route tasks for the common case. At a high level this function essentially takes a set of vertices and nets and produces placements, memory allocations, routing tables and application loading information. .. warning:: This function is deprecated. New users should use...
[ "Wrapper", "for", "core", "place", "-", "and", "-", "route", "tasks", "for", "the", "common", "case", ".", "At", "a", "high", "level", "this", "function", "essentially", "takes", "a", "set", "of", "vertices", "and", "nets", "and", "produces", "placements",...
python
train
51.634921
erocarrera/pefile
pefile.py
https://github.com/erocarrera/pefile/blob/8a78a2e251a3f2336c232bf411133927b479edf2/pefile.py#L5214-L5220
def get_word_from_offset(self, offset): """Return the word value at the given file offset. (little endian)""" if offset+2 > len(self.__data__): return None return self.get_word_from_data(self.__data__[offset:offset+2], 0)
[ "def", "get_word_from_offset", "(", "self", ",", "offset", ")", ":", "if", "offset", "+", "2", ">", "len", "(", "self", ".", "__data__", ")", ":", "return", "None", "return", "self", ".", "get_word_from_data", "(", "self", ".", "__data__", "[", "offset",...
Return the word value at the given file offset. (little endian)
[ "Return", "the", "word", "value", "at", "the", "given", "file", "offset", ".", "(", "little", "endian", ")" ]
python
train
36.142857
rocky/python3-trepan
trepan/cli.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/cli.py#L41-L242
def main(dbg=None, sys_argv=list(sys.argv)): """Routine which gets run if we were invoked directly""" global __title__ # Save the original just for use in the restart that works via exec. orig_sys_argv = list(sys_argv) opts, dbg_opts, sys_argv = Moptions.process_options(__title__, ...
[ "def", "main", "(", "dbg", "=", "None", ",", "sys_argv", "=", "list", "(", "sys", ".", "argv", ")", ")", ":", "global", "__title__", "# Save the original just for use in the restart that works via exec.", "orig_sys_argv", "=", "list", "(", "sys_argv", ")", "opts",...
Routine which gets run if we were invoked directly
[ "Routine", "which", "gets", "run", "if", "we", "were", "invoked", "directly" ]
python
test
39.539604
mandiant/ioc_writer
ioc_writer/managers/upgrade_10.py
https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/managers/upgrade_10.py#L79-L94
def parse(self, fn): """ Parses a file into a lxml.etree structure with namespaces remove. This tree is added to self.iocs. :param fn: File to parse. :return: """ ioc_xml = xmlutils.read_xml_no_ns(fn) if not ioc_xml: return False root = ioc_x...
[ "def", "parse", "(", "self", ",", "fn", ")", ":", "ioc_xml", "=", "xmlutils", ".", "read_xml_no_ns", "(", "fn", ")", "if", "not", "ioc_xml", ":", "return", "False", "root", "=", "ioc_xml", ".", "getroot", "(", ")", "iocid", "=", "root", ".", "get", ...
Parses a file into a lxml.etree structure with namespaces remove. This tree is added to self.iocs. :param fn: File to parse. :return:
[ "Parses", "a", "file", "into", "a", "lxml", ".", "etree", "structure", "with", "namespaces", "remove", ".", "This", "tree", "is", "added", "to", "self", ".", "iocs", "." ]
python
train
28.5
materialsproject/pymatgen
pymatgen/apps/borg/queen.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L64-L83
def parallel_assimilate(self, rootpath): """ Assimilate the entire subdirectory structure in rootpath. """ logger.info('Scanning for valid paths...') valid_paths = [] for (parent, subdirs, files) in os.walk(rootpath): valid_paths.extend(self._drone.get_valid_p...
[ "def", "parallel_assimilate", "(", "self", ",", "rootpath", ")", ":", "logger", ".", "info", "(", "'Scanning for valid paths...'", ")", "valid_paths", "=", "[", "]", "for", "(", "parent", ",", "subdirs", ",", "files", ")", "in", "os", ".", "walk", "(", "...
Assimilate the entire subdirectory structure in rootpath.
[ "Assimilate", "the", "entire", "subdirectory", "structure", "in", "rootpath", "." ]
python
train
43.7
jim-easterbrook/pywws
src/pywws/conversions.py
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L212-L238
def usaheatindex(temp, humidity, dew=None): """Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40% """ if temp is None or humidity is None: return Non...
[ "def", "usaheatindex", "(", "temp", ",", "humidity", ",", "dew", "=", "None", ")", ":", "if", "temp", "is", "None", "or", "humidity", "is", "None", ":", "return", "None", "if", "dew", "is", "None", ":", "dew", "=", "dew_point", "(", "temp", ",", "h...
Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40%
[ "Calculate", "Heat", "Index", "as", "per", "USA", "National", "Weather", "Service", "Standards" ]
python
train
31.925926
saltstack/salt
salt/modules/junos.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1367-L1478
def get_table(table, table_file, path=None, target=None, key=None, key_items=None, filters=None, template_args=None): ''' Retrieve data from a Junos device using Tables/Views table (required) Name of PyEZ Table table_file (required) YAML file that has the table specified ...
[ "def", "get_table", "(", "table", ",", "table_file", ",", "path", "=", "None", ",", "target", "=", "None", ",", "key", "=", "None", ",", "key_items", "=", "None", ",", "filters", "=", "None", ",", "template_args", "=", "None", ")", ":", "conn", "=", ...
Retrieve data from a Junos device using Tables/Views table (required) Name of PyEZ Table table_file (required) YAML file that has the table specified in table parameter path: Path of location of the YAML file. defaults to op directory in jnpr.junos.op target: ...
[ "Retrieve", "data", "from", "a", "Junos", "device", "using", "Tables", "/", "Views" ]
python
train
35.723214
ray-project/ray
python/ray/experimental/state.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L747-L765
def cluster_resources(self): """Get the current total cluster resources. Note that this information can grow stale as nodes are added to or removed from the cluster. Returns: A dictionary mapping resource name to the total quantity of that resource in the cl...
[ "def", "cluster_resources", "(", "self", ")", ":", "resources", "=", "defaultdict", "(", "int", ")", "clients", "=", "self", ".", "client_table", "(", ")", "for", "client", "in", "clients", ":", "# Only count resources from live clients.", "if", "client", "[", ...
Get the current total cluster resources. Note that this information can grow stale as nodes are added to or removed from the cluster. Returns: A dictionary mapping resource name to the total quantity of that resource in the cluster.
[ "Get", "the", "current", "total", "cluster", "resources", "." ]
python
train
34.578947
ronaldguillen/wave
wave/decorators.py
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/decorators.py#L18-L76
def rest_verbs(http_method_names=None): """ Decorator that converts a function-based view into an RestView subclass. Takes a list of allowed methods for the view as an argument. """ http_method_names = ['GET'] if (http_method_names is None) else http_method_names def decorator(func): ...
[ "def", "rest_verbs", "(", "http_method_names", "=", "None", ")", ":", "http_method_names", "=", "[", "'GET'", "]", "if", "(", "http_method_names", "is", "None", ")", "else", "http_method_names", "def", "decorator", "(", "func", ")", ":", "WrappedRestView", "="...
Decorator that converts a function-based view into an RestView subclass. Takes a list of allowed methods for the view as an argument.
[ "Decorator", "that", "converts", "a", "function", "-", "based", "view", "into", "an", "RestView", "subclass", ".", "Takes", "a", "list", "of", "allowed", "methods", "for", "the", "view", "as", "an", "argument", "." ]
python
train
39.983051
MIT-LCP/wfdb-python
wfdb/processing/evaluate.py
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/processing/evaluate.py#L264-L331
def plot(self, sig_style='', title=None, figsize=None, return_fig=False): """ Plot the comparison of two sets of annotations, possibly overlaid on their original signal. Parameters ---------- sig_style : str, optional The matplotlib style of the ...
[ "def", "plot", "(", "self", ",", "sig_style", "=", "''", ",", "title", "=", "None", ",", "figsize", "=", "None", ",", "return_fig", "=", "False", ")", ":", "fig", "=", "plt", ".", "figure", "(", "figsize", "=", "figsize", ")", "ax", "=", "fig", "...
Plot the comparison of two sets of annotations, possibly overlaid on their original signal. Parameters ---------- sig_style : str, optional The matplotlib style of the signal title : str, optional The title of the plot figsize: tuple, optional ...
[ "Plot", "the", "comparison", "of", "two", "sets", "of", "annotations", "possibly", "overlaid", "on", "their", "original", "signal", "." ]
python
train
36.044118
kgori/treeCl
treeCl/utils/misc.py
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/utils/misc.py#L160-L172
def alignment_to_partials(alignment, missing_data=None): """ Generate a partials dictionary from a treeCl.Alignment """ partials_dict = {} for (name, sequence) in alignment.get_sequences(): datatype = 'dna' if alignment.is_dna() else 'protein' partials_dict[name] = seq_to_partials(sequence, ...
[ "def", "alignment_to_partials", "(", "alignment", ",", "missing_data", "=", "None", ")", ":", "partials_dict", "=", "{", "}", "for", "(", "name", ",", "sequence", ")", "in", "alignment", ".", "get_sequences", "(", ")", ":", "datatype", "=", "'dna'", "if", ...
Generate a partials dictionary from a treeCl.Alignment
[ "Generate", "a", "partials", "dictionary", "from", "a", "treeCl", ".", "Alignment" ]
python
train
42.307692
sbg/sevenbridges-python
sevenbridges/models/task.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L407-L424
def wait(self=None, period=10, callback=None, *args, **kwargs): """Wait until task is complete :param period: Time in seconds between reloads :param callback: Function to call after the task has finished, arguments and keyword arguments can be provided for it :return: Return ...
[ "def", "wait", "(", "self", "=", "None", ",", "period", "=", "10", ",", "callback", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "while", "self", ".", "status", "not", "in", "[", "TaskStatus", ".", "COMPLETED", ",", "TaskStatus...
Wait until task is complete :param period: Time in seconds between reloads :param callback: Function to call after the task has finished, arguments and keyword arguments can be provided for it :return: Return value of provided callback function or None if a callback funct...
[ "Wait", "until", "task", "is", "complete", ":", "param", "period", ":", "Time", "in", "seconds", "between", "reloads", ":", "param", "callback", ":", "Function", "to", "call", "after", "the", "task", "has", "finished", "arguments", "and", "keyword", "argumen...
python
train
37.555556
AmesCornish/buttersink
buttersink/Store.py
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/Store.py#L438-L441
def writeInfo(self, stream): """ Write information about diffs into a file stream for use later. """ for (fromUUID, size) in Diff.theKnownSizes[self.uuid].iteritems(): self.writeInfoLine(stream, fromUUID, size)
[ "def", "writeInfo", "(", "self", ",", "stream", ")", ":", "for", "(", "fromUUID", ",", "size", ")", "in", "Diff", ".", "theKnownSizes", "[", "self", ".", "uuid", "]", ".", "iteritems", "(", ")", ":", "self", ".", "writeInfoLine", "(", "stream", ",", ...
Write information about diffs into a file stream for use later.
[ "Write", "information", "about", "diffs", "into", "a", "file", "stream", "for", "use", "later", "." ]
python
train
58.75
lsbardel/python-stdnet
stdnet/odm/struct.py
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L588-L592
def pop_back(self): '''Remove the last element from the :class:`Sequence`.''' backend = self.backend return backend.execute(backend.structure(self).pop_back(), self.value_pickler.loads)
[ "def", "pop_back", "(", "self", ")", ":", "backend", "=", "self", ".", "backend", "return", "backend", ".", "execute", "(", "backend", ".", "structure", "(", "self", ")", ".", "pop_back", "(", ")", ",", "self", ".", "value_pickler", ".", "loads", ")" ]
Remove the last element from the :class:`Sequence`.
[ "Remove", "the", "last", "element", "from", "the", ":", "class", ":", "Sequence", "." ]
python
train
48
DataONEorg/d1_python
lib_common/src/d1_common/bagit.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/bagit.py#L183-L189
def _add_path(dir_name, payload_info_list): """Add a key with the path to each payload_info_dict.""" for payload_info_dict in payload_info_list: file_name = payload_info_dict['filename'] or payload_info_dict['pid'] payload_info_dict['path'] = d1_common.utils.filesystem.gen_safe_path( ...
[ "def", "_add_path", "(", "dir_name", ",", "payload_info_list", ")", ":", "for", "payload_info_dict", "in", "payload_info_list", ":", "file_name", "=", "payload_info_dict", "[", "'filename'", "]", "or", "payload_info_dict", "[", "'pid'", "]", "payload_info_dict", "["...
Add a key with the path to each payload_info_dict.
[ "Add", "a", "key", "with", "the", "path", "to", "each", "payload_info_dict", "." ]
python
train
50.285714
JelteF/PyLaTeX
pylatex/utils.py
https://github.com/JelteF/PyLaTeX/blob/62d9d9912ce8445e6629cdbcb80ad86143a1ed23/pylatex/utils.py#L68-L100
def escape_latex(s): r"""Escape characters that are special in latex. Args ---- s : `str`, `NoEscape` or anything that can be converted to string The string to be escaped. If this is not a string, it will be converted to a string using `str`. If it is a `NoEscape` string, it will pass ...
[ "def", "escape_latex", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "NoEscape", ")", ":", "return", "s", "return", "NoEscape", "(", "''", ".", "join", "(", "_latex_special_chars", ".", "get", "(", "c", ",", "c", ")", "for", "c", "in", "st...
r"""Escape characters that are special in latex. Args ---- s : `str`, `NoEscape` or anything that can be converted to string The string to be escaped. If this is not a string, it will be converted to a string using `str`. If it is a `NoEscape` string, it will pass through unchanged....
[ "r", "Escape", "characters", "that", "are", "special", "in", "latex", "." ]
python
train
28.484848
bukun/TorCMS
torcms/handlers/post_handler.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/post_handler.py#L503-L525
def fetch_post_data(self): ''' fetch post accessed data. post_data, and ext_dic. ''' post_data = {} ext_dic = {} for key in self.request.arguments: if key.startswith('ext_') or key.startswith('tag_'): ext_dic[key] = self.get_argument(key) ...
[ "def", "fetch_post_data", "(", "self", ")", ":", "post_data", "=", "{", "}", "ext_dic", "=", "{", "}", "for", "key", "in", "self", ".", "request", ".", "arguments", ":", "if", "key", ".", "startswith", "(", "'ext_'", ")", "or", "key", ".", "startswit...
fetch post accessed data. post_data, and ext_dic.
[ "fetch", "post", "accessed", "data", ".", "post_data", "and", "ext_dic", "." ]
python
train
34.26087
YosaiProject/yosai
yosai/core/subject/subject.py
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/core/subject/subject.py#L566-L583
def pop_identity(self): """ :returns: SimpleIdentifierCollection """ popped = None stack = self.get_run_as_identifiers_stack() if (stack): popped = stack.pop() if (stack): # persist the changed stack to the session ...
[ "def", "pop_identity", "(", "self", ")", ":", "popped", "=", "None", "stack", "=", "self", ".", "get_run_as_identifiers_stack", "(", ")", "if", "(", "stack", ")", ":", "popped", "=", "stack", ".", "pop", "(", ")", "if", "(", "stack", ")", ":", "# per...
:returns: SimpleIdentifierCollection
[ ":", "returns", ":", "SimpleIdentifierCollection" ]
python
train
31.777778
tjcsl/ion
intranet/apps/notifications/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/notifications/views.py#L53-L91
def chrome_getdata_view(request): """Get the data of the last notification sent to the current user. This is needed because Chrome, as of version 44, doesn't support sending a data payload to a notification. Thus, information on what the notification is actually for must be manually fetched. """ ...
[ "def", "chrome_getdata_view", "(", "request", ")", ":", "data", "=", "{", "}", "if", "request", ".", "user", ".", "is_authenticated", ":", "# authenticated session", "notifs", "=", "GCMNotification", ".", "objects", ".", "filter", "(", "sent_to__user", "=", "r...
Get the data of the last notification sent to the current user. This is needed because Chrome, as of version 44, doesn't support sending a data payload to a notification. Thus, information on what the notification is actually for must be manually fetched.
[ "Get", "the", "data", "of", "the", "last", "notification", "sent", "to", "the", "current", "user", "." ]
python
train
40.230769
OpenHydrology/floodestimation
floodestimation/parsers.py
https://github.com/OpenHydrology/floodestimation/blob/782da7c5abd1348923129efe89fb70003ebb088c/floodestimation/parsers.py#L70-L93
def parse_str(self, s): """ Parse string and return relevant object :param s: string to parse :type s: str :return: Parsed object """ self.object = self.parsed_class() in_section = None # Holds name of FEH file section while traversing through file. ...
[ "def", "parse_str", "(", "self", ",", "s", ")", ":", "self", ".", "object", "=", "self", ".", "parsed_class", "(", ")", "in_section", "=", "None", "# Holds name of FEH file section while traversing through file.", "for", "line", "in", "s", ".", "split", "(", "...
Parse string and return relevant object :param s: string to parse :type s: str :return: Parsed object
[ "Parse", "string", "and", "return", "relevant", "object" ]
python
train
39.375
ktbyers/netmiko
netmiko/_textfsm/_clitable.py
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_clitable.py#L344-L360
def AddKeys(self, key_list): """Mark additional columns as being part of the superkey. Supplements the Keys already extracted from the FSM template. Useful when adding new columns to existing tables. Note: This will impact attempts to further 'extend' the table as the superkey must be common bet...
[ "def", "AddKeys", "(", "self", ",", "key_list", ")", ":", "for", "keyname", "in", "key_list", ":", "if", "keyname", "not", "in", "self", ".", "header", ":", "raise", "KeyError", "(", "\"'%s'\"", "%", "keyname", ")", "self", ".", "_keys", "=", "self", ...
Mark additional columns as being part of the superkey. Supplements the Keys already extracted from the FSM template. Useful when adding new columns to existing tables. Note: This will impact attempts to further 'extend' the table as the superkey must be common between tables for successful extension. ...
[ "Mark", "additional", "columns", "as", "being", "part", "of", "the", "superkey", ".", "Supplements", "the", "Keys", "already", "extracted", "from", "the", "FSM", "template", ".", "Useful", "when", "adding", "new", "columns", "to", "existing", "tables", ".", ...
python
train
40.470588
tornadoweb/tornado
tornado/httputil.py
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/httputil.py#L1121-L1144
def parse_cookie(cookie: str) -> Dict[str, str]: """Parse a ``Cookie`` HTTP header into a dict of name/value pairs. This function attempts to mimic browser cookie parsing behavior; it specifically does not follow any of the cookie-related RFCs (because browsers don't either). The algorithm used is...
[ "def", "parse_cookie", "(", "cookie", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "cookiedict", "=", "{", "}", "for", "chunk", "in", "cookie", ".", "split", "(", "str", "(", "\";\"", ")", ")", ":", "if", "str", "(", "\"=\"", ...
Parse a ``Cookie`` HTTP header into a dict of name/value pairs. This function attempts to mimic browser cookie parsing behavior; it specifically does not follow any of the cookie-related RFCs (because browsers don't either). The algorithm used is identical to that used by Django version 1.9.10. ....
[ "Parse", "a", "Cookie", "HTTP", "header", "into", "a", "dict", "of", "name", "/", "value", "pairs", "." ]
python
train
36.125
Esri/ArcREST
src/arcrest/hostedservice/service.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L1025-L1054
def addToDefinition(self, json_dict): """ The addToDefinition operation supports adding a definition property to a hosted feature service. The result of this operation is a response indicating success or failure with error code and description. This functi...
[ "def", "addToDefinition", "(", "self", ",", "json_dict", ")", ":", "params", "=", "{", "\"f\"", ":", "\"json\"", ",", "\"addToDefinition\"", ":", "json", ".", "dumps", "(", "json_dict", ")", ",", "\"async\"", ":", "False", "}", "uURL", "=", "self", ".", ...
The addToDefinition operation supports adding a definition property to a hosted feature service. The result of this operation is a response indicating success or failure with error code and description. This function will allow users to change add additional values ...
[ "The", "addToDefinition", "operation", "supports", "adding", "a", "definition", "property", "to", "a", "hosted", "feature", "service", ".", "The", "result", "of", "this", "operation", "is", "a", "response", "indicating", "success", "or", "failure", "with", "erro...
python
train
40.966667
aconrad/pycobertura
pycobertura/cli.py
https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cli.py#L141-L176
def diff( cobertura_file1, cobertura_file2, color, format, output, source1, source2, source_prefix1, source_prefix2, source): """compare coverage of two Cobertura reports""" cobertura1 = Cobertura( cobertura_file1, source=source1, source_prefix=source_prefix1 ...
[ "def", "diff", "(", "cobertura_file1", ",", "cobertura_file2", ",", "color", ",", "format", ",", "output", ",", "source1", ",", "source2", ",", "source_prefix1", ",", "source_prefix2", ",", "source", ")", ":", "cobertura1", "=", "Cobertura", "(", "cobertura_fi...
compare coverage of two Cobertura reports
[ "compare", "coverage", "of", "two", "Cobertura", "reports" ]
python
train
28.944444
datamachine/twx.botapi
twx/botapi/botapi.py
https://github.com/datamachine/twx.botapi/blob/c85184da738169e8f9d6d8e62970540f427c486e/twx/botapi/botapi.py#L4306-L4308
def send_document(self, *args, **kwargs): """See :func:`send_document`""" return send_document(*args, **self._merge_overrides(**kwargs)).run()
[ "def", "send_document", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "send_document", "(", "*", "args", ",", "*", "*", "self", ".", "_merge_overrides", "(", "*", "*", "kwargs", ")", ")", ".", "run", "(", ")" ]
See :func:`send_document`
[ "See", ":", "func", ":", "send_document" ]
python
train
52
common-workflow-language/cwltool
cwltool/cwlrdf.py
https://github.com/common-workflow-language/cwltool/blob/cb81b22abc52838823da9945f04d06739ab32fda/cwltool/cwlrdf.py#L25-L30
def printrdf(wflow, ctx, style): # type: (Process, ContextType, Text) -> Text """Serialize the CWL document into a string, ready for printing.""" rdf = gather(wflow, ctx).serialize(format=style, encoding='utf-8') if not rdf: return u"" return rdf.decode('utf-8')
[ "def", "printrdf", "(", "wflow", ",", "ctx", ",", "style", ")", ":", "# type: (Process, ContextType, Text) -> Text", "rdf", "=", "gather", "(", "wflow", ",", "ctx", ")", ".", "serialize", "(", "format", "=", "style", ",", "encoding", "=", "'utf-8'", ")", "...
Serialize the CWL document into a string, ready for printing.
[ "Serialize", "the", "CWL", "document", "into", "a", "string", "ready", "for", "printing", "." ]
python
train
47
SuperCowPowers/bat
bat/utils/net_utils.py
https://github.com/SuperCowPowers/bat/blob/069e6bc52843dc07760969c531cc442ca7da8e0c/bat/utils/net_utils.py#L50-L62
def str_to_inet(address): """Convert an a string IP address to a inet struct Args: address (str): String representation of address Returns: inet: Inet network address """ # First try ipv4 and then ipv6 try: return socket.inet_pton(socket.AF_INET, address)...
[ "def", "str_to_inet", "(", "address", ")", ":", "# First try ipv4 and then ipv6", "try", ":", "return", "socket", ".", "inet_pton", "(", "socket", ".", "AF_INET", ",", "address", ")", "except", "socket", ".", "error", ":", "return", "socket", ".", "inet_pton",...
Convert an a string IP address to a inet struct Args: address (str): String representation of address Returns: inet: Inet network address
[ "Convert", "an", "a", "string", "IP", "address", "to", "a", "inet", "struct" ]
python
train
30.076923
stevearc/dql
dql/util.py
https://github.com/stevearc/dql/blob/e9d3aa22873076dae5ebd02e35318aa996b1e56a/dql/util.py#L98-L110
def eval_function(value): """ Evaluate a timestamp function """ name, args = value[0], value[1:] if name == "NOW": return datetime.utcnow().replace(tzinfo=tzutc()) elif name in ["TIMESTAMP", "TS"]: return parse(unwrap(args[0])).replace(tzinfo=tzlocal()) elif name in ["UTCTIMESTAMP", ...
[ "def", "eval_function", "(", "value", ")", ":", "name", ",", "args", "=", "value", "[", "0", "]", ",", "value", "[", "1", ":", "]", "if", "name", "==", "\"NOW\"", ":", "return", "datetime", ".", "utcnow", "(", ")", ".", "replace", "(", "tzinfo", ...
Evaluate a timestamp function
[ "Evaluate", "a", "timestamp", "function" ]
python
train
39.384615
meejah/txtorcon
txtorcon/socks.py
https://github.com/meejah/txtorcon/blob/14053b95adf0b4bd9dd9c317bece912a26578a93/txtorcon/socks.py#L139-L153
def _parse_version_reply(self): "waiting for a version reply" if len(self._data) >= 2: reply = self._data[:2] self._data = self._data[2:] (version, method) = struct.unpack('BB', reply) if version == 5 and method in [0x00, 0x02]: self.versio...
[ "def", "_parse_version_reply", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_data", ")", ">=", "2", ":", "reply", "=", "self", ".", "_data", "[", ":", "2", "]", "self", ".", "_data", "=", "self", ".", "_data", "[", "2", ":", "]", "(",...
waiting for a version reply
[ "waiting", "for", "a", "version", "reply" ]
python
train
42.6
Kozea/pygal
pygal/graph/graph.py
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/graph.py#L555-L596
def _static_value( self, serie_node, value, x, y, metadata, align_text='left', classes=None ): """Write the print value""" label = metadata and metadata.get('label') classes = classes and [classes...
[ "def", "_static_value", "(", "self", ",", "serie_node", ",", "value", ",", "x", ",", "y", ",", "metadata", ",", "align_text", "=", "'left'", ",", "classes", "=", "None", ")", ":", "label", "=", "metadata", "and", "metadata", ".", "get", "(", "'label'",...
Write the print value
[ "Write", "the", "print", "value" ]
python
train
31
bokeh/bokeh
bokeh/model.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L838-L861
def _visit_value_and_its_immediate_references(obj, visitor): ''' Recurse down Models, HasProps, and Python containers The ordering in this function is to optimize performance. We check the most comomn types (int, float, str) first so that we can quickly return in the common case. We avoid isinstance ...
[ "def", "_visit_value_and_its_immediate_references", "(", "obj", ",", "visitor", ")", ":", "typ", "=", "type", "(", "obj", ")", "if", "typ", "in", "_common_types", ":", "# short circuit on common base types", "return", "if", "typ", "is", "list", "or", "issubclass",...
Recurse down Models, HasProps, and Python containers The ordering in this function is to optimize performance. We check the most comomn types (int, float, str) first so that we can quickly return in the common case. We avoid isinstance and issubclass checks in a couple places with `type` checks becau...
[ "Recurse", "down", "Models", "HasProps", "and", "Python", "containers" ]
python
train
46.625
saltstack/salt
salt/modules/lxd.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxd.py#L2151-L2201
def profile_config_get(name, config_key, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get a profile config item. name : The name of the profile to get the config item from. config_key : The key for the item to retrieve. remot...
[ "def", "profile_config_get", "(", "name", ",", "config_key", ",", "remote_addr", "=", "None", ",", "cert", "=", "None", ",", "key", "=", "None", ",", "verify_cert", "=", "True", ")", ":", "profile", "=", "profile_get", "(", "name", ",", "remote_addr", ",...
Get a profile config item. name : The name of the profile to get the config item from. config_key : The key for the item to retrieve. remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its ...
[ "Get", "a", "profile", "config", "item", "." ]
python
train
25.411765
pycontribs/pyrax
pyrax/utils.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/utils.py#L708-L712
def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition(".") __import__(mod_str) return getattr(sys.modules[mod_str], class_str)
[ "def", "import_class", "(", "import_str", ")", ":", "mod_str", ",", "_sep", ",", "class_str", "=", "import_str", ".", "rpartition", "(", "\".\"", ")", "__import__", "(", "mod_str", ")", "return", "getattr", "(", "sys", ".", "modules", "[", "mod_str", "]", ...
Returns a class from a string including module and class.
[ "Returns", "a", "class", "from", "a", "string", "including", "module", "and", "class", "." ]
python
train
45.4
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/semantic_data_editor.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/semantic_data_editor.py#L292-L306
def cut_action_callback(self, *event): """Add a copy and cut all selected row dict value pairs to the clipboard""" if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None: _, dict_paths = self.get_view_selection() stored_data_list = [] ...
[ "def", "cut_action_callback", "(", "self", ",", "*", "event", ")", ":", "if", "react_to_event", "(", "self", ".", "view", ",", "self", ".", "tree_view", ",", "event", ")", "and", "self", ".", "active_entry_widget", "is", "None", ":", "_", ",", "dict_path...
Add a copy and cut all selected row dict value pairs to the clipboard
[ "Add", "a", "copy", "and", "cut", "all", "selected", "row", "dict", "value", "pairs", "to", "the", "clipboard" ]
python
train
55.666667
IRC-SPHERE/HyperStream
hyperstream/workflow/workflow_manager.py
https://github.com/IRC-SPHERE/HyperStream/blob/98478f4d31ed938f4aa7c958ed0d4c3ffcb2e780/hyperstream/workflow/workflow_manager.py#L193-L212
def add_workflow(self, workflow, commit=False): """ Add a new workflow and optionally commit it to the database :param workflow: The workflow :param commit: Whether to commit the workflow to the database :type workflow: Workflow :type commit: bool :return: None ...
[ "def", "add_workflow", "(", "self", ",", "workflow", ",", "commit", "=", "False", ")", ":", "if", "workflow", ".", "workflow_id", "in", "self", ".", "workflows", ":", "raise", "KeyError", "(", "\"Workflow with id {} already exists\"", ".", "format", "(", "work...
Add a new workflow and optionally commit it to the database :param workflow: The workflow :param commit: Whether to commit the workflow to the database :type workflow: Workflow :type commit: bool :return: None
[ "Add", "a", "new", "workflow", "and", "optionally", "commit", "it", "to", "the", "database", ":", "param", "workflow", ":", "The", "workflow", ":", "param", "commit", ":", "Whether", "to", "commit", "the", "workflow", "to", "the", "database", ":", "type", ...
python
train
40.65
annoviko/pyclustering
pyclustering/cluster/ga.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/ga.py#L103-L116
def collect_population_best(self, best_chromosome, best_fitness_function): """! @brief Stores the best chromosome for current specific iteration and its fitness function's value. @param[in] best_chromosome (list): The best chromosome on specific iteration. @param[in] best_fitnes...
[ "def", "collect_population_best", "(", "self", ",", "best_chromosome", ",", "best_fitness_function", ")", ":", "if", "not", "self", ".", "_need_population_best", ":", "return", "self", ".", "_best_population_result", "[", "'chromosome'", "]", ".", "append", "(", "...
! @brief Stores the best chromosome for current specific iteration and its fitness function's value. @param[in] best_chromosome (list): The best chromosome on specific iteration. @param[in] best_fitness_function (float): Fitness function value of the chromosome.
[ "!" ]
python
valid
43.928571
yougov/pmxbot
pmxbot/logging.py
https://github.com/yougov/pmxbot/blob/5da84a3258a0fd73cb35b60e39769a5d7bfb2ba7/pmxbot/logging.py#L468-L488
def strike(channel, nick, rest): "Strike last <n> statements from the record" yield NoLog rest = rest.strip() if not rest: count = 1 else: if not rest.isdigit(): yield "Strike how many? Argument must be a positive integer." raise StopIteration count = int(rest) try: struck = Logger.store.strike(cha...
[ "def", "strike", "(", "channel", ",", "nick", ",", "rest", ")", ":", "yield", "NoLog", "rest", "=", "rest", ".", "strip", "(", ")", "if", "not", "rest", ":", "count", "=", "1", "else", ":", "if", "not", "rest", ".", "isdigit", "(", ")", ":", "y...
Strike last <n> statements from the record
[ "Strike", "last", "<n", ">", "statements", "from", "the", "record" ]
python
train
27.571429
nion-software/nionswift
nion/swift/Facade.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2460-L2473
def get_library_value(self, key: str) -> typing.Any: """Get the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) if desc is n...
[ "def", "get_library_value", "(", "self", ",", "key", ":", "str", ")", "->", "typing", ".", "Any", ":", "desc", "=", "Metadata", ".", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "field_id", "=", "desc", "[",...
Get the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes
[ "Get", "the", "library", "value", "for", "the", "given", "key", "." ]
python
train
33.071429
pedroburon/tbk
tbk/webpay/confirmation.py
https://github.com/pedroburon/tbk/blob/ecd6741e0bae06269eb4ac885c3ffcb7902ee40e/tbk/webpay/confirmation.py#L110-L122
def accountable_date(self): '''Accountable date of transaction, localized as America/Santiago ''' fecha_transaccion = self.data['TBK_FECHA_CONTABLE'] m = int(fecha_transaccion[:2]) d = int(fecha_transaccion[2:]) santiago = pytz.timezone('America/Santiago') today =...
[ "def", "accountable_date", "(", "self", ")", ":", "fecha_transaccion", "=", "self", ".", "data", "[", "'TBK_FECHA_CONTABLE'", "]", "m", "=", "int", "(", "fecha_transaccion", "[", ":", "2", "]", ")", "d", "=", "int", "(", "fecha_transaccion", "[", "2", ":...
Accountable date of transaction, localized as America/Santiago
[ "Accountable", "date", "of", "transaction", "localized", "as", "America", "/", "Santiago" ]
python
train
42.076923
mailgun/talon
talon/signature/learning/featurespace.py
https://github.com/mailgun/talon/blob/cdd84563dd329c4f887591807870d10015e0c7a7/talon/signature/learning/featurespace.py#L18-L47
def features(sender=''): '''Returns a list of signature features.''' return [ # This one isn't from paper. # Meant to match companies names, sender's names, address. many_capitalized_words, # This one is not from paper. # Line is too long. # This one is less aggre...
[ "def", "features", "(", "sender", "=", "''", ")", ":", "return", "[", "# This one isn't from paper.", "# Meant to match companies names, sender's names, address.", "many_capitalized_words", ",", "# This one is not from paper.", "# Line is too long.", "# This one is less aggressive th...
Returns a list of signature features.
[ "Returns", "a", "list", "of", "signature", "features", "." ]
python
train
46.366667
cthorey/pdsimage
pdsimage/PDS_Extractor.py
https://github.com/cthorey/pdsimage/blob/f71de6dfddd3d538d76da229b4b9605c40f3fbac/pdsimage/PDS_Extractor.py#L685-L707
def _define_case(self): ''' Identify case ''' lonBool = self._map_center( 'long', self.lonM) != self._map_center('long', self.lonm) latBool = self._map_center( 'lat', self.latM) != self._map_center('lat', self.latm) if not lonBool and not latBool: pr...
[ "def", "_define_case", "(", "self", ")", ":", "lonBool", "=", "self", ".", "_map_center", "(", "'long'", ",", "self", ".", "lonM", ")", "!=", "self", ".", "_map_center", "(", "'long'", ",", "self", ".", "lonm", ")", "latBool", "=", "self", ".", "_map...
Identify case
[ "Identify", "case" ]
python
train
41.73913
gmr/rejected
rejected/process.py
https://github.com/gmr/rejected/blob/610a3e1401122ecb98d891b6795cca0255e5b044/rejected/process.py#L793-L818
def submit_influxdb_measurement(self): """Submit a measurement for a message to InfluxDB""" measurement = influxdb.Measurement(*self.influxdb) measurement.set_timestamp(time.time()) for key, value in self.measurement.counters.items(): measurement.set_field(key, value) ...
[ "def", "submit_influxdb_measurement", "(", "self", ")", ":", "measurement", "=", "influxdb", ".", "Measurement", "(", "*", "self", ".", "influxdb", ")", "measurement", ".", "set_timestamp", "(", "time", ".", "time", "(", ")", ")", "for", "key", ",", "value...
Submit a measurement for a message to InfluxDB
[ "Submit", "a", "measurement", "for", "a", "message", "to", "InfluxDB" ]
python
train
51.269231
noahbenson/pimms
pimms/util.py
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/util.py#L664-L673
def is_memoized(self, k): ''' lmap.is_memoized(k) yields True if k is a key in the given lazy map lmap that is both lazy and already memoized. ''' v = ps.PMap.__getitem__(self, k) if not isinstance(v, (types.FunctionType, partial)): return False else: ...
[ "def", "is_memoized", "(", "self", ",", "k", ")", ":", "v", "=", "ps", ".", "PMap", ".", "__getitem__", "(", "self", ",", "k", ")", "if", "not", "isinstance", "(", "v", ",", "(", "types", ".", "FunctionType", ",", "partial", ")", ")", ":", "retur...
lmap.is_memoized(k) yields True if k is a key in the given lazy map lmap that is both lazy and already memoized.
[ "lmap", ".", "is_memoized", "(", "k", ")", "yields", "True", "if", "k", "is", "a", "key", "in", "the", "given", "lazy", "map", "lmap", "that", "is", "both", "lazy", "and", "already", "memoized", "." ]
python
train
35.3
inasafe/inasafe
safe/gui/widgets/dock.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L1596-L1657
def set_provenance_to_project_variables(provenances): """Helper method to update / create provenance in project variables. :param provenances: Keys and values from provenances. :type provenances: dict """ def write_project_variable(key, value): """Helper to write project variable for base_k...
[ "def", "set_provenance_to_project_variables", "(", "provenances", ")", ":", "def", "write_project_variable", "(", "key", ",", "value", ")", ":", "\"\"\"Helper to write project variable for base_key and value.\n\n The key will be:\n - base_key__KEY: value for dictionary.\n ...
Helper method to update / create provenance in project variables. :param provenances: Keys and values from provenances. :type provenances: dict
[ "Helper", "method", "to", "update", "/", "create", "provenance", "in", "project", "variables", "." ]
python
train
39.516129
rueckstiess/mtools
mtools/mlogfilter/mlogfilter.py
https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlogfilter/mlogfilter.py#L141-L172
def _formatNumbers(self, line): """ Format the numbers so that there are commas inserted. For example: 1200300 becomes 1,200,300. """ # below thousands separator syntax only works for # python 2.7, skip for 2.6 if sys.version_info < (2, 7): return lin...
[ "def", "_formatNumbers", "(", "self", ",", "line", ")", ":", "# below thousands separator syntax only works for", "# python 2.7, skip for 2.6", "if", "sys", ".", "version_info", "<", "(", "2", ",", "7", ")", ":", "return", "line", "last_index", "=", "0", "try", ...
Format the numbers so that there are commas inserted. For example: 1200300 becomes 1,200,300.
[ "Format", "the", "numbers", "so", "that", "there", "are", "commas", "inserted", "." ]
python
train
34.1875
guaix-ucm/numina
numina/drps/drpsystem.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/drps/drpsystem.py#L36-L43
def load_drp(self, name, entry_point='numina.pipeline.1'): """Load all available DRPs in 'entry_point'.""" for drpins in self.iload(entry_point): if drpins.name == name: return drpins else: raise KeyError('{}'.format(name))
[ "def", "load_drp", "(", "self", ",", "name", ",", "entry_point", "=", "'numina.pipeline.1'", ")", ":", "for", "drpins", "in", "self", ".", "iload", "(", "entry_point", ")", ":", "if", "drpins", ".", "name", "==", "name", ":", "return", "drpins", "else", ...
Load all available DRPs in 'entry_point'.
[ "Load", "all", "available", "DRPs", "in", "entry_point", "." ]
python
train
35.125
hotdoc/hotdoc
hotdoc/core/formatter.py
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/formatter.py#L462-L487
def write_out(self, page, xml_subpages, output): """Banana banana """ # pylint: disable=missing-docstring def subpages(_): return xml_subpages namespace = etree.FunctionNamespace('uri:hotdoc') namespace['subpages'] = subpages html_output = os.path.joi...
[ "def", "write_out", "(", "self", ",", "page", ",", "xml_subpages", ",", "output", ")", ":", "# pylint: disable=missing-docstring", "def", "subpages", "(", "_", ")", ":", "return", "xml_subpages", "namespace", "=", "etree", ".", "FunctionNamespace", "(", "'uri:ho...
Banana banana
[ "Banana", "banana" ]
python
train
40
Microsoft/nni
src/sdk/pynni/nni/networkmorphism_tuner/graph.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/graph.py#L233-L255
def _redirect_edge(self, u_id, v_id, new_v_id): """Redirect the layer to a new node. Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id` while keeping all other property of the edge the same. """ layer_id = None for index, edge_tuple in...
[ "def", "_redirect_edge", "(", "self", ",", "u_id", ",", "v_id", ",", "new_v_id", ")", ":", "layer_id", "=", "None", "for", "index", ",", "edge_tuple", "in", "enumerate", "(", "self", ".", "adj_list", "[", "u_id", "]", ")", ":", "if", "edge_tuple", "[",...
Redirect the layer to a new node. Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id` while keeping all other property of the edge the same.
[ "Redirect", "the", "layer", "to", "a", "new", "node", ".", "Change", "the", "edge", "originally", "from", "u_id", "to", "v_id", "into", "an", "edge", "from", "u_id", "to", "new_v_id", "while", "keeping", "all", "other", "property", "of", "the", "edge", "...
python
train
47.304348
openpaperwork/paperwork-backend
paperwork_backend/docimport.py
https://github.com/openpaperwork/paperwork-backend/blob/114b831e94e039e68b339751fd18250877abad76/paperwork_backend/docimport.py#L151-L161
def can_import(self, file_uris, current_doc=None): """ Check that the specified file looks like a PDF """ if len(file_uris) <= 0: return False for uri in file_uris: uri = self.fs.safe(uri) if not self.check_file_type(uri): retur...
[ "def", "can_import", "(", "self", ",", "file_uris", ",", "current_doc", "=", "None", ")", ":", "if", "len", "(", "file_uris", ")", "<=", "0", ":", "return", "False", "for", "uri", "in", "file_uris", ":", "uri", "=", "self", ".", "fs", ".", "safe", ...
Check that the specified file looks like a PDF
[ "Check", "that", "the", "specified", "file", "looks", "like", "a", "PDF" ]
python
train
30.636364
minhhoit/yacms
yacms/pages/admin.py
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/admin.py#L175-L182
def save_form(self, request, form, change): """ Don't show links in the sitemap. """ obj = form.save(commit=False) if not obj.id and "in_sitemap" not in form.fields: obj.in_sitemap = False return super(LinkAdmin, self).save_form(request, form, change)
[ "def", "save_form", "(", "self", ",", "request", ",", "form", ",", "change", ")", ":", "obj", "=", "form", ".", "save", "(", "commit", "=", "False", ")", "if", "not", "obj", ".", "id", "and", "\"in_sitemap\"", "not", "in", "form", ".", "fields", ":...
Don't show links in the sitemap.
[ "Don", "t", "show", "links", "in", "the", "sitemap", "." ]
python
train
38
bfontaine/term2048
term2048/ui.py
https://github.com/bfontaine/term2048/blob/8b5ce8b65f44f20a7ad36022a34dce56184070af/term2048/ui.py#L30-L41
def parse_cli_args(): """parse args from the CLI and return a dict""" parser = argparse.ArgumentParser(description='2048 in your terminal') parser.add_argument('--mode', dest='mode', type=str, default=None, help='colors mode (dark or light)') parser.add_argument('--az', dest='azm...
[ "def", "parse_cli_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'2048 in your terminal'", ")", "parser", ".", "add_argument", "(", "'--mode'", ",", "dest", "=", "'mode'", ",", "type", "=", "str", ",", "defa...
parse args from the CLI and return a dict
[ "parse", "args", "from", "the", "CLI", "and", "return", "a", "dict" ]
python
train
59.166667
apache/airflow
airflow/models/taskinstance.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/taskinstance.py#L470-L474
def key(self): """ Returns a tuple that identifies the task instance uniquely """ return self.dag_id, self.task_id, self.execution_date, self.try_number
[ "def", "key", "(", "self", ")", ":", "return", "self", ".", "dag_id", ",", "self", ".", "task_id", ",", "self", ".", "execution_date", ",", "self", ".", "try_number" ]
Returns a tuple that identifies the task instance uniquely
[ "Returns", "a", "tuple", "that", "identifies", "the", "task", "instance", "uniquely" ]
python
test
36
yougov/pmxbot
pmxbot/system.py
https://github.com/yougov/pmxbot/blob/5da84a3258a0fd73cb35b60e39769a5d7bfb2ba7/pmxbot/system.py#L17-L49
def help(rest): """Help (this command)""" rs = rest.strip() if rs: # give help for matching commands for handler in Handler._registry: if handler.name == rs.lower(): yield '!%s: %s' % (handler.name, handler.doc) break else: yield "command not found" return # give help for all commands def mk...
[ "def", "help", "(", "rest", ")", ":", "rs", "=", "rest", ".", "strip", "(", ")", "if", "rs", ":", "# give help for matching commands", "for", "handler", "in", "Handler", ".", "_registry", ":", "if", "handler", ".", "name", "==", "rs", ".", "lower", "("...
Help (this command)
[ "Help", "(", "this", "command", ")" ]
python
train
24.212121
PayEx/pypayex
payex/utils.py
https://github.com/PayEx/pypayex/blob/549ba7cc47f112a7aa3417fcf87ff07bc74cd9ab/payex/utils.py#L12-L23
def normalize_value(val): """ Normalize strings with booleans into Python types. """ if val is not None: if val.lower() == 'false': val = False elif val.lower() == 'true': val = True return val
[ "def", "normalize_value", "(", "val", ")", ":", "if", "val", "is", "not", "None", ":", "if", "val", ".", "lower", "(", ")", "==", "'false'", ":", "val", "=", "False", "elif", "val", ".", "lower", "(", ")", "==", "'true'", ":", "val", "=", "True",...
Normalize strings with booleans into Python types.
[ "Normalize", "strings", "with", "booleans", "into", "Python", "types", "." ]
python
train
21
PySimpleGUI/PySimpleGUI
DemoPrograms/Demo_Multithreaded_Queued.py
https://github.com/PySimpleGUI/PySimpleGUI/blob/08184197f5bd4580ab5e5aca28bdda30f87b86fc/DemoPrograms/Demo_Multithreaded_Queued.py#L68-L100
def the_gui(gui_queue): """ Starts and executes the GUI Reads data from a Queue and displays the data to the window Returns when the user exits / closes the window (that means it does NOT return until the user exits the window) :param gui_queue: Queue the GUI should read from :return: ...
[ "def", "the_gui", "(", "gui_queue", ")", ":", "layout", "=", "[", "[", "sg", ".", "Text", "(", "'Multithreaded Window Example'", ")", "]", ",", "[", "sg", ".", "Text", "(", "''", ",", "size", "=", "(", "15", ",", "1", ")", ",", "key", "=", "'_OUT...
Starts and executes the GUI Reads data from a Queue and displays the data to the window Returns when the user exits / closes the window (that means it does NOT return until the user exits the window) :param gui_queue: Queue the GUI should read from :return:
[ "Starts", "and", "executes", "the", "GUI", "Reads", "data", "from", "a", "Queue", "and", "displays", "the", "data", "to", "the", "window", "Returns", "when", "the", "user", "exits", "/", "closes", "the", "window", "(", "that", "means", "it", "does", "NOT...
python
train
49.878788
O365/python-o365
O365/utils/utils.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L259-L270
def get_first_recipient_with_address(self): """ Returns the first recipient found with a non blank address :return: First Recipient :rtype: Recipient """ recipients_with_address = [recipient for recipient in self._recipients if recipient.addres...
[ "def", "get_first_recipient_with_address", "(", "self", ")", ":", "recipients_with_address", "=", "[", "recipient", "for", "recipient", "in", "self", ".", "_recipients", "if", "recipient", ".", "address", "]", "if", "recipients_with_address", ":", "return", "recipie...
Returns the first recipient found with a non blank address :return: First Recipient :rtype: Recipient
[ "Returns", "the", "first", "recipient", "found", "with", "a", "non", "blank", "address" ]
python
train
35.916667