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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tahoe-lafs/tahoe-lafs | 766a53b5208c03c45ca0a98e97eee76870276aa1 | src/allmydata/client.py | python | _make_secret | () | return base32.b2a(os.urandom(hashutil.CRYPTO_VAL_SIZE)) + b"\n" | Returns a base32-encoded random secret of hashutil.CRYPTO_VAL_SIZE
bytes. | Returns a base32-encoded random secret of hashutil.CRYPTO_VAL_SIZE
bytes. | [
"Returns",
"a",
"base32",
"-",
"encoded",
"random",
"secret",
"of",
"hashutil",
".",
"CRYPTO_VAL_SIZE",
"bytes",
"."
] | def _make_secret():
"""
Returns a base32-encoded random secret of hashutil.CRYPTO_VAL_SIZE
bytes.
"""
return base32.b2a(os.urandom(hashutil.CRYPTO_VAL_SIZE)) + b"\n" | [
"def",
"_make_secret",
"(",
")",
":",
"return",
"base32",
".",
"b2a",
"(",
"os",
".",
"urandom",
"(",
"hashutil",
".",
"CRYPTO_VAL_SIZE",
")",
")",
"+",
"b\"\\n\""
] | https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/client.py#L147-L152 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/addons/stock/stock.py | python | stock_package._complete_name | (self, cr, uid, ids, name, args, context=None) | return res | Forms complete name of location from parent location to child location.
@return: Dictionary of values | Forms complete name of location from parent location to child location. | [
"Forms",
"complete",
"name",
"of",
"location",
"from",
"parent",
"location",
"to",
"child",
"location",
"."
] | def _complete_name(self, cr, uid, ids, name, args, context=None):
""" Forms complete name of location from parent location to child location.
@return: Dictionary of values
"""
res = {}
for m in self.browse(cr, uid, ids, context=context):
res[m.id] = m.name
... | [
"def",
"_complete_name",
"(",
"self",
",",
"cr",
",",
"uid",
",",
"ids",
",",
"name",
",",
"args",
",",
"context",
"=",
"None",
")",
":",
"res",
"=",
"{",
"}",
"for",
"m",
"in",
"self",
".",
"browse",
"(",
"cr",
",",
"uid",
",",
"ids",
",",
"... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/stock/stock.py#L3907-L3918 | |
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/db/main/api.py | python | console_auth_token_destroy_all_by_instance | (context, instance_uuid) | Delete all console authorizations belonging to the instance. | Delete all console authorizations belonging to the instance. | [
"Delete",
"all",
"console",
"authorizations",
"belonging",
"to",
"the",
"instance",
"."
] | def console_auth_token_destroy_all_by_instance(context, instance_uuid):
"""Delete all console authorizations belonging to the instance."""
context.session.query(models.ConsoleAuthToken).\
filter_by(instance_uuid=instance_uuid).delete() | [
"def",
"console_auth_token_destroy_all_by_instance",
"(",
"context",
",",
"instance_uuid",
")",
":",
"context",
".",
"session",
".",
"query",
"(",
"models",
".",
"ConsoleAuthToken",
")",
".",
"filter_by",
"(",
"instance_uuid",
"=",
"instance_uuid",
")",
".",
"dele... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/db/main/api.py#L4701-L4704 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scatterpolargl/selected/_textfont.py | python | Textfont.color | (self) | return self["color"] | Sets the text font color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)... | Sets the text font color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)... | [
"Sets",
"the",
"text",
"font",
"color",
"of",
"selected",
"points",
".",
"The",
"color",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"rgb... | def color(self):
"""
Sets the text font color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hs... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatterpolargl/selected/_textfont.py#L16-L66 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/datetime.py | python | timedelta.__reduce__ | (self) | return (self.__class__, self._getstate()) | [] | def __reduce__(self):
return (self.__class__, self._getstate()) | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"__class__",
",",
"self",
".",
"_getstate",
"(",
")",
")"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/datetime.py#L628-L629 | |||
thomasweng15/E.V.E. | e3bea3e45d0c549eccc6824c9cadbcc6980545f6 | actions/wolfram.py | python | Wolfram.open | (self, wolfram, text, controller) | Open webpage of visual WolframAlpha result. | Open webpage of visual WolframAlpha result. | [
"Open",
"webpage",
"of",
"visual",
"WolframAlpha",
"result",
"."
] | def open(self, wolfram, text, controller):
"""Open webpage of visual WolframAlpha result."""
wolfram_url = "http://www.wolframalpha.com/input/?i=" + text.replace(" ", "+")
controller.open(wolfram_url) | [
"def",
"open",
"(",
"self",
",",
"wolfram",
",",
"text",
",",
"controller",
")",
":",
"wolfram_url",
"=",
"\"http://www.wolframalpha.com/input/?i=\"",
"+",
"text",
".",
"replace",
"(",
"\" \"",
",",
"\"+\"",
")",
"controller",
".",
"open",
"(",
"wolfram_url",
... | https://github.com/thomasweng15/E.V.E./blob/e3bea3e45d0c549eccc6824c9cadbcc6980545f6/actions/wolfram.py#L71-L74 | ||
jelmer/xandikos | 3149a633c388a6f1dffbc6686763fca00f72e3bc | xandikos/store/git.py | python | GitStore.set_displayname | (self, displayname) | Set the display name.
:param displayname: New display name | Set the display name. | [
"Set",
"the",
"display",
"name",
"."
] | def set_displayname(self, displayname):
"""Set the display name.
:param displayname: New display name
"""
self.config.set_displayname(displayname) | [
"def",
"set_displayname",
"(",
"self",
",",
"displayname",
")",
":",
"self",
".",
"config",
".",
"set_displayname",
"(",
"displayname",
")"
] | https://github.com/jelmer/xandikos/blob/3149a633c388a6f1dffbc6686763fca00f72e3bc/xandikos/store/git.py#L481-L486 | ||
robinhood/faust | 01b4c0ad8390221db71751d80001b0fd879291e2 | faust/types/settings/settings.py | python | Settings.value_serializer | (self) | Default value serializer.
Serializer used for values by default when no serializer
is specified, or a model is not being used.
This can be string, the name of a serializer/codec, or an actual
:class:`faust.serializers.codecs.Codec` instance.
.. seealso::
- The :re... | Default value serializer. | [
"Default",
"value",
"serializer",
"."
] | def value_serializer(self) -> CodecArg:
"""Default value serializer.
Serializer used for values by default when no serializer
is specified, or a model is not being used.
This can be string, the name of a serializer/codec, or an actual
:class:`faust.serializers.codecs.Codec` ins... | [
"def",
"value_serializer",
"(",
"self",
")",
"->",
"CodecArg",
":"
] | https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/types/settings/settings.py#L1143-L1156 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/setuptools/setuptools/command/develop.py | python | VersionlessRequirement.__getattr__ | (self, name) | return getattr(self.__dist, name) | [] | def __getattr__(self, name):
return getattr(self.__dist, name) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"__dist",
",",
"name",
")"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/command/develop.py#L237-L238 | |||
freedombox/FreedomBox | 335a7f92cc08f27981f838a7cddfc67740598e54 | plinth/modules/tor/__init__.py | python | TorApp.__init__ | (self) | Create components for the app. | Create components for the app. | [
"Create",
"components",
"for",
"the",
"app",
"."
] | def __init__(self):
"""Create components for the app."""
super().__init__()
info = app_module.Info(app_id=self.app_id, version=self._version,
depends=['names'
], name=_('Tor'), icon_filename='tor',
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"info",
"=",
"app_module",
".",
"Info",
"(",
"app_id",
"=",
"self",
".",
"app_id",
",",
"version",
"=",
"self",
".",
"_version",
",",
"depends",
"=",
"[",
"'nam... | https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/modules/tor/__init__.py#L44-L91 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cdn/v20180606/cdn_client.py | python | CdnClient.CreateEdgePackTask | (self, request) | 动态打包任务提交接口
:param request: Request instance for CreateEdgePackTask.
:type request: :class:`tencentcloud.cdn.v20180606.models.CreateEdgePackTaskRequest`
:rtype: :class:`tencentcloud.cdn.v20180606.models.CreateEdgePackTaskResponse` | 动态打包任务提交接口 | [
"动态打包任务提交接口"
] | def CreateEdgePackTask(self, request):
"""动态打包任务提交接口
:param request: Request instance for CreateEdgePackTask.
:type request: :class:`tencentcloud.cdn.v20180606.models.CreateEdgePackTaskRequest`
:rtype: :class:`tencentcloud.cdn.v20180606.models.CreateEdgePackTaskResponse`
"""
... | [
"def",
"CreateEdgePackTask",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"CreateEdgePackTask\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loa... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cdn/v20180606/cdn_client.py#L113-L138 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/internet/pollreactor.py | python | PollReactor.removeAll | (self) | return self._removeAll(
[self._selectables[fd] for fd in self._reads],
[self._selectables[fd] for fd in self._writes]) | Remove all selectables, and return a list of them. | Remove all selectables, and return a list of them. | [
"Remove",
"all",
"selectables",
"and",
"return",
"a",
"list",
"of",
"them",
"."
] | def removeAll(self):
"""
Remove all selectables, and return a list of them.
"""
return self._removeAll(
[self._selectables[fd] for fd in self._reads],
[self._selectables[fd] for fd in self._writes]) | [
"def",
"removeAll",
"(",
"self",
")",
":",
"return",
"self",
".",
"_removeAll",
"(",
"[",
"self",
".",
"_selectables",
"[",
"fd",
"]",
"for",
"fd",
"in",
"self",
".",
"_reads",
"]",
",",
"[",
"self",
".",
"_selectables",
"[",
"fd",
"]",
"for",
"fd"... | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/internet/pollreactor.py#L138-L144 | |
Minyus/causallift | c808b15de7e7912c4c08e9ad4152e4bd33f008c9 | kedro_cli.py | python | install | () | Install project dependencies from both requirements.txt and environment.yml (optional). | Install project dependencies from both requirements.txt and environment.yml (optional). | [
"Install",
"project",
"dependencies",
"from",
"both",
"requirements",
".",
"txt",
"and",
"environment",
".",
"yml",
"(",
"optional",
")",
"."
] | def install():
"""Install project dependencies from both requirements.txt and environment.yml (optional)."""
if (Path.cwd() / "src" / "environment.yml").is_file():
call(["conda", "install", "--file", "src/environment.yml", "--yes"])
python_call("pip", ["install", "-U", "-r", "src/requirements.txt"... | [
"def",
"install",
"(",
")",
":",
"if",
"(",
"Path",
".",
"cwd",
"(",
")",
"/",
"\"src\"",
"/",
"\"environment.yml\"",
")",
".",
"is_file",
"(",
")",
":",
"call",
"(",
"[",
"\"conda\"",
",",
"\"install\"",
",",
"\"--file\"",
",",
"\"src/environment.yml\""... | https://github.com/Minyus/causallift/blob/c808b15de7e7912c4c08e9ad4152e4bd33f008c9/kedro_cli.py#L163-L169 | ||
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/wheel/signatures/ed25519py.py | python | crypto_sign_keypair | (seed=None) | return Keypair(vkbytes, skbytes+vkbytes) | Return (verifying, secret) key from a given seed, or os.urandom(32) | Return (verifying, secret) key from a given seed, or os.urandom(32) | [
"Return",
"(",
"verifying",
"secret",
")",
"key",
"from",
"a",
"given",
"seed",
"or",
"os",
".",
"urandom",
"(",
"32",
")"
] | def crypto_sign_keypair(seed=None):
"""Return (verifying, secret) key from a given seed, or os.urandom(32)"""
if seed is None:
seed = os.urandom(PUBLICKEYBYTES)
else:
warnings.warn("ed25519ll should choose random seed.",
RuntimeWarning)
if len(seed) != 32:
... | [
"def",
"crypto_sign_keypair",
"(",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",
"os",
".",
"urandom",
"(",
"PUBLICKEYBYTES",
")",
"else",
":",
"warnings",
".",
"warn",
"(",
"\"ed25519ll should choose random seed.\"",
",",
"Run... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/wheel/signatures/ed25519py.py#L18-L29 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_tf_objects.py | python | TFXLNetLMHeadModel.from_pretrained | (cls, *args, **kwargs) | [] | def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["tf"]) | [
"def",
"from_pretrained",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"cls",
",",
"[",
"\"tf\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_tf_objects.py#L2965-L2966 | ||||
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/e3/base/Logger.py | python | Account.__init__ | (self, id_, id_account, account, status, nick='', message='',
path='', cid=None) | constructor | constructor | [
"constructor"
] | def __init__(self, id_, id_account, account, status, nick='', message='',
path='', cid=None):
'''constructor'''
self.id = id_
self.id_account = id_account
self.account = account
self.status = status
self.nick = nick
self.message = message
self.path... | [
"def",
"__init__",
"(",
"self",
",",
"id_",
",",
"id_account",
",",
"account",
",",
"status",
",",
"nick",
"=",
"''",
",",
"message",
"=",
"''",
",",
"path",
"=",
"''",
",",
"cid",
"=",
"None",
")",
":",
"self",
".",
"id",
"=",
"id_",
"self",
"... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/base/Logger.py#L38-L49 | ||
Franck-Dernoncourt/NeuroNER | 3817feaf290c1f6e03ae23ea964e68c88d0e7a88 | neuroner/prepare_pretrained_model.py | python | prepare_pretrained_model_for_restoring | (output_folder_name, epoch_number,
model_name, delete_token_mappings=False) | Copy the dataset.pickle, parameters.ini, and model checkpoint files after
removing the data used for training.
The dataset and labels are deleted from dataset.pickle by default. The only
information about the dataset that remain in the pretrained model
is the list of tokens that appears in the da... | Copy the dataset.pickle, parameters.ini, and model checkpoint files after
removing the data used for training.
The dataset and labels are deleted from dataset.pickle by default. The only
information about the dataset that remain in the pretrained model
is the list of tokens that appears in the da... | [
"Copy",
"the",
"dataset",
".",
"pickle",
"parameters",
".",
"ini",
"and",
"model",
"checkpoint",
"files",
"after",
"removing",
"the",
"data",
"used",
"for",
"training",
".",
"The",
"dataset",
"and",
"labels",
"are",
"deleted",
"from",
"dataset",
".",
"pickle... | def prepare_pretrained_model_for_restoring(output_folder_name, epoch_number,
model_name, delete_token_mappings=False):
'''
Copy the dataset.pickle, parameters.ini, and model checkpoint files after
removing the data used for training.
The dataset and labels are deleted from dataset.pickle by d... | [
"def",
"prepare_pretrained_model_for_restoring",
"(",
"output_folder_name",
",",
"epoch_number",
",",
"model_name",
",",
"delete_token_mappings",
"=",
"False",
")",
":",
"input_model_folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'.'",
",",
"'output'",
",",
"... | https://github.com/Franck-Dernoncourt/NeuroNER/blob/3817feaf290c1f6e03ae23ea964e68c88d0e7a88/neuroner/prepare_pretrained_model.py#L82-L131 | ||
whyliam/whyliam.workflows.youdao | 2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c | workflow/util.py | python | LockFile.locked | (self) | return self._lock.is_set() | ``True`` if file is locked by this instance. | ``True`` if file is locked by this instance. | [
"True",
"if",
"file",
"is",
"locked",
"by",
"this",
"instance",
"."
] | def locked(self):
"""``True`` if file is locked by this instance."""
return self._lock.is_set() | [
"def",
"locked",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lock",
".",
"is_set",
"(",
")"
] | https://github.com/whyliam/whyliam.workflows.youdao/blob/2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c/workflow/util.py#L415-L417 | |
fergusq/tampio | b0017d2557a21c47fddc20cfceeb92f4e0376401 | voikko/libvoikko.py | python | Voikko.setLibrarySearchPath | (cls, searchPath) | Set the path to a directory that should be used to search for the native library
before trying to load it from the default (OS specific) lookup path. | Set the path to a directory that should be used to search for the native library
before trying to load it from the default (OS specific) lookup path. | [
"Set",
"the",
"path",
"to",
"a",
"directory",
"that",
"should",
"be",
"used",
"to",
"search",
"for",
"the",
"native",
"library",
"before",
"trying",
"to",
"load",
"it",
"from",
"the",
"default",
"(",
"OS",
"specific",
")",
"lookup",
"path",
"."
] | def setLibrarySearchPath(cls, searchPath):
"""Set the path to a directory that should be used to search for the native library
before trying to load it from the default (OS specific) lookup path.
"""
cls._sharedLibrarySearchPath = searchPath | [
"def",
"setLibrarySearchPath",
"(",
"cls",
",",
"searchPath",
")",
":",
"cls",
".",
"_sharedLibrarySearchPath",
"=",
"searchPath"
] | https://github.com/fergusq/tampio/blob/b0017d2557a21c47fddc20cfceeb92f4e0376401/voikko/libvoikko.py#L419-L423 | ||
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/models/hdr_ipt.py | python | XYZ_to_hdr_IPT | (XYZ, Y_s=0.2, Y_abs=100, method='Fairchild 2011') | return from_range_100(IPT_hdr) | Converts from *CIE XYZ* tristimulus values to *hdr-IPT* colourspace.
Parameters
----------
XYZ : array_like
*CIE XYZ* tristimulus values.
Y_s : numeric or array_like
Relative luminance :math:`Y_s` of the surround.
Y_abs : numeric or array_like
Absolute luminance :math:`Y_{ab... | Converts from *CIE XYZ* tristimulus values to *hdr-IPT* colourspace. | [
"Converts",
"from",
"*",
"CIE",
"XYZ",
"*",
"tristimulus",
"values",
"to",
"*",
"hdr",
"-",
"IPT",
"*",
"colourspace",
"."
] | def XYZ_to_hdr_IPT(XYZ, Y_s=0.2, Y_abs=100, method='Fairchild 2011'):
"""
Converts from *CIE XYZ* tristimulus values to *hdr-IPT* colourspace.
Parameters
----------
XYZ : array_like
*CIE XYZ* tristimulus values.
Y_s : numeric or array_like
Relative luminance :math:`Y_s` of the s... | [
"def",
"XYZ_to_hdr_IPT",
"(",
"XYZ",
",",
"Y_s",
"=",
"0.2",
",",
"Y_abs",
"=",
"100",
",",
"method",
"=",
"'Fairchild 2011'",
")",
":",
"XYZ",
"=",
"to_domain_1",
"(",
"XYZ",
")",
"method",
"=",
"validate_method",
"(",
"method",
",",
"HDR_IPT_METHODS",
... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/models/hdr_ipt.py#L141-L218 | |
pyqteval/evlal_win | ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92 | pyinstaller-2.0/PyInstaller/lib/altgraph/GraphAlgo.py | python | _priorityDictionary.smallest | (self) | return heap[0][1] | Find smallest item after removing deleted items from front of heap. | Find smallest item after removing deleted items from front of heap. | [
"Find",
"smallest",
"item",
"after",
"removing",
"deleted",
"items",
"from",
"front",
"of",
"heap",
"."
] | def smallest(self):
'''
Find smallest item after removing deleted items from front of heap.
'''
if len(self) == 0:
raise IndexError, "smallest of empty priorityDictionary"
heap = self.__heap
while heap[0][1] not in self or self[heap[0][1]] != heap[0][0]:
... | [
"def",
"smallest",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"raise",
"IndexError",
",",
"\"smallest of empty priorityDictionary\"",
"heap",
"=",
"self",
".",
"__heap",
"while",
"heap",
"[",
"0",
"]",
"[",
"1",
"]",
"not",
"... | https://github.com/pyqteval/evlal_win/blob/ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92/pyinstaller-2.0/PyInstaller/lib/altgraph/GraphAlgo.py#L90-L109 | |
openstack/keystone | 771c943ad2116193e7bb118c74993c829d93bd71 | keystone/resource/core.py | python | Manager.assert_domain_not_federated | (self, domain_id, domain) | Assert the Domain's name and id do not match the reserved keyword.
Note that the reserved keyword is defined in the configuration file,
by default, it is 'Federated', it is also case insensitive.
If config's option is empty the default hardcoded value 'Federated'
will be used.
... | Assert the Domain's name and id do not match the reserved keyword. | [
"Assert",
"the",
"Domain",
"s",
"name",
"and",
"id",
"do",
"not",
"match",
"the",
"reserved",
"keyword",
"."
] | def assert_domain_not_federated(self, domain_id, domain):
"""Assert the Domain's name and id do not match the reserved keyword.
Note that the reserved keyword is defined in the configuration file,
by default, it is 'Federated', it is also case insensitive.
If config's option is empty th... | [
"def",
"assert_domain_not_federated",
"(",
"self",
",",
"domain_id",
",",
"domain",
")",
":",
"# NOTE(marek-denis): We cannot create this attribute in the __init__ as",
"# config values are always initialized to default value.",
"federated_domain",
"=",
"CONF",
".",
"federation",
"... | https://github.com/openstack/keystone/blob/771c943ad2116193e7bb118c74993c829d93bd71/keystone/resource/core.py#L245-L264 | ||
ebranca/owasp-pysec | 163e10a146db04f40648979e8d7c0c10e7737781 | pysec/alg.py | python | knp_first | (source, pattern, start=0, stop=None) | Return the index of the first occurrence of pattern in
source[start:stop] | Return the index of the first occurrence of pattern in
source[start:stop] | [
"Return",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"of",
"pattern",
"in",
"source",
"[",
"start",
":",
"stop",
"]"
] | def knp_first(source, pattern, start=0, stop=None):
"""Return the index of the first occurrence of pattern in
source[start:stop]"""
try:
return knp(source, pattern, start, stop).next()
except StopIteration:
return -1 | [
"def",
"knp_first",
"(",
"source",
",",
"pattern",
",",
"start",
"=",
"0",
",",
"stop",
"=",
"None",
")",
":",
"try",
":",
"return",
"knp",
"(",
"source",
",",
"pattern",
",",
"start",
",",
"stop",
")",
".",
"next",
"(",
")",
"except",
"StopIterati... | https://github.com/ebranca/owasp-pysec/blob/163e10a146db04f40648979e8d7c0c10e7737781/pysec/alg.py#L50-L56 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/flows/general/collectors.py | python | ArtifactCollectorFlow._AreArtifactsKnowledgeBaseArtifacts | (self) | return True | [] | def _AreArtifactsKnowledgeBaseArtifacts(self):
knowledgebase_list = config.CONFIG["Artifacts.knowledge_base"]
for artifact_name in self.args.artifact_list:
if artifact_name not in knowledgebase_list:
return False
return True | [
"def",
"_AreArtifactsKnowledgeBaseArtifacts",
"(",
"self",
")",
":",
"knowledgebase_list",
"=",
"config",
".",
"CONFIG",
"[",
"\"Artifacts.knowledge_base\"",
"]",
"for",
"artifact_name",
"in",
"self",
".",
"args",
".",
"artifact_list",
":",
"if",
"artifact_name",
"n... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/flows/general/collectors.py#L250-L255 | |||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/api/ssl_keys.py | python | SSLKeyHandler.delete | (self, request, id) | return rc.DELETED | @description-title Delete an SSL key
@description Deletes the SSL key with the given ID.
@param (int) "id" [required=true] An SSH key ID.
@success (http-status-code) "204" 204
@error (http-status-code) "404" 404
@error (content) "not-found" The requested SSH key is not found.
... | @description-title Delete an SSL key
@description Deletes the SSL key with the given ID. | [
"@description",
"-",
"title",
"Delete",
"an",
"SSL",
"key",
"@description",
"Deletes",
"the",
"SSL",
"key",
"with",
"the",
"given",
"ID",
"."
] | def delete(self, request, id):
"""@description-title Delete an SSL key
@description Deletes the SSL key with the given ID.
@param (int) "id" [required=true] An SSH key ID.
@success (http-status-code) "204" 204
@error (http-status-code) "404" 404
@error (content) "not-f... | [
"def",
"delete",
"(",
"self",
",",
"request",
",",
"id",
")",
":",
"key",
"=",
"get_object_or_404",
"(",
"SSLKey",
",",
"id",
"=",
"id",
")",
"if",
"key",
".",
"user",
"!=",
"request",
".",
"user",
":",
"return",
"HttpResponseForbidden",
"(",
"\"Can't ... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/api/ssl_keys.py#L122-L156 | |
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/experiments/profiling/gprof2dot.py | python | Profile.__init__ | (self) | [] | def __init__(self):
Object.__init__(self)
self.functions = {}
self.cycles = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"Object",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"functions",
"=",
"{",
"}",
"self",
".",
"cycles",
"=",
"[",
"]"
] | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/experiments/profiling/gprof2dot.py#L291-L294 | ||||
PythonTurtle/PythonTurtle | 929f10892e62ece8d5f230d3e995d380d6493cf3 | pythonturtle/shelltoprocess/forkedpyshell.py | python | Shell.setLocalShell | (self) | Add 'shell' to locals as reference to ShellFacade instance. | Add 'shell' to locals as reference to ShellFacade instance. | [
"Add",
"shell",
"to",
"locals",
"as",
"reference",
"to",
"ShellFacade",
"instance",
"."
] | def setLocalShell(self):
"""Add 'shell' to locals as reference to ShellFacade instance."""
self.interp.locals['shell'] = ShellFacade(other=self) | [
"def",
"setLocalShell",
"(",
"self",
")",
":",
"self",
".",
"interp",
".",
"locals",
"[",
"'shell'",
"]",
"=",
"ShellFacade",
"(",
"other",
"=",
"self",
")"
] | https://github.com/PythonTurtle/PythonTurtle/blob/929f10892e62ece8d5f230d3e995d380d6493cf3/pythonturtle/shelltoprocess/forkedpyshell.py#L439-L441 | ||
blinktrade/bitex | a4896e7faef9c4aa0ca5325f18b77db67003764e | libs/websocket.py | python | _SSLSocketWrapper.recv | (self, bufsize) | return self.ssl.read(bufsize) | [] | def recv(self, bufsize):
return self.ssl.read(bufsize) | [
"def",
"recv",
"(",
"self",
",",
"bufsize",
")",
":",
"return",
"self",
".",
"ssl",
".",
"read",
"(",
"bufsize",
")"
] | https://github.com/blinktrade/bitex/blob/a4896e7faef9c4aa0ca5325f18b77db67003764e/libs/websocket.py#L202-L203 | |||
rajarshd/Multi-Step-Reasoning | 3218d626839f7217554f38d82e00e4f460b508e4 | msr/reader/model.py | python | Model.parallelize | (self) | Use data parallel to copy the model across several gpus.
This will take all gpus visible with CUDA_VISIBLE_DEVICES. | Use data parallel to copy the model across several gpus.
This will take all gpus visible with CUDA_VISIBLE_DEVICES. | [
"Use",
"data",
"parallel",
"to",
"copy",
"the",
"model",
"across",
"several",
"gpus",
".",
"This",
"will",
"take",
"all",
"gpus",
"visible",
"with",
"CUDA_VISIBLE_DEVICES",
"."
] | def parallelize(self):
"""Use data parallel to copy the model across several gpus.
This will take all gpus visible with CUDA_VISIBLE_DEVICES.
"""
self.parallel = True
self.network = torch.nn.DataParallel(self.network) | [
"def",
"parallelize",
"(",
"self",
")",
":",
"self",
".",
"parallel",
"=",
"True",
"self",
".",
"network",
"=",
"torch",
".",
"nn",
".",
"DataParallel",
"(",
"self",
".",
"network",
")"
] | https://github.com/rajarshd/Multi-Step-Reasoning/blob/3218d626839f7217554f38d82e00e4f460b508e4/msr/reader/model.py#L965-L970 | ||
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/devplugins/irc/irccmds.py | python | IRCCommander.raw | (self, text) | Sends raw text to the server. | Sends raw text to the server. | [
"Sends",
"raw",
"text",
"to",
"the",
"server",
"."
] | def raw(self, text):
'Sends raw text to the server.'
self._irc.sendraw(text) | [
"def",
"raw",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"_irc",
".",
"sendraw",
"(",
"text",
")"
] | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/devplugins/irc/irccmds.py#L64-L67 | ||
annoviko/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | pyclustering/nnet/__init__.py | python | network.set_connection | (self, i, j) | !
@brief Couples two specified oscillators in the network with dynamic connections.
@param[in] i (uint): index of an oscillator that should be coupled with oscillator 'j' in the network.
@param[in] j (uint): index of an oscillator that should be coupled with oscillator 'i' in the networ... | ! | [
"!"
] | def set_connection(self, i, j):
"""!
@brief Couples two specified oscillators in the network with dynamic connections.
@param[in] i (uint): index of an oscillator that should be coupled with oscillator 'j' in the network.
@param[in] j (uint): index of an oscillator that should b... | [
"def",
"set_connection",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"if",
"(",
"self",
".",
"structure",
"!=",
"conn_type",
".",
"DYNAMIC",
")",
":",
"raise",
"NameError",
"(",
"\"Connection between oscillators can be changed only in case of dynamic type.\"",
")",
... | https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/nnet/__init__.py#L372-L391 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scattergl/_unselected.py | python | Unselected.marker | (self) | return self["marker"] | The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergl.unselected.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
... | The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergl.unselected.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
... | [
"The",
"marker",
"property",
"is",
"an",
"instance",
"of",
"Marker",
"that",
"may",
"be",
"specified",
"as",
":",
"-",
"An",
"instance",
"of",
":",
"class",
":",
"plotly",
".",
"graph_objs",
".",
"scattergl",
".",
"unselected",
".",
"Marker",
"-",
"A",
... | def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergl.unselected.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
... | [
"def",
"marker",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"marker\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scattergl/_unselected.py#L16-L40 | |
YingZhangDUT/Deep-Mutual-Learning | 34a20583debe4e0dab1d9856db69bed278c5c011 | datasets/convert_to_tfrecords.py | python | run | (image_dir, output_dir, split_name) | Convert images to tfrecords.
Args:
image_dir: The image directory where the raw images are stored.
output_dir: The directory where the lists and tfrecords are stored.
split_name: The split name of dataset. | Convert images to tfrecords.
Args:
image_dir: The image directory where the raw images are stored.
output_dir: The directory where the lists and tfrecords are stored.
split_name: The split name of dataset. | [
"Convert",
"images",
"to",
"tfrecords",
".",
"Args",
":",
"image_dir",
":",
"The",
"image",
"directory",
"where",
"the",
"raw",
"images",
"are",
"stored",
".",
"output_dir",
":",
"The",
"directory",
"where",
"the",
"lists",
"and",
"tfrecords",
"are",
"stored... | def run(image_dir, output_dir, split_name):
"""Convert images to tfrecords.
Args:
image_dir: The image directory where the raw images are stored.
output_dir: The directory where the lists and tfrecords are stored.
split_name: The split name of dataset.
"""
list_filename = os.path.join(output... | [
"def",
"run",
"(",
"image_dir",
",",
"output_dir",
",",
"split_name",
")",
":",
"list_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"'%s.txt'",
"%",
"split_name",
")",
"tf_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"... | https://github.com/YingZhangDUT/Deep-Mutual-Learning/blob/34a20583debe4e0dab1d9856db69bed278c5c011/datasets/convert_to_tfrecords.py#L50-L67 | ||
nate-parrott/Flashlight | c3a7c7278a1cccf8918e7543faffc68e863ff5ab | flashlightplugins/cloudstorage/common.py | python | posix_time_to_http | (posix_time) | Convert posix time to HTML header time format.
Args:
posix_time: unix time.
Returns:
A datatime str in RFC 2616 format. | Convert posix time to HTML header time format. | [
"Convert",
"posix",
"time",
"to",
"HTML",
"header",
"time",
"format",
"."
] | def posix_time_to_http(posix_time):
"""Convert posix time to HTML header time format.
Args:
posix_time: unix time.
Returns:
A datatime str in RFC 2616 format.
"""
if posix_time:
return email_utils.formatdate(posix_time, usegmt=True) | [
"def",
"posix_time_to_http",
"(",
"posix_time",
")",
":",
"if",
"posix_time",
":",
"return",
"email_utils",
".",
"formatdate",
"(",
"posix_time",
",",
"usegmt",
"=",
"True",
")"
] | https://github.com/nate-parrott/Flashlight/blob/c3a7c7278a1cccf8918e7543faffc68e863ff5ab/flashlightplugins/cloudstorage/common.py#L331-L341 | ||
sagemath/sagecell | f654176956af8ebd83a0769b916116d600785398 | namespace.py | python | InstrumentedNamespace.__init__ | (self, *args, **kwargs) | Set up a namespace id | Set up a namespace id | [
"Set",
"up",
"a",
"namespace",
"id"
] | def __init__(self, *args, **kwargs):
"""
Set up a namespace id
"""
dict.__init__(self,*args,**kwargs)
self.events = defaultdict(lambda: defaultdict(list)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dict",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"events",
"=",
"defaultdict",
"(",
"lambda",
":",
"defaultdict",... | https://github.com/sagemath/sagecell/blob/f654176956af8ebd83a0769b916116d600785398/namespace.py#L5-L10 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/core/numbers.py | python | NaN.__mul__ | (self, other) | return self | [] | def __mul__(self, other):
return self | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/core/numbers.py#L2524-L2525 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/util/varints.py | python | varint_to_int | (vi) | return i | [] | def varint_to_int(vi):
b = ord(vi[0])
p = 1
i = b & 0x7f
shift = 7
while b & 0x80 != 0:
b = ord(vi[p])
p += 1
i |= (b & 0x7F) << shift
shift += 7
return i | [
"def",
"varint_to_int",
"(",
"vi",
")",
":",
"b",
"=",
"ord",
"(",
"vi",
"[",
"0",
"]",
")",
"p",
"=",
"1",
"i",
"=",
"b",
"&",
"0x7f",
"shift",
"=",
"7",
"while",
"b",
"&",
"0x80",
"!=",
"0",
":",
"b",
"=",
"ord",
"(",
"vi",
"[",
"p",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/util/varints.py#L63-L73 | |||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/core/virtual_network_client.py | python | VirtualNetworkClient.remove_drg_route_distribution_statements | (self, drg_route_distribution_id, remove_drg_route_distribution_statements_details, **kwargs) | Removes one or more route distribution statements from the specified route distribution's map.
:param str drg_route_distribution_id: (required)
The `OCID`__ of the route distribution.
__ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
:param oci.co... | Removes one or more route distribution statements from the specified route distribution's map. | [
"Removes",
"one",
"or",
"more",
"route",
"distribution",
"statements",
"from",
"the",
"specified",
"route",
"distribution",
"s",
"map",
"."
] | def remove_drg_route_distribution_statements(self, drg_route_distribution_id, remove_drg_route_distribution_statements_details, **kwargs):
"""
Removes one or more route distribution statements from the specified route distribution's map.
:param str drg_route_distribution_id: (required)
... | [
"def",
"remove_drg_route_distribution_statements",
"(",
"self",
",",
"drg_route_distribution_id",
",",
"remove_drg_route_distribution_statements_details",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/drgRouteDistributions/{drgRouteDistributionId}/actions/removeDrgRout... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/virtual_network_client.py#L17750-L17823 | ||
yzhao062/combo | 229d578de498b47ae03cf2580472aceebf8c2766 | combo/models/base.py | python | BaseAggregator._detector_predict_proba | (self, X, proba_method='linear') | Predict the probability of a sample being outlier. Two approaches
are possible:
1. simply use Min-max conversion to linearly transform the outlier
scores into the range of [0,1]. The model must be
fitted first.
2. use unifying scores, see :cite:`kriegel2011interpreting`.
... | Predict the probability of a sample being outlier. Two approaches
are possible: | [
"Predict",
"the",
"probability",
"of",
"a",
"sample",
"being",
"outlier",
".",
"Two",
"approaches",
"are",
"possible",
":"
] | def _detector_predict_proba(self, X, proba_method='linear'):
"""Predict the probability of a sample being outlier. Two approaches
are possible:
1. simply use Min-max conversion to linearly transform the outlier
scores into the range of [0,1]. The model must be
fitted first... | [
"def",
"_detector_predict_proba",
"(",
"self",
",",
"X",
",",
"proba_method",
"=",
"'linear'",
")",
":",
"check_is_fitted",
"(",
"self",
",",
"[",
"'decision_scores_'",
",",
"'threshold_'",
",",
"'labels_'",
"]",
")",
"train_scores",
"=",
"self",
".",
"decisio... | https://github.com/yzhao062/combo/blob/229d578de498b47ae03cf2580472aceebf8c2766/combo/models/base.py#L165-L215 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/site.py | python | setcopyright | () | Set 'copyright' and 'credits' in builtins | Set 'copyright' and 'credits' in builtins | [
"Set",
"copyright",
"and",
"credits",
"in",
"builtins"
] | def setcopyright():
"""Set 'copyright' and 'credits' in builtins"""
builtins.copyright = _sitebuiltins._Printer("copyright", sys.copyright)
if sys.platform[:4] == 'java':
builtins.credits = _sitebuiltins._Printer(
"credits",
"Jython is maintained by the Jython developers (www... | [
"def",
"setcopyright",
"(",
")",
":",
"builtins",
".",
"copyright",
"=",
"_sitebuiltins",
".",
"_Printer",
"(",
"\"copyright\"",
",",
"sys",
".",
"copyright",
")",
"if",
"sys",
".",
"platform",
"[",
":",
"4",
"]",
"==",
"'java'",
":",
"builtins",
".",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/site.py#L407-L428 | ||
benoitc/couchdbkit | 6be148640c00b54ee87a2f2d502e9d67fa5b45a8 | couchdbkit/external.py | python | External.send_response | (self, code=200, body="", headers={}) | [] | def send_response(self, code=200, body="", headers={}):
resp = {
'code': code,
'body': body,
'headers': headers
}
self.write(json.dumps(resp)) | [
"def",
"send_response",
"(",
"self",
",",
"code",
"=",
"200",
",",
"body",
"=",
"\"\"",
",",
"headers",
"=",
"{",
"}",
")",
":",
"resp",
"=",
"{",
"'code'",
":",
"code",
",",
"'body'",
":",
"body",
",",
"'headers'",
":",
"headers",
"}",
"self",
"... | https://github.com/benoitc/couchdbkit/blob/6be148640c00b54ee87a2f2d502e9d67fa5b45a8/couchdbkit/external.py#L52-L58 | ||||
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/abcFormat/__init__.py | python | ABCMetadata.getDefaultQuarterLength | (self) | r'''
If there is a quarter length representation available, return it as a floating point value
>>> am = abcFormat.ABCMetadata('L:1/2')
>>> am.preParse()
>>> am.getDefaultQuarterLength()
2.0
>>> am = abcFormat.ABCMetadata('L:1/8')
>>> am.preParse()
>>> a... | r'''
If there is a quarter length representation available, return it as a floating point value | [
"r",
"If",
"there",
"is",
"a",
"quarter",
"length",
"representation",
"available",
"return",
"it",
"as",
"a",
"floating",
"point",
"value"
] | def getDefaultQuarterLength(self) -> float:
r'''
If there is a quarter length representation available, return it as a floating point value
>>> am = abcFormat.ABCMetadata('L:1/2')
>>> am.preParse()
>>> am.getDefaultQuarterLength()
2.0
>>> am = abcFormat.ABCMetad... | [
"def",
"getDefaultQuarterLength",
"(",
"self",
")",
"->",
"float",
":",
"# environLocal.printDebug(['getDefaultQuarterLength', self.data])",
"if",
"self",
".",
"isDefaultNoteLength",
"(",
")",
"and",
"'/'",
"in",
"self",
".",
"data",
":",
"# should be in L:1/4 form",
"n... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/abcFormat/__init__.py#L677-L750 | ||
great-expectations/great_expectations | 45224cb890aeae725af25905923d0dbbab2d969d | great_expectations/render/renderer/notebook_renderer.py | python | BaseNotebookRenderer.render_to_disk | (
self,
notebook_file_path: str,
) | Render a notebook to disk from arguments | Render a notebook to disk from arguments | [
"Render",
"a",
"notebook",
"to",
"disk",
"from",
"arguments"
] | def render_to_disk(
self,
notebook_file_path: str,
) -> None:
"""
Render a notebook to disk from arguments
"""
raise NotImplementedError | [
"def",
"render_to_disk",
"(",
"self",
",",
"notebook_file_path",
":",
"str",
",",
")",
"->",
"None",
":",
"raise",
"NotImplementedError"
] | https://github.com/great-expectations/great_expectations/blob/45224cb890aeae725af25905923d0dbbab2d969d/great_expectations/render/renderer/notebook_renderer.py#L77-L84 | ||
Net-ng/kansha | 85b5816da126b1c7098707c98f217d8b2e524ff2 | kansha/board/comp.py | python | Board.get_available_user_ids | (self) | return set(dbm.user.id for dbm in self.data.board_members) | Return list of member
Return:
- list of members | Return list of member | [
"Return",
"list",
"of",
"member"
] | def get_available_user_ids(self):
"""Return list of member
Return:
- list of members
"""
return set(dbm.user.id for dbm in self.data.board_members) | [
"def",
"get_available_user_ids",
"(",
"self",
")",
":",
"return",
"set",
"(",
"dbm",
".",
"user",
".",
"id",
"for",
"dbm",
"in",
"self",
".",
"data",
".",
"board_members",
")"
] | https://github.com/Net-ng/kansha/blob/85b5816da126b1c7098707c98f217d8b2e524ff2/kansha/board/comp.py#L748-L754 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | lvar_t.is_floating_var | (self, *args) | return _idaapi.lvar_t_is_floating_var(self, *args) | is_floating_var(self) -> bool | is_floating_var(self) -> bool | [
"is_floating_var",
"(",
"self",
")",
"-",
">",
"bool"
] | def is_floating_var(self, *args):
"""
is_floating_var(self) -> bool
"""
return _idaapi.lvar_t_is_floating_var(self, *args) | [
"def",
"is_floating_var",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"lvar_t_is_floating_var",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L35928-L35932 | |
Arelle/Arelle | 20f3d8a8afd41668e1520799acd333349ce0ba17 | arelle/TkTableWrapper.py | python | Table.spans | (self, index=None, **kwargs) | Manipulate row/col spans.
When called with no arguments, all known spans are returned as a dict.
When called with only the index, the span for that index only is
returned, if any. Otherwise kwargs is assumed to contain keys/values
pairs used to set spans. A span starts at the row,col de... | Manipulate row/col spans. | [
"Manipulate",
"row",
"/",
"col",
"spans",
"."
] | def spans(self, index=None, **kwargs):
"""Manipulate row/col spans.
When called with no arguments, all known spans are returned as a dict.
When called with only the index, the span for that index only is
returned, if any. Otherwise kwargs is assumed to contain keys/values
pairs ... | [
"def",
"spans",
"(",
"self",
",",
"index",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"args",
"=",
"tkinter",
".",
"_flatten",
"(",
"list",
"(",
"kwargs",
".",
"items",
"(",
")",
")",
")",
"self",
".",
"tk",
".",
"call... | https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/TkTableWrapper.py#L374-L387 | ||
nopernik/mpDNS | b17dc39e7068406df82cb3431b3042e74e520cf9 | dnslib/dns.py | python | DNSQuestion.__ne__ | (self,other) | return not(self.__eq__(other)) | [] | def __ne__(self,other):
return not(self.__eq__(other)) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"(",
"self",
".",
"__eq__",
"(",
"other",
")",
")"
] | https://github.com/nopernik/mpDNS/blob/b17dc39e7068406df82cb3431b3042e74e520cf9/dnslib/dns.py#L678-L679 | |||
zachwill/flask-engine | 7c8ad4bfe36382a8c9286d873ec7b785715832a4 | libs/pkg_resources.py | python | Environment.add | (self,dist) | Add `dist` if we ``can_add()`` it and it isn't already added | Add `dist` if we ``can_add()`` it and it isn't already added | [
"Add",
"dist",
"if",
"we",
"can_add",
"()",
"it",
"and",
"it",
"isn",
"t",
"already",
"added"
] | def add(self,dist):
"""Add `dist` if we ``can_add()`` it and it isn't already added"""
if self.can_add(dist) and dist.has_version():
dists = self._distmap.setdefault(dist.key,[])
if dist not in dists:
dists.append(dist)
if dist.key in self._cache:
... | [
"def",
"add",
"(",
"self",
",",
"dist",
")",
":",
"if",
"self",
".",
"can_add",
"(",
"dist",
")",
"and",
"dist",
".",
"has_version",
"(",
")",
":",
"dists",
"=",
"self",
".",
"_distmap",
".",
"setdefault",
"(",
"dist",
".",
"key",
",",
"[",
"]",
... | https://github.com/zachwill/flask-engine/blob/7c8ad4bfe36382a8c9286d873ec7b785715832a4/libs/pkg_resources.py#L751-L758 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/admissionregistration_v1_webhook_client_config.py | python | AdmissionregistrationV1WebhookClientConfig.service | (self, service) | Sets the service of this AdmissionregistrationV1WebhookClientConfig.
:param service: The service of this AdmissionregistrationV1WebhookClientConfig. # noqa: E501
:type: AdmissionregistrationV1ServiceReference | Sets the service of this AdmissionregistrationV1WebhookClientConfig. | [
"Sets",
"the",
"service",
"of",
"this",
"AdmissionregistrationV1WebhookClientConfig",
"."
] | def service(self, service):
"""Sets the service of this AdmissionregistrationV1WebhookClientConfig.
:param service: The service of this AdmissionregistrationV1WebhookClientConfig. # noqa: E501
:type: AdmissionregistrationV1ServiceReference
"""
self._service = service | [
"def",
"service",
"(",
"self",
",",
"service",
")",
":",
"self",
".",
"_service",
"=",
"service"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/admissionregistration_v1_webhook_client_config.py#L102-L110 | ||
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/corpus/reader/propbank.py | python | PropbankInstance.predid | (self) | return "rel" | Identifier of the predicate. | Identifier of the predicate. | [
"Identifier",
"of",
"the",
"predicate",
"."
] | def predid(self):
"""Identifier of the predicate."""
return "rel" | [
"def",
"predid",
"(",
"self",
")",
":",
"return",
"\"rel\""
] | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/corpus/reader/propbank.py#L232-L234 | |
bisohns/search-engine-parser | ede1355a1f63398d9217b8e502fbd6c52b53bf09 | search_engine_parser/core/engines/stackoverflow.py | python | Search.parse_single_result | (self, single_result, return_type=ReturnType.FULL, **kwargs) | return rdict | Parses the source code to return
:param single_result: single result found in <div class="summary">
:type single_result: `bs4.element.ResultSet`
:return: parsed title, link and description of single result
:rtype: dict | Parses the source code to return | [
"Parses",
"the",
"source",
"code",
"to",
"return"
] | def parse_single_result(self, single_result, return_type=ReturnType.FULL, **kwargs):
"""
Parses the source code to return
:param single_result: single result found in <div class="summary">
:type single_result: `bs4.element.ResultSet`
:return: parsed title, link and description o... | [
"def",
"parse_single_result",
"(",
"self",
",",
"single_result",
",",
"return_type",
"=",
"ReturnType",
".",
"FULL",
",",
"*",
"*",
"kwargs",
")",
":",
"rdict",
"=",
"SearchItem",
"(",
")",
"h3",
"=",
"single_result",
".",
"find",
"(",
"'h3'",
")",
"# py... | https://github.com/bisohns/search-engine-parser/blob/ede1355a1f63398d9217b8e502fbd6c52b53bf09/search_engine_parser/core/engines/stackoverflow.py#L35-L59 | |
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/contrib/miopen.py | python | conv2d_forward | (
x,
w,
stride_h=1,
stride_w=1,
pad_h=0,
pad_w=0,
dilation_h=1,
dilation_w=1,
conv_mode=0,
data_type=1,
group_count=1,
) | return te.extern(
list(oshape),
[x, w],
lambda ins, outs: tvm.tir.call_packed(
"tvm.contrib.miopen.conv2d.forward",
conv_mode,
data_type,
pad_h,
pad_w,
stride_h,
stride_w,
dilation_h,
dila... | Create an extern op that compute 2D convolution with MIOpen
Parameters
----------
x: Tensor
input feature map
w: Tensor
convolution weight
stride_h: int
height stride
stride_w: int
width stride
pad_h: int
height pad
pad_w: int
weight pad
... | Create an extern op that compute 2D convolution with MIOpen | [
"Create",
"an",
"extern",
"op",
"that",
"compute",
"2D",
"convolution",
"with",
"MIOpen"
] | def conv2d_forward(
x,
w,
stride_h=1,
stride_w=1,
pad_h=0,
pad_w=0,
dilation_h=1,
dilation_w=1,
conv_mode=0,
data_type=1,
group_count=1,
):
"""Create an extern op that compute 2D convolution with MIOpen
Parameters
----------
x: Tensor
input feature ma... | [
"def",
"conv2d_forward",
"(",
"x",
",",
"w",
",",
"stride_h",
"=",
"1",
",",
"stride_w",
"=",
"1",
",",
"pad_h",
"=",
"0",
",",
"pad_w",
"=",
"0",
",",
"dilation_h",
"=",
"1",
",",
"dilation_w",
"=",
"1",
",",
"conv_mode",
"=",
"0",
",",
"data_ty... | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/contrib/miopen.py#L45-L138 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/dts/v20180330/dts_client.py | python | DtsClient.DescribeMigrateCheckJob | (self, request) | 本接口用于创建校验后,获取校验的结果. 能查询到当前校验的状态和进度.
若通过校验, 则可调用'StartMigrateJob' 开始迁移.
若未通过校验, 则能查询到校验失败的原因. 请按照报错, 通过'ModifyMigrateJob'修改迁移配置或是调整源/目标实例的相关参数.
:param request: Request instance for DescribeMigrateCheckJob.
:type request: :class:`tencentcloud.dts.v20180330.models.DescribeMigrateCheckJobRe... | 本接口用于创建校验后,获取校验的结果. 能查询到当前校验的状态和进度.
若通过校验, 则可调用'StartMigrateJob' 开始迁移.
若未通过校验, 则能查询到校验失败的原因. 请按照报错, 通过'ModifyMigrateJob'修改迁移配置或是调整源/目标实例的相关参数. | [
"本接口用于创建校验后",
"获取校验的结果",
".",
"能查询到当前校验的状态和进度",
".",
"若通过校验",
"则可调用",
"StartMigrateJob",
"开始迁移",
".",
"若未通过校验",
"则能查询到校验失败的原因",
".",
"请按照报错",
"通过",
"ModifyMigrateJob",
"修改迁移配置或是调整源",
"/",
"目标实例的相关参数",
"."
] | def DescribeMigrateCheckJob(self, request):
"""本接口用于创建校验后,获取校验的结果. 能查询到当前校验的状态和进度.
若通过校验, 则可调用'StartMigrateJob' 开始迁移.
若未通过校验, 则能查询到校验失败的原因. 请按照报错, 通过'ModifyMigrateJob'修改迁移配置或是调整源/目标实例的相关参数.
:param request: Request instance for DescribeMigrateCheckJob.
:type request: :class:`tenc... | [
"def",
"DescribeMigrateCheckJob",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DescribeMigrateCheckJob\"",
",",
"params",
")",
"response",
"=",
"json",
"... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/dts/v20180330/dts_client.py#L231-L258 | ||
rll/rllab | ba78e4c16dc492982e648f117875b22af3965579 | rllab/envs/box2d/box2d_viewer.py | python | Box2DViewer.setCenter | (self, value) | Updates the view offset based on the center of the screen.
Tells the debug draw to update its values also. | Updates the view offset based on the center of the screen. | [
"Updates",
"the",
"view",
"offset",
"based",
"on",
"the",
"center",
"of",
"the",
"screen",
"."
] | def setCenter(self, value):
"""
Updates the view offset based on the center of the screen.
Tells the debug draw to update its values also.
"""
self._viewCenter = b2Vec2(*value)
self._viewCenter *= self._viewZoom
self._viewOffset = self._viewCenter - self.screenSi... | [
"def",
"setCenter",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_viewCenter",
"=",
"b2Vec2",
"(",
"*",
"value",
")",
"self",
".",
"_viewCenter",
"*=",
"self",
".",
"_viewZoom",
"self",
".",
"_viewOffset",
"=",
"self",
".",
"_viewCenter",
"-",
"s... | https://github.com/rll/rllab/blob/ba78e4c16dc492982e648f117875b22af3965579/rllab/envs/box2d/box2d_viewer.py#L182-L190 | ||
liquidctl/liquidctl | 73962574632f94050c2a75f517e929a29797b5e2 | liquidctl/cli.py | python | _device_set_color | (dev, args, **opts) | [] | def _device_set_color(dev, args, **opts):
color = map(color_from_str, args['<color>'])
dev.set_color(args['<channel>'].lower(), args['<mode>'].lower(), color, **opts) | [
"def",
"_device_set_color",
"(",
"dev",
",",
"args",
",",
"*",
"*",
"opts",
")",
":",
"color",
"=",
"map",
"(",
"color_from_str",
",",
"args",
"[",
"'<color>'",
"]",
")",
"dev",
".",
"set_color",
"(",
"args",
"[",
"'<channel>'",
"]",
".",
"lower",
"(... | https://github.com/liquidctl/liquidctl/blob/73962574632f94050c2a75f517e929a29797b5e2/liquidctl/cli.py#L274-L276 | ||||
facebookresearch/neuralvolumes | 8c5fad49b2b05b4b2e79917ee87299e7c1676d59 | data/dryice1.py | python | load_krt | (path) | return cameras | Load KRT file containing intrinsic and extrinsic parameters. | Load KRT file containing intrinsic and extrinsic parameters. | [
"Load",
"KRT",
"file",
"containing",
"intrinsic",
"and",
"extrinsic",
"parameters",
"."
] | def load_krt(path):
"""Load KRT file containing intrinsic and extrinsic parameters."""
cameras = {}
with open(path, "r") as f:
while True:
name = f.readline()
if name == "":
break
intrin = [[float(x) for x in f.readline().split()] for i in range(... | [
"def",
"load_krt",
"(",
"path",
")",
":",
"cameras",
"=",
"{",
"}",
"with",
"open",
"(",
"path",
",",
"\"r\"",
")",
"as",
"f",
":",
"while",
"True",
":",
"name",
"=",
"f",
".",
"readline",
"(",
")",
"if",
"name",
"==",
"\"\"",
":",
"break",
"in... | https://github.com/facebookresearch/neuralvolumes/blob/8c5fad49b2b05b4b2e79917ee87299e7c1676d59/data/dryice1.py#L13-L33 | |
ask/mode | a104009f0c96790b9f6140179b4968da07a38c81 | mode/worker.py | python | Worker.carp | (self, msg: str) | Write warning to standard err. | Write warning to standard err. | [
"Write",
"warning",
"to",
"standard",
"err",
"."
] | def carp(self, msg: str) -> None:
"""Write warning to standard err."""
self._say(msg, file=self.stderr) | [
"def",
"carp",
"(",
"self",
",",
"msg",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"_say",
"(",
"msg",
",",
"file",
"=",
"self",
".",
"stderr",
")"
] | https://github.com/ask/mode/blob/a104009f0c96790b9f6140179b4968da07a38c81/mode/worker.py#L153-L155 | ||
facebookresearch/FaderNetworks | cdd9e50659b635a6e04311e1cf4b9a6e6683319b | src/training.py | python | Trainer.save_best_periodic | (self, to_log) | Save the best models / periodically save the models. | Save the best models / periodically save the models. | [
"Save",
"the",
"best",
"models",
"/",
"periodically",
"save",
"the",
"models",
"."
] | def save_best_periodic(self, to_log):
"""
Save the best models / periodically save the models.
"""
if to_log['ae_loss'] < self.best_loss:
self.best_loss = to_log['ae_loss']
logger.info('Best reconstruction loss: %.5f' % self.best_loss)
self.save_model(... | [
"def",
"save_best_periodic",
"(",
"self",
",",
"to_log",
")",
":",
"if",
"to_log",
"[",
"'ae_loss'",
"]",
"<",
"self",
".",
"best_loss",
":",
"self",
".",
"best_loss",
"=",
"to_log",
"[",
"'ae_loss'",
"]",
"logger",
".",
"info",
"(",
"'Best reconstruction ... | https://github.com/facebookresearch/FaderNetworks/blob/cdd9e50659b635a6e04311e1cf4b9a6e6683319b/src/training.py#L245-L258 | ||
abhik/pebl | 5e7d694eb1e4f90e0f1410000b958ba62698a268 | src/pebl/config.py | python | write | (filename, include_defaults=False) | Writes parameters to config file.
If include_default is True, writes all parameters. Else, only writes
parameters that were specifically set (via config file, command line, etc). | Writes parameters to config file. | [
"Writes",
"parameters",
"to",
"config",
"file",
"."
] | def write(filename, include_defaults=False):
"""Writes parameters to config file.
If include_default is True, writes all parameters. Else, only writes
parameters that were specifically set (via config file, command line, etc).
"""
config = ConfigParser()
params = _parameters.values() if inclu... | [
"def",
"write",
"(",
"filename",
",",
"include_defaults",
"=",
"False",
")",
":",
"config",
"=",
"ConfigParser",
"(",
")",
"params",
"=",
"_parameters",
".",
"values",
"(",
")",
"if",
"include_defaults",
"else",
"[",
"p",
"for",
"p",
"in",
"_parameters",
... | https://github.com/abhik/pebl/blob/5e7d694eb1e4f90e0f1410000b958ba62698a268/src/pebl/config.py#L183-L199 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/gdata/src/gdata/service.py | python | GDataService.ClientLogin | (self, username, password, account_type=None, service=None,
auth_service_url=None, source=None, captcha_token=None,
captcha_response=None) | Convenience method for authenticating using ProgrammaticLogin.
Sets values for email, password, and other optional members.
Args:
username:
password:
account_type: string (optional)
service: string (optional)
auth_service_url: string (optional)
captcha_token: string (o... | Convenience method for authenticating using ProgrammaticLogin.
Sets values for email, password, and other optional members. | [
"Convenience",
"method",
"for",
"authenticating",
"using",
"ProgrammaticLogin",
".",
"Sets",
"values",
"for",
"email",
"password",
"and",
"other",
"optional",
"members",
"."
] | def ClientLogin(self, username, password, account_type=None, service=None,
auth_service_url=None, source=None, captcha_token=None,
captcha_response=None):
"""Convenience method for authenticating using ProgrammaticLogin.
Sets values for email, password, and other optional members.
Args:
... | [
"def",
"ClientLogin",
"(",
"self",
",",
"username",
",",
"password",
",",
"account_type",
"=",
"None",
",",
"service",
"=",
"None",
",",
"auth_service_url",
"=",
"None",
",",
"source",
"=",
"None",
",",
"captcha_token",
"=",
"None",
",",
"captcha_response",
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/src/gdata/service.py#L815-L843 | ||
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/css_linter.py | python | _CSSLexerClassifier.is_tag | (self, tok) | return (tok['style'] == ScintillaConstants.SCE_CSS_TAG
or self.is_operator(tok, "*")) | [] | def is_tag(self, tok):
return (tok['style'] == ScintillaConstants.SCE_CSS_TAG
or self.is_operator(tok, "*")) | [
"def",
"is_tag",
"(",
"self",
",",
"tok",
")",
":",
"return",
"(",
"tok",
"[",
"'style'",
"]",
"==",
"ScintillaConstants",
".",
"SCE_CSS_TAG",
"or",
"self",
".",
"is_operator",
"(",
"tok",
",",
"\"*\"",
")",
")"
] | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/css_linter.py#L122-L124 | |||
knownsec/Pocsuite | 877d1b1604629b8dcd6e53b167c3c98249e5e94f | pocsuite/thirdparty/pyparsing/pyparsing.py | python | upcaseTokens | (s,l,t) | return [ tt.upper() for tt in map(_ustr,t) ] | Helper parse action to convert tokens to upper case. | Helper parse action to convert tokens to upper case. | [
"Helper",
"parse",
"action",
"to",
"convert",
"tokens",
"to",
"upper",
"case",
"."
] | def upcaseTokens(s,l,t):
"""Helper parse action to convert tokens to upper case."""
return [ tt.upper() for tt in map(_ustr,t) ] | [
"def",
"upcaseTokens",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"return",
"[",
"tt",
".",
"upper",
"(",
")",
"for",
"tt",
"in",
"map",
"(",
"_ustr",
",",
"t",
")",
"]"
] | https://github.com/knownsec/Pocsuite/blob/877d1b1604629b8dcd6e53b167c3c98249e5e94f/pocsuite/thirdparty/pyparsing/pyparsing.py#L3406-L3408 | |
google/trax | d6cae2067dedd0490b78d831033607357e975015 | trax/data/inputs.py | python | generate_sequential_chunks | (max_length=None) | return _f | Returns a function that generates chunks of atmost max_length length. | Returns a function that generates chunks of atmost max_length length. | [
"Returns",
"a",
"function",
"that",
"generates",
"chunks",
"of",
"atmost",
"max_length",
"length",
"."
] | def generate_sequential_chunks(max_length=None):
"""Returns a function that generates chunks of atmost max_length length."""
def _f(generator):
for example in generator:
n_tokens = len(example)
if n_tokens <= max_length:
yield example
else:
n_segments = int(math.ceil(float(n_to... | [
"def",
"generate_sequential_chunks",
"(",
"max_length",
"=",
"None",
")",
":",
"def",
"_f",
"(",
"generator",
")",
":",
"for",
"example",
"in",
"generator",
":",
"n_tokens",
"=",
"len",
"(",
"example",
")",
"if",
"n_tokens",
"<=",
"max_length",
":",
"yield... | https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/data/inputs.py#L918-L931 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/apps_v1beta2_api.py | python | AppsV1beta2Api.delete_namespaced_deployment_with_http_info | (self, name, namespace, **kwargs) | return self.api_client.call_api(
'/apis/apps/v1beta2/namespaces/{namespace}/deployments/{name}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_... | delete_namespaced_deployment # noqa: E501
delete a Deployment # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_namespaced_deployment_with_http_info(name, namespace, async_req=... | delete_namespaced_deployment # noqa: E501 | [
"delete_namespaced_deployment",
"#",
"noqa",
":",
"E501"
] | def delete_namespaced_deployment_with_http_info(self, name, namespace, **kwargs): # noqa: E501
"""delete_namespaced_deployment # noqa: E501
delete a Deployment # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asyn... | [
"def",
"delete_namespaced_deployment_with_http_info",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'name'",
",",
"'namespace'",
",",
"'pretty'... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/apps_v1beta2_api.py#L1937-L2056 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/identity.py | python | StrongInstanceDict.add | (self, state) | [] | def add(self, state):
if state.key in self:
if attributes.instance_state(self._dict[state.key]) is not state:
raise sa_exc.InvalidRequestError(
"Can't attach instance "
"%s; another instance with key %s is already "
"present... | [
"def",
"add",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
".",
"key",
"in",
"self",
":",
"if",
"attributes",
".",
"instance_state",
"(",
"self",
".",
"_dict",
"[",
"state",
".",
"key",
"]",
")",
"is",
"not",
"state",
":",
"raise",
"sa_exc",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/identity.py#L300-L312 | ||||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py | python | DIFPresExchHandler.process_constraint_holders | (
self,
subject_ids: Sequence[str],
) | Check if holder or subject of claim still controls the identifier. | Check if holder or subject of claim still controls the identifier. | [
"Check",
"if",
"holder",
"or",
"subject",
"of",
"claim",
"still",
"controls",
"the",
"identifier",
"."
] | async def process_constraint_holders(
self,
subject_ids: Sequence[str],
) -> bool:
"""Check if holder or subject of claim still controls the identifier."""
async with self.profile.session() as session:
wallet = session.inject(BaseWallet)
try:
f... | [
"async",
"def",
"process_constraint_holders",
"(",
"self",
",",
"subject_ids",
":",
"Sequence",
"[",
"str",
"]",
",",
")",
"->",
"bool",
":",
"async",
"with",
"self",
".",
"profile",
".",
"session",
"(",
")",
"as",
"session",
":",
"wallet",
"=",
"session... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/present_proof/dif/pres_exch_handler.py#L437-L450 | ||
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/ImageMasking.py | python | getMaskData2 | () | return _data2 | [] | def getMaskData2():
return _data2 | [
"def",
"getMaskData2",
"(",
")",
":",
"return",
"_data2"
] | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/ImageMasking.py#L230-L231 | |||
stanfordnlp/cocoa | 26bfea048f00241eb4dbff861b2d9260bde52636 | mutualfriends/web/third_party_backend.py | python | BackendConnection.create_user_if_necessary | (self, userid) | Adds a new user to the database if necessary
:param :
:return: | Adds a new user to the database if necessary
:param :
:return: | [
"Adds",
"a",
"new",
"user",
"to",
"the",
"database",
"if",
"necessary",
":",
"param",
":",
":",
"return",
":"
] | def create_user_if_necessary(self, userid):
"""
Adds a new user to the database if necessary
:param :
:return:
"""
with self.conn:
cursor = self.conn.cursor()
now = get_timestamp()
cursor.execute("INSERT OR IGNORE INTO ActiveUsers VALUE... | [
"def",
"create_user_if_necessary",
"(",
"self",
",",
"userid",
")",
":",
"with",
"self",
".",
"conn",
":",
"cursor",
"=",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
"now",
"=",
"get_timestamp",
"(",
")",
"cursor",
".",
"execute",
"(",
"\"INSERT OR IGN... | https://github.com/stanfordnlp/cocoa/blob/26bfea048f00241eb4dbff861b2d9260bde52636/mutualfriends/web/third_party_backend.py#L31-L41 | ||
pymc-devs/pymc | 38867dd19e96afb0ceccc8ccd74a9795f118dfe3 | pymc/distributions/continuous.py | python | Gumbel.logcdf | (
value: Union[float, np.ndarray, TensorVariable],
mu: Union[float, np.ndarray, TensorVariable],
beta: Union[float, np.ndarray, TensorVariable],
) | return check_parameters(res, 0 < beta, msg="beta > 0") | Compute the log of the cumulative distribution function for Gumbel distribution
at the specified value.
Parameters
----------
value: numeric or np.ndarray or aesara.tensor
Value(s) for which log CDF is calculated. If the log CDF for multiple
values are desired th... | Compute the log of the cumulative distribution function for Gumbel distribution
at the specified value. | [
"Compute",
"the",
"log",
"of",
"the",
"cumulative",
"distribution",
"function",
"for",
"Gumbel",
"distribution",
"at",
"the",
"specified",
"value",
"."
] | def logcdf(
value: Union[float, np.ndarray, TensorVariable],
mu: Union[float, np.ndarray, TensorVariable],
beta: Union[float, np.ndarray, TensorVariable],
) -> TensorVariable:
"""
Compute the log of the cumulative distribution function for Gumbel distribution
at the s... | [
"def",
"logcdf",
"(",
"value",
":",
"Union",
"[",
"float",
",",
"np",
".",
"ndarray",
",",
"TensorVariable",
"]",
",",
"mu",
":",
"Union",
"[",
"float",
",",
"np",
".",
"ndarray",
",",
"TensorVariable",
"]",
",",
"beta",
":",
"Union",
"[",
"float",
... | https://github.com/pymc-devs/pymc/blob/38867dd19e96afb0ceccc8ccd74a9795f118dfe3/pymc/distributions/continuous.py#L3311-L3332 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/filecmp.py | python | _filter | (flist, skip) | return list(filterfalse(skip.__contains__, flist)) | [] | def _filter(flist, skip):
return list(filterfalse(skip.__contains__, flist)) | [
"def",
"_filter",
"(",
"flist",
",",
"skip",
")",
":",
"return",
"list",
"(",
"filterfalse",
"(",
"skip",
".",
"__contains__",
",",
"flist",
")",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/filecmp.py#L294-L295 | |||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py | python | Client.delete_partition_column_statistics | (self, db_name, tbl_name, part_name, col_name) | return self.recv_delete_partition_column_statistics() | Parameters:
- db_name
- tbl_name
- part_name
- col_name | Parameters:
- db_name
- tbl_name
- part_name
- col_name | [
"Parameters",
":",
"-",
"db_name",
"-",
"tbl_name",
"-",
"part_name",
"-",
"col_name"
] | def delete_partition_column_statistics(self, db_name, tbl_name, part_name, col_name):
"""
Parameters:
- db_name
- tbl_name
- part_name
- col_name
"""
self.send_delete_partition_column_statistics(db_name, tbl_name, part_name, col_name)
return s... | [
"def",
"delete_partition_column_statistics",
"(",
"self",
",",
"db_name",
",",
"tbl_name",
",",
"part_name",
",",
"col_name",
")",
":",
"self",
".",
"send_delete_partition_column_statistics",
"(",
"db_name",
",",
"tbl_name",
",",
"part_name",
",",
"col_name",
")",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L4946-L4956 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/PIL/ImageSequence.py | python | Iterator.next | (self) | return self.__next__() | [] | def next(self):
return self.__next__() | [
"def",
"next",
"(",
"self",
")",
":",
"return",
"self",
".",
"__next__",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/PIL/ImageSequence.py#L55-L56 | |||
SilenceDut/nbaplus-server | 368067f7a1de958c12fb35462afe2713760b52ae | beautifulsoup4-4.3.2/bs4/dammit.py | python | UnicodeDammit._to_unicode | (self, data, encoding, errors="strict") | return unicode(data, encoding, errors) | 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 _to_unicode(self, data, encoding, errors="strict"):
'''Given a string and its encoding, decodes the string into Unicode.
%encoding is a string recognized by encodings.aliases'''
return unicode(data, encoding, errors) | [
"def",
"_to_unicode",
"(",
"self",
",",
"data",
",",
"encoding",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"return",
"unicode",
"(",
"data",
",",
"encoding",
",",
"errors",
")"
] | https://github.com/SilenceDut/nbaplus-server/blob/368067f7a1de958c12fb35462afe2713760b52ae/beautifulsoup4-4.3.2/bs4/dammit.py#L425-L428 | |
freedombox/FreedomBox | 335a7f92cc08f27981f838a7cddfc67740598e54 | plinth/modules/networks/__init__.py | python | set_internet_connection_type | (internet_connection_type) | return kvstore.set('networks_internet_type', internet_connection_type) | Store the internet connection type. | Store the internet connection type. | [
"Store",
"the",
"internet",
"connection",
"type",
"."
] | def set_internet_connection_type(internet_connection_type):
"""Store the internet connection type."""
return kvstore.set('networks_internet_type', internet_connection_type) | [
"def",
"set_internet_connection_type",
"(",
"internet_connection_type",
")",
":",
"return",
"kvstore",
".",
"set",
"(",
"'networks_internet_type'",
",",
"internet_connection_type",
")"
] | https://github.com/freedombox/FreedomBox/blob/335a7f92cc08f27981f838a7cddfc67740598e54/plinth/modules/networks/__init__.py#L110-L112 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/federation/pulsar/_pulsar_manager.py | python | PulsarManager.delete_namespace | (self, tenant: str, namespace: str, force: bool = False) | return response | [] | def delete_namespace(self, tenant: str, namespace: str, force: bool = False):
session = self._create_session()
response = session.delete(
self.service_url +
'namespace/{}/{}?force={}'.format(tenant,
namespace, str(force).lower())
... | [
"def",
"delete_namespace",
"(",
"self",
",",
"tenant",
":",
"str",
",",
"namespace",
":",
"str",
",",
"force",
":",
"bool",
"=",
"False",
")",
":",
"session",
"=",
"self",
".",
"_create_session",
"(",
")",
"response",
"=",
"session",
".",
"delete",
"("... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/federation/pulsar/_pulsar_manager.py#L161-L168 | |||
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/Utilities.py | python | getRGBOpaqueRedColor | () | return _rgbRed | [] | def getRGBOpaqueRedColor():
global _rgbRed
if _rgbRed is None:
opaqueRed = (0.663, 0, 0.031, 1)
_rgbRed = CGColorCreate(
getTheCalibratedRGBColorSpace(), opaqueRed)
return _rgbRed | [
"def",
"getRGBOpaqueRedColor",
"(",
")",
":",
"global",
"_rgbRed",
"if",
"_rgbRed",
"is",
"None",
":",
"opaqueRed",
"=",
"(",
"0.663",
",",
"0",
",",
"0.031",
",",
"1",
")",
"_rgbRed",
"=",
"CGColorCreate",
"(",
"getTheCalibratedRGBColorSpace",
"(",
")",
"... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/Utilities.py#L120-L126 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/bigip.py | python | delete_pool | (hostname, username, password, name) | A function to connect to a bigip device and delete a specific pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the pool which will be deleted
CLI Example
.. code-block::... | A function to connect to a bigip device and delete a specific pool. | [
"A",
"function",
"to",
"connect",
"to",
"a",
"bigip",
"device",
"and",
"delete",
"a",
"specific",
"pool",
"."
] | def delete_pool(hostname, username, password, name):
"""
A function to connect to a bigip device and delete a specific pool.
hostname
The host/address of the bigip device
username
The iControl REST username
password
The iControl REST password
name
The name of the... | [
"def",
"delete_pool",
"(",
"hostname",
",",
"username",
",",
"password",
",",
"name",
")",
":",
"# build session",
"bigip_session",
"=",
"_build_session",
"(",
"username",
",",
"password",
")",
"# delete to REST",
"try",
":",
"response",
"=",
"bigip_session",
".... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/bigip.py#L1004-L1038 | ||
pyansys/pymapdl | c07291fc062b359abf0e92b95a92d753a95ef3d7 | ansys/mapdl/core/_commands/preproc/meshing.py | python | Meshing.desize | (
self,
minl="",
minh="",
mxel="",
angl="",
angh="",
edgmn="",
edgmx="",
adjf="",
adjm="",
**kwargs,
) | return self.run(command, **kwargs) | Controls default element sizes.
APDL Command: DESIZE
Parameters
----------
minl
Minimum number of elements that will be attached to a line when
using lower-order elements (defaults to 3 elements per line). If
MINL = DEFA, all arguments will be set b... | Controls default element sizes. | [
"Controls",
"default",
"element",
"sizes",
"."
] | def desize(
self,
minl="",
minh="",
mxel="",
angl="",
angh="",
edgmn="",
edgmx="",
adjf="",
adjm="",
**kwargs,
):
"""Controls default element sizes.
APDL Command: DESIZE
Parameters
----------
... | [
"def",
"desize",
"(",
"self",
",",
"minl",
"=",
"\"\"",
",",
"minh",
"=",
"\"\"",
",",
"mxel",
"=",
"\"\"",
",",
"angl",
"=",
"\"\"",
",",
"angh",
"=",
"\"\"",
",",
"edgmn",
"=",
"\"\"",
",",
"edgmx",
"=",
"\"\"",
",",
"adjf",
"=",
"\"\"",
",",... | https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/meshing.py#L456-L533 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/google_ads_service/client.py | python | GoogleAdsServiceClient.hotel_performance_view_path | (customer_id: str,) | return "customers/{customer_id}/hotelPerformanceView".format(
customer_id=customer_id,
) | Return a fully-qualified hotel_performance_view string. | Return a fully-qualified hotel_performance_view string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"hotel_performance_view",
"string",
"."
] | def hotel_performance_view_path(customer_id: str,) -> str:
"""Return a fully-qualified hotel_performance_view string."""
return "customers/{customer_id}/hotelPerformanceView".format(
customer_id=customer_id,
) | [
"def",
"hotel_performance_view_path",
"(",
"customer_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/hotelPerformanceView\"",
".",
"format",
"(",
"customer_id",
"=",
"customer_id",
",",
")"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/google_ads_service/client.py#L1720-L1724 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/core/serializers/__init__.py | python | unregister_serializer | (format) | Unregister a given serializer. This is not a thread-safe operation. | Unregister a given serializer. This is not a thread-safe operation. | [
"Unregister",
"a",
"given",
"serializer",
".",
"This",
"is",
"not",
"a",
"thread",
"-",
"safe",
"operation",
"."
] | def unregister_serializer(format):
"Unregister a given serializer. This is not a thread-safe operation."
if not _serializers:
_load_serializers()
if format not in _serializers:
raise SerializerDoesNotExist(format)
del _serializers[format] | [
"def",
"unregister_serializer",
"(",
"format",
")",
":",
"if",
"not",
"_serializers",
":",
"_load_serializers",
"(",
")",
"if",
"format",
"not",
"in",
"_serializers",
":",
"raise",
"SerializerDoesNotExist",
"(",
"format",
")",
"del",
"_serializers",
"[",
"format... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/core/serializers/__init__.py#L86-L92 | ||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/pipes.py | python | Template.__repr__ | (self) | return '<Template instance, steps=%r>' % (self.steps,) | t.__repr__() implements repr(t). | t.__repr__() implements repr(t). | [
"t",
".",
"__repr__",
"()",
"implements",
"repr",
"(",
"t",
")",
"."
] | def __repr__(self):
"""t.__repr__() implements repr(t)."""
return '<Template instance, steps=%r>' % (self.steps,) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Template instance, steps=%r>'",
"%",
"(",
"self",
".",
"steps",
",",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/pipes.py#L90-L92 | |
Project-MONAI/MONAI | 83f8b06372a3803ebe9281300cb794a1f3395018 | monai/transforms/utility/array.py | python | AsChannelLast.__call__ | (self, img: NdarrayOrTensor) | return moveaxis(img, self.channel_dim, -1) | Apply the transform to `img`. | Apply the transform to `img`. | [
"Apply",
"the",
"transform",
"to",
"img",
"."
] | def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
"""
Apply the transform to `img`.
"""
return moveaxis(img, self.channel_dim, -1) | [
"def",
"__call__",
"(",
"self",
",",
"img",
":",
"NdarrayOrTensor",
")",
"->",
"NdarrayOrTensor",
":",
"return",
"moveaxis",
"(",
"img",
",",
"self",
".",
"channel_dim",
",",
"-",
"1",
")"
] | https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/monai/transforms/utility/array.py#L159-L163 | |
terrifyzhao/bert-utils | 1d5f3eb649b4ee8a059f7050da483d0cd6d7fff4 | modeling.py | python | attention_layer | (from_tensor,
to_tensor,
attention_mask=None,
num_attention_heads=1,
size_per_head=512,
query_act=None,
key_act=None,
value_act=None,
attention_probs_dropout_pr... | return context_layer | Performs multi-headed attention from `from_tensor` to `to_tensor`.
This is an implementation of multi-headed attention based on "Attention
is all you Need". If `from_tensor` and `to_tensor` are the same, then
this is self-attention. Each timestep in `from_tensor` attends to the
corresponding sequence in `to_te... | Performs multi-headed attention from `from_tensor` to `to_tensor`. | [
"Performs",
"multi",
"-",
"headed",
"attention",
"from",
"from_tensor",
"to",
"to_tensor",
"."
] | def attention_layer(from_tensor,
to_tensor,
attention_mask=None,
num_attention_heads=1,
size_per_head=512,
query_act=None,
key_act=None,
value_act=None,
attenti... | [
"def",
"attention_layer",
"(",
"from_tensor",
",",
"to_tensor",
",",
"attention_mask",
"=",
"None",
",",
"num_attention_heads",
"=",
"1",
",",
"size_per_head",
"=",
"512",
",",
"query_act",
"=",
"None",
",",
"key_act",
"=",
"None",
",",
"value_act",
"=",
"No... | https://github.com/terrifyzhao/bert-utils/blob/1d5f3eb649b4ee8a059f7050da483d0cd6d7fff4/modeling.py#L560-L753 | |
jhpyle/docassemble | b90c84e57af59aa88b3404d44d0b125c70f832cc | docassemble_base/docassemble/base/util.py | python | DADict._trigger_gather | (self) | Triggers the gathering process. | Triggers the gathering process. | [
"Triggers",
"the",
"gathering",
"process",
"."
] | def _trigger_gather(self):
"""Triggers the gathering process."""
if docassemble.base.functions.get_gathering_mode(self.instanceName) is False:
if self.auto_gather:
self.gather()
else:
self.gathered | [
"def",
"_trigger_gather",
"(",
"self",
")",
":",
"if",
"docassemble",
".",
"base",
".",
"functions",
".",
"get_gathering_mode",
"(",
"self",
".",
"instanceName",
")",
"is",
"False",
":",
"if",
"self",
".",
"auto_gather",
":",
"self",
".",
"gather",
"(",
... | https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/util.py#L2250-L2256 | ||
truenas/middleware | b11ec47d6340324f5a32287ffb4012e5d709b934 | src/middlewared/middlewared/plugins/chart_releases_linux/upgrade.py | python | ChartReleaseService.upgrade_summary | (self, release_name, options) | return {
'container_images_to_update': {
k: v for k, v in release['resources']['container_images'].items() if v['update_available']
},
'changelog': changelog,
'available_versions_for_upgrade': all_newer_versions,
'item_update_available': releas... | Retrieve upgrade summary for `release_name` which will include which container images will be updated
and changelog for `options.item_version` chart version specified if applicable. If only container images
need to be updated, changelog will be `null`.
If chart release `release_name` does not r... | Retrieve upgrade summary for `release_name` which will include which container images will be updated
and changelog for `options.item_version` chart version specified if applicable. If only container images
need to be updated, changelog will be `null`. | [
"Retrieve",
"upgrade",
"summary",
"for",
"release_name",
"which",
"will",
"include",
"which",
"container",
"images",
"will",
"be",
"updated",
"and",
"changelog",
"for",
"options",
".",
"item_version",
"chart",
"version",
"specified",
"if",
"applicable",
".",
"If",... | async def upgrade_summary(self, release_name, options):
"""
Retrieve upgrade summary for `release_name` which will include which container images will be updated
and changelog for `options.item_version` chart version specified if applicable. If only container images
need to be updated, c... | [
"async",
"def",
"upgrade_summary",
"(",
"self",
",",
"release_name",
",",
"options",
")",
":",
"release",
"=",
"await",
"self",
".",
"middleware",
".",
"call",
"(",
"'chart.release.query'",
",",
"[",
"[",
"'id'",
",",
"'='",
",",
"release_name",
"]",
"]",
... | https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/plugins/chart_releases_linux/upgrade.py#L154-L204 | |
sfepy/sfepy | 02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25 | sfepy/discrete/problem.py | python | Problem.set_mesh_coors | (self, coors, update_fields=False, actual=False,
clear_all=True, extra_dofs=False) | Set mesh coordinates.
Parameters
----------
coors : array
The new coordinates.
update_fields : bool
If True, update also coordinates of fields.
actual : bool
If True, update the actual configuration coordinates,
otherwise the undef... | Set mesh coordinates. | [
"Set",
"mesh",
"coordinates",
"."
] | def set_mesh_coors(self, coors, update_fields=False, actual=False,
clear_all=True, extra_dofs=False):
"""
Set mesh coordinates.
Parameters
----------
coors : array
The new coordinates.
update_fields : bool
If True, update al... | [
"def",
"set_mesh_coors",
"(",
"self",
",",
"coors",
",",
"update_fields",
"=",
"False",
",",
"actual",
"=",
"False",
",",
"clear_all",
"=",
"True",
",",
"extra_dofs",
"=",
"False",
")",
":",
"set_mesh_coors",
"(",
"self",
".",
"domain",
",",
"self",
".",... | https://github.com/sfepy/sfepy/blob/02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25/sfepy/discrete/problem.py#L739-L756 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_table.py | python | Table.customdatasrc | (self) | return self["customdatasrc"] | Sets the source reference on Chart Studio Cloud for
`customdata`.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for
`customdata`.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"customdata",
".",
"The",
"customdatasrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def customdatasrc(self):
"""
Sets the source reference on Chart Studio Cloud for
`customdata`.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["cust... | [
"def",
"customdatasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"customdatasrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_table.py#L224-L236 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/importlib/abc.py | python | PathEntryFinder.invalidate_caches | (self) | An optional method for clearing the finder's cache, if any.
This method is used by PathFinder.invalidate_caches(). | An optional method for clearing the finder's cache, if any.
This method is used by PathFinder.invalidate_caches(). | [
"An",
"optional",
"method",
"for",
"clearing",
"the",
"finder",
"s",
"cache",
"if",
"any",
".",
"This",
"method",
"is",
"used",
"by",
"PathFinder",
".",
"invalidate_caches",
"()",
"."
] | def invalidate_caches(self):
"""An optional method for clearing the finder's cache, if any.
This method is used by PathFinder.invalidate_caches().
""" | [
"def",
"invalidate_caches",
"(",
"self",
")",
":"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/importlib/abc.py#L116-L119 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/fabmetheus_utilities/euclidean.py | python | XIntersectionIndex.__cmp__ | (self, other) | return int( self.x > other.x ) | Get comparison in order to sort x intersections in ascending order of x. | Get comparison in order to sort x intersections in ascending order of x. | [
"Get",
"comparison",
"in",
"order",
"to",
"sort",
"x",
"intersections",
"in",
"ascending",
"order",
"of",
"x",
"."
] | def __cmp__(self, other):
'Get comparison in order to sort x intersections in ascending order of x.'
if self.x < other.x:
return - 1
return int( self.x > other.x ) | [
"def",
"__cmp__",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"x",
"<",
"other",
".",
"x",
":",
"return",
"-",
"1",
"return",
"int",
"(",
"self",
".",
"x",
">",
"other",
".",
"x",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/euclidean.py#L2423-L2427 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventDetails.get_sso_error_details | (self) | return self._value | Only call this if :meth:`is_sso_error_details` is true.
:rtype: SsoErrorDetails | Only call this if :meth:`is_sso_error_details` is true. | [
"Only",
"call",
"this",
"if",
":",
"meth",
":",
"is_sso_error_details",
"is",
"true",
"."
] | def get_sso_error_details(self):
"""
Only call this if :meth:`is_sso_error_details` is true.
:rtype: SsoErrorDetails
"""
if not self.is_sso_error_details():
raise AttributeError("tag 'sso_error_details' not set")
return self._value | [
"def",
"get_sso_error_details",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_sso_error_details",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'sso_error_details' not set\"",
")",
"return",
"self",
".",
"_value"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L18489-L18497 | |
aws-quickstart/quickstart-redhat-openshift | 2b87dd38b72e7e4c439a606c5a9ea458d72da612 | functions/source/DeleteBucketContents/requests/utils.py | python | guess_filename | (obj) | Tries to guess the filename of the given object. | Tries to guess the filename of the given object. | [
"Tries",
"to",
"guess",
"the",
"filename",
"of",
"the",
"given",
"object",
"."
] | def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if (name and isinstance(name, basestring) and name[0] != '<' and
name[-1] != '>'):
return os.path.basename(name) | [
"def",
"guess_filename",
"(",
"obj",
")",
":",
"name",
"=",
"getattr",
"(",
"obj",
",",
"'name'",
",",
"None",
")",
"if",
"(",
"name",
"and",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"and",
"name",
"[",
"0",
"]",
"!=",
"'<'",
"and",
"name... | https://github.com/aws-quickstart/quickstart-redhat-openshift/blob/2b87dd38b72e7e4c439a606c5a9ea458d72da612/functions/source/DeleteBucketContents/requests/utils.py#L219-L224 | ||
PaddlePaddle/ERNIE | 15eddb022ce1beb281777e9ab8807a1bdfa7a76e | propeller/paddle/train/metrics.py | python | Mrr.__init__ | (self, qid, label, pred) | doc | doc | [
"doc"
] | def __init__(self, qid, label, pred):
"""doc"""
if label.shape != pred.shape:
raise ValueError(
'expect label shape == pred shape, got: label.shape=%s, pred.shape = %s'
% (repr(label), repr(pred)))
self.qid = qid
self.label = label
sel... | [
"def",
"__init__",
"(",
"self",
",",
"qid",
",",
"label",
",",
"pred",
")",
":",
"if",
"label",
".",
"shape",
"!=",
"pred",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"'expect label shape == pred shape, got: label.shape=%s, pred.shape = %s'",
"%",
"(",
"repr... | https://github.com/PaddlePaddle/ERNIE/blob/15eddb022ce1beb281777e9ab8807a1bdfa7a76e/propeller/paddle/train/metrics.py#L447-L457 | ||
dipu-bd/lightnovel-crawler | eca7a71f217ce7a6b0a54d2e2afb349571871880 | sources/en/n/novelmtl.py | python | NovelMTLCrawler.read_novel_info | (self) | Get novel title, autor, cover etc | Get novel title, autor, cover etc | [
"Get",
"novel",
"title",
"autor",
"cover",
"etc"
] | def read_novel_info(self):
'''Get novel title, autor, cover etc'''
logger.debug('Visiting %s', self.novel_url)
soup = self.get_soup(self.novel_url)
self.novel_title = soup.select_one('.novel-info .novel-title').text.strip()
logger.info('Novel title: %s', self.novel_title)
... | [
"def",
"read_novel_info",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Visiting %s'",
",",
"self",
".",
"novel_url",
")",
"soup",
"=",
"self",
".",
"get_soup",
"(",
"self",
".",
"novel_url",
")",
"self",
".",
"novel_title",
"=",
"soup",
".",
"... | https://github.com/dipu-bd/lightnovel-crawler/blob/eca7a71f217ce7a6b0a54d2e2afb349571871880/sources/en/n/novelmtl.py#L55-L111 | ||
ricequant/rqalpha-mod-ctp | bfd40801f9a182226a911cac74660f62993eb6db | rqalpha_mod_ctp/ctp/pyctp/linux64_35/__init__.py | python | TraderApi.OnRspQryCombAction | (self, pCombAction, pRspInfo, nRequestID, bIsLast) | 请求查询申请组合响应 | 请求查询申请组合响应 | [
"请求查询申请组合响应"
] | def OnRspQryCombAction(self, pCombAction, pRspInfo, nRequestID, bIsLast):
"""请求查询申请组合响应""" | [
"def",
"OnRspQryCombAction",
"(",
"self",
",",
"pCombAction",
",",
"pRspInfo",
",",
"nRequestID",
",",
"bIsLast",
")",
":"
] | https://github.com/ricequant/rqalpha-mod-ctp/blob/bfd40801f9a182226a911cac74660f62993eb6db/rqalpha_mod_ctp/ctp/pyctp/linux64_35/__init__.py#L660-L661 | ||
chrysn/aiocoap | 1f03d4ceb969b2b443c288c312d44c3b7c3e2031 | aiocoap/cli/common.py | python | add_server_arguments | (parser) | Add the --bind option to an argparse parser | Add the --bind option to an argparse parser | [
"Add",
"the",
"--",
"bind",
"option",
"to",
"an",
"argparse",
"parser"
] | def add_server_arguments(parser):
"""Add the --bind option to an argparse parser"""
def hostportsplit_helper(arg):
"""Wrapper around hostportsplit that gives better error messages than
'invalid hostportsplit value'"""
try:
return hostportsplit(arg)
except ValueError... | [
"def",
"add_server_arguments",
"(",
"parser",
")",
":",
"def",
"hostportsplit_helper",
"(",
"arg",
")",
":",
"\"\"\"Wrapper around hostportsplit that gives better error messages than\n 'invalid hostportsplit value'\"\"\"",
"try",
":",
"return",
"hostportsplit",
"(",
"arg",... | https://github.com/chrysn/aiocoap/blob/1f03d4ceb969b2b443c288c312d44c3b7c3e2031/aiocoap/cli/common.py#L59-L82 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/parsedatetime/__init__.py | python | _initSymbols | (ptc) | Initialize symbols and single character constants. | Initialize symbols and single character constants. | [
"Initialize",
"symbols",
"and",
"single",
"character",
"constants",
"."
] | def _initSymbols(ptc):
"""
Initialize symbols and single character constants.
"""
# build am and pm lists to contain
# original case, lowercase and first-char
# versions of the meridian text
if len(ptc.locale.meridian) > 0:
am = ptc.locale.meridian[0]
ptc.am = [ am... | [
"def",
"_initSymbols",
"(",
"ptc",
")",
":",
"# build am and pm lists to contain",
"# original case, lowercase and first-char",
"# versions of the meridian text",
"if",
"len",
"(",
"ptc",
".",
"locale",
".",
"meridian",
")",
">",
"0",
":",
"am",
"=",
"ptc",
".",
"lo... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/parsedatetime/__init__.py#L1930-L1962 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/command_support/EditCommand.py | python | EditCommand._removeStructure | (self) | Remove this structure.
@see: L{self.cancelStructure} | Remove this structure. | [
"Remove",
"this",
"structure",
"."
] | def _removeStructure(self):
"""
Remove this structure.
@see: L{self.cancelStructure}
"""
if self.struct is not None:
self.struct.kill_with_contents()
self.struct = None
self._revertNumber()
self.win.win_update() | [
"def",
"_removeStructure",
"(",
"self",
")",
":",
"if",
"self",
".",
"struct",
"is",
"not",
"None",
":",
"self",
".",
"struct",
".",
"kill_with_contents",
"(",
")",
"self",
".",
"struct",
"=",
"None",
"self",
".",
"_revertNumber",
"(",
")",
"self",
"."... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/command_support/EditCommand.py#L358-L367 | ||
diegma/graph-2-text | 56e19d3066116c26464acde46c1b52ec46f319e6 | onmt/Models.py | python | RNNEncoder.forward | (self, src, lengths=None, encoder_state=None) | return encoder_final, memory_bank | See :obj:`EncoderBase.forward()` | See :obj:`EncoderBase.forward()` | [
"See",
":",
"obj",
":",
"EncoderBase",
".",
"forward",
"()"
] | def forward(self, src, lengths=None, encoder_state=None):
"See :obj:`EncoderBase.forward()`"
self._check_args(src, lengths, encoder_state)
emb = self.embeddings(src)
s_len, batch, emb_dim = emb.size()
packed_emb = emb
if lengths is not None and not self.no_pack_padded_s... | [
"def",
"forward",
"(",
"self",
",",
"src",
",",
"lengths",
"=",
"None",
",",
"encoder_state",
"=",
"None",
")",
":",
"self",
".",
"_check_args",
"(",
"src",
",",
"lengths",
",",
"encoder_state",
")",
"emb",
"=",
"self",
".",
"embeddings",
"(",
"src",
... | https://github.com/diegma/graph-2-text/blob/56e19d3066116c26464acde46c1b52ec46f319e6/onmt/Models.py#L134-L154 | |
firedm/FireDM | d27d3d27c869625f75520ca2bacfa9ebd11caf2f | firedm/controller.py | python | Controller._update_playlist_menu | (self, pl_menu) | update playlist menu and send notification to view | update playlist menu and send notification to view | [
"update",
"playlist",
"menu",
"and",
"send",
"notification",
"to",
"view"
] | def _update_playlist_menu(self, pl_menu):
"""update playlist menu and send notification to view"""
self.playlist_menu = pl_menu
self._update_view(command='playlist_menu', playlist_menu=pl_menu) | [
"def",
"_update_playlist_menu",
"(",
"self",
",",
"pl_menu",
")",
":",
"self",
".",
"playlist_menu",
"=",
"pl_menu",
"self",
".",
"_update_view",
"(",
"command",
"=",
"'playlist_menu'",
",",
"playlist_menu",
"=",
"pl_menu",
")"
] | https://github.com/firedm/FireDM/blob/d27d3d27c869625f75520ca2bacfa9ebd11caf2f/firedm/controller.py#L586-L589 | ||
coderedcorp/coderedcms | 14bd43ffa418279986658dde93005bd6dfbd763c | coderedcms/models/page_models.py | python | CoderedEventIndexPage.fullcalendar_view | (self) | return {
self.CalendarViews.NONE: '',
self.CalendarViews.MONTH: 'dayGridMonth',
self.CalendarViews.AGENDA_WEEK: 'timeGridWeek',
self.CalendarViews.AGENDA_DAY: 'timeGridDay',
self.CalendarViews.LIST_MONTH: 'listMonth',
}[self.default_calendar_view] | Translate calendar views to fullcalendar.js identifiers. | Translate calendar views to fullcalendar.js identifiers. | [
"Translate",
"calendar",
"views",
"to",
"fullcalendar",
".",
"js",
"identifiers",
"."
] | def fullcalendar_view(self) -> str:
"""
Translate calendar views to fullcalendar.js identifiers.
"""
return {
self.CalendarViews.NONE: '',
self.CalendarViews.MONTH: 'dayGridMonth',
self.CalendarViews.AGENDA_WEEK: 'timeGridWeek',
self.Calend... | [
"def",
"fullcalendar_view",
"(",
"self",
")",
"->",
"str",
":",
"return",
"{",
"self",
".",
"CalendarViews",
".",
"NONE",
":",
"''",
",",
"self",
".",
"CalendarViews",
".",
"MONTH",
":",
"'dayGridMonth'",
",",
"self",
".",
"CalendarViews",
".",
"AGENDA_WEE... | https://github.com/coderedcorp/coderedcms/blob/14bd43ffa418279986658dde93005bd6dfbd763c/coderedcms/models/page_models.py#L972-L982 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.