nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
guoday/CCF-BDCI-Sentiment-Analysis-Baseline
842d1d944a55e4096429173bc63ac2fba0957a39
pytorch_transformers/modeling_xlm.py
python
XLMConfig.__init__
(self, vocab_size_or_config_json_file=30145, emb_dim=2048, n_layers=12, n_heads=16, dropout=0.1, attention_dropout=0.1, gelu_activation=True, sinusoidal_embeddings=False, ...
Constructs XLMConfig.
Constructs XLMConfig.
[ "Constructs", "XLMConfig", "." ]
def __init__(self, vocab_size_or_config_json_file=30145, emb_dim=2048, n_layers=12, n_heads=16, dropout=0.1, attention_dropout=0.1, gelu_activation=True, sinusoidal_embeddings=False, ...
[ "def", "__init__", "(", "self", ",", "vocab_size_or_config_json_file", "=", "30145", ",", "emb_dim", "=", "2048", ",", "n_layers", "=", "12", ",", "n_heads", "=", "16", ",", "dropout", "=", "0.1", ",", "attention_dropout", "=", "0.1", ",", "gelu_activation",...
https://github.com/guoday/CCF-BDCI-Sentiment-Analysis-Baseline/blob/842d1d944a55e4096429173bc63ac2fba0957a39/pytorch_transformers/modeling_xlm.py#L105-L181
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/plot/plotcanvas.py
python
PlotCanvas.GetEnableGrid
(self)
return self.enableGrid
Get the enableGrid value. .. deprecated:: Feb 27, 2016 Use the :attr:`~wx.lib.plot.plotcanvas.PlotCanvas.enableGrid` property instead.
Get the enableGrid value.
[ "Get", "the", "enableGrid", "value", "." ]
def GetEnableGrid(self): """ Get the enableGrid value. .. deprecated:: Feb 27, 2016 Use the :attr:`~wx.lib.plot.plotcanvas.PlotCanvas.enableGrid` property instead. """ pendingDeprecation("self.enableGrid property") return self.enableGrid
[ "def", "GetEnableGrid", "(", "self", ")", ":", "pendingDeprecation", "(", "\"self.enableGrid property\"", ")", "return", "self", ".", "enableGrid" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/plot/plotcanvas.py#L970-L980
zalando/connexion
fc6803bc0021c8b9840558d9429bb4c272689ea4
connexion/security/aiohttp_security_handler_factory.py
python
AioHttpSecurityHandlerFactory.get_token_info_remote
(self, token_info_url)
return wrapper
Return a function which will call `token_info_url` to retrieve token info. Returned function must accept oauth token in parameter. It must return a token_info dict in case of success, None otherwise. :param token_info_url: Url to get information about the token :type token_info_url: st...
Return a function which will call `token_info_url` to retrieve token info.
[ "Return", "a", "function", "which", "will", "call", "token_info_url", "to", "retrieve", "token", "info", "." ]
def get_token_info_remote(self, token_info_url): """ Return a function which will call `token_info_url` to retrieve token info. Returned function must accept oauth token in parameter. It must return a token_info dict in case of success, None otherwise. :param token_info_url: Ur...
[ "def", "get_token_info_remote", "(", "self", ",", "token_info_url", ")", ":", "async", "def", "wrapper", "(", "token", ")", ":", "if", "not", "self", ".", "client_session", ":", "# Must be created in a coroutine", "self", ".", "client_session", "=", "aiohttp", "...
https://github.com/zalando/connexion/blob/fc6803bc0021c8b9840558d9429bb4c272689ea4/connexion/security/aiohttp_security_handler_factory.py#L19-L39
cleanlab/cleanlab
331349dd3c5641991952ae30215dd9d85828d6f8
cleanlab/polyplex.py
python
slope_intercept
(point1, point2)
return slope, intercept
Returns the slope and intercept between point1 and point2. Parameters ---------- point1 : tuple e.g. (1.3, 4) point2 : tuple Returns ------- A tuple(slope, intercept)
Returns the slope and intercept between point1 and point2.
[ "Returns", "the", "slope", "and", "intercept", "between", "point1", "and", "point2", "." ]
def slope_intercept(point1, point2): '''Returns the slope and intercept between point1 and point2. Parameters ---------- point1 : tuple e.g. (1.3, 4) point2 : tuple Returns ------- A tuple(slope, intercept)''' (x0, y0) = point1 (x1, y1) = point2 slope = (y1 - y0)...
[ "def", "slope_intercept", "(", "point1", ",", "point2", ")", ":", "(", "x0", ",", "y0", ")", "=", "point1", "(", "x1", ",", "y1", ")", "=", "point2", "slope", "=", "(", "y1", "-", "y0", ")", "/", "float", "(", "x1", "-", "x0", ")", "intercept",...
https://github.com/cleanlab/cleanlab/blob/331349dd3c5641991952ae30215dd9d85828d6f8/cleanlab/polyplex.py#L27-L45
mysql/mysql-connector-python
c5460bcbb0dff8e4e48bf4af7a971c89bf486d85
lib/mysqlx/statement.py
python
FilterableStatement.get_limit_offset
(self)
return self._limit_offset
Returns the limit offset. Returns: int: The limit offset.
Returns the limit offset.
[ "Returns", "the", "limit", "offset", "." ]
def get_limit_offset(self): """Returns the limit offset. Returns: int: The limit offset. """ return self._limit_offset
[ "def", "get_limit_offset", "(", "self", ")", ":", "return", "self", ".", "_limit_offset" ]
https://github.com/mysql/mysql-connector-python/blob/c5460bcbb0dff8e4e48bf4af7a971c89bf486d85/lib/mysqlx/statement.py#L411-L417
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
TensorFlow/Translation/GNMT/model.py
python
BaseModel.build_encoder_states
(self, include_embeddings=False)
return stack_state_list
Stack encoder states and return tensor [batch, length, layer, size].
Stack encoder states and return tensor [batch, length, layer, size].
[ "Stack", "encoder", "states", "and", "return", "tensor", "[", "batch", "length", "layer", "size", "]", "." ]
def build_encoder_states(self, include_embeddings=False): """Stack encoder states and return tensor [batch, length, layer, size].""" assert self.mode == tf.contrib.learn.ModeKeys.INFER if include_embeddings: stack_state_list = tf.stack( [self.encoder_emb_inp] + self.encoder_state_list, 2) ...
[ "def", "build_encoder_states", "(", "self", ",", "include_embeddings", "=", "False", ")", ":", "assert", "self", ".", "mode", "==", "tf", ".", "contrib", ".", "learn", ".", "ModeKeys", ".", "INFER", "if", "include_embeddings", ":", "stack_state_list", "=", "...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Translation/GNMT/model.py#L644-L657
jeetsukumaran/DendroPy
29fd294bf05d890ebf6a8d576c501e471db27ca1
src/dendropy/datamodel/treemodel.py
python
Node.child_nodes
(self)
return list(self._child_nodes)
Returns a shallow-copy list of all child nodes of this node. Note ---- Unless an actual ``list`` is needed, iterating over the child nodes using :meth:`Node.child_node_iter()` is preferable to avoid the overhead of list construction. Returns ------- :py:...
Returns a shallow-copy list of all child nodes of this node.
[ "Returns", "a", "shallow", "-", "copy", "list", "of", "all", "child", "nodes", "of", "this", "node", "." ]
def child_nodes(self): """ Returns a shallow-copy list of all child nodes of this node. Note ---- Unless an actual ``list`` is needed, iterating over the child nodes using :meth:`Node.child_node_iter()` is preferable to avoid the overhead of list construction. ...
[ "def", "child_nodes", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_child_nodes", ")" ]
https://github.com/jeetsukumaran/DendroPy/blob/29fd294bf05d890ebf6a8d576c501e471db27ca1/src/dendropy/datamodel/treemodel.py#L2084-L2099
scrapinghub/python-scrapinghub
34ecb803a8063e8606983fe8de968af2f7fc8f0f
scrapinghub/client/logs.py
python
Logs.debug
(self, message, **other)
Log a message with DEBUG level.
Log a message with DEBUG level.
[ "Log", "a", "message", "with", "DEBUG", "level", "." ]
def debug(self, message, **other): """Log a message with DEBUG level.""" self._origin.debug(message, **other)
[ "def", "debug", "(", "self", ",", "message", ",", "*", "*", "other", ")", ":", "self", ".", "_origin", ".", "debug", "(", "message", ",", "*", "*", "other", ")" ]
https://github.com/scrapinghub/python-scrapinghub/blob/34ecb803a8063e8606983fe8de968af2f7fc8f0f/scrapinghub/client/logs.py#L62-L64
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/setuptools/pkg_resources/__init__.py
python
IMetadataProvider.get_metadata_lines
(name)
Yield named metadata resource as list of non-blank non-comment lines Leading and trailing whitespace is stripped from each line, and lines with ``#`` as the first non-blank character are omitted.
Yield named metadata resource as list of non-blank non-comment lines
[ "Yield", "named", "metadata", "resource", "as", "list", "of", "non", "-", "blank", "non", "-", "comment", "lines" ]
def get_metadata_lines(name): """Yield named metadata resource as list of non-blank non-comment lines Leading and trailing whitespace is stripped from each line, and lines with ``#`` as the first non-blank character are omitted."""
[ "def", "get_metadata_lines", "(", "name", ")", ":" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/pkg_resources/__init__.py#L541-L545
wuzheng-sjtu/FastFPN
a60a618665b11481e95bd184073a2ac09febc9d4
libs/layers/roi.py
python
_unmap
(data, count, inds, fill=0)
return ret
Unmap a subset of item (data) back to the original set of items (of size count)
Unmap a subset of item (data) back to the original set of items (of size count)
[ "Unmap", "a", "subset", "of", "item", "(", "data", ")", "back", "to", "the", "original", "set", "of", "items", "(", "of", "size", "count", ")" ]
def _unmap(data, count, inds, fill=0): """ Unmap a subset of item (data) back to the original set of items (of size count) """ if len(data.shape) == 1: ret = np.empty((count,), dtype=np.float32) ret.fill(fill) ret[inds] = data else: ret = np.empty((count,) + data.shape[1:], dtype=np.float32) ...
[ "def", "_unmap", "(", "data", ",", "count", ",", "inds", ",", "fill", "=", "0", ")", ":", "if", "len", "(", "data", ".", "shape", ")", "==", "1", ":", "ret", "=", "np", ".", "empty", "(", "(", "count", ",", ")", ",", "dtype", "=", "np", "."...
https://github.com/wuzheng-sjtu/FastFPN/blob/a60a618665b11481e95bd184073a2ac09febc9d4/libs/layers/roi.py#L155-L166
cve-search/cve-search
222a230f4948733d2a8ed5c158140a81f2716e25
lib/LogHandler.py
python
HelperLogger.critical
(self, msg, *args, **kwargs)
return super(HelperLogger, self).critical(msg, *args, **kwargs)
Log ‘msg % args’ with severity ‘CRITICAL’ and color *RED*. Store logged message to the database for dashboard alerting. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.critical(“Houston, we have a %s”, “hell of a problem”, exc_info=1) :...
Log ‘msg % args’ with severity ‘CRITICAL’ and color *RED*.
[ "Log", "‘msg", "%", "args’", "with", "severity", "‘CRITICAL’", "and", "color", "*", "RED", "*", "." ]
def critical(self, msg, *args, **kwargs): """ Log ‘msg % args’ with severity ‘CRITICAL’ and color *RED*. Store logged message to the database for dashboard alerting. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.critical(“Houst...
[ "def", "critical", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "msg", "=", "colors", ".", "color", "(", "\"{}\"", ".", "format", "(", "msg", ")", ",", "fg", "=", "HelperLogger", ".", "level_map", "[", "\"critical\"...
https://github.com/cve-search/cve-search/blob/222a230f4948733d2a8ed5c158140a81f2716e25/lib/LogHandler.py#L142-L158
altair-viz/altair
fb9e82eb378f68bad7a10c639f95e9a3991ac18d
altair/vegalite/v4/display.py
python
vegalite
(spec, validate=True)
Render and optionally validate a VegaLite 4 spec. This will use the currently enabled renderer to render the spec. Parameters ========== spec: dict A fully compliant VegaLite 4 spec, with the data portion fully processed. validate: bool Should the spec be validated against the Vega...
Render and optionally validate a VegaLite 4 spec.
[ "Render", "and", "optionally", "validate", "a", "VegaLite", "4", "spec", "." ]
def vegalite(spec, validate=True): """Render and optionally validate a VegaLite 4 spec. This will use the currently enabled renderer to render the spec. Parameters ========== spec: dict A fully compliant VegaLite 4 spec, with the data portion fully processed. validate: bool Sho...
[ "def", "vegalite", "(", "spec", ",", "validate", "=", "True", ")", ":", "from", "IPython", ".", "display", "import", "display", "display", "(", "VegaLite", "(", "spec", ",", "validate", "=", "validate", ")", ")" ]
https://github.com/altair-viz/altair/blob/fb9e82eb378f68bad7a10c639f95e9a3991ac18d/altair/vegalite/v4/display.py#L105-L119
eriklindernoren/ML-From-Scratch
a2806c6732eee8d27762edd6d864e0c179d8e9e8
mlfromscratch/unsupervised_learning/apriori.py
python
Apriori._transaction_contains_items
(self, transaction, items)
return True
True or false depending on each item in the itemset is in the transaction
True or false depending on each item in the itemset is in the transaction
[ "True", "or", "false", "depending", "on", "each", "item", "in", "the", "itemset", "is", "in", "the", "transaction" ]
def _transaction_contains_items(self, transaction, items): """ True or false depending on each item in the itemset is in the transaction """ # If items is in fact only one item if isinstance(items, int): return items in transaction # Iterate through list of items and ...
[ "def", "_transaction_contains_items", "(", "self", ",", "transaction", ",", "items", ")", ":", "# If items is in fact only one item", "if", "isinstance", "(", "items", ",", "int", ")", ":", "return", "items", "in", "transaction", "# Iterate through list of items and mak...
https://github.com/eriklindernoren/ML-From-Scratch/blob/a2806c6732eee8d27762edd6d864e0c179d8e9e8/mlfromscratch/unsupervised_learning/apriori.py#L102-L113
marinho/geraldo
868ebdce67176d9b6205cddc92476f642c783fff
site/newsite/site-geraldo/django/middleware/transaction.py
python
TransactionMiddleware.process_exception
(self, request, exception)
Rolls back the database and leaves transaction management
Rolls back the database and leaves transaction management
[ "Rolls", "back", "the", "database", "and", "leaves", "transaction", "management" ]
def process_exception(self, request, exception): """Rolls back the database and leaves transaction management""" if transaction.is_dirty(): transaction.rollback() transaction.leave_transaction_management()
[ "def", "process_exception", "(", "self", ",", "request", ",", "exception", ")", ":", "if", "transaction", ".", "is_dirty", "(", ")", ":", "transaction", ".", "rollback", "(", ")", "transaction", ".", "leave_transaction_management", "(", ")" ]
https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/middleware/transaction.py#L15-L19
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/widgets/branch.py
python
BranchesTreeWidget.set_upstream
(self, branch, remote_branch)
Configure the upstream for a branch
Configure the upstream for a branch
[ "Configure", "the", "upstream", "for", "a", "branch" ]
def set_upstream(self, branch, remote_branch): """Configure the upstream for a branch""" context = self.context remote, r_branch = gitcmds.parse_remote_branch(remote_branch) if remote and r_branch: cmds.do(cmds.SetUpstreamBranch, context, branch, remote, r_branch)
[ "def", "set_upstream", "(", "self", ",", "branch", ",", "remote_branch", ")", ":", "context", "=", "self", ".", "context", "remote", ",", "r_branch", "=", "gitcmds", ".", "parse_remote_branch", "(", "remote_branch", ")", "if", "remote", "and", "r_branch", ":...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/branch.py#L342-L347
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/core/leoCommands.py
python
Commands.universalCallback
(self, source_c, function)
return minibufferCallback
Create a universal command callback. Create and return a callback that wraps a function with an rClick signature in a callback which adapts standard minibufer command callbacks to a compatible format. This also serves to allow rClick callback functions to handle minibuffer comm...
Create a universal command callback.
[ "Create", "a", "universal", "command", "callback", "." ]
def universalCallback(self, source_c, function): """Create a universal command callback. Create and return a callback that wraps a function with an rClick signature in a callback which adapts standard minibufer command callbacks to a compatible format. This also serves to allow...
[ "def", "universalCallback", "(", "self", ",", "source_c", ",", "function", ")", ":", "def", "minibufferCallback", "(", "event", ",", "function", "=", "function", ")", ":", "# Avoid a pylint complaint.", "if", "hasattr", "(", "self", ",", "'theContextMenuController...
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoCommands.py#L2451-L2497
bspaans/python-mingus
6558cacffeaab4f084a3eedda12b0e86fd24c430
mingus/core/scales.py
python
Octatonic.__init__
(self, note, octaves=1)
Create the octatonic (also known as "diminished") scale starting on the chosen note.
Create the octatonic (also known as "diminished") scale starting on the chosen note.
[ "Create", "the", "octatonic", "(", "also", "known", "as", "diminished", ")", "scale", "starting", "on", "the", "chosen", "note", "." ]
def __init__(self, note, octaves=1): """Create the octatonic (also known as "diminished") scale starting on the chosen note.""" super(Octatonic, self).__init__(note, octaves) self.name = "{0} octatonic".format(self.tonic)
[ "def", "__init__", "(", "self", ",", "note", ",", "octaves", "=", "1", ")", ":", "super", "(", "Octatonic", ",", "self", ")", ".", "__init__", "(", "note", ",", "octaves", ")", "self", ".", "name", "=", "\"{0} octatonic\"", ".", "format", "(", "self"...
https://github.com/bspaans/python-mingus/blob/6558cacffeaab4f084a3eedda12b0e86fd24c430/mingus/core/scales.py#L600-L604
prompt-toolkit/python-prompt-toolkit
e9eac2eb59ec385e81742fa2ac623d4b8de00925
examples/full-screen/simple-demos/alignment.py
python
_
(event)
Quit application.
Quit application.
[ "Quit", "application", "." ]
def _(event): "Quit application." event.app.exit()
[ "def", "_", "(", "event", ")", ":", "event", ".", "app", ".", "exit", "(", ")" ]
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/e9eac2eb59ec385e81742fa2ac623d4b8de00925/examples/full-screen/simple-demos/alignment.py#L46-L48
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/mako/runtime.py
python
_kwargs_for_callable
(callable_, data)
return kwargs
[]
def _kwargs_for_callable(callable_, data): argspec = compat.inspect_func_args(callable_) # for normal pages, **pageargs is usually present if argspec[2]: return data # for rendering defs from the top level, figure out the args namedargs = argspec[0] + [v for v in argspec[1:3] if v is not No...
[ "def", "_kwargs_for_callable", "(", "callable_", ",", "data", ")", ":", "argspec", "=", "compat", ".", "inspect_func_args", "(", "callable_", ")", "# for normal pages, **pageargs is usually present", "if", "argspec", "[", "2", "]", ":", "return", "data", "# for rend...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/mako/runtime.py#L806-L818
elfi-dev/elfi
07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c
elfi/methods/inference/parameter_inference.py
python
ParameterInference.update
(self, batch, batch_index)
Update the inference state with a new batch. ELFI calls this method when a new batch has been computed and the state of the inference should be updated with it. It is also possible to bypass ELFI and call this directly to update the inference. Parameters ---------- batc...
Update the inference state with a new batch.
[ "Update", "the", "inference", "state", "with", "a", "new", "batch", "." ]
def update(self, batch, batch_index): """Update the inference state with a new batch. ELFI calls this method when a new batch has been computed and the state of the inference should be updated with it. It is also possible to bypass ELFI and call this directly to update the inference. ...
[ "def", "update", "(", "self", ",", "batch", ",", "batch_index", ")", ":", "self", ".", "state", "[", "'n_batches'", "]", "+=", "1", "self", ".", "state", "[", "'n_sim'", "]", "+=", "self", ".", "batch_size" ]
https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/methods/inference/parameter_inference.py#L153-L173
bungnoid/glTools
8ff0899de43784a18bd4543285655e68e28fb5e5
utils/base.py
python
dagSort
(objectList=[])
return objectList
Sort the list of DAG objects in the hierarchy @param objectList: List of DAG object to sort. If empty, use current selection. @type objectList: list
Sort the list of DAG objects in the hierarchy
[ "Sort", "the", "list", "of", "DAG", "objects", "in", "the", "hierarchy" ]
def dagSort(objectList=[]): ''' Sort the list of DAG objects in the hierarchy @param objectList: List of DAG object to sort. If empty, use current selection. @type objectList: list ''' # Check Object List if not objectList: objectList = mc.ls(sl=1) objectList = mc.listRelatives(objectList,ad=True) objectLi...
[ "def", "dagSort", "(", "objectList", "=", "[", "]", ")", ":", "# Check Object List", "if", "not", "objectList", ":", "objectList", "=", "mc", ".", "ls", "(", "sl", "=", "1", ")", "objectList", "=", "mc", ".", "listRelatives", "(", "objectList", ",", "a...
https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/utils/base.py#L522-L543
debian-calibre/calibre
020fc81d3936a64b2ac51459ecb796666ab6a051
src/calibre/library/catalogs/epub_mobi_builder.py
python
CatalogBuilder.dump_custom_fields
(self)
Dump custom field mappings for debugging
Dump custom field mappings for debugging
[ "Dump", "custom", "field", "mappings", "for", "debugging" ]
def dump_custom_fields(self): """ Dump custom field mappings for debugging """ if self.opts.verbose: self.opts.log.info(" Custom fields:") all_custom_fields = self.db.custom_field_keys() for cf in all_custom_fields: self.opts.log.info("...
[ "def", "dump_custom_fields", "(", "self", ")", ":", "if", "self", ".", "opts", ".", "verbose", ":", "self", ".", "opts", ".", "log", ".", "info", "(", "\" Custom fields:\"", ")", "all_custom_fields", "=", "self", ".", "db", ".", "custom_field_keys", "(", ...
https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/library/catalogs/epub_mobi_builder.py#L662-L672
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/future/backports/email/message.py
python
Message.__contains__
(self, name)
return name.lower() in [k.lower() for k, v in self._headers]
[]
def __contains__(self, name): return name.lower() in [k.lower() for k, v in self._headers]
[ "def", "__contains__", "(", "self", ",", "name", ")", ":", "return", "name", ".", "lower", "(", ")", "in", "[", "k", ".", "lower", "(", ")", "for", "k", ",", "v", "in", "self", ".", "_headers", "]" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/backports/email/message.py#L378-L379
sketchfab/blender-plugin
0d0220fb776d137761636d6272923595a1ff5ac8
addons/io_sketchfab_plugin/blender/imp/gltf2_io_draco_compression_extension.py
python
decode_primitive
(gltf, prim)
Handles draco compression. Moves decoded data into new buffers and buffer views held by the accessors of the given primitive.
Handles draco compression. Moves decoded data into new buffers and buffer views held by the accessors of the given primitive.
[ "Handles", "draco", "compression", ".", "Moves", "decoded", "data", "into", "new", "buffers", "and", "buffer", "views", "held", "by", "the", "accessors", "of", "the", "given", "primitive", "." ]
def decode_primitive(gltf, prim): """ Handles draco compression. Moves decoded data into new buffers and buffer views held by the accessors of the given primitive. """ # Load DLL and setup function signatures. dll = cdll.LoadLibrary(str(dll_path().resolve())) dll.decoderCreate.restype = c_...
[ "def", "decode_primitive", "(", "gltf", ",", "prim", ")", ":", "# Load DLL and setup function signatures.", "dll", "=", "cdll", ".", "LoadLibrary", "(", "str", "(", "dll_path", "(", ")", ".", "resolve", "(", ")", ")", ")", "dll", ".", "decoderCreate", ".", ...
https://github.com/sketchfab/blender-plugin/blob/0d0220fb776d137761636d6272923595a1ff5ac8/addons/io_sketchfab_plugin/blender/imp/gltf2_io_draco_compression_extension.py#L23-L143
pytorch/audio
7b6b2d000023e2aa3365b769866c5f375e0d5fda
torchaudio/_internal/module_utils.py
python
is_module_available
(*modules: str)
return all(importlib.util.find_spec(m) is not None for m in modules)
r"""Returns if a top-level module with :attr:`name` exists *without** importing it. This is generally safer than try-catch block around a `import X`. It avoids third party libraries breaking assumptions of some of our tests, e.g., setting multiprocessing start method when imported (see librosa/#747, tor...
r"""Returns if a top-level module with :attr:`name` exists *without** importing it. This is generally safer than try-catch block around a `import X`. It avoids third party libraries breaking assumptions of some of our tests, e.g., setting multiprocessing start method when imported (see librosa/#747, tor...
[ "r", "Returns", "if", "a", "top", "-", "level", "module", "with", ":", "attr", ":", "name", "exists", "*", "without", "**", "importing", "it", ".", "This", "is", "generally", "safer", "than", "try", "-", "catch", "block", "around", "a", "import", "X", ...
def is_module_available(*modules: str) -> bool: r"""Returns if a top-level module with :attr:`name` exists *without** importing it. This is generally safer than try-catch block around a `import X`. It avoids third party libraries breaking assumptions of some of our tests, e.g., setting multiprocessing s...
[ "def", "is_module_available", "(", "*", "modules", ":", "str", ")", "->", "bool", ":", "return", "all", "(", "importlib", ".", "util", ".", "find_spec", "(", "m", ")", "is", "not", "None", "for", "m", "in", "modules", ")" ]
https://github.com/pytorch/audio/blob/7b6b2d000023e2aa3365b769866c5f375e0d5fda/torchaudio/_internal/module_utils.py#L9-L16
jodal/pyspotify
770aee08de274951b63e60bdd8835188b58e7862
spotify/track.py
python
Track.is_local
(self)
return bool(lib.sp_track_is_local(self._session._sp_session, self._sp_track))
Whether the track is a local track. Will always return :class:`None` if the track isn't loaded.
Whether the track is a local track.
[ "Whether", "the", "track", "is", "a", "local", "track", "." ]
def is_local(self): """Whether the track is a local track. Will always return :class:`None` if the track isn't loaded. """ spotify.Error.maybe_raise(self.error, ignores=[spotify.ErrorType.IS_LOADING]) if not self.is_loaded: return None return bool(lib.sp_trac...
[ "def", "is_local", "(", "self", ")", ":", "spotify", ".", "Error", ".", "maybe_raise", "(", "self", ".", "error", ",", "ignores", "=", "[", "spotify", ".", "ErrorType", ".", "IS_LOADING", "]", ")", "if", "not", "self", ".", "is_loaded", ":", "return", ...
https://github.com/jodal/pyspotify/blob/770aee08de274951b63e60bdd8835188b58e7862/spotify/track.py#L105-L113
avocado-framework/avocado
1f9b3192e8ba47d029c33fe21266bd113d17811f
avocado/utils/asset.py
python
Asset._get_writable_cache_dir
(self)
Returns the first available writable cache directory When a asset has to be downloaded, a writable cache directory is then needed. The first available writable cache directory will be used. :returns: the first writable cache dir :rtype: str :raises: OSError
Returns the first available writable cache directory
[ "Returns", "the", "first", "available", "writable", "cache", "directory" ]
def _get_writable_cache_dir(self): """ Returns the first available writable cache directory When a asset has to be downloaded, a writable cache directory is then needed. The first available writable cache directory will be used. :returns: the first writable cache dir ...
[ "def", "_get_writable_cache_dir", "(", "self", ")", ":", "for", "cache_dir", "in", "self", ".", "cache_dirs", ":", "cache_dir", "=", "os", ".", "path", ".", "expanduser", "(", "cache_dir", ")", "if", "utils_path", ".", "usable_rw_dir", "(", "cache_dir", ")",...
https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/utils/asset.py#L278-L294
secdev/scapy
65089071da1acf54622df0b4fa7fc7673d47d3cd
scapy/arch/bpf/supersocket.py
python
isBPFSocket
(obj)
return isinstance( obj, (L2bpfListenSocket, L2bpfListenSocket, L3bpfSocket) )
Return True is obj is a BPF Super Socket
Return True is obj is a BPF Super Socket
[ "Return", "True", "is", "obj", "is", "a", "BPF", "Super", "Socket" ]
def isBPFSocket(obj): """Return True is obj is a BPF Super Socket""" return isinstance( obj, (L2bpfListenSocket, L2bpfListenSocket, L3bpfSocket) )
[ "def", "isBPFSocket", "(", "obj", ")", ":", "return", "isinstance", "(", "obj", ",", "(", "L2bpfListenSocket", ",", "L2bpfListenSocket", ",", "L3bpfSocket", ")", ")" ]
https://github.com/secdev/scapy/blob/65089071da1acf54622df0b4fa7fc7673d47d3cd/scapy/arch/bpf/supersocket.py#L446-L451
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/ne1_ui/prefs/Preferences.py
python
Preferences._setupPage_Reports
(self)
return
Setup the "Reports" page.
Setup the "Reports" page.
[ "Setup", "the", "Reports", "page", "." ]
def _setupPage_Reports(self): """ Setup the "Reports" page. """ connect_checkbox_with_boolean_pref( self.msg_serial_number_checkbox, historyMsgSerialNumber_prefs_key ) connect_checkbox_with_boolean_pref( self.msg_timestamp_checkbox, historyMsgTimestamp_prefs_key ) return
[ "def", "_setupPage_Reports", "(", "self", ")", ":", "connect_checkbox_with_boolean_pref", "(", "self", ".", "msg_serial_number_checkbox", ",", "historyMsgSerialNumber_prefs_key", ")", "connect_checkbox_with_boolean_pref", "(", "self", ".", "msg_timestamp_checkbox", ",", "hist...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/ne1_ui/prefs/Preferences.py#L1338-L1344
gawel/pyquery
0a5f285d8541e24b0aeadc5e928037d748e0327c
pyquery/pyquery.py
python
PyQuery.parents
(self, selector=None)
return self._filter_only( selector, [e for e in self._traverse_parent_topdown()], unique=True )
>>> d = PyQuery('<span><p class="hello">Hi</p><p>Bye</p></span>') >>> d('p').parents() [<span>] >>> d('.hello').parents('span') [<span>] >>> d('.hello').parents('p') []
>>> d = PyQuery('<span><p class="hello">Hi</p><p>Bye</p></span>') >>> d('p').parents() [<span>] >>> d('.hello').parents('span') [<span>] >>> d('.hello').parents('p') []
[ ">>>", "d", "=", "PyQuery", "(", "<span", ">", "<p", "class", "=", "hello", ">", "Hi<", "/", "p", ">", "<p", ">", "Bye<", "/", "p", ">", "<", "/", "span", ">", ")", ">>>", "d", "(", "p", ")", ".", "parents", "()", "[", "<span", ">", "]", ...
def parents(self, selector=None): """ >>> d = PyQuery('<span><p class="hello">Hi</p><p>Bye</p></span>') >>> d('p').parents() [<span>] >>> d('.hello').parents('span') [<span>] >>> d('.hello').parents('p') [] """ return self._filter_only( ...
[ "def", "parents", "(", "self", ",", "selector", "=", "None", ")", ":", "return", "self", ".", "_filter_only", "(", "selector", ",", "[", "e", "for", "e", "in", "self", ".", "_traverse_parent_topdown", "(", ")", "]", ",", "unique", "=", "True", ")" ]
https://github.com/gawel/pyquery/blob/0a5f285d8541e24b0aeadc5e928037d748e0327c/pyquery/pyquery.py#L508-L522
scanny/python-pptx
71d1ca0b2b3b9178d64cdab565e8503a25a54e0b
pptx/dml/fill.py
python
_SolidFill.fore_color
(self)
return ColorFormat.from_colorchoice_parent(self._solidFill)
Return |ColorFormat| object controlling fill color.
Return |ColorFormat| object controlling fill color.
[ "Return", "|ColorFormat|", "object", "controlling", "fill", "color", "." ]
def fore_color(self): """Return |ColorFormat| object controlling fill color.""" return ColorFormat.from_colorchoice_parent(self._solidFill)
[ "def", "fore_color", "(", "self", ")", ":", "return", "ColorFormat", ".", "from_colorchoice_parent", "(", "self", ".", "_solidFill", ")" ]
https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/dml/fill.py#L344-L346
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/setuptools/pkg_resources/__init__.py
python
WorkingSet._build_from_requirements
(cls, req_spec)
return ws
Build a working set from a requirement spec. Rewrites sys.path.
Build a working set from a requirement spec. Rewrites sys.path.
[ "Build", "a", "working", "set", "from", "a", "requirement", "spec", ".", "Rewrites", "sys", ".", "path", "." ]
def _build_from_requirements(cls, req_spec): """ Build a working set from a requirement spec. Rewrites sys.path. """ # try it without defaults already on sys.path # by starting with an empty path ws = cls([]) reqs = parse_requirements(req_spec) dists = ws....
[ "def", "_build_from_requirements", "(", "cls", ",", "req_spec", ")", ":", "# try it without defaults already on sys.path", "# by starting with an empty path", "ws", "=", "cls", "(", "[", "]", ")", "reqs", "=", "parse_requirements", "(", "req_spec", ")", "dists", "=", ...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/pkg_resources/__init__.py#L622-L641
xiaomengyc/SPG
0006659c5be4c3451f8c9a188f1e91e9ff682fa9
utils/transforms/functional.py
python
vflip
(img)
return img.transpose(Image.FLIP_TOP_BOTTOM)
Vertically flip the given PIL Image. Args: img (PIL Image): Image to be flipped. Returns: PIL Image: Vertically flipped image.
Vertically flip the given PIL Image.
[ "Vertically", "flip", "the", "given", "PIL", "Image", "." ]
def vflip(img): """Vertically flip the given PIL Image. Args: img (PIL Image): Image to be flipped. Returns: PIL Image: Vertically flipped image. """ if not _is_pil_image(img): raise TypeError('img should be PIL Image. Got {}'.format(type(img))) return img.transpose(I...
[ "def", "vflip", "(", "img", ")", ":", "if", "not", "_is_pil_image", "(", "img", ")", ":", "raise", "TypeError", "(", "'img should be PIL Image. Got {}'", ".", "format", "(", "type", "(", "img", ")", ")", ")", "return", "img", ".", "transpose", "(", "Imag...
https://github.com/xiaomengyc/SPG/blob/0006659c5be4c3451f8c9a188f1e91e9ff682fa9/utils/transforms/functional.py#L306-L318
henkelis/sonospy
841f52010fd6e1e932d8f1a8896ad4e5a0667b8a
sonospy/sonos_service.py
python
SonosService.from_element
(self, elt)
return self
Sets the object properties from an element.
Sets the object properties from an element.
[ "Sets", "the", "object", "properties", "from", "an", "element", "." ]
def from_element(self, elt): """ Sets the object properties from an element. """ self.element_name = elt.tag Capabilities_attrib = elt.get('Capabilities') if Capabilities_attrib is not None: self.Capabilities = Capabilities_attrib Id_attrib = elt.get('Id') ...
[ "def", "from_element", "(", "self", ",", "elt", ")", ":", "self", ".", "element_name", "=", "elt", ".", "tag", "Capabilities_attrib", "=", "elt", ".", "get", "(", "'Capabilities'", ")", "if", "Capabilities_attrib", "is", "not", "None", ":", "self", ".", ...
https://github.com/henkelis/sonospy/blob/841f52010fd6e1e932d8f1a8896ad4e5a0667b8a/sonospy/sonos_service.py#L132-L213
Antergos/Cnchi
13ac2209da9432d453e0097cf48a107640b563a9
src/cnchi.py
python
CnchiInit.setup_gettext
()
This allows to translate all py texts (not the glade ones)
This allows to translate all py texts (not the glade ones)
[ "This", "allows", "to", "translate", "all", "py", "texts", "(", "not", "the", "glade", "ones", ")" ]
def setup_gettext(): """ This allows to translate all py texts (not the glade ones) """ gettext.textdomain(CnchiInit.APP_NAME) gettext.bindtextdomain(CnchiInit.APP_NAME, CnchiInit.LOCALE_DIR) locale_code, _encoding = locale.getdefaultlocale() lang = gettext.translation( ...
[ "def", "setup_gettext", "(", ")", ":", "gettext", ".", "textdomain", "(", "CnchiInit", ".", "APP_NAME", ")", "gettext", ".", "bindtextdomain", "(", "CnchiInit", ".", "APP_NAME", ",", "CnchiInit", ".", "LOCALE_DIR", ")", "locale_code", ",", "_encoding", "=", ...
https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/cnchi.py#L516-L525
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3db/pr.py
python
filter_actions
(resource, url, filters)
return actions
Helper to construct the actions for a saved filter. Args: resource: the S3Resource url: the filter page URL filters: the filter GET vars
Helper to construct the actions for a saved filter.
[ "Helper", "to", "construct", "the", "actions", "for", "a", "saved", "filter", "." ]
def filter_actions(resource, url, filters): """ Helper to construct the actions for a saved filter. Args: resource: the S3Resource url: the filter page URL filters: the filter GET vars """ if not url: return "" T = current.T actions = []...
[ "def", "filter_actions", "(", "resource", ",", "url", ",", "filters", ")", ":", "if", "not", "url", ":", "return", "\"\"", "T", "=", "current", ".", "T", "actions", "=", "[", "]", "append", "=", "actions", ".", "append", "tablename", "=", "resource", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3db/pr.py#L11312-L11375
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/Crypto/Random/random.py
python
StrongRandom.choice
(self, seq)
return seq[self.randrange(len(seq))]
Return a random element from a (non-empty) sequence. If the seqence is empty, raises IndexError.
Return a random element from a (non-empty) sequence.
[ "Return", "a", "random", "element", "from", "a", "(", "non", "-", "empty", ")", "sequence", "." ]
def choice(self, seq): """Return a random element from a (non-empty) sequence. If the seqence is empty, raises IndexError. """ if len(seq) == 0: raise IndexError("empty sequence") return seq[self.randrange(len(seq))]
[ "def", "choice", "(", "self", ",", "seq", ")", ":", "if", "len", "(", "seq", ")", "==", "0", ":", "raise", "IndexError", "(", "\"empty sequence\"", ")", "return", "seq", "[", "self", ".", "randrange", "(", "len", "(", "seq", ")", ")", "]" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/Crypto/Random/random.py#L95-L102
glutanimate/review-heatmap
c758478125b60a81c66c87c35b12b7968ec0a348
src/review_heatmap/libaddon/gui/basic/interface.py
python
CommonWidgetInterface._removeListItem
(self, list_widget, item)
Remove QListWidgetItem from list widget
Remove QListWidgetItem from list widget
[ "Remove", "QListWidgetItem", "from", "list", "widget" ]
def _removeListItem(self, list_widget, item): """ Remove QListWidgetItem from list widget """ list_widget.takeItem(list_widget.row(item)) # takeItem does not delete the QListWidgetItem: del(item)
[ "def", "_removeListItem", "(", "self", ",", "list_widget", ",", "item", ")", ":", "list_widget", ".", "takeItem", "(", "list_widget", ".", "row", "(", "item", ")", ")", "# takeItem does not delete the QListWidgetItem:", "del", "(", "item", ")" ]
https://github.com/glutanimate/review-heatmap/blob/c758478125b60a81c66c87c35b12b7968ec0a348/src/review_heatmap/libaddon/gui/basic/interface.py#L963-L969
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/messaging/smsbackends/push/models.py
python
PushBackend.get_generic_name
(cls)
return "Push"
[]
def get_generic_name(cls): return "Push"
[ "def", "get_generic_name", "(", "cls", ")", ":", "return", "\"Push\"" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/messaging/smsbackends/push/models.py#L71-L72
iTechArt/convtools-ita
25c1057e20581d957bec1339758325dc98fec43e
src/convtools/base.py
python
Call.__init__
(self, *args, self_conv=BaseConversion._none, **kwargs)
[]
def __init__(self, *args, self_conv=BaseConversion._none, **kwargs): super().__init__(self_conv) self.args = [self.ensure_conversion(arg) for arg in args] self.kwargs = ( {k: self.ensure_conversion(v) for k, v in kwargs.items()} if kwargs else {} )
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "self_conv", "=", "BaseConversion", ".", "_none", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "self_conv", ")", "self", ".", "args", "=", "[", "self", ".", "ensu...
https://github.com/iTechArt/convtools-ita/blob/25c1057e20581d957bec1339758325dc98fec43e/src/convtools/base.py#L1246-L1253
eleurent/highway-env
9d63973da854584fe51b00ccee7b24b1bf031418
highway_env/vehicle/controller.py
python
ControlledVehicle.set_route_at_intersection
(self, _to: int)
Set the road to be followed at the next intersection. Erase current planned route. :param _to: index of the road to follow at next intersection, in the road network
Set the road to be followed at the next intersection.
[ "Set", "the", "road", "to", "be", "followed", "at", "the", "next", "intersection", "." ]
def set_route_at_intersection(self, _to: int) -> None: """ Set the road to be followed at the next intersection. Erase current planned route. :param _to: index of the road to follow at next intersection, in the road network """ routes = self.get_routes_at_intersection(...
[ "def", "set_route_at_intersection", "(", "self", ",", "_to", ":", "int", ")", "->", "None", ":", "routes", "=", "self", ".", "get_routes_at_intersection", "(", ")", "if", "routes", ":", "if", "_to", "==", "\"random\"", ":", "_to", "=", "self", ".", "road...
https://github.com/eleurent/highway-env/blob/9d63973da854584fe51b00ccee7b24b1bf031418/highway_env/vehicle/controller.py#L175-L188
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/cgi.py
python
FieldStorage.make_file
(self)
Overridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version opens a temporary file for reading...
Overridable: return a readable & writable file.
[ "Overridable", ":", "return", "a", "readable", "&", "writable", "file", "." ]
def make_file(self): """Overridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version op...
[ "def", "make_file", "(", "self", ")", ":", "if", "self", ".", "_binary_file", ":", "return", "tempfile", ".", "TemporaryFile", "(", "\"wb+\"", ")", "else", ":", "return", "tempfile", ".", "TemporaryFile", "(", "\"w+\"", ",", "encoding", "=", "self", ".", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/cgi.py#L811-L839
inspurer/WorkAttendanceSystem
1221e2d67bdf5bb15fe99517cc3ded58ccb066df
V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/locations.py
python
virtualenv_no_global
()
Return True if in a venv and no system site packages.
Return True if in a venv and no system site packages.
[ "Return", "True", "if", "in", "a", "venv", "and", "no", "system", "site", "packages", "." ]
def virtualenv_no_global(): """ Return True if in a venv and no system site packages. """ # this mirrors the logic in virtualenv.py for locating the # no-global-site-packages.txt file site_mod_dir = os.path.dirname(os.path.abspath(site.__file__)) no_global_file = os.path.join(site_mod_dir, '...
[ "def", "virtualenv_no_global", "(", ")", ":", "# this mirrors the logic in virtualenv.py for locating the", "# no-global-site-packages.txt file", "site_mod_dir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "site", ".", "__file__"...
https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/locations.py#L52-L61
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/contrib/staticfiles/storage.py
python
ConfiguredStorage._setup
(self)
[]
def _setup(self): self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
[ "def", "_setup", "(", "self", ")", ":", "self", ".", "_wrapped", "=", "get_storage_class", "(", "settings", ".", "STATICFILES_STORAGE", ")", "(", ")" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/staticfiles/storage.py#L503-L504
tmux-python/tmuxp
4913143d7b6d8d81ed591236d0312ea159c66623
tmuxp/cli.py
python
get_tmuxinator_dir
()
return os.path.expanduser('~/.tmuxinator/')
Return tmuxinator configuration directory. Checks for ``TMUXINATOR_CONFIG`` environmental variable. Returns ------- str : absolute path to tmuxinator config directory See Also -------- :meth:`tmuxp.config.import_tmuxinator`
Return tmuxinator configuration directory.
[ "Return", "tmuxinator", "configuration", "directory", "." ]
def get_tmuxinator_dir(): """ Return tmuxinator configuration directory. Checks for ``TMUXINATOR_CONFIG`` environmental variable. Returns ------- str : absolute path to tmuxinator config directory See Also -------- :meth:`tmuxp.config.import_tmuxinator` """ if 'TMU...
[ "def", "get_tmuxinator_dir", "(", ")", ":", "if", "'TMUXINATOR_CONFIG'", "in", "os", ".", "environ", ":", "return", "os", ".", "path", ".", "expanduser", "(", "os", ".", "environ", "[", "'TMUXINATOR_CONFIG'", "]", ")", "return", "os", ".", "path", ".", "...
https://github.com/tmux-python/tmuxp/blob/4913143d7b6d8d81ed591236d0312ea159c66623/tmuxp/cli.py#L87-L105
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
drafts/link_shortener_drngdk.py
python
error_dialog
(title, message)
A diaolog box for error messages.
A diaolog box for error messages.
[ "A", "diaolog", "box", "for", "error", "messages", "." ]
def error_dialog(title, message): '''A diaolog box for error messages.''' try: alert(title, message) except KeyboardInterrupt: pass webbrowser.open('drafts://') exit(message)
[ "def", "error_dialog", "(", "title", ",", "message", ")", ":", "try", ":", "alert", "(", "title", ",", "message", ")", "except", "KeyboardInterrupt", ":", "pass", "webbrowser", ".", "open", "(", "'drafts://'", ")", "exit", "(", "message", ")" ]
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/drafts/link_shortener_drngdk.py#L8-L15
Shizmob/pydle
9798eb3db6665622fdd1391cdb563ebdb3014c6c
pydle/features/ircv3/cap.py
python
CapabilityNegotiationSupport.on_raw_410
(self, message)
Unknown CAP subcommand or CAP error. Force-end negotiations.
Unknown CAP subcommand or CAP error. Force-end negotiations.
[ "Unknown", "CAP", "subcommand", "or", "CAP", "error", ".", "Force", "-", "end", "negotiations", "." ]
async def on_raw_410(self, message): """ Unknown CAP subcommand or CAP error. Force-end negotiations. """ self.logger.error('Server sent "Unknown CAP subcommand: %s". Aborting capability negotiation.', message.params[0]) self._capabilities_requested = set() self._capabilities_negotiatin...
[ "async", "def", "on_raw_410", "(", "self", ",", "message", ")", ":", "self", ".", "logger", ".", "error", "(", "'Server sent \"Unknown CAP subcommand: %s\". Aborting capability negotiation.'", ",", "message", ".", "params", "[", "0", "]", ")", "self", ".", "_capab...
https://github.com/Shizmob/pydle/blob/9798eb3db6665622fdd1391cdb563ebdb3014c6c/pydle/features/ircv3/cap.py#L179-L185
coderSkyChen/Action_Recognition_Zoo
92ec5ec3efeee852aec5c057798298cd3a8e58ae
model_zoo/models/differential_privacy/dp_sgd/dp_optimizer/dp_optimizer.py
python
DPGradientDescentOptimizer.__init__
(self, learning_rate, eps_delta, sanitizer, sigma=None, use_locking=False, name="DPGradientDescent", batches_per_lot=1)
Construct a differentially private gradient descent optimizer. The optimizer uses fixed privacy budget for each batch of training. Args: learning_rate: for GradientDescentOptimizer. eps_delta: EpsDelta pair for each epoch. sanitizer: for sanitizing the graident. sigma: noise sigma. If ...
Construct a differentially private gradient descent optimizer.
[ "Construct", "a", "differentially", "private", "gradient", "descent", "optimizer", "." ]
def __init__(self, learning_rate, eps_delta, sanitizer, sigma=None, use_locking=False, name="DPGradientDescent", batches_per_lot=1): """Construct a differentially private gradient descent optimizer. The optimizer uses fixed privacy budget for each batch of training. Args: ...
[ "def", "__init__", "(", "self", ",", "learning_rate", ",", "eps_delta", ",", "sanitizer", ",", "sigma", "=", "None", ",", "use_locking", "=", "False", ",", "name", "=", "\"DPGradientDescent\"", ",", "batches_per_lot", "=", "1", ")", ":", "super", "(", "DPG...
https://github.com/coderSkyChen/Action_Recognition_Zoo/blob/92ec5ec3efeee852aec5c057798298cd3a8e58ae/model_zoo/models/differential_privacy/dp_sgd/dp_optimizer/dp_optimizer.py#L30-L67
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gui/editors/displaytabs/groupembeddedlist.py
python
GroupEmbeddedList.find_index
(self, obj)
return (groupindex, index)
Returns the index of the object within the associated data. This will be a path (groupindex, index)
Returns the index of the object within the associated data. This will be a path (groupindex, index)
[ "Returns", "the", "index", "of", "the", "object", "within", "the", "associated", "data", ".", "This", "will", "be", "a", "path", "(", "groupindex", "index", ")" ]
def find_index(self, obj): """ Returns the index of the object within the associated data. This will be a path (groupindex, index) """ data = self.get_data() groupindex = None index = None for groupindex, group in enumerate(data): try: ...
[ "def", "find_index", "(", "self", ",", "obj", ")", ":", "data", "=", "self", ".", "get_data", "(", ")", "groupindex", "=", "None", "index", "=", "None", "for", "groupindex", ",", "group", "in", "enumerate", "(", "data", ")", ":", "try", ":", "index",...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/editors/displaytabs/groupembeddedlist.py#L197-L211
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/api/prospective_search/prospective_search_stub.py
python
ProspectiveSearchStub._Simplify
(self, parser_return)
return parser_return
Simplifies the output of the parser.
Simplifies the output of the parser.
[ "Simplifies", "the", "output", "of", "the", "parser", "." ]
def _Simplify(self, parser_return): """Simplifies the output of the parser.""" if parser_return.tree: return self._SimplifyNode(query_parser.SimplifyNode(parser_return.tree)) return parser_return
[ "def", "_Simplify", "(", "self", ",", "parser_return", ")", ":", "if", "parser_return", ".", "tree", ":", "return", "self", ".", "_SimplifyNode", "(", "query_parser", ".", "SimplifyNode", "(", "parser_return", ".", "tree", ")", ")", "return", "parser_return" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/prospective_search/prospective_search_stub.py#L419-L423
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/OpenSSL/SSL.py
python
Connection.sock_shutdown
(self, *args, **kwargs)
return self._socket.shutdown(*args, **kwargs)
Call the :meth:`shutdown` method of the underlying socket. See :manpage:`shutdown(2)`. :return: What the socket's shutdown() method returns
Call the :meth:`shutdown` method of the underlying socket. See :manpage:`shutdown(2)`.
[ "Call", "the", ":", "meth", ":", "shutdown", "method", "of", "the", "underlying", "socket", ".", "See", ":", "manpage", ":", "shutdown", "(", "2", ")", "." ]
def sock_shutdown(self, *args, **kwargs): """ Call the :meth:`shutdown` method of the underlying socket. See :manpage:`shutdown(2)`. :return: What the socket's shutdown() method returns """ return self._socket.shutdown(*args, **kwargs)
[ "def", "sock_shutdown", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_socket", ".", "shutdown", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/OpenSSL/SSL.py#L2197-L2204
bmoscon/cryptofeed
c0f52011c6d67c10c0e5b5f480cccaee6068e375
cryptofeed/exchanges/bitdotcom.py
python
BitDotCom._ticker
(self, data: dict, timestamp: float)
{ 'channel': 'ticker', 'timestamp': 1639093870710, 'data': { 'time': 1639093870710, 'instrument_id': 'ETH-PERPETUAL', 'best_bid': '4155.85000000', 'best_ask': '4155.90000000', 'best_bid_qty': '2000.000000...
{ 'channel': 'ticker', 'timestamp': 1639093870710, 'data': { 'time': 1639093870710, 'instrument_id': 'ETH-PERPETUAL', 'best_bid': '4155.85000000', 'best_ask': '4155.90000000', 'best_bid_qty': '2000.000000...
[ "{", "channel", ":", "ticker", "timestamp", ":", "1639093870710", "data", ":", "{", "time", ":", "1639093870710", "instrument_id", ":", "ETH", "-", "PERPETUAL", "best_bid", ":", "4155", ".", "85000000", "best_ask", ":", "4155", ".", "90000000", "best_bid_qty",...
async def _ticker(self, data: dict, timestamp: float): ''' { 'channel': 'ticker', 'timestamp': 1639093870710, 'data': { 'time': 1639093870710, 'instrument_id': 'ETH-PERPETUAL', 'best_bid': '4155.85000000', ...
[ "async", "def", "_ticker", "(", "self", ",", "data", ":", "dict", ",", "timestamp", ":", "float", ")", ":", "if", "data", "[", "'data'", "]", "[", "'best_bid'", "]", "and", "data", "[", "'data'", "]", "[", "'best_ask'", "]", ":", "t", "=", "Ticker"...
https://github.com/bmoscon/cryptofeed/blob/c0f52011c6d67c10c0e5b5f480cccaee6068e375/cryptofeed/exchanges/bitdotcom.py#L263-L302
serge-sans-paille/pythran
f9f73aa5a965adc4ebcb91a439784dbe9ef911fa
pythran/types/types.py
python
Types.isargument
(self, node)
checks whether node aliases to a parameter.
checks whether node aliases to a parameter.
[ "checks", "whether", "node", "aliases", "to", "a", "parameter", "." ]
def isargument(self, node): """ checks whether node aliases to a parameter.""" try: node_id, _ = self.node_to_id(node) return (node_id in self.name_to_nodes and any(isinstance(n, ast.Name) and isinstance(n.ctx, ast.Param) ...
[ "def", "isargument", "(", "self", ",", "node", ")", ":", "try", ":", "node_id", ",", "_", "=", "self", ".", "node_to_id", "(", "node", ")", "return", "(", "node_id", "in", "self", ".", "name_to_nodes", "and", "any", "(", "isinstance", "(", "n", ",", ...
https://github.com/serge-sans-paille/pythran/blob/f9f73aa5a965adc4ebcb91a439784dbe9ef911fa/pythran/types/types.py#L123-L132
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/google_assistant/http.py
python
GoogleConfig.should_report_state
(self)
return self._config.get(CONF_REPORT_STATE)
Return if states should be proactively reported.
Return if states should be proactively reported.
[ "Return", "if", "states", "should", "be", "proactively", "reported", "." ]
def should_report_state(self): """Return if states should be proactively reported.""" return self._config.get(CONF_REPORT_STATE)
[ "def", "should_report_state", "(", "self", ")", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_REPORT_STATE", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/google_assistant/http.py#L110-L112
MichaelGrupp/evo
c65af3b69188aaadbbd7b5f99ac7973d74343d65
evo/core/transformations.py
python
euler_matrix
(ai, aj, ak, axes='sxyz')
return M
Return homogeneous rotation matrix from Euler angles and axis sequence. ai, aj, ak : Euler's roll, pitch and yaw angles axes : One of 24 axis sequences as string or encoded tuple >>> R = euler_matrix(1, 2, 3, 'syxz') >>> numpy.allclose(numpy.sum(R[0]), -1.34786452) True >>> R = euler_matrix(1,...
Return homogeneous rotation matrix from Euler angles and axis sequence.
[ "Return", "homogeneous", "rotation", "matrix", "from", "Euler", "angles", "and", "axis", "sequence", "." ]
def euler_matrix(ai, aj, ak, axes='sxyz'): """Return homogeneous rotation matrix from Euler angles and axis sequence. ai, aj, ak : Euler's roll, pitch and yaw angles axes : One of 24 axis sequences as string or encoded tuple >>> R = euler_matrix(1, 2, 3, 'syxz') >>> numpy.allclose(numpy.sum(R[0]),...
[ "def", "euler_matrix", "(", "ai", ",", "aj", ",", "ak", ",", "axes", "=", "'sxyz'", ")", ":", "try", ":", "firstaxis", ",", "parity", ",", "repetition", ",", "frame", "=", "_AXES2TUPLE", "[", "axes", "]", "except", "(", "AttributeError", ",", "KeyError...
https://github.com/MichaelGrupp/evo/blob/c65af3b69188aaadbbd7b5f99ac7973d74343d65/evo/core/transformations.py#L1053-L1113
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/scripts/shared.py
python
load_population
(year=2021)
return ( pd.DataFrame([_find_closest_year_row(df_group, year) for loc, df_group in df.groupby("entity")]) .dropna() .rename(columns={"entity": "location", "year": "population_year"}) )
[]
def load_population(year=2021): df = pd.read_csv( POPULATION_CSV_PATH, keep_default_na=False, usecols=["entity", "year", "population"], ) return ( pd.DataFrame([_find_closest_year_row(df_group, year) for loc, df_group in df.groupby("entity")]) .dropna() .renam...
[ "def", "load_population", "(", "year", "=", "2021", ")", ":", "df", "=", "pd", ".", "read_csv", "(", "POPULATION_CSV_PATH", ",", "keep_default_na", "=", "False", ",", "usecols", "=", "[", "\"entity\"", ",", "\"year\"", ",", "\"population\"", "]", ",", ")",...
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/scripts/shared.py#L38-L48
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/lighthouse/v20200324/models.py
python
StartInstancesResponse.__init__
(self)
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/lighthouse/v20200324/models.py#L5020-L5025
lbryio/torba
190304344c0ff68f8a24cf50272307a11bf7f62b
torba/server/daemon.py
python
Daemon.current_url
(self)
return self.urls[self.url_index]
Returns the current daemon URL.
Returns the current daemon URL.
[ "Returns", "the", "current", "daemon", "URL", "." ]
def current_url(self): """Returns the current daemon URL.""" return self.urls[self.url_index]
[ "def", "current_url", "(", "self", ")", ":", "return", "self", ".", "urls", "[", "self", ".", "url_index", "]" ]
https://github.com/lbryio/torba/blob/190304344c0ff68f8a24cf50272307a11bf7f62b/torba/server/daemon.py#L70-L72
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/providers/azure/azure_service_bus.py
python
AzureServiceBus._CreateTopic
(self)
Creates Service Bus topic.
Creates Service Bus topic.
[ "Creates", "Service", "Bus", "topic", "." ]
def _CreateTopic(self): """Creates Service Bus topic.""" cmd = [ azure.AZURE_PATH, 'servicebus', 'topic', 'create', '--name', self.topic_name, '--namespace-name', self.namespace_name ] + self.resource_group.args vm_util.IssueCommand(cmd)
[ "def", "_CreateTopic", "(", "self", ")", ":", "cmd", "=", "[", "azure", ".", "AZURE_PATH", ",", "'servicebus'", ",", "'topic'", ",", "'create'", ",", "'--name'", ",", "self", ".", "topic_name", ",", "'--namespace-name'", ",", "self", ".", "namespace_name", ...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/azure/azure_service_bus.py#L97-L103
rucio/rucio
6d0d358e04f5431f0b9a98ae40f31af0ddff4833
lib/rucio/core/naming_convention.py
python
delete_naming_convention
(scope, convention_type, session=None)
return session.query(models.NamingConvention) \ .filter_by(scope=scope, convention_type=convention_type) \ .delete()
delete a naming convention for a given scope :param scope: the name for the scope. :param regexp: the regular expression to validate the name. (DEPRECATED) :param convention_type: the did_type on which the regexp should apply. :param session: The database session in use.
delete a naming convention for a given scope
[ "delete", "a", "naming", "convention", "for", "a", "given", "scope" ]
def delete_naming_convention(scope, convention_type, session=None): """ delete a naming convention for a given scope :param scope: the name for the scope. :param regexp: the regular expression to validate the name. (DEPRECATED) :param convention_type: the did_type on which the regexp should apply. ...
[ "def", "delete_naming_convention", "(", "scope", ",", "convention_type", ",", "session", "=", "None", ")", ":", "REGION", ".", "delete", "(", "scope", ".", "internal", ")", "return", "session", ".", "query", "(", "models", ".", "NamingConvention", ")", ".", ...
https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/core/naming_convention.py#L91-L103
nvbn/everpad
5db96c0f9b7c30ce4f900274f3826fdfa55cbaac
everpad/provider/sync/note.py
python
PullNote._get_all_notes
(self)
Iterate all notes
Iterate all notes
[ "Iterate", "all", "notes" ]
def _get_all_notes(self): """Iterate all notes""" offset = 0 while True: note_list = self.note_store.findNotes( self.auth_token, NoteFilter( order=ttypes.NoteSortOrder.UPDATED, ascending=False, ), offset, limits...
[ "def", "_get_all_notes", "(", "self", ")", ":", "offset", "=", "0", "while", "True", ":", "note_list", "=", "self", ".", "note_store", ".", "findNotes", "(", "self", ".", "auth_token", ",", "NoteFilter", "(", "order", "=", "ttypes", ".", "NoteSortOrder", ...
https://github.com/nvbn/everpad/blob/5db96c0f9b7c30ce4f900274f3826fdfa55cbaac/everpad/provider/sync/note.py#L188-L205
derek-zhang123/MxShop
22001da19b3d85424f48d78a844b8f424ae1e0e6
extra_apps/rest_framework/templatetags/rest_framework.py
python
optional_logout
(request, user)
return mark_safe(snippet)
Include a logout snippet if REST framework's logout view is in the URLconf.
Include a logout snippet if REST framework's logout view is in the URLconf.
[ "Include", "a", "logout", "snippet", "if", "REST", "framework", "s", "logout", "view", "is", "in", "the", "URLconf", "." ]
def optional_logout(request, user): """ Include a logout snippet if REST framework's logout view is in the URLconf. """ try: logout_url = reverse('rest_framework:logout') except NoReverseMatch: snippet = format_html('<li class="navbar-text">{user}</li>', user=escape(user)) re...
[ "def", "optional_logout", "(", "request", ",", "user", ")", ":", "try", ":", "logout_url", "=", "reverse", "(", "'rest_framework:logout'", ")", "except", "NoReverseMatch", ":", "snippet", "=", "format_html", "(", "'<li class=\"navbar-text\">{user}</li>'", ",", "user...
https://github.com/derek-zhang123/MxShop/blob/22001da19b3d85424f48d78a844b8f424ae1e0e6/extra_apps/rest_framework/templatetags/rest_framework.py#L126-L147
traveller59/second.pytorch
3aba19c9688274f75ebb5e576f65cfe54773c021
second/data/dataset.py
python
Dataset.get_sensor_data
(self, query)
Dataset must provide a unified function to get data. Args: query: int or dict. this param must support int for training. if dict, should have this format (no example yet): { sensor_name: { sensor_meta } ...
Dataset must provide a unified function to get data. Args: query: int or dict. this param must support int for training. if dict, should have this format (no example yet): { sensor_name: { sensor_meta } ...
[ "Dataset", "must", "provide", "a", "unified", "function", "to", "get", "data", ".", "Args", ":", "query", ":", "int", "or", "dict", ".", "this", "param", "must", "support", "int", "for", "training", ".", "if", "dict", "should", "have", "this", "format", ...
def get_sensor_data(self, query): """Dataset must provide a unified function to get data. Args: query: int or dict. this param must support int for training. if dict, should have this format (no example yet): { sensor_name: { ...
[ "def", "get_sensor_data", "(", "self", ",", "query", ")", ":", "raise", "NotImplementedError" ]
https://github.com/traveller59/second.pytorch/blob/3aba19c9688274f75ebb5e576f65cfe54773c021/second/data/dataset.py#L55-L108
materialsproject/fireworks
83a907c19baf2a5c9fdcf63996f9797c3c85b785
fireworks/utilities/dagflow.py
python
DAGFlow.delete_dataflow_links
(self)
Deletes graph edges corresponding to data flow links
Deletes graph edges corresponding to data flow links
[ "Deletes", "graph", "edges", "corresponding", "to", "data", "flow", "links" ]
def delete_dataflow_links(self): """Deletes graph edges corresponding to data flow links""" lst = [link.index for link in list(self.es) if link["label"] != " "] self.delete_edges(lst)
[ "def", "delete_dataflow_links", "(", "self", ")", ":", "lst", "=", "[", "link", ".", "index", "for", "link", "in", "list", "(", "self", ".", "es", ")", "if", "link", "[", "\"label\"", "]", "!=", "\" \"", "]", "self", ".", "delete_edges", "(", "lst", ...
https://github.com/materialsproject/fireworks/blob/83a907c19baf2a5c9fdcf63996f9797c3c85b785/fireworks/utilities/dagflow.py#L279-L282
ducksboard/libsaas
615981a3336f65be9d51ae95a48aed9ad3bd1c3c
libsaas/services/fullcontact/resource.py
python
Name.normalizer
(self, q, casing=None)
return request, parsers.parse_json
Take quasi-structured name data provided as a string and outputs the data in a structured manner. :var q: Name you would like to be normalized. :vartype q: str :var casing: One of: uppercase, lowercase or titlecase. :vartype casing: str
Take quasi-structured name data provided as a string and outputs the data in a structured manner.
[ "Take", "quasi", "-", "structured", "name", "data", "provided", "as", "a", "string", "and", "outputs", "the", "data", "in", "a", "structured", "manner", "." ]
def normalizer(self, q, casing=None): """ Take quasi-structured name data provided as a string and outputs the data in a structured manner. :var q: Name you would like to be normalized. :vartype q: str :var casing: One of: uppercase, lowercase or titlecase. :var...
[ "def", "normalizer", "(", "self", ",", "q", ",", "casing", "=", "None", ")", ":", "params", "=", "base", ".", "get_params", "(", "None", ",", "locals", "(", ")", ")", "url", "=", "'{0}/{1}'", ".", "format", "(", "self", ".", "get_url", "(", ")", ...
https://github.com/ducksboard/libsaas/blob/615981a3336f65be9d51ae95a48aed9ad3bd1c3c/libsaas/services/fullcontact/resource.py#L72-L88
click-contrib/click-spinner
851bef736e09996ad29800069394a9d4f1d254cb
versioneer.py
python
get_root
()
return root
Get the project root directory. We require that all commands are run from the project root, i.e. the directory that contains setup.py, setup.cfg, and versioneer.py .
Get the project root directory.
[ "Get", "the", "project", "root", "directory", "." ]
def get_root(): """Get the project root directory. We require that all commands are run from the project root, i.e. the directory that contains setup.py, setup.cfg, and versioneer.py . """ root = os.path.realpath(os.path.abspath(os.getcwd())) setup_py = os.path.join(root, "setup.py") versio...
[ "def", "get_root", "(", ")", ":", "root", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "abspath", "(", "os", ".", "getcwd", "(", ")", ")", ")", "setup_py", "=", "os", ".", "path", ".", "join", "(", "root", ",", "\"setup...
https://github.com/click-contrib/click-spinner/blob/851bef736e09996ad29800069394a9d4f1d254cb/versioneer.py#L368-L402
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/data_catalog/data_catalog_client.py
python
DataCatalogClient.get_namespace
(self, catalog_id, namespace_id, **kwargs)
Gets a specific namespace for the given key within a data catalog. :param str catalog_id: (required) Unique catalog identifier. :param str namespace_id: (required) Unique namespace identifier. :param list[str] fields: (optional) Specifies the fields to ret...
Gets a specific namespace for the given key within a data catalog.
[ "Gets", "a", "specific", "namespace", "for", "the", "given", "key", "within", "a", "data", "catalog", "." ]
def get_namespace(self, catalog_id, namespace_id, **kwargs): """ Gets a specific namespace for the given key within a data catalog. :param str catalog_id: (required) Unique catalog identifier. :param str namespace_id: (required) Unique namespace identifier. ...
[ "def", "get_namespace", "(", "self", ",", "catalog_id", ",", "namespace_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/catalogs/{catalogId}/namespaces/{namespaceId}\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/data_catalog/data_catalog_client.py#L6969-L7073
deepmind/acme
9880719d9def1d87a194377b394a414a17d11064
acme/agents/jax/ail/learning.py
python
AILLearner._process_sample
(self, sample: reverb.ReplaySample)
return sample._replace(data=sample.data._replace(reward=rewards))
Updates the reward of the replay sample. Args: sample: Replay sample to update the reward to. Returns: The replay sample with an updated reward.
Updates the reward of the replay sample.
[ "Updates", "the", "reward", "of", "the", "replay", "sample", "." ]
def _process_sample(self, sample: reverb.ReplaySample) -> reverb.ReplaySample: """Updates the reward of the replay sample. Args: sample: Replay sample to update the reward to. Returns: The replay sample with an updated reward. """ transitions = reverb_utils.replay_sample_to_sars_transi...
[ "def", "_process_sample", "(", "self", ",", "sample", ":", "reverb", ".", "ReplaySample", ")", "->", "reverb", ".", "ReplaySample", ":", "transitions", "=", "reverb_utils", ".", "replay_sample_to_sars_transition", "(", "sample", ",", "is_sequence", "=", "self", ...
https://github.com/deepmind/acme/blob/9880719d9def1d87a194377b394a414a17d11064/acme/agents/jax/ail/learning.py#L216-L231
StackStorm/st2
85ae05b73af422efd3097c9c05351f7f1cc8369e
st2common/st2common/util/schema/__init__.py
python
get_action_output_schema
(additional_properties=True)
return get_draft_schema( version="action_output_schema", additional_properties=additional_properties )
Return a generic schema which is used for validating action output.
Return a generic schema which is used for validating action output.
[ "Return", "a", "generic", "schema", "which", "is", "used", "for", "validating", "action", "output", "." ]
def get_action_output_schema(additional_properties=True): """ Return a generic schema which is used for validating action output. """ return get_draft_schema( version="action_output_schema", additional_properties=additional_properties )
[ "def", "get_action_output_schema", "(", "additional_properties", "=", "True", ")", ":", "return", "get_draft_schema", "(", "version", "=", "\"action_output_schema\"", ",", "additional_properties", "=", "additional_properties", ")" ]
https://github.com/StackStorm/st2/blob/85ae05b73af422efd3097c9c05351f7f1cc8369e/st2common/st2common/util/schema/__init__.py#L89-L95
ehForwarderBot/efb-wechat-slave
36a94c5e5f2fe5dc7247448cf37d5e8b653e8990
efb_wechat_slave/vendor/itchat/core.py
python
Core.revoke
(self, msgId, toUserName, localId=None)
revoke message with its and msgId for options - msgId: message Id on server - toUserName: 'UserName' key of friend dict - localId: message Id at local (optional) it is defined in components/messages.py
revoke message with its and msgId for options - msgId: message Id on server - toUserName: 'UserName' key of friend dict - localId: message Id at local (optional) it is defined in components/messages.py
[ "revoke", "message", "with", "its", "and", "msgId", "for", "options", "-", "msgId", ":", "message", "Id", "on", "server", "-", "toUserName", ":", "UserName", "key", "of", "friend", "dict", "-", "localId", ":", "message", "Id", "at", "local", "(", "option...
def revoke(self, msgId, toUserName, localId=None): """ revoke message with its and msgId for options - msgId: message Id on server - toUserName: 'UserName' key of friend dict - localId: message Id at local (optional) it is defined in compon...
[ "def", "revoke", "(", "self", ",", "msgId", ",", "toUserName", ",", "localId", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/ehForwarderBot/efb-wechat-slave/blob/36a94c5e5f2fe5dc7247448cf37d5e8b653e8990/efb_wechat_slave/vendor/itchat/core.py#L406-L414
dagster-io/dagster
b27d569d5fcf1072543533a0c763815d96f90b8f
python_modules/libraries/dagster-dbt/dagster_dbt/rpc/resources.py
python
DbtRpcResource.seed
( self, show: bool = False, select: List[str] = None, exclude: List[str] = None, **kwargs )
return self._get_result(data=json.dumps(data))
Sends a request with the method ``seed`` to the dbt RPC server, and returns the response. For more details, see the dbt docs for the RPC method `seed <https://docs.getdbt.com/reference/commands/rpc/#run-seed>`_. Args: show (bool, optional): If ``True``, then show a sample of the see...
Sends a request with the method ``seed`` to the dbt RPC server, and returns the response. For more details, see the dbt docs for the RPC method `seed <https://docs.getdbt.com/reference/commands/rpc/#run-seed>`_.
[ "Sends", "a", "request", "with", "the", "method", "seed", "to", "the", "dbt", "RPC", "server", "and", "returns", "the", "response", ".", "For", "more", "details", "see", "the", "dbt", "docs", "for", "the", "RPC", "method", "seed", "<https", ":", "//", ...
def seed( self, show: bool = False, select: List[str] = None, exclude: List[str] = None, **kwargs ) -> DbtRpcOutput: """Sends a request with the method ``seed`` to the dbt RPC server, and returns the response. For more details, see the dbt docs for the RPC method `seed <https://docs....
[ "def", "seed", "(", "self", ",", "show", ":", "bool", "=", "False", ",", "select", ":", "List", "[", "str", "]", "=", "None", ",", "exclude", ":", "List", "[", "str", "]", "=", "None", ",", "*", "*", "kwargs", ")", "->", "DbtRpcOutput", ":", "d...
https://github.com/dagster-io/dagster/blob/b27d569d5fcf1072543533a0c763815d96f90b8f/python_modules/libraries/dagster-dbt/dagster_dbt/rpc/resources.py#L333-L355
goncalopp/simple-ocr-opencv
3af7530e5279cda2a8528cfbcbb57359eb20dd4f
simpleocr/segmentation_filters.py
python
SmallFilter._good_segments
(self, segments)
return good_width * good_height
[]
def _good_segments(self, segments): good_width = segments[:, 2] <= self.max_width good_height = segments[:, 3] <= self.max_height return good_width * good_height
[ "def", "_good_segments", "(", "self", ",", "segments", ")", ":", "good_width", "=", "segments", "[", ":", ",", "2", "]", "<=", "self", ".", "max_width", "good_height", "=", "segments", "[", ":", ",", "3", "]", "<=", "self", ".", "max_height", "return",...
https://github.com/goncalopp/simple-ocr-opencv/blob/3af7530e5279cda2a8528cfbcbb57359eb20dd4f/simpleocr/segmentation_filters.py#L56-L59
Telefonica/HomePWN
080398174159f856f4155dcb155c6754d1f85ad8
utils/opendrop/zeroconf.py
python
DNSText.__repr__
(self)
String representation
String representation
[ "String", "representation" ]
def __repr__(self): """String representation""" if len(self.text) > 10: return self.to_string(self.text[:7]) + "..." else: return self.to_string(self.text)
[ "def", "__repr__", "(", "self", ")", ":", "if", "len", "(", "self", ".", "text", ")", ">", "10", ":", "return", "self", ".", "to_string", "(", "self", ".", "text", "[", ":", "7", "]", ")", "+", "\"...\"", "else", ":", "return", "self", ".", "to...
https://github.com/Telefonica/HomePWN/blob/080398174159f856f4155dcb155c6754d1f85ad8/utils/opendrop/zeroconf.py#L583-L588
ninthDevilHAUNSTER/ArknightsAutoHelper
a27a930502d6e432368d9f62595a1d69a992f4e6
vendor/penguin_client/penguin_client/models/notice.py
python
Notice.to_str
(self)
return pprint.pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/ninthDevilHAUNSTER/ArknightsAutoHelper/blob/a27a930502d6e432368d9f62595a1d69a992f4e6/vendor/penguin_client/penguin_client/models/notice.py#L176-L178
DEAP/deap
2f63dcf6aaa341b8fe5d66d99e9e003a21312fef
deap/tools/selection.py
python
selEpsilonLexicase
(individuals, k, epsilon)
return selected_individuals
Returns an individual that does the best on the fitness cases when considered one at a time in random order. Requires a epsilon parameter. https://push-language.hampshire.edu/uploads/default/original/1X/35c30e47ef6323a0a949402914453f277fb1b5b0.pdf Implemented epsilon_y implementation. :param individual...
Returns an individual that does the best on the fitness cases when considered one at a time in random order. Requires a epsilon parameter. https://push-language.hampshire.edu/uploads/default/original/1X/35c30e47ef6323a0a949402914453f277fb1b5b0.pdf Implemented epsilon_y implementation.
[ "Returns", "an", "individual", "that", "does", "the", "best", "on", "the", "fitness", "cases", "when", "considered", "one", "at", "a", "time", "in", "random", "order", ".", "Requires", "a", "epsilon", "parameter", ".", "https", ":", "//", "push", "-", "l...
def selEpsilonLexicase(individuals, k, epsilon): """ Returns an individual that does the best on the fitness cases when considered one at a time in random order. Requires a epsilon parameter. https://push-language.hampshire.edu/uploads/default/original/1X/35c30e47ef6323a0a949402914453f277fb1b5b0.pdf ...
[ "def", "selEpsilonLexicase", "(", "individuals", ",", "k", ",", "epsilon", ")", ":", "selected_individuals", "=", "[", "]", "for", "i", "in", "range", "(", "k", ")", ":", "fit_weights", "=", "individuals", "[", "0", "]", ".", "fitness", ".", "weights", ...
https://github.com/DEAP/deap/blob/2f63dcf6aaa341b8fe5d66d99e9e003a21312fef/deap/tools/selection.py#L247-L281
IlyaGusev/rupo
83a5fac0dddd480a401181e5465f0e3c94ad2dcc
rupo/api.py
python
Engine.get_improved_markup
(self, text: str, language: str="ru")
return MetreClassifier.improve_markup(markup)
:param text: текст. :param language: язык. :return: его разметка по словарю, классификатору метру и ML классификатору.
:param text: текст. :param language: язык. :return: его разметка по словарю, классификатору метру и ML классификатору.
[ ":", "param", "text", ":", "текст", ".", ":", "param", "language", ":", "язык", ".", ":", "return", ":", "его", "разметка", "по", "словарю", "классификатору", "метру", "и", "ML", "классификатору", "." ]
def get_improved_markup(self, text: str, language: str="ru") -> Tuple[Markup, ClassificationResult]: """ :param text: текст. :param language: язык. :return: его разметка по словарю, классификатору метру и ML классификатору. """ markup = Markup.process_text(text, self.get...
[ "def", "get_improved_markup", "(", "self", ",", "text", ":", "str", ",", "language", ":", "str", "=", "\"ru\"", ")", "->", "Tuple", "[", "Markup", ",", "ClassificationResult", "]", ":", "markup", "=", "Markup", ".", "process_text", "(", "text", ",", "sel...
https://github.com/IlyaGusev/rupo/blob/83a5fac0dddd480a401181e5465f0e3c94ad2dcc/rupo/api.py#L115-L122
idanr1986/cuckoo-droid
1350274639473d3d2b0ac740cae133ca53ab7444
analyzer/android_on_linux/lib/api/androguard/jvm.py
python
JVMFormat.get_field_descriptor
(self, class_name, field_name, descriptor)
return None
Return the specific field @param class_name : the class name of the field @param field_name : the name of the field @param descriptor : the descriptor of the field @rtype: L{FieldInfo}
Return the specific field
[ "Return", "the", "specific", "field" ]
def get_field_descriptor(self, class_name, field_name, descriptor) : """ Return the specific field @param class_name : the class name of the field @param field_name : the name of the field @param descriptor : the descriptor of the field @rtype: L{Fie...
[ "def", "get_field_descriptor", "(", "self", ",", "class_name", ",", "field_name", ",", "descriptor", ")", ":", "# FIXME : handle multiple class name ?", "if", "class_name", "!=", "None", ":", "if", "class_name", "!=", "self", ".", "__CM", ".", "get_this_class_name",...
https://github.com/idanr1986/cuckoo-droid/blob/1350274639473d3d2b0ac740cae133ca53ab7444/analyzer/android_on_linux/lib/api/androguard/jvm.py#L3062-L3080
gpodder/mygpo
7a028ad621d05d4ca0d58fd22fb92656c8835e43
mygpo/maintenance/management/podcastcmd.py
python
random_podcasts
()
[]
def random_podcasts(): while True: yield Podcast.objects.all().random().first()
[ "def", "random_podcasts", "(", ")", ":", "while", "True", ":", "yield", "Podcast", ".", "objects", ".", "all", "(", ")", ".", "random", "(", ")", ".", "first", "(", ")" ]
https://github.com/gpodder/mygpo/blob/7a028ad621d05d4ca0d58fd22fb92656c8835e43/mygpo/maintenance/management/podcastcmd.py#L101-L103
dcos/dcos
79b9a39b4e639dc2c9435a869918399b50bfaf24
release/__init__.py
python
_get_global_builders
()
return res
Find builders defined globally
Find builders defined globally
[ "Find", "builders", "defined", "globally" ]
def _get_global_builders(): """Find builders defined globally """ res = {} for name in pkg_resources.resource_listdir('pkgpanda', DOCKERFILE_DIR): res[name] = pkg_resources.resource_filename('pkgpanda', DOCKERFILE_DIR + name) return res
[ "def", "_get_global_builders", "(", ")", ":", "res", "=", "{", "}", "for", "name", "in", "pkg_resources", ".", "resource_listdir", "(", "'pkgpanda'", ",", "DOCKERFILE_DIR", ")", ":", "res", "[", "name", "]", "=", "pkg_resources", ".", "resource_filename", "(...
https://github.com/dcos/dcos/blob/79b9a39b4e639dc2c9435a869918399b50bfaf24/release/__init__.py#L534-L542
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py
python
makeXMLTags
(tagStr)
return _makeTags( tagStr, True )
Helper to construct opening and closing tag expressions for XML, given a tag name. Matches tags only in the given upper/lower case. Example: similar to L{makeHTMLTags}
Helper to construct opening and closing tag expressions for XML, given a tag name. Matches tags only in the given upper/lower case.
[ "Helper", "to", "construct", "opening", "and", "closing", "tag", "expressions", "for", "XML", "given", "a", "tag", "name", ".", "Matches", "tags", "only", "in", "the", "given", "upper", "/", "lower", "case", "." ]
def makeXMLTags(tagStr): """ Helper to construct opening and closing tag expressions for XML, given a tag name. Matches tags only in the given upper/lower case. Example: similar to L{makeHTMLTags} """ return _makeTags( tagStr, True )
[ "def", "makeXMLTags", "(", "tagStr", ")", ":", "return", "_makeTags", "(", "tagStr", ",", "True", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py#L4882-L4889
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Ubuntu_13/paramiko/file.py
python
BufferedFile.read
(self, size=None)
return result
Read at most C{size} bytes from the file (less if we hit the end of the file first). If the C{size} argument is negative or omitted, read all the remaining data in the file. @param size: maximum number of bytes to read @type size: int @return: data read from the file, or an emp...
Read at most C{size} bytes from the file (less if we hit the end of the file first). If the C{size} argument is negative or omitted, read all the remaining data in the file.
[ "Read", "at", "most", "C", "{", "size", "}", "bytes", "from", "the", "file", "(", "less", "if", "we", "hit", "the", "end", "of", "the", "file", "first", ")", ".", "If", "the", "C", "{", "size", "}", "argument", "is", "negative", "or", "omitted", ...
def read(self, size=None): """ Read at most C{size} bytes from the file (less if we hit the end of the file first). If the C{size} argument is negative or omitted, read all the remaining data in the file. @param size: maximum number of bytes to read @type size: int ...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "_closed", ":", "raise", "IOError", "(", "'File is closed'", ")", "if", "not", "(", "self", ".", "_flags", "&", "self", ".", "FLAG_READ", ")", ":", "raise", "IOError",...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/paramiko/file.py#L111-L163
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/aifc.py
python
Aifc_write.setsampwidth
(self, sampwidth)
[]
def setsampwidth(self, sampwidth): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if sampwidth < 1 or sampwidth > 4: raise Error, 'bad sample width' self._sampwidth = sampwidth
[ "def", "setsampwidth", "(", "self", ",", "sampwidth", ")", ":", "if", "self", ".", "_nframeswritten", ":", "raise", "Error", ",", "'cannot change parameters after starting to write'", "if", "sampwidth", "<", "1", "or", "sampwidth", ">", "4", ":", "raise", "Error...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/aifc.py#L625-L630
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/traceback.py
python
format_exception
(etype, value, tb, limit = None)
return list
Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly th...
Format a stack trace and the exception information.
[ "Format", "a", "stack", "trace", "and", "the", "exception", "information", "." ]
def format_exception(etype, value, tb, limit = None): """Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. ...
[ "def", "format_exception", "(", "etype", ",", "value", ",", "tb", ",", "limit", "=", "None", ")", ":", "if", "tb", ":", "list", "=", "[", "'Traceback (most recent call last):\\n'", "]", "list", "=", "list", "+", "format_tb", "(", "tb", ",", "limit", ")",...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/traceback.py#L130-L145
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/inspect.py
python
_signature_get_partial
(wrapped_sig, partial, extra_args=())
return wrapped_sig.replace(parameters=new_params.values())
Private helper to calculate how 'wrapped_sig' signature will look like after applying a 'functools.partial' object (or alike) on it.
Private helper to calculate how 'wrapped_sig' signature will look like after applying a 'functools.partial' object (or alike) on it.
[ "Private", "helper", "to", "calculate", "how", "wrapped_sig", "signature", "will", "look", "like", "after", "applying", "a", "functools", ".", "partial", "object", "(", "or", "alike", ")", "on", "it", "." ]
def _signature_get_partial(wrapped_sig, partial, extra_args=()): """Private helper to calculate how 'wrapped_sig' signature will look like after applying a 'functools.partial' object (or alike) on it. """ old_params = wrapped_sig.parameters new_params = OrderedDict(old_params.items()) part...
[ "def", "_signature_get_partial", "(", "wrapped_sig", ",", "partial", ",", "extra_args", "=", "(", ")", ")", ":", "old_params", "=", "wrapped_sig", ".", "parameters", "new_params", "=", "OrderedDict", "(", "old_params", ".", "items", "(", ")", ")", "partial_arg...
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/inspect.py#L1675-L1748
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
tensorflow_dl_models/research/real_nvp/real_nvp_utils.py
python
max_pool_2x2
(input_)
return tf.nn.max_pool( input_, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding="SAME")
Max pooling.
Max pooling.
[ "Max", "pooling", "." ]
def max_pool_2x2(input_): """Max pooling.""" return tf.nn.max_pool( input_, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding="SAME")
[ "def", "max_pool_2x2", "(", "input_", ")", ":", "return", "tf", ".", "nn", ".", "max_pool", "(", "input_", ",", "ksize", "=", "[", "1", ",", "2", ",", "2", ",", "1", "]", ",", "strides", "=", "[", "1", ",", "2", ",", "2", ",", "1", "]", ","...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/real_nvp/real_nvp_utils.py#L128-L131
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/client/sources/resources/library_patches/uuid.py
python
UUID.get_clock_seq_hi_variant
(self)
return (self.int >> 56L) & 0xff
[]
def get_clock_seq_hi_variant(self): return (self.int >> 56L) & 0xff
[ "def", "get_clock_seq_hi_variant", "(", "self", ")", ":", "return", "(", "self", ".", "int", ">>", "56L", ")", "&", "0xff" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/client/sources/resources/library_patches/uuid.py#L238-L239
sqlmapproject/sqlmap
3b07b70864624dff4c29dcaa8a61c78e7f9189f7
lib/core/common.py
python
getAutoDirectories
()
return list(retVal)
>>> pushValue(kb.absFilePaths) >>> kb.absFilePaths = ["C:\\inetpub\\wwwroot\\index.asp", "/var/www/html"] >>> getAutoDirectories() ['C:/inetpub/wwwroot', '/var/www/html'] >>> kb.absFilePaths = popValue()
>>> pushValue(kb.absFilePaths) >>> kb.absFilePaths = ["C:\\inetpub\\wwwroot\\index.asp", "/var/www/html"] >>> getAutoDirectories() ['C:/inetpub/wwwroot', '/var/www/html'] >>> kb.absFilePaths = popValue()
[ ">>>", "pushValue", "(", "kb", ".", "absFilePaths", ")", ">>>", "kb", ".", "absFilePaths", "=", "[", "C", ":", "\\\\", "inetpub", "\\\\", "wwwroot", "\\\\", "index", ".", "asp", "/", "var", "/", "www", "/", "html", "]", ">>>", "getAutoDirectories", "()...
def getAutoDirectories(): """ >>> pushValue(kb.absFilePaths) >>> kb.absFilePaths = ["C:\\inetpub\\wwwroot\\index.asp", "/var/www/html"] >>> getAutoDirectories() ['C:/inetpub/wwwroot', '/var/www/html'] >>> kb.absFilePaths = popValue() """ retVal = OrderedSet() if kb.absFilePaths: ...
[ "def", "getAutoDirectories", "(", ")", ":", "retVal", "=", "OrderedSet", "(", ")", "if", "kb", ".", "absFilePaths", ":", "infoMsg", "=", "\"retrieved web server absolute paths: \"", "infoMsg", "+=", "\"'%s'\"", "%", "\", \"", ".", "join", "(", "ntToPosixSlashes", ...
https://github.com/sqlmapproject/sqlmap/blob/3b07b70864624dff4c29dcaa8a61c78e7f9189f7/lib/core/common.py#L879-L904
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/jinja2/filters.py
python
do_xmlattr
(_eval_ctx, d, autospace=True)
return rv
Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped: .. sourcecode:: html+jinja <ul{{ {'class': 'my_list', 'missing': none, 'id': 'list-%d'|format(variable)}|xmlattr }}> ... <...
Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped:
[ "Create", "an", "SGML", "/", "XML", "attribute", "string", "based", "on", "the", "items", "in", "a", "dict", ".", "All", "values", "that", "are", "neither", "none", "nor", "undefined", "are", "automatically", "escaped", ":" ]
def do_xmlattr(_eval_ctx, d, autospace=True): """Create an SGML/XML attribute string based on the items in a dict. All values that are neither `none` nor `undefined` are automatically escaped: .. sourcecode:: html+jinja <ul{{ {'class': 'my_list', 'missing': none, 'id': 'list-%d...
[ "def", "do_xmlattr", "(", "_eval_ctx", ",", "d", ",", "autospace", "=", "True", ")", ":", "rv", "=", "u' '", ".", "join", "(", "u'%s=\"%s\"'", "%", "(", "escape", "(", "key", ")", ",", "escape", "(", "value", ")", ")", "for", "key", ",", "value", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/jinja2/filters.py#L154-L186
oaubert/python-vlc
908ffdbd0844dc1849728c456e147788798c99da
generated/3.0/vlc.py
python
libvlc_media_player_get_full_chapter_descriptions
(p_mi, i_chapters_of_title, pp_chapters)
return f(p_mi, i_chapters_of_title, pp_chapters)
Get the full description of available chapters. @param p_mi: the media player. @param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1). @param pp_chapters: address to store an allocated array of chapter descriptions descriptions (must be freed with L{libvlc_cha...
Get the full description of available chapters.
[ "Get", "the", "full", "description", "of", "available", "chapters", "." ]
def libvlc_media_player_get_full_chapter_descriptions(p_mi, i_chapters_of_title, pp_chapters): '''Get the full description of available chapters. @param p_mi: the media player. @param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1). @param pp_chapters: add...
[ "def", "libvlc_media_player_get_full_chapter_descriptions", "(", "p_mi", ",", "i_chapters_of_title", ",", "pp_chapters", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_media_player_get_full_chapter_descriptions'", ",", "None", ")", "or", "_Cfunction", "(", ...
https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/3.0/vlc.py#L7161-L7172
learnables/cherry
80e78f8bb53c2e6bb8eece0ba74122e5d6d6216f
cherry/envs/logger_wrapper.py
python
Logger._episodes_length_rewards
(self, rewards, dones)
return episode_rewards, episode_lengths
When dealing with array rewards and dones (as for VecEnv) the length and rewards are only computed on the first dimension. (i.e. the first sub-process.)
When dealing with array rewards and dones (as for VecEnv) the length and rewards are only computed on the first dimension. (i.e. the first sub-process.)
[ "When", "dealing", "with", "array", "rewards", "and", "dones", "(", "as", "for", "VecEnv", ")", "the", "length", "and", "rewards", "are", "only", "computed", "on", "the", "first", "dimension", ".", "(", "i", ".", "e", ".", "the", "first", "sub", "-", ...
def _episodes_length_rewards(self, rewards, dones): """ When dealing with array rewards and dones (as for VecEnv) the length and rewards are only computed on the first dimension. (i.e. the first sub-process.) """ episode_rewards = [] episode_lengths = [] a...
[ "def", "_episodes_length_rewards", "(", "self", ",", "rewards", ",", "dones", ")", ":", "episode_rewards", "=", "[", "]", "episode_lengths", "=", "[", "]", "accum", "=", "0.0", "length", "=", "0", "for", "r", ",", "d", "in", "zip", "(", "rewards", ",",...
https://github.com/learnables/cherry/blob/80e78f8bb53c2e6bb8eece0ba74122e5d6d6216f/cherry/envs/logger_wrapper.py#L39-L64
Map-A-Droid/MAD
81375b5c9ccc5ca3161eb487aa81469d40ded221
mapadroid/worker/WorkerBase.py
python
WorkerBase.__init__
(self, args, dev_id, origin, last_known_state, communicator: AbstractCommunicator, mapping_manager: MappingManager, area_id: int, routemanager_name: str, db_wrapper: DbWrapper, pogo_window_manager: PogoWindows, walker=None, event=None)
[]
def __init__(self, args, dev_id, origin, last_known_state, communicator: AbstractCommunicator, mapping_manager: MappingManager, area_id: int, routemanager_name: str, db_wrapper: DbWrapper, pogo_window_manager: PogoWindows, walker=None, event=None): AbstractWork...
[ "def", "__init__", "(", "self", ",", "args", ",", "dev_id", ",", "origin", ",", "last_known_state", ",", "communicator", ":", "AbstractCommunicator", ",", "mapping_manager", ":", "MappingManager", ",", "area_id", ":", "int", ",", "routemanager_name", ":", "str",...
https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/worker/WorkerBase.py#L44-L102
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_openshift/library/oc_route.py
python
Yedit.file_exists
(self)
return False
return whether file exists
return whether file exists
[ "return", "whether", "file", "exists" ]
def file_exists(self): ''' return whether file exists ''' if os.path.exists(self.filename): return True return False
[ "def", "file_exists", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "filename", ")", ":", "return", "True", "return", "False" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_route.py#L451-L456
cgre-aachen/gempy
6ad16c46fc6616c9f452fba85d31ce32decd8b10
gempy/utils/meta.py
python
_setdoc
(docstring, indent=True, position='end')
return decor
Copy the doc of a function or method into the decorated function. Args: docstring: docstring of to be added indent: position: Returns:
Copy the doc of a function or method into the decorated function.
[ "Copy", "the", "doc", "of", "a", "function", "or", "method", "into", "the", "decorated", "function", "." ]
def _setdoc(docstring, indent=True, position='end'): """Copy the doc of a function or method into the decorated function. Args: docstring: docstring of to be added indent: position: Returns: """ if type(docstring) is list: try: docstring = '----'.join(d...
[ "def", "_setdoc", "(", "docstring", ",", "indent", "=", "True", ",", "position", "=", "'end'", ")", ":", "if", "type", "(", "docstring", ")", "is", "list", ":", "try", ":", "docstring", "=", "'----'", ".", "join", "(", "docstring", ")", "except", "Ty...
https://github.com/cgre-aachen/gempy/blob/6ad16c46fc6616c9f452fba85d31ce32decd8b10/gempy/utils/meta.py#L7-L44
jilljenn/tryalgo
46da31aea9a0ff58819e360c987f9506b21f6e9d
tryalgo/graph.py
python
extract_path
(prec, v)
return L[::-1]
extracts a path in form of vertex list from source to vertex v given a precedence table prec leading to the source :param prec: precedence table of a tree :param v: vertex on the tree :returns: path from root to v, in form of a list :complexity: linear
extracts a path in form of vertex list from source to vertex v given a precedence table prec leading to the source
[ "extracts", "a", "path", "in", "form", "of", "vertex", "list", "from", "source", "to", "vertex", "v", "given", "a", "precedence", "table", "prec", "leading", "to", "the", "source" ]
def extract_path(prec, v): """extracts a path in form of vertex list from source to vertex v given a precedence table prec leading to the source :param prec: precedence table of a tree :param v: vertex on the tree :returns: path from root to v, in form of a list :complexity: linear """ ...
[ "def", "extract_path", "(", "prec", ",", "v", ")", ":", "L", "=", "[", "]", "while", "v", "is", "not", "None", ":", "L", ".", "append", "(", "v", ")", "v", "=", "prec", "[", "v", "]", "assert", "v", "not", "in", "L", "# prevent infinite loops for...
https://github.com/jilljenn/tryalgo/blob/46da31aea9a0ff58819e360c987f9506b21f6e9d/tryalgo/graph.py#L313-L327
DeepRNN/image_captioning
ee6936c3a1a8872ae7b055cfc8762fa323b01412
model.py
python
CaptionGenerator.build_optimizer
(self)
Setup the optimizer and training operation.
Setup the optimizer and training operation.
[ "Setup", "the", "optimizer", "and", "training", "operation", "." ]
def build_optimizer(self): """ Setup the optimizer and training operation. """ config = self.config learning_rate = tf.constant(config.initial_learning_rate) if config.learning_rate_decay_factor < 1.0: def _learning_rate_decay_fn(learning_rate, global_step): ...
[ "def", "build_optimizer", "(", "self", ")", ":", "config", "=", "self", ".", "config", "learning_rate", "=", "tf", ".", "constant", "(", "config", ".", "initial_learning_rate", ")", "if", "config", ".", "learning_rate_decay_factor", "<", "1.0", ":", "def", "...
https://github.com/DeepRNN/image_captioning/blob/ee6936c3a1a8872ae7b055cfc8762fa323b01412/model.py#L461-L513
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_persistent_volume_claim_status.py
python
V1PersistentVolumeClaimStatus.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """ For `print` and `pprint` """ return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_persistent_volume_claim_status.py#L150-L154
fab-jul/imgcomp-cvpr
f03ce0bfa846f7ba1bf9b7ba415b082efe5c192c
code/inputpipeline.py
python
PathsDataset.from_paths_pickle_file
(paths_pickle_file)
[]
def from_paths_pickle_file(paths_pickle_file): if not paths_pickle_file.endswith('.pkl'): raise ValueError('Not a .pkl file: {}'.format(paths_pickle_file)) assert os.path.exists(paths_pickle_file) with tf.name_scope('pickle_input'): base_dir = os.path.dirname(paths_pickle...
[ "def", "from_paths_pickle_file", "(", "paths_pickle_file", ")", ":", "if", "not", "paths_pickle_file", ".", "endswith", "(", "'.pkl'", ")", ":", "raise", "ValueError", "(", "'Not a .pkl file: {}'", ".", "format", "(", "paths_pickle_file", ")", ")", "assert", "os",...
https://github.com/fab-jul/imgcomp-cvpr/blob/f03ce0bfa846f7ba1bf9b7ba415b082efe5c192c/code/inputpipeline.py#L111-L127
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/experimental/prefs/Preferences.py
python
Preferences._setupPage_Undo
(self)
return
Setup the "Undo" page.
Setup the "Undo" page.
[ "Setup", "the", "Undo", "page", "." ]
def _setupPage_Undo(self): """ Setup the "Undo" page. """ connect_checkbox_with_boolean_pref(self.undo_restore_view_CheckBox, undoRestoreView_prefs_key) connect_checkbox_with_boolean_pref( self.undo_automatic_checkpoints_Chec...
[ "def", "_setupPage_Undo", "(", "self", ")", ":", "connect_checkbox_with_boolean_pref", "(", "self", ".", "undo_restore_view_CheckBox", ",", "undoRestoreView_prefs_key", ")", "connect_checkbox_with_boolean_pref", "(", "self", ".", "undo_automatic_checkpoints_CheckBox", ",", "u...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/experimental/prefs/Preferences.py#L1779-L1790
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/plistlib.py
python
writePlistToResource
(rootObject, path, restype='plst', resid=0)
Write 'rootObject' as a plst resource to the resource fork of path.
Write 'rootObject' as a plst resource to the resource fork of path.
[ "Write", "rootObject", "as", "a", "plst", "resource", "to", "the", "resource", "fork", "of", "path", "." ]
def writePlistToResource(rootObject, path, restype='plst', resid=0): """Write 'rootObject' as a plst resource to the resource fork of path. """ warnings.warnpy3k("In 3.x, writePlistToResource is removed.", stacklevel=2) from Carbon.File import FSRef, FSGetResourceForkName from Carbon.Files import fs...
[ "def", "writePlistToResource", "(", "rootObject", ",", "path", ",", "restype", "=", "'plst'", ",", "resid", "=", "0", ")", ":", "warnings", ".", "warnpy3k", "(", "\"In 3.x, writePlistToResource is removed.\"", ",", "stacklevel", "=", "2", ")", "from", "Carbon", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/plistlib.py#L130-L148
NVIDIA/NeMo
5b0c0b4dec12d87d3cd960846de4105309ce938e
nemo/collections/asr/modules/rnnt_abstract.py
python
AbstractRNNTDecoder.initialize_state
(self, y: torch.Tensor)
Initialize the state of the RNN layers, with same dtype and device as input `y`. Args: y: A torch.Tensor whose device the generated states will be placed on. Returns: List of torch.Tensor, each of shape [L, B, H], where L = Number of RNN layers B...
Initialize the state of the RNN layers, with same dtype and device as input `y`.
[ "Initialize", "the", "state", "of", "the", "RNN", "layers", "with", "same", "dtype", "and", "device", "as", "input", "y", "." ]
def initialize_state(self, y: torch.Tensor) -> List[torch.Tensor]: """ Initialize the state of the RNN layers, with same dtype and device as input `y`. Args: y: A torch.Tensor whose device the generated states will be placed on. Returns: List of torch.Tensor, ea...
[ "def", "initialize_state", "(", "self", ",", "y", ":", "torch", ".", "Tensor", ")", "->", "List", "[", "torch", ".", "Tensor", "]", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/asr/modules/rnnt_abstract.py#L150-L163