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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/_lib/future/future/backports/email/message.py | python | Message.raw_items | (self) | return iter(self._headers.copy()) | Return the (name, value) header pairs without modification.
This is an "internal" API, intended only for use by a generator. | Return the (name, value) header pairs without modification. | [
"Return",
"the",
"(",
"name",
"value",
")",
"header",
"pairs",
"without",
"modification",
"."
] | def raw_items(self):
"""Return the (name, value) header pairs without modification.
This is an "internal" API, intended only for use by a generator.
"""
return iter(self._headers.copy()) | [
"def",
"raw_items",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"_headers",
".",
"copy",
"(",
")",
")"
] | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/email/message.py#L441-L446 | |
nextcloud/appstore | bd7682d3e176b904e0e5dfc31a09650ddac5cdf0 | nextcloudappstore/core/models.py | python | NextcloudRelease.get_current_main | () | [] | def get_current_main():
current = NextcloudRelease.objects.get_current()
if len(current) > 0:
return current[0].version.split('.')[0]
else:
return None | [
"def",
"get_current_main",
"(",
")",
":",
"current",
"=",
"NextcloudRelease",
".",
"objects",
".",
"get_current",
"(",
")",
"if",
"len",
"(",
"current",
")",
">",
"0",
":",
"return",
"current",
"[",
"0",
"]",
".",
"version",
".",
"split",
"(",
"'.'",
... | https://github.com/nextcloud/appstore/blob/bd7682d3e176b904e0e5dfc31a09650ddac5cdf0/nextcloudappstore/core/models.py#L644-L649 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/keyword_theme_constant_service/client.py | python | KeywordThemeConstantServiceClient.parse_common_folder_path | (path: str) | return m.groupdict() if m else {} | Parse a folder path into its component segments. | Parse a folder path into its component segments. | [
"Parse",
"a",
"folder",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_common_folder_path(path: str) -> Dict[str, str]:
"""Parse a folder path into its component segments."""
m = re.match(r"^folders/(?P<folder>.+?)$", path)
return m.groupdict() if m else {} | [
"def",
"parse_common_folder_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^folders/(?P<folder>.+?)$\"",
",",
"path",
")",
"return",
"m",
".",
"groupdict",
"(",
")",
"if",
"m"... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/keyword_theme_constant_service/client.py#L219-L222 | |
oaubert/python-vlc | 908ffdbd0844dc1849728c456e147788798c99da | generated/2.2/vlc.py | python | libvlc_get_log_verbosity | (p_instance) | return f(p_instance) | Always returns minus one.
This function is only provided for backward compatibility.
@param p_instance: ignored.
@return: always -1. | Always returns minus one.
This function is only provided for backward compatibility. | [
"Always",
"returns",
"minus",
"one",
".",
"This",
"function",
"is",
"only",
"provided",
"for",
"backward",
"compatibility",
"."
] | def libvlc_get_log_verbosity(p_instance):
'''Always returns minus one.
This function is only provided for backward compatibility.
@param p_instance: ignored.
@return: always -1.
'''
f = _Cfunctions.get('libvlc_get_log_verbosity', None) or \
_Cfunction('libvlc_get_log_verbosity', ((1,),),... | [
"def",
"libvlc_get_log_verbosity",
"(",
"p_instance",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_get_log_verbosity'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_get_log_verbosity'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"Non... | https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/2.2/vlc.py#L3989-L3998 | |
projecthamster/hamster | 19d160090de30e756bdc3122ff935bdaa86e2843 | waflib/Configure.py | python | ConfigurationContext.prepare_env | (self, env) | Insert *PREFIX*, *BINDIR* and *LIBDIR* values into ``env``
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
:param env: a ConfigSet, usually ``conf.env`` | Insert *PREFIX*, *BINDIR* and *LIBDIR* values into ``env`` | [
"Insert",
"*",
"PREFIX",
"*",
"*",
"BINDIR",
"*",
"and",
"*",
"LIBDIR",
"*",
"values",
"into",
"env"
] | def prepare_env(self, env):
"""
Insert *PREFIX*, *BINDIR* and *LIBDIR* values into ``env``
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
:param env: a ConfigSet, usually ``conf.env``
"""
if not env.PREFIX:
if Options.options.prefix or Utils.is_win32:
env.PREFIX = Options.options.prefix
else:
... | [
"def",
"prepare_env",
"(",
"self",
",",
"env",
")",
":",
"if",
"not",
"env",
".",
"PREFIX",
":",
"if",
"Options",
".",
"options",
".",
"prefix",
"or",
"Utils",
".",
"is_win32",
":",
"env",
".",
"PREFIX",
"=",
"Options",
".",
"options",
".",
"prefix",... | https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/waflib/Configure.py#L192-L213 | ||
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/plugin_base/provider.py | python | Provider.get_directory_size | (self, path, relative_to=None) | Return directory size | Return directory size | [
"Return",
"directory",
"size"
] | def get_directory_size(self, path, relative_to=None):
"""Return directory size"""
pass | [
"def",
"get_directory_size",
"(",
"self",
",",
"path",
",",
"relative_to",
"=",
"None",
")",
":",
"pass"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/plugin_base/provider.py#L178-L180 | ||
ModelOriented/DALEX | 1fd2110c25cbed8f0f7e717c3795183271b386a7 | python/dalex/dalex/fairness/_group_fairness/utils.py | python | _metric_ratios_2_df | (fobject) | return data | Converts GroupFairnessClassification
to elegant DataFrame with 4 columns (subgroup, metric, score, label) | Converts GroupFairnessClassification
to elegant DataFrame with 4 columns (subgroup, metric, score, label) | [
"Converts",
"GroupFairnessClassification",
"to",
"elegant",
"DataFrame",
"with",
"4",
"columns",
"(",
"subgroup",
"metric",
"score",
"label",
")"
] | def _metric_ratios_2_df(fobject):
"""
Converts GroupFairnessClassification
to elegant DataFrame with 4 columns (subgroup, metric, score, label)
"""
data = fobject.result
data = data.stack(dropna=False)
data = data.reset_index()
data.columns = ["subgroup", "metric", "score"]
data = d... | [
"def",
"_metric_ratios_2_df",
"(",
"fobject",
")",
":",
"data",
"=",
"fobject",
".",
"result",
"data",
"=",
"data",
".",
"stack",
"(",
"dropna",
"=",
"False",
")",
"data",
"=",
"data",
".",
"reset_index",
"(",
")",
"data",
".",
"columns",
"=",
"[",
"... | https://github.com/ModelOriented/DALEX/blob/1fd2110c25cbed8f0f7e717c3795183271b386a7/python/dalex/dalex/fairness/_group_fairness/utils.py#L202-L218 | |
qiufengyuyi/sequence_tagging | ad6b3299ebbe32837f3d6e20c2c9190d6a8c934a | bert/run_classifier.py | python | InputExample.__init__ | (self, guid, text_a, text_b=None, label=None) | Constructs a InputExample.
Args:
guid: Unique id for the example.
text_a: string. The untokenized text of the first sequence. For single
sequence tasks, only this sequence must be specified.
text_b: (Optional) string. The untokenized text of the second sequence.
... | Constructs a InputExample. | [
"Constructs",
"a",
"InputExample",
"."
] | def __init__(self, guid, text_a, text_b=None, label=None):
"""Constructs a InputExample.
Args:
guid: Unique id for the example.
text_a: string. The untokenized text of the first sequence. For single
sequence tasks, only this sequence must be specified.
text_b: ... | [
"def",
"__init__",
"(",
"self",
",",
"guid",
",",
"text_a",
",",
"text_b",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"self",
".",
"guid",
"=",
"guid",
"self",
".",
"text_a",
"=",
"text_a",
"self",
".",
"text_b",
"=",
"text_b",
"self",
".",
... | https://github.com/qiufengyuyi/sequence_tagging/blob/ad6b3299ebbe32837f3d6e20c2c9190d6a8c934a/bert/run_classifier.py#L124-L139 | ||
sigmavirus24/github3.py | f642a27833d6bef93daf5bb27b35e5ddbcfbb773 | src/github3/session.py | python | BasicAuth.__repr__ | (self) | return f"basic {self.username}" | Use the username as the representation. | Use the username as the representation. | [
"Use",
"the",
"username",
"as",
"the",
"representation",
"."
] | def __repr__(self):
"""Use the username as the representation."""
return f"basic {self.username}" | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"f\"basic {self.username}\""
] | https://github.com/sigmavirus24/github3.py/blob/f642a27833d6bef93daf5bb27b35e5ddbcfbb773/src/github3/session.py#L31-L33 | |
jiajunsu/calculator_of_Onmyoji | fe9552128d78f37edf0b291e1cc76be1dc95b9f0 | calculator_of_Onmyoji/result_combination.py | python | load_comb_result_sheet | (filename) | return combs_data | load .csv comb file into memory. Not used in this version.
Args:
filename (str): File name to be loaded
Returns:
combs_data(list of OrderedDict): data of mitama combs. | load .csv comb file into memory. Not used in this version. | [
"load",
".",
"csv",
"comb",
"file",
"into",
"memory",
".",
"Not",
"used",
"in",
"this",
"version",
"."
] | def load_comb_result_sheet(filename):
"""load .csv comb file into memory. Not used in this version.
Args:
filename (str): File name to be loaded
Returns:
combs_data(list of OrderedDict): data of mitama combs.
"""
print("Loading previous result: %s" % filename)
with open(filenam... | [
"def",
"load_comb_result_sheet",
"(",
"filename",
")",
":",
"print",
"(",
"\"Loading previous result: %s\"",
"%",
"filename",
")",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"fd",
":",
"reader",
"=",
"csv",
".",
"DictReader",
"(",
"fd",
")",
"... | https://github.com/jiajunsu/calculator_of_Onmyoji/blob/fe9552128d78f37edf0b291e1cc76be1dc95b9f0/calculator_of_Onmyoji/result_combination.py#L162-L176 | |
pytorch/botorch | f85fb8ff36d21e21bdb881d107982fb6d5d78704 | botorch/utils/low_rank.py | python | _reshape_base_samples | (
base_samples: Tensor, sample_shape: torch.Size, posterior: GPyTorchPosterior
) | return base_samples.reshape(
*peshape[:-2],
peshape[-1],
peshape[-2],
*sample_shape,
) | r"""Manipulate shape of base_samples to match `MultivariateNormal.rsample`.
This ensure that base_samples are used in the same way as in
gpytorch.distributions.MultivariateNormal. For CBD, it is important to ensure
that the same base samples are used for the in-sample points here and in the
cached box ... | r"""Manipulate shape of base_samples to match `MultivariateNormal.rsample`. | [
"r",
"Manipulate",
"shape",
"of",
"base_samples",
"to",
"match",
"MultivariateNormal",
".",
"rsample",
"."
] | def _reshape_base_samples(
base_samples: Tensor, sample_shape: torch.Size, posterior: GPyTorchPosterior
) -> Tensor:
r"""Manipulate shape of base_samples to match `MultivariateNormal.rsample`.
This ensure that base_samples are used in the same way as in
gpytorch.distributions.MultivariateNormal. For CB... | [
"def",
"_reshape_base_samples",
"(",
"base_samples",
":",
"Tensor",
",",
"sample_shape",
":",
"torch",
".",
"Size",
",",
"posterior",
":",
"GPyTorchPosterior",
")",
"->",
"Tensor",
":",
"loc",
"=",
"posterior",
".",
"mvn",
".",
"loc",
"peshape",
"=",
"poster... | https://github.com/pytorch/botorch/blob/f85fb8ff36d21e21bdb881d107982fb6d5d78704/botorch/utils/low_rank.py#L40-L72 | |
deepgram/kur | fd0c120e50815c1e5be64e5dde964dcd47234556 | kur/loss/loss.py | python | Loss.get_name | (cls) | return cls.__name__.lower() | Returns the name of the loss function.
# Return value
A lower-case string unique to this loss function. | Returns the name of the loss function. | [
"Returns",
"the",
"name",
"of",
"the",
"loss",
"function",
"."
] | def get_name(cls):
""" Returns the name of the loss function.
# Return value
A lower-case string unique to this loss function.
"""
return cls.__name__.lower() | [
"def",
"get_name",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"__name__",
".",
"lower",
"(",
")"
] | https://github.com/deepgram/kur/blob/fd0c120e50815c1e5be64e5dde964dcd47234556/kur/loss/loss.py#L47-L54 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_tf_objects.py | python | TFRemBertForTokenClassification.call | (self, *args, **kwargs) | [] | def call(self, *args, **kwargs):
requires_backends(self, ["tf"]) | [
"def",
"call",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"self",
",",
"[",
"\"tf\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_tf_objects.py#L2265-L2266 | ||||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py | python | ExFileObject.close | (self) | Close the file object. | Close the file object. | [
"Close",
"the",
"file",
"object",
"."
] | def close(self):
"""Close the file object.
"""
self.closed = True | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"closed",
"=",
"True"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L905-L908 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/pyparsing.py | python | NotAny.__init__ | (self, expr) | [] | def __init__(self, expr):
super(NotAny, self).__init__(expr)
# ~ self.leaveWhitespace()
self.skipWhitespace = False # do NOT use self.leaveWhitespace(), don't want to propagate to exprs
self.mayReturnEmpty = True
self.errmsg = "Found unwanted token, " + _ustr(self.expr) | [
"def",
"__init__",
"(",
"self",
",",
"expr",
")",
":",
"super",
"(",
"NotAny",
",",
"self",
")",
".",
"__init__",
"(",
"expr",
")",
"# ~ self.leaveWhitespace()",
"self",
".",
"skipWhitespace",
"=",
"False",
"# do NOT use self.leaveWhitespace(), don't want to propaga... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/pyparsing.py#L4650-L4655 | ||||
magic-wormhole/magic-wormhole | e522a3992217b433ac2c36543bf85c27a7226ed9 | src/wormhole/transit.py | python | InboundConnectionFactory.__init__ | (self, owner) | [] | def __init__(self, owner):
self.owner = owner
self.start = time.time()
self._inbound_d = defer.Deferred(self._cancel)
self._pending_connections = set() | [
"def",
"__init__",
"(",
"self",
",",
"owner",
")",
":",
"self",
".",
"owner",
"=",
"owner",
"self",
".",
"start",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"_inbound_d",
"=",
"defer",
".",
"Deferred",
"(",
"self",
".",
"_cancel",
")",
"self"... | https://github.com/magic-wormhole/magic-wormhole/blob/e522a3992217b433ac2c36543bf85c27a7226ed9/src/wormhole/transit.py#L428-L432 | ||||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/flask/json.py | python | loads | (s, **kwargs) | return _json.loads(s, **kwargs) | Unserialize a JSON object from a string ``s`` by using the application's
configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
application on the stack. | Unserialize a JSON object from a string ``s`` by using the application's
configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
application on the stack. | [
"Unserialize",
"a",
"JSON",
"object",
"from",
"a",
"string",
"s",
"by",
"using",
"the",
"application",
"s",
"configured",
"decoder",
"(",
":",
"attr",
":",
"~flask",
".",
"Flask",
".",
"json_decoder",
")",
"if",
"there",
"is",
"an",
"application",
"on",
... | def loads(s, **kwargs):
"""Unserialize a JSON object from a string ``s`` by using the application's
configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
application on the stack.
"""
_load_arg_defaults(kwargs)
if isinstance(s, bytes):
s = s.decode(kwargs.pop('encoding', ... | [
"def",
"loads",
"(",
"s",
",",
"*",
"*",
"kwargs",
")",
":",
"_load_arg_defaults",
"(",
"kwargs",
")",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
":",
"s",
"=",
"s",
".",
"decode",
"(",
"kwargs",
".",
"pop",
"(",
"'encoding'",
",",
"None",
... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/flask/json.py#L141-L149 | |
chin-gyou/dialogue-utterance-rewriter | 5433e43af1b14d7d3a8d2142f26e46db4322c061 | decode.py | python | BeamSearchDecoder.write_for_attnvis | (self, article, abstract, decoded_words, attn_dists) | Write some data to json file, which can be read into the in-browser attention visualizer tool:
https://github.com/abisee/attn_vis
Args:
article: The original article string.
abstract: The human (correct) abstract string.
attn_dists: List of arrays; the attention distr... | Write some data to json file, which can be read into the in-browser attention visualizer tool:
https://github.com/abisee/attn_vis
Args:
article: The original article string.
abstract: The human (correct) abstract string.
attn_dists: List of arrays; the attention distr... | [
"Write",
"some",
"data",
"to",
"json",
"file",
"which",
"can",
"be",
"read",
"into",
"the",
"in",
"-",
"browser",
"attention",
"visualizer",
"tool",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"abisee",
"/",
"attn_vis",
"Args",
":",
"article",
... | def write_for_attnvis(self, article, abstract, decoded_words, attn_dists):
"""
Write some data to json file, which can be read into the in-browser attention visualizer tool:
https://github.com/abisee/attn_vis
Args:
article: The original article string.
abstract: T... | [
"def",
"write_for_attnvis",
"(",
"self",
",",
"article",
",",
"abstract",
",",
"decoded_words",
",",
"attn_dists",
")",
":",
"to_write",
"=",
"{",
"'origin_context'",
":",
"make_html_safe",
"(",
"article",
")",
",",
"'decoded_sum'",
":",
"make_html_safe",
"(",
... | https://github.com/chin-gyou/dialogue-utterance-rewriter/blob/5433e43af1b14d7d3a8d2142f26e46db4322c061/decode.py#L246-L265 | ||
uqfoundation/dill | 1094a28f685a330181e6894d0294509b1da08f3c | dill/_dill.py | python | _module_map | () | return modmap | get map of imported modules | get map of imported modules | [
"get",
"map",
"of",
"imported",
"modules"
] | def _module_map():
"""get map of imported modules"""
from collections import defaultdict
modmap = defaultdict(list)
items = 'items' if PY3 else 'iteritems'
for name, module in getattr(sys.modules, items)():
if module is None:
continue
for objname, obj in module.__dict__.i... | [
"def",
"_module_map",
"(",
")",
":",
"from",
"collections",
"import",
"defaultdict",
"modmap",
"=",
"defaultdict",
"(",
"list",
")",
"items",
"=",
"'items'",
"if",
"PY3",
"else",
"'iteritems'",
"for",
"name",
",",
"module",
"in",
"getattr",
"(",
"sys",
"."... | https://github.com/uqfoundation/dill/blob/1094a28f685a330181e6894d0294509b1da08f3c/dill/_dill.py#L359-L369 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | openedx/core/djangoapps/xblock/learning_context/learning_context.py | python | LearningContext.usage_for_child_include | (self, parent_usage, parent_definition, parsed_include) | Method that the runtime uses when loading a block's child, to get the
ID of the child. Must return a usage key.
The child is always from an <xblock-include /> element.
parent_usage: the UsageKeyV2 subclass key of the parent
parent_definition: the BundleDefinitionLocator key of the par... | Method that the runtime uses when loading a block's child, to get the
ID of the child. Must return a usage key. | [
"Method",
"that",
"the",
"runtime",
"uses",
"when",
"loading",
"a",
"block",
"s",
"child",
"to",
"get",
"the",
"ID",
"of",
"the",
"child",
".",
"Must",
"return",
"a",
"usage",
"key",
"."
] | def usage_for_child_include(self, parent_usage, parent_definition, parsed_include):
"""
Method that the runtime uses when loading a block's child, to get the
ID of the child. Must return a usage key.
The child is always from an <xblock-include /> element.
parent_usage: the Usag... | [
"def",
"usage_for_child_include",
"(",
"self",
",",
"parent_usage",
",",
"parent_definition",
",",
"parsed_include",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/xblock/learning_context/learning_context.py#L69-L87 | ||
openstack/cloudkitty | 78da8eac53c56566191aad548f035158877ccfe5 | cloudkitty/hacking/checks.py | python | no_translate_logs | (logical_line, filename) | Check for 'LOG.*(_('
Starting with the Pike series, OpenStack no longer supports log
translation.
* This check assumes that 'LOG' is a logger.
* Use filename so we can start enforcing this in specific folders instead
of needing to do so all at once.
C313 | Check for 'LOG.*(_(' | [
"Check",
"for",
"LOG",
".",
"*",
"(",
"_",
"("
] | def no_translate_logs(logical_line, filename):
"""Check for 'LOG.*(_('
Starting with the Pike series, OpenStack no longer supports log
translation.
* This check assumes that 'LOG' is a logger.
* Use filename so we can start enforcing this in specific folders instead
of needing to do so all a... | [
"def",
"no_translate_logs",
"(",
"logical_line",
",",
"filename",
")",
":",
"if",
"translated_logs",
".",
"match",
"(",
"logical_line",
")",
":",
"yield",
"(",
"0",
",",
"\"C313 Don't translate logs\"",
")"
] | https://github.com/openstack/cloudkitty/blob/78da8eac53c56566191aad548f035158877ccfe5/cloudkitty/hacking/checks.py#L103-L116 | ||
openstack/kuryr | 5b38e84ef8a0a62ee44d53ddd1cda377b0d9d934 | kuryr/lib/binding/drivers/utils.py | python | get_ipdb | () | return _IPDB_CACHE | Returns the already cached or a newly created IPDB instance.
IPDB reads the Linux specific file when it's instantiated. This behaviour
prevents Mac OSX users from running unit tests. This function makes the
loading IPDB lazyily and therefore it can be mocked after the import of
modules that import this... | Returns the already cached or a newly created IPDB instance. | [
"Returns",
"the",
"already",
"cached",
"or",
"a",
"newly",
"created",
"IPDB",
"instance",
"."
] | def get_ipdb():
"""Returns the already cached or a newly created IPDB instance.
IPDB reads the Linux specific file when it's instantiated. This behaviour
prevents Mac OSX users from running unit tests. This function makes the
loading IPDB lazyily and therefore it can be mocked after the import of
m... | [
"def",
"get_ipdb",
"(",
")",
":",
"global",
"_IPDB_CACHE",
"if",
"not",
"_IPDB_CACHE",
":",
"_IPDB_CACHE",
"=",
"pyroute2",
".",
"IPDB",
"(",
")",
"return",
"_IPDB_CACHE"
] | https://github.com/openstack/kuryr/blob/5b38e84ef8a0a62ee44d53ddd1cda377b0d9d934/kuryr/lib/binding/drivers/utils.py#L36-L49 | |
blackfeather-wang/ISDA-for-Deep-Networks | b66a594482557dada126211d65a4e9b6f4328423 | Semantic segmentation on Cityscapes/libs/bn.py | python | InPlaceABNSync.__init__ | (self, num_features, devices=None, eps=1e-5, momentum=0.1, affine=True, activation="leaky_relu",
slope=0.01) | Creates a synchronized, InPlace Activated Batch Normalization module
Parameters
----------
num_features : int
Number of feature channels in the input and output.
devices : list of int or None
IDs of the GPUs that will run the replicas of this module.
eps ... | Creates a synchronized, InPlace Activated Batch Normalization module | [
"Creates",
"a",
"synchronized",
"InPlace",
"Activated",
"Batch",
"Normalization",
"module"
] | def __init__(self, num_features, devices=None, eps=1e-5, momentum=0.1, affine=True, activation="leaky_relu",
slope=0.01):
"""Creates a synchronized, InPlace Activated Batch Normalization module
Parameters
----------
num_features : int
Number of feature chann... | [
"def",
"__init__",
"(",
"self",
",",
"num_features",
",",
"devices",
"=",
"None",
",",
"eps",
"=",
"1e-5",
",",
"momentum",
"=",
"0.1",
",",
"affine",
"=",
"True",
",",
"activation",
"=",
"\"leaky_relu\"",
",",
"slope",
"=",
"0.01",
")",
":",
"super",
... | https://github.com/blackfeather-wang/ISDA-for-Deep-Networks/blob/b66a594482557dada126211d65a4e9b6f4328423/Semantic segmentation on Cityscapes/libs/bn.py#L114-L156 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/mimify.py | python | mimify_part | (ifile, ofile, is_mime) | Convert an 8bit part of a MIME mail message to quoted-printable. | Convert an 8bit part of a MIME mail message to quoted-printable. | [
"Convert",
"an",
"8bit",
"part",
"of",
"a",
"MIME",
"mail",
"message",
"to",
"quoted",
"-",
"printable",
"."
] | def mimify_part(ifile, ofile, is_mime):
"""Convert an 8bit part of a MIME mail message to quoted-printable."""
has_cte = is_qp = is_base64 = 0
multipart = None
must_quote_body = must_quote_header = has_iso_chars = 0
header = []
header_end = ''
message = []
message_end = ''
# read he... | [
"def",
"mimify_part",
"(",
"ifile",
",",
"ofile",
",",
"is_mime",
")",
":",
"has_cte",
"=",
"is_qp",
"=",
"is_base64",
"=",
"0",
"multipart",
"=",
"None",
"must_quote_body",
"=",
"must_quote_header",
"=",
"has_iso_chars",
"=",
"0",
"header",
"=",
"[",
"]",... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/mimify.py#L280-L413 | ||
azavea/raster-vision | fc181a6f31f085affa1ee12f0204bdbc5a6bf85a | rastervision_core/rastervision/core/data/label_store/chip_classification_geojson_store.py | python | ChipClassificationGeoJSONStore.__init__ | (self, uri, class_config, crs_transformer) | Constructor.
Args:
uri: uri of GeoJSON file containing labels
class_config: ClassConfig
crs_transformer: CRSTransformer to convert from map coords in label
in GeoJSON file to pixel coords. | Constructor. | [
"Constructor",
"."
] | def __init__(self, uri, class_config, crs_transformer):
"""Constructor.
Args:
uri: uri of GeoJSON file containing labels
class_config: ClassConfig
crs_transformer: CRSTransformer to convert from map coords in label
in GeoJSON file to pixel coords.
... | [
"def",
"__init__",
"(",
"self",
",",
"uri",
",",
"class_config",
",",
"crs_transformer",
")",
":",
"self",
".",
"uri",
"=",
"uri",
"self",
".",
"class_config",
"=",
"class_config",
"self",
".",
"crs_transformer",
"=",
"crs_transformer"
] | https://github.com/azavea/raster-vision/blob/fc181a6f31f085affa1ee12f0204bdbc5a6bf85a/rastervision_core/rastervision/core/data/label_store/chip_classification_geojson_store.py#L13-L24 | ||
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.transformString | ( self, instring ) | Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string will then sca... | Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string will then sca... | [
"Extension",
"to",
"C",
"{",
"L",
"{",
"scanString",
"}}",
"to",
"modify",
"matching",
"text",
"with",
"modified",
"tokens",
"that",
"may",
"be",
"returned",
"from",
"a",
"parse",
"action",
".",
"To",
"use",
"C",
"{",
"transformString",
"}",
"define",
"a... | def transformString( self, instring ):
"""
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Inv... | [
"def",
"transformString",
"(",
"self",
",",
"instring",
")",
":",
"out",
"=",
"[",
"]",
"lastE",
"=",
"0",
"# force preservation of <TAB>s, to minimize unwanted transformation of string, and to",
"# keep string locs straight between transformString and scanString",
"self",
".",
... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pkg_resources/_vendor/pyparsing.py#L1692-L1733 | ||
etianen/django-watson | 077c336dd430a0eb397efecb2bf57867149a8d78 | watson/search.py | python | SearchContextManager._request_finished_receiver | (self, **kwargs) | Called at the end of a request, ensuring that any open contexts
are closed. Not closing all active contexts can cause memory leaks
and weird behaviour. | Called at the end of a request, ensuring that any open contexts
are closed. Not closing all active contexts can cause memory leaks
and weird behaviour. | [
"Called",
"at",
"the",
"end",
"of",
"a",
"request",
"ensuring",
"that",
"any",
"open",
"contexts",
"are",
"closed",
".",
"Not",
"closing",
"all",
"active",
"contexts",
"can",
"cause",
"memory",
"leaks",
"and",
"weird",
"behaviour",
"."
] | def _request_finished_receiver(self, **kwargs):
"""
Called at the end of a request, ensuring that any open contexts
are closed. Not closing all active contexts can cause memory leaks
and weird behaviour.
"""
while self.is_active():
self.end() | [
"def",
"_request_finished_receiver",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"while",
"self",
".",
"is_active",
"(",
")",
":",
"self",
".",
"end",
"(",
")"
] | https://github.com/etianen/django-watson/blob/077c336dd430a0eb397efecb2bf57867149a8d78/watson/search.py#L286-L293 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | uCSIsMusicalSymbols | (code) | return ret | Check whether the character is part of MusicalSymbols UCS
Block | Check whether the character is part of MusicalSymbols UCS
Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"MusicalSymbols",
"UCS",
"Block"
] | def uCSIsMusicalSymbols(code):
"""Check whether the character is part of MusicalSymbols UCS
Block """
ret = libxml2mod.xmlUCSIsMusicalSymbols(code)
return ret | [
"def",
"uCSIsMusicalSymbols",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsMusicalSymbols",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L2717-L2721 | |
google-research/tensor2robot | 484a15ee63df412f1f7e53861c936630ad31124b | models/model_interface.py | python | ModelInterface.preprocessor | (self) | Returns the preprocessor used to create preprocess model inputs. | Returns the preprocessor used to create preprocess model inputs. | [
"Returns",
"the",
"preprocessor",
"used",
"to",
"create",
"preprocess",
"model",
"inputs",
"."
] | def preprocessor(self):
"""Returns the preprocessor used to create preprocess model inputs.""" | [
"def",
"preprocessor",
"(",
"self",
")",
":"
] | https://github.com/google-research/tensor2robot/blob/484a15ee63df412f1f7e53861c936630ad31124b/models/model_interface.py#L60-L61 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/OpenLDAP/Integrations/OpenLDAP/OpenLDAP.py | python | LdapClient._fetch_specific_groups | (self, specific_groups: str) | Fetches specific ldap groups under given base DN. | Fetches specific ldap groups under given base DN. | [
"Fetches",
"specific",
"ldap",
"groups",
"under",
"given",
"base",
"DN",
"."
] | def _fetch_specific_groups(self, specific_groups: str) -> dict:
"""
Fetches specific ldap groups under given base DN.
"""
dn_list = [group.strip() for group in argToList(specific_groups, separator="#")]
with Connection(self._ldap_server, self._username, self._password) as lda... | [
"def",
"_fetch_specific_groups",
"(",
"self",
",",
"specific_groups",
":",
"str",
")",
"->",
"dict",
":",
"dn_list",
"=",
"[",
"group",
".",
"strip",
"(",
")",
"for",
"group",
"in",
"argToList",
"(",
"specific_groups",
",",
"separator",
"=",
"\"#\"",
")",
... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/OpenLDAP/Integrations/OpenLDAP/OpenLDAP.py#L201-L224 | ||
ztosec/hunter | 4ee5cca8dc5fc5d7e631e935517bd0f493c30a37 | SqlmapCelery/sqlmap/thirdparty/clientform/clientform.py | python | HTMLForm.add_file | (self, file_object, content_type=None, filename=None,
name=None, id=None, nr=None, label=None) | Add a file to be uploaded.
file_object: file-like object (with read method) from which to read
data to upload
content_type: MIME content type of data to upload
filename: filename to pass to server
If filename is None, no filename is sent to the server.
If content_type... | Add a file to be uploaded. | [
"Add",
"a",
"file",
"to",
"be",
"uploaded",
"."
] | def add_file(self, file_object, content_type=None, filename=None,
name=None, id=None, nr=None, label=None):
"""Add a file to be uploaded.
file_object: file-like object (with read method) from which to read
data to upload
content_type: MIME content type of data to uploa... | [
"def",
"add_file",
"(",
"self",
",",
"file_object",
",",
"content_type",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"name",
"=",
"None",
",",
"id",
"=",
"None",
",",
"nr",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"self",
".",
"find_co... | https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/SqlmapCelery/sqlmap/thirdparty/clientform/clientform.py#L3061-L3091 | ||
Ericsson/codechecker | c4e43f62dc3acbf71d3109b337db7c97f7852f43 | web/client/codechecker_client/cmd/cmd.py | python | __register_results | (parser) | Add argparse subcommand parser for the "list analysis results" action. | Add argparse subcommand parser for the "list analysis results" action. | [
"Add",
"argparse",
"subcommand",
"parser",
"for",
"the",
"list",
"analysis",
"results",
"action",
"."
] | def __register_results(parser):
"""
Add argparse subcommand parser for the "list analysis results" action.
"""
parser.add_argument(type=str,
nargs='+',
dest="names",
metavar='RUN_NAMES',
help="Names of the a... | [
"def",
"__register_results",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"type",
"=",
"str",
",",
"nargs",
"=",
"'+'",
",",
"dest",
"=",
"\"names\"",
",",
"metavar",
"=",
"'RUN_NAMES'",
",",
"help",
"=",
"\"Names of the analysis runs to show r... | https://github.com/Ericsson/codechecker/blob/c4e43f62dc3acbf71d3109b337db7c97f7852f43/web/client/codechecker_client/cmd/cmd.py#L449-L477 | ||
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/src/util/BeautifulSoup.py | python | UnicodeDammit._toUnicode | (self, data, encoding) | return newdata | Given a string and its encoding, decodes the string into Unicode.
%encoding is a string recognized by encodings.aliases | Given a string and its encoding, decodes the string into Unicode.
%encoding is a string recognized by encodings.aliases | [
"Given",
"a",
"string",
"and",
"its",
"encoding",
"decodes",
"the",
"string",
"into",
"Unicode",
".",
"%encoding",
"is",
"a",
"string",
"recognized",
"by",
"encodings",
".",
"aliases"
] | def _toUnicode(self, data, encoding):
'''Given a string and its encoding, decodes the string into Unicode.
%encoding is a string recognized by encodings.aliases'''
# strip Byte Order Mark (if present)
if (len(data) >= 4) and (data[:2] == '\xfe\xff') \
and (data[2:4] != '\... | [
"def",
"_toUnicode",
"(",
"self",
",",
"data",
",",
"encoding",
")",
":",
"# strip Byte Order Mark (if present)",
"if",
"(",
"len",
"(",
"data",
")",
">=",
"4",
")",
"and",
"(",
"data",
"[",
":",
"2",
"]",
"==",
"'\\xfe\\xff'",
")",
"and",
"(",
"data",... | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/util/BeautifulSoup.py#L1667-L1690 | |
hacktoolkit/django-htk | 902f3780630f1308aa97a70b9b62a5682239ff2d | lib/zillow/utils.py | python | Zestimate._parse | (self) | Parse the XML response in `self.xml`
Invariant: `self.xml` must be already set. | Parse the XML response in `self.xml` | [
"Parse",
"the",
"XML",
"response",
"in",
"self",
".",
"xml"
] | def _parse(self):
"""Parse the XML response in `self.xml`
Invariant: `self.xml` must be already set.
"""
soup = BeautifulSoup(self.xml, 'xml')
zrequest = soup.request
if zrequest:
self.request = {
'zpid' : zrequest.zpid.string,
}
... | [
"def",
"_parse",
"(",
"self",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"self",
".",
"xml",
",",
"'xml'",
")",
"zrequest",
"=",
"soup",
".",
"request",
"if",
"zrequest",
":",
"self",
".",
"request",
"=",
"{",
"'zpid'",
":",
"zrequest",
".",
"zpid"... | https://github.com/hacktoolkit/django-htk/blob/902f3780630f1308aa97a70b9b62a5682239ff2d/lib/zillow/utils.py#L56-L106 | ||
dimmg/flusk | f64bc46a13a8371f0ded3c49c5531abdea18425b | core/api/common/serializers.py | python | serialize_uuid | (rv) | return str(rv) | Register the `uuid.UUID` type
for the generic serializable function.
:param rv: object to be serialized
:type rv: uuid.UUID
:returns: string | Register the `uuid.UUID` type
for the generic serializable function.
:param rv: object to be serialized
:type rv: uuid.UUID
:returns: string | [
"Register",
"the",
"uuid",
".",
"UUID",
"type",
"for",
"the",
"generic",
"serializable",
"function",
".",
":",
"param",
"rv",
":",
"object",
"to",
"be",
"serialized",
":",
"type",
"rv",
":",
"uuid",
".",
"UUID",
":",
"returns",
":",
"string"
] | def serialize_uuid(rv):
"""Register the `uuid.UUID` type
for the generic serializable function.
:param rv: object to be serialized
:type rv: uuid.UUID
:returns: string
"""
return str(rv) | [
"def",
"serialize_uuid",
"(",
"rv",
")",
":",
"return",
"str",
"(",
"rv",
")"
] | https://github.com/dimmg/flusk/blob/f64bc46a13a8371f0ded3c49c5531abdea18425b/core/api/common/serializers.py#L29-L36 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/reshape/pivot.py | python | _build_names_mapper | (
rownames: list[str], colnames: list[str]
) | return rownames_mapper, unique_rownames, colnames_mapper, unique_colnames | Given the names of a DataFrame's rows and columns, returns a set of unique row
and column names and mappers that convert to original names.
A row or column name is replaced if it is duplicate among the rows of the inputs,
among the columns of the inputs or between the rows and the columns.
Parameters
... | Given the names of a DataFrame's rows and columns, returns a set of unique row
and column names and mappers that convert to original names. | [
"Given",
"the",
"names",
"of",
"a",
"DataFrame",
"s",
"rows",
"and",
"columns",
"returns",
"a",
"set",
"of",
"unique",
"row",
"and",
"column",
"names",
"and",
"mappers",
"that",
"convert",
"to",
"original",
"names",
"."
] | def _build_names_mapper(
rownames: list[str], colnames: list[str]
) -> tuple[dict[str, str], list[str], dict[str, str], list[str]]:
"""
Given the names of a DataFrame's rows and columns, returns a set of unique row
and column names and mappers that convert to original names.
A row or column name is... | [
"def",
"_build_names_mapper",
"(",
"rownames",
":",
"list",
"[",
"str",
"]",
",",
"colnames",
":",
"list",
"[",
"str",
"]",
")",
"->",
"tuple",
"[",
"dict",
"[",
"str",
",",
"str",
"]",
",",
"list",
"[",
"str",
"]",
",",
"dict",
"[",
"str",
",",
... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/reshape/pivot.py#L789-L840 | |
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/scheduler/manager.py | python | SchedulerManager._ensure_sufficient_hosts | (
self, context, hosts, required_count, claimed_uuids=None,
) | Checks that we have selected a host for each requested instance. If
not, log this failure, remove allocations for any claimed instances,
and raise a NoValidHost exception. | Checks that we have selected a host for each requested instance. If
not, log this failure, remove allocations for any claimed instances,
and raise a NoValidHost exception. | [
"Checks",
"that",
"we",
"have",
"selected",
"a",
"host",
"for",
"each",
"requested",
"instance",
".",
"If",
"not",
"log",
"this",
"failure",
"remove",
"allocations",
"for",
"any",
"claimed",
"instances",
"and",
"raise",
"a",
"NoValidHost",
"exception",
"."
] | def _ensure_sufficient_hosts(
self, context, hosts, required_count, claimed_uuids=None,
):
"""Checks that we have selected a host for each requested instance. If
not, log this failure, remove allocations for any claimed instances,
and raise a NoValidHost exception.
"""
... | [
"def",
"_ensure_sufficient_hosts",
"(",
"self",
",",
"context",
",",
"hosts",
",",
"required_count",
",",
"claimed_uuids",
"=",
"None",
",",
")",
":",
"if",
"len",
"(",
"hosts",
")",
"==",
"required_count",
":",
"# We have enough hosts.",
"return",
"if",
"clai... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/scheduler/manager.py#L425-L455 | ||
chiphuyen/stanford-tensorflow-tutorials | 51e53daaa2a32cfe7a1966f060b28dbbd081791c | 2017/examples/deepdream/deepdream_solution.py | python | get_layer | (layer) | return graph.get_tensor_by_name('import/%s:0' % layer) | Helper for getting layer output Tensor in model Graph.
Args:
layer: string, layer name
Returns:
Tensor for that layer. | Helper for getting layer output Tensor in model Graph. | [
"Helper",
"for",
"getting",
"layer",
"output",
"Tensor",
"in",
"model",
"Graph",
"."
] | def get_layer(layer):
"""Helper for getting layer output Tensor in model Graph.
Args:
layer: string, layer name
Returns:
Tensor for that layer.
"""
graph = tf.get_default_graph()
return graph.get_tensor_by_name('import/%s:0' % layer) | [
"def",
"get_layer",
"(",
"layer",
")",
":",
"graph",
"=",
"tf",
".",
"get_default_graph",
"(",
")",
"return",
"graph",
".",
"get_tensor_by_name",
"(",
"'import/%s:0'",
"%",
"layer",
")"
] | https://github.com/chiphuyen/stanford-tensorflow-tutorials/blob/51e53daaa2a32cfe7a1966f060b28dbbd081791c/2017/examples/deepdream/deepdream_solution.py#L31-L41 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py | python | disable_warnings | (category=exceptions.HTTPWarning) | Helper for quickly disabling all urllib3 warnings. | Helper for quickly disabling all urllib3 warnings. | [
"Helper",
"for",
"quickly",
"disabling",
"all",
"urllib3",
"warnings",
"."
] | def disable_warnings(category=exceptions.HTTPWarning):
"""
Helper for quickly disabling all urllib3 warnings.
"""
warnings.simplefilter('ignore', category) | [
"def",
"disable_warnings",
"(",
"category",
"=",
"exceptions",
".",
"HTTPWarning",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"'ignore'",
",",
"category",
")"
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py#L87-L91 | ||
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py | python | CNBiasNbSetWeight.as_dict | (self) | return {
"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"cn_weights": {str(cn): cnw for cn, cnw in self.cn_weights.items()},
"initialization_options": self.initialization_options,
} | MSONable dict | MSONable dict | [
"MSONable",
"dict"
] | def as_dict(self):
"""MSONable dict"""
return {
"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"cn_weights": {str(cn): cnw for cn, cnw in self.cn_weights.items()},
"initialization_options": self.initialization_options,
} | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"cn_weights\"",
":",
"{",
"str",
"(",
"cn",
")",
":",
"cn... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.py#L1926-L1933 | |
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/realm/featurization.py | python | Tokenizer._get_char_to_byte_map | (self, text) | return char_to_byte_map | Returns a map from character to byte offsets.
Args:
text (str): a Unicode string.
Returns:
a map from each character offset to a byte offset. | Returns a map from character to byte offsets. | [
"Returns",
"a",
"map",
"from",
"character",
"to",
"byte",
"offsets",
"."
] | def _get_char_to_byte_map(self, text):
"""Returns a map from character to byte offsets.
Args:
text (str): a Unicode string.
Returns:
a map from each character offset to a byte offset.
"""
char_to_byte_map = {}
char_offset = 0
byte_offset = 0
for character in text:
cha... | [
"def",
"_get_char_to_byte_map",
"(",
"self",
",",
"text",
")",
":",
"char_to_byte_map",
"=",
"{",
"}",
"char_offset",
"=",
"0",
"byte_offset",
"=",
"0",
"for",
"character",
"in",
"text",
":",
"char_to_byte_map",
"[",
"char_offset",
"]",
"=",
"byte_offset",
"... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/realm/featurization.py#L476-L494 | |
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/astroprint/plugin/services/system.py | python | SystemService.setAutoStorage | (self,data,sendResponse) | [] | def setAutoStorage(self,data,sendResponse):
s = settings()
if 'clearFiles' in data:
s.setBoolean(['clearFiles'], data['clearFiles'])
sendResponse({'success': 'no_error'}) | [
"def",
"setAutoStorage",
"(",
"self",
",",
"data",
",",
"sendResponse",
")",
":",
"s",
"=",
"settings",
"(",
")",
"if",
"'clearFiles'",
"in",
"data",
":",
"s",
".",
"setBoolean",
"(",
"[",
"'clearFiles'",
"]",
",",
"data",
"[",
"'clearFiles'",
"]",
")"... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/plugin/services/system.py#L553-L557 | ||||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbWuDaoKou.taobao_wdk_equipment_conveyor_exceptionslidewaylog_get | (
self,
warehouse_id='9999',
conveyor_id='1',
start_id='0'
) | return self._top_request(
"taobao.wdk.equipment.conveyor.exceptionslidewaylog.get",
{
"warehouse_id": warehouse_id,
"conveyor_id": conveyor_id,
"start_id": start_id
}
) | 异常通道日志查询
五道口悬挂链异常通道事件查询
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=30558
:param warehouse_id: 仓库Id
:param conveyor_id: 悬挂链Id,即wcsNum
:param start_id: 数据库id最小值 | 异常通道日志查询
五道口悬挂链异常通道事件查询
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=30558 | [
"异常通道日志查询",
"五道口悬挂链异常通道事件查询",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"30558"
] | def taobao_wdk_equipment_conveyor_exceptionslidewaylog_get(
self,
warehouse_id='9999',
conveyor_id='1',
start_id='0'
):
"""
异常通道日志查询
五道口悬挂链异常通道事件查询
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=30558
:param warehouse_id... | [
"def",
"taobao_wdk_equipment_conveyor_exceptionslidewaylog_get",
"(",
"self",
",",
"warehouse_id",
"=",
"'9999'",
",",
"conveyor_id",
"=",
"'1'",
",",
"start_id",
"=",
"'0'",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"taobao.wdk.equipment.conveyor.exceptio... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L62067-L62089 | |
wialon/gmqtt | 8f449b016e441075c8507b653ccafaa8b1615aeb | gmqtt/mqtt/handler.py | python | MqttPackageHandler.__get_handler__ | (self, cmd) | return self._handler_cache[cmd_type] | [] | def __get_handler__(self, cmd):
cmd_type = cmd & 0xF0
if cmd_type not in self._handler_cache:
handler_name = '_handle_{}_packet'.format(MQTTCommands(cmd_type).name.lower())
self._handler_cache[cmd_type] = getattr(self, handler_name, self._default_handler)
return self._han... | [
"def",
"__get_handler__",
"(",
"self",
",",
"cmd",
")",
":",
"cmd_type",
"=",
"cmd",
"&",
"0xF0",
"if",
"cmd_type",
"not",
"in",
"self",
".",
"_handler_cache",
":",
"handler_name",
"=",
"'_handle_{}_packet'",
".",
"format",
"(",
"MQTTCommands",
"(",
"cmd_typ... | https://github.com/wialon/gmqtt/blob/8f449b016e441075c8507b653ccafaa8b1615aeb/gmqtt/mqtt/handler.py#L204-L209 | |||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/email/charset.py | python | Charset.get_body_encoding | (self) | Return the content-transfer-encoding used for body encoding.
This is either the string `quoted-printable' or `base64' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object being
encoded. The function sh... | Return the content-transfer-encoding used for body encoding. | [
"Return",
"the",
"content",
"-",
"transfer",
"-",
"encoding",
"used",
"for",
"body",
"encoding",
"."
] | def get_body_encoding(self):
"""Return the content-transfer-encoding used for body encoding.
This is either the string `quoted-printable' or `base64' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object... | [
"def",
"get_body_encoding",
"(",
"self",
")",
":",
"assert",
"self",
".",
"body_encoding",
"!=",
"SHORTEST",
"if",
"self",
".",
"body_encoding",
"==",
"QP",
":",
"return",
"'quoted-printable'",
"elif",
"self",
".",
"body_encoding",
"==",
"BASE64",
":",
"return... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/email/charset.py#L249-L268 | ||
sqall01/alertR | e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13 | sensorClientICalendar/lib/client/core.py | python | Connection.recv | (self,
buffsize: int,
timeout: Optional[float] = 20.0) | Receives data on the connection.
:param buffsize: how much data at max is received
:param timeout: timeout of the receiving call | Receives data on the connection.
:param buffsize: how much data at max is received
:param timeout: timeout of the receiving call | [
"Receives",
"data",
"on",
"the",
"connection",
".",
":",
"param",
"buffsize",
":",
"how",
"much",
"data",
"at",
"max",
"is",
"received",
":",
"param",
"timeout",
":",
"timeout",
"of",
"the",
"receiving",
"call"
] | def recv(self,
buffsize: int,
timeout: Optional[float] = 20.0) -> bytes:
"""
Receives data on the connection.
:param buffsize: how much data at max is received
:param timeout: timeout of the receiving call
"""
raise NotImplementedError("Abstract ... | [
"def",
"recv",
"(",
"self",
",",
"buffsize",
":",
"int",
",",
"timeout",
":",
"Optional",
"[",
"float",
"]",
"=",
"20.0",
")",
"->",
"bytes",
":",
"raise",
"NotImplementedError",
"(",
"\"Abstract class.\"",
")"
] | https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/sensorClientICalendar/lib/client/core.py#L37-L45 | ||
arsenetar/dupeguru | eb57d269fcc1392fac9d49eb10d597a9c66fcc82 | qt/app.py | python | DupeGuru.create_results_window | (self) | Creates resultWindow and details_dialog depending on the selected ``app_mode``. | Creates resultWindow and details_dialog depending on the selected ``app_mode``. | [
"Creates",
"resultWindow",
"and",
"details_dialog",
"depending",
"on",
"the",
"selected",
"app_mode",
"."
] | def create_results_window(self):
"""Creates resultWindow and details_dialog depending on the selected ``app_mode``."""
if self.details_dialog is not None:
# The object is not deleted entirely, avoid saving its geometry in the future
# self.willSavePrefs.disconnect(self.details_di... | [
"def",
"create_results_window",
"(",
"self",
")",
":",
"if",
"self",
".",
"details_dialog",
"is",
"not",
"None",
":",
"# The object is not deleted entirely, avoid saving its geometry in the future",
"# self.willSavePrefs.disconnect(self.details_dialog.appWillSavePrefs)",
"# or simply... | https://github.com/arsenetar/dupeguru/blob/eb57d269fcc1392fac9d49eb10d597a9c66fcc82/qt/app.py#L376-L395 | ||
neuropsychology/NeuroKit | d01111b9b82364d28da01c002e6cbfc45d9493d9 | neurokit2/stats/cluster_quality.py | python | _cluster_quality_gap | (data, clusters, clustering, info, n_random=10) | return out | GAP statistic and modified GAP statistic by Mohajer (2011).
The GAP statistic compares the total within intra-cluster variation for different values of k
with their expected values under null reference distribution of the data. | GAP statistic and modified GAP statistic by Mohajer (2011). | [
"GAP",
"statistic",
"and",
"modified",
"GAP",
"statistic",
"by",
"Mohajer",
"(",
"2011",
")",
"."
] | def _cluster_quality_gap(data, clusters, clustering, info, n_random=10):
"""GAP statistic and modified GAP statistic by Mohajer (2011).
The GAP statistic compares the total within intra-cluster variation for different values of k
with their expected values under null reference distribution of the data.
... | [
"def",
"_cluster_quality_gap",
"(",
"data",
",",
"clusters",
",",
"clustering",
",",
"info",
",",
"n_random",
"=",
"10",
")",
":",
"dispersion",
"=",
"_cluster_quality_sumsquares",
"(",
"data",
",",
"clusters",
",",
"clustering",
")",
"mins",
",",
"maxs",
"=... | https://github.com/neuropsychology/NeuroKit/blob/d01111b9b82364d28da01c002e6cbfc45d9493d9/neurokit2/stats/cluster_quality.py#L194-L235 | |
foobuzz/todo | 048cb5d256745b09588088e7d2cac09217d62538 | source/todo/cli_parser.py | python | parse_args | (args) | return report | Apply application-level parsing of the values of the args dictionary
*in place*. Returns a report which is a list of errors (strings) that
might have occured during parsing. There's no waranty that the args
dictionary will work with the rest of the application if the report
list isn't empty. | Apply application-level parsing of the values of the args dictionary
*in place*. Returns a report which is a list of errors (strings) that
might have occured during parsing. There's no waranty that the args
dictionary will work with the rest of the application if the report
list isn't empty. | [
"Apply",
"application",
"-",
"level",
"parsing",
"of",
"the",
"values",
"of",
"the",
"args",
"dictionary",
"*",
"in",
"place",
"*",
".",
"Returns",
"a",
"report",
"which",
"is",
"a",
"list",
"of",
"errors",
"(",
"strings",
")",
"that",
"might",
"have",
... | def parse_args(args):
""" Apply application-level parsing of the values of the args dictionary
*in place*. Returns a report which is a list of errors (strings) that
might have occured during parsing. There's no waranty that the args
dictionary will work with the rest of the application if the report
list isn't emp... | [
"def",
"parse_args",
"(",
"args",
")",
":",
"report",
"=",
"[",
"]",
"for",
"arg_name",
",",
"parser",
"in",
"PARSERS",
":",
"value",
"=",
"args",
".",
"get",
"(",
"arg_name",
")",
"if",
"value",
"is",
"not",
"None",
":",
"success",
",",
"result",
... | https://github.com/foobuzz/todo/blob/048cb5d256745b09588088e7d2cac09217d62538/source/todo/cli_parser.py#L104-L119 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/timeit.py | python | timeit | (stmt="pass", setup="pass", timer=default_timer,
number=default_number, globals=None) | return Timer(stmt, setup, timer, globals).timeit(number) | Convenience function to create Timer object and call timeit method. | Convenience function to create Timer object and call timeit method. | [
"Convenience",
"function",
"to",
"create",
"Timer",
"object",
"and",
"call",
"timeit",
"method",
"."
] | def timeit(stmt="pass", setup="pass", timer=default_timer,
number=default_number, globals=None):
"""Convenience function to create Timer object and call timeit method."""
return Timer(stmt, setup, timer, globals).timeit(number) | [
"def",
"timeit",
"(",
"stmt",
"=",
"\"pass\"",
",",
"setup",
"=",
"\"pass\"",
",",
"timer",
"=",
"default_timer",
",",
"number",
"=",
"default_number",
",",
"globals",
"=",
"None",
")",
":",
"return",
"Timer",
"(",
"stmt",
",",
"setup",
",",
"timer",
"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/timeit.py#L231-L234 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/campaign_draft_service/client.py | python | CampaignDraftServiceClient.parse_campaign_path | (path: str) | return m.groupdict() if m else {} | Parse a campaign path into its component segments. | Parse a campaign path into its component segments. | [
"Parse",
"a",
"campaign",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_campaign_path(path: str) -> Dict[str, str]:
"""Parse a campaign path into its component segments."""
m = re.match(
r"^customers/(?P<customer_id>.+?)/campaigns/(?P<campaign_id>.+?)$",
path,
)
return m.groupdict() if m else {} | [
"def",
"parse_campaign_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^customers/(?P<customer_id>.+?)/campaigns/(?P<campaign_id>.+?)$\"",
",",
"path",
",",
")",
"return",
"m",
".",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/campaign_draft_service/client.py#L189-L195 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/utilites/textfile.py | python | writeTextFile | (fname, text) | Write text with utf-8 encoding | Write text with utf-8 encoding | [
"Write",
"text",
"with",
"utf",
"-",
"8",
"encoding"
] | def writeTextFile(fname, text):
"""
Write text with utf-8 encoding
"""
with open(fname, "w", encoding="utf-8", errors='surrogatepass') as fp:
fp.write(text) | [
"def",
"writeTextFile",
"(",
"fname",
",",
"text",
")",
":",
"with",
"open",
"(",
"fname",
",",
"\"w\"",
",",
"encoding",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"'surrogatepass'",
")",
"as",
"fp",
":",
"fp",
".",
"write",
"(",
"text",
")"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/utilites/textfile.py#L13-L18 | ||
gitless-vcs/gitless | 3ac28e39e170acdcd1590e0a25a06790ae0e6922 | gitless/cli/gl_commit.py | python | _auto_track | (files, curr_b) | Tracks those untracked files in the list. | Tracks those untracked files in the list. | [
"Tracks",
"those",
"untracked",
"files",
"in",
"the",
"list",
"."
] | def _auto_track(files, curr_b):
"""Tracks those untracked files in the list."""
for fp in files:
f = curr_b.status_file(fp)
if f.type == core.GL_STATUS_UNTRACKED:
curr_b.track_file(f.fp) | [
"def",
"_auto_track",
"(",
"files",
",",
"curr_b",
")",
":",
"for",
"fp",
"in",
"files",
":",
"f",
"=",
"curr_b",
".",
"status_file",
"(",
"fp",
")",
"if",
"f",
".",
"type",
"==",
"core",
".",
"GL_STATUS_UNTRACKED",
":",
"curr_b",
".",
"track_file",
... | https://github.com/gitless-vcs/gitless/blob/3ac28e39e170acdcd1590e0a25a06790ae0e6922/gitless/cli/gl_commit.py#L120-L125 | ||
pan-unit42/public_tools | 9ef8b06fdf18784d1729c8b9d7f804190a2d68c7 | DecryptPlugX/PlugXDecrypter.py | python | DecryptAlgo | (EncryptData,PayloadSize,StartKey,Keys) | return decrypt | IN: Encrypted Data, PayloadSize,StartKey and Dictionary of keys
OUT: Bytearray of decrypted data
Description:
This function is the PlugX crypto routine used in compressed PlugX samples | IN: Encrypted Data, PayloadSize,StartKey and Dictionary of keys
OUT: Bytearray of decrypted data | [
"IN",
":",
"Encrypted",
"Data",
"PayloadSize",
"StartKey",
"and",
"Dictionary",
"of",
"keys",
"OUT",
":",
"Bytearray",
"of",
"decrypted",
"data"
] | def DecryptAlgo(EncryptData,PayloadSize,StartKey,Keys):
"""
IN: Encrypted Data, PayloadSize,StartKey and Dictionary of keys
OUT: Bytearray of decrypted data
Description:
This function is the PlugX crypto routine used in compressed PlugX samples
"""
key0=StartKey&0xFFFFFFFF
key1=StartKey... | [
"def",
"DecryptAlgo",
"(",
"EncryptData",
",",
"PayloadSize",
",",
"StartKey",
",",
"Keys",
")",
":",
"key0",
"=",
"StartKey",
"&",
"0xFFFFFFFF",
"key1",
"=",
"StartKey",
"&",
"0xFFFFFFFF",
"key2",
"=",
"StartKey",
"&",
"0xFFFFFFFF",
"key3",
"=",
"StartKey",... | https://github.com/pan-unit42/public_tools/blob/9ef8b06fdf18784d1729c8b9d7f804190a2d68c7/DecryptPlugX/PlugXDecrypter.py#L134-L162 | |
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | lib/pythontwitter/__init__.py | python | List.SetSubscriber_count | (self, subscriber_count) | Set the subscriber_count of this list.
Args:
subscriber_count:
The subscriber_count of this list. | Set the subscriber_count of this list. | [
"Set",
"the",
"subscriber_count",
"of",
"this",
"list",
"."
] | def SetSubscriber_count(self, subscriber_count):
'''Set the subscriber_count of this list.
Args:
subscriber_count:
The subscriber_count of this list.
'''
self._subscriber_count = subscriber_count | [
"def",
"SetSubscriber_count",
"(",
"self",
",",
"subscriber_count",
")",
":",
"self",
".",
"_subscriber_count",
"=",
"subscriber_count"
] | https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/lib/pythontwitter/__init__.py#L1720-L1727 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/uuid.py | python | uuid5 | (namespace, name) | return UUID(bytes=hash[:16], version=5) | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | Generate a UUID from the SHA-1 hash of a namespace UUID and a name. | [
"Generate",
"a",
"UUID",
"from",
"the",
"SHA",
"-",
"1",
"hash",
"of",
"a",
"namespace",
"UUID",
"and",
"a",
"name",
"."
] | def uuid5(namespace, name):
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
from hashlib import sha1
hash = sha1(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=5) | [
"def",
"uuid5",
"(",
"namespace",
",",
"name",
")",
":",
"from",
"hashlib",
"import",
"sha1",
"hash",
"=",
"sha1",
"(",
"namespace",
".",
"bytes",
"+",
"name",
")",
".",
"digest",
"(",
")",
"return",
"UUID",
"(",
"bytes",
"=",
"hash",
"[",
":",
"16... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/uuid.py#L549-L553 | |
boto/boto | b2a6f08122b2f1b89888d2848e730893595cd001 | boto/emr/step.py | python | Step.jar | (self) | :rtype: str
:return: URI to the jar | :rtype: str
:return: URI to the jar | [
":",
"rtype",
":",
"str",
":",
"return",
":",
"URI",
"to",
"the",
"jar"
] | def jar(self):
"""
:rtype: str
:return: URI to the jar
"""
raise NotImplemented() | [
"def",
"jar",
"(",
"self",
")",
":",
"raise",
"NotImplemented",
"(",
")"
] | https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/emr/step.py#L30-L35 | ||
slackapi/python-slack-sdk | 2dee6656ffacb7de0c29bb2a6c2b51ec6b5dbce7 | slack/web/async_slack_response.py | python | AsyncSlackResponse.validate | (self) | Check if the response from Slack was successful.
Returns:
(AsyncSlackResponse)
This method returns it's own object. e.g. 'self'
Raises:
SlackApiError: The request to the Slack API failed. | Check if the response from Slack was successful. | [
"Check",
"if",
"the",
"response",
"from",
"Slack",
"was",
"successful",
"."
] | def validate(self):
"""Check if the response from Slack was successful.
Returns:
(AsyncSlackResponse)
This method returns it's own object. e.g. 'self'
Raises:
SlackApiError: The request to the Slack API failed.
"""
if self.status_code == ... | [
"def",
"validate",
"(",
"self",
")",
":",
"if",
"self",
".",
"status_code",
"==",
"200",
"and",
"self",
".",
"data",
"and",
"self",
".",
"data",
".",
"get",
"(",
"\"ok\"",
",",
"False",
")",
":",
"return",
"self",
"msg",
"=",
"\"The request to the Slac... | https://github.com/slackapi/python-slack-sdk/blob/2dee6656ffacb7de0c29bb2a6c2b51ec6b5dbce7/slack/web/async_slack_response.py#L182-L195 | ||
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/lib/autoai_ts_libs/autoai_window_transformed_target_regressor.py | python | _AutoaiWindowTransformedTargetRegressorImpl.fit | (self, X, y) | return self | [] | def fit(self, X, y):
self._wrapped_model.fit(X, y)
return self | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"self",
".",
"_wrapped_model",
".",
"fit",
"(",
"X",
",",
"y",
")",
"return",
"self"
] | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/lib/autoai_ts_libs/autoai_window_transformed_target_regressor.py#L71-L73 | |||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/payments/models.py | python | Payment.save | (self, user=None) | [] | def save(self, user=None):
if not self.id:
self.guid = str(uuid.uuid4())
if user and user.id:
self.creator = user
self.creator_username = user.username
if user and user.id:
self.owner = user
self.owner_username = user.userna... | [
"def",
"save",
"(",
"self",
",",
"user",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"id",
":",
"self",
".",
"guid",
"=",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"if",
"user",
"and",
"user",
".",
"id",
":",
"self",
".",
"creator... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/payments/models.py#L92-L102 | ||||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | xtune/src/transformers/data/processors/xglue.py | python | QnliProcessor.get_example_from_tensor_dict | (self, tensor_dict) | return InputExample(
tensor_dict["idx"].numpy(),
tensor_dict["question"].numpy().decode("utf-8"),
tensor_dict["sentence"].numpy().decode("utf-8"),
str(tensor_dict["label"].numpy()),
) | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_example_from_tensor_dict(self, tensor_dict):
"""See base class."""
return InputExample(
tensor_dict["idx"].numpy(),
tensor_dict["question"].numpy().decode("utf-8"),
tensor_dict["sentence"].numpy().decode("utf-8"),
str(tensor_dict["label"].numpy()),... | [
"def",
"get_example_from_tensor_dict",
"(",
"self",
",",
"tensor_dict",
")",
":",
"return",
"InputExample",
"(",
"tensor_dict",
"[",
"\"idx\"",
"]",
".",
"numpy",
"(",
")",
",",
"tensor_dict",
"[",
"\"question\"",
"]",
".",
"numpy",
"(",
")",
".",
"decode",
... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/data/processors/xglue.py#L555-L562 | |
Alexey-T/CudaText | 6a8b9a974c5d5029c6c273bde83198c83b3a5fb9 | app/cudatext.app/Contents/Resources/py/sys/urllib3/util/timeout.py | python | Timeout.read_timeout | (self) | Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If the connection time has not been
... | Get the value for the read timeout. | [
"Get",
"the",
"value",
"for",
"the",
"read",
"timeout",
"."
] | def read_timeout(self):
"""Get the value for the read timeout.
This assumes some time has elapsed in the connection timeout and
computes the read timeout appropriately.
If self.total is set, the read timeout is dependent on the amount of
time taken by the connect timeout. If th... | [
"def",
"read_timeout",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"total",
"is",
"not",
"None",
"and",
"self",
".",
"total",
"is",
"not",
"self",
".",
"DEFAULT_TIMEOUT",
"and",
"self",
".",
"_read",
"is",
"not",
"None",
"and",
"self",
".",
"_read... | https://github.com/Alexey-T/CudaText/blob/6a8b9a974c5d5029c6c273bde83198c83b3a5fb9/app/cudatext.app/Contents/Resources/py/sys/urllib3/util/timeout.py#L239-L268 | ||
kelvinguu/neural-editor | 3390140cb727b8c44092398fa68ceb0231b28e8b | third-party/gtd/gtd/io.py | python | JSONPicklable.to_json | (self) | return d | Use jsonpickle to convert this object to JSON. | Use jsonpickle to convert this object to JSON. | [
"Use",
"jsonpickle",
"to",
"convert",
"this",
"object",
"to",
"JSON",
"."
] | def to_json(self):
"""Use jsonpickle to convert this object to JSON."""
s = self.to_json_str()
d = json.loads(s) # convert str to dict
return d | [
"def",
"to_json",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"to_json_str",
"(",
")",
"d",
"=",
"json",
".",
"loads",
"(",
"s",
")",
"# convert str to dict",
"return",
"d"
] | https://github.com/kelvinguu/neural-editor/blob/3390140cb727b8c44092398fa68ceb0231b28e8b/third-party/gtd/gtd/io.py#L357-L361 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/bson/__init__.py | python | _get_date | (data, view, position, dummy0, opts, dummy1) | return _millis_to_datetime(
_UNPACK_LONG_FROM(data, position)[0], opts), position + 8 | Decode a BSON datetime to python datetime.datetime. | Decode a BSON datetime to python datetime.datetime. | [
"Decode",
"a",
"BSON",
"datetime",
"to",
"python",
"datetime",
".",
"datetime",
"."
] | def _get_date(data, view, position, dummy0, opts, dummy1):
"""Decode a BSON datetime to python datetime.datetime."""
return _millis_to_datetime(
_UNPACK_LONG_FROM(data, position)[0], opts), position + 8 | [
"def",
"_get_date",
"(",
"data",
",",
"view",
",",
"position",
",",
"dummy0",
",",
"opts",
",",
"dummy1",
")",
":",
"return",
"_millis_to_datetime",
"(",
"_UNPACK_LONG_FROM",
"(",
"data",
",",
"position",
")",
"[",
"0",
"]",
",",
"opts",
")",
",",
"pos... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/bson/__init__.py#L346-L349 | |
python-trio/trio | 4edfd41bd5519a2e626e87f6c6ca9fb32b90a6f4 | trio/_core/_unbounded_queue.py | python | UnboundedQueue.statistics | (self) | return _UnboundedQueueStats(
qsize=len(self._data), tasks_waiting=self._lot.statistics().tasks_waiting
) | Return an object containing debugging information.
Currently the following fields are defined:
* ``qsize``: The number of items currently in the queue.
* ``tasks_waiting``: The number of tasks blocked on this queue's
:meth:`get_batch` method. | Return an object containing debugging information. | [
"Return",
"an",
"object",
"containing",
"debugging",
"information",
"."
] | def statistics(self):
"""Return an object containing debugging information.
Currently the following fields are defined:
* ``qsize``: The number of items currently in the queue.
* ``tasks_waiting``: The number of tasks blocked on this queue's
:meth:`get_batch` method.
... | [
"def",
"statistics",
"(",
"self",
")",
":",
"return",
"_UnboundedQueueStats",
"(",
"qsize",
"=",
"len",
"(",
"self",
".",
"_data",
")",
",",
"tasks_waiting",
"=",
"self",
".",
"_lot",
".",
"statistics",
"(",
")",
".",
"tasks_waiting",
")"
] | https://github.com/python-trio/trio/blob/4edfd41bd5519a2e626e87f6c6ca9fb32b90a6f4/trio/_core/_unbounded_queue.py#L131-L143 | |
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/examples/human_segmentation/eval.py | python | evaluate | (args) | [] | def evaluate(args):
eval_transforms = transforms.Compose(
[transforms.Resize(args.image_shape), transforms.Normalize()])
eval_dataset = pdx.datasets.SegDataset(
data_dir=args.data_dir,
file_list=args.val_list,
transforms=eval_transforms)
model = pdx.load_model(args.model_di... | [
"def",
"evaluate",
"(",
"args",
")",
":",
"eval_transforms",
"=",
"transforms",
".",
"Compose",
"(",
"[",
"transforms",
".",
"Resize",
"(",
"args",
".",
"image_shape",
")",
",",
"transforms",
".",
"Normalize",
"(",
")",
"]",
")",
"eval_dataset",
"=",
"pd... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/examples/human_segmentation/eval.py#L68-L79 | ||||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | pypy/module/cpyext/dictobject.py | python | PyDict_Keys | (space, w_obj) | return space.call_method(space.w_dict, "keys", w_obj) | Return a PyListObject containing all the keys from the dictionary,
as in the dictionary method dict.keys(). | Return a PyListObject containing all the keys from the dictionary,
as in the dictionary method dict.keys(). | [
"Return",
"a",
"PyListObject",
"containing",
"all",
"the",
"keys",
"from",
"the",
"dictionary",
"as",
"in",
"the",
"dictionary",
"method",
"dict",
".",
"keys",
"()",
"."
] | def PyDict_Keys(space, w_obj):
"""Return a PyListObject containing all the keys from the dictionary,
as in the dictionary method dict.keys()."""
return space.call_method(space.w_dict, "keys", w_obj) | [
"def",
"PyDict_Keys",
"(",
"space",
",",
"w_obj",
")",
":",
"return",
"space",
".",
"call_method",
"(",
"space",
".",
"w_dict",
",",
"\"keys\"",
",",
"w_obj",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/cpyext/dictobject.py#L207-L210 | |
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/datasets/snap_dataset.py | python | EgoData.__inc__ | (self, key, value, *args, **kwargs) | [] | def __inc__(self, key, value, *args, **kwargs):
if key == 'circle':
return self.num_nodes
elif key == 'circle_batch':
return value.max().item() + 1 if value.numel() > 0 else 0
else:
return super().__inc__(key, value, *args, **kwargs) | [
"def",
"__inc__",
"(",
"self",
",",
"key",
",",
"value",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"key",
"==",
"'circle'",
":",
"return",
"self",
".",
"num_nodes",
"elif",
"key",
"==",
"'circle_batch'",
":",
"return",
"value",
".",
... | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/datasets/snap_dataset.py#L13-L19 | ||||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/xdrlib.py | python | Unpacker.unpack_double | (self) | return struct.unpack('>d', data)[0] | [] | def unpack_double(self):
i = self.__pos
self.__pos = j = i+8
data = self.__buf[i:j]
if len(data) < 8:
raise EOFError
return struct.unpack('>d', data)[0] | [
"def",
"unpack_double",
"(",
"self",
")",
":",
"i",
"=",
"self",
".",
"__pos",
"self",
".",
"__pos",
"=",
"j",
"=",
"i",
"+",
"8",
"data",
"=",
"self",
".",
"__buf",
"[",
"i",
":",
"j",
"]",
"if",
"len",
"(",
"data",
")",
"<",
"8",
":",
"ra... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/xdrlib.py#L195-L201 | |||
Eugeny/reconfigure | ff1115dede4b80222a2618d0e7657cafa36a2573 | reconfigure/parsers/iniparse/compat.py | python | RawConfigParser.has_option | (self, section, option) | return (option in sec) | Check for the existence of a given option in a given section. | Check for the existence of a given option in a given section. | [
"Check",
"for",
"the",
"existence",
"of",
"a",
"given",
"option",
"in",
"a",
"given",
"section",
"."
] | def has_option(self, section, option):
"""Check for the existence of a given option in a given section."""
if section in self.data:
sec = self.data[section]
else:
raise NoSectionError(section)
return (option in sec) | [
"def",
"has_option",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"if",
"section",
"in",
"self",
".",
"data",
":",
"sec",
"=",
"self",
".",
"data",
"[",
"section",
"]",
"else",
":",
"raise",
"NoSectionError",
"(",
"section",
")",
"return",
"... | https://github.com/Eugeny/reconfigure/blob/ff1115dede4b80222a2618d0e7657cafa36a2573/reconfigure/parsers/iniparse/compat.py#L163-L169 | |
deanishe/alfred-convert | 97407f4ec8dbca5abbc6952b2b56cf3918624177 | src/pkg_resources/__init__.py | python | DistInfoDistribution._compute_dependencies | (self) | return dm | Recompute this distribution's dependencies. | Recompute this distribution's dependencies. | [
"Recompute",
"this",
"distribution",
"s",
"dependencies",
"."
] | def _compute_dependencies(self):
"""Recompute this distribution's dependencies."""
dm = self.__dep_map = {None: []}
reqs = []
# Including any condition expressions
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
reqs.extend(parse_requirements(req))
... | [
"def",
"_compute_dependencies",
"(",
"self",
")",
":",
"dm",
"=",
"self",
".",
"__dep_map",
"=",
"{",
"None",
":",
"[",
"]",
"}",
"reqs",
"=",
"[",
"]",
"# Including any condition expressions",
"for",
"req",
"in",
"self",
".",
"_parsed_pkg_info",
".",
"get... | https://github.com/deanishe/alfred-convert/blob/97407f4ec8dbca5abbc6952b2b56cf3918624177/src/pkg_resources/__init__.py#L3026-L3047 | |
trezor/trezor-firmware | 5c4703c9bbfb962fbbe409c2e40030f30161e4f0 | python/src/trezorlib/cli/btc.py | python | sign_message | (
client: "TrezorClient",
coin: str,
address: str,
message: str,
script_type: messages.InputScriptType,
) | return {
"message": message,
"address": res.address,
"signature": base64.b64encode(res.signature).decode(),
} | Sign message using address of given path. | Sign message using address of given path. | [
"Sign",
"message",
"using",
"address",
"of",
"given",
"path",
"."
] | def sign_message(
client: "TrezorClient",
coin: str,
address: str,
message: str,
script_type: messages.InputScriptType,
) -> Dict[str, str]:
"""Sign message using address of given path."""
address_n = tools.parse_path(address)
res = btc.sign_message(client, coin, address_n, message, scri... | [
"def",
"sign_message",
"(",
"client",
":",
"\"TrezorClient\"",
",",
"coin",
":",
"str",
",",
"address",
":",
"str",
",",
"message",
":",
"str",
",",
"script_type",
":",
"messages",
".",
"InputScriptType",
",",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
... | https://github.com/trezor/trezor-firmware/blob/5c4703c9bbfb962fbbe409c2e40030f30161e4f0/python/src/trezorlib/cli/btc.py#L338-L352 | |
Runbook/runbook | 7b68622f75ef09f654046f0394540025f3ee7445 | src/actions/actions/rackspace-powercycle/__init__.py | python | call_action | (redata, jdata, logger) | Perform actual call | Perform actual call | [
"Perform",
"actual",
"call"
] | def call_action(redata, jdata, logger):
''' Perform actual call '''
# Authenticate with Rackspace ID service
headers = {'Content-Type': 'application/json'}
authmsg = {
"auth": {
"RAX-KSKEY:apiKeyCredentials": {
"username": redata['data']['username'],
... | [
"def",
"call_action",
"(",
"redata",
",",
"jdata",
",",
"logger",
")",
":",
"# Authenticate with Rackspace ID service",
"headers",
"=",
"{",
"'Content-Type'",
":",
"'application/json'",
"}",
"authmsg",
"=",
"{",
"\"auth\"",
":",
"{",
"\"RAX-KSKEY:apiKeyCredentials\"",... | https://github.com/Runbook/runbook/blob/7b68622f75ef09f654046f0394540025f3ee7445/src/actions/actions/rackspace-powercycle/__init__.py#L37-L98 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | IResourceProvider.get_resource_filename | (manager, resource_name) | Return a true filesystem path for `resource_name`
`manager` must be an ``IResourceManager`` | Return a true filesystem path for `resource_name` | [
"Return",
"a",
"true",
"filesystem",
"path",
"for",
"resource_name"
] | def get_resource_filename(manager, resource_name):
"""Return a true filesystem path for `resource_name`
`manager` must be an ``IResourceManager``""" | [
"def",
"get_resource_filename",
"(",
"manager",
",",
"resource_name",
")",
":"
] | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L590-L593 | ||
DistrictDataLabs/yellowbrick | 2eb8e3edfbe6f3f22c595b38989a23ba7cea40cf | yellowbrick/classifier/base.py | python | ClassificationScoreVisualizer.class_colors_ | (self) | return self._colors | Returns ``_colors`` if it exists, otherwise computes a categorical color
per class based on the matplotlib color cycle. If the visualizer is not
fitted, raises a NotFitted exception.
If subclasses require users to choose colors or have specialized color
handling, they should set ``_colo... | Returns ``_colors`` if it exists, otherwise computes a categorical color
per class based on the matplotlib color cycle. If the visualizer is not
fitted, raises a NotFitted exception. | [
"Returns",
"_colors",
"if",
"it",
"exists",
"otherwise",
"computes",
"a",
"categorical",
"color",
"per",
"class",
"based",
"on",
"the",
"matplotlib",
"color",
"cycle",
".",
"If",
"the",
"visualizer",
"is",
"not",
"fitted",
"raises",
"a",
"NotFitted",
"exceptio... | def class_colors_(self):
"""
Returns ``_colors`` if it exists, otherwise computes a categorical color
per class based on the matplotlib color cycle. If the visualizer is not
fitted, raises a NotFitted exception.
If subclasses require users to choose colors or have specialized co... | [
"def",
"class_colors_",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_colors\"",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"classes_\"",
")",
":",
"raise",
"NotFitted",
"(",
"\"cannot determine colors before fit\"",
")",
"#... | https://github.com/DistrictDataLabs/yellowbrick/blob/2eb8e3edfbe6f3f22c595b38989a23ba7cea40cf/yellowbrick/classifier/base.py#L137-L156 | |
sxjscience/HKO-7 | adeb05a366d4b57f94a5ddb814af57cc62ffe3c5 | nowcasting/operators/common.py | python | weighted_mae | (pred, gt, weight) | return weighted_l1(pred, gt, weight) | [] | def weighted_mae(pred, gt, weight):
return weighted_l1(pred, gt, weight) | [
"def",
"weighted_mae",
"(",
"pred",
",",
"gt",
",",
"weight",
")",
":",
"return",
"weighted_l1",
"(",
"pred",
",",
"gt",
",",
"weight",
")"
] | https://github.com/sxjscience/HKO-7/blob/adeb05a366d4b57f94a5ddb814af57cc62ffe3c5/nowcasting/operators/common.py#L417-L418 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/setuptools/sandbox.py | python | DirectorySandbox.tmpnam | (self) | [] | def tmpnam(self):
self._violation("tmpnam") | [
"def",
"tmpnam",
"(",
"self",
")",
":",
"self",
".",
"_violation",
"(",
"\"tmpnam\"",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/setuptools/sandbox.py#L421-L422 | ||||
google/android-emulator-container-scripts | 0d5f55ca938818486a2ad638b91464e952e87cf4 | emu/android_release_zip.py | python | SystemImageReleaseZip.tag | (self) | return tag | The tag associated with this release. | The tag associated with this release. | [
"The",
"tag",
"associated",
"with",
"this",
"release",
"."
] | def tag(self):
"""The tag associated with this release."""
tag = self.props.get("SystemImage.TagId", "")
if tag == "default" or tag.strip() == "":
tag = "android"
return tag | [
"def",
"tag",
"(",
"self",
")",
":",
"tag",
"=",
"self",
".",
"props",
".",
"get",
"(",
"\"SystemImage.TagId\"",
",",
"\"\"",
")",
"if",
"tag",
"==",
"\"default\"",
"or",
"tag",
".",
"strip",
"(",
")",
"==",
"\"\"",
":",
"tag",
"=",
"\"android\"",
... | https://github.com/google/android-emulator-container-scripts/blob/0d5f55ca938818486a2ad638b91464e952e87cf4/emu/android_release_zip.py#L159-L164 | |
hsoft/moneyguru | 802f2f45c181224f5a14272d58dd90bac80bcf22 | core/util.py | python | first | (iterable) | Returns the first item of ``iterable``. | Returns the first item of ``iterable``. | [
"Returns",
"the",
"first",
"item",
"of",
"iterable",
"."
] | def first(iterable):
"""Returns the first item of ``iterable``.
"""
try:
return next(iter(iterable))
except StopIteration:
return None | [
"def",
"first",
"(",
"iterable",
")",
":",
"try",
":",
"return",
"next",
"(",
"iter",
"(",
"iterable",
")",
")",
"except",
"StopIteration",
":",
"return",
"None"
] | https://github.com/hsoft/moneyguru/blob/802f2f45c181224f5a14272d58dd90bac80bcf22/core/util.py#L61-L67 | ||
kamalgill/flask-appengine-template | 11760f83faccbb0d0afe416fc58e67ecfb4643c2 | src/lib/click/_compat.py | python | is_ascii_encoding | (encoding) | Checks if a given encoding is ascii. | Checks if a given encoding is ascii. | [
"Checks",
"if",
"a",
"given",
"encoding",
"is",
"ascii",
"."
] | def is_ascii_encoding(encoding):
"""Checks if a given encoding is ascii."""
try:
return codecs.lookup(encoding).name == 'ascii'
except LookupError:
return False | [
"def",
"is_ascii_encoding",
"(",
"encoding",
")",
":",
"try",
":",
"return",
"codecs",
".",
"lookup",
"(",
"encoding",
")",
".",
"name",
"==",
"'ascii'",
"except",
"LookupError",
":",
"return",
"False"
] | https://github.com/kamalgill/flask-appengine-template/blob/11760f83faccbb0d0afe416fc58e67ecfb4643c2/src/lib/click/_compat.py#L30-L35 | ||
UniversalDependencies/tools | 74faa47086440d03e06aa26bc7a8247878737c18 | compat/argparse.py | python | _SubParsersAction.__call__ | (self, parser, namespace, values, option_string=None) | [] | def __call__(self, parser, namespace, values, option_string=None):
parser_name = values[0]
arg_strings = values[1:]
# set the parser name if requested
if self.dest is not SUPPRESS:
setattr(namespace, self.dest, parser_name)
# select the parser
try:
... | [
"def",
"__call__",
"(",
"self",
",",
"parser",
",",
"namespace",
",",
"values",
",",
"option_string",
"=",
"None",
")",
":",
"parser_name",
"=",
"values",
"[",
"0",
"]",
"arg_strings",
"=",
"values",
"[",
"1",
":",
"]",
"# set the parser name if requested",
... | https://github.com/UniversalDependencies/tools/blob/74faa47086440d03e06aa26bc7a8247878737c18/compat/argparse.py#L1092-L1114 | ||||
sth2018/FastWordQuery | 901ebe8fd5989d8861d20ee3fec3acd15b7f46a5 | addons/fastwq/gui/base.py | python | Dialog.__init__ | (self, parent, title) | Set the modal status for the dialog, sets its layout to the
return value of the _ui() method, and sets a default title. | Set the modal status for the dialog, sets its layout to the
return value of the _ui() method, and sets a default title. | [
"Set",
"the",
"modal",
"status",
"for",
"the",
"dialog",
"sets",
"its",
"layout",
"to",
"the",
"return",
"value",
"of",
"the",
"_ui",
"()",
"method",
"and",
"sets",
"a",
"default",
"title",
"."
] | def __init__(self, parent, title):
'''
Set the modal status for the dialog, sets its layout to the
return value of the _ui() method, and sets a default title.
'''
self._title = title
self._parent = parent
super(Dialog, self).__init__(parent)
self.setModa... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"title",
")",
":",
"self",
".",
"_title",
"=",
"title",
"self",
".",
"_parent",
"=",
"parent",
"super",
"(",
"Dialog",
",",
"self",
")",
".",
"__init__",
"(",
"parent",
")",
"self",
".",
"setModal",... | https://github.com/sth2018/FastWordQuery/blob/901ebe8fd5989d8861d20ee3fec3acd15b7f46a5/addons/fastwq/gui/base.py#L34-L56 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/sqli/thirdparty/chardet/chardistribution.py | python | EUCJPDistributionAnalysis.__init__ | (self) | [] | def __init__(self):
CharDistributionAnalysis.__init__(self)
self._mCharToFreqOrder = JISCharToFreqOrder
self._mTableSize = JIS_TABLE_SIZE
self._mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO | [
"def",
"__init__",
"(",
"self",
")",
":",
"CharDistributionAnalysis",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"_mCharToFreqOrder",
"=",
"JISCharToFreqOrder",
"self",
".",
"_mTableSize",
"=",
"JIS_TABLE_SIZE",
"self",
".",
"_mTypicalDistributionRatio",
"=",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/chardet/chardistribution.py#L186-L190 | ||||
teamclairvoyant/airflow-rest-api-plugin | 4434b462af6af56fbb9876d5b9bb251b96d26124 | plugins/rest_api_plugin.py | python | REST_API.get_empty_process_output | () | return {
"stderr": "",
"stdin": "",
"stdout": ""
} | [] | def get_empty_process_output():
return {
"stderr": "",
"stdin": "",
"stdout": ""
} | [
"def",
"get_empty_process_output",
"(",
")",
":",
"return",
"{",
"\"stderr\"",
":",
"\"\"",
",",
"\"stdin\"",
":",
"\"\"",
",",
"\"stdout\"",
":",
"\"\"",
"}"
] | https://github.com/teamclairvoyant/airflow-rest-api-plugin/blob/4434b462af6af56fbb9876d5b9bb251b96d26124/plugins/rest_api_plugin.py#L1128-L1133 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Demo/tkinter/guido/sortvisu.py | python | Array.hide_pivot | (self) | [] | def hide_pivot(self):
self.pivot.coords(((0, 0), (0, 0))) | [
"def",
"hide_pivot",
"(",
"self",
")",
":",
"self",
".",
"pivot",
".",
"coords",
"(",
"(",
"(",
"0",
",",
"0",
")",
",",
"(",
"0",
",",
"0",
")",
")",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/tkinter/guido/sortvisu.py#L156-L157 | ||||
USEPA/WNTR | 2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc | wntr/sim/aml/expr.py | python | UnaryOperator.__init__ | (self, operand) | Parameters
----------
operand: Node | Parameters
----------
operand: Node | [
"Parameters",
"----------",
"operand",
":",
"Node"
] | def __init__(self, operand):
"""
Parameters
----------
operand: Node
"""
self._operand = operand | [
"def",
"__init__",
"(",
"self",
",",
"operand",
")",
":",
"self",
".",
"_operand",
"=",
"operand"
] | https://github.com/USEPA/WNTR/blob/2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc/wntr/sim/aml/expr.py#L800-L806 | ||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/dev/bdf_vectorized2/bdf_vectorized.py | python | BDF_._prepare_chexa | (self, unused_card: List[str], card_obj: BDFCard, comment='') | return elem | adds a CHEXA8/CHEXA20 | adds a CHEXA8/CHEXA20 | [
"adds",
"a",
"CHEXA8",
"/",
"CHEXA20"
] | def _prepare_chexa(self, unused_card: List[str], card_obj: BDFCard, comment='') -> None:
"""adds a CHEXA8/CHEXA20"""
if len(card_obj) == 11:
elem = CHEXA8.add_card(card_obj, comment=comment)
else:
elem = CHEXA20.add_card(card_obj, comment=comment)
self._add_method... | [
"def",
"_prepare_chexa",
"(",
"self",
",",
"unused_card",
":",
"List",
"[",
"str",
"]",
",",
"card_obj",
":",
"BDFCard",
",",
"comment",
"=",
"''",
")",
"->",
"None",
":",
"if",
"len",
"(",
"card_obj",
")",
"==",
"11",
":",
"elem",
"=",
"CHEXA8",
"... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized2/bdf_vectorized.py#L2820-L2827 | |
yongzhuo/nlp_xiaojiang | 729f8ee20d4ff9db9f8dfd75e745e8ca5ba7cee6 | ChatBot/chatbot_search/chatbot_tfserving/indexAnnoy.py | python | AnnoySearch.save | (self, path) | 存储 | 存储 | [
"存储"
] | def save(self, path):
""" 存储 """
self.annoy_index.save(path) | [
"def",
"save",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"annoy_index",
".",
"save",
"(",
"path",
")"
] | https://github.com/yongzhuo/nlp_xiaojiang/blob/729f8ee20d4ff9db9f8dfd75e745e8ca5ba7cee6/ChatBot/chatbot_search/chatbot_tfserving/indexAnnoy.py#L34-L36 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pkg_resources/__init__.py | python | WorkingSet.__getstate__ | (self) | return (
self.entries[:], self.entry_keys.copy(), self.by_key.copy(),
self.callbacks[:]
) | [] | def __getstate__(self):
return (
self.entries[:], self.entry_keys.copy(), self.by_key.copy(),
self.callbacks[:]
) | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"entries",
"[",
":",
"]",
",",
"self",
".",
"entry_keys",
".",
"copy",
"(",
")",
",",
"self",
".",
"by_key",
".",
"copy",
"(",
")",
",",
"self",
".",
"callbacks",
"[",
":",... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pkg_resources/__init__.py#L1009-L1013 | |||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | delete_table_column_statistics_result.validate | (self) | return | [] | def validate(self):
return | [
"def",
"validate",
"(",
"self",
")",
":",
"return"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L27348-L27349 | |||
google/Legilimency | 02cd38fd82a90bca789b8bf61c88f4bc5dd1eb07 | BCMClient.py | python | BCMClient.get_pcie_obj | (self) | return self.pcie_obj | Returns the address of the PCIe object. | Returns the address of the PCIe object. | [
"Returns",
"the",
"address",
"of",
"the",
"PCIe",
"object",
"."
] | def get_pcie_obj(self):
"""
Returns the address of the PCIe object.
"""
return self.pcie_obj | [
"def",
"get_pcie_obj",
"(",
"self",
")",
":",
"return",
"self",
".",
"pcie_obj"
] | https://github.com/google/Legilimency/blob/02cd38fd82a90bca789b8bf61c88f4bc5dd1eb07/BCMClient.py#L109-L114 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/gce.py | python | GCENodeDriver.ex_get_targetinstance | (self, name, zone=None) | return self._to_targetinstance(response) | Return a TargetInstance object based on a name and optional zone.
:param name: The name of the target instance
:type name: ``str``
:keyword zone: The zone to search for the target instance in (set to
'all' to search all zones).
:type zone: ``str`` or :... | Return a TargetInstance object based on a name and optional zone. | [
"Return",
"a",
"TargetInstance",
"object",
"based",
"on",
"a",
"name",
"and",
"optional",
"zone",
"."
] | def ex_get_targetinstance(self, name, zone=None):
"""
Return a TargetInstance object based on a name and optional zone.
:param name: The name of the target instance
:type name: ``str``
:keyword zone: The zone to search for the target instance in (set to
... | [
"def",
"ex_get_targetinstance",
"(",
"self",
",",
"name",
",",
"zone",
"=",
"None",
")",
":",
"zone",
"=",
"self",
".",
"_set_zone",
"(",
"zone",
")",
"or",
"self",
".",
"_find_zone_or_region",
"(",
"name",
",",
"\"targetInstances\"",
",",
"res_name",
"=",... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/gce.py#L8199-L8218 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/util/task_system.py | python | getModNameForModDict | (obj) | return None | :type obj: dict
:rtype: str | None
:returns The module name or None. It will not return '__main__' in any case
because that likely will not be the same in the unpickling environment.
Also see: https://stackoverflow.com/questions/56171796/ | :type obj: dict
:rtype: str | None
:returns The module name or None. It will not return '__main__' in any case
because that likely will not be the same in the unpickling environment.
Also see: https://stackoverflow.com/questions/56171796/ | [
":",
"type",
"obj",
":",
"dict",
":",
"rtype",
":",
"str",
"|",
"None",
":",
"returns",
"The",
"module",
"name",
"or",
"None",
".",
"It",
"will",
"not",
"return",
"__main__",
"in",
"any",
"case",
"because",
"that",
"likely",
"will",
"not",
"be",
"the... | def getModNameForModDict(obj):
"""
:type obj: dict
:rtype: str | None
:returns The module name or None. It will not return '__main__' in any case
because that likely will not be the same in the unpickling environment.
Also see: https://stackoverflow.com/questions/56171796/
"""
if "__name__" not in obj:
... | [
"def",
"getModNameForModDict",
"(",
"obj",
")",
":",
"if",
"\"__name__\"",
"not",
"in",
"obj",
":",
"return",
"None",
"# this is not a module",
"mod_name",
"=",
"obj",
"[",
"\"__name__\"",
"]",
"if",
"mod_name",
"==",
"\"__main__\"",
":",
"return",
"None",
"if... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/util/task_system.py#L565-L583 | |
PaulSonOfLars/tgbot | 0ece72778b7772725ab214fe0929daaa2fc7d2d1 | tg_bot/modules/sql/locks_sql.py | python | init_restrictions | (chat_id, reset=False) | return restr | [] | def init_restrictions(chat_id, reset=False):
curr_restr = SESSION.query(Restrictions).get(str(chat_id))
if reset:
SESSION.delete(curr_restr)
SESSION.flush()
restr = Restrictions(str(chat_id))
SESSION.add(restr)
SESSION.commit()
return restr | [
"def",
"init_restrictions",
"(",
"chat_id",
",",
"reset",
"=",
"False",
")",
":",
"curr_restr",
"=",
"SESSION",
".",
"query",
"(",
"Restrictions",
")",
".",
"get",
"(",
"str",
"(",
"chat_id",
")",
")",
"if",
"reset",
":",
"SESSION",
".",
"delete",
"(",... | https://github.com/PaulSonOfLars/tgbot/blob/0ece72778b7772725ab214fe0929daaa2fc7d2d1/tg_bot/modules/sql/locks_sql.py#L88-L96 | |||
PaddlePaddle/models | 511e2e282960ed4c7440c3f1d1e62017acb90e11 | tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_ref/torchvision/transforms/functional_pil.py | python | rotate | (img, angle, interpolation=0, expand=False, center=None, fill=None) | return img.rotate(angle, interpolation, expand, center, **opts) | [] | def rotate(img, angle, interpolation=0, expand=False, center=None, fill=None):
if not _is_pil_image(img):
raise TypeError("img should be PIL Image. Got {}".format(type(img)))
opts = _parse_fill(fill, img)
return img.rotate(angle, interpolation, expand, center, **opts) | [
"def",
"rotate",
"(",
"img",
",",
"angle",
",",
"interpolation",
"=",
"0",
",",
"expand",
"=",
"False",
",",
"center",
"=",
"None",
",",
"fill",
"=",
"None",
")",
":",
"if",
"not",
"_is_pil_image",
"(",
"img",
")",
":",
"raise",
"TypeError",
"(",
"... | https://github.com/PaddlePaddle/models/blob/511e2e282960ed4c7440c3f1d1e62017acb90e11/tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_ref/torchvision/transforms/functional_pil.py#L289-L294 | |||
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/imdb_urdu_reviews/imdb_urdu_reviews.py | python | ImdbUrduReviews._split_generators | (self, dl_manager) | return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"filepath": os.path.join(dl_path, "imdb_urdu_reviews.csv")}
),
] | Returns SplitGenerators. | Returns SplitGenerators. | [
"Returns",
"SplitGenerators",
"."
] | def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
dl_path = dl_manager.download_and_extract(_URL)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"filepath": os.path.join(dl_path, "imdb_urdu_reviews.csv")}
),
... | [
"def",
"_split_generators",
"(",
"self",
",",
"dl_manager",
")",
":",
"dl_path",
"=",
"dl_manager",
".",
"download_and_extract",
"(",
"_URL",
")",
"return",
"[",
"datasets",
".",
"SplitGenerator",
"(",
"name",
"=",
"datasets",
".",
"Split",
".",
"TRAIN",
","... | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/imdb_urdu_reviews/imdb_urdu_reviews.py#L57-L64 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | scripts/iam-tools/delete_iam_account.py | python | DeleteUser.get_keys | (user_name, client, aws_account) | Get the Access Key IDs of the user, and return them in a list.
Returns:
All access keys found for the IAM user, in a list.
List will be empty if the user has no keys. | Get the Access Key IDs of the user, and return them in a list. | [
"Get",
"the",
"Access",
"Key",
"IDs",
"of",
"the",
"user",
"and",
"return",
"them",
"in",
"a",
"list",
"."
] | def get_keys(user_name, client, aws_account):
""" Get the Access Key IDs of the user, and return them in a list.
Returns:
All access keys found for the IAM user, in a list.
List will be empty if the user has no keys.
"""
try:
client.list_access_keys... | [
"def",
"get_keys",
"(",
"user_name",
",",
"client",
",",
"aws_account",
")",
":",
"try",
":",
"client",
".",
"list_access_keys",
"(",
"UserName",
"=",
"user_name",
")",
"except",
"botocore",
".",
"exceptions",
".",
"ClientError",
"as",
"client_exception",
":",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/scripts/iam-tools/delete_iam_account.py#L158-L186 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailadmin/userbar.py | python | BaseItem.render | (self, request) | return render_to_string(self.template, dict(self=self, request=request), request=request) | [] | def render(self, request):
return render_to_string(self.template, dict(self=self, request=request), request=request) | [
"def",
"render",
"(",
"self",
",",
"request",
")",
":",
"return",
"render_to_string",
"(",
"self",
".",
"template",
",",
"dict",
"(",
"self",
"=",
"self",
",",
"request",
"=",
"request",
")",
",",
"request",
"=",
"request",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailadmin/userbar.py#L9-L10 | |||
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/FCN/tensorflow-fcn2/fcn32_vgg.py | python | FCN32VGG.get_fc_weight_reshape | (self, name, shape, num_classes=None) | return tf.get_variable(name="weights", initializer=init, shape=shape) | [] | def get_fc_weight_reshape(self, name, shape, num_classes=None):
print('Layer name: %s' % name)
print('Layer shape: %s' % shape)
weights = self.data_dict[name][0]
weights = weights.reshape(shape)
if num_classes is not None:
weights = self._summary_reshape(weights, shap... | [
"def",
"get_fc_weight_reshape",
"(",
"self",
",",
"name",
",",
"shape",
",",
"num_classes",
"=",
"None",
")",
":",
"print",
"(",
"'Layer name: %s'",
"%",
"name",
")",
"print",
"(",
"'Layer shape: %s'",
"%",
"shape",
")",
"weights",
"=",
"self",
".",
"data_... | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/FCN/tensorflow-fcn2/fcn32_vgg.py#L371-L381 | |||
ilius/pyglossary | d599b3beda3ae17642af5debd83bb991148e6425 | pyglossary/plugins/dicformids.py | python | Reader.__iter__ | (self) | return self | [] | def __iter__(self):
return self | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/ilius/pyglossary/blob/d599b3beda3ae17642af5debd83bb991148e6425/pyglossary/plugins/dicformids.py#L87-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.