repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
fictorial/pygameui
pygameui/view.py
https://github.com/fictorial/pygameui/blob/af6a35f347d6fafa66c4255bbbe38736d842ff65/pygameui/view.py#L74-L91
def layout(self): """Call to have the view layout itself. Subclasses should invoke this after laying out child views and/or updating its own frame. """ if self.shadowed: shadow_size = theme.current.shadow_size shadowed_frame_size = (self.frame.w + shadow_...
[ "def", "layout", "(", "self", ")", ":", "if", "self", ".", "shadowed", ":", "shadow_size", "=", "theme", ".", "current", ".", "shadow_size", "shadowed_frame_size", "=", "(", "self", ".", "frame", ".", "w", "+", "shadow_size", ",", "self", ".", "frame", ...
Call to have the view layout itself. Subclasses should invoke this after laying out child views and/or updating its own frame.
[ "Call", "to", "have", "the", "view", "layout", "itself", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xorbrecordbox.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbrecordbox.py#L282-L290
def currentRecord( self ): """ Returns the record found at the current index for this combo box. :rerturn <orb.Table> || None """ if self._currentRecord is None and self.isRequired(): self._currentRecord = self.recordAt(self.currentIndex()) ...
[ "def", "currentRecord", "(", "self", ")", ":", "if", "self", ".", "_currentRecord", "is", "None", "and", "self", ".", "isRequired", "(", ")", ":", "self", ".", "_currentRecord", "=", "self", ".", "recordAt", "(", "self", ".", "currentIndex", "(", ")", ...
Returns the record found at the current index for this combo box. :rerturn <orb.Table> || None
[ "Returns", "the", "record", "found", "at", "the", "current", "index", "for", "this", "combo", "box", ".", ":", "rerturn", "<orb", ".", "Table", ">", "||", "None" ]
python
train
wbond/certvalidator
certvalidator/validate.py
https://github.com/wbond/certvalidator/blob/c62233a713bcc36963e9d82323ec8d84f8e01485/certvalidator/validate.py#L53-L107
def validate_tls_hostname(validation_context, cert, hostname): """ Validates the end-entity certificate from a certvalidator.path.ValidationPath object to ensure that the certificate is valid for the hostname provided and that the certificate is valid for the purpose of a TLS connection. THE CE...
[ "def", "validate_tls_hostname", "(", "validation_context", ",", "cert", ",", "hostname", ")", ":", "if", "not", "isinstance", "(", "validation_context", ",", "ValidationContext", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n validation_...
Validates the end-entity certificate from a certvalidator.path.ValidationPath object to ensure that the certificate is valid for the hostname provided and that the certificate is valid for the purpose of a TLS connection. THE CERTIFICATE PATH MUST BE VALIDATED SEPARATELY VIA validate_path()! :para...
[ "Validates", "the", "end", "-", "entity", "certificate", "from", "a", "certvalidator", ".", "path", ".", "ValidationPath", "object", "to", "ensure", "that", "the", "certificate", "is", "valid", "for", "the", "hostname", "provided", "and", "that", "the", "certi...
python
train
openknowledge-archive/flexidate
flexidate/__init__.py
https://github.com/openknowledge-archive/flexidate/blob/d4fb7d6c7786725bd892fbccd8c3837ac45bcb67/flexidate/__init__.py#L126-L142
def as_float(self): '''Get as a float (year being the integer part). Replace '?' in year with 9 so as to be conservative (e.g. 19?? becomes 1999) and elsewhere (month, day) with 0 @return: float. ''' if not self.year: return None out = float(self.yea...
[ "def", "as_float", "(", "self", ")", ":", "if", "not", "self", ".", "year", ":", "return", "None", "out", "=", "float", "(", "self", ".", "year", ".", "replace", "(", "'?'", ",", "'9'", ")", ")", "if", "self", ".", "month", ":", "# TODO: we are ass...
Get as a float (year being the integer part). Replace '?' in year with 9 so as to be conservative (e.g. 19?? becomes 1999) and elsewhere (month, day) with 0 @return: float.
[ "Get", "as", "a", "float", "(", "year", "being", "the", "integer", "part", ")", "." ]
python
train
wmayner/pyphi
pyphi/compute/subsystem.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/compute/subsystem.py#L39-L52
def compute(mechanism, subsystem, purviews, cause_purviews, effect_purviews): """Compute a |Concept| for a mechanism, in this |Subsystem| with the provided purviews. """ concept = subsystem.concept(mechanism, purviews=purviews, ...
[ "def", "compute", "(", "mechanism", ",", "subsystem", ",", "purviews", ",", "cause_purviews", ",", "effect_purviews", ")", ":", "concept", "=", "subsystem", ".", "concept", "(", "mechanism", ",", "purviews", "=", "purviews", ",", "cause_purviews", "=", "cause_...
Compute a |Concept| for a mechanism, in this |Subsystem| with the provided purviews.
[ "Compute", "a", "|Concept|", "for", "a", "mechanism", "in", "this", "|Subsystem|", "with", "the", "provided", "purviews", "." ]
python
train
gem/oq-engine
openquake/calculators/views.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/views.py#L397-L407
def view_portfolio_loss(token, dstore): """ The mean and stddev loss for the full portfolio for each loss type, extracted from the event loss table, averaged over the realizations """ data = portfolio_loss(dstore) # shape (R, L) loss_types = list(dstore['oqparam'].loss_dt().names) header = ...
[ "def", "view_portfolio_loss", "(", "token", ",", "dstore", ")", ":", "data", "=", "portfolio_loss", "(", "dstore", ")", "# shape (R, L)", "loss_types", "=", "list", "(", "dstore", "[", "'oqparam'", "]", ".", "loss_dt", "(", ")", ".", "names", ")", "header"...
The mean and stddev loss for the full portfolio for each loss type, extracted from the event loss table, averaged over the realizations
[ "The", "mean", "and", "stddev", "loss", "for", "the", "full", "portfolio", "for", "each", "loss", "type", "extracted", "from", "the", "event", "loss", "table", "averaged", "over", "the", "realizations" ]
python
train
jaysonsantos/python-binary-memcached
bmemcached/client/mixin.py
https://github.com/jaysonsantos/python-binary-memcached/blob/6a792829349c69204d9c5045e5c34b4231216dd6/bmemcached/client/mixin.py#L48-L70
def set_servers(self, servers): """ Iter to a list of servers and instantiate Protocol class. :param servers: A list of servers :type servers: list :return: Returns nothing :rtype: None """ if isinstance(servers, six.string_types): servers = [...
[ "def", "set_servers", "(", "self", ",", "servers", ")", ":", "if", "isinstance", "(", "servers", ",", "six", ".", "string_types", ")", ":", "servers", "=", "[", "servers", "]", "assert", "servers", ",", "\"No memcached servers supplied\"", "self", ".", "_ser...
Iter to a list of servers and instantiate Protocol class. :param servers: A list of servers :type servers: list :return: Returns nothing :rtype: None
[ "Iter", "to", "a", "list", "of", "servers", "and", "instantiate", "Protocol", "class", "." ]
python
train
dropbox/stone
stone/frontend/parser.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/parser.py#L478-L480
def p_tag_ref(self, p): 'tag_ref : ID' p[0] = AstTagRef(self.path, p.lineno(1), p.lexpos(1), p[1])
[ "def", "p_tag_ref", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "AstTagRef", "(", "self", ".", "path", ",", "p", ".", "lineno", "(", "1", ")", ",", "p", ".", "lexpos", "(", "1", ")", ",", "p", "[", "1", "]", ")" ]
tag_ref : ID
[ "tag_ref", ":", "ID" ]
python
train
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L104-L179
def add_alpha_labels(axes, xpos=0.03, ypos=0.95, suffix='', color=None, fontsize=14, fontweight='normal', boxstyle='square', facecolor='white', edgecolor='white', alpha=1.0): '''Add sequential alphbet labels to subplot axes Args ---- axes: list of pyplot.ax A list of matplotlib ...
[ "def", "add_alpha_labels", "(", "axes", ",", "xpos", "=", "0.03", ",", "ypos", "=", "0.95", ",", "suffix", "=", "''", ",", "color", "=", "None", ",", "fontsize", "=", "14", ",", "fontweight", "=", "'normal'", ",", "boxstyle", "=", "'square'", ",", "f...
Add sequential alphbet labels to subplot axes Args ---- axes: list of pyplot.ax A list of matplotlib axes to add the label labels to xpos: float or array_like X position(s) of labels in figure coordinates ypos: float or array_like Y position(s) of labels in figure coordinate...
[ "Add", "sequential", "alphbet", "labels", "to", "subplot", "axes" ]
python
train
cloudmesh/cloudmesh-common
cloudmesh/common/ConfigDict.py
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ConfigDict.py#L336-L346
def save(self, filename=None): """ saves the configuration in the given filename, if it is none the filename at load time is used. :param filename: the file name :type filename: string :return: """ content = self.data.yaml() with open(Config.path_e...
[ "def", "save", "(", "self", ",", "filename", "=", "None", ")", ":", "content", "=", "self", ".", "data", ".", "yaml", "(", ")", "with", "open", "(", "Config", ".", "path_expand", "(", "ConfigDict", ".", "filename", ")", ",", "'w'", ")", "as", "f", ...
saves the configuration in the given filename, if it is none the filename at load time is used. :param filename: the file name :type filename: string :return:
[ "saves", "the", "configuration", "in", "the", "given", "filename", "if", "it", "is", "none", "the", "filename", "at", "load", "time", "is", "used", ".", ":", "param", "filename", ":", "the", "file", "name", ":", "type", "filename", ":", "string", ":", ...
python
train
spyder-ide/spyder
spyder/config/user.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L417-L425
def set_default(self, section, option, default_value): """ Set Default value for a given (section, option) -> called when a new (section, option) is set and no default exists """ section = self._check_section_option(section, option) for sec, options in self.defaults...
[ "def", "set_default", "(", "self", ",", "section", ",", "option", ",", "default_value", ")", ":", "section", "=", "self", ".", "_check_section_option", "(", "section", ",", "option", ")", "for", "sec", ",", "options", "in", "self", ".", "defaults", ":", ...
Set Default value for a given (section, option) -> called when a new (section, option) is set and no default exists
[ "Set", "Default", "value", "for", "a", "given", "(", "section", "option", ")", "-", ">", "called", "when", "a", "new", "(", "section", "option", ")", "is", "set", "and", "no", "default", "exists" ]
python
train
InfoAgeTech/django-core
django_core/forms/widgets.py
https://github.com/InfoAgeTech/django-core/blob/9664a145473b75120bf71e1644e9c8086e7e8955/django_core/forms/widgets.py#L78-L85
def get_widget_css_class(self, attrs): """Gets the class for the widget.""" size_class = 'size-{0}'.format(self.num_inputs) if 'class' in attrs: attrs['class'] += ' {0}'.format(size_class) else: attrs['class'] = size_class
[ "def", "get_widget_css_class", "(", "self", ",", "attrs", ")", ":", "size_class", "=", "'size-{0}'", ".", "format", "(", "self", ".", "num_inputs", ")", "if", "'class'", "in", "attrs", ":", "attrs", "[", "'class'", "]", "+=", "' {0}'", ".", "format", "("...
Gets the class for the widget.
[ "Gets", "the", "class", "for", "the", "widget", "." ]
python
train
neighbordog/deviantart
deviantart/api.py
https://github.com/neighbordog/deviantart/blob/5612f1d5e2139a48c9d793d7fd19cde7e162d7b1/deviantart/api.py#L299-L312
def get_categories(self, catpath="/"): """Fetch the categorytree :param catpath: The category to list children of """ response = self._req('/browse/categorytree', { "catpath":catpath }) categories = response['categories'] return categories
[ "def", "get_categories", "(", "self", ",", "catpath", "=", "\"/\"", ")", ":", "response", "=", "self", ".", "_req", "(", "'/browse/categorytree'", ",", "{", "\"catpath\"", ":", "catpath", "}", ")", "categories", "=", "response", "[", "'categories'", "]", "...
Fetch the categorytree :param catpath: The category to list children of
[ "Fetch", "the", "categorytree" ]
python
train
rflamary/POT
ot/lp/cvx.py
https://github.com/rflamary/POT/blob/c5108efc7b6702e1af3928bef1032e6b37734d1c/ot/lp/cvx.py#L22-L26
def scipy_sparse_to_spmatrix(A): """Efficient conversion from scipy sparse matrix to cvxopt sparse matrix""" coo = A.tocoo() SP = spmatrix(coo.data.tolist(), coo.row.tolist(), coo.col.tolist(), size=A.shape) return SP
[ "def", "scipy_sparse_to_spmatrix", "(", "A", ")", ":", "coo", "=", "A", ".", "tocoo", "(", ")", "SP", "=", "spmatrix", "(", "coo", ".", "data", ".", "tolist", "(", ")", ",", "coo", ".", "row", ".", "tolist", "(", ")", ",", "coo", ".", "col", "....
Efficient conversion from scipy sparse matrix to cvxopt sparse matrix
[ "Efficient", "conversion", "from", "scipy", "sparse", "matrix", "to", "cvxopt", "sparse", "matrix" ]
python
train
bitcraze/crazyflie-lib-python
cflib/crazyflie/__init__.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/__init__.py#L356-L359
def add_port_callback(self, port, cb): """Add a callback for data that comes on a specific port""" logger.debug('Adding callback on port [%d] to [%s]', port, cb) self.add_header_callback(cb, port, 0, 0xff, 0x0)
[ "def", "add_port_callback", "(", "self", ",", "port", ",", "cb", ")", ":", "logger", ".", "debug", "(", "'Adding callback on port [%d] to [%s]'", ",", "port", ",", "cb", ")", "self", ".", "add_header_callback", "(", "cb", ",", "port", ",", "0", ",", "0xff"...
Add a callback for data that comes on a specific port
[ "Add", "a", "callback", "for", "data", "that", "comes", "on", "a", "specific", "port" ]
python
train
dottedmag/pychm
chm/chm.py
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L238-L319
def GetArchiveInfo(self): '''Obtains information on CHM archive. This function checks the /#SYSTEM file inside the CHM archive to obtain the index, home page, topics, encoding and title. It is called from LoadCHM. ''' self.searchable = extra.is_searchable(self.file) ...
[ "def", "GetArchiveInfo", "(", "self", ")", ":", "self", ".", "searchable", "=", "extra", ".", "is_searchable", "(", "self", ".", "file", ")", "self", ".", "lcid", "=", "None", "result", ",", "ui", "=", "chmlib", ".", "chm_resolve_object", "(", "self", ...
Obtains information on CHM archive. This function checks the /#SYSTEM file inside the CHM archive to obtain the index, home page, topics, encoding and title. It is called from LoadCHM.
[ "Obtains", "information", "on", "CHM", "archive", ".", "This", "function", "checks", "the", "/", "#SYSTEM", "file", "inside", "the", "CHM", "archive", "to", "obtain", "the", "index", "home", "page", "topics", "encoding", "and", "title", ".", "It", "is", "c...
python
train
vaexio/vaex
packages/vaex-astro/vaex/astro/export.py
https://github.com/vaexio/vaex/blob/a45b672f8287afca2ada8e36b74b604b9b28dd85/packages/vaex-astro/vaex/astro/export.py#L23-L107
def export_hdf5_v1(dataset, path, column_names=None, byteorder="=", shuffle=False, selection=False, progress=None, virtual=True): """ :param DatasetLocal dataset: dataset to export :param str path: path for file :param lis[str] column_names: list of column names to export or None for all columns :pa...
[ "def", "export_hdf5_v1", "(", "dataset", ",", "path", ",", "column_names", "=", "None", ",", "byteorder", "=", "\"=\"", ",", "shuffle", "=", "False", ",", "selection", "=", "False", ",", "progress", "=", "None", ",", "virtual", "=", "True", ")", ":", "...
:param DatasetLocal dataset: dataset to export :param str path: path for file :param lis[str] column_names: list of column names to export or None for all columns :param str byteorder: = for native, < for little endian and > for big endian :param bool shuffle: export rows in random order :param bool...
[ ":", "param", "DatasetLocal", "dataset", ":", "dataset", "to", "export", ":", "param", "str", "path", ":", "path", "for", "file", ":", "param", "lis", "[", "str", "]", "column_names", ":", "list", "of", "column", "names", "to", "export", "or", "None", ...
python
test
DLR-RM/RAFCON
source/rafcon/gui/utils/notification_overview.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/utils/notification_overview.py#L114-L269
def get_nice_info_dict_string(self, info, level='\t', overview=None): """ Inserts all elements of a notification info-dictionary of gtkmvc3 or a Signal into one string and indicates levels of calls defined by 'kwargs'. Additionally, the elements get structured into a dict that holds all levels o...
[ "def", "get_nice_info_dict_string", "(", "self", ",", "info", ",", "level", "=", "'\\t'", ",", "overview", "=", "None", ")", ":", "def", "get_nice_meta_signal_msg_tuple_string", "(", "meta_signal_msg_tuple", ",", "level", ",", "overview", ")", ":", "meta_signal_di...
Inserts all elements of a notification info-dictionary of gtkmvc3 or a Signal into one string and indicates levels of calls defined by 'kwargs'. Additionally, the elements get structured into a dict that holds all levels of the general notification key-value pairs in faster accessible lists. The diction...
[ "Inserts", "all", "elements", "of", "a", "notification", "info", "-", "dictionary", "of", "gtkmvc3", "or", "a", "Signal", "into", "one", "string", "and", "indicates", "levels", "of", "calls", "defined", "by", "kwargs", ".", "Additionally", "the", "elements", ...
python
train
gwastro/pycbc
pycbc/tmpltbank/calc_moments.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/tmpltbank/calc_moments.py#L23-L149
def determine_eigen_directions(metricParams, preserveMoments=False, vary_fmax=False, vary_density=None): """ This function will calculate the coordinate transfomations that are needed to rotate from a coordinate system described by the various Lambda components in the freq...
[ "def", "determine_eigen_directions", "(", "metricParams", ",", "preserveMoments", "=", "False", ",", "vary_fmax", "=", "False", ",", "vary_density", "=", "None", ")", ":", "evals", "=", "{", "}", "evecs", "=", "{", "}", "metric", "=", "{", "}", "unmax_metr...
This function will calculate the coordinate transfomations that are needed to rotate from a coordinate system described by the various Lambda components in the frequency expansion, to a coordinate system where the metric is Cartesian. Parameters ----------- metricParams : metricParameters insta...
[ "This", "function", "will", "calculate", "the", "coordinate", "transfomations", "that", "are", "needed", "to", "rotate", "from", "a", "coordinate", "system", "described", "by", "the", "various", "Lambda", "components", "in", "the", "frequency", "expansion", "to", ...
python
train
andy-z/ged4py
ged4py/parser.py
https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/parser.py#L60-L129
def guess_codec(file, errors="strict", require_char=False): """Look at file contents and guess its correct encoding. File must be open in binary mode and positioned at offset 0. If BOM record is present then it is assumed to be UTF-8 or UTF-16 encoded file. GEDCOM header is searched for CHAR record and...
[ "def", "guess_codec", "(", "file", ",", "errors", "=", "\"strict\"", ",", "require_char", "=", "False", ")", ":", "# mapping of gedcom character set specifiers to Python encoding names", "gedcom_char_to_codec", "=", "{", "'ansel'", ":", "'gedcom'", ",", "}", "# check BO...
Look at file contents and guess its correct encoding. File must be open in binary mode and positioned at offset 0. If BOM record is present then it is assumed to be UTF-8 or UTF-16 encoded file. GEDCOM header is searched for CHAR record and encoding name is extracted from it, if BOM record is present t...
[ "Look", "at", "file", "contents", "and", "guess", "its", "correct", "encoding", "." ]
python
train
numenta/nupic
src/nupic/database/client_jobs_dao.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/database/client_jobs_dao.py#L1005-L1033
def _getOneMatchingRowNoRetries(self, tableInfo, conn, fieldsToMatch, selectFieldNames): """ Return a single matching row with the requested field values from the the requested table or None if nothing matched. tableInfo: Table information: a ClientJobsDAO._TableInfo...
[ "def", "_getOneMatchingRowNoRetries", "(", "self", ",", "tableInfo", ",", "conn", ",", "fieldsToMatch", ",", "selectFieldNames", ")", ":", "rows", "=", "self", ".", "_getMatchingRowsNoRetries", "(", "tableInfo", ",", "conn", ",", "fieldsToMatch", ",", "selectField...
Return a single matching row with the requested field values from the the requested table or None if nothing matched. tableInfo: Table information: a ClientJobsDAO._TableInfoBase instance conn: Owned connection acquired from ConnectionFactory.get() fieldsToMatch: Dictionary of inter...
[ "Return", "a", "single", "matching", "row", "with", "the", "requested", "field", "values", "from", "the", "the", "requested", "table", "or", "None", "if", "nothing", "matched", "." ]
python
valid
polysquare/polysquare-generic-file-linter
polysquarelinter/spelling.py
https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/spelling.py#L467-L480
def get_transition(self, # suppress(too-many-arguments) line, line_index, column, is_escaped, comment_system_transitions, eof=False): """Return a parser state, a move-ahead ...
[ "def", "get_transition", "(", "self", ",", "# suppress(too-many-arguments)", "line", ",", "line_index", ",", "column", ",", "is_escaped", ",", "comment_system_transitions", ",", "eof", "=", "False", ")", ":", "raise", "NotImplementedError", "(", "\"\"\"Cannot instanti...
Return a parser state, a move-ahead amount, and an append range. If this parser state should terminate and return back to the TEXT state, then return that state and also any corresponding chunk that would have been yielded as a result.
[ "Return", "a", "parser", "state", "a", "move", "-", "ahead", "amount", "and", "an", "append", "range", "." ]
python
train
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/WSDLTools.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1473-L1477
def addOutParameter(self, name, type, namespace=None, element_type=0): """Add an output parameter description to the call info.""" parameter = ParameterInfo(name, type, namespace, element_type) self.outparams.append(parameter) return parameter
[ "def", "addOutParameter", "(", "self", ",", "name", ",", "type", ",", "namespace", "=", "None", ",", "element_type", "=", "0", ")", ":", "parameter", "=", "ParameterInfo", "(", "name", ",", "type", ",", "namespace", ",", "element_type", ")", "self", ".",...
Add an output parameter description to the call info.
[ "Add", "an", "output", "parameter", "description", "to", "the", "call", "info", "." ]
python
train
maxzheng/localconfig
localconfig/manager.py
https://github.com/maxzheng/localconfig/blob/636087f2489295d9dae2693dda8a86e4daa4ff9d/localconfig/manager.py#L109-L117
def _add_dot_key(self, section, key=None): """ :param str section: Config section :param str key: Config key """ if key: self._dot_keys[self._to_dot_key(section, key)] = (section, key) else: self._dot_keys[self._to_dot_key(section)] = section
[ "def", "_add_dot_key", "(", "self", ",", "section", ",", "key", "=", "None", ")", ":", "if", "key", ":", "self", ".", "_dot_keys", "[", "self", ".", "_to_dot_key", "(", "section", ",", "key", ")", "]", "=", "(", "section", ",", "key", ")", "else", ...
:param str section: Config section :param str key: Config key
[ ":", "param", "str", "section", ":", "Config", "section", ":", "param", "str", "key", ":", "Config", "key" ]
python
train
fabioz/PyDev.Debugger
third_party/pep8/lib2to3/lib2to3/refactor.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/lib2to3/lib2to3/refactor.py#L339-L360
def refactor_file(self, filename, write=False, doctests_only=False): """Refactors a file.""" input, encoding = self._read_python_source(filename) if input is None: # Reading the file failed. return input += u"\n" # Silence certain parse errors if doctests_...
[ "def", "refactor_file", "(", "self", ",", "filename", ",", "write", "=", "False", ",", "doctests_only", "=", "False", ")", ":", "input", ",", "encoding", "=", "self", ".", "_read_python_source", "(", "filename", ")", "if", "input", "is", "None", ":", "# ...
Refactors a file.
[ "Refactors", "a", "file", "." ]
python
train
tBuLi/symfit
symfit/core/fit.py
https://github.com/tBuLi/symfit/blob/759dd3d1d4270510d651f40b23dd26b1b10eee83/symfit/core/fit.py#L851-L871
def eval_hessian(self, *args, **kwargs): """ :return: Hessian evaluated at the specified point. """ # Evaluate the hessian model and use the resulting Ans namedtuple as a # dict. From this, take the relevant components. eval_hess_dict = self.hessian_model(*args, **kwargs)...
[ "def", "eval_hessian", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Evaluate the hessian model and use the resulting Ans namedtuple as a", "# dict. From this, take the relevant components.", "eval_hess_dict", "=", "self", ".", "hessian_model", "(", "...
:return: Hessian evaluated at the specified point.
[ ":", "return", ":", "Hessian", "evaluated", "at", "the", "specified", "point", "." ]
python
train
joshspeagle/dynesty
dynesty/sampler.py
https://github.com/joshspeagle/dynesty/blob/9e482aafeb5cf84bedb896fa6f07a761d917983e/dynesty/sampler.py#L863-L899
def add_final_live(self, print_progress=True, print_func=None): """ **A wrapper that executes the loop adding the final live points.** Adds the final set of live points to the pre-existing sequence of dead points from the current nested sampling run. Parameters ---------...
[ "def", "add_final_live", "(", "self", ",", "print_progress", "=", "True", ",", "print_func", "=", "None", ")", ":", "# Initialize quantities/", "if", "print_func", "is", "None", ":", "print_func", "=", "print_fn", "# Add remaining live points to samples.", "ncall", ...
**A wrapper that executes the loop adding the final live points.** Adds the final set of live points to the pre-existing sequence of dead points from the current nested sampling run. Parameters ---------- print_progress : bool, optional Whether or not to output a sim...
[ "**", "A", "wrapper", "that", "executes", "the", "loop", "adding", "the", "final", "live", "points", ".", "**", "Adds", "the", "final", "set", "of", "live", "points", "to", "the", "pre", "-", "existing", "sequence", "of", "dead", "points", "from", "the",...
python
train
SCIP-Interfaces/PySCIPOpt
examples/unfinished/portfolio_soco.py
https://github.com/SCIP-Interfaces/PySCIPOpt/blob/9c960b40d94a48b0304d73dbe28b467b9c065abe/examples/unfinished/portfolio_soco.py#L27-L55
def p_portfolio(I,sigma,r,alpha,beta): """p_portfolio -- modified markowitz model for portfolio optimization. Parameters: - I: set of items - sigma[i]: standard deviation of item i - r[i]: revenue of item i - alpha: acceptance threshold - beta: desired confidence level ...
[ "def", "p_portfolio", "(", "I", ",", "sigma", ",", "r", ",", "alpha", ",", "beta", ")", ":", "model", "=", "Model", "(", "\"p_portfolio\"", ")", "x", "=", "{", "}", "for", "i", "in", "I", ":", "x", "[", "i", "]", "=", "model", ".", "addVar", ...
p_portfolio -- modified markowitz model for portfolio optimization. Parameters: - I: set of items - sigma[i]: standard deviation of item i - r[i]: revenue of item i - alpha: acceptance threshold - beta: desired confidence level Returns a model, ready to be solved.
[ "p_portfolio", "--", "modified", "markowitz", "model", "for", "portfolio", "optimization", ".", "Parameters", ":", "-", "I", ":", "set", "of", "items", "-", "sigma", "[", "i", "]", ":", "standard", "deviation", "of", "item", "i", "-", "r", "[", "i", "]...
python
train
pytorch/vision
torchvision/datasets/mnist.py
https://github.com/pytorch/vision/blob/3afcf3cd49661c466c75ea536b0b2a7ff57f9a05/torchvision/datasets/mnist.py#L262-L304
def download(self): """Download the EMNIST data if it doesn't exist in processed_folder already.""" import shutil import zipfile if self._check_exists(): return makedir_exist_ok(self.raw_folder) makedir_exist_ok(self.processed_folder) # download fil...
[ "def", "download", "(", "self", ")", ":", "import", "shutil", "import", "zipfile", "if", "self", ".", "_check_exists", "(", ")", ":", "return", "makedir_exist_ok", "(", "self", ".", "raw_folder", ")", "makedir_exist_ok", "(", "self", ".", "processed_folder", ...
Download the EMNIST data if it doesn't exist in processed_folder already.
[ "Download", "the", "EMNIST", "data", "if", "it", "doesn", "t", "exist", "in", "processed_folder", "already", "." ]
python
test
wakatime/wakatime
wakatime/packages/urllib3/util/connection.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/urllib3/util/connection.py#L7-L29
def is_connection_dropped(conn): # Platform-specific """ Returns True if the connection is dropped and should be closed. :param conn: :class:`httplib.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycli...
[ "def", "is_connection_dropped", "(", "conn", ")", ":", "# Platform-specific", "sock", "=", "getattr", "(", "conn", ",", "'sock'", ",", "False", ")", "if", "sock", "is", "False", ":", "# Platform-specific: AppEngine", "return", "False", "if", "sock", "is", "Non...
Returns True if the connection is dropped and should be closed. :param conn: :class:`httplib.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycling transparently for us.
[ "Returns", "True", "if", "the", "connection", "is", "dropped", "and", "should", "be", "closed", "." ]
python
train
Mindwerks/worldengine
worldengine/draw.py
https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/draw.py#L323-L353
def draw_simple_elevation(world, sea_level, target): """ This function can be used on a generic canvas (either an image to save on disk or a canvas part of a GUI) """ e = world.layers['elevation'].data c = numpy.empty(e.shape, dtype=numpy.float) has_ocean = not (sea_level is None or world.l...
[ "def", "draw_simple_elevation", "(", "world", ",", "sea_level", ",", "target", ")", ":", "e", "=", "world", ".", "layers", "[", "'elevation'", "]", ".", "data", "c", "=", "numpy", ".", "empty", "(", "e", ".", "shape", ",", "dtype", "=", "numpy", ".",...
This function can be used on a generic canvas (either an image to save on disk or a canvas part of a GUI)
[ "This", "function", "can", "be", "used", "on", "a", "generic", "canvas", "(", "either", "an", "image", "to", "save", "on", "disk", "or", "a", "canvas", "part", "of", "a", "GUI", ")" ]
python
train
Shapeways/coyote_framework
coyote_framework/mixins/filesystem.py
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/filesystem.py#L7-L19
def create_directory(directory): """Creates a directory if it does not exist (in a thread-safe way) @param directory: The directory to create @return: The directory specified """ try: os.makedirs(directory) except OSError, e: if e.errno == errno.EEXIST and os.path.isdir(director...
[ "def", "create_directory", "(", "directory", ")", ":", "try", ":", "os", ".", "makedirs", "(", "directory", ")", "except", "OSError", ",", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "EEXIST", "and", "os", ".", "path", ".", "isdir", "(", ...
Creates a directory if it does not exist (in a thread-safe way) @param directory: The directory to create @return: The directory specified
[ "Creates", "a", "directory", "if", "it", "does", "not", "exist", "(", "in", "a", "thread", "-", "safe", "way", ")" ]
python
train
tmux-python/libtmux
libtmux/window.py
https://github.com/tmux-python/libtmux/blob/8eb2f8bbea3a025c1567b1516653414dbc24e1fc/libtmux/window.py#L356-L378
def select_pane(self, target_pane): """ Return selected :class:`Pane` through ``$ tmux select-pane``. Parameters ---------- target_pane : str 'target_pane', '-U' ,'-D', '-L', '-R', or '-l'. Return ------ :class:`Pane` """ if ...
[ "def", "select_pane", "(", "self", ",", "target_pane", ")", ":", "if", "target_pane", "in", "[", "'-l'", ",", "'-U'", ",", "'-D'", ",", "'-L'", ",", "'-R'", "]", ":", "proc", "=", "self", ".", "cmd", "(", "'select-pane'", ",", "'-t%s'", "%", "self", ...
Return selected :class:`Pane` through ``$ tmux select-pane``. Parameters ---------- target_pane : str 'target_pane', '-U' ,'-D', '-L', '-R', or '-l'. Return ------ :class:`Pane`
[ "Return", "selected", ":", "class", ":", "Pane", "through", "$", "tmux", "select", "-", "pane", "." ]
python
train
universalcore/unicore.distribute
unicore/distribute/utils.py
https://github.com/universalcore/unicore.distribute/blob/f3216fefd9df5aef31b3d1b666eb3f79db032d98/unicore/distribute/utils.py#L50-L69
def get_dict(self, section, option): """ This allows for loading of Pyramid dictionary style configuration options: [foo] bar = baz=qux zap=paz ``get_dict('foo', 'bar')`` returns ``{'baz': 'qux', 'zap': 'paz'}`` :param str section: ...
[ "def", "get_dict", "(", "self", ",", "section", ",", "option", ")", ":", "return", "dict", "(", "re", ".", "split", "(", "'\\s*=\\s*'", ",", "value", ")", "for", "value", "in", "self", ".", "get_list", "(", "section", ",", "option", ")", ")" ]
This allows for loading of Pyramid dictionary style configuration options: [foo] bar = baz=qux zap=paz ``get_dict('foo', 'bar')`` returns ``{'baz': 'qux', 'zap': 'paz'}`` :param str section: The section to read. :param str option: ...
[ "This", "allows", "for", "loading", "of", "Pyramid", "dictionary", "style", "configuration", "options", ":" ]
python
train
numenta/nupic
src/nupic/algorithms/spatial_pooler.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1476-L1492
def _updateBoostFactorsGlobal(self): """ Update boost factors when global inhibition is used """ # When global inhibition is enabled, the target activation level is # the sparsity of the spatial pooler if (self._localAreaDensity > 0): targetDensity = self._localAreaDensity else: ...
[ "def", "_updateBoostFactorsGlobal", "(", "self", ")", ":", "# When global inhibition is enabled, the target activation level is", "# the sparsity of the spatial pooler", "if", "(", "self", ".", "_localAreaDensity", ">", "0", ")", ":", "targetDensity", "=", "self", ".", "_lo...
Update boost factors when global inhibition is used
[ "Update", "boost", "factors", "when", "global", "inhibition", "is", "used" ]
python
valid
scoutapp/scout_apm_python
src/scout_apm/api/context.py
https://github.com/scoutapp/scout_apm_python/blob/e5539ee23b8129be9b75d5007c88b6158b51294f/src/scout_apm/api/context.py#L8-L18
def add(key, value): """Adds context to the currently executing request. :key: Any String identifying the request context. Example: "user_ip", "plan", "alert_count" :value: Any json-serializable type. Example: "1.1.1.1", "free", 100 :returns: nothing. ...
[ "def", "add", "(", "key", ",", "value", ")", ":", "tr", "=", "TrackedRequest", ".", "instance", "(", ")", "tr", ".", "tag", "(", "key", ",", "value", ")" ]
Adds context to the currently executing request. :key: Any String identifying the request context. Example: "user_ip", "plan", "alert_count" :value: Any json-serializable type. Example: "1.1.1.1", "free", 100 :returns: nothing.
[ "Adds", "context", "to", "the", "currently", "executing", "request", "." ]
python
train
Jammy2211/PyAutoLens
autolens/plotters/array_plotters.py
https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/plotters/array_plotters.py#L495-L520
def plot_mask(mask, units, kpc_per_arcsec, pointsize, zoom_offset_pixels): """Plot the mask of the array on the figure. Parameters ----------- mask : ndarray of data.array.mask.Mask The mask applied to the array, the edge of which is plotted as a set of points over the plotted array. units ...
[ "def", "plot_mask", "(", "mask", ",", "units", ",", "kpc_per_arcsec", ",", "pointsize", ",", "zoom_offset_pixels", ")", ":", "if", "mask", "is", "not", "None", ":", "plt", ".", "gca", "(", ")", "edge_pixels", "=", "mask", ".", "masked_grid_index_to_pixel", ...
Plot the mask of the array on the figure. Parameters ----------- mask : ndarray of data.array.mask.Mask The mask applied to the array, the edge of which is plotted as a set of points over the plotted array. units : str The units of the y / x axis of the plots, in arc-seconds ('arcsec') ...
[ "Plot", "the", "mask", "of", "the", "array", "on", "the", "figure", "." ]
python
valid
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py#L898-L909
def ovsdb_server_port(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ovsdb_server = ET.SubElement(config, "ovsdb-server", xmlns="urn:brocade.com:mgmt:brocade-tunnels") name_key = ET.SubElement(ovsdb_server, "name") name_key.text = kwargs.pop('na...
[ "def", "ovsdb_server_port", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "ovsdb_server", "=", "ET", ".", "SubElement", "(", "config", ",", "\"ovsdb-server\"", ",", "xmlns", "=", "\"urn:brocade...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
Vagrants/blackbird
blackbird/utils/configread.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L218-L227
def notify(self, name, job): """ Concrete method of Subject.notify(). Notify to change the status of Subject for observer. This method call Observer.update(). In this program, ConfigReader.notify() call JobObserver.update(). For exmaple, register threads.redis.ConcreateJo...
[ "def", "notify", "(", "self", ",", "name", ",", "job", ")", ":", "for", "observer", "in", "self", ".", "_observers", ":", "observer", ".", "update", "(", "name", ",", "job", ")" ]
Concrete method of Subject.notify(). Notify to change the status of Subject for observer. This method call Observer.update(). In this program, ConfigReader.notify() call JobObserver.update(). For exmaple, register threads.redis.ConcreateJob to JobObserver.jobs.
[ "Concrete", "method", "of", "Subject", ".", "notify", "()", ".", "Notify", "to", "change", "the", "status", "of", "Subject", "for", "observer", ".", "This", "method", "call", "Observer", ".", "update", "()", ".", "In", "this", "program", "ConfigReader", "....
python
train
spyder-ide/spyder
spyder/utils/qthelpers.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L396-L411
def show(self, dialog): """Generic method to show a non-modal dialog and keep reference to the Qt C++ object""" for dlg in list(self.dialogs.values()): if to_text_string(dlg.windowTitle()) \ == to_text_string(dialog.windowTitle()): dlg.show() ...
[ "def", "show", "(", "self", ",", "dialog", ")", ":", "for", "dlg", "in", "list", "(", "self", ".", "dialogs", ".", "values", "(", ")", ")", ":", "if", "to_text_string", "(", "dlg", ".", "windowTitle", "(", ")", ")", "==", "to_text_string", "(", "di...
Generic method to show a non-modal dialog and keep reference to the Qt C++ object
[ "Generic", "method", "to", "show", "a", "non", "-", "modal", "dialog", "and", "keep", "reference", "to", "the", "Qt", "C", "++", "object" ]
python
train
crytic/slither
slither/core/declarations/function.py
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/core/declarations/function.py#L782-L792
def apply_visitor(self, Visitor): """ Apply a visitor to all the function expressions Args: Visitor: slither.visitors Returns list(): results of the visit """ expressions = self.expressions v = [Visitor(e).result() for e in expressions]...
[ "def", "apply_visitor", "(", "self", ",", "Visitor", ")", ":", "expressions", "=", "self", ".", "expressions", "v", "=", "[", "Visitor", "(", "e", ")", ".", "result", "(", ")", "for", "e", "in", "expressions", "]", "return", "[", "item", "for", "subl...
Apply a visitor to all the function expressions Args: Visitor: slither.visitors Returns list(): results of the visit
[ "Apply", "a", "visitor", "to", "all", "the", "function", "expressions", "Args", ":", "Visitor", ":", "slither", ".", "visitors", "Returns", "list", "()", ":", "results", "of", "the", "visit" ]
python
train
MillionIntegrals/vel
vel/optimizers/sgd.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/optimizers/sgd.py#L32-L34
def create(lr, weight_decay=0, momentum=0, layer_groups=False): """ Vel factory function """ return SgdFactory(lr=lr, weight_decay=weight_decay, momentum=momentum, layer_groups=layer_groups)
[ "def", "create", "(", "lr", ",", "weight_decay", "=", "0", ",", "momentum", "=", "0", ",", "layer_groups", "=", "False", ")", ":", "return", "SgdFactory", "(", "lr", "=", "lr", ",", "weight_decay", "=", "weight_decay", ",", "momentum", "=", "momentum", ...
Vel factory function
[ "Vel", "factory", "function" ]
python
train
cloudant/python-cloudant
src/cloudant/database.py
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/database.py#L1403-L1413
def shards(self): """ Retrieves information about the shards in the current remote database. :returns: Shard information retrieval status in JSON format """ url = '/'.join((self.database_url, '_shards')) resp = self.r_session.get(url) resp.raise_for_status() ...
[ "def", "shards", "(", "self", ")", ":", "url", "=", "'/'", ".", "join", "(", "(", "self", ".", "database_url", ",", "'_shards'", ")", ")", "resp", "=", "self", ".", "r_session", ".", "get", "(", "url", ")", "resp", ".", "raise_for_status", "(", ")"...
Retrieves information about the shards in the current remote database. :returns: Shard information retrieval status in JSON format
[ "Retrieves", "information", "about", "the", "shards", "in", "the", "current", "remote", "database", "." ]
python
train
openpermissions/perch
perch/model.py
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/model.py#L246-L267
def validate_state_transition(self, user, start_state, end_state, **kwargs): """ Validate whether user can transition resource from start state to end state :param user :param start_state :param end_state :return: bool """ if start_state == end_state: ...
[ "def", "validate_state_transition", "(", "self", ",", "user", ",", "start_state", ",", "end_state", ",", "*", "*", "kwargs", ")", ":", "if", "start_state", "==", "end_state", ":", "raise", "Return", "(", "True", ")", "transitions", "=", "self", ".", "state...
Validate whether user can transition resource from start state to end state :param user :param start_state :param end_state :return: bool
[ "Validate", "whether", "user", "can", "transition", "resource", "from", "start", "state", "to", "end", "state", ":", "param", "user", ":", "param", "start_state", ":", "param", "end_state", ":", "return", ":", "bool" ]
python
train
openstack/networking-cisco
networking_cisco/apps/saf/agent/iptables_driver.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/iptables_driver.py#L66-L75
def remove_rule_entry(self, rule_info): """Remove host data object from rule_info list.""" temp_list = list(self.rule_info) for rule in temp_list: if (rule.ip == rule_info.get('ip') and rule.mac == rule_info.get('mac') and rule.port == rule_info.g...
[ "def", "remove_rule_entry", "(", "self", ",", "rule_info", ")", ":", "temp_list", "=", "list", "(", "self", ".", "rule_info", ")", "for", "rule", "in", "temp_list", ":", "if", "(", "rule", ".", "ip", "==", "rule_info", ".", "get", "(", "'ip'", ")", "...
Remove host data object from rule_info list.
[ "Remove", "host", "data", "object", "from", "rule_info", "list", "." ]
python
train
pandas-dev/pandas
pandas/tseries/offsets.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/tseries/offsets.py#L1474-L1490
def _get_offset_day(self, other): """ Find the day in the same month as other that has the same weekday as self.weekday and is the self.week'th such day in the month. Parameters ---------- other : datetime Returns ------- day : int """ ...
[ "def", "_get_offset_day", "(", "self", ",", "other", ")", ":", "mstart", "=", "datetime", "(", "other", ".", "year", ",", "other", ".", "month", ",", "1", ")", "wday", "=", "mstart", ".", "weekday", "(", ")", "shift_days", "=", "(", "self", ".", "w...
Find the day in the same month as other that has the same weekday as self.weekday and is the self.week'th such day in the month. Parameters ---------- other : datetime Returns ------- day : int
[ "Find", "the", "day", "in", "the", "same", "month", "as", "other", "that", "has", "the", "same", "weekday", "as", "self", ".", "weekday", "and", "is", "the", "self", ".", "week", "th", "such", "day", "in", "the", "month", "." ]
python
train
awslabs/sockeye
sockeye/arguments.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/arguments.py#L192-L222
def simple_dict() -> Callable: """ A simple dictionary format that does not require spaces or quoting. Supported types: bool, int, float :return: A method that can be used as a type in argparse. """ def parse(dict_str: str): def _parse(value: str): if value == "True": ...
[ "def", "simple_dict", "(", ")", "->", "Callable", ":", "def", "parse", "(", "dict_str", ":", "str", ")", ":", "def", "_parse", "(", "value", ":", "str", ")", ":", "if", "value", "==", "\"True\"", ":", "return", "True", "if", "value", "==", "\"False\"...
A simple dictionary format that does not require spaces or quoting. Supported types: bool, int, float :return: A method that can be used as a type in argparse.
[ "A", "simple", "dictionary", "format", "that", "does", "not", "require", "spaces", "or", "quoting", "." ]
python
train
tensorflow/probability
tensorflow_probability/python/distributions/mixture.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/mixture.py#L497-L502
def _cat_probs(self, log_probs): """Get a list of num_components batchwise probabilities.""" which_softmax = tf.nn.log_softmax if log_probs else tf.nn.softmax cat_probs = which_softmax(self.cat.logits) cat_probs = tf.unstack(cat_probs, num=self.num_components, axis=-1) return cat_probs
[ "def", "_cat_probs", "(", "self", ",", "log_probs", ")", ":", "which_softmax", "=", "tf", ".", "nn", ".", "log_softmax", "if", "log_probs", "else", "tf", ".", "nn", ".", "softmax", "cat_probs", "=", "which_softmax", "(", "self", ".", "cat", ".", "logits"...
Get a list of num_components batchwise probabilities.
[ "Get", "a", "list", "of", "num_components", "batchwise", "probabilities", "." ]
python
test
ismms-himc/clustergrammer2
clustergrammer2/clustergrammer_fun/run_filter.py
https://github.com/ismms-himc/clustergrammer2/blob/5acea9bff7eda546cf0647b9e3647f631eb6f5f5/clustergrammer2/clustergrammer_fun/run_filter.py#L35-L68
def df_filter_col_sum(df, threshold, take_abs=True): ''' filter columns in matrix at some threshold and remove rows that have all zero values ''' from copy import deepcopy from .__init__ import Network net = Network() if take_abs is True: df_copy = deepcopy(df['mat'].abs()) else: df_copy = deepc...
[ "def", "df_filter_col_sum", "(", "df", ",", "threshold", ",", "take_abs", "=", "True", ")", ":", "from", "copy", "import", "deepcopy", "from", ".", "__init__", "import", "Network", "net", "=", "Network", "(", ")", "if", "take_abs", "is", "True", ":", "df...
filter columns in matrix at some threshold and remove rows that have all zero values
[ "filter", "columns", "in", "matrix", "at", "some", "threshold", "and", "remove", "rows", "that", "have", "all", "zero", "values" ]
python
train
GeorgeArgyros/symautomata
symautomata/pdastring.py
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pdastring.py#L503-L509
def printer(self): """Visualizes the current state""" for key in self.statediag: if key.trans is not None and len(key.trans) > 0: print '****** ' + repr(key.id) + '(' + repr(key.type)\ + ' on sym ' + repr(key.sym) + ') ******' print key.t...
[ "def", "printer", "(", "self", ")", ":", "for", "key", "in", "self", ".", "statediag", ":", "if", "key", ".", "trans", "is", "not", "None", "and", "len", "(", "key", ".", "trans", ")", ">", "0", ":", "print", "'****** '", "+", "repr", "(", "key",...
Visualizes the current state
[ "Visualizes", "the", "current", "state" ]
python
train
benley/butcher
butcher/targets/pkgfilegroup.py
https://github.com/benley/butcher/blob/8b18828ea040af56b7835beab5fd03eab23cc9ee/butcher/targets/pkgfilegroup.py#L62-L73
def output_files(self): """Returns the list of output files from this rule. Paths are generated from the outputs of this rule's dependencies, with their paths translated based on prefix and strip_prefix. Returned paths are relative to buildroot. """ for dep in self.subg...
[ "def", "output_files", "(", "self", ")", ":", "for", "dep", "in", "self", ".", "subgraph", ".", "successors", "(", "self", ".", "address", ")", ":", "dep_rule", "=", "self", ".", "subgraph", ".", "node", "[", "dep", "]", "[", "'target_obj'", "]", "fo...
Returns the list of output files from this rule. Paths are generated from the outputs of this rule's dependencies, with their paths translated based on prefix and strip_prefix. Returned paths are relative to buildroot.
[ "Returns", "the", "list", "of", "output", "files", "from", "this", "rule", "." ]
python
train
delfick/harpoon
harpoon/task_finder.py
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/task_finder.py#L26-L40
def find_tasks(self, overrides): """Find the custom tasks and record the associated image with each task""" tasks = self.default_tasks() configuration = self.collector.configuration for image in list(configuration["images"].keys()): path = configuration.path(["images", image...
[ "def", "find_tasks", "(", "self", ",", "overrides", ")", ":", "tasks", "=", "self", ".", "default_tasks", "(", ")", "configuration", "=", "self", ".", "collector", ".", "configuration", "for", "image", "in", "list", "(", "configuration", "[", "\"images\"", ...
Find the custom tasks and record the associated image with each task
[ "Find", "the", "custom", "tasks", "and", "record", "the", "associated", "image", "with", "each", "task" ]
python
train
mayhewj/greenstalk
greenstalk.py
https://github.com/mayhewj/greenstalk/blob/765a5e7321a101a08e400a66e88df06c57406f58/greenstalk.py#L263-L270
def bury(self, job: Job, priority: int = DEFAULT_PRIORITY) -> None: """Buries a reserved job. :param job: The job to bury. :param priority: An integer between 0 and 4,294,967,295 where 0 is the most urgent. """ self._send_cmd(b'bury %d %d' % (job.id, pri...
[ "def", "bury", "(", "self", ",", "job", ":", "Job", ",", "priority", ":", "int", "=", "DEFAULT_PRIORITY", ")", "->", "None", ":", "self", ".", "_send_cmd", "(", "b'bury %d %d'", "%", "(", "job", ".", "id", ",", "priority", ")", ",", "b'BURIED'", ")" ...
Buries a reserved job. :param job: The job to bury. :param priority: An integer between 0 and 4,294,967,295 where 0 is the most urgent.
[ "Buries", "a", "reserved", "job", "." ]
python
train
EpistasisLab/scikit-mdr
mdr/mdr.py
https://github.com/EpistasisLab/scikit-mdr/blob/768565deb10467d04a960d27e000ab38b7aa8a62/mdr/mdr.py#L191-L208
def fit_predict(self, features, class_labels): """Convenience function that fits the provided data then constructs predictions from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_sa...
[ "def", "fit_predict", "(", "self", ",", "features", ",", "class_labels", ")", ":", "self", ".", "fit", "(", "features", ",", "class_labels", ")", "return", "self", ".", "predict", "(", "features", ")" ]
Convenience function that fits the provided data then constructs predictions from the provided features. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix class_labels: array-like {n_samples} List of true class labels Retu...
[ "Convenience", "function", "that", "fits", "the", "provided", "data", "then", "constructs", "predictions", "from", "the", "provided", "features", "." ]
python
test
hotdoc/hotdoc
hotdoc/core/project.py
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/project.py#L304-L311
def __get_formatter(self, extension_name): """ Banana banana """ ext = self.extensions.get(extension_name) if ext: return ext.formatter return None
[ "def", "__get_formatter", "(", "self", ",", "extension_name", ")", ":", "ext", "=", "self", ".", "extensions", ".", "get", "(", "extension_name", ")", "if", "ext", ":", "return", "ext", ".", "formatter", "return", "None" ]
Banana banana
[ "Banana", "banana" ]
python
train
ray-project/ray
python/ray/rllib/models/preprocessors.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/models/preprocessors.py#L105-L124
def transform(self, observation): """Downsamples images from (210, 160, 3) by the configured factor.""" self.check_shape(observation) scaled = observation[25:-25, :, :] if self._dim < 84: scaled = cv2.resize(scaled, (84, 84)) # OpenAI: Resize by half, then down to 42x...
[ "def", "transform", "(", "self", ",", "observation", ")", ":", "self", ".", "check_shape", "(", "observation", ")", "scaled", "=", "observation", "[", "25", ":", "-", "25", ",", ":", ",", ":", "]", "if", "self", ".", "_dim", "<", "84", ":", "scaled...
Downsamples images from (210, 160, 3) by the configured factor.
[ "Downsamples", "images", "from", "(", "210", "160", "3", ")", "by", "the", "configured", "factor", "." ]
python
train
LLNL/scraper
scraper/tfs/__init__.py
https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scraper/tfs/__init__.py#L33-L51
def create_tfs_project_analysis_client(url, token=None): """ Create a project_analysis_client.py client for a Team Foundation Server Enterprise connection instance. This is helpful for understanding project languages, but currently blank for all our test conditions. If token is not provided, will attem...
[ "def", "create_tfs_project_analysis_client", "(", "url", ",", "token", "=", "None", ")", ":", "if", "token", "is", "None", ":", "token", "=", "os", ".", "environ", ".", "get", "(", "'TFS_API_TOKEN'", ",", "None", ")", "tfs_connection", "=", "create_tfs_conne...
Create a project_analysis_client.py client for a Team Foundation Server Enterprise connection instance. This is helpful for understanding project languages, but currently blank for all our test conditions. If token is not provided, will attempt to use the TFS_API_TOKEN environment variable if present.
[ "Create", "a", "project_analysis_client", ".", "py", "client", "for", "a", "Team", "Foundation", "Server", "Enterprise", "connection", "instance", ".", "This", "is", "helpful", "for", "understanding", "project", "languages", "but", "currently", "blank", "for", "al...
python
test
pipermerriam/flex
flex/validation/common.py
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L248-L264
def validate_unique_items(value, **kwargs): """ Validator for ARRAY types to enforce that all array items must be unique. """ # we can't just look at the items themselves since 0 and False are treated # the same as dictionary keys, and objects aren't hashable. counter = collections.Counter(( ...
[ "def", "validate_unique_items", "(", "value", ",", "*", "*", "kwargs", ")", ":", "# we can't just look at the items themselves since 0 and False are treated", "# the same as dictionary keys, and objects aren't hashable.", "counter", "=", "collections", ".", "Counter", "(", "(", ...
Validator for ARRAY types to enforce that all array items must be unique.
[ "Validator", "for", "ARRAY", "types", "to", "enforce", "that", "all", "array", "items", "must", "be", "unique", "." ]
python
train
pallets/werkzeug
examples/coolmagic/utils.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/coolmagic/utils.py#L33-L55
def export(string, template=None, **extra): """ Decorator for registering view functions and adding templates to it. """ def wrapped(f): endpoint = (f.__module__ + "." + f.__name__)[16:] if template is not None: old_f = f def f(**kwargs): rv ...
[ "def", "export", "(", "string", ",", "template", "=", "None", ",", "*", "*", "extra", ")", ":", "def", "wrapped", "(", "f", ")", ":", "endpoint", "=", "(", "f", ".", "__module__", "+", "\".\"", "+", "f", ".", "__name__", ")", "[", "16", ":", "]...
Decorator for registering view functions and adding templates to it.
[ "Decorator", "for", "registering", "view", "functions", "and", "adding", "templates", "to", "it", "." ]
python
train
MaxHalford/prince
prince/svd.py
https://github.com/MaxHalford/prince/blob/714c9cdfc4d9f8823eabf550a23ad01fe87c50d7/prince/svd.py#L10-L35
def compute_svd(X, n_components, n_iter, random_state, engine): """Computes an SVD with k components.""" # Determine what SVD engine to use if engine == 'auto': engine = 'sklearn' # Compute the SVD if engine == 'fbpca': if FBPCA_INSTALLED: U, s, V = fbpca.pca(X, k=n_com...
[ "def", "compute_svd", "(", "X", ",", "n_components", ",", "n_iter", ",", "random_state", ",", "engine", ")", ":", "# Determine what SVD engine to use", "if", "engine", "==", "'auto'", ":", "engine", "=", "'sklearn'", "# Compute the SVD", "if", "engine", "==", "'...
Computes an SVD with k components.
[ "Computes", "an", "SVD", "with", "k", "components", "." ]
python
train
yograterol/zoort
zoort.py
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L760-L801
def backup_database(args): ''' Backup one database from CLI ''' username = args.get('<user>') password = args.get('<password>') database = args['<database>'] host = args.get('<host>') or '127.0.0.1' path = args.get('--path') or os.getcwd() s3 = args.get('--upload_s3') glacier = a...
[ "def", "backup_database", "(", "args", ")", ":", "username", "=", "args", ".", "get", "(", "'<user>'", ")", "password", "=", "args", ".", "get", "(", "'<password>'", ")", "database", "=", "args", "[", "'<database>'", "]", "host", "=", "args", ".", "get...
Backup one database from CLI
[ "Backup", "one", "database", "from", "CLI" ]
python
train
saltstack/salt
salt/spm/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/__init__.py#L1015-L1077
def _build(self, args): ''' Build a package ''' if len(args) < 2: raise SPMInvocationError('A path to a formula must be specified') self.abspath = args[1].rstrip('/') comps = self.abspath.split('/') self.relpath = comps[-1] formula_path = '{0...
[ "def", "_build", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "<", "2", ":", "raise", "SPMInvocationError", "(", "'A path to a formula must be specified'", ")", "self", ".", "abspath", "=", "args", "[", "1", "]", ".", "rstrip", "(",...
Build a package
[ "Build", "a", "package" ]
python
train
gccxml/pygccxml
pygccxml/parser/directory_cache.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L466-L484
def acquire_filename(self, name): """Acquire a file name and return its id and its signature. """ id_ = self.__id_lut.get(name) # Is this a new entry? if id_ is None: # then create one... id_ = self.__next_id self.__next_id += 1 se...
[ "def", "acquire_filename", "(", "self", ",", "name", ")", ":", "id_", "=", "self", ".", "__id_lut", ".", "get", "(", "name", ")", "# Is this a new entry?", "if", "id_", "is", "None", ":", "# then create one...", "id_", "=", "self", ".", "__next_id", "self"...
Acquire a file name and return its id and its signature.
[ "Acquire", "a", "file", "name", "and", "return", "its", "id", "and", "its", "signature", "." ]
python
train
theonion/influxer
influxer/wsgi.py
https://github.com/theonion/influxer/blob/bdc6e4770d1e37c21a785881c9c50f4c767b34cc/influxer/wsgi.py#L502-L569
def trending(params): """gets trending content values """ # get params try: series = params.get("site", [DEFAULT_SERIES])[0] offset = params.get("offset", [DEFAULT_GROUP_BY])[0] limit = params.get("limit", [20])[0] except Exception as e: LOGGER.exception(e) re...
[ "def", "trending", "(", "params", ")", ":", "# get params", "try", ":", "series", "=", "params", ".", "get", "(", "\"site\"", ",", "[", "DEFAULT_SERIES", "]", ")", "[", "0", "]", "offset", "=", "params", ".", "get", "(", "\"offset\"", ",", "[", "DEFA...
gets trending content values
[ "gets", "trending", "content", "values" ]
python
train
pycontribs/pyrax
pyrax/clouddns.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddns.py#L228-L234
def update_record(self, record, data=None, priority=None, ttl=None, comment=None): """ Modifies an existing record for this domain. """ return self.manager.update_record(self, record, data=data, priority=priority, ttl=ttl, comment=comment)
[ "def", "update_record", "(", "self", ",", "record", ",", "data", "=", "None", ",", "priority", "=", "None", ",", "ttl", "=", "None", ",", "comment", "=", "None", ")", ":", "return", "self", ".", "manager", ".", "update_record", "(", "self", ",", "rec...
Modifies an existing record for this domain.
[ "Modifies", "an", "existing", "record", "for", "this", "domain", "." ]
python
train
saltstack/salt
salt/proxy/panos.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L442-L453
def grains(): ''' Get the grains from the proxied device ''' if not DETAILS.get('grains_cache', {}): DETAILS['grains_cache'] = GRAINS_CACHE try: query = {'type': 'op', 'cmd': '<show><system><info></info></system></show>'} DETAILS['grains_cache'] = call(query)['res...
[ "def", "grains", "(", ")", ":", "if", "not", "DETAILS", ".", "get", "(", "'grains_cache'", ",", "{", "}", ")", ":", "DETAILS", "[", "'grains_cache'", "]", "=", "GRAINS_CACHE", "try", ":", "query", "=", "{", "'type'", ":", "'op'", ",", "'cmd'", ":", ...
Get the grains from the proxied device
[ "Get", "the", "grains", "from", "the", "proxied", "device" ]
python
train
Calysto/calysto
calysto/ai/conx.py
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L4304-L4309
def loadWeightsFromFile(self, filename, mode='pickle'): """ Deprecated. Use loadWeights instead. """ Network.loadWeights(self, filename, mode) self.updateGraphics()
[ "def", "loadWeightsFromFile", "(", "self", ",", "filename", ",", "mode", "=", "'pickle'", ")", ":", "Network", ".", "loadWeights", "(", "self", ",", "filename", ",", "mode", ")", "self", ".", "updateGraphics", "(", ")" ]
Deprecated. Use loadWeights instead.
[ "Deprecated", ".", "Use", "loadWeights", "instead", "." ]
python
train
hyperledger/indy-node
indy_node/server/domain_req_handler.py
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_node/server/domain_req_handler.py#L784-L796
def _addAttr(self, txn, isCommitted=False) -> None: """ The state trie stores the hash of the whole attribute data at: the did+attribute name if the data is plaintext (RAW) the did+hash(attribute) if the data is encrypted (ENC) If the attribute is HASH, then nothing is st...
[ "def", "_addAttr", "(", "self", ",", "txn", ",", "isCommitted", "=", "False", ")", "->", "None", ":", "assert", "get_type", "(", "txn", ")", "==", "ATTRIB", "attr_type", ",", "path", ",", "value", ",", "hashed_value", ",", "value_bytes", "=", "domain", ...
The state trie stores the hash of the whole attribute data at: the did+attribute name if the data is plaintext (RAW) the did+hash(attribute) if the data is encrypted (ENC) If the attribute is HASH, then nothing is stored in attribute store, the trie stores a blank value for the k...
[ "The", "state", "trie", "stores", "the", "hash", "of", "the", "whole", "attribute", "data", "at", ":", "the", "did", "+", "attribute", "name", "if", "the", "data", "is", "plaintext", "(", "RAW", ")", "the", "did", "+", "hash", "(", "attribute", ")", ...
python
train
tchellomello/python-arlo
pyarlo/base_station.py
https://github.com/tchellomello/python-arlo/blob/db70aeb81705309c56ad32bbab1094f6cd146524/pyarlo/base_station.py#L55-L90
def thread_function(self): """Thread function.""" self.__subscribed = True url = SUBSCRIBE_ENDPOINT + "?token=" + self._session_token data = self._session.query(url, method='GET', raw=True, stream=True) if not data or not data.ok: _LOGGER.debug("Did not receive a va...
[ "def", "thread_function", "(", "self", ")", ":", "self", ".", "__subscribed", "=", "True", "url", "=", "SUBSCRIBE_ENDPOINT", "+", "\"?token=\"", "+", "self", ".", "_session_token", "data", "=", "self", ".", "_session", ".", "query", "(", "url", ",", "metho...
Thread function.
[ "Thread", "function", "." ]
python
train
pelotoncycle/cycle_detector
cycle_detector.py
https://github.com/pelotoncycle/cycle_detector/blob/a7c1a2e321e232de10f5862f6042471a3c60beb9/cycle_detector.py#L256-L311
def brent(seqs, f=None, start=None, key=lambda x: x): """Brent's Cycle Detector. See help(cycle_detector) for more context. Args: *args: Two iterators issueing the exact same sequence: -or- f, start: Function and starting state for finite state machine Yields: Values yielde...
[ "def", "brent", "(", "seqs", ",", "f", "=", "None", ",", "start", "=", "None", ",", "key", "=", "lambda", "x", ":", "x", ")", ":", "power", "=", "period", "=", "1", "tortise", ",", "hare", "=", "seqs", "yield", "hare", ".", "next", "(", ")", ...
Brent's Cycle Detector. See help(cycle_detector) for more context. Args: *args: Two iterators issueing the exact same sequence: -or- f, start: Function and starting state for finite state machine Yields: Values yielded by sequence_a if it terminates, undefined if a cycle ...
[ "Brent", "s", "Cycle", "Detector", "." ]
python
test
biolink/ontobio
ontobio/sim/annotation_scorer.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/sim/annotation_scorer.py#L106-L116
def _get_scaled_score( simple_score: float, categorical_score: float, category_weight: Optional[float] = .5) -> float: """ Scaled score is the weighted average of the simple score and categorical score """ return np.average( [simple...
[ "def", "_get_scaled_score", "(", "simple_score", ":", "float", ",", "categorical_score", ":", "float", ",", "category_weight", ":", "Optional", "[", "float", "]", "=", ".5", ")", "->", "float", ":", "return", "np", ".", "average", "(", "[", "simple_score", ...
Scaled score is the weighted average of the simple score and categorical score
[ "Scaled", "score", "is", "the", "weighted", "average", "of", "the", "simple", "score", "and", "categorical", "score" ]
python
train
vinci1it2000/schedula
examples/processing_chain/process.py
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/process.py#L51-L65
def save_outputs(outputs, output_fpath): """ Save model outputs in an Excel file. :param outputs: Model outputs. :type outputs: dict :param output_fpath: Output file path. :type output_fpath: str """ df = pd.DataFrame(outputs) with pd.ExcelWriter(output_fpath) as wr...
[ "def", "save_outputs", "(", "outputs", ",", "output_fpath", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", "outputs", ")", "with", "pd", ".", "ExcelWriter", "(", "output_fpath", ")", "as", "writer", ":", "df", ".", "to_excel", "(", "writer", ")" ]
Save model outputs in an Excel file. :param outputs: Model outputs. :type outputs: dict :param output_fpath: Output file path. :type output_fpath: str
[ "Save", "model", "outputs", "in", "an", "Excel", "file", "." ]
python
train
aloetesting/aloe_webdriver
aloe_webdriver/__init__.py
https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L706-L713
def assert_radio_selected(self, value): """ Assert the radio button with the given label (recommended), name or id is chosen. """ radio = find_field(world.browser, 'radio', value) assert radio, "Cannot find a '{}' radio button.".format(value) assert radio.is_selected(), "Radio button should ...
[ "def", "assert_radio_selected", "(", "self", ",", "value", ")", ":", "radio", "=", "find_field", "(", "world", ".", "browser", ",", "'radio'", ",", "value", ")", "assert", "radio", ",", "\"Cannot find a '{}' radio button.\"", ".", "format", "(", "value", ")", ...
Assert the radio button with the given label (recommended), name or id is chosen.
[ "Assert", "the", "radio", "button", "with", "the", "given", "label", "(", "recommended", ")", "name", "or", "id", "is", "chosen", "." ]
python
train
SuLab/WikidataIntegrator
wikidataintegrator/wdi_core.py
https://github.com/SuLab/WikidataIntegrator/blob/8ceb2ed1c08fec070ec9edfcf7db7b8691481b62/wikidataintegrator/wdi_core.py#L818-L829
def get_description(self, lang='en'): """ Retrieve the description in a certain language :param lang: The Wikidata language the description should be retrieved for :return: Returns the description string """ if self.fast_run: return list(self.fast_run_containe...
[ "def", "get_description", "(", "self", ",", "lang", "=", "'en'", ")", ":", "if", "self", ".", "fast_run", ":", "return", "list", "(", "self", ".", "fast_run_container", ".", "get_language_data", "(", "self", ".", "wd_item_id", ",", "lang", ",", "'descripti...
Retrieve the description in a certain language :param lang: The Wikidata language the description should be retrieved for :return: Returns the description string
[ "Retrieve", "the", "description", "in", "a", "certain", "language", ":", "param", "lang", ":", "The", "Wikidata", "language", "the", "description", "should", "be", "retrieved", "for", ":", "return", ":", "Returns", "the", "description", "string" ]
python
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L247-L265
def _try_reconnect(self): """Try to recover an interrupted connection.""" try: if self.connection_interrupted: self.connect_direct(self.connection_string, force=True) self.connection_interrupted = False self.connected = True #...
[ "def", "_try_reconnect", "(", "self", ")", ":", "try", ":", "if", "self", ".", "connection_interrupted", ":", "self", ".", "connect_direct", "(", "self", ".", "connection_string", ",", "force", "=", "True", ")", "self", ".", "connection_interrupted", "=", "F...
Try to recover an interrupted connection.
[ "Try", "to", "recover", "an", "interrupted", "connection", "." ]
python
train
CivicSpleen/ambry
ambry/bundle/bundle.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2736-L2739
def is_finalized(self): """Return True if the bundle is installed.""" return self.state == self.STATES.FINALIZED or self.state == self.STATES.INSTALLED
[ "def", "is_finalized", "(", "self", ")", ":", "return", "self", ".", "state", "==", "self", ".", "STATES", ".", "FINALIZED", "or", "self", ".", "state", "==", "self", ".", "STATES", ".", "INSTALLED" ]
Return True if the bundle is installed.
[ "Return", "True", "if", "the", "bundle", "is", "installed", "." ]
python
train
gkbrk/hackchat
hackchat.py
https://github.com/gkbrk/hackchat/blob/f8c96dc1ce528ba7800130e43848127f0db3e057/hackchat.py#L38-L41
def _send_packet(self, packet): """Sends <packet> (<dict>) to https://hack.chat.""" encoded = json.dumps(packet) self.ws.send(encoded)
[ "def", "_send_packet", "(", "self", ",", "packet", ")", ":", "encoded", "=", "json", ".", "dumps", "(", "packet", ")", "self", ".", "ws", ".", "send", "(", "encoded", ")" ]
Sends <packet> (<dict>) to https://hack.chat.
[ "Sends", "<packet", ">", "(", "<dict", ">", ")", "to", "https", ":", "//", "hack", ".", "chat", "." ]
python
train
MycroftAI/mycroft-precise
precise/scripts/train_generated.py
https://github.com/MycroftAI/mycroft-precise/blob/e17cebdd171906dbd8a16e282d8a7966fba2eeba/precise/scripts/train_generated.py#L131-L141
def chunk_audio_pieces(self, pieces, chunk_size): """Convert chunks of audio into a series of equally sized pieces""" left_over = np.array([]) for piece in pieces: if left_over.size == 0: combined = piece else: combined = np.concatenate([le...
[ "def", "chunk_audio_pieces", "(", "self", ",", "pieces", ",", "chunk_size", ")", ":", "left_over", "=", "np", ".", "array", "(", "[", "]", ")", "for", "piece", "in", "pieces", ":", "if", "left_over", ".", "size", "==", "0", ":", "combined", "=", "pie...
Convert chunks of audio into a series of equally sized pieces
[ "Convert", "chunks", "of", "audio", "into", "a", "series", "of", "equally", "sized", "pieces" ]
python
train
rfverbruggen/rachiopy
rachiopy/zone.py
https://github.com/rfverbruggen/rachiopy/blob/c91abc9984f0f453e60fa905285c1b640c3390ae/rachiopy/zone.py#L11-L15
def start(self, zone_id, duration): """Start a zone.""" path = 'zone/start' payload = {'id': zone_id, 'duration': duration} return self.rachio.put(path, payload)
[ "def", "start", "(", "self", ",", "zone_id", ",", "duration", ")", ":", "path", "=", "'zone/start'", "payload", "=", "{", "'id'", ":", "zone_id", ",", "'duration'", ":", "duration", "}", "return", "self", ".", "rachio", ".", "put", "(", "path", ",", ...
Start a zone.
[ "Start", "a", "zone", "." ]
python
train
mapillary/mapillary_tools
mapillary_tools/exif_read.py
https://github.com/mapillary/mapillary_tools/blob/816785e90c589cae6e8e34a5530ce8417d29591c/mapillary_tools/exif_read.py#L20-L39
def format_time(time_string): ''' Format time string with invalid time elements in hours/minutes/seconds Format for the timestring needs to be "%Y_%m_%d_%H_%M_%S" e.g. 2014_03_31_24_10_11 => 2014_04_01_00_10_11 ''' subseconds = False data = time_string.split("_") hours, minutes, seconds...
[ "def", "format_time", "(", "time_string", ")", ":", "subseconds", "=", "False", "data", "=", "time_string", ".", "split", "(", "\"_\"", ")", "hours", ",", "minutes", ",", "seconds", "=", "int", "(", "data", "[", "3", "]", ")", ",", "int", "(", "data"...
Format time string with invalid time elements in hours/minutes/seconds Format for the timestring needs to be "%Y_%m_%d_%H_%M_%S" e.g. 2014_03_31_24_10_11 => 2014_04_01_00_10_11
[ "Format", "time", "string", "with", "invalid", "time", "elements", "in", "hours", "/", "minutes", "/", "seconds", "Format", "for", "the", "timestring", "needs", "to", "be", "%Y_%m_%d_%H_%M_%S" ]
python
train
dmwm/DBS
Server/Python/src/dbs/business/DBSOutputConfig.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSOutputConfig.py#L55-L107
def insertOutputConfig(self, businput): """ Method to insert the Output Config. app_name, release_version, pset_hash, global_tag and output_module_label are required. args: businput(dic): input dictionary. Updated Oct 12, 2011 """ if not ...
[ "def", "insertOutputConfig", "(", "self", ",", "businput", ")", ":", "if", "not", "(", "\"app_name\"", "in", "businput", "and", "\"release_version\"", "in", "businput", "and", "\"pset_hash\"", "in", "businput", "and", "\"output_module_label\"", "in", "businput", "...
Method to insert the Output Config. app_name, release_version, pset_hash, global_tag and output_module_label are required. args: businput(dic): input dictionary. Updated Oct 12, 2011
[ "Method", "to", "insert", "the", "Output", "Config", ".", "app_name", "release_version", "pset_hash", "global_tag", "and", "output_module_label", "are", "required", ".", "args", ":", "businput", "(", "dic", ")", ":", "input", "dictionary", "." ]
python
train
MisterY/gnucash-portfolio
gnucash_portfolio/splitsaggregate.py
https://github.com/MisterY/gnucash-portfolio/blob/bfaad8345a5479d1cd111acee1939e25c2a638c2/gnucash_portfolio/splitsaggregate.py#L39-L47
def get_for_accounts(self, accounts: List[Account]): ''' Get all splits for the given accounts ''' account_ids = [acc.guid for acc in accounts] query = ( self.query .filter(Split.account_guid.in_(account_ids)) ) splits = query.all() return splits
[ "def", "get_for_accounts", "(", "self", ",", "accounts", ":", "List", "[", "Account", "]", ")", ":", "account_ids", "=", "[", "acc", ".", "guid", "for", "acc", "in", "accounts", "]", "query", "=", "(", "self", ".", "query", ".", "filter", "(", "Split...
Get all splits for the given accounts
[ "Get", "all", "splits", "for", "the", "given", "accounts" ]
python
train
consbio/parserutils
parserutils/collections.py
https://github.com/consbio/parserutils/blob/f13f80db99ed43479336b116e38512e3566e4623/parserutils/collections.py#L228-L245
def reduce_value(value, default=EMPTY_STR): """ :return: a single value from lists, tuples or sets with one item; otherwise, the value itself if not empty or the default if it is. """ if hasattr(value, '__len__'): vlen = len(value) if vlen == 0: return default e...
[ "def", "reduce_value", "(", "value", ",", "default", "=", "EMPTY_STR", ")", ":", "if", "hasattr", "(", "value", ",", "'__len__'", ")", ":", "vlen", "=", "len", "(", "value", ")", "if", "vlen", "==", "0", ":", "return", "default", "elif", "vlen", "=="...
:return: a single value from lists, tuples or sets with one item; otherwise, the value itself if not empty or the default if it is.
[ ":", "return", ":", "a", "single", "value", "from", "lists", "tuples", "or", "sets", "with", "one", "item", ";", "otherwise", "the", "value", "itself", "if", "not", "empty", "or", "the", "default", "if", "it", "is", "." ]
python
train
OrangeTux/einder
einder/client.py
https://github.com/OrangeTux/einder/blob/deb2c5f79a69b684257fe939659c3bd751556fd5/einder/client.py#L114-L118
def power_on(self): """ Power on the set-top box. """ if not self.is_powered_on(): log.debug('Powering on set-top box at %s:%s.', self.ip, self.port) self.send_key(keys.POWER)
[ "def", "power_on", "(", "self", ")", ":", "if", "not", "self", ".", "is_powered_on", "(", ")", ":", "log", ".", "debug", "(", "'Powering on set-top box at %s:%s.'", ",", "self", ".", "ip", ",", "self", ".", "port", ")", "self", ".", "send_key", "(", "k...
Power on the set-top box.
[ "Power", "on", "the", "set", "-", "top", "box", "." ]
python
train
pandas-dev/pandas
pandas/util/_exceptions.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/util/_exceptions.py#L5-L16
def rewrite_exception(old_name, new_name): """Rewrite the message of an exception.""" try: yield except Exception as e: msg = e.args[0] msg = msg.replace(old_name, new_name) args = (msg,) if len(e.args) > 1: args = args + e.args[1:] e.args = args ...
[ "def", "rewrite_exception", "(", "old_name", ",", "new_name", ")", ":", "try", ":", "yield", "except", "Exception", "as", "e", ":", "msg", "=", "e", ".", "args", "[", "0", "]", "msg", "=", "msg", ".", "replace", "(", "old_name", ",", "new_name", ")",...
Rewrite the message of an exception.
[ "Rewrite", "the", "message", "of", "an", "exception", "." ]
python
train
inveniosoftware-attic/invenio-utils
invenio_utils/html.py
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/html.py#L661-L678
def remove_html_markup(text, replacechar=' ', remove_escaped_chars_p=True): """ Remove HTML markup from text. @param text: Input text. @type text: string. @param replacechar: By which character should we replace HTML markup. Usually, a single space or an empty string are nice values. @t...
[ "def", "remove_html_markup", "(", "text", ",", "replacechar", "=", "' '", ",", "remove_escaped_chars_p", "=", "True", ")", ":", "if", "not", "remove_escaped_chars_p", ":", "return", "RE_HTML_WITHOUT_ESCAPED_CHARS", ".", "sub", "(", "replacechar", ",", "text", ")",...
Remove HTML markup from text. @param text: Input text. @type text: string. @param replacechar: By which character should we replace HTML markup. Usually, a single space or an empty string are nice values. @type replacechar: string @param remove_escaped_chars_p: If True, also remove escaped ...
[ "Remove", "HTML", "markup", "from", "text", "." ]
python
train
michaelaye/pyciss
pyciss/opusapi.py
https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L184-L196
def create_request_with_query(self, kind, query, size="thumb", fmt="json"): """api/data.[fmt], api/images/[size].[fmt] api/files.[fmt] kind = ['data', 'images', 'files'] """ if kind == "data" or kind == "files": url = "{}/{}.{}".format(base_url, kind, fmt) elif kin...
[ "def", "create_request_with_query", "(", "self", ",", "kind", ",", "query", ",", "size", "=", "\"thumb\"", ",", "fmt", "=", "\"json\"", ")", ":", "if", "kind", "==", "\"data\"", "or", "kind", "==", "\"files\"", ":", "url", "=", "\"{}/{}.{}\"", ".", "form...
api/data.[fmt], api/images/[size].[fmt] api/files.[fmt] kind = ['data', 'images', 'files']
[ "api", "/", "data", ".", "[", "fmt", "]", "api", "/", "images", "/", "[", "size", "]", ".", "[", "fmt", "]", "api", "/", "files", ".", "[", "fmt", "]" ]
python
train
ContextLab/hypertools
hypertools/_shared/params.py
https://github.com/ContextLab/hypertools/blob/b76c7ac8061998b560e969ff8e4f4c915088e7a0/hypertools/_shared/params.py#L18-L48
def default_params(model, update_dict=None): """ Loads and updates default model parameters Parameters ---------- model : str The name of a model update_dict : dict A dict to update default parameters Returns ---------- params : dict A dictionary of param...
[ "def", "default_params", "(", "model", ",", "update_dict", "=", "None", ")", ":", "if", "model", "in", "parameters", ":", "params", "=", "parameters", "[", "model", "]", ".", "copy", "(", ")", "else", ":", "params", "=", "None", "if", "update_dict", ":...
Loads and updates default model parameters Parameters ---------- model : str The name of a model update_dict : dict A dict to update default parameters Returns ---------- params : dict A dictionary of parameters
[ "Loads", "and", "updates", "default", "model", "parameters" ]
python
train
sbg/sevenbridges-python
sevenbridges/models/file.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/file.py#L491-L507
def list_files(self, offset=None, limit=None, api=None): """List files in a folder :param api: Api instance :param offset: Pagination offset :param limit: Pagination limit :return: List of files """ api = api or self._API if not self.is_folder(): ...
[ "def", "list_files", "(", "self", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "api", "=", "None", ")", ":", "api", "=", "api", "or", "self", ".", "_API", "if", "not", "self", ".", "is_folder", "(", ")", ":", "raise", "SbgError", "...
List files in a folder :param api: Api instance :param offset: Pagination offset :param limit: Pagination limit :return: List of files
[ "List", "files", "in", "a", "folder", ":", "param", "api", ":", "Api", "instance", ":", "param", "offset", ":", "Pagination", "offset", ":", "param", "limit", ":", "Pagination", "limit", ":", "return", ":", "List", "of", "files" ]
python
train
drhagen/parsita
parsita/parsers.py
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L451-L463
def rep1(parser: Union[Parser, Sequence[Input]]) -> RepeatedOnceParser: """Match a parser one or more times repeatedly. This matches ``parser`` multiple times in a row. If it matches as least once, it returns a list of values from each time ``parser`` matched. If it does not match ``parser`` at all, it...
[ "def", "rep1", "(", "parser", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ")", "->", "RepeatedOnceParser", ":", "if", "isinstance", "(", "parser", ",", "str", ")", ":", "parser", "=", "lit", "(", "parser", ")", "return", "Re...
Match a parser one or more times repeatedly. This matches ``parser`` multiple times in a row. If it matches as least once, it returns a list of values from each time ``parser`` matched. If it does not match ``parser`` at all, it fails. Args: parser: Parser or literal
[ "Match", "a", "parser", "one", "or", "more", "times", "repeatedly", "." ]
python
test
madprime/cgivar2gvcf
cgivar2gvcf/__init__.py
https://github.com/madprime/cgivar2gvcf/blob/13b4cd8da08669f7e4b0ceed77a7a17082f91037/cgivar2gvcf/__init__.py#L473-L522
def from_command_line(): """ Run CGI var to gVCF conversion from the command line. """ # Parse options parser = argparse.ArgumentParser( description='Convert Complete Genomics var files to gVCF format.') parser.add_argument( '-d', '--refseqdir', metavar='REFSEQDIR', required=True...
[ "def", "from_command_line", "(", ")", ":", "# Parse options", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Convert Complete Genomics var files to gVCF format.'", ")", "parser", ".", "add_argument", "(", "'-d'", ",", "'--refseqdir'", ",", ...
Run CGI var to gVCF conversion from the command line.
[ "Run", "CGI", "var", "to", "gVCF", "conversion", "from", "the", "command", "line", "." ]
python
train
openpermissions/perch
perch/migrations/user_22e76f4ff8bd41e19aa52839fc8f13a1.py
https://github.com/openpermissions/perch/blob/36d78994133918f3c52c187f19e50132960a0156/perch/migrations/user_22e76f4ff8bd41e19aa52839fc8f13a1.py#L10-L23
def migrate_user(instance): """ Move User.organisations['global']['role'] to top-level property and remove verified flag """ instance._resource.pop('verified', None) if 'role' in instance._resource: return instance global_org = instance.organisations.pop('global', {}) instance....
[ "def", "migrate_user", "(", "instance", ")", ":", "instance", ".", "_resource", ".", "pop", "(", "'verified'", ",", "None", ")", "if", "'role'", "in", "instance", ".", "_resource", ":", "return", "instance", "global_org", "=", "instance", ".", "organisations...
Move User.organisations['global']['role'] to top-level property and remove verified flag
[ "Move", "User", ".", "organisations", "[", "global", "]", "[", "role", "]", "to", "top", "-", "level", "property", "and", "remove", "verified", "flag" ]
python
train
ioos/compliance-checker
compliance_checker/cf/cf.py
https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L850-L871
def check_convention_globals(self, ds): ''' Check the common global attributes are strings if they exist. CF §2.6.2 title/history global attributes, must be strings. Do not need to exist. :param netCDF4.Dataset ds: An open netCDF dataset :rtype: list :return: Li...
[ "def", "check_convention_globals", "(", "self", ",", "ds", ")", ":", "attrs", "=", "[", "'title'", ",", "'history'", "]", "valid_globals", "=", "TestCtx", "(", "BaseCheck", ".", "MEDIUM", ",", "self", ".", "section_titles", "[", "'2.6'", "]", ")", "for", ...
Check the common global attributes are strings if they exist. CF §2.6.2 title/history global attributes, must be strings. Do not need to exist. :param netCDF4.Dataset ds: An open netCDF dataset :rtype: list :return: List of Results
[ "Check", "the", "common", "global", "attributes", "are", "strings", "if", "they", "exist", "." ]
python
train
theno/fabsetup
fabsetup/fabfile/setup/__init__.py
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L92-L117
def solarized(): '''Set solarized colors in urxvt, tmux, and vim. More Infos: * Getting solarized colors right with urxvt, st, tmux and vim: https://bbs.archlinux.org/viewtopic.php?id=164108 * Creating ~/.Xresources: https://wiki.archlinux.org/index.php/Rxvt-unicode#Creating_.7E.2F.Xresour...
[ "def", "solarized", "(", ")", ":", "install_packages", "(", "[", "'rxvt-unicode'", ",", "'tmux'", ",", "'vim'", "]", ")", "install_file_legacy", "(", "'~/.Xresources'", ")", "if", "env", ".", "host_string", "==", "'localhost'", ":", "run", "(", "'xrdb ~/.Xres...
Set solarized colors in urxvt, tmux, and vim. More Infos: * Getting solarized colors right with urxvt, st, tmux and vim: https://bbs.archlinux.org/viewtopic.php?id=164108 * Creating ~/.Xresources: https://wiki.archlinux.org/index.php/Rxvt-unicode#Creating_.7E.2F.Xresources * Select a good...
[ "Set", "solarized", "colors", "in", "urxvt", "tmux", "and", "vim", "." ]
python
train
gpennington/PyMarvel
marvel/story.py
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/story.py#L91-L100
def get_creators(self, *args, **kwargs): """ Returns a full CreatorDataWrapper object for this story. /stories/{storyId}/creators :returns: CreatorDataWrapper -- A new request to API. Contains full results set. """ from .creator import Creator, CreatorDataWrapper ...
[ "def", "get_creators", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "creator", "import", "Creator", ",", "CreatorDataWrapper", "return", "self", ".", "get_related_resource", "(", "Creator", ",", "CreatorDataWrapper", ",", "a...
Returns a full CreatorDataWrapper object for this story. /stories/{storyId}/creators :returns: CreatorDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "CreatorDataWrapper", "object", "for", "this", "story", "." ]
python
train
pjuren/pyokit
src/pyokit/io/fastaIterators.py
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/fastaIterators.py#L148-L186
def fastaIterator(fn, useMutableString=False, verbose=False): """ A generator function which yields fastaSequence objects from a fasta-format file or stream. :param fn: a file-like stream or a string; if this is a string, it's treated as a filename, else it's treated it as a file-like ...
[ "def", "fastaIterator", "(", "fn", ",", "useMutableString", "=", "False", ",", "verbose", "=", "False", ")", ":", "fh", "=", "fn", "if", "type", "(", "fh", ")", ".", "__name__", "==", "\"str\"", ":", "fh", "=", "open", "(", "fh", ")", "if", "verbos...
A generator function which yields fastaSequence objects from a fasta-format file or stream. :param fn: a file-like stream or a string; if this is a string, it's treated as a filename, else it's treated it as a file-like object, which must have a readline() method. :param useMu...
[ "A", "generator", "function", "which", "yields", "fastaSequence", "objects", "from", "a", "fasta", "-", "format", "file", "or", "stream", "." ]
python
train
boundary/pulse-api-cli
boundary/hostgroup_update.py
https://github.com/boundary/pulse-api-cli/blob/b01ca65b442eed19faac309c9d62bbc3cb2c098f/boundary/hostgroup_update.py#L38-L47
def get_arguments(self): """ Extracts the specific arguments of this CLI """ HostgroupModify.get_arguments(self) if self.args.host_group_id is not None: self.host_group_id = self.args.host_group_id self.path = "v1/hostgroup/" + str(self.host_group_id)
[ "def", "get_arguments", "(", "self", ")", ":", "HostgroupModify", ".", "get_arguments", "(", "self", ")", "if", "self", ".", "args", ".", "host_group_id", "is", "not", "None", ":", "self", ".", "host_group_id", "=", "self", ".", "args", ".", "host_group_id...
Extracts the specific arguments of this CLI
[ "Extracts", "the", "specific", "arguments", "of", "this", "CLI" ]
python
test
nschloe/matplotlib2tikz
matplotlib2tikz/save.py
https://github.com/nschloe/matplotlib2tikz/blob/ac5daca6f38b834d757f6c6ae6cc34121956f46b/matplotlib2tikz/save.py#L322-L327
def extend(self, content, zorder): """ Extends with a list and a z-order """ if zorder not in self._content: self._content[zorder] = [] self._content[zorder].extend(content)
[ "def", "extend", "(", "self", ",", "content", ",", "zorder", ")", ":", "if", "zorder", "not", "in", "self", ".", "_content", ":", "self", ".", "_content", "[", "zorder", "]", "=", "[", "]", "self", ".", "_content", "[", "zorder", "]", ".", "extend"...
Extends with a list and a z-order
[ "Extends", "with", "a", "list", "and", "a", "z", "-", "order" ]
python
train
RJT1990/pyflux
pyflux/ssm/ndynlin.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/ssm/ndynlin.py#L151-L169
def state_likelihood(self, beta, alpha): """ Returns likelihood of the states given the variance latent variables Parameters ---------- beta : np.array Contains untransformed starting values for latent variables alpha : np.array State matrix ...
[ "def", "state_likelihood", "(", "self", ",", "beta", ",", "alpha", ")", ":", "_", ",", "_", ",", "_", ",", "Q", "=", "self", ".", "_ss_matrices", "(", "beta", ")", "state_lik", "=", "0", "for", "i", "in", "range", "(", "alpha", ".", "shape", "[",...
Returns likelihood of the states given the variance latent variables Parameters ---------- beta : np.array Contains untransformed starting values for latent variables alpha : np.array State matrix Returns ---------- State likeliho...
[ "Returns", "likelihood", "of", "the", "states", "given", "the", "variance", "latent", "variables" ]
python
train
dstufft/crust
crust/query.py
https://github.com/dstufft/crust/blob/5d4011ecace12fd3f68a03a17dbefb78390a9fc0/crust/query.py#L501-L511
def _fill_cache(self, num=None): """ Fills the result cache with 'num' more entries (or until the results iterator is exhausted). """ if self._iter: try: for i in range(num or ITER_CHUNK_SIZE): self._result_cache.append(next(self._i...
[ "def", "_fill_cache", "(", "self", ",", "num", "=", "None", ")", ":", "if", "self", ".", "_iter", ":", "try", ":", "for", "i", "in", "range", "(", "num", "or", "ITER_CHUNK_SIZE", ")", ":", "self", ".", "_result_cache", ".", "append", "(", "next", "...
Fills the result cache with 'num' more entries (or until the results iterator is exhausted).
[ "Fills", "the", "result", "cache", "with", "num", "more", "entries", "(", "or", "until", "the", "results", "iterator", "is", "exhausted", ")", "." ]
python
train