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
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/permutation.py
python
Permutation.__str__
(self)
return repr(self)
TESTS:: sage: Permutations.options.display='list' sage: p = Permutation([2,1,3]) sage: str(p) '[2, 1, 3]' sage: Permutations.options.display='cycle' sage: str(p) '(1,2)' sage: Permutations.options.display='singleton' ...
TESTS::
[ "TESTS", "::" ]
def __str__(self) -> str: """ TESTS:: sage: Permutations.options.display='list' sage: p = Permutation([2,1,3]) sage: str(p) '[2, 1, 3]' sage: Permutations.options.display='cycle' sage: str(p) '(1,2)' sage: P...
[ "def", "__str__", "(", "self", ")", "->", "str", ":", "return", "repr", "(", "self", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/permutation.py#L588-L604
cisco/mindmeld
809c36112e9ea8019fe29d54d136ca14eb4fd8db
mindmeld/models/evaluation.py
python
ModelEvaluation._get_confusion_matrix_and_counts
(y_true, y_pred)
return { "confusion_matrix": confusion_mat, "counts_by_class": Counts(tp_arr, tn_arr, fp_arr, fn_arr), "counts_overall": Counts( sum(tp_arr), sum(tn_arr), sum(fp_arr), sum(fn_arr) ), }
Generates the confusion matrix where each element Cij is the number of observations known to be in group i predicted to be in group j Returns: dict: Contains 2d array of the confusion matrix, and an array of tp, tn, fp, fn values
Generates the confusion matrix where each element Cij is the number of observations known to be in group i predicted to be in group j
[ "Generates", "the", "confusion", "matrix", "where", "each", "element", "Cij", "is", "the", "number", "of", "observations", "known", "to", "be", "in", "group", "i", "predicted", "to", "be", "in", "group", "j" ]
def _get_confusion_matrix_and_counts(y_true, y_pred): """ Generates the confusion matrix where each element Cij is the number of observations known to be in group i predicted to be in group j Returns: dict: Contains 2d array of the confusion matrix, and an array of tp, tn, f...
[ "def", "_get_confusion_matrix_and_counts", "(", "y_true", ",", "y_pred", ")", ":", "confusion_mat", "=", "confusion_matrix", "(", "y_true", "=", "y_true", ",", "y_pred", "=", "y_pred", ")", "tp_arr", ",", "tn_arr", ",", "fp_arr", ",", "fn_arr", "=", "[", "]"...
https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/models/evaluation.py#L283-L328
sybrenstuvel/flickrapi
4de81d85dcdd73e4e1d19b112a0ff93feb0d10f7
flickrapi/cache.py
python
SimpleCache.cull
(self)
Reduces the number of cached items
Reduces the number of cached items
[ "Reduces", "the", "number", "of", "cached", "items" ]
def cull(self): """Reduces the number of cached items""" doomed = [k for (i, k) in enumerate(self.storage) if i % self.cull_frequency == 0] for k in doomed: self.delete(k)
[ "def", "cull", "(", "self", ")", ":", "doomed", "=", "[", "k", "for", "(", "i", ",", "k", ")", "in", "enumerate", "(", "self", ".", "storage", ")", "if", "i", "%", "self", ".", "cull_frequency", "==", "0", "]", "for", "k", "in", "doomed", ":", ...
https://github.com/sybrenstuvel/flickrapi/blob/4de81d85dcdd73e4e1d19b112a0ff93feb0d10f7/flickrapi/cache.py#L92-L98
deanishe/alfred-stackexchange
b2047b76165900d55f0c7d18fd7c40131bee94ed
src/workflow/workflow.py
python
Settings.__delitem__
(self, key)
Implement :class:`dict` interface.
Implement :class:`dict` interface.
[ "Implement", ":", "class", ":", "dict", "interface", "." ]
def __delitem__(self, key): """Implement :class:`dict` interface.""" super(Settings, self).__delitem__(key) self.save()
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "super", "(", "Settings", ",", "self", ")", ".", "__delitem__", "(", "key", ")", "self", ".", "save", "(", ")" ]
https://github.com/deanishe/alfred-stackexchange/blob/b2047b76165900d55f0c7d18fd7c40131bee94ed/src/workflow/workflow.py#L872-L875
biocore/qiime
76d633c0389671e93febbe1338b5ded658eba31f
qiime/denoiser/utils.py
python
store_clusters
(mapping, sff_fp, outdir="/tmp/", store_members=False)
Stores fasta and flogram file for each cluster.
Stores fasta and flogram file for each cluster.
[ "Stores", "fasta", "and", "flogram", "file", "for", "each", "cluster", "." ]
def store_clusters(mapping, sff_fp, outdir="/tmp/", store_members=False): """Stores fasta and flogram file for each cluster.""" # get mapping read to cluster invert_map = invert_mapping(mapping) (flowgrams, header) = lazy_parse_sff_handle(open(sff_fp)) leftover_fasta_fh = open(outdir + "/singleton...
[ "def", "store_clusters", "(", "mapping", ",", "sff_fp", ",", "outdir", "=", "\"/tmp/\"", ",", "store_members", "=", "False", ")", ":", "# get mapping read to cluster", "invert_map", "=", "invert_mapping", "(", "mapping", ")", "(", "flowgrams", ",", "header", ")"...
https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/denoiser/utils.py#L230-L269
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/sql/functions.py
python
FunctionElement.clauses
(self)
return self.clause_expr.element
Return the underlying :class:`.ClauseList` which contains the arguments for this :class:`.FunctionElement`.
Return the underlying :class:`.ClauseList` which contains the arguments for this :class:`.FunctionElement`.
[ "Return", "the", "underlying", ":", "class", ":", ".", "ClauseList", "which", "contains", "the", "arguments", "for", "this", ":", "class", ":", ".", "FunctionElement", "." ]
def clauses(self): """Return the underlying :class:`.ClauseList` which contains the arguments for this :class:`.FunctionElement`. """ return self.clause_expr.element
[ "def", "clauses", "(", "self", ")", ":", "return", "self", ".", "clause_expr", ".", "element" ]
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/sql/functions.py#L90-L95
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/workbench/ui/ui_workbench.py
python
UIWorkbench.run
(self)
Run the UI workbench application. This method will load the core and ui plugins and start the main application event loop. This is a blocking call which will return when the application event loop exits.
Run the UI workbench application.
[ "Run", "the", "UI", "workbench", "application", "." ]
def run(self): """ Run the UI workbench application. This method will load the core and ui plugins and start the main application event loop. This is a blocking call which will return when the application event loop exits. """ import enaml with enaml.imports(): ...
[ "def", "run", "(", "self", ")", ":", "import", "enaml", "with", "enaml", ".", "imports", "(", ")", ":", "from", "enaml", ".", "workbench", ".", "core", ".", "core_manifest", "import", "CoreManifest", "from", "enaml", ".", "workbench", ".", "ui", ".", "...
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/workbench/ui/ui_workbench.py#L24-L46
mlcommons/ck
558a22c5970eb0d6708d0edc080e62a92566bab0
ck/repo/module/mlperf/module.py
python
compare_experiments
(i)
return rdict
Input: { (cids[]) - up to 2 CIDs of entries to compare (interactive by default) (repo_uoa) - experiment repository ('*' by default) (extra_tags) - extra tags to search for CIDs } Output: { return - ...
Input: { (cids[]) - up to 2 CIDs of entries to compare (interactive by default) (repo_uoa) - experiment repository ('*' by default) (extra_tags) - extra tags to search for CIDs }
[ "Input", ":", "{", "(", "cids", "[]", ")", "-", "up", "to", "2", "CIDs", "of", "entries", "to", "compare", "(", "interactive", "by", "default", ")", "(", "repo_uoa", ")", "-", "experiment", "repository", "(", "*", "by", "default", ")", "(", "extra_ta...
def compare_experiments(i): """ Input: { (cids[]) - up to 2 CIDs of entries to compare (interactive by default) (repo_uoa) - experiment repository ('*' by default) (extra_tags) - extra tags to search for CIDs } Output: ...
[ "def", "compare_experiments", "(", "i", ")", ":", "cids", "=", "i", ".", "get", "(", "'cids'", ")", "repo_uoa", "=", "i", ".", "get", "(", "'repo_uoa'", ",", "'*'", ")", "extra_tags", "=", "i", ".", "get", "(", "'extra_tags'", ",", "'mlperf,accuracy'",...
https://github.com/mlcommons/ck/blob/558a22c5970eb0d6708d0edc080e62a92566bab0/ck/repo/module/mlperf/module.py#L177-L280
Jajcus/pyxmpp2
59e5fd7c8837991ac265dc6aad23a6bd256768a7
pyxmpp2/ext/muc/muccore.py
python
MucUserX.get_items
(self)
return ret
Get a list of objects describing the content of `self`. :return: the list of objects. :returntype: `list` of `MucItemBase` (`MucItem` and/or `MucStatus`)
Get a list of objects describing the content of `self`.
[ "Get", "a", "list", "of", "objects", "describing", "the", "content", "of", "self", "." ]
def get_items(self): """Get a list of objects describing the content of `self`. :return: the list of objects. :returntype: `list` of `MucItemBase` (`MucItem` and/or `MucStatus`) """ if not self.xmlnode.children: return [] ret=[] n=self.xmlnode.childre...
[ "def", "get_items", "(", "self", ")", ":", "if", "not", "self", ".", "xmlnode", ".", "children", ":", "return", "[", "]", "ret", "=", "[", "]", "n", "=", "self", ".", "xmlnode", ".", "children", "while", "n", ":", "ns", "=", "n", ".", "ns", "("...
https://github.com/Jajcus/pyxmpp2/blob/59e5fd7c8837991ac265dc6aad23a6bd256768a7/pyxmpp2/ext/muc/muccore.py#L491-L511
jiangxinyang227/NLP-Project
b11f67d8962f40e17990b4fc4551b0ea5496881c
multi_label_classifier/predictors/predict_base.py
python
PredictorBase.sentence_to_idx
(self, sentence)
创建数据对象 :return:
创建数据对象 :return:
[ "创建数据对象", ":", "return", ":" ]
def sentence_to_idx(self, sentence): """ 创建数据对象 :return: """ raise NotImplementedError
[ "def", "sentence_to_idx", "(", "self", ",", "sentence", ")", ":", "raise", "NotImplementedError" ]
https://github.com/jiangxinyang227/NLP-Project/blob/b11f67d8962f40e17990b4fc4551b0ea5496881c/multi_label_classifier/predictors/predict_base.py#L17-L22
m110/grafcli
5c5ba2cec7454703345e6d2efc478d354827379b
grafcli/documents.py
python
Panel.parent
(self)
return self._row
[]
def parent(self): return self._row
[ "def", "parent", "(", "self", ")", ":", "return", "self", ".", "_row" ]
https://github.com/m110/grafcli/blob/5c5ba2cec7454703345e6d2efc478d354827379b/grafcli/documents.py#L295-L296
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/asyncio/locks.py
python
Lock.release
(self)
Release a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. There is no return value.
Release a lock.
[ "Release", "a", "lock", "." ]
def release(self): """Release a lock. When the lock is locked, reset it to unlocked, and return. If any other coroutines are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. When invoked on an unlocked lock, a RuntimeError is raised. ...
[ "def", "release", "(", "self", ")", ":", "if", "self", ".", "_locked", ":", "self", ".", "_locked", "=", "False", "self", ".", "_wake_up_first", "(", ")", "else", ":", "raise", "RuntimeError", "(", "'Lock is not acquired.'", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/locks.py#L214-L229
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/requests/requests/packages/urllib3/poolmanager.py
python
PoolManager.connection_from_url
(self, url)
return self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor. Additional parameters are taken from the :class:`.PoolManager` constructor.
Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor.
[ "Similar", "to", ":", "func", ":", "urllib3", ".", "connectionpool", ".", "connection_from_url", "but", "doesn", "t", "pass", "any", "additional", "parameters", "to", "the", ":", "class", ":", "urllib3", ".", "connectionpool", ".", "ConnectionPool", "constructor...
def connection_from_url(self, url): """ Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor. Additional parameters are taken from the :class:`.PoolManager` ...
[ "def", "connection_from_url", "(", "self", ",", "url", ")", ":", "u", "=", "parse_url", "(", "url", ")", "return", "self", ".", "connection_from_host", "(", "u", ".", "host", ",", "port", "=", "u", ".", "port", ",", "scheme", "=", "u", ".", "scheme",...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/requests/requests/packages/urllib3/poolmanager.py#L129-L139
websauna/websauna
a57de54fb8a3fae859f24f373f0292e1e4b3c344
websauna/system/user/social.py
python
GoogleMapper.import_social_media_user
(self, user: authomatic.core.User)
return { "email": user.email, "first_name": user.first_name, "last_name": user.last_name, "full_name": user.name, "locale": user.locale, "picture": user.picture, "email_verified": user.email_verified, }
Map Authomatic user information to a dictionary. ref: http://peterhudec.github.io/authomatic/reference/providers.html#authomatic.providers.oauth2.Google :param user: A user returned by Authomatic. :return: Mapping from authomatic.core.User.
Map Authomatic user information to a dictionary.
[ "Map", "Authomatic", "user", "information", "to", "a", "dictionary", "." ]
def import_social_media_user(self, user: authomatic.core.User): """Map Authomatic user information to a dictionary. ref: http://peterhudec.github.io/authomatic/reference/providers.html#authomatic.providers.oauth2.Google :param user: A user returned by Authomatic. :return: Mapping from ...
[ "def", "import_social_media_user", "(", "self", ",", "user", ":", "authomatic", ".", "core", ".", "User", ")", ":", "return", "{", "\"email\"", ":", "user", ".", "email", ",", "\"first_name\"", ":", "user", ".", "first_name", ",", "\"last_name\"", ":", "us...
https://github.com/websauna/websauna/blob/a57de54fb8a3fae859f24f373f0292e1e4b3c344/websauna/system/user/social.py#L206-L222
microsoft/nlp-recipes
7db6d204e5116da07bb3c549df546e49cb7ab5a5
utils_nlp/models/transformers/abstractive_summarization_seq2seq.py
python
S2SAbstractiveSummarizer.predict
( self, test_dataset, per_gpu_batch_size=4, max_tgt_length=64, beam_size=1, need_score_traces=False, length_penalty=0, forbid_duplicate_ngrams=True, forbid_ignore_word=".", s2s_config=S2SConfig(), num_gpus=None, gpu_ids=None...
Method for predicting, i.e. generating summaries. Args: test_dataset (S2SAbsSumDataset): Testing dataset. per_gpu_batch_size (int, optional): Number of testing samples in each batch per GPU. Defaults to 4. max_tgt_length (int, optional): Maximum number of toke...
Method for predicting, i.e. generating summaries. Args: test_dataset (S2SAbsSumDataset): Testing dataset. per_gpu_batch_size (int, optional): Number of testing samples in each batch per GPU. Defaults to 4. max_tgt_length (int, optional): Maximum number of toke...
[ "Method", "for", "predicting", "i", ".", "e", ".", "generating", "summaries", ".", "Args", ":", "test_dataset", "(", "S2SAbsSumDataset", ")", ":", "Testing", "dataset", ".", "per_gpu_batch_size", "(", "int", "optional", ")", ":", "Number", "of", "testing", "...
def predict( self, test_dataset, per_gpu_batch_size=4, max_tgt_length=64, beam_size=1, need_score_traces=False, length_penalty=0, forbid_duplicate_ngrams=True, forbid_ignore_word=".", s2s_config=S2SConfig(), num_gpus=None, g...
[ "def", "predict", "(", "self", ",", "test_dataset", ",", "per_gpu_batch_size", "=", "4", ",", "max_tgt_length", "=", "64", ",", "beam_size", "=", "1", ",", "need_score_traces", "=", "False", ",", "length_penalty", "=", "0", ",", "forbid_duplicate_ngrams", "=",...
https://github.com/microsoft/nlp-recipes/blob/7db6d204e5116da07bb3c549df546e49cb7ab5a5/utils_nlp/models/transformers/abstractive_summarization_seq2seq.py#L778-L1053
nodesign/weio
1d67d705a5c36a2e825ad13feab910b0aca9a2e8
openWrt/files/usr/lib/python2.7/site-packages/tornado/log.py
python
LogFormatter.format
(self, record)
return formatted.replace("\n", "\n ")
[]
def format(self, record): try: record.message = record.getMessage() except Exception as e: record.message = "Bad message (%r): %r" % (e, record.__dict__) assert isinstance(record.message, basestring_type) # guaranteed by logging record.asctime = time.strftime( ...
[ "def", "format", "(", "self", ",", "record", ")", ":", "try", ":", "record", ".", "message", "=", "record", ".", "getMessage", "(", ")", "except", "Exception", "as", "e", ":", "record", ".", "message", "=", "\"Bad message (%r): %r\"", "%", "(", "e", ",...
https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/log.py#L104-L151
pydicom/pynetdicom
f57d8214c82b63c8e76638af43ce331f584a80fa
pynetdicom/ae.py
python
ApplicationEntity.acse_timeout
(self)
return self._acse_timeout
Get or set the ACSE timeout value (in seconds). Parameters ---------- value : Union[int, float, None] The maximum amount of time (in seconds) to wait for association related messages. A value of ``None`` means no timeout. (default: ``30``)
Get or set the ACSE timeout value (in seconds).
[ "Get", "or", "set", "the", "ACSE", "timeout", "value", "(", "in", "seconds", ")", "." ]
def acse_timeout(self) -> Optional[float]: """Get or set the ACSE timeout value (in seconds). Parameters ---------- value : Union[int, float, None] The maximum amount of time (in seconds) to wait for association related messages. A value of ``None`` means no time...
[ "def", "acse_timeout", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_acse_timeout" ]
https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/ae.py#L110-L120
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/modules/boss/module_manager/module_observer.py
python
ModuleObserver.proxy
(self)
return self._proxy
Returns a proxy of the remote object.
Returns a proxy of the remote object.
[ "Returns", "a", "proxy", "of", "the", "remote", "object", "." ]
def proxy(self): """Returns a proxy of the remote object.""" if not self._is_service_available: raise DBusObserverError("Service {} is not available." .format(self._service_name)) if not self._proxy: self._proxy = self._message_bus.get...
[ "def", "proxy", "(", "self", ")", ":", "if", "not", "self", ".", "_is_service_available", ":", "raise", "DBusObserverError", "(", "\"Service {} is not available.\"", ".", "format", "(", "self", ".", "_service_name", ")", ")", "if", "not", "self", ".", "_proxy"...
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/boss/module_manager/module_observer.py#L50-L60
soravux/scoop
3c0357c32cec3169a19c822a3857c968a48775c5
scoop/encapsulation.py
python
unpickleLambda
(pickled_callable)
return types.LambdaType(marshal.loads(pickled_callable), globals())
[]
def unpickleLambda(pickled_callable): # TODO: Set globals to user module return types.LambdaType(marshal.loads(pickled_callable), globals())
[ "def", "unpickleLambda", "(", "pickled_callable", ")", ":", "# TODO: Set globals to user module", "return", "types", ".", "LambdaType", "(", "marshal", ".", "loads", "(", "pickled_callable", ")", ",", "globals", "(", ")", ")" ]
https://github.com/soravux/scoop/blob/3c0357c32cec3169a19c822a3857c968a48775c5/scoop/encapsulation.py#L126-L128
devstructure/blueprint
574a9fc0dd3031c66970387f1105d8c89e61218f
blueprint/cli.py
python
create
(options, args)
Instantiate and return a Blueprint object from either standard input or by reverse-engineering the system.
Instantiate and return a Blueprint object from either standard input or by reverse-engineering the system.
[ "Instantiate", "and", "return", "a", "Blueprint", "object", "from", "either", "standard", "input", "or", "by", "reverse", "-", "engineering", "the", "system", "." ]
def create(options, args): """ Instantiate and return a Blueprint object from either standard input or by reverse-engineering the system. """ try: with context_managers.mkdtemp(): if not os.isatty(sys.stdin.fileno()): try: b = blueprint.Bluepr...
[ "def", "create", "(", "options", ",", "args", ")", ":", "try", ":", "with", "context_managers", ".", "mkdtemp", "(", ")", ":", "if", "not", "os", ".", "isatty", "(", "sys", ".", "stdin", ".", "fileno", "(", ")", ")", ":", "try", ":", "b", "=", ...
https://github.com/devstructure/blueprint/blob/574a9fc0dd3031c66970387f1105d8c89e61218f/blueprint/cli.py#L16-L44
xyz2tex/svg2tikz
8e56b5752de4b330a436b70e57ba55603232737a
svg2tikz/extensions/tikz_export.py
python
TikZPathExporter._convert_transform_to_tikz
(self, transform)
return options
Convert a SVG transform attribute to a list of TikZ transformations
Convert a SVG transform attribute to a list of TikZ transformations
[ "Convert", "a", "SVG", "transform", "attribute", "to", "a", "list", "of", "TikZ", "transformations" ]
def _convert_transform_to_tikz(self, transform): """Convert a SVG transform attribute to a list of TikZ transformations""" # return "" if not transform: return [] options = [] for cmd, params in transform: if cmd == 'translate': x, y = par...
[ "def", "_convert_transform_to_tikz", "(", "self", ",", "transform", ")", ":", "# return \"\"", "if", "not", "transform", ":", "return", "[", "]", "options", "=", "[", "]", "for", "cmd", ",", "params", "in", "transform", ":", "if", "cmd", "==", "'translate'...
https://github.com/xyz2tex/svg2tikz/blob/8e56b5752de4b330a436b70e57ba55603232737a/svg2tikz/extensions/tikz_export.py#L957-L988
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/core/expr/logical_expr.py
python
BooleanExpressionBase.clone
(self, substitute=None)
return clone_expression(self, substitute=substitute)
Return a clone of the expression tree. Note: This method does not clone the leaves of the tree, which are numeric constants and variables. It only clones the interior nodes, and expression leaf nodes like :class:`_MutableLinearExpression<pyomo.core.ex...
Return a clone of the expression tree.
[ "Return", "a", "clone", "of", "the", "expression", "tree", "." ]
def clone(self, substitute=None): """ Return a clone of the expression tree. Note: This method does not clone the leaves of the tree, which are numeric constants and variables. It only clones the interior nodes, and expression leaf nodes like ...
[ "def", "clone", "(", "self", ",", "substitute", "=", "None", ")", ":", "return", "clone_expression", "(", "self", ",", "substitute", "=", "substitute", ")" ]
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/core/expr/logical_expr.py#L607-L627
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/moosefs.py
python
fileinfo
(path)
return ret
Return information on a file located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.fileinfo /path/to/dir/
Return information on a file located on the Moose
[ "Return", "information", "on", "a", "file", "located", "on", "the", "Moose" ]
def fileinfo(path): """ Return information on a file located on the Moose CLI Example: .. code-block:: bash salt '*' moosefs.fileinfo /path/to/dir/ """ cmd = "mfsfileinfo " + path ret = {} chunknum = "" out = __salt__["cmd.run_all"](cmd, python_shell=False) output = o...
[ "def", "fileinfo", "(", "path", ")", ":", "cmd", "=", "\"mfsfileinfo \"", "+", "path", "ret", "=", "{", "}", "chunknum", "=", "\"\"", "out", "=", "__salt__", "[", "\"cmd.run_all\"", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "output", "="...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/moosefs.py#L47-L90
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/numpy/distutils/system_info.py
python
system_info.check_libs2
(self, lib_dirs, libs, opt_libs=[])
return info
If static or shared libraries are available then return their info dictionary. Checks each library for shared or static.
If static or shared libraries are available then return their info dictionary.
[ "If", "static", "or", "shared", "libraries", "are", "available", "then", "return", "their", "info", "dictionary", "." ]
def check_libs2(self, lib_dirs, libs, opt_libs=[]): """If static or shared libraries are available then return their info dictionary. Checks each library for shared or static. """ exts = self.library_extensions() info = self._check_libs(lib_dirs, libs, opt_libs, exts) ...
[ "def", "check_libs2", "(", "self", ",", "lib_dirs", ",", "libs", ",", "opt_libs", "=", "[", "]", ")", ":", "exts", "=", "self", ".", "library_extensions", "(", ")", "info", "=", "self", ".", "_check_libs", "(", "lib_dirs", ",", "libs", ",", "opt_libs",...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/numpy/distutils/system_info.py#L707-L718
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
thirdpart/shibboleth/views.py
python
ShibbolethView.get_context_data
(self, **kwargs)
return context
[]
def get_context_data(self, **kwargs): context = super(ShibbolethView, self).get_context_data(**kwargs) context['user'] = self.request.user return context
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "ShibbolethView", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "context", "[", "'user'", "]", "=", "self", ".", "reques...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/thirdpart/shibboleth/views.py#L40-L43
MISP/misp-modules
8ae64ba2640ff7150794068b63d80ab74bfa0856
misp_modules/modules/expansion/passivetotal.py
python
query_finder
(request)
Find the query value in the client request.
Find the query value in the client request.
[ "Find", "the", "query", "value", "in", "the", "client", "request", "." ]
def query_finder(request): """Find the query value in the client request.""" for item in mispattributes['input']: if not request.get(item, None): continue playbook = None for x in query_playbook: if item not in x['inputs']: continue pl...
[ "def", "query_finder", "(", "request", ")", ":", "for", "item", "in", "mispattributes", "[", "'input'", "]", ":", "if", "not", "request", ".", "get", "(", "item", ",", "None", ")", ":", "continue", "playbook", "=", "None", "for", "x", "in", "query_play...
https://github.com/MISP/misp-modules/blob/8ae64ba2640ff7150794068b63d80ab74bfa0856/misp_modules/modules/expansion/passivetotal.py#L52-L65
moble/quaternion
8f6fc306306c45f0bf79331a22ef3998e4d187bc
src/quaternion/quaternion_time_series.py
python
unflip_rotors
(q, axis=-1, inplace=False)
return quaternion.as_quat_array(f)
Flip signs of quaternions along axis to ensure continuity Quaternions form a "double cover" of the rotation group, meaning that if `q` represents a rotation, then `-q` represents the same rotation. This is clear from the way a quaternion is used to rotate a vector `v`: the rotated vector is `q * v * q...
Flip signs of quaternions along axis to ensure continuity
[ "Flip", "signs", "of", "quaternions", "along", "axis", "to", "ensure", "continuity" ]
def unflip_rotors(q, axis=-1, inplace=False): """Flip signs of quaternions along axis to ensure continuity Quaternions form a "double cover" of the rotation group, meaning that if `q` represents a rotation, then `-q` represents the same rotation. This is clear from the way a quaternion is used to rota...
[ "def", "unflip_rotors", "(", "q", ",", "axis", "=", "-", "1", ",", "inplace", "=", "False", ")", ":", "q", "=", "np", ".", "asarray", "(", "q", ",", "dtype", "=", "np", ".", "quaternion", ")", "ndim", "=", "q", ".", "ndim", "if", "abs", "(", ...
https://github.com/moble/quaternion/blob/8f6fc306306c45f0bf79331a22ef3998e4d187bc/src/quaternion/quaternion_time_series.py#L13-L58
Defense-Cyber-Crime-Center/DC3-MWCP
92f4be12e73d60673a5e9fa59694e75cc27b4edf
mwcp/resources/techanarchy_bridge.py
python
interpreter_path
()
return _interpreter_path
Returns the path for python interpreter, assuming it can be found. Because of various factors (including ability to override) this may not be accurate.
Returns the path for python interpreter, assuming it can be found. Because of various factors (including ability to override) this may not be accurate.
[ "Returns", "the", "path", "for", "python", "interpreter", "assuming", "it", "can", "be", "found", ".", "Because", "of", "various", "factors", "(", "including", "ability", "to", "override", ")", "this", "may", "not", "be", "accurate", "." ]
def interpreter_path(): """ Returns the path for python interpreter, assuming it can be found. Because of various factors (including ability to override) this may not be accurate. """ global _interpreter_path if not _interpreter_path: # first try sys.executable--this is reliable most of ...
[ "def", "interpreter_path", "(", ")", ":", "global", "_interpreter_path", "if", "not", "_interpreter_path", ":", "# first try sys.executable--this is reliable most of the time but", "# doesn't work when python is embedded, ex. using wsgi mod for web", "# server", "if", "\"python\"", "...
https://github.com/Defense-Cyber-Crime-Center/DC3-MWCP/blob/92f4be12e73d60673a5e9fa59694e75cc27b4edf/mwcp/resources/techanarchy_bridge.py#L340-L363
dabeaz/curio
27ccf4d130dd8c048e28bd15a22015bce3f55d53
curio/monitor.py
python
Monitor.interactive_loop
(self, sout, input_lines)
Main interactive loop of the monitor
Main interactive loop of the monitor
[ "Main", "interactive", "loop", "of", "the", "monitor" ]
def interactive_loop(self, sout, input_lines): ''' Main interactive loop of the monitor ''' sout.write('\nCurio Monitor: %d tasks running\n' % len(self.kernel._tasks)) sout.write('Type help for commands\n') while True: sout.write('curio > ') sout.f...
[ "def", "interactive_loop", "(", "self", ",", "sout", ",", "input_lines", ")", ":", "sout", ".", "write", "(", "'\\nCurio Monitor: %d tasks running\\n'", "%", "len", "(", "self", ".", "kernel", ".", "_tasks", ")", ")", "sout", ".", "write", "(", "'Type help f...
https://github.com/dabeaz/curio/blob/27ccf4d130dd8c048e28bd15a22015bce3f55d53/curio/monitor.py#L199-L244
cuemacro/findatapy
8ce72b17cc4dd3e3f53f0ab8adf58b6eeae29c10
findatapy/market/datavendorweb.py
python
Fred.__do_series_search
(self, url)
return data, num_results_total
Helper function for making one HTTP request for data, and parsing the returned results into a DataFrame
Helper function for making one HTTP request for data, and parsing the returned results into a DataFrame
[ "Helper", "function", "for", "making", "one", "HTTP", "request", "for", "data", "and", "parsing", "the", "returned", "results", "into", "a", "DataFrame" ]
def __do_series_search(self, url): """Helper function for making one HTTP request for data, and parsing the returned results into a DataFrame """ root = self.__fetch_data(url) series_ids = [] data = {} num_results_returned = 0 # number of results returned in this HTTP ...
[ "def", "__do_series_search", "(", "self", ",", "url", ")", ":", "root", "=", "self", ".", "__fetch_data", "(", "url", ")", "series_ids", "=", "[", "]", "data", "=", "{", "}", "num_results_returned", "=", "0", "# number of results returned in this HTTP request", ...
https://github.com/cuemacro/findatapy/blob/8ce72b17cc4dd3e3f53f0ab8adf58b6eeae29c10/findatapy/market/datavendorweb.py#L2238-L2270
levlaz/braindump
9640dd03f99851dbd34dd6cac98a747a4a591b01
app/models.py
python
User.get_deleted_notes
(self)
return list(filter(lambda note: note.is_deleted, self.notes))
Return all notes owned by this user that are in the trash.
Return all notes owned by this user that are in the trash.
[ "Return", "all", "notes", "owned", "by", "this", "user", "that", "are", "in", "the", "trash", "." ]
def get_deleted_notes(self): """ Return all notes owned by this user that are in the trash.""" return list(filter(lambda note: note.is_deleted, self.notes))
[ "def", "get_deleted_notes", "(", "self", ")", ":", "return", "list", "(", "filter", "(", "lambda", "note", ":", "note", ".", "is_deleted", ",", "self", ".", "notes", ")", ")" ]
https://github.com/levlaz/braindump/blob/9640dd03f99851dbd34dd6cac98a747a4a591b01/app/models.py#L68-L70
peterdsharpe/AeroSandbox
ded68b0465f2bfdcaf4bc90abd8c91be0addcaba
aerosandbox/numpy/array.py
python
length
(array)
Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality. Args: array: Returns:
Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality. Args: array:
[ "Returns", "the", "length", "of", "an", "1D", "-", "array", "-", "like", "object", ".", "An", "extension", "of", "len", "()", "with", "slightly", "different", "functionality", ".", "Args", ":", "array", ":" ]
def length(array) -> int: """ Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality. Args: array: Returns: """ if not is_casadi_type(array): try: return len(array) except TypeError: return 1 ...
[ "def", "length", "(", "array", ")", "->", "int", ":", "if", "not", "is_casadi_type", "(", "array", ")", ":", "try", ":", "return", "len", "(", "array", ")", "except", "TypeError", ":", "return", "1", "else", ":", "if", "array", ".", "shape", "[", "...
https://github.com/peterdsharpe/AeroSandbox/blob/ded68b0465f2bfdcaf4bc90abd8c91be0addcaba/aerosandbox/numpy/array.py#L109-L128
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/openhome/media_player.py
python
OpenhomeDevice.is_volume_muted
(self)
return self._volume_muted
Return true if volume is muted.
Return true if volume is muted.
[ "Return", "true", "if", "volume", "is", "muted", "." ]
def is_volume_muted(self): """Return true if volume is muted.""" return self._volume_muted
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_volume_muted" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/openhome/media_player.py#L300-L302
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/axes/_base.py
python
_AxesBase.get_data_ratio
(self)
return ysize / xsize
Returns the aspect ratio of the raw data. This method is intended to be overridden by new projection types.
Returns the aspect ratio of the raw data.
[ "Returns", "the", "aspect", "ratio", "of", "the", "raw", "data", "." ]
def get_data_ratio(self): """ Returns the aspect ratio of the raw data. This method is intended to be overridden by new projection types. """ xmin, xmax = self.get_xbound() ymin, ymax = self.get_ybound() xsize = max(abs(xmax - xmin), 1e-30) ysize...
[ "def", "get_data_ratio", "(", "self", ")", ":", "xmin", ",", "xmax", "=", "self", ".", "get_xbound", "(", ")", "ymin", ",", "ymax", "=", "self", ".", "get_ybound", "(", ")", "xsize", "=", "max", "(", "abs", "(", "xmax", "-", "xmin", ")", ",", "1e...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/axes/_base.py#L1415-L1428
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/codeintel2/tree_php.py
python
PHPTreeEvaluator._calltip_from_class
(self, node, scoperef)
[]
def _calltip_from_class(self, node, scoperef): # If the class has a defined signature then use that. signature = node.get("signature") doc = node.get("doc") if signature: ctlines = signature.splitlines(0) if doc: ctlines += doc.splitlines(0) ...
[ "def", "_calltip_from_class", "(", "self", ",", "node", ",", "scoperef", ")", ":", "# If the class has a defined signature then use that.", "signature", "=", "node", ".", "get", "(", "\"signature\"", ")", "doc", "=", "node", ".", "get", "(", "\"doc\"", ")", "if"...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/tree_php.py#L687-L732
shiyanhui/FileHeader
f347cc134021fb0b710694b71c57742476f5fd2b
jinja2/environment.py
python
Environment.iter_extensions
(self)
return iter(sorted(self.extensions.values(), key=lambda x: x.priority))
Iterates over the extensions by priority.
Iterates over the extensions by priority.
[ "Iterates", "over", "the", "extensions", "by", "priority", "." ]
def iter_extensions(self): """Iterates over the extensions by priority.""" return iter(sorted(self.extensions.values(), key=lambda x: x.priority))
[ "def", "iter_extensions", "(", "self", ")", ":", "return", "iter", "(", "sorted", "(", "self", ".", "extensions", ".", "values", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", ".", "priority", ")", ")" ]
https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/jinja2/environment.py#L370-L373
webpy/webpy.github.com
c6ccc32b6581edcc1b3e5991ad8cc30df14b5632
static/web-0.138.py
python
changequery
(**kw)
return out
Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return `/foo?a=3&b=2` -- the same URL but with the arguments you requested changed.
Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return `/foo?a=3&b=2` -- the same URL but with the arguments you requested changed.
[ "Imagine", "you", "re", "at", "/", "foo?a", "=", "1&b", "=", "2", ".", "Then", "changequery", "(", "a", "=", "3", ")", "will", "return", "/", "foo?a", "=", "3&b", "=", "2", "--", "the", "same", "URL", "but", "with", "the", "arguments", "you", "re...
def changequery(**kw): """ Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return `/foo?a=3&b=2` -- the same URL but with the arguments you requested changed. """ query = input(_method='get') for k, v in kw.iteritems(): if v is None: query.pop(k, None) ...
[ "def", "changequery", "(", "*", "*", "kw", ")", ":", "query", "=", "input", "(", "_method", "=", "'get'", ")", "for", "k", ",", "v", "in", "kw", ".", "iteritems", "(", ")", ":", "if", "v", "is", "None", ":", "query", ".", "pop", "(", "k", ","...
https://github.com/webpy/webpy.github.com/blob/c6ccc32b6581edcc1b3e5991ad8cc30df14b5632/static/web-0.138.py#L1762-L1777
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/core/djangoapps/xblock/runtime/shims.py
python
RuntimeShim.replace_jump_to_id_urls
(self, html_str)
return html_str
Replace /jump_to_id/ URLs in the HTML with expanded versions. See common/djangoapps/static_replace/__init__.py
Replace /jump_to_id/ URLs in the HTML with expanded versions. See common/djangoapps/static_replace/__init__.py
[ "Replace", "/", "jump_to_id", "/", "URLs", "in", "the", "HTML", "with", "expanded", "versions", ".", "See", "common", "/", "djangoapps", "/", "static_replace", "/", "__init__", ".", "py" ]
def replace_jump_to_id_urls(self, html_str): """ Replace /jump_to_id/ URLs in the HTML with expanded versions. See common/djangoapps/static_replace/__init__.py """ # TODO: implement or deprecate. # See also the version in openedx/core/lib/xblock_utils/__init__.py ...
[ "def", "replace_jump_to_id_urls", "(", "self", ",", "html_str", ")", ":", "# TODO: implement or deprecate.", "# See also the version in openedx/core/lib/xblock_utils/__init__.py", "return", "html_str" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/xblock/runtime/shims.py#L212-L219
anki/vector-python-sdk
d61fdb07c6278deba750f987b20441fff2df865f
examples/apps/proximity_mapper/lib/proximity_mapper_state.py
python
MapState._render_points
(cls, point_list: List[Vector3], size: float, color: List[float])
Draws a collection of points in the OpenGL 3D worldspace. This function must be invoked inside the OpenGL render loop. :param point_list: the points to render in the view context :param size: the size in pixels of each point :param color: the color to render the points
Draws a collection of points in the OpenGL 3D worldspace.
[ "Draws", "a", "collection", "of", "points", "in", "the", "OpenGL", "3D", "worldspace", "." ]
def _render_points(cls, point_list: List[Vector3], size: float, color: List[float]): """Draws a collection of points in the OpenGL 3D worldspace. This function must be invoked inside the OpenGL render loop. :param point_list: the points to render in the view context :param size: the si...
[ "def", "_render_points", "(", "cls", ",", "point_list", ":", "List", "[", "Vector3", "]", ",", "size", ":", "float", ",", "color", ":", "List", "[", "float", "]", ")", ":", "glPointSize", "(", "size", ")", "cls", ".", "_set_color", "(", "color", ")",...
https://github.com/anki/vector-python-sdk/blob/d61fdb07c6278deba750f987b20441fff2df865f/examples/apps/proximity_mapper/lib/proximity_mapper_state.py#L208-L222
xiaofengShi/CHINESE-OCR
46395d14802d876adc0ee0c943621d6b4e3ddf3a
ctpn/lib/roi_data_layer/minibatch.py
python
_vis_minibatch
(im_blob, rois_blob, labels_blob, overlaps)
Visualize a mini-batch for debugging.
Visualize a mini-batch for debugging.
[ "Visualize", "a", "mini", "-", "batch", "for", "debugging", "." ]
def _vis_minibatch(im_blob, rois_blob, labels_blob, overlaps): """Visualize a mini-batch for debugging.""" import matplotlib.pyplot as plt for i in range(rois_blob.shape[0]): rois = rois_blob[i, :] im_ind = rois[0] roi = rois[1:] im = im_blob[im_ind, :, :, :].transpose((1, 2,...
[ "def", "_vis_minibatch", "(", "im_blob", ",", "rois_blob", ",", "labels_blob", ",", "overlaps", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "for", "i", "in", "range", "(", "rois_blob", ".", "shape", "[", "0", "]", ")", ":", "rois", "=...
https://github.com/xiaofengShi/CHINESE-OCR/blob/46395d14802d876adc0ee0c943621d6b4e3ddf3a/ctpn/lib/roi_data_layer/minibatch.py#L187-L209
androguard/androguard
8d091cbb309c0c50bf239f805cc1e0931b8dcddc
androguard/core/analysis/auto.py
python
DefaultAndroAnalysis.analysis_axml
(self, log, axmlobj)
return True
This method is called in order to know if the analysis must continue :param log: an object which corresponds to a unique app :param androguard.core.bytecodes.axml.AXMLPrinter axmlobj: a :class:`AXMLPrinter` object :returns: True if the analysis should continue afterwards :rtype: bool
This method is called in order to know if the analysis must continue
[ "This", "method", "is", "called", "in", "order", "to", "know", "if", "the", "analysis", "must", "continue" ]
def analysis_axml(self, log, axmlobj): """ This method is called in order to know if the analysis must continue :param log: an object which corresponds to a unique app :param androguard.core.bytecodes.axml.AXMLPrinter axmlobj: a :class:`AXMLPrinter` object :returns: True if the...
[ "def", "analysis_axml", "(", "self", ",", "log", ",", "axmlobj", ")", ":", "return", "True" ]
https://github.com/androguard/androguard/blob/8d091cbb309c0c50bf239f805cc1e0931b8dcddc/androguard/core/analysis/auto.py#L305-L315
zhaoweicai/Detectron-Cascade-RCNN
5a297fcc16eab6c26b7b1a9fe2767c626730f03b
detectron/modeling/model_builder.py
python
_add_roi_mask_head
( model, add_roi_mask_head_func, blob_in, dim_in, spatial_scale_in )
return loss_gradients
Add a mask prediction head to the model.
Add a mask prediction head to the model.
[ "Add", "a", "mask", "prediction", "head", "to", "the", "model", "." ]
def _add_roi_mask_head( model, add_roi_mask_head_func, blob_in, dim_in, spatial_scale_in ): """Add a mask prediction head to the model.""" # Capture model graph before adding the mask head bbox_net = copy.deepcopy(model.net.Proto()) # Add the mask head blob_mask_head, dim_mask_head = add_roi_mas...
[ "def", "_add_roi_mask_head", "(", "model", ",", "add_roi_mask_head_func", ",", "blob_in", ",", "dim_in", ",", "spatial_scale_in", ")", ":", "# Capture model graph before adding the mask head", "bbox_net", "=", "copy", ".", "deepcopy", "(", "model", ".", "net", ".", ...
https://github.com/zhaoweicai/Detectron-Cascade-RCNN/blob/5a297fcc16eab6c26b7b1a9fe2767c626730f03b/detectron/modeling/model_builder.py#L337-L364
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/sqli/plugins/generic/users.py
python
Users.getUsers
(self)
return kb.data.cachedUsers
[]
def getUsers(self): infoMsg = "fetching database users" logger.info(infoMsg) rootQuery = queries[Backend.getIdentifiedDbms()].users condition = (Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008"))) condition |= (Backend.isDbms(DBMS.MYSQL) and not kb.data.ha...
[ "def", "getUsers", "(", "self", ")", ":", "infoMsg", "=", "\"fetching database users\"", "logger", ".", "info", "(", "infoMsg", ")", "rootQuery", "=", "queries", "[", "Backend", ".", "getIdentifiedDbms", "(", ")", "]", ".", "users", "condition", "=", "(", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/plugins/generic/users.py#L87-L146
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/bitbake/lib/pyinotify.py
python
_RawEvent.__init__
(self, wd, mask, cookie, name)
@param wd: Watch Descriptor. @type wd: int @param mask: Bitmask of events. @type mask: int @param cookie: Cookie. @type cookie: int @param name: Basename of the file or directory against which the event was raised in case where the watched directory ...
[]
def __init__(self, wd, mask, cookie, name): """ @param wd: Watch Descriptor. @type wd: int @param mask: Bitmask of events. @type mask: int @param cookie: Cookie. @type cookie: int @param name: Basename of the file or directory against which the ...
[ "def", "__init__", "(", "self", ",", "wd", ",", "mask", ",", "cookie", ",", "name", ")", ":", "# Use this variable to cache the result of str(self), this object", "# is immutable.", "self", ".", "_str", "=", "None", "# name: remove trailing '\\0'", "d", "=", "{", "'...
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/bitbake/lib/pyinotify.py#L494-L517
iTechArt/convtools-ita
25c1057e20581d957bec1339758325dc98fec43e
src/convtools/aggregations.py
python
BaseDictReducer.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # for backward compatibility with versions <= 0.8 if len(self.expressions) == 1: expr = self.expressions[0] if isinstance(expr, (Tuple, List)) and len(expr.items) == 2: self.expressions...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "# for backward compatibility with versions <= 0.8", "if", "len", "(", "self", ".", ...
https://github.com/iTechArt/convtools-ita/blob/25c1057e20581d957bec1339758325dc98fec43e/src/convtools/aggregations.py#L994-L1002
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/algebras/quaternion.py
python
Quaternion.add
(self, other)
return Quaternion(q1.a + q2.a, q1.b + q2.b, q1.c + q2.c, q1.d + q2.d)
Adds quaternions. Parameters ========== other : Quaternion The quaternion to add to current (self) quaternion. Returns ======= Quaternion The resultant quaternion after adding self to other Examples ======== >>> from s...
Adds quaternions.
[ "Adds", "quaternions", "." ]
def add(self, other): """Adds quaternions. Parameters ========== other : Quaternion The quaternion to add to current (self) quaternion. Returns ======= Quaternion The resultant quaternion after adding self to other Examples ...
[ "def", "add", "(", "self", ",", "other", ")", ":", "q1", "=", "self", "q2", "=", "sympify", "(", "other", ")", "# If q2 is a number or a SymPy expression instead of a quaternion", "if", "not", "isinstance", "(", "q2", ",", "Quaternion", ")", ":", "if", "q1", ...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/algebras/quaternion.py#L210-L262
box/box-python-sdk
e8abbb515cfe77d9533df77c807d55d6b494ceaa
boxsdk/client/client.py
python
Client.file
(self, file_id: str)
return self.translator.get('file')(session=self._session, object_id=file_id)
Initialize a :class:`File` object, whose box id is file_id. :param file_id: The box id of the :class:`File` object. :return: A :class:`File` object with the given file id.
Initialize a :class:`File` object, whose box id is file_id.
[ "Initialize", "a", ":", "class", ":", "File", "object", "whose", "box", "id", "is", "file_id", "." ]
def file(self, file_id: str) -> 'File': """ Initialize a :class:`File` object, whose box id is file_id. :param file_id: The box id of the :class:`File` object. :return: A :class:`File` object with the given file id. """ return self.translator.get(...
[ "def", "file", "(", "self", ",", "file_id", ":", "str", ")", "->", "'File'", ":", "return", "self", ".", "translator", ".", "get", "(", "'file'", ")", "(", "session", "=", "self", ".", "_session", ",", "object_id", "=", "file_id", ")" ]
https://github.com/box/box-python-sdk/blob/e8abbb515cfe77d9533df77c807d55d6b494ceaa/boxsdk/client/client.py#L118-L127
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
stock2/ctp/ApiStruct.py
python
QryPartBroker.__init__
(self, ExchangeID='', BrokerID='', ParticipantID='')
[]
def __init__(self, ExchangeID='', BrokerID='', ParticipantID=''): self.ExchangeID = '' #交易所代码, char[9] self.BrokerID = '' #经纪公司代码, char[11] self.ParticipantID = ''
[ "def", "__init__", "(", "self", ",", "ExchangeID", "=", "''", ",", "BrokerID", "=", "''", ",", "ParticipantID", "=", "''", ")", ":", "self", ".", "ExchangeID", "=", "''", "#交易所代码, char[9]", "self", ".", "BrokerID", "=", "''", "#经纪公司代码, char[11]", "self", ...
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/stock2/ctp/ApiStruct.py#L2552-L2555
kamalkraj/ALBERT-TF2.0
8d0cc211361e81a648bf846d8ec84225273db0e4
classifier_data_lib.py
python
XnliProcessor.get_processor_name
()
return "XNLI"
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_processor_name(): """See base class.""" return "XNLI"
[ "def", "get_processor_name", "(", ")", ":", "return", "\"XNLI\"" ]
https://github.com/kamalkraj/ALBERT-TF2.0/blob/8d0cc211361e81a648bf846d8ec84225273db0e4/classifier_data_lib.py#L166-L168
jhpyle/docassemble
b90c84e57af59aa88b3404d44d0b125c70f832cc
docassemble_base/docassemble/base/util.py
python
ocr_page
(indexno, doc=None, lang=None, pdf_to_ppm='pdf_to_ppm', ocr_resolution=300, psm=6, page=None, x=None, y=None, W=None, H=None, user_code=None, user=None, pdf=False, preserve_color=False)
return dict(indexno=indexno, page=page, text=text)
Runs optical character recognition on an image or a page of a PDF file and returns the recognized text.
Runs optical character recognition on an image or a page of a PDF file and returns the recognized text.
[ "Runs", "optical", "character", "recognition", "on", "an", "image", "or", "a", "page", "of", "a", "PDF", "file", "and", "returns", "the", "recognized", "text", "." ]
def ocr_page(indexno, doc=None, lang=None, pdf_to_ppm='pdf_to_ppm', ocr_resolution=300, psm=6, page=None, x=None, y=None, W=None, H=None, user_code=None, user=None, pdf=False, preserve_color=False): """Runs optical character recognition on an image or a page of a PDF file and returns the recognized text.""" if ...
[ "def", "ocr_page", "(", "indexno", ",", "doc", "=", "None", ",", "lang", "=", "None", ",", "pdf_to_ppm", "=", "'pdf_to_ppm'", ",", "ocr_resolution", "=", "300", ",", "psm", "=", "6", ",", "page", "=", "None", ",", "x", "=", "None", ",", "y", "=", ...
https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/util.py#L8757-L8829
BerkeleyAutomation/dex-net
cccf93319095374b0eefc24b8b6cd40bc23966d2
src/dexnet/grasping/collision_checker.py
python
OpenRaveCollisionChecker._setup_rave_env
()
OpenRave environment
OpenRave environment
[ "OpenRave", "environment" ]
def _setup_rave_env(): """ OpenRave environment """ OpenRaveCollisionChecker.env_ = rave.Environment()
[ "def", "_setup_rave_env", "(", ")", ":", "OpenRaveCollisionChecker", ".", "env_", "=", "rave", ".", "Environment", "(", ")" ]
https://github.com/BerkeleyAutomation/dex-net/blob/cccf93319095374b0eefc24b8b6cd40bc23966d2/src/dexnet/grasping/collision_checker.py#L212-L214
rosedu/wouso
82fd175354432d29b6623c150d5d82c4fe5260de
wouso/core/qpool/models.py
python
Question.answers
(self)
return self.answer_set.filter(active=True)
A list of all active answers
A list of all active answers
[ "A", "list", "of", "all", "active", "answers" ]
def answers(self): """ A list of all active answers """ return self.answer_set.filter(active=True)
[ "def", "answers", "(", "self", ")", ":", "return", "self", ".", "answer_set", ".", "filter", "(", "active", "=", "True", ")" ]
https://github.com/rosedu/wouso/blob/82fd175354432d29b6623c150d5d82c4fe5260de/wouso/core/qpool/models.py#L91-L93
coreemu/core
7e18a7a72023a69a92ad61d87461bd659ba27f7c
daemon/core/api/grpc/server.py
python
CoreGrpcServer.EditLink
( self, request: core_pb2.EditLinkRequest, context: ServicerContext )
return core_pb2.EditLinkResponse(result=True)
Edit a link :param request: edit-link request :param context: context object :return: edit-link response
Edit a link
[ "Edit", "a", "link" ]
def EditLink( self, request: core_pb2.EditLinkRequest, context: ServicerContext ) -> core_pb2.EditLinkResponse: """ Edit a link :param request: edit-link request :param context: context object :return: edit-link response """ logging.debug("edit link: ...
[ "def", "EditLink", "(", "self", ",", "request", ":", "core_pb2", ".", "EditLinkRequest", ",", "context", ":", "ServicerContext", ")", "->", "core_pb2", ".", "EditLinkResponse", ":", "logging", ".", "debug", "(", "\"edit link: %s\"", ",", "request", ")", "sessi...
https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/api/grpc/server.py#L948-L992
mattloper/chumpy
8c777ce1650a0c48dc74c43bd8b7b3176ebcd8f9
chumpy/optimization_internal.py
python
ChInputsStacked.dr_wrt
(self, wrt, profiler=None)
Loop over free variables and delete cache for the whole tree after finished each one
Loop over free variables and delete cache for the whole tree after finished each one
[ "Loop", "over", "free", "variables", "and", "delete", "cache", "for", "the", "whole", "tree", "after", "finished", "each", "one" ]
def dr_wrt(self, wrt, profiler=None): ''' Loop over free variables and delete cache for the whole tree after finished each one ''' if wrt is self.x: jacs = [] for fvi, freevar in enumerate(self.free_variables): tm = timer() if isins...
[ "def", "dr_wrt", "(", "self", ",", "wrt", ",", "profiler", "=", "None", ")", ":", "if", "wrt", "is", "self", ".", "x", ":", "jacs", "=", "[", "]", "for", "fvi", ",", "freevar", "in", "enumerate", "(", "self", ".", "free_variables", ")", ":", "tm"...
https://github.com/mattloper/chumpy/blob/8c777ce1650a0c48dc74c43bd8b7b3176ebcd8f9/chumpy/optimization_internal.py#L34-L71
log2timeline/plaso
fe2e316b8c76a0141760c0f2f181d84acb83abc2
plaso/preprocessors/manager.py
python
FileSystemWinRegistryFileReader.Open
(self, path, ascii_codepage='cp1252')
return self._OpenPathSpec(path_specification)
Opens the Windows Registry file specified by the path. Args: path (str): path of the Windows Registry file. ascii_codepage (Optional[str]): ASCII string codepage. Returns: WinRegistryFile: Windows Registry file or None.
Opens the Windows Registry file specified by the path.
[ "Opens", "the", "Windows", "Registry", "file", "specified", "by", "the", "path", "." ]
def Open(self, path, ascii_codepage='cp1252'): """Opens the Windows Registry file specified by the path. Args: path (str): path of the Windows Registry file. ascii_codepage (Optional[str]): ASCII string codepage. Returns: WinRegistryFile: Windows Registry file or None. """ path_s...
[ "def", "Open", "(", "self", ",", "path", ",", "ascii_codepage", "=", "'cp1252'", ")", ":", "path_specification", "=", "None", "try", ":", "path_specification", "=", "self", ".", "_path_resolver", ".", "ResolvePath", "(", "path", ")", "except", "dfvfs_errors", ...
https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/preprocessors/manager.py#L97-L119
turicas/brasil.io
f1c371fe828a090510259a5027b49e2e651936b4
core/data_models.py
python
SociosBrasilEmpresaMixin.is_headquarter
(self)
return self.cnpj[:12].endswith("0001")
[]
def is_headquarter(self): return self.cnpj[:12].endswith("0001")
[ "def", "is_headquarter", "(", "self", ")", ":", "return", "self", ".", "cnpj", "[", ":", "12", "]", ".", "endswith", "(", "\"0001\"", ")" ]
https://github.com/turicas/brasil.io/blob/f1c371fe828a090510259a5027b49e2e651936b4/core/data_models.py#L38-L39
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/internet/_glibbase.py
python
GlibReactorBase.crash
(self)
Crash the reactor.
Crash the reactor.
[ "Crash", "the", "reactor", "." ]
def crash(self): """ Crash the reactor. """ posixbase.PosixReactorBase.crash(self) self._crash()
[ "def", "crash", "(", "self", ")", ":", "posixbase", ".", "PosixReactorBase", ".", "crash", "(", "self", ")", "self", ".", "_crash", "(", ")" ]
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/internet/_glibbase.py#L268-L273
sissaschool/xmlschema
847ead0540c58390efb95b2024eda120eb535ef1
xmlschema/resources.py
python
XMLResource.iter_location_hints
(self, tag: Optional[str] = None)
Yields all schema location hints of the XML resource. If tag is not None or '*', only location hints of elements whose tag equals tag are returned from the iterator.
Yields all schema location hints of the XML resource. If tag is not None or '*', only location hints of elements whose tag equals tag are returned from the iterator.
[ "Yields", "all", "schema", "location", "hints", "of", "the", "XML", "resource", ".", "If", "tag", "is", "not", "None", "or", "*", "only", "location", "hints", "of", "elements", "whose", "tag", "equals", "tag", "are", "returned", "from", "the", "iterator", ...
def iter_location_hints(self, tag: Optional[str] = None) -> Iterator[Tuple[str, str]]: """ Yields all schema location hints of the XML resource. If tag is not None or '*', only location hints of elements whose tag equals tag are returned from the iterator. """ for elem in...
[ "def", "iter_location_hints", "(", "self", ",", "tag", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Iterator", "[", "Tuple", "[", "str", ",", "str", "]", "]", ":", "for", "elem", "in", "self", ".", "iter", "(", "tag", ")", ":", "yie...
https://github.com/sissaschool/xmlschema/blob/847ead0540c58390efb95b2024eda120eb535ef1/xmlschema/resources.py#L1070-L1077
toxygen-project/toxygen
0a54012cf5ee72434b923bcde7d8f1a4e575ce2f
toxygen/profile.py
python
Profile.friend_typing
(self, friend_number, typing)
Display incoming typing notification
Display incoming typing notification
[ "Display", "incoming", "typing", "notification" ]
def friend_typing(self, friend_number, typing): """ Display incoming typing notification """ if friend_number == self.get_active_number() and self.is_active_a_friend(): self._screen.typing.setVisible(typing)
[ "def", "friend_typing", "(", "self", ",", "friend_number", ",", "typing", ")", ":", "if", "friend_number", "==", "self", ".", "get_active_number", "(", ")", "and", "self", ".", "is_active_a_friend", "(", ")", ":", "self", ".", "_screen", ".", "typing", "."...
https://github.com/toxygen-project/toxygen/blob/0a54012cf5ee72434b923bcde7d8f1a4e575ce2f/toxygen/profile.py#L402-L407
google/timesketch
1ce6b60e125d104e6644947c6f1dbe1b82ac76b6
timesketch/lib/stories/interface.py
python
StoryExporter.__exit__
(self, exception_type, exception_value, traceback)
Make it possible to use "with" statement.
Make it possible to use "with" statement.
[ "Make", "it", "possible", "to", "use", "with", "statement", "." ]
def __exit__(self, exception_type, exception_value, traceback): """Make it possible to use "with" statement.""" self.reset()
[ "def", "__exit__", "(", "self", ",", "exception_type", ",", "exception_value", ",", "traceback", ")", ":", "self", ".", "reset", "(", ")" ]
https://github.com/google/timesketch/blob/1ce6b60e125d104e6644947c6f1dbe1b82ac76b6/timesketch/lib/stories/interface.py#L150-L152
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/lib-tk/turtle.py
python
TPen.fillcolor
(self, *args)
Return or set the fillcolor. Arguments: Four input formats are allowed: - fillcolor() Return the current fillcolor as color specification string, possibly in hex-number format (see example). May be used as input to another color/pencolor/fillcolor call. ...
Return or set the fillcolor.
[ "Return", "or", "set", "the", "fillcolor", "." ]
def fillcolor(self, *args): """ Return or set the fillcolor. Arguments: Four input formats are allowed: - fillcolor() Return the current fillcolor as color specification string, possibly in hex-number format (see example). May be used as input to an...
[ "def", "fillcolor", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "color", "=", "self", ".", "_colorstr", "(", "args", ")", "if", "color", "==", "self", ".", "_fillcolor", ":", "return", "self", ".", "pen", "(", "fillcolor", "=", "col...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/lib-tk/turtle.py#L2178-L2212
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
stock/ctp/ApiStruct.py
python
CombinationLeg.__init__
(self, CombInstrumentID='', LegID=0, LegInstrumentID='', Direction=D_Buy, LegMultiple=0, ImplyLevel=0)
[]
def __init__(self, CombInstrumentID='', LegID=0, LegInstrumentID='', Direction=D_Buy, LegMultiple=0, ImplyLevel=0): self.CombInstrumentID = 'InstrumentID' #组合合约代码, char[31] self.LegID = '' #单腿编号, int self.LegInstrumentID = 'InstrumentID' #单腿合约代码, char[31] self.Direction = '' #买卖方向, char ...
[ "def", "__init__", "(", "self", ",", "CombInstrumentID", "=", "''", ",", "LegID", "=", "0", ",", "LegInstrumentID", "=", "''", ",", "Direction", "=", "D_Buy", ",", "LegMultiple", "=", "0", ",", "ImplyLevel", "=", "0", ")", ":", "self", ".", "CombInstru...
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/stock/ctp/ApiStruct.py#L2976-L2982
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/dispatcher.py
python
CustomProjectReportDispatcher.permissions_check
(self, report, request, domain=None, is_navigation_check=False)
return super(CustomProjectReportDispatcher, self).permissions_check(report, request, domain)
[]
def permissions_check(self, report, request, domain=None, is_navigation_check=False): if is_navigation_check and not has_privilege(request, privileges.CUSTOM_REPORTS): return False if isinstance(request.couch_user, AnonymousCouchUser) and self.prefix == 'custom_project_report': r...
[ "def", "permissions_check", "(", "self", ",", "report", ",", "request", ",", "domain", "=", "None", ",", "is_navigation_check", "=", "False", ")", ":", "if", "is_navigation_check", "and", "not", "has_privilege", "(", "request", ",", "privileges", ".", "CUSTOM_...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/dispatcher.py#L279-L289
openwpm/OpenWPM
771b6db4169374a7f7b6eb5ce6e59ea763f26df4
openwpm/storage/storage_controller.py
python
StorageController.handler
( self, reader: asyncio.StreamReader, _: asyncio.StreamWriter )
Created for every new connection to the Server
Created for every new connection to the Server
[ "Created", "for", "every", "new", "connection", "to", "the", "Server" ]
async def handler( self, reader: asyncio.StreamReader, _: asyncio.StreamWriter ) -> None: """Created for every new connection to the Server""" self.logger.debug("Initializing new handler") while True: try: record: Tuple[str, Any] = await get_message_from_r...
[ "async", "def", "handler", "(", "self", ",", "reader", ":", "asyncio", ".", "StreamReader", ",", "_", ":", "asyncio", ".", "StreamWriter", ")", "->", "None", ":", "self", ".", "logger", ".", "debug", "(", "\"Initializing new handler\"", ")", "while", "True...
https://github.com/openwpm/OpenWPM/blob/771b6db4169374a7f7b6eb5ce6e59ea763f26df4/openwpm/storage/storage_controller.py#L100-L156
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/user_groups/management/commands/import_groups.py
python
Command.add_arguments
(self, parser)
[]
def add_arguments(self, parser): parser.add_argument('import_id', type=int)
[ "def", "add_arguments", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'import_id'", ",", "type", "=", "int", ")" ]
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/user_groups/management/commands/import_groups.py#L7-L8
OCA/l10n-spain
99050907670a70307fcd8cdfb6f3400d9e120df4
l10n_es_aeat_mod111/models/mod111.py
python
L10nEsAeatMod111Report._compute_casilla_28
(self)
[]
def _compute_casilla_28(self): casillas = (3, 6, 9) for report in self: tax_lines = report.tax_line_ids.filtered( lambda x: x.field_number in casillas ) report.casilla_28 = ( sum(tax_lines.mapped("amount")) + report.casi...
[ "def", "_compute_casilla_28", "(", "self", ")", ":", "casillas", "=", "(", "3", ",", "6", ",", "9", ")", "for", "report", "in", "self", ":", "tax_lines", "=", "report", ".", "tax_line_ids", ".", "filtered", "(", "lambda", "x", ":", "x", ".", "field_n...
https://github.com/OCA/l10n-spain/blob/99050907670a70307fcd8cdfb6f3400d9e120df4/l10n_es_aeat_mod111/models/mod111.py#L255-L269
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/logilab/common/registry.py
python
RegistryStore.registry_class
(self, regid)
return existing registry named regid or use factory to create one and return it
return existing registry named regid or use factory to create one and return it
[ "return", "existing", "registry", "named", "regid", "or", "use", "factory", "to", "create", "one", "and", "return", "it" ]
def registry_class(self, regid): """return existing registry named regid or use factory to create one and return it""" try: return self.REGISTRY_FACTORY[regid] except KeyError: return self.REGISTRY_FACTORY[None]
[ "def", "registry_class", "(", "self", ",", "regid", ")", ":", "try", ":", "return", "self", ".", "REGISTRY_FACTORY", "[", "regid", "]", "except", "KeyError", ":", "return", "self", ".", "REGISTRY_FACTORY", "[", "None", "]" ]
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/logilab/common/registry.py#L563-L569
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/appdirs.py
python
AppDirs.user_data_dir
(self)
return user_data_dir(self.appname, self.appauthor, version=self.version, roaming=self.roaming)
[]
def user_data_dir(self): return user_data_dir(self.appname, self.appauthor, version=self.version, roaming=self.roaming)
[ "def", "user_data_dir", "(", "self", ")", ":", "return", "user_data_dir", "(", "self", ".", "appname", ",", "self", ".", "appauthor", ",", "version", "=", "self", ".", "version", ",", "roaming", "=", "self", ".", "roaming", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/appdirs.py#L376-L378
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
jina/clients/base/helper.py
python
AioHttpClientlet.send_message
(self)
Send message to Gateway
Send message to Gateway
[ "Send", "message", "to", "Gateway" ]
async def send_message(self): """Send message to Gateway""" ...
[ "async", "def", "send_message", "(", "self", ")", ":", "..." ]
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/clients/base/helper.py#L30-L32
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/base/models.py
python
RepoSecretKeyManager.get_secret_key
(self, repo_id)
return repo_secret_key.secret_key
[]
def get_secret_key(self, repo_id): try: repo_secret_key = self.get(repo_id=repo_id) except RepoSecretKey.DoesNotExist: return None return repo_secret_key.secret_key
[ "def", "get_secret_key", "(", "self", ",", "repo_id", ")", ":", "try", ":", "repo_secret_key", "=", "self", ".", "get", "(", "repo_id", "=", "repo_id", ")", "except", "RepoSecretKey", ".", "DoesNotExist", ":", "return", "None", "return", "repo_secret_key", "...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/base/models.py#L329-L335
eth-brownie/brownie
754bda9f0a294b2beb86453d5eca4ff769a877c8
brownie/convert/datatypes.py
python
Wei.to
(self, unit: str)
Returns a converted denomination of the stored wei value. Accepts any valid ether unit denomination as string, like: "gwei", "milliether", "finney", "ether". :param unit: An ether denomination like "ether" or "gwei" :return: A 'Fixed' type number in the specified denomination
Returns a converted denomination of the stored wei value. Accepts any valid ether unit denomination as string, like: "gwei", "milliether", "finney", "ether".
[ "Returns", "a", "converted", "denomination", "of", "the", "stored", "wei", "value", ".", "Accepts", "any", "valid", "ether", "unit", "denomination", "as", "string", "like", ":", "gwei", "milliether", "finney", "ether", "." ]
def to(self, unit: str) -> "Fixed": """ Returns a converted denomination of the stored wei value. Accepts any valid ether unit denomination as string, like: "gwei", "milliether", "finney", "ether". :param unit: An ether denomination like "ether" or "gwei" :return: A 'Fix...
[ "def", "to", "(", "self", ",", "unit", ":", "str", ")", "->", "\"Fixed\"", ":", "try", ":", "return", "Fixed", "(", "self", "*", "Fixed", "(", "10", ")", "**", "-", "UNITS", "[", "unit", "]", ")", "except", "KeyError", ":", "raise", "TypeError", ...
https://github.com/eth-brownie/brownie/blob/754bda9f0a294b2beb86453d5eca4ff769a877c8/brownie/convert/datatypes.py#L82-L94
JustDoPython/python-100-day
4e75007195aa4cdbcb899aeb06b9b08996a4606c
day-121/dt.py
python
majorityCnt
(classList)
return sortedClassCount[0][0]
类别数多的类别 :param classList: 类别 :return: 返回类别数多的类别
类别数多的类别 :param classList: 类别 :return: 返回类别数多的类别
[ "类别数多的类别", ":", "param", "classList", ":", "类别", ":", "return", ":", "返回类别数多的类别" ]
def majorityCnt(classList): ''' 类别数多的类别 :param classList: 类别 :return: 返回类别数多的类别 ''' classCount={} for vote in classList: if vote not in classCount.keys(): classCount[vote] = 0 classCount[vote] += 1 sortedClassCount = sorted(classCount.iteritems(), key=operator.itemgetter(...
[ "def", "majorityCnt", "(", "classList", ")", ":", "classCount", "=", "{", "}", "for", "vote", "in", "classList", ":", "if", "vote", "not", "in", "classCount", ".", "keys", "(", ")", ":", "classCount", "[", "vote", "]", "=", "0", "classCount", "[", "v...
https://github.com/JustDoPython/python-100-day/blob/4e75007195aa4cdbcb899aeb06b9b08996a4606c/day-121/dt.py#L103-L114
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/packaging/version.py
python
_legacy_cmpkey
(version)
return epoch, parts
[]
def _legacy_cmpkey(version): # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch # greater than or equal to 0. This will effectively put the LegacyVersion, # which uses the defacto standard originally implemented by setuptools, # as before all PEP 440 versions. epoch = -1 ...
[ "def", "_legacy_cmpkey", "(", "version", ")", ":", "# We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch", "# greater than or equal to 0. This will effectively put the LegacyVersion,", "# which uses the defacto standard originally implemented by setuptools,", "# as before all...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/packaging/version.py#L131-L155
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/collections.py
python
Counter.__or__
(self, other)
return result
Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1})
Union is the maximum of value in either of the input counters.
[ "Union", "is", "the", "maximum", "of", "value", "in", "either", "of", "the", "input", "counters", "." ]
def __or__(self, other): '''Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem...
[ "def", "__or__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "Counter", ")", ":", "return", "NotImplemented", "result", "=", "Counter", "(", ")", "for", "elem", ",", "count", "in", "self", ".", "items", "(", ")"...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/collections.py#L523-L541
ethereum/trinity
6383280c5044feb06695ac2f7bc1100b7bcf4fe0
trinity/sync/beam/chain.py
python
BeamSyncer.run
(self)
[]
async def run(self) -> None: try: await self._launch_strategy.fulfill_prerequisites() except asyncio.TimeoutError as exc: self.logger.exception( "Timed out while trying to fulfill prerequisites of " f"sync launch strategy: {exc} from {self._launch...
[ "async", "def", "run", "(", "self", ")", "->", "None", ":", "try", ":", "await", "self", ".", "_launch_strategy", ".", "fulfill_prerequisites", "(", ")", "except", "asyncio", ".", "TimeoutError", "as", "exc", ":", "self", ".", "logger", ".", "exception", ...
https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/sync/beam/chain.py#L221-L287
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/mechanize/_clientcookie.py
python
CookiePolicy.return_ok
(self, cookie, request)
Return true if (and only if) cookie should be returned to server. cookie: mechanize.Cookie object request: object implementing the interface defined by CookieJar.add_cookie_header.__doc__
Return true if (and only if) cookie should be returned to server.
[ "Return", "true", "if", "(", "and", "only", "if", ")", "cookie", "should", "be", "returned", "to", "server", "." ]
def return_ok(self, cookie, request): """Return true if (and only if) cookie should be returned to server. cookie: mechanize.Cookie object request: object implementing the interface defined by CookieJar.add_cookie_header.__doc__ """ raise NotImplementedError()
[ "def", "return_ok", "(", "self", ",", "cookie", ",", "request", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/mechanize/_clientcookie.py#L478-L486
sukeesh/Jarvis
2dc2a550b59ea86cca5dfb965661b6fc4cabd434
jarviscli/utilities/voice.py
python
remove_ansi_escape_seq
(text)
return text
This method removes ANSI escape sequences (such as a colorama color code) from a string so that they aren't spoken. :param text: The text that may contain ANSI escape sequences. :return: The text with ANSI escape sequences removed.
This method removes ANSI escape sequences (such as a colorama color code) from a string so that they aren't spoken. :param text: The text that may contain ANSI escape sequences. :return: The text with ANSI escape sequences removed.
[ "This", "method", "removes", "ANSI", "escape", "sequences", "(", "such", "as", "a", "colorama", "color", "code", ")", "from", "a", "string", "so", "that", "they", "aren", "t", "spoken", ".", ":", "param", "text", ":", "The", "text", "that", "may", "con...
def remove_ansi_escape_seq(text): """ This method removes ANSI escape sequences (such as a colorama color code) from a string so that they aren't spoken. :param text: The text that may contain ANSI escape sequences. :return: The text with ANSI escape sequences removed. """ if text: t...
[ "def", "remove_ansi_escape_seq", "(", "text", ")", ":", "if", "text", ":", "text", "=", "re", ".", "sub", "(", "r'''(\\x9B|\\x1B\\[)[0-?]*[ -\\/]*[@-~]'''", ",", "''", ",", "text", ")", "return", "text" ]
https://github.com/sukeesh/Jarvis/blob/2dc2a550b59ea86cca5dfb965661b6fc4cabd434/jarviscli/utilities/voice.py#L41-L50
mido/mido
b884bc3c41d64da77bf6f3c879f823626c188e89
mido/sockets.py
python
PortServer._update_ports
(self)
Remove closed port ports.
Remove closed port ports.
[ "Remove", "closed", "port", "ports", "." ]
def _update_ports(self): """Remove closed port ports.""" self.ports = [port for port in self.ports if not port.closed]
[ "def", "_update_ports", "(", "self", ")", ":", "self", ".", "ports", "=", "[", "port", "for", "port", "in", "self", ".", "ports", "if", "not", "port", ".", "closed", "]" ]
https://github.com/mido/mido/blob/b884bc3c41d64da77bf6f3c879f823626c188e89/mido/sockets.py#L42-L44
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventTypeArg.is_team_folder_change_status
(self)
return self._tag == 'team_folder_change_status'
Check if the union tag is ``team_folder_change_status``. :rtype: bool
Check if the union tag is ``team_folder_change_status``.
[ "Check", "if", "the", "union", "tag", "is", "team_folder_change_status", "." ]
def is_team_folder_change_status(self): """ Check if the union tag is ``team_folder_change_status``. :rtype: bool """ return self._tag == 'team_folder_change_status'
[ "def", "is_team_folder_change_status", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'team_folder_change_status'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L42719-L42725
msmbuilder/msmbuilder
515fd5c27836c797692d600216b5eb224dfc1c5d
msmbuilder/feature_selection/featureselector.py
python
FeatureSelector.partial_transform
(self, traj)
return np.concatenate([self.features[feat].partial_transform(traj) for feat in self.which_feat], axis=1)
Featurize an MD trajectory into a vector space. Parameters ---------- traj : mdtraj.Trajectory A molecular dynamics trajectory to featurize. Returns ------- features : np.ndarray, dtype=float, shape=(n_samples, n_features) A featurized trajectory...
Featurize an MD trajectory into a vector space.
[ "Featurize", "an", "MD", "trajectory", "into", "a", "vector", "space", "." ]
def partial_transform(self, traj): """Featurize an MD trajectory into a vector space. Parameters ---------- traj : mdtraj.Trajectory A molecular dynamics trajectory to featurize. Returns ------- features : np.ndarray, dtype=float, shape=(n_samples, n...
[ "def", "partial_transform", "(", "self", ",", "traj", ")", ":", "return", "np", ".", "concatenate", "(", "[", "self", ".", "features", "[", "feat", "]", ".", "partial_transform", "(", "traj", ")", "for", "feat", "in", "self", ".", "which_feat", "]", ",...
https://github.com/msmbuilder/msmbuilder/blob/515fd5c27836c797692d600216b5eb224dfc1c5d/msmbuilder/feature_selection/featureselector.py#L51-L68
mandiant/idawasm
51cb56d8664057790f1c94f44a189261a21cbbc9
scripts/wasm_emu.py
python
Emulator.handle_I32_STORE
(self, insn)
[]
def handle_I32_STORE(self, insn): value = self.pop() base = self.pop() offset = insn.imm.offset if isinstance(base, I32): addr = I32(base.value + offset) else: addr = AddOperation(base, I32(offset)) if isinstance(value, I32): v0 = I32...
[ "def", "handle_I32_STORE", "(", "self", ",", "insn", ")", ":", "value", "=", "self", ".", "pop", "(", ")", "base", "=", "self", ".", "pop", "(", ")", "offset", "=", "insn", ".", "imm", ".", "offset", "if", "isinstance", "(", "base", ",", "I32", "...
https://github.com/mandiant/idawasm/blob/51cb56d8664057790f1c94f44a189261a21cbbc9/scripts/wasm_emu.py#L430-L463
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/remotectypes.py
python
RemoteStructurePointer64.raw_value
(self)
return self.value
[]
def raw_value(self): return self.value
[ "def", "raw_value", "(", "self", ")", ":", "return", "self", ".", "value" ]
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/remotectypes.py#L234-L235
FSecureLABS/Jandroid
e31d0dab58a2bfd6ed8e0a387172b8bd7c893436
libs/platform-tools/platform-tools_darwin/systrace/catapult/devil/devil/android/device_temp_file.py
python
DeviceTempFile.close
(self)
Deletes the temporary file from the device.
Deletes the temporary file from the device.
[ "Deletes", "the", "temporary", "file", "from", "the", "device", "." ]
def close(self): """Deletes the temporary file from the device.""" # ignore exception if the file is already gone. def delete_temporary_file(): try: self._adb.Shell('rm -f %s' % self.name_quoted, expect_status=None) except base_error.BaseError as e: # We don't really care, and st...
[ "def", "close", "(", "self", ")", ":", "# ignore exception if the file is already gone.", "def", "delete_temporary_file", "(", ")", ":", "try", ":", "self", ".", "_adb", ".", "Shell", "(", "'rm -f %s'", "%", "self", ".", "name_quoted", ",", "expect_status", "=",...
https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_darwin/systrace/catapult/devil/devil/android/device_temp_file.py#L56-L72
grnet/synnefo
d06ec8c7871092131cdaabf6b03ed0b504c93e43
snf-cyclades-app/synnefo/quotas/__init__.py
python
get_volume_size_delta
(action, db_volume, info)
Compute the change in the size of a volume
Compute the change in the size of a volume
[ "Compute", "the", "change", "in", "the", "size", "of", "a", "volume" ]
def get_volume_size_delta(action, db_volume, info): """Compute the change in the size of a volume""" if action == "add": return int(db_volume.size) << 30 elif action == "remove": return -int(db_volume.size) << 30 elif action == "modify": return info.get("size_delta", 0) << 30 ...
[ "def", "get_volume_size_delta", "(", "action", ",", "db_volume", ",", "info", ")", ":", "if", "action", "==", "\"add\"", ":", "return", "int", "(", "db_volume", ".", "size", ")", "<<", "30", "elif", "action", "==", "\"remove\"", ":", "return", "-", "int"...
https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-cyclades-app/synnefo/quotas/__init__.py#L438-L447
ethereum/trinity
6383280c5044feb06695ac2f7bc1100b7bcf4fe0
trinity/components/builtin/metrics/service/trio.py
python
TrioMetricsService.async_post
(self, data: str)
[]
async def async_post(self, data: str) -> None: # use trio-compatible asks library for async http calls await self.session.post(data=data)
[ "async", "def", "async_post", "(", "self", ",", "data", ":", "str", ")", "->", "None", ":", "# use trio-compatible asks library for async http calls", "await", "self", ".", "session", ".", "post", "(", "data", "=", "data", ")" ]
https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/components/builtin/metrics/service/trio.py#L32-L34
princewen/tensorflow_practice
b3696f757a9620ed317b5b34b749f6352a1542b6
recommendation/Basic-DKN-Demo/news/news_preprocess.py
python
encoding_title
(title, entities)
return word_encoding, entity_encoding
Encoding a title according to word2index map and entity2index map :param title: a piece of news title :param entities: entities contained in the news title :return: encodings of the title with respect to word and entity, respectively
Encoding a title according to word2index map and entity2index map :param title: a piece of news title :param entities: entities contained in the news title :return: encodings of the title with respect to word and entity, respectively
[ "Encoding", "a", "title", "according", "to", "word2index", "map", "and", "entity2index", "map", ":", "param", "title", ":", "a", "piece", "of", "news", "title", ":", "param", "entities", ":", "entities", "contained", "in", "the", "news", "title", ":", "ret...
def encoding_title(title, entities): """ Encoding a title according to word2index map and entity2index map :param title: a piece of news title :param entities: entities contained in the news title :return: encodings of the title with respect to word and entity, respectively """ local_map = g...
[ "def", "encoding_title", "(", "title", ",", "entities", ")", ":", "local_map", "=", "get_local_word2entity", "(", "entities", ")", "array", "=", "title", ".", "split", "(", "' '", ")", "word_encoding", "=", "[", "'0'", "]", "*", "MAX_TITLE_LENGTH", "entity_e...
https://github.com/princewen/tensorflow_practice/blob/b3696f757a9620ed317b5b34b749f6352a1542b6/recommendation/Basic-DKN-Demo/news/news_preprocess.py#L101-L125
ymcui/Chinese-XLNet
d93eca11a7866577ef29e7811897c369404cae28
src/function_builder.py
python
get_race_loss
(FLAGS, features, is_training)
return total_loss, per_example_loss, logits
Loss for downstream multi-choice QA tasks such as RACE.
Loss for downstream multi-choice QA tasks such as RACE.
[ "Loss", "for", "downstream", "multi", "-", "choice", "QA", "tasks", "such", "as", "RACE", "." ]
def get_race_loss(FLAGS, features, is_training): """Loss for downstream multi-choice QA tasks such as RACE.""" bsz_per_core = tf.shape(features["input_ids"])[0] def _transform_features(feature): out = tf.reshape(feature, [bsz_per_core, 4, -1]) out = tf.transpose(out, [2, 0, 1]) out = tf.reshape(out,...
[ "def", "get_race_loss", "(", "FLAGS", ",", "features", ",", "is_training", ")", ":", "bsz_per_core", "=", "tf", ".", "shape", "(", "features", "[", "\"input_ids\"", "]", ")", "[", "0", "]", "def", "_transform_features", "(", "feature", ")", ":", "out", "...
https://github.com/ymcui/Chinese-XLNet/blob/d93eca11a7866577ef29e7811897c369404cae28/src/function_builder.py#L324-L361
brainiak/brainiak
ee093597c6c11597b0a59e95b48d2118e40394a5
brainiak/funcalign/rsrm.py
python
RSRM.fit
(self, X)
return self
Compute the Robust Shared Response Model Parameters ---------- X : list of 2D arrays, element i has shape=[voxels_i, timepoints] Each element in the list contains the fMRI data of one subject.
Compute the Robust Shared Response Model
[ "Compute", "the", "Robust", "Shared", "Response", "Model" ]
def fit(self, X): """Compute the Robust Shared Response Model Parameters ---------- X : list of 2D arrays, element i has shape=[voxels_i, timepoints] Each element in the list contains the fMRI data of one subject. """ logger.info('Starting RSRM') # ...
[ "def", "fit", "(", "self", ",", "X", ")", ":", "logger", ".", "info", "(", "'Starting RSRM'", ")", "# Check that the regularizer value is positive", "if", "0.0", ">=", "self", ".", "gamma", ":", "raise", "ValueError", "(", "\"Gamma parameter should be positive.\"", ...
https://github.com/brainiak/brainiak/blob/ee093597c6c11597b0a59e95b48d2118e40394a5/brainiak/funcalign/rsrm.py#L114-L155
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/simulators/gazebo_ros.py
python
GazeboROSEnv.compute_reward
(self, state, obs)
Compute and return the reward based on the state and on the observation. It also returns a boolean value indicating if the task is over or not.
Compute and return the reward based on the state and on the observation. It also returns a boolean value indicating if the task is over or not.
[ "Compute", "and", "return", "the", "reward", "based", "on", "the", "state", "and", "on", "the", "observation", ".", "It", "also", "returns", "a", "boolean", "value", "indicating", "if", "the", "task", "is", "over", "or", "not", "." ]
def compute_reward(self, state, obs): """ Compute and return the reward based on the state and on the observation. It also returns a boolean value indicating if the task is over or not. """ raise NotImplementedError("This function needs to be overwritten...")
[ "def", "compute_reward", "(", "self", ",", "state", ",", "obs", ")", ":", "raise", "NotImplementedError", "(", "\"This function needs to be overwritten...\"", ")" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/gazebo_ros.py#L484-L489
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/yaml3/parser.py
python
Parser.parse_document_start
(self)
return event
[]
def parse_document_start(self): # Parse any extra document end indicators. while self.check_token(DocumentEndToken): self.get_token() # Parse an explicit document. if not self.check_token(StreamEndToken): token = self.peek_token() start_mark = token....
[ "def", "parse_document_start", "(", "self", ")", ":", "# Parse any extra document end indicators.", "while", "self", ".", "check_token", "(", "DocumentEndToken", ")", ":", "self", ".", "get_token", "(", ")", "# Parse an explicit document.", "if", "not", "self", ".", ...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/yaml3/parser.py#L159-L188
flaskbb/flaskbb
de13a37fcb713b9c627632210ab9a7bb980d591f
flaskbb/utils/helpers.py
python
to_bytes
(text, encoding="utf-8")
return text
Transform string to bytes.
Transform string to bytes.
[ "Transform", "string", "to", "bytes", "." ]
def to_bytes(text, encoding="utf-8"): """Transform string to bytes.""" if isinstance(text, str): text = text.encode(encoding) return text
[ "def", "to_bytes", "(", "text", ",", "encoding", "=", "\"utf-8\"", ")", ":", "if", "isinstance", "(", "text", ",", "str", ")", ":", "text", "=", "text", ".", "encode", "(", "encoding", ")", "return", "text" ]
https://github.com/flaskbb/flaskbb/blob/de13a37fcb713b9c627632210ab9a7bb980d591f/flaskbb/utils/helpers.py#L52-L56
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/point/config_flow.py
python
PointFlowHandler.__init__
(self)
Initialize flow.
Initialize flow.
[ "Initialize", "flow", "." ]
def __init__(self): """Initialize flow.""" self.flow_impl = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "flow_impl", "=", "None" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/point/config_flow.py#L49-L51
ivyl/gedit-mate
781dfb5435f4fe6a97effa619dda5b3719e44485
legacy-plugins/completion.py
python
CompletionPlugin._update_fonts
(self, view)
Update font descriptions and ascent metrics.
Update font descriptions and ascent metrics.
[ "Update", "font", "descriptions", "and", "ascent", "metrics", "." ]
def _update_fonts(self, view): """Update font descriptions and ascent metrics.""" context = view.get_pango_context() font_desc = context.get_font_description() if self._font_ascent == 0: # Acquiring pango metrics is a bit slow, # so do this only when absolutely n...
[ "def", "_update_fonts", "(", "self", ",", "view", ")", ":", "context", "=", "view", ".", "get_pango_context", "(", ")", "font_desc", "=", "context", ".", "get_font_description", "(", ")", "if", "self", ".", "_font_ascent", "==", "0", ":", "# Acquiring pango ...
https://github.com/ivyl/gedit-mate/blob/781dfb5435f4fe6a97effa619dda5b3719e44485/legacy-plugins/completion.py#L328-L339
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py
python
ForwardingRule.ip_address
(self)
return self._ip_address
property for resource ip_address
property for resource ip_address
[ "property", "for", "resource", "ip_address" ]
def ip_address(self): '''property for resource ip_address''' return self._ip_address
[ "def", "ip_address", "(", "self", ")", ":", "return", "self", ".", "_ip_address" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py#L876-L878
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/Bastion.py
python
_test
()
Test the Bastion() function.
Test the Bastion() function.
[ "Test", "the", "Bastion", "()", "function", "." ]
def _test(): """Test the Bastion() function.""" class Original: def __init__(self): self.sum = 0 def add(self, n): self._add(n) def _add(self, n): self.sum = self.sum + n def total(self): return self.sum o = Original() b = B...
[ "def", "_test", "(", ")", ":", "class", "Original", ":", "def", "__init__", "(", "self", ")", ":", "self", ".", "sum", "=", "0", "def", "add", "(", "self", ",", "n", ")", ":", "self", ".", "_add", "(", "n", ")", "def", "_add", "(", "self", ",...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/Bastion.py#L134-L176
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/irc.py
python
IRCClient.irc_ERR_NICKNAMEINUSE
(self, prefix, params)
Called when we try to register or change to a nickname that is already taken.
Called when we try to register or change to a nickname that is already taken.
[ "Called", "when", "we", "try", "to", "register", "or", "change", "to", "a", "nickname", "that", "is", "already", "taken", "." ]
def irc_ERR_NICKNAMEINUSE(self, prefix, params): """ Called when we try to register or change to a nickname that is already taken. """ self._attemptedNick = self.alterCollidedNick(self._attemptedNick) self.setNick(self._attemptedNick)
[ "def", "irc_ERR_NICKNAMEINUSE", "(", "self", ",", "prefix", ",", "params", ")", ":", "self", ".", "_attemptedNick", "=", "self", ".", "alterCollidedNick", "(", "self", ".", "_attemptedNick", ")", "self", ".", "setNick", "(", "self", ".", "_attemptedNick", ")...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/words/protocols/irc.py#L1911-L1917
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/campaign_label_service/client.py
python
CampaignLabelServiceClientMeta.get_transport_class
( cls, label: str = None, )
return next(iter(cls._transport_registry.values()))
Return an appropriate transport class. Args: label: The name of the desired transport. If none is provided, then the first transport in the registry is used. Returns: The transport class to use.
Return an appropriate transport class.
[ "Return", "an", "appropriate", "transport", "class", "." ]
def get_transport_class( cls, label: str = None, ) -> Type[CampaignLabelServiceTransport]: """Return an appropriate transport class. Args: label: The name of the desired transport. If none is provided, then the first transport in the registry is used. Re...
[ "def", "get_transport_class", "(", "cls", ",", "label", ":", "str", "=", "None", ",", ")", "->", "Type", "[", "CampaignLabelServiceTransport", "]", ":", "# If a specific transport is requested, return that one.", "if", "label", ":", "return", "cls", ".", "_transport...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/campaign_label_service/client.py#L52-L70
PaddlePaddle/PGL
e48545f2814523c777b8a9a9188bf5a7f00d6e52
legacy/examples/stgcn/main.py
python
main
(args)
main
main
[ "main" ]
def main(args): """main""" PeMS = data_gen_mydata(args.input_file, args.label_file, args.n_route, args.n_his, args.n_pred, (args.n_val, args.n_test)) log.info(PeMS.get_stats()) log.info(PeMS.get_len('train')) gf = GraphFactory(args) place = fluid.CUDAPlace(0) if arg...
[ "def", "main", "(", "args", ")", ":", "PeMS", "=", "data_gen_mydata", "(", "args", ".", "input_file", ",", "args", ".", "label_file", ",", "args", ".", "n_route", ",", "args", ".", "n_his", ",", "args", ".", "n_pred", ",", "(", "args", ".", "n_val", ...
https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/legacy/examples/stgcn/main.py#L35-L122
square/pylink
a2d9fbd3add62ffd06ba737c5ea82b8491fdc425
pylink/jlink.py
python
JLink.rtt_read
(self, buffer_index, num_bytes)
return list(buf[:bytes_read])
Reads data from the RTT buffer. This method will read at most num_bytes bytes from the specified RTT buffer. The data is automatically removed from the RTT buffer. If there are not num_bytes bytes waiting in the RTT buffer, the entire contents of the RTT buffer will be read. Ar...
Reads data from the RTT buffer.
[ "Reads", "data", "from", "the", "RTT", "buffer", "." ]
def rtt_read(self, buffer_index, num_bytes): """Reads data from the RTT buffer. This method will read at most num_bytes bytes from the specified RTT buffer. The data is automatically removed from the RTT buffer. If there are not num_bytes bytes waiting in the RTT buffer, the ent...
[ "def", "rtt_read", "(", "self", ",", "buffer_index", ",", "num_bytes", ")", ":", "buf", "=", "(", "ctypes", ".", "c_ubyte", "*", "num_bytes", ")", "(", ")", "bytes_read", "=", "self", ".", "_dll", ".", "JLINK_RTTERMINAL_Read", "(", "buffer_index", ",", "...
https://github.com/square/pylink/blob/a2d9fbd3add62ffd06ba737c5ea82b8491fdc425/pylink/jlink.py#L5072-L5097
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/api/v2010/__init__.py
python
V2010.addresses
(self)
return self.account.addresses
:rtype: twilio.rest.api.v2010.account.address.AddressList
:rtype: twilio.rest.api.v2010.account.address.AddressList
[ ":", "rtype", ":", "twilio", ".", "rest", ".", "api", ".", "v2010", ".", "account", ".", "address", ".", "AddressList" ]
def addresses(self): """ :rtype: twilio.rest.api.v2010.account.address.AddressList """ return self.account.addresses
[ "def", "addresses", "(", "self", ")", ":", "return", "self", ".", "account", ".", "addresses" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/__init__.py#L57-L61