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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
weechat/scripts | 99ec0e7eceefabb9efb0f11ec26d45d6e8e84335 | python/beinc.py | python | WeechatTarget._fetch_formatted_str | (self, template, values) | return template | Returns a formatted string by replacing the defined
macros in 'template' the the corresponding values from 'values'
:param template: The template to use
:type template: str
:param values: The values dict
:type values: dict
:return: The formatted string
:rtype: ... | Returns a formatted string by replacing the defined
macros in 'template' the the corresponding values from 'values' | [
"Returns",
"a",
"formatted",
"string",
"by",
"replacing",
"the",
"defined",
"macros",
"in",
"template",
"the",
"the",
"corresponding",
"values",
"from",
"values"
] | def _fetch_formatted_str(self, template, values):
"""
Returns a formatted string by replacing the defined
macros in 'template' the the corresponding values from 'values'
:param template: The template to use
:type template: str
:param values: The values dict
:typ... | [
"def",
"_fetch_formatted_str",
"(",
"self",
",",
"template",
",",
"values",
")",
":",
"timestamp",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
"(",
"self",
".",
"_timestamp_format",
")",
"replacements",
"=",
"{",
"'%S'",
":",
... | https://github.com/weechat/scripts/blob/99ec0e7eceefabb9efb0f11ec26d45d6e8e84335/python/beinc.py#L280-L304 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/pyparsing.py | python | dictOf | ( key, value ) | return Dict( ZeroOrMore( Group ( key + value ) ) ) | Helper to easily and clearly define a dictionary by specifying the respective patterns
for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
in the proper order. The key pattern can include delimiting markers or punctuation,
as long as they are sup... | Helper to easily and clearly define a dictionary by specifying the respective patterns
for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
in the proper order. The key pattern can include delimiting markers or punctuation,
as long as they are sup... | [
"Helper",
"to",
"easily",
"and",
"clearly",
"define",
"a",
"dictionary",
"by",
"specifying",
"the",
"respective",
"patterns",
"for",
"the",
"key",
"and",
"value",
".",
"Takes",
"care",
"of",
"defining",
"the",
"C",
"{",
"L",
"{",
"Dict",
"}}",
"C",
"{",
... | def dictOf( key, value ):
"""Helper to easily and clearly define a dictionary by specifying the respective patterns
for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
in the proper order. The key pattern can include delimiting markers or punctuatio... | [
"def",
"dictOf",
"(",
"key",
",",
"value",
")",
":",
"return",
"Dict",
"(",
"ZeroOrMore",
"(",
"Group",
"(",
"key",
"+",
"value",
")",
")",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/pyparsing.py#L3373-L3381 | |
phaethon/kamene | bf679a65d456411942ee4a907818ba3d6a183bfe | kamene/plist.py | python | PacketList.summary | (self, prn=None, lfilter=None) | prints a summary of each packet
prn: function to apply to each packet instead of lambda x:x.summary()
lfilter: truth function to apply to each packet to decide whether it will be displayed | prints a summary of each packet
prn: function to apply to each packet instead of lambda x:x.summary()
lfilter: truth function to apply to each packet to decide whether it will be displayed | [
"prints",
"a",
"summary",
"of",
"each",
"packet",
"prn",
":",
"function",
"to",
"apply",
"to",
"each",
"packet",
"instead",
"of",
"lambda",
"x",
":",
"x",
".",
"summary",
"()",
"lfilter",
":",
"truth",
"function",
"to",
"apply",
"to",
"each",
"packet",
... | def summary(self, prn=None, lfilter=None):
"""prints a summary of each packet
prn: function to apply to each packet instead of lambda x:x.summary()
lfilter: truth function to apply to each packet to decide whether it will be displayed"""
for r in self.res:
if lfilter is not None:
... | [
"def",
"summary",
"(",
"self",
",",
"prn",
"=",
"None",
",",
"lfilter",
"=",
"None",
")",
":",
"for",
"r",
"in",
"self",
".",
"res",
":",
"if",
"lfilter",
"is",
"not",
"None",
":",
"if",
"not",
"lfilter",
"(",
"r",
")",
":",
"continue",
"if",
"... | https://github.com/phaethon/kamene/blob/bf679a65d456411942ee4a907818ba3d6a183bfe/kamene/plist.py#L101-L112 | ||
jjhelmus/nmrglue | f47397dcda84854d2136395a9998fe0b57356cbf | nmrglue/fileio/jcampdx.py | python | find_yfactors | (dic) | return (factor_r, factor_i) | Helper to find yfactors from NTUPLES format.
Returns YFactors in tuple with order (R,I) | Helper to find yfactors from NTUPLES format.
Returns YFactors in tuple with order (R,I) | [
"Helper",
"to",
"find",
"yfactors",
"from",
"NTUPLES",
"format",
".",
"Returns",
"YFactors",
"in",
"tuple",
"with",
"order",
"(",
"R",
"I",
")"
] | def find_yfactors(dic):
'''
Helper to find yfactors from NTUPLES format.
Returns YFactors in tuple with order (R,I)
'''
# first check which column is R and I:
index_r = None
index_i = None
try:
symbols = dic["SYMBOL"][0].split(",")
symbols = [s.strip() for s in symbols]
... | [
"def",
"find_yfactors",
"(",
"dic",
")",
":",
"# first check which column is R and I:",
"index_r",
"=",
"None",
"index_i",
"=",
"None",
"try",
":",
"symbols",
"=",
"dic",
"[",
"\"SYMBOL\"",
"]",
"[",
"0",
"]",
".",
"split",
"(",
"\",\"",
")",
"symbols",
"=... | https://github.com/jjhelmus/nmrglue/blob/f47397dcda84854d2136395a9998fe0b57356cbf/nmrglue/fileio/jcampdx.py#L436-L461 | |
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/future/backports/email/_header_value_parser.py | python | get_comment | (value) | return comment, value[1:] | comment = "(" *([FWS] ccontent) [FWS] ")"
ccontent = ctext / quoted-pair / comment
We handle nested comments here, and quoted-pair in our qp-ctext routine. | comment = "(" *([FWS] ccontent) [FWS] ")"
ccontent = ctext / quoted-pair / comment | [
"comment",
"=",
"(",
"*",
"(",
"[",
"FWS",
"]",
"ccontent",
")",
"[",
"FWS",
"]",
")",
"ccontent",
"=",
"ctext",
"/",
"quoted",
"-",
"pair",
"/",
"comment"
] | def get_comment(value):
"""comment = "(" *([FWS] ccontent) [FWS] ")"
ccontent = ctext / quoted-pair / comment
We handle nested comments here, and quoted-pair in our qp-ctext routine.
"""
if value and value[0] != '(':
raise errors.HeaderParseError(
"expected '(' but found '{}'... | [
"def",
"get_comment",
"(",
"value",
")",
":",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"!=",
"'('",
":",
"raise",
"errors",
".",
"HeaderParseError",
"(",
"\"expected '(' but found '{}'\"",
".",
"format",
"(",
"value",
")",
")",
"comment",
"=",
"Commen... | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/future/backports/email/_header_value_parser.py#L1612-L1635 | |
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/PIL/OleFileIO.py | python | OleFileIO._check_duplicate_stream | (self, first_sect, minifat=False) | Checks if a stream has not been already referenced elsewhere.
This method should only be called once for each known stream, and only
if stream size is not null.
:param first_sect: int, index of first sector of the stream in FAT
:param minifat: bool, if True, stream is located in the Min... | Checks if a stream has not been already referenced elsewhere.
This method should only be called once for each known stream, and only
if stream size is not null. | [
"Checks",
"if",
"a",
"stream",
"has",
"not",
"been",
"already",
"referenced",
"elsewhere",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"once",
"for",
"each",
"known",
"stream",
"and",
"only",
"if",
"stream",
"size",
"is",
"not",
"null",
"."
] | def _check_duplicate_stream(self, first_sect, minifat=False):
"""
Checks if a stream has not been already referenced elsewhere.
This method should only be called once for each known stream, and only
if stream size is not null.
:param first_sect: int, index of first sector of the... | [
"def",
"_check_duplicate_stream",
"(",
"self",
",",
"first_sect",
",",
"minifat",
"=",
"False",
")",
":",
"if",
"minifat",
":",
"debug",
"(",
"'_check_duplicate_stream: sect=%d in MiniFAT'",
"%",
"first_sect",
")",
"used_streams",
"=",
"self",
".",
"_used_streams_mi... | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/PIL/OleFileIO.py#L1396-L1419 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/lib/xmodule/xmodule/tabs.py | python | TabFragmentViewMixin.render_to_fragment | (self, request, course, **kwargs) | return self.fragment_view.render_to_fragment(request, course_id=str(course.id), **kwargs) | Renders this tab to a web fragment. | Renders this tab to a web fragment. | [
"Renders",
"this",
"tab",
"to",
"a",
"web",
"fragment",
"."
] | def render_to_fragment(self, request, course, **kwargs):
"""
Renders this tab to a web fragment.
"""
return self.fragment_view.render_to_fragment(request, course_id=str(course.id), **kwargs) | [
"def",
"render_to_fragment",
"(",
"self",
",",
"request",
",",
"course",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"fragment_view",
".",
"render_to_fragment",
"(",
"request",
",",
"course_id",
"=",
"str",
"(",
"course",
".",
"id",
")",
",... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/tabs.py#L287-L291 | |
apachecn/AiLearning | 228b62a905a2a9bf6066f65c16d53056b10ec610 | src/py3.x/ml/6.SVM/svm-complete.py | python | selectJrand | (i, m) | return j | 随机选择一个整数
Args:
i 第一个alpha的下标
m 所有alpha的数目
Returns:
j 返回一个不为i的随机数,在0~m之间的整数值 | 随机选择一个整数
Args:
i 第一个alpha的下标
m 所有alpha的数目
Returns:
j 返回一个不为i的随机数,在0~m之间的整数值 | [
"随机选择一个整数",
"Args",
":",
"i",
"第一个alpha的下标",
"m",
"所有alpha的数目",
"Returns",
":",
"j",
"返回一个不为i的随机数,在0~m之间的整数值"
] | def selectJrand(i, m):
"""
随机选择一个整数
Args:
i 第一个alpha的下标
m 所有alpha的数目
Returns:
j 返回一个不为i的随机数,在0~m之间的整数值
"""
j = i
while j == i:
j = random.randint(0, m - 1)
return j | [
"def",
"selectJrand",
"(",
"i",
",",
"m",
")",
":",
"j",
"=",
"i",
"while",
"j",
"==",
"i",
":",
"j",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"m",
"-",
"1",
")",
"return",
"j"
] | https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py3.x/ml/6.SVM/svm-complete.py#L112-L124 | |
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | ez_setup.py | python | download_setuptools | (
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
delay = 15
) | return os.path.realpath(saveto) | Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the nu... | Download setuptools from a specified location and return its filename | [
"Download",
"setuptools",
"from",
"a",
"specified",
"location",
"and",
"return",
"its",
"filename"
] | def download_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
delay = 15
):
"""Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_ba... | [
"def",
"download_setuptools",
"(",
"version",
"=",
"DEFAULT_VERSION",
",",
"download_base",
"=",
"DEFAULT_URL",
",",
"to_dir",
"=",
"os",
".",
"curdir",
",",
"delay",
"=",
"15",
")",
":",
"import",
"urllib2",
",",
"shutil",
"egg_name",
"=",
"\"setuptools-%s-py... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/ez_setup.py#L113-L158 | |
bdcht/amoco | dac8e00b862eb6d87cc88dddd1e5316c67c1d798 | amoco/system/structs/fields.py | python | Field.format | (self) | return "%ds" % sz | The format of a regular Field (ie. not derived from RawField) is always returned
as matching a finite-length string. | The format of a regular Field (ie. not derived from RawField) is always returned
as matching a finite-length string. | [
"The",
"format",
"of",
"a",
"regular",
"Field",
"(",
"ie",
".",
"not",
"derived",
"from",
"RawField",
")",
"is",
"always",
"returned",
"as",
"matching",
"a",
"finite",
"-",
"length",
"string",
"."
] | def format(self):
"""
The format of a regular Field (ie. not derived from RawField) is always returned
as matching a finite-length string.
"""
sz = self.size()
return "%ds" % sz | [
"def",
"format",
"(",
"self",
")",
":",
"sz",
"=",
"self",
".",
"size",
"(",
")",
"return",
"\"%ds\"",
"%",
"sz"
] | https://github.com/bdcht/amoco/blob/dac8e00b862eb6d87cc88dddd1e5316c67c1d798/amoco/system/structs/fields.py#L74-L80 | |
jindongwang/transferlearning | 74a8914eed52c6f0759f39c0239d7e8b5baa6245 | code/distance/mmd_numpy_sklearn.py | python | mmd_linear | (X, Y) | return delta.dot(delta.T) | MMD using linear kernel (i.e., k(x,y) = <x,y>)
Note that this is not the original linear MMD, only the reformulated and faster version.
The original version is:
def mmd_linear(X, Y):
XX = np.dot(X, X.T)
YY = np.dot(Y, Y.T)
XY = np.dot(X, Y.T)
return XX.mea... | MMD using linear kernel (i.e., k(x,y) = <x,y>)
Note that this is not the original linear MMD, only the reformulated and faster version.
The original version is:
def mmd_linear(X, Y):
XX = np.dot(X, X.T)
YY = np.dot(Y, Y.T)
XY = np.dot(X, Y.T)
return XX.mea... | [
"MMD",
"using",
"linear",
"kernel",
"(",
"i",
".",
"e",
".",
"k",
"(",
"x",
"y",
")",
"=",
"<x",
"y",
">",
")",
"Note",
"that",
"this",
"is",
"not",
"the",
"original",
"linear",
"MMD",
"only",
"the",
"reformulated",
"and",
"faster",
"version",
".",... | def mmd_linear(X, Y):
"""MMD using linear kernel (i.e., k(x,y) = <x,y>)
Note that this is not the original linear MMD, only the reformulated and faster version.
The original version is:
def mmd_linear(X, Y):
XX = np.dot(X, X.T)
YY = np.dot(Y, Y.T)
XY = np.dot(X, Y... | [
"def",
"mmd_linear",
"(",
"X",
",",
"Y",
")",
":",
"delta",
"=",
"X",
".",
"mean",
"(",
"0",
")",
"-",
"Y",
".",
"mean",
"(",
"0",
")",
"return",
"delta",
".",
"dot",
"(",
"delta",
".",
"T",
")"
] | https://github.com/jindongwang/transferlearning/blob/74a8914eed52c6f0759f39c0239d7e8b5baa6245/code/distance/mmd_numpy_sklearn.py#L7-L25 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pkg_resources/_vendor/packaging/_structures.py | python | Infinity.__ne__ | (self, other) | return not isinstance(other, self.__class__) | [] | def __ne__(self, other):
return not isinstance(other, self.__class__) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pkg_resources/_vendor/packaging/_structures.py#L24-L25 | |||
anime-dl/anime-downloader | 17fb8fe8bcf0525cc2052b37492c7f6fc2f56454 | anime_downloader/sites/anime.py | python | Anime.search | (cls, query) | return | Search searches for the anime using the query given.
Parameters
----------
query: str
query is the query keyword to be searched.
Returns
-------
list
List of :py:class:`~anime_downloader.sites.anime.SearchResult` | Search searches for the anime using the query given. | [
"Search",
"searches",
"for",
"the",
"anime",
"using",
"the",
"query",
"given",
"."
] | def search(cls, query):
"""
Search searches for the anime using the query given.
Parameters
----------
query: str
query is the query keyword to be searched.
Returns
-------
list
List of :py:class:`~anime_downloader.sites.anime.Sea... | [
"def",
"search",
"(",
"cls",
",",
"query",
")",
":",
"return"
] | https://github.com/anime-dl/anime-downloader/blob/17fb8fe8bcf0525cc2052b37492c7f6fc2f56454/anime_downloader/sites/anime.py#L50-L64 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | datadog_checks_base/datadog_checks/base/checks/win/winpdh.py | python | WinPDHCounter._get_counter_dictionary | (self) | [] | def _get_counter_dictionary(self):
if WinPDHCounter.pdh_counter_dict:
# already populated
return
if WinPDHCounter._use_en_counter_names:
# already found out the registry isn't there
return
try:
val, t = winreg.QueryValueEx(winreg.HKEY_... | [
"def",
"_get_counter_dictionary",
"(",
"self",
")",
":",
"if",
"WinPDHCounter",
".",
"pdh_counter_dict",
":",
"# already populated",
"return",
"if",
"WinPDHCounter",
".",
"_use_en_counter_names",
":",
"# already found out the registry isn't there",
"return",
"try",
":",
"... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_base/datadog_checks/base/checks/win/winpdh.py#L115-L148 | ||||
keras-team/keras-tuner | 197eb0fc580fc52a49add60c2af25dbe269e4072 | keras_tuner/protos/service_pb2_grpc.py | python | OracleServicer.UpdateSpace | (self, request, context) | Updates the HyperParameter search space. | Updates the HyperParameter search space. | [
"Updates",
"the",
"HyperParameter",
"search",
"space",
"."
] | def UpdateSpace(self, request, context):
"""Updates the HyperParameter search space."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!") | [
"def",
"UpdateSpace",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"\"Method not implemented!\"",
")",
"raise",
"NotImplementedEr... | https://github.com/keras-team/keras-tuner/blob/197eb0fc580fc52a49add60c2af25dbe269e4072/keras_tuner/protos/service_pb2_grpc.py#L79-L83 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_cinder_volume_source.py | python | V1CinderVolumeSource.fs_type | (self) | return self._fs_type | Gets the fs_type of this V1CinderVolumeSource. # noqa: E501
Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md # noqa... | Gets the fs_type of this V1CinderVolumeSource. # noqa: E501 | [
"Gets",
"the",
"fs_type",
"of",
"this",
"V1CinderVolumeSource",
".",
"#",
"noqa",
":",
"E501"
] | def fs_type(self):
"""Gets the fs_type of this V1CinderVolumeSource. # noqa: E501
Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: https://examples.k8s.io/mys... | [
"def",
"fs_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fs_type"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_cinder_volume_source.py#L70-L78 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.__init__ | (self, name, mode, comptype, fileobj, bufsize) | Construct a _Stream object. | Construct a _Stream object. | [
"Construct",
"a",
"_Stream",
"object",
"."
] | def __init__(self, name, mode, comptype, fileobj, bufsize):
"""Construct a _Stream object.
"""
self._extfileobj = True
if fileobj is None:
fileobj = _LowLevelFile(name, mode)
self._extfileobj = False
if comptype == '*':
# Enable transparent co... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"mode",
",",
"comptype",
",",
"fileobj",
",",
"bufsize",
")",
":",
"self",
".",
"_extfileobj",
"=",
"True",
"if",
"fileobj",
"is",
"None",
":",
"fileobj",
"=",
"_LowLevelFile",
"(",
"name",
",",
"mode",... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L399-L449 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/tkinter/__init__.py | python | Frame.__init__ | (self, master=None, cnf={}, **kw) | Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class,
colormap, container, cursor, height, highlightbackground,
highlightcolor, highlightthickness, relief, takefocus, visual, width. | Construct a frame widget with the parent MASTER. | [
"Construct",
"a",
"frame",
"widget",
"with",
"the",
"parent",
"MASTER",
"."
] | def __init__(self, master=None, cnf={}, **kw):
"""Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class,
colormap, container, cursor, height, highlightbackground,
highlightcolor, highlightthickness, relief, takefocus, visual, width... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"cnf",
"=",
"_cnfmerge",
"(",
"(",
"cnf",
",",
"kw",
")",
")",
"extra",
"=",
"(",
")",
"if",
"'class_'",
"in",
"cnf",
":",
... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/__init__.py#L2573-L2587 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/spin.py | python | SpinState.m | (self) | return self.label[1] | [] | def m(self):
return self.label[1] | [
"def",
"m",
"(",
"self",
")",
":",
"return",
"self",
".",
"label",
"[",
"1",
"]"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/spin.py#L939-L940 | |||
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas_rhino/artists/polygonartist.py | python | PolygonArtist.draw | (self, show_points=False, show_edges=False, show_face=True) | return guids | Draw the polygon.
Parameters
----------
show_points : bool, optional
Default is ``False``.
show_edges : bool, optional
Default is ``False``.
show_face : bool, optional
Default is ``True``.
Returns
-------
list
... | Draw the polygon. | [
"Draw",
"the",
"polygon",
"."
] | def draw(self, show_points=False, show_edges=False, show_face=True):
"""Draw the polygon.
Parameters
----------
show_points : bool, optional
Default is ``False``.
show_edges : bool, optional
Default is ``False``.
show_face : bool, optional
... | [
"def",
"draw",
"(",
"self",
",",
"show_points",
"=",
"False",
",",
"show_edges",
"=",
"False",
",",
"show_face",
"=",
"True",
")",
":",
"_points",
"=",
"map",
"(",
"list",
",",
"self",
".",
"primitive",
".",
"points",
")",
"guids",
"=",
"[",
"]",
"... | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas_rhino/artists/polygonartist.py#L24-L52 | |
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/gui/watolib/host_attributes.py | python | ABCHostAttribute.show_in_host_cleanup | (self) | return self.editable() | Whether or not to make this attribute selectable in
the host cleanup form | Whether or not to make this attribute selectable in
the host cleanup form | [
"Whether",
"or",
"not",
"to",
"make",
"this",
"attribute",
"selectable",
"in",
"the",
"host",
"cleanup",
"form"
] | def show_in_host_cleanup(self) -> bool:
"""Whether or not to make this attribute selectable in
the host cleanup form"""
return self.editable() | [
"def",
"show_in_host_cleanup",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"editable",
"(",
")"
] | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/watolib/host_attributes.py#L280-L283 | |
beetbox/confuse | c328e810f7a31412e0650235f71728e983edd18e | confuse/core.py | python | ConfigView.get_redactions | (self) | Get the set of currently-redacted sub-key-paths at this view. | Get the set of currently-redacted sub-key-paths at this view. | [
"Get",
"the",
"set",
"of",
"currently",
"-",
"redacted",
"sub",
"-",
"key",
"-",
"paths",
"at",
"this",
"view",
"."
] | def get_redactions(self):
"""Get the set of currently-redacted sub-key-paths at this view.
"""
raise NotImplementedError() | [
"def",
"get_redactions",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/beetbox/confuse/blob/c328e810f7a31412e0650235f71728e983edd18e/confuse/core.py#L377-L380 | ||
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/virt/powervm/disk/driver.py | python | DiskAdapter.capacity_used | (self) | Capacity of the storage in gigabytes that is used.
Default is to say none of it is used. | Capacity of the storage in gigabytes that is used. | [
"Capacity",
"of",
"the",
"storage",
"in",
"gigabytes",
"that",
"is",
"used",
"."
] | def capacity_used(self):
"""Capacity of the storage in gigabytes that is used.
Default is to say none of it is used.
"""
raise NotImplementedError() | [
"def",
"capacity_used",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/virt/powervm/disk/driver.py#L195-L200 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/diagram_algebras.py | python | OrbitBasis.product_on_basis | (self, d1, d2) | return self._from_dict(term_dict) | r"""
Return the product `O_{d_1} O_{d_2}` of two elements
in the orbit basis ``self``.
EXAMPLES::
sage: R.<x> = QQ[]
sage: OP = PartitionAlgebra(2, x, R).orbit_basis()
sage: SP = OP.basis().keys(); sp = SP([[-2, -1, 1, 2]])
sage: OP.product_on_ba... | r"""
Return the product `O_{d_1} O_{d_2}` of two elements
in the orbit basis ``self``. | [
"r",
"Return",
"the",
"product",
"O_",
"{",
"d_1",
"}",
"O_",
"{",
"d_2",
"}",
"of",
"two",
"elements",
"in",
"the",
"orbit",
"basis",
"self",
"."
] | def product_on_basis(self, d1, d2):
r"""
Return the product `O_{d_1} O_{d_2}` of two elements
in the orbit basis ``self``.
EXAMPLES::
sage: R.<x> = QQ[]
sage: OP = PartitionAlgebra(2, x, R).orbit_basis()
sage: SP = OP.basis().keys(); sp = SP([[-2, -1... | [
"def",
"product_on_basis",
"(",
"self",
",",
"d1",
",",
"d2",
")",
":",
"# According to Corollary 4.12 in [BH2017]_, product is zero unless the",
"# stacked diagrams \"exactly match\" in the middle.",
"pi_1",
"=",
"[",
"frozenset",
"(",
"[",
"-",
"i",
"for",
"i",
"in",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/diagram_algebras.py#L3341-L3452 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/physics/quantum/cg.py | python | _check_cg | (cg_term, expr, length, sign=None) | Checks whether a term matches the given expression | Checks whether a term matches the given expression | [
"Checks",
"whether",
"a",
"term",
"matches",
"the",
"given",
"expression"
] | def _check_cg(cg_term, expr, length, sign=None):
"""Checks whether a term matches the given expression"""
# TODO: Check for symmetries
matches = cg_term.match(expr)
if matches is None:
return
if sign is not None:
if not isinstance(sign, tuple):
raise TypeError('sign must ... | [
"def",
"_check_cg",
"(",
"cg_term",
",",
"expr",
",",
"length",
",",
"sign",
"=",
"None",
")",
":",
"# TODO: Check for symmetries",
"matches",
"=",
"cg_term",
".",
"match",
"(",
"expr",
")",
"if",
"matches",
"is",
"None",
":",
"return",
"if",
"sign",
"is... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/physics/quantum/cg.py#L641-L653 | ||
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/plugin_base/provider.py | python | Provider.set_owner | (self, path, owner=-1, group=-1, relative_to=None) | Set owner and/or group for specified path | Set owner and/or group for specified path | [
"Set",
"owner",
"and",
"/",
"or",
"group",
"for",
"specified",
"path"
] | def set_owner(self, path, owner=-1, group=-1, relative_to=None):
"""Set owner and/or group for specified path"""
pass | [
"def",
"set_owner",
"(",
"self",
",",
"path",
",",
"owner",
"=",
"-",
"1",
",",
"group",
"=",
"-",
"1",
",",
"relative_to",
"=",
"None",
")",
":",
"pass"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/plugin_base/provider.py#L210-L212 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/command_support/GraphicsMode.py | python | basicGraphicsMode.update_cursor_for_RMB | (self) | Update the cursor for operations when the right mouse button (RMB) is pressed | Update the cursor for operations when the right mouse button (RMB) is pressed | [
"Update",
"the",
"cursor",
"for",
"operations",
"when",
"the",
"right",
"mouse",
"button",
"(",
"RMB",
")",
"is",
"pressed"
] | def update_cursor_for_RMB(self): # mark 060228
"""
Update the cursor for operations when the right mouse button (RMB) is pressed
"""
pass | [
"def",
"update_cursor_for_RMB",
"(",
"self",
")",
":",
"# mark 060228",
"pass"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/command_support/GraphicsMode.py#L1272-L1276 | ||
paulproteus/python-scraping-code-samples | 4e5396d4e311ca66c784a2b5f859308285e511da | new/seleniumrc/selenium-remote-control-1.0-beta-2/selenium-python-client-driver-1.0-beta-2/selenium.py | python | selenium.get_whether_this_frame_match_frame_expression | (self,currentFrameString,target) | return self.get_boolean("getWhetherThisFrameMatchFrameExpression", [currentFrameString,target,]) | Determine whether current/locator identify the frame containing this running code.
This is useful in proxy injection mode, where this code runs in every
browser frame and window, and sometimes the selenium server needs to identify
the "current" frame. In this case, when the te... | Determine whether current/locator identify the frame containing this running code.
This is useful in proxy injection mode, where this code runs in every
browser frame and window, and sometimes the selenium server needs to identify
the "current" frame. In this case, when the te... | [
"Determine",
"whether",
"current",
"/",
"locator",
"identify",
"the",
"frame",
"containing",
"this",
"running",
"code",
".",
"This",
"is",
"useful",
"in",
"proxy",
"injection",
"mode",
"where",
"this",
"code",
"runs",
"in",
"every",
"browser",
"frame",
"and",
... | def get_whether_this_frame_match_frame_expression(self,currentFrameString,target):
"""
Determine whether current/locator identify the frame containing this running code.
This is useful in proxy injection mode, where this code runs in every
browser frame and window, and ... | [
"def",
"get_whether_this_frame_match_frame_expression",
"(",
"self",
",",
"currentFrameString",
",",
"target",
")",
":",
"return",
"self",
".",
"get_boolean",
"(",
"\"getWhetherThisFrameMatchFrameExpression\"",
",",
"[",
"currentFrameString",
",",
"target",
",",
"]",
")... | https://github.com/paulproteus/python-scraping-code-samples/blob/4e5396d4e311ca66c784a2b5f859308285e511da/new/seleniumrc/selenium-remote-control-1.0-beta-2/selenium-python-client-driver-1.0-beta-2/selenium.py#L862-L877 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/provenance_event_dto.py | python | ProvenanceEventDTO.input_content_claim_section | (self) | return self._input_content_claim_section | Gets the input_content_claim_section of this ProvenanceEventDTO.
The section in which the input content claim lives.
:return: The input_content_claim_section of this ProvenanceEventDTO.
:rtype: str | Gets the input_content_claim_section of this ProvenanceEventDTO.
The section in which the input content claim lives. | [
"Gets",
"the",
"input_content_claim_section",
"of",
"this",
"ProvenanceEventDTO",
".",
"The",
"section",
"in",
"which",
"the",
"input",
"content",
"claim",
"lives",
"."
] | def input_content_claim_section(self):
"""
Gets the input_content_claim_section of this ProvenanceEventDTO.
The section in which the input content claim lives.
:return: The input_content_claim_section of this ProvenanceEventDTO.
:rtype: str
"""
return self._input... | [
"def",
"input_content_claim_section",
"(",
"self",
")",
":",
"return",
"self",
".",
"_input_content_claim_section"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/provenance_event_dto.py#L827-L835 | |
coryo/ComicReader.bundle | 178849a400b0afa2f92627a93e7147f929989548 | Contents/Libraries/Shared/rarfile.py | python | RarExtFile.tell | (self) | return self.inf.file_size - self.remain | Return current reading position in uncompressed data. | Return current reading position in uncompressed data. | [
"Return",
"current",
"reading",
"position",
"in",
"uncompressed",
"data",
"."
] | def tell(self):
"""Return current reading position in uncompressed data."""
return self.inf.file_size - self.remain | [
"def",
"tell",
"(",
"self",
")",
":",
"return",
"self",
".",
"inf",
".",
"file_size",
"-",
"self",
".",
"remain"
] | https://github.com/coryo/ComicReader.bundle/blob/178849a400b0afa2f92627a93e7147f929989548/Contents/Libraries/Shared/rarfile.py#L1426-L1428 | |
ShahriyarR/MySQL-AutoXtraBackup | dfdf86ba4d1fe15a35cececa4934cb7f247e448f | mysql_autoxtrabackup/general_conf/check_env.py | python | CheckEnv.check_mysql_inc_backup_dir | (self) | return create_directory(str(self.backup_options.get("inc_dir"))) | Check incremental backup directory path.
If this path exists return True if not try to create.
:return: True on success. | Check incremental backup directory path.
If this path exists return True if not try to create.
:return: True on success. | [
"Check",
"incremental",
"backup",
"directory",
"path",
".",
"If",
"this",
"path",
"exists",
"return",
"True",
"if",
"not",
"try",
"to",
"create",
".",
":",
"return",
":",
"True",
"on",
"success",
"."
] | def check_mysql_inc_backup_dir(self) -> Optional[bool]:
"""
Check incremental backup directory path.
If this path exists return True if not try to create.
:return: True on success.
"""
if os.path.exists(str(self.backup_options.get("inc_dir"))):
logger.info("OK... | [
"def",
"check_mysql_inc_backup_dir",
"(",
"self",
")",
"->",
"Optional",
"[",
"bool",
"]",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"str",
"(",
"self",
".",
"backup_options",
".",
"get",
"(",
"\"inc_dir\"",
")",
")",
")",
":",
"logger",
".",
... | https://github.com/ShahriyarR/MySQL-AutoXtraBackup/blob/dfdf86ba4d1fe15a35cececa4934cb7f247e448f/mysql_autoxtrabackup/general_conf/check_env.py#L172-L182 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/core/serializers/xml_serializer.py | python | Deserializer._handle_fk_field_node | (self, node, field) | Handle a <field> node for a ForeignKey | Handle a <field> node for a ForeignKey | [
"Handle",
"a",
"<field",
">",
"node",
"for",
"a",
"ForeignKey"
] | def _handle_fk_field_node(self, node, field):
"""
Handle a <field> node for a ForeignKey
"""
# Check if there is a child node named 'None', returning None if so.
if node.getElementsByTagName('None'):
return None
else:
if hasattr(field.rel.to._defau... | [
"def",
"_handle_fk_field_node",
"(",
"self",
",",
"node",
",",
"field",
")",
":",
"# Check if there is a child node named 'None', returning None if so.",
"if",
"node",
".",
"getElementsByTagName",
"(",
"'None'",
")",
":",
"return",
"None",
"else",
":",
"if",
"hasattr"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/core/serializers/xml_serializer.py#L216-L242 | ||
lixin4ever/E2E-TBSA | 7e538ab487fbf8ab426c9ea7a5ccbc0a34174222 | utils.py | python | set_cid | (dataset, char_vocab) | return dataset | set cid field for the records in the dataset
:param dataset: dataset
:param char_vocab: vocabulary of character
:return: | set cid field for the records in the dataset
:param dataset: dataset
:param char_vocab: vocabulary of character
:return: | [
"set",
"cid",
"field",
"for",
"the",
"records",
"in",
"the",
"dataset",
":",
"param",
"dataset",
":",
"dataset",
":",
"param",
"char_vocab",
":",
"vocabulary",
"of",
"character",
":",
"return",
":"
] | def set_cid(dataset, char_vocab):
"""
set cid field for the records in the dataset
:param dataset: dataset
:param char_vocab: vocabulary of character
:return:
"""
n_records = len(dataset)
cids = []
for i in range(n_records):
words = dataset[i]['words']
cids = []
... | [
"def",
"set_cid",
"(",
"dataset",
",",
"char_vocab",
")",
":",
"n_records",
"=",
"len",
"(",
"dataset",
")",
"cids",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"n_records",
")",
":",
"words",
"=",
"dataset",
"[",
"i",
"]",
"[",
"'words'",
"]",
... | https://github.com/lixin4ever/E2E-TBSA/blob/7e538ab487fbf8ab426c9ea7a5ccbc0a34174222/utils.py#L513-L528 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/lib2to3/pytree.py | python | WildcardPattern.generate_matches | (self, nodes) | Generator yielding matches for a sequence of nodes.
Args:
nodes: sequence of nodes
Yields:
(count, results) tuples where:
count: the match comprises nodes[:count];
results: dict containing named submatches. | Generator yielding matches for a sequence of nodes. | [
"Generator",
"yielding",
"matches",
"for",
"a",
"sequence",
"of",
"nodes",
"."
] | def generate_matches(self, nodes):
"""
Generator yielding matches for a sequence of nodes.
Args:
nodes: sequence of nodes
Yields:
(count, results) tuples where:
count: the match comprises nodes[:count];
results: dict containing named subm... | [
"def",
"generate_matches",
"(",
"self",
",",
"nodes",
")",
":",
"if",
"self",
".",
"content",
"is",
"None",
":",
"# Shortcut for special case (see __init__.__doc__)",
"for",
"count",
"in",
"xrange",
"(",
"self",
".",
"min",
",",
"1",
"+",
"min",
"(",
"len",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/lib2to3/pytree.py#L722-L765 | ||
giantbranch/python-hacker-code | addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d | 我手敲的代码(中文注释)/chapter9/pycrypto-2.6.1/build/lib.win32-2.7/Crypto/PublicKey/RSA.py | python | _RSAobj.verify | (self, M, signature) | return pubkey.pubkey.verify(self, M, signature) | Verify the validity of an RSA signature.
:attention: this function performs the plain, primitive RSA encryption
(*textbook*). In real applications, you always need to use proper
cryptographic padding, and you should not directly verify data with
this method. Failure to do so may lead... | Verify the validity of an RSA signature. | [
"Verify",
"the",
"validity",
"of",
"an",
"RSA",
"signature",
"."
] | def verify(self, M, signature):
"""Verify the validity of an RSA signature.
:attention: this function performs the plain, primitive RSA encryption
(*textbook*). In real applications, you always need to use proper
cryptographic padding, and you should not directly verify data with
... | [
"def",
"verify",
"(",
"self",
",",
"M",
",",
"signature",
")",
":",
"return",
"pubkey",
".",
"pubkey",
".",
"verify",
"(",
"self",
",",
"M",
",",
"signature",
")"
] | https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter9/pycrypto-2.6.1/build/lib.win32-2.7/Crypto/PublicKey/RSA.py#L201-L221 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/Quartz/CoreGraphics/_contextmanager.py | python | CGContextPage.__exit__ | (self, exc_type, exc_value, exc_tp) | return False | [] | def __exit__(self, exc_type, exc_value, exc_tp):
CG.CGContextEndPage(self.context)
return False | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
",",
"exc_value",
",",
"exc_tp",
")",
":",
"CG",
".",
"CGContextEndPage",
"(",
"self",
".",
"context",
")",
"return",
"False"
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/Quartz/CoreGraphics/_contextmanager.py#L93-L95 | |||
SCSSoftware/BlenderTools | 96f323d3bdf2d8cb8ed7f882dcdf036277a802dd | addon/io_scs_tools/utils/mesh.py | python | get_vertex_normal | (mesh, vert_index) | return vrt_no | Takes a mesh and vertex index and returns normal of the vertex.
:param mesh:
:param vert_index:
:return: | Takes a mesh and vertex index and returns normal of the vertex.
:param mesh:
:param vert_index:
:return: | [
"Takes",
"a",
"mesh",
"and",
"vertex",
"index",
"and",
"returns",
"normal",
"of",
"the",
"vertex",
".",
":",
"param",
"mesh",
":",
":",
"param",
"vert_index",
":",
":",
"return",
":"
] | def get_vertex_normal(mesh, vert_index):
"""
Takes a mesh and vertex index and returns normal of the vertex.
:param mesh:
:param vert_index:
:return:
"""
loop_vert_no = mesh.vertices[vert_index].normal
# vrt_no = (loop_vert_no[0], loop_vert_no[1], loop_vert_no[2])
vrt_no = (loop_vert... | [
"def",
"get_vertex_normal",
"(",
"mesh",
",",
"vert_index",
")",
":",
"loop_vert_no",
"=",
"mesh",
".",
"vertices",
"[",
"vert_index",
"]",
".",
"normal",
"# vrt_no = (loop_vert_no[0], loop_vert_no[1], loop_vert_no[2])",
"vrt_no",
"=",
"(",
"loop_vert_no",
"[",
"0",
... | https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/utils/mesh.py#L231-L242 | |
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/nodes/mesh/get_uv_map.py | python | GetUVMapNode.execute | (self, mesh, uvMapName) | return uvMap.data | [] | def execute(self, mesh, uvMapName):
if uvMapName == "":
self.raiseErrorMessage("UV map name can't be empty.")
uvMap = mesh.getUVMapAttribute(uvMapName)
if uvMap is None:
self.raiseErrorMessage(f"Mesh doesn't have a uv map with the name '{uvMapName}'.")
return uv... | [
"def",
"execute",
"(",
"self",
",",
"mesh",
",",
"uvMapName",
")",
":",
"if",
"uvMapName",
"==",
"\"\"",
":",
"self",
".",
"raiseErrorMessage",
"(",
"\"UV map name can't be empty.\"",
")",
"uvMap",
"=",
"mesh",
".",
"getUVMapAttribute",
"(",
"uvMapName",
")",
... | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/mesh/get_uv_map.py#L16-L24 | |||
urwid/urwid | e2423b5069f51d318ea1ac0f355a0efe5448f7eb | urwid/widget.py | python | Edit.set_edit_pos | (self, pos) | Set the cursor position with a self.edit_text offset.
Clips pos to [0, len(edit_text)].
:param pos: cursor position
:type pos: int
>>> e = Edit(u"", u"word")
>>> e.edit_pos
4
>>> e.set_edit_pos(2)
>>> e.edit_pos
2
>>> e.edit_pos = -1 # U... | Set the cursor position with a self.edit_text offset.
Clips pos to [0, len(edit_text)]. | [
"Set",
"the",
"cursor",
"position",
"with",
"a",
"self",
".",
"edit_text",
"offset",
".",
"Clips",
"pos",
"to",
"[",
"0",
"len",
"(",
"edit_text",
")",
"]",
"."
] | def set_edit_pos(self, pos):
"""
Set the cursor position with a self.edit_text offset.
Clips pos to [0, len(edit_text)].
:param pos: cursor position
:type pos: int
>>> e = Edit(u"", u"word")
>>> e.edit_pos
4
>>> e.set_edit_pos(2)
>>> e.ed... | [
"def",
"set_edit_pos",
"(",
"self",
",",
"pos",
")",
":",
"if",
"pos",
"<",
"0",
":",
"pos",
"=",
"0",
"if",
"pos",
">",
"len",
"(",
"self",
".",
"_edit_text",
")",
":",
"pos",
"=",
"len",
"(",
"self",
".",
"_edit_text",
")",
"self",
".",
"high... | https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/widget.py#L1300-L1328 | ||
luuuyi/RefineDet.PyTorch | 0e4b24ce07245fcb8c48292326a731729cc5746a | data/coco.py | python | COCOAnnotationTransform.__call__ | (self, target, width, height) | return res | Args:
target (dict): COCO target json annotation as a python dict
height (int): height
width (int): width
Returns:
a list containing lists of bounding boxes [bbox coords, class idx] | Args:
target (dict): COCO target json annotation as a python dict
height (int): height
width (int): width
Returns:
a list containing lists of bounding boxes [bbox coords, class idx] | [
"Args",
":",
"target",
"(",
"dict",
")",
":",
"COCO",
"target",
"json",
"annotation",
"as",
"a",
"python",
"dict",
"height",
"(",
"int",
")",
":",
"height",
"width",
"(",
"int",
")",
":",
"width",
"Returns",
":",
"a",
"list",
"containing",
"lists",
"... | def __call__(self, target, width, height):
"""
Args:
target (dict): COCO target json annotation as a python dict
height (int): height
width (int): width
Returns:
a list containing lists of bounding boxes [bbox coords, class idx]
"""
... | [
"def",
"__call__",
"(",
"self",
",",
"target",
",",
"width",
",",
"height",
")",
":",
"scale",
"=",
"np",
".",
"array",
"(",
"[",
"width",
",",
"height",
",",
"width",
",",
"height",
"]",
")",
"res",
"=",
"[",
"]",
"for",
"obj",
"in",
"target",
... | https://github.com/luuuyi/RefineDet.PyTorch/blob/0e4b24ce07245fcb8c48292326a731729cc5746a/data/coco.py#L49-L72 | |
chapmanb/bcbb | dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027 | biopython/glimmer_to_proteins.py | python | protein_recs | (glimmer_file, ref_rec) | Generate protein records | Generate protein records | [
"Generate",
"protein",
"records"
] | def protein_recs(glimmer_file, ref_rec):
"""Generate protein records
"""
with open(glimmer_file) as in_handle:
for gene_num, exons, strand in glimmer_predictions(in_handle):
seq_exons = []
for start, end in exons:
seq_exons.append(ref_rec.seq[start:end])
... | [
"def",
"protein_recs",
"(",
"glimmer_file",
",",
"ref_rec",
")",
":",
"with",
"open",
"(",
"glimmer_file",
")",
"as",
"in_handle",
":",
"for",
"gene_num",
",",
"exons",
",",
"strand",
"in",
"glimmer_predictions",
"(",
"in_handle",
")",
":",
"seq_exons",
"=",... | https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/biopython/glimmer_to_proteins.py#L36-L48 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/cells/rpcapi.py | python | CellsAPI.proxy_rpc_to_manager | (self, ctxt, rpc_message, topic, call=False,
timeout=None) | return self.call(ctxt, self.make_msg('proxy_rpc_to_manager',
topic=topic,
rpc_message=rpc_message,
call=call,
timeout=timeout),
... | Proxy RPC to a compute manager. The host in the topic
should be encoded with the target cell name. | Proxy RPC to a compute manager. The host in the topic
should be encoded with the target cell name. | [
"Proxy",
"RPC",
"to",
"a",
"compute",
"manager",
".",
"The",
"host",
"in",
"the",
"topic",
"should",
"be",
"encoded",
"with",
"the",
"target",
"cell",
"name",
"."
] | def proxy_rpc_to_manager(self, ctxt, rpc_message, topic, call=False,
timeout=None):
"""Proxy RPC to a compute manager. The host in the topic
should be encoded with the target cell name.
"""
return self.call(ctxt, self.make_msg('proxy_rpc_to_manager',
... | [
"def",
"proxy_rpc_to_manager",
"(",
"self",
",",
"ctxt",
",",
"rpc_message",
",",
"topic",
",",
"call",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"ctxt",
",",
"self",
".",
"make_msg",
"(",
"'proxy_rpc_to_man... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/cells/rpcapi.py#L184-L195 | |
enthought/chaco | 0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f | chaco/tools/pan_tool.py | python | PanTool.panning_left_up | (self, event) | Handles the left mouse button coming up when the tool is in the
'panning' state.
Stops panning if the left mouse button is the drag button. | Handles the left mouse button coming up when the tool is in the
'panning' state. | [
"Handles",
"the",
"left",
"mouse",
"button",
"coming",
"up",
"when",
"the",
"tool",
"is",
"in",
"the",
"panning",
"state",
"."
] | def panning_left_up(self, event):
"""Handles the left mouse button coming up when the tool is in the
'panning' state.
Stops panning if the left mouse button is the drag button.
"""
if self.drag_button == "left":
self._end_pan(event) | [
"def",
"panning_left_up",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"drag_button",
"==",
"\"left\"",
":",
"self",
".",
"_end_pan",
"(",
"event",
")"
] | https://github.com/enthought/chaco/blob/0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f/chaco/tools/pan_tool.py#L138-L145 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/MicrosoftDefenderAdvancedThreatProtection/Integrations/MicrosoftDefenderAdvancedThreatProtection/MicrosoftDefenderAdvancedThreatProtection.py | python | MsClient.get_investigation_list | (self, ) | return self.ms_client.http_request(method='GET', url_suffix=cmd_url) | Retrieves a collection of Investigations.
Returns:
dict. A collection of Investigations entities. | Retrieves a collection of Investigations. | [
"Retrieves",
"a",
"collection",
"of",
"Investigations",
"."
] | def get_investigation_list(self, ):
"""Retrieves a collection of Investigations.
Returns:
dict. A collection of Investigations entities.
"""
cmd_url = '/investigations'
return self.ms_client.http_request(method='GET', url_suffix=cmd_url) | [
"def",
"get_investigation_list",
"(",
"self",
",",
")",
":",
"cmd_url",
"=",
"'/investigations'",
"return",
"self",
".",
"ms_client",
".",
"http_request",
"(",
"method",
"=",
"'GET'",
",",
"url_suffix",
"=",
"cmd_url",
")"
] | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/MicrosoftDefenderAdvancedThreatProtection/Integrations/MicrosoftDefenderAdvancedThreatProtection/MicrosoftDefenderAdvancedThreatProtection.py#L562-L569 | |
google/aiyprojects-raspbian | 964f07f5b4bd2ec785cfda6f318e50e1b67d4758 | src/aiy/vision/inference.py | python | InferenceEngine.get_inference_state | (self) | return self._communicate_bytes(_REQ_GET_INFERENCE_STATE).inference_state | Returns inference state. | Returns inference state. | [
"Returns",
"inference",
"state",
"."
] | def get_inference_state(self):
"""Returns inference state."""
return self._communicate_bytes(_REQ_GET_INFERENCE_STATE).inference_state | [
"def",
"get_inference_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_communicate_bytes",
"(",
"_REQ_GET_INFERENCE_STATE",
")",
".",
"inference_state"
] | https://github.com/google/aiyprojects-raspbian/blob/964f07f5b4bd2ec785cfda6f318e50e1b67d4758/src/aiy/vision/inference.py#L366-L368 | |
nadineproject/nadine | c41c8ef7ffe18f1853029c97eecc329039b4af6c | nadine/utils/xero_api.py | python | some_view_which_calls_xero | (request) | [] | def some_view_which_calls_xero(request):
cred_state = caches['mycache'].get('xero_creds')
credentials = OAuth2Credentials(**cred_state)
if credentials.expired():
credentials.refresh()
caches['default'].set('xero_creds', credentials.state)
xero = Xero(credentials)
contacts = xero.contacts.a... | [
"def",
"some_view_which_calls_xero",
"(",
"request",
")",
":",
"cred_state",
"=",
"caches",
"[",
"'mycache'",
"]",
".",
"get",
"(",
"'xero_creds'",
")",
"credentials",
"=",
"OAuth2Credentials",
"(",
"*",
"*",
"cred_state",
")",
"if",
"credentials",
".",
"expir... | https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/nadine/utils/xero_api.py#L221-L229 | ||||
NVlabs/planercnn | 2698414a44eaa164f5174f7fe3c87dfc4d5dea3b | models/model.py | python | pyramid_roi_align | (inputs, pool_size, image_shape) | return pooled | Implements ROI Pooling on multiple levels of the feature pyramid.
Params:
- pool_size: [height, width] of the output pooled regions. Usually [7, 7]
- image_shape: [height, width, channels]. Shape of input image in pixels
Inputs:
- boxes: [batch, num_boxes, (y1, x1, y2, x2)] in normalized
... | Implements ROI Pooling on multiple levels of the feature pyramid. | [
"Implements",
"ROI",
"Pooling",
"on",
"multiple",
"levels",
"of",
"the",
"feature",
"pyramid",
"."
] | def pyramid_roi_align(inputs, pool_size, image_shape):
"""Implements ROI Pooling on multiple levels of the feature pyramid.
Params:
- pool_size: [height, width] of the output pooled regions. Usually [7, 7]
- image_shape: [height, width, channels]. Shape of input image in pixels
Inputs:
- boxes... | [
"def",
"pyramid_roi_align",
"(",
"inputs",
",",
"pool_size",
",",
"image_shape",
")",
":",
"## Currently only supports batchsize 1",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"inputs",
")",
")",
":",
"inputs",
"[",
"i",
"]",
"=",
"inputs",
"[",
"i",
"]",... | https://github.com/NVlabs/planercnn/blob/2698414a44eaa164f5174f7fe3c87dfc4d5dea3b/models/model.py#L364-L452 | |
sshaoshuai/PointRCNN | 1d0dee91262b970f460135252049112d80259ca0 | lib/utils/kitti_utils.py | python | enlarge_box3d | (boxes3d, extra_width) | return large_boxes3d | :param boxes3d: (N, 7) [x, y, z, h, w, l, ry] | :param boxes3d: (N, 7) [x, y, z, h, w, l, ry] | [
":",
"param",
"boxes3d",
":",
"(",
"N",
"7",
")",
"[",
"x",
"y",
"z",
"h",
"w",
"l",
"ry",
"]"
] | def enlarge_box3d(boxes3d, extra_width):
"""
:param boxes3d: (N, 7) [x, y, z, h, w, l, ry]
"""
if isinstance(boxes3d, np.ndarray):
large_boxes3d = boxes3d.copy()
else:
large_boxes3d = boxes3d.clone()
large_boxes3d[:, 3:6] += extra_width * 2
large_boxes3d[:, 1] += extra_width
... | [
"def",
"enlarge_box3d",
"(",
"boxes3d",
",",
"extra_width",
")",
":",
"if",
"isinstance",
"(",
"boxes3d",
",",
"np",
".",
"ndarray",
")",
":",
"large_boxes3d",
"=",
"boxes3d",
".",
"copy",
"(",
")",
"else",
":",
"large_boxes3d",
"=",
"boxes3d",
".",
"clo... | https://github.com/sshaoshuai/PointRCNN/blob/1d0dee91262b970f460135252049112d80259ca0/lib/utils/kitti_utils.py#L150-L160 | |
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/asyncio/events.py | python | AbstractServer.close | (self) | Stop serving. This leaves existing connections open. | Stop serving. This leaves existing connections open. | [
"Stop",
"serving",
".",
"This",
"leaves",
"existing",
"connections",
"open",
"."
] | def close(self):
"""Stop serving. This leaves existing connections open."""
raise NotImplementedError | [
"def",
"close",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/asyncio/events.py#L171-L173 | ||
certbot/certbot | 30b066f08260b73fc26256b5484a180468b9d0a6 | certbot/certbot/crypto_util.py | python | init_save_key | (key_size: int, key_dir: str, key_type: str = "rsa",
elliptic_curve: str = "secp256r1",
keyname: str = "key-certbot.pem") | return generate_key(key_size, key_dir, key_type=key_type, elliptic_curve=elliptic_curve,
keyname=keyname, strict_permissions=config.strict_permissions) | Initializes and saves a privkey.
Inits key and saves it in PEM format on the filesystem.
.. note:: keyname is the attempted filename, it may be different if a file
already exists at the path.
.. deprecated:: 1.16.0
Use :func:`generate_key` instead.
:param int key_size: key size in bit... | Initializes and saves a privkey. | [
"Initializes",
"and",
"saves",
"a",
"privkey",
"."
] | def init_save_key(key_size: int, key_dir: str, key_type: str = "rsa",
elliptic_curve: str = "secp256r1",
keyname: str = "key-certbot.pem") -> util.Key:
"""Initializes and saves a privkey.
Inits key and saves it in PEM format on the filesystem.
.. note:: keyname is the a... | [
"def",
"init_save_key",
"(",
"key_size",
":",
"int",
",",
"key_dir",
":",
"str",
",",
"key_type",
":",
"str",
"=",
"\"rsa\"",
",",
"elliptic_curve",
":",
"str",
"=",
"\"secp256r1\"",
",",
"keyname",
":",
"str",
"=",
"\"key-certbot.pem\"",
")",
"->",
"util"... | https://github.com/certbot/certbot/blob/30b066f08260b73fc26256b5484a180468b9d0a6/certbot/certbot/crypto_util.py#L104-L135 | |
RJT1990/mantra | 7db4d272a1625c33eaa681b8c2e75c0aa57c6952 | mantraml/core/management/commands/launch.py | python | LaunchCmd.configure_project | (self, project_name, top_dir) | This method configures a new project
Parameters
-----------
project_name - str
Name of the project
top_dir - str
The directory of the project
Returns
-----------
void - updates the files in the project | This method configures a new project | [
"This",
"method",
"configures",
"a",
"new",
"project"
] | def configure_project(self, project_name, top_dir):
"""
This method configures a new project
Parameters
-----------
project_name - str
Name of the project
top_dir - str
The directory of the project
Returns
-----------
... | [
"def",
"configure_project",
"(",
"self",
",",
"project_name",
",",
"top_dir",
")",
":",
"readme_text",
"=",
"\"# %s\\n\\nYour first Mantra project - huzzah!\"",
"%",
"project_name",
"self",
".",
"write_new_content",
"(",
"file_path",
"=",
"top_dir",
"+",
"'/README.md'",... | https://github.com/RJT1990/mantra/blob/7db4d272a1625c33eaa681b8c2e75c0aa57c6952/mantraml/core/management/commands/launch.py#L69-L92 | ||
mpplab/mnssp3 | fa82abdcc8cc5486927047811286b3328237cc33 | DNA/Motif Finding/Python/logo/pyseqlogo/utils.py | python | aggregate_motif_ic | (ic) | return motif_scores_agg | Return per base motif information content | Return per base motif information content | [
"Return",
"per",
"base",
"motif",
"information",
"content"
] | def aggregate_motif_ic(ic):
"""Return per base motif information content"""
motif_scores_agg = []
for position in ic:
motif_scores_agg.append(sum([x[1] for x in position]))
return motif_scores_agg | [
"def",
"aggregate_motif_ic",
"(",
"ic",
")",
":",
"motif_scores_agg",
"=",
"[",
"]",
"for",
"position",
"in",
"ic",
":",
"motif_scores_agg",
".",
"append",
"(",
"sum",
"(",
"[",
"x",
"[",
"1",
"]",
"for",
"x",
"in",
"position",
"]",
")",
")",
"return... | https://github.com/mpplab/mnssp3/blob/fa82abdcc8cc5486927047811286b3328237cc33/DNA/Motif Finding/Python/logo/pyseqlogo/utils.py#L171-L176 | |
Bashfuscator/Bashfuscator | 7487348da2d0112213f8540ae28bf12b652f924a | bashfuscator/core/engine/obfuscation_handler.py | python | ObfuscationHandler.evalWrap | (self, payload, selMutator) | return wrappedPayload | Wrap the payload in an execution stub, to allow bash to execute
the string produced by the payload. Will not wrap the payload
if certain Mutators were used to generate the most recent layer
of the payload.
:param payload: input command(s) to wrap
:type payload: str
:para... | Wrap the payload in an execution stub, to allow bash to execute
the string produced by the payload. Will not wrap the payload
if certain Mutators were used to generate the most recent layer
of the payload. | [
"Wrap",
"the",
"payload",
"in",
"an",
"execution",
"stub",
"to",
"allow",
"bash",
"to",
"execute",
"the",
"string",
"produced",
"by",
"the",
"payload",
".",
"Will",
"not",
"wrap",
"the",
"payload",
"if",
"certain",
"Mutators",
"were",
"used",
"to",
"genera... | def evalWrap(self, payload, selMutator):
"""
Wrap the payload in an execution stub, to allow bash to execute
the string produced by the payload. Will not wrap the payload
if certain Mutators were used to generate the most recent layer
of the payload.
:param payload: inpu... | [
"def",
"evalWrap",
"(",
"self",
",",
"payload",
",",
"selMutator",
")",
":",
"if",
"selMutator",
".",
"evalWrap",
":",
"evalMethodChoice",
"=",
"self",
".",
"randGen",
".",
"randChoice",
"(",
"3",
")",
"if",
"evalMethodChoice",
"==",
"1",
":",
"wrappedPayl... | https://github.com/Bashfuscator/Bashfuscator/blob/7487348da2d0112213f8540ae28bf12b652f924a/bashfuscator/core/engine/obfuscation_handler.py#L371-L409 | |
tensorflow/federated | 5a60a032360087b8f4c7fcfd97ed1c0131c3eac3 | tensorflow_federated/python/core/impl/compiler/tensorflow_computation_transformations.py | python | prune_tensorflow_proto | (proto) | return pruned_proto | Extracts subgraph from `proto` preserving parameter, result and initialize.
Args:
proto: Instance of `pb.Computation` of the `tensorflow` variety whose
`graphdef` attribute we wish to prune of extraneous ops.
Returns:
A transformed instance of `pb.Computation` of the `tensorflow` variety,
whose ... | Extracts subgraph from `proto` preserving parameter, result and initialize. | [
"Extracts",
"subgraph",
"from",
"proto",
"preserving",
"parameter",
"result",
"and",
"initialize",
"."
] | def prune_tensorflow_proto(proto):
"""Extracts subgraph from `proto` preserving parameter, result and initialize.
Args:
proto: Instance of `pb.Computation` of the `tensorflow` variety whose
`graphdef` attribute we wish to prune of extraneous ops.
Returns:
A transformed instance of `pb.Computation`... | [
"def",
"prune_tensorflow_proto",
"(",
"proto",
")",
":",
"py_typecheck",
".",
"check_type",
"(",
"proto",
",",
"pb",
".",
"Computation",
")",
"computation_oneof",
"=",
"proto",
".",
"WhichOneof",
"(",
"'computation'",
")",
"if",
"computation_oneof",
"!=",
"'tens... | https://github.com/tensorflow/federated/blob/5a60a032360087b8f4c7fcfd97ed1c0131c3eac3/tensorflow_federated/python/core/impl/compiler/tensorflow_computation_transformations.py#L30-L74 | |
aiqm/torchani | 258e6c36cf2b35a3a672137ebe30cb923db75952 | torchani/data/__init__.py | python | Transformations.species_to_indices | (reenterable_iterable, species_order=('H', 'C', 'N', 'O', 'F', 'S', 'Cl')) | [] | def species_to_indices(reenterable_iterable, species_order=('H', 'C', 'N', 'O', 'F', 'S', 'Cl')):
if species_order == 'periodic_table':
species_order = utils.PERIODIC_TABLE
idx = {k: i for i, k in enumerate(species_order)}
def reenterable_iterable_factory():
for d in ree... | [
"def",
"species_to_indices",
"(",
"reenterable_iterable",
",",
"species_order",
"=",
"(",
"'H'",
",",
"'C'",
",",
"'N'",
",",
"'O'",
",",
"'F'",
",",
"'S'",
",",
"'Cl'",
")",
")",
":",
"if",
"species_order",
"==",
"'periodic_table'",
":",
"species_order",
... | https://github.com/aiqm/torchani/blob/258e6c36cf2b35a3a672137ebe30cb923db75952/torchani/data/__init__.py#L157-L169 | ||||
xuannianz/keras-CenterNet | 39cb123a94d7774490df28e637240de03577f912 | augmentor/transform.py | python | scaling_y | (min=0.9, max=1.1, prob=0.5) | Construct a homogeneous 2D scaling matrix.
Args
factor: a 2D vector for X and Y scaling
Returns
the zoom matrix as 3 by 3 numpy array | Construct a homogeneous 2D scaling matrix. | [
"Construct",
"a",
"homogeneous",
"2D",
"scaling",
"matrix",
"."
] | def scaling_y(min=0.9, max=1.1, prob=0.5):
"""
Construct a homogeneous 2D scaling matrix.
Args
factor: a 2D vector for X and Y scaling
Returns
the zoom matrix as 3 by 3 numpy array
"""
random_prob = np.random.uniform()
if random_prob > prob:
# angle: the shear angle... | [
"def",
"scaling_y",
"(",
"min",
"=",
"0.9",
",",
"max",
"=",
"1.1",
",",
"prob",
"=",
"0.5",
")",
":",
"random_prob",
"=",
"np",
".",
"random",
".",
"uniform",
"(",
")",
"if",
"random_prob",
">",
"prob",
":",
"# angle: the shear angle in radians",
"facto... | https://github.com/xuannianz/keras-CenterNet/blob/39cb123a94d7774490df28e637240de03577f912/augmentor/transform.py#L249-L269 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/django/utils/http.py | python | urlsafe_base64_encode | (s) | return base64.urlsafe_b64encode(s).rstrip(b'\n=') | Encodes a bytestring in base64 for use in URLs, stripping any trailing
equal signs. | Encodes a bytestring in base64 for use in URLs, stripping any trailing
equal signs. | [
"Encodes",
"a",
"bytestring",
"in",
"base64",
"for",
"use",
"in",
"URLs",
"stripping",
"any",
"trailing",
"equal",
"signs",
"."
] | def urlsafe_base64_encode(s):
"""
Encodes a bytestring in base64 for use in URLs, stripping any trailing
equal signs.
"""
return base64.urlsafe_b64encode(s).rstrip(b'\n=') | [
"def",
"urlsafe_base64_encode",
"(",
"s",
")",
":",
"return",
"base64",
".",
"urlsafe_b64encode",
"(",
"s",
")",
".",
"rstrip",
"(",
"b'\\n='",
")"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/utils/http.py#L203-L208 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/tempfile.py | python | TemporaryDirectory.__init__ | (self, suffix="", prefix=template, dir=None) | [] | def __init__(self, suffix="", prefix=template, dir=None):
self.name = mkdtemp(suffix, prefix, dir)
self._finalizer = _weakref.finalize(
self, self._cleanup, self.name,
warn_message="Implicitly cleaning up {!r}".format(self)) | [
"def",
"__init__",
"(",
"self",
",",
"suffix",
"=",
"\"\"",
",",
"prefix",
"=",
"template",
",",
"dir",
"=",
"None",
")",
":",
"self",
".",
"name",
"=",
"mkdtemp",
"(",
"suffix",
",",
"prefix",
",",
"dir",
")",
"self",
".",
"_finalizer",
"=",
"_wea... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tempfile.py#L690-L694 | ||||
hasegaw/IkaLog | bd476da541fcc296f792d4db76a6b9174c4777ad | ikalog/scenes/result_detail.py | python | ResultDetail.load_akaze_model | (self) | [] | def load_akaze_model(self):
model_filename = IkaUtils.get_path(
'data', 'result_detail_features.akaze.model')
try:
self.load_model_from_file(model_filename)
if self.ref_keypoints == None:
raise
except:
IkaUtils.dprint(
... | [
"def",
"load_akaze_model",
"(",
"self",
")",
":",
"model_filename",
"=",
"IkaUtils",
".",
"get_path",
"(",
"'data'",
",",
"'result_detail_features.akaze.model'",
")",
"try",
":",
"self",
".",
"load_model_from_file",
"(",
"model_filename",
")",
"if",
"self",
".",
... | https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/scenes/result_detail.py#L149-L165 | ||||
amymcgovern/pyparrot | bf4775ec1199b282e4edde1e4a8e018dcc8725e0 | pyparrot/utils/vlc.py | python | libvlc_dialog_get_context | (p_id) | return f(p_id) | Return the opaque pointer associated with the dialog id.
@version: LibVLC 3.0.0 and later. | Return the opaque pointer associated with the dialog id. | [
"Return",
"the",
"opaque",
"pointer",
"associated",
"with",
"the",
"dialog",
"id",
"."
] | def libvlc_dialog_get_context(p_id):
'''Return the opaque pointer associated with the dialog id.
@version: LibVLC 3.0.0 and later.
'''
f = _Cfunctions.get('libvlc_dialog_get_context', None) or \
_Cfunction('libvlc_dialog_get_context', ((1,),), None,
ctypes.c_void_p, ctypes.c_... | [
"def",
"libvlc_dialog_get_context",
"(",
"p_id",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_dialog_get_context'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_dialog_get_context'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"None",... | https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/utils/vlc.py#L4769-L4776 | |
shamangary/FSA-Net | 4361d0e48103bb215d15734220c9d17e6812bb48 | lib/loupe_keras.py | python | NetRVLAD.build | (self, input_shape) | [] | def build(self, input_shape):
# Create a trainable weight variable for this layer.
self.cluster_weights = self.add_weight(name='kernel_W1',
shape=(self.feature_size, self.cluster_size),
initializer=tf.random_normal_initializer(stdde... | [
"def",
"build",
"(",
"self",
",",
"input_shape",
")",
":",
"# Create a trainable weight variable for this layer.",
"self",
".",
"cluster_weights",
"=",
"self",
".",
"add_weight",
"(",
"name",
"=",
"'kernel_W1'",
",",
"shape",
"=",
"(",
"self",
".",
"feature_size",... | https://github.com/shamangary/FSA-Net/blob/4361d0e48103bb215d15734220c9d17e6812bb48/lib/loupe_keras.py#L170-L185 | ||||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/_deprecate/graph.py | python | DGLGraph.prop_nodes | (self,
nodes_generator,
message_func="default",
reduce_func="default",
apply_node_func="default") | Propagate messages using graph traversal by triggering
:func:`pull()` on nodes.
The traversal order is specified by the ``nodes_generator``. It generates
node frontiers, which is a list or a tensor of nodes. The nodes in the
same frontier will be triggered together, while nodes in diffe... | Propagate messages using graph traversal by triggering
:func:`pull()` on nodes. | [
"Propagate",
"messages",
"using",
"graph",
"traversal",
"by",
"triggering",
":",
"func",
":",
"pull",
"()",
"on",
"nodes",
"."
] | def prop_nodes(self,
nodes_generator,
message_func="default",
reduce_func="default",
apply_node_func="default"):
"""Propagate messages using graph traversal by triggering
:func:`pull()` on nodes.
The traversal order is ... | [
"def",
"prop_nodes",
"(",
"self",
",",
"nodes_generator",
",",
"message_func",
"=",
"\"default\"",
",",
"reduce_func",
"=",
"\"default\"",
",",
"apply_node_func",
"=",
"\"default\"",
")",
":",
"for",
"node_frontier",
"in",
"nodes_generator",
":",
"self",
".",
"p... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/_deprecate/graph.py#L3286-L3360 | ||
DeepLabCut/DeepLabCut | 1dd14c54729ae0d8e66ca495aa5baeb83502e1c7 | deeplabcut/gui/labeling_toolbox.py | python | MainFrame.saveDataSet | (self, event) | Saves the final dataframe | Saves the final dataframe | [
"Saves",
"the",
"final",
"dataframe"
] | def saveDataSet(self, event):
"""
Saves the final dataframe
"""
self.statusbar.SetStatusText("File saved")
MainFrame.saveEachImage(self)
MainFrame.updateZoomPan(self)
# Windows compatible
self.dataFrame.sort_index(inplace=True)
self.dataFrame = se... | [
"def",
"saveDataSet",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"statusbar",
".",
"SetStatusText",
"(",
"\"File saved\"",
")",
"MainFrame",
".",
"saveEachImage",
"(",
"self",
")",
"MainFrame",
".",
"updateZoomPan",
"(",
"self",
")",
"# Windows compatib... | https://github.com/DeepLabCut/DeepLabCut/blob/1dd14c54729ae0d8e66ca495aa5baeb83502e1c7/deeplabcut/gui/labeling_toolbox.py#L927-L948 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/modeling/powerlaws.py | python | BrokenPowerLaw1D.fit_deriv | (x, amplitude, x_break, alpha_1, alpha_2) | return [d_amplitude, d_x_break, d_alpha_1, d_alpha_2] | One dimensional broken power law derivative with respect to parameters | One dimensional broken power law derivative with respect to parameters | [
"One",
"dimensional",
"broken",
"power",
"law",
"derivative",
"with",
"respect",
"to",
"parameters"
] | def fit_deriv(x, amplitude, x_break, alpha_1, alpha_2):
"""One dimensional broken power law derivative with respect to parameters"""
alpha = np.where(x < x_break, alpha_1, alpha_2)
xx = x / x_break
d_amplitude = xx ** (-alpha)
d_x_break = amplitude * alpha * d_amplitude / x_bre... | [
"def",
"fit_deriv",
"(",
"x",
",",
"amplitude",
",",
"x_break",
",",
"alpha_1",
",",
"alpha_2",
")",
":",
"alpha",
"=",
"np",
".",
"where",
"(",
"x",
"<",
"x_break",
",",
"alpha_1",
",",
"alpha_2",
")",
"xx",
"=",
"x",
"/",
"x_break",
"d_amplitude",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/modeling/powerlaws.py#L122-L134 | |
emmetio/livestyle-sublime-old | c42833c046e9b2f53ebce3df3aa926528f5a33b5 | tornado/websocket.py | python | WebSocketClientConnection.on_message | (self, message) | [] | def on_message(self, message):
if self.read_future is not None:
self.read_future.set_result(message)
self.read_future = None
else:
self.read_queue.append(message) | [
"def",
"on_message",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"read_future",
"is",
"not",
"None",
":",
"self",
".",
"read_future",
".",
"set_result",
"(",
"message",
")",
"self",
".",
"read_future",
"=",
"None",
"else",
":",
"self",
".... | https://github.com/emmetio/livestyle-sublime-old/blob/c42833c046e9b2f53ebce3df3aa926528f5a33b5/tornado/websocket.py#L837-L842 | ||||
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/gntp/notifier.py | python | GrowlNotifier._checkIcon | (self, data) | return gntp.shim.u(data).startswith('http') | Check the icon to see if it's valid
If it's a simple URL icon, then we return True. If it's a data icon
then we return False | Check the icon to see if it's valid | [
"Check",
"the",
"icon",
"to",
"see",
"if",
"it",
"s",
"valid"
] | def _checkIcon(self, data):
'''
Check the icon to see if it's valid
If it's a simple URL icon, then we return True. If it's a data icon
then we return False
'''
logger.info('Checking icon')
return gntp.shim.u(data).startswith('http') | [
"def",
"_checkIcon",
"(",
"self",
",",
"data",
")",
":",
"logger",
".",
"info",
"(",
"'Checking icon'",
")",
"return",
"gntp",
".",
"shim",
".",
"u",
"(",
"data",
")",
".",
"startswith",
"(",
"'http'",
")"
] | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/gntp/notifier.py#L64-L72 | |
benadida/helios-server | 19555c3e5e86b4301264ccb26587c51aec8cbbd2 | helios/crypto/elgamal.py | python | PublicKey.verify_sk_proof | (self, dlog_proof, challenge_generator = None) | return ((left_side == right_side) and (dlog_proof.challenge == expected_challenge)) | verify the proof of knowledge of the secret key
g^response = commitment * y^challenge | verify the proof of knowledge of the secret key
g^response = commitment * y^challenge | [
"verify",
"the",
"proof",
"of",
"knowledge",
"of",
"the",
"secret",
"key",
"g^response",
"=",
"commitment",
"*",
"y^challenge"
] | def verify_sk_proof(self, dlog_proof, challenge_generator = None):
"""
verify the proof of knowledge of the secret key
g^response = commitment * y^challenge
"""
left_side = pow(self.g, dlog_proof.response, self.p)
right_side = (dlog_proof.commitment * pow(self.y, dlog_proof.challenge... | [
"def",
"verify_sk_proof",
"(",
"self",
",",
"dlog_proof",
",",
"challenge_generator",
"=",
"None",
")",
":",
"left_side",
"=",
"pow",
"(",
"self",
".",
"g",
",",
"dlog_proof",
".",
"response",
",",
"self",
".",
"p",
")",
"right_side",
"=",
"(",
"dlog_pro... | https://github.com/benadida/helios-server/blob/19555c3e5e86b4301264ccb26587c51aec8cbbd2/helios/crypto/elgamal.py#L112-L122 | |
cloudant/bigcouch | 8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe | couchjs/scons/scons-local-2.0.1/SCons/Tool/mslink.py | python | _dllEmitter | (target, source, env, paramtp) | return (target+extratargets, source+extrasources) | Common implementation of dll emitter. | Common implementation of dll emitter. | [
"Common",
"implementation",
"of",
"dll",
"emitter",
"."
] | def _dllEmitter(target, source, env, paramtp):
"""Common implementation of dll emitter."""
SCons.Tool.msvc.validate_vars(env)
extratargets = []
extrasources = []
dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp)
no_import_lib = env.get('no_import_lib', 0)
if not dll:
... | [
"def",
"_dllEmitter",
"(",
"target",
",",
"source",
",",
"env",
",",
"paramtp",
")",
":",
"SCons",
".",
"Tool",
".",
"msvc",
".",
"validate_vars",
"(",
"env",
")",
"extratargets",
"=",
"[",
"]",
"extrasources",
"=",
"[",
"]",
"dll",
"=",
"env",
".",
... | https://github.com/cloudant/bigcouch/blob/8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe/couchjs/scons/scons-local-2.0.1/SCons/Tool/mslink.py#L95-L144 | |
renerocksai/sublimeless_zk | 6738375c0e371f0c2fde0aa9e539242cfd2b4777 | patches/PyInstaller/depend/bindepend.py | python | getAssemblies | (pth) | return rv | On Windows return the dependent Side-by-Side (SxS) assemblies of a binary as a
list of Manifest objects.
Dependent assemblies are required only by binaries compiled with MSVC 9.0.
Python 2.7 and 3.2 is compiled with MSVC 9.0 and thus depends on Microsoft
Redistributable runtime libraries 9.0.
Pyth... | On Windows return the dependent Side-by-Side (SxS) assemblies of a binary as a
list of Manifest objects. | [
"On",
"Windows",
"return",
"the",
"dependent",
"Side",
"-",
"by",
"-",
"Side",
"(",
"SxS",
")",
"assemblies",
"of",
"a",
"binary",
"as",
"a",
"list",
"of",
"Manifest",
"objects",
"."
] | def getAssemblies(pth):
"""
On Windows return the dependent Side-by-Side (SxS) assemblies of a binary as a
list of Manifest objects.
Dependent assemblies are required only by binaries compiled with MSVC 9.0.
Python 2.7 and 3.2 is compiled with MSVC 9.0 and thus depends on Microsoft
Redistributa... | [
"def",
"getAssemblies",
"(",
"pth",
")",
":",
"if",
"pth",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"\".manifest\"",
")",
":",
"return",
"[",
"]",
"# check for manifest file",
"manifestnm",
"=",
"pth",
"+",
"\".manifest\"",
"if",
"os",
".",
"path",
... | https://github.com/renerocksai/sublimeless_zk/blob/6738375c0e371f0c2fde0aa9e539242cfd2b4777/patches/PyInstaller/depend/bindepend.py#L329-L379 | |
mapproxy/mapproxy | 45ae81b3dd6c8a1a0b473ba8c669afd0ec7ecd10 | mapproxy/multiapp.py | python | make_wsgi_app | (config_dir, allow_listing=True, debug=False) | return MultiMapProxy(loader, list_apps=allow_listing, debug=debug) | Create a MultiMapProxy with the given config directory.
:param config_dir: the directory with all project configurations.
:param allow_listing: True if MapProxy should list all instances
at the root URL | Create a MultiMapProxy with the given config directory. | [
"Create",
"a",
"MultiMapProxy",
"with",
"the",
"given",
"config",
"directory",
"."
] | def make_wsgi_app(config_dir, allow_listing=True, debug=False):
"""
Create a MultiMapProxy with the given config directory.
:param config_dir: the directory with all project configurations.
:param allow_listing: True if MapProxy should list all instances
at the root URL
"""
config_dir =... | [
"def",
"make_wsgi_app",
"(",
"config_dir",
",",
"allow_listing",
"=",
"True",
",",
"debug",
"=",
"False",
")",
":",
"config_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"config_dir",
")",
"loader",
"=",
"DirectoryConfLoader",
"(",
"config_dir",
")",
... | https://github.com/mapproxy/mapproxy/blob/45ae81b3dd6c8a1a0b473ba8c669afd0ec7ecd10/mapproxy/multiapp.py#L49-L59 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/objc/_properties.py | python | object_property.__set__ | (self, object, value) | return self.__setprop(object, value) | [] | def __set__(self, object, value):
if self.__setprop is None:
raise ValueError("setting read-only property " + self._name)
return self.__setprop(object, value) | [
"def",
"__set__",
"(",
"self",
",",
"object",
",",
"value",
")",
":",
"if",
"self",
".",
"__setprop",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"setting read-only property \"",
"+",
"self",
".",
"_name",
")",
"return",
"self",
".",
"__setprop",
"(",... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/objc/_properties.py#L237-L241 | |||
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models_pytorch/mrc_pytorch/pytorch_modeling.py | python | ALBertEncoder.__init__ | (self, config) | [] | def __init__(self, config):
super(ALBertEncoder, self).__init__()
self.num_hidden_layers = config.num_hidden_layers
self.layer_shared = BertLayer(config) | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"super",
"(",
"ALBertEncoder",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"num_hidden_layers",
"=",
"config",
".",
"num_hidden_layers",
"self",
".",
"layer_shared",
"=",
"BertLayer",
"... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models_pytorch/mrc_pytorch/pytorch_modeling.py#L502-L505 | ||||
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/beanstalk/layer1.py | python | Layer1.create_storage_location | (self) | return self._get_response('CreateStorageLocation', params={}) | Creates the Amazon S3 storage location for the account. This
location is used to store user log files.
:raises: TooManyBucketsException,
S3SubscriptionRequiredException,
InsufficientPrivilegesException | Creates the Amazon S3 storage location for the account. This
location is used to store user log files. | [
"Creates",
"the",
"Amazon",
"S3",
"storage",
"location",
"for",
"the",
"account",
".",
"This",
"location",
"is",
"used",
"to",
"store",
"user",
"log",
"files",
"."
] | def create_storage_location(self):
"""
Creates the Amazon S3 storage location for the account. This
location is used to store user log files.
:raises: TooManyBucketsException,
S3SubscriptionRequiredException,
InsufficientPrivilegesException
""... | [
"def",
"create_storage_location",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_response",
"(",
"'CreateStorageLocation'",
",",
"params",
"=",
"{",
"}",
")"
] | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/beanstalk/layer1.py#L359-L369 | |
taomujian/linbing | fe772a58f41e3b046b51a866bdb7e4655abaf51a | python/app/thirdparty/dirsearch/thirdparty/jinja2/lexer.py | python | TokenStream.next_if | (self, expr: str) | return None | Perform the token test and return the token if it matched.
Otherwise the return value is `None`. | Perform the token test and return the token if it matched.
Otherwise the return value is `None`. | [
"Perform",
"the",
"token",
"test",
"and",
"return",
"the",
"token",
"if",
"it",
"matched",
".",
"Otherwise",
"the",
"return",
"value",
"is",
"None",
"."
] | def next_if(self, expr: str) -> t.Optional[Token]:
"""Perform the token test and return the token if it matched.
Otherwise the return value is `None`.
"""
if self.current.test(expr):
return next(self)
return None | [
"def",
"next_if",
"(",
"self",
",",
"expr",
":",
"str",
")",
"->",
"t",
".",
"Optional",
"[",
"Token",
"]",
":",
"if",
"self",
".",
"current",
".",
"test",
"(",
"expr",
")",
":",
"return",
"next",
"(",
"self",
")",
"return",
"None"
] | https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/jinja2/lexer.py#L365-L372 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/gdata/apps/emailsettings/data.py | python | EmailSettingsFilter.GetHasTheWord | (self) | return self._GetProperty(FILTER_HAS_THE_WORD_NAME) | Get the HasTheWord value of the Filter object.
Returns:
The HasTheWord value of this Filter object as a string or None. | Get the HasTheWord value of the Filter object. | [
"Get",
"the",
"HasTheWord",
"value",
"of",
"the",
"Filter",
"object",
"."
] | def GetHasTheWord(self):
"""Get the HasTheWord value of the Filter object.
Returns:
The HasTheWord value of this Filter object as a string or None.
"""
return self._GetProperty(FILTER_HAS_THE_WORD_NAME) | [
"def",
"GetHasTheWord",
"(",
"self",
")",
":",
"return",
"self",
".",
"_GetProperty",
"(",
"FILTER_HAS_THE_WORD_NAME",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gdata/apps/emailsettings/data.py#L273-L280 | |
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mimic/scripts/extern/pyqtgraph_0_11_0_dev0/pyqtgraph/colormap.py | python | ColorMap.mapToFloat | (self, data) | return self.map(data, mode=self.FLOAT) | Convenience function; see :func:`map() <pyqtgraph.ColorMap.map>`. | Convenience function; see :func:`map() <pyqtgraph.ColorMap.map>`. | [
"Convenience",
"function",
";",
"see",
":",
"func",
":",
"map",
"()",
"<pyqtgraph",
".",
"ColorMap",
".",
"map",
">",
"."
] | def mapToFloat(self, data):
"""Convenience function; see :func:`map() <pyqtgraph.ColorMap.map>`."""
return self.map(data, mode=self.FLOAT) | [
"def",
"mapToFloat",
"(",
"self",
",",
"data",
")",
":",
"return",
"self",
".",
"map",
"(",
"data",
",",
"mode",
"=",
"self",
".",
"FLOAT",
")"
] | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0_dev0/pyqtgraph/colormap.py#L130-L132 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/libmp/libmpf.py | python | python_mpf_mul | (s, t, prec=0, rnd=round_fast) | return {1:finf, -1:fninf}[mpf_sign(s) * mpf_sign(t)] | Multiply two raw mpfs | Multiply two raw mpfs | [
"Multiply",
"two",
"raw",
"mpfs"
] | def python_mpf_mul(s, t, prec=0, rnd=round_fast):
"""Multiply two raw mpfs"""
ssign, sman, sexp, sbc = s
tsign, tman, texp, tbc = t
sign = ssign ^ tsign
man = sman*tman
if man:
bc = sbc + tbc - 1
bc += int(man>>bc)
if prec:
return normalize1(sign, man, sexp+te... | [
"def",
"python_mpf_mul",
"(",
"s",
",",
"t",
",",
"prec",
"=",
"0",
",",
"rnd",
"=",
"round_fast",
")",
":",
"ssign",
",",
"sman",
",",
"sexp",
",",
"sbc",
"=",
"s",
"tsign",
",",
"tman",
",",
"texp",
",",
"tbc",
"=",
"t",
"sign",
"=",
"ssign",... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/libmp/libmpf.py#L858-L878 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/tty.py | python | setraw | (fd, when=TCSAFLUSH) | Put terminal into a raw mode. | Put terminal into a raw mode. | [
"Put",
"terminal",
"into",
"a",
"raw",
"mode",
"."
] | def setraw(fd, when=TCSAFLUSH):
"""Put terminal into a raw mode."""
mode = tcgetattr(fd)
mode[IFLAG] = mode[IFLAG] & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
mode[OFLAG] = mode[OFLAG] & ~(OPOST)
mode[CFLAG] = mode[CFLAG] & ~(CSIZE | PARENB)
mode[CFLAG] = mode[CFLAG] | CS8
mode[LFLAG] = mode... | [
"def",
"setraw",
"(",
"fd",
",",
"when",
"=",
"TCSAFLUSH",
")",
":",
"mode",
"=",
"tcgetattr",
"(",
"fd",
")",
"mode",
"[",
"IFLAG",
"]",
"=",
"mode",
"[",
"IFLAG",
"]",
"&",
"~",
"(",
"BRKINT",
"|",
"ICRNL",
"|",
"INPCK",
"|",
"ISTRIP",
"|",
"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tty.py#L18-L28 | ||
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pip/_vendor/requests/packages/chardet/chardistribution.py | python | CharDistributionAnalysis.get_confidence | (self) | return SURE_YES | return confidence based on existing data | return confidence based on existing data | [
"return",
"confidence",
"based",
"on",
"existing",
"data"
] | def get_confidence(self):
"""return confidence based on existing data"""
# if we didn't receive any character in our consideration range,
# return negative answer
if self._mTotalChars <= 0 or self._mFreqChars <= MINIMUM_DATA_THRESHOLD:
return SURE_NO
if self._mTotalC... | [
"def",
"get_confidence",
"(",
"self",
")",
":",
"# if we didn't receive any character in our consideration range,",
"# return negative answer",
"if",
"self",
".",
"_mTotalChars",
"<=",
"0",
"or",
"self",
".",
"_mFreqChars",
"<=",
"MINIMUM_DATA_THRESHOLD",
":",
"return",
"... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/requests/packages/chardet/chardistribution.py#L82-L96 | |
sanic-org/sanic | 8b0eaa097cf4ef13a6b52dce24ae93fb20f73947 | sanic/headers.py | python | parse_forwarded | (headers, config) | return fwd_normalize(reversed(options)) if found else None | Parse RFC 7239 Forwarded headers.
The value of `by` or `secret` must match `config.FORWARDED_SECRET`
:return: dict with keys and values, or None if nothing matched | Parse RFC 7239 Forwarded headers.
The value of `by` or `secret` must match `config.FORWARDED_SECRET`
:return: dict with keys and values, or None if nothing matched | [
"Parse",
"RFC",
"7239",
"Forwarded",
"headers",
".",
"The",
"value",
"of",
"by",
"or",
"secret",
"must",
"match",
"config",
".",
"FORWARDED_SECRET",
":",
"return",
":",
"dict",
"with",
"keys",
"and",
"values",
"or",
"None",
"if",
"nothing",
"matched"
] | def parse_forwarded(headers, config) -> Optional[Options]:
"""Parse RFC 7239 Forwarded headers.
The value of `by` or `secret` must match `config.FORWARDED_SECRET`
:return: dict with keys and values, or None if nothing matched
"""
header = headers.getall("forwarded", None)
secret = config.FORWARD... | [
"def",
"parse_forwarded",
"(",
"headers",
",",
"config",
")",
"->",
"Optional",
"[",
"Options",
"]",
":",
"header",
"=",
"headers",
".",
"getall",
"(",
"\"forwarded\"",
",",
"None",
")",
"secret",
"=",
"config",
".",
"FORWARDED_SECRET",
"if",
"header",
"is... | https://github.com/sanic-org/sanic/blob/8b0eaa097cf4ef13a6b52dce24ae93fb20f73947/sanic/headers.py#L235-L270 | |
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/object_detection/models/ssd_spaghettinet_feature_extractor.py | python | SpaghettiNet._quantizable_concat | (self,
inputs,
axis,
is_training,
is_quantized=True,
default_min=0,
default_max=6,
ema_decay=0.999,
scope='quant... | return outputs | Concat replacement with quantization option.
Allows concat inputs to share the same min max ranges,
from experimental/gazelle/synthetic/model/tpu/utils.py.
Args:
inputs: list of tensors to concatenate.
axis: dimension along which to concatenate.
is_training: true if the graph is a traini... | Concat replacement with quantization option. | [
"Concat",
"replacement",
"with",
"quantization",
"option",
"."
] | def _quantizable_concat(self,
inputs,
axis,
is_training,
is_quantized=True,
default_min=0,
default_max=6,
ema_decay=0.999,
... | [
"def",
"_quantizable_concat",
"(",
"self",
",",
"inputs",
",",
"axis",
",",
"is_training",
",",
"is_quantized",
"=",
"True",
",",
"default_min",
"=",
"0",
",",
"default_max",
"=",
"6",
",",
"ema_decay",
"=",
"0.999",
",",
"scope",
"=",
"'quantized_concat'",
... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/models/ssd_spaghettinet_feature_extractor.py#L67-L126 | |
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/aui/framemanager.py | python | AuiManager.OnClose | (self, ev) | Called when the managed window is closed. Makes sure that :meth:`UnInit`
is called. | Called when the managed window is closed. Makes sure that :meth:`UnInit`
is called. | [
"Called",
"when",
"the",
"managed",
"window",
"is",
"closed",
".",
"Makes",
"sure",
"that",
":",
"meth",
":",
"UnInit",
"is",
"called",
"."
] | def OnClose(self, ev):
"""Called when the managed window is closed. Makes sure that :meth:`UnInit`
is called.
"""
ev.Skip()
if ev.GetEventObject() == self._frame:
wx.CallAfter(self.UnInit) | [
"def",
"OnClose",
"(",
"self",
",",
"ev",
")",
":",
"ev",
".",
"Skip",
"(",
")",
"if",
"ev",
".",
"GetEventObject",
"(",
")",
"==",
"self",
".",
"_frame",
":",
"wx",
".",
"CallAfter",
"(",
"self",
".",
"UnInit",
")"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/aui/framemanager.py#L4602-L4609 | ||
KvasirSecurity/Kvasir | a5b3775184a8343240e1154a1f762f75df04dc0a | modules/skaldship/nessus/vulns.py | python | NessusVulns.parse | (self, rpt_item) | return vuln_id, vulndata, extradata | PluginID data is built as the report is processed however we want to
also be certain to not duplicate existing t_vulndata so a lookup is
performed with both the pluginID and fname. If none found the record is
entered into the database and populates the local dict
:param rpt_item: A Repo... | PluginID data is built as the report is processed however we want to
also be certain to not duplicate existing t_vulndata so a lookup is
performed with both the pluginID and fname. If none found the record is
entered into the database and populates the local dict | [
"PluginID",
"data",
"is",
"built",
"as",
"the",
"report",
"is",
"processed",
"however",
"we",
"want",
"to",
"also",
"be",
"certain",
"to",
"not",
"duplicate",
"existing",
"t_vulndata",
"so",
"a",
"lookup",
"is",
"performed",
"with",
"both",
"the",
"pluginID"... | def parse(self, rpt_item):
"""
PluginID data is built as the report is processed however we want to
also be certain to not duplicate existing t_vulndata so a lookup is
performed with both the pluginID and fname. If none found the record is
entered into the database and populates ... | [
"def",
"parse",
"(",
"self",
",",
"rpt_item",
")",
":",
"# TODO: Check validity of XML or CSV",
"# if not etree.iselement(rpt_item):",
"# log(\"Invalid plugin data received: %s\" % type(rpt_item), logging.ERROR)",
"# return (None, {}, {})",
"# extract specific parts of ReportItem",
"... | https://github.com/KvasirSecurity/Kvasir/blob/a5b3775184a8343240e1154a1f762f75df04dc0a/modules/skaldship/nessus/vulns.py#L105-L296 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/template/loader_tags.py | python | do_block | (parser, token) | return BlockNode(block_name, nodelist) | Define a block that can be overridden by child templates. | Define a block that can be overridden by child templates. | [
"Define",
"a",
"block",
"that",
"can",
"be",
"overridden",
"by",
"child",
"templates",
"."
] | def do_block(parser, token):
"""
Define a block that can be overridden by child templates.
"""
bits = token.contents.split()
if len(bits) != 2:
raise TemplateSyntaxError("'%s' tag takes only one argument" % bits[0])
block_name = bits[1]
# Keep track of the names of BlockNodes found i... | [
"def",
"do_block",
"(",
"parser",
",",
"token",
")",
":",
"bits",
"=",
"token",
".",
"contents",
".",
"split",
"(",
")",
"if",
"len",
"(",
"bits",
")",
"!=",
"2",
":",
"raise",
"TemplateSyntaxError",
"(",
"\"'%s' tag takes only one argument\"",
"%",
"bits"... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/template/loader_tags.py#L173-L197 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/parser/rdp/connection.py | python | ServerConnectionParser.parseStructure | (self, stream: BytesIO) | return self.parsers[header](substream) | [] | def parseStructure(self, stream: BytesIO) -> typing.Union[ServerCoreData, ServerSecurityData, ServerNetworkData]:
header = Uint16LE.unpack(stream)
length = Uint16LE.unpack(stream) - 4
data = stream.read(length)
if len(data) < length:
raise ParsingError("Server Data length fi... | [
"def",
"parseStructure",
"(",
"self",
",",
"stream",
":",
"BytesIO",
")",
"->",
"typing",
".",
"Union",
"[",
"ServerCoreData",
",",
"ServerSecurityData",
",",
"ServerNetworkData",
"]",
":",
"header",
"=",
"Uint16LE",
".",
"unpack",
"(",
"stream",
")",
"lengt... | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/parser/rdp/connection.py#L296-L309 | |||
wemake-services/wemake-python-styleguide | 11767452c7d9766dbf9aa49c75b231db9aaef937 | wemake_python_styleguide/logic/complexity/annotations.py | python | get_annotation_complexity | (annotation_node: _Annotation) | return 1 | Recursively counts complexity of annotation nodes.
When annotations are written as strings,
we additionally parse them to ``ast`` nodes. | Recursively counts complexity of annotation nodes. | [
"Recursively",
"counts",
"complexity",
"of",
"annotation",
"nodes",
"."
] | def get_annotation_complexity(annotation_node: _Annotation) -> int:
"""
Recursively counts complexity of annotation nodes.
When annotations are written as strings,
we additionally parse them to ``ast`` nodes.
"""
if isinstance(annotation_node, ast.Str):
# try to parse string-wrapped ann... | [
"def",
"get_annotation_complexity",
"(",
"annotation_node",
":",
"_Annotation",
")",
"->",
"int",
":",
"if",
"isinstance",
"(",
"annotation_node",
",",
"ast",
".",
"Str",
")",
":",
"# try to parse string-wrapped annotations",
"try",
":",
"annotation_node",
"=",
"ast... | https://github.com/wemake-services/wemake-python-styleguide/blob/11767452c7d9766dbf9aa49c75b231db9aaef937/wemake_python_styleguide/logic/complexity/annotations.py#L21-L44 | |
apachecn/AiLearning | 228b62a905a2a9bf6066f65c16d53056b10ec610 | src/py3.x/dl/rnn.py | python | RecurrentLayer.update | (self) | 按照梯度下降,更新权重 | 按照梯度下降,更新权重 | [
"按照梯度下降,更新权重"
] | def update(self):
'''
按照梯度下降,更新权重
'''
self.W -= self.learning_rate * self.gradient | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"W",
"-=",
"self",
".",
"learning_rate",
"*",
"self",
".",
"gradient"
] | https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py3.x/dl/rnn.py#L45-L49 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/secureprotol/encrypt.py | python | PadsCipher.encrypt | (self, value) | return ret | [] | def encrypt(self, value):
if isinstance(value, np.ndarray):
ret = value
for uid, rand in self._rands.items():
if uid > self._uuid:
ret = rand.add_rand_pads(ret, 1.0 * self._amplify_factor)
else:
ret = rand.add_rand_p... | [
"def",
"encrypt",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"np",
".",
"ndarray",
")",
":",
"ret",
"=",
"value",
"for",
"uid",
",",
"rand",
"in",
"self",
".",
"_rands",
".",
"items",
"(",
")",
":",
"if",
"uid",
... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/secureprotol/encrypt.py#L288-L313 | |||
pjlantz/droidbox | 519ddd198ccef2e0d27e12929f25702f6a385d94 | APIMonitor/androguard/core/bytecodes/dvm.py | python | LinearSweepAlgorithm.get_instructions | (self, cm, size, insn, idx) | :param cm: a ClassManager object
:type cm: :class:`ClassManager` object
:param size: the total size of the buffer
:type size: int
:param insn: a raw buffer where are the instructions
:type insn: string
:param idx: a start address in the buffer
... | :param cm: a ClassManager object
:type cm: :class:`ClassManager` object
:param size: the total size of the buffer
:type size: int
:param insn: a raw buffer where are the instructions
:type insn: string
:param idx: a start address in the buffer
... | [
":",
"param",
"cm",
":",
"a",
"ClassManager",
"object",
":",
"type",
"cm",
":",
":",
"class",
":",
"ClassManager",
"object",
":",
"param",
"size",
":",
"the",
"total",
"size",
"of",
"the",
"buffer",
":",
"type",
"size",
":",
"int",
":",
"param",
"ins... | def get_instructions(self, cm, size, insn, idx) :
"""
:param cm: a ClassManager object
:type cm: :class:`ClassManager` object
:param size: the total size of the buffer
:type size: int
:param insn: a raw buffer where are the instructions
:ty... | [
"def",
"get_instructions",
"(",
"self",
",",
"cm",
",",
"size",
",",
"insn",
",",
"idx",
")",
":",
"self",
".",
"odex",
"=",
"cm",
".",
"get_odex_format",
"(",
")",
"max_idx",
"=",
"size",
"*",
"calcsize",
"(",
"'=H'",
")",
"# Get instructions",
"while... | https://github.com/pjlantz/droidbox/blob/519ddd198ccef2e0d27e12929f25702f6a385d94/APIMonitor/androguard/core/bytecodes/dvm.py#L5686-L5736 | ||
rail-berkeley/softlearning | 13cf187cc93d90f7c217ea2845067491c3c65464 | softlearning/algorithms/rl_algorithm.py | python | RLAlgorithm._timestep_before_hook | (self, *args, **kwargs) | Hook called at the beginning of each timestep. | Hook called at the beginning of each timestep. | [
"Hook",
"called",
"at",
"the",
"beginning",
"of",
"each",
"timestep",
"."
] | def _timestep_before_hook(self, *args, **kwargs):
"""Hook called at the beginning of each timestep."""
pass | [
"def",
"_timestep_before_hook",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | https://github.com/rail-berkeley/softlearning/blob/13cf187cc93d90f7c217ea2845067491c3c65464/softlearning/algorithms/rl_algorithm.py#L111-L113 | ||
Allen7D/mini-shop-server | 5f3ddd5a4e5e99a1e005f11abc620cefff2493fc | app/core/swagger_filed.py | python | WholeArg.args_module | (self) | return global_args_module if self.is_global else self.api_doc | :return: args_module: 参数的模块(global_args or self.api_doc) | :return: args_module: 参数的模块(global_args or self.api_doc) | [
":",
"return",
":",
"args_module",
":",
"参数的模块",
"(",
"global_args",
"or",
"self",
".",
"api_doc",
")"
] | def args_module(self):
'''
:return: args_module: 参数的模块(global_args or self.api_doc)
'''
from app.extensions.api_docs import global_args as global_args_module
return global_args_module if self.is_global else self.api_doc | [
"def",
"args_module",
"(",
"self",
")",
":",
"from",
"app",
".",
"extensions",
".",
"api_docs",
"import",
"global_args",
"as",
"global_args_module",
"return",
"global_args_module",
"if",
"self",
".",
"is_global",
"else",
"self",
".",
"api_doc"
] | https://github.com/Allen7D/mini-shop-server/blob/5f3ddd5a4e5e99a1e005f11abc620cefff2493fc/app/core/swagger_filed.py#L317-L322 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/whoosh/src/whoosh/filedb/fieldcache.py | python | FieldCache.to_file | (self, dbfile) | Saves an in-memory field cache to a file.
>>> fc = FieldCache.from_field(r, "tag")
>>> fc.to_file(f) | Saves an in-memory field cache to a file.
>>> fc = FieldCache.from_field(r, "tag")
>>> fc.to_file(f) | [
"Saves",
"an",
"in",
"-",
"memory",
"field",
"cache",
"to",
"a",
"file",
".",
">>>",
"fc",
"=",
"FieldCache",
".",
"from_field",
"(",
"r",
"tag",
")",
">>>",
"fc",
".",
"to_file",
"(",
"f",
")"
] | def to_file(self, dbfile):
"""Saves an in-memory field cache to a file.
>>> fc = FieldCache.from_field(r, "tag")
>>> fc.to_file(f)
"""
# Write a tag at the start of the file indicating the file write is in
# progress, to warn other processes that might open the ... | [
"def",
"to_file",
"(",
"self",
",",
"dbfile",
")",
":",
"# Write a tag at the start of the file indicating the file write is in",
"# progress, to warn other processes that might open the file. We'll",
"# seek back and change this when the file is done.",
"dbfile",
".",
"write",
"(",
"b... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/whoosh/src/whoosh/filedb/fieldcache.py#L239-L274 | ||
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/algorithms/statistics/models/regression.py | python | OLSModel.rank | (self) | return matrix_rank(self.wdesign) | Compute rank of design matrix | Compute rank of design matrix | [
"Compute",
"rank",
"of",
"design",
"matrix"
] | def rank(self):
""" Compute rank of design matrix
"""
return matrix_rank(self.wdesign) | [
"def",
"rank",
"(",
"self",
")",
":",
"return",
"matrix_rank",
"(",
"self",
".",
"wdesign",
")"
] | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/algorithms/statistics/models/regression.py#L278-L281 | |
awslabs/aws-ec2rescue-linux | 8ecf40e7ea0d2563dac057235803fca2221029d2 | lib/boto3/resources/action.py | python | BatchAction.__call__ | (self, parent, *args, **kwargs) | return responses | Perform the batch action's operation on every page of results
from the collection.
:type parent:
:py:class:`~boto3.resources.collection.ResourceCollection`
:param parent: The collection iterator to which this action
is attached.
:rtype: list(dict)
... | Perform the batch action's operation on every page of results
from the collection. | [
"Perform",
"the",
"batch",
"action",
"s",
"operation",
"on",
"every",
"page",
"of",
"results",
"from",
"the",
"collection",
"."
] | def __call__(self, parent, *args, **kwargs):
"""
Perform the batch action's operation on every page of results
from the collection.
:type parent:
:py:class:`~boto3.resources.collection.ResourceCollection`
:param parent: The collection iterator to which this action
... | [
"def",
"__call__",
"(",
"self",
",",
"parent",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"service_name",
"=",
"None",
"client",
"=",
"None",
"responses",
"=",
"[",
"]",
"operation_name",
"=",
"xform_name",
"(",
"self",
".",
"_action_model",
... | https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/boto3/resources/action.py#L108-L159 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/events.py | python | ConnectionEvents.set_connection_execution_options | (self, conn, opts) | Intercept when the :meth:`_engine.Connection.execution_options`
method is called.
This method is called after the new :class:`_engine.Connection`
has been
produced, with the newly updated execution options collection, but
before the :class:`.Dialect` has acted upon any of those ... | Intercept when the :meth:`_engine.Connection.execution_options`
method is called. | [
"Intercept",
"when",
"the",
":",
"meth",
":",
"_engine",
".",
"Connection",
".",
"execution_options",
"method",
"is",
"called",
"."
] | def set_connection_execution_options(self, conn, opts):
"""Intercept when the :meth:`_engine.Connection.execution_options`
method is called.
This method is called after the new :class:`_engine.Connection`
has been
produced, with the newly updated execution options collection, bu... | [
"def",
"set_connection_execution_options",
"(",
"self",
",",
"conn",
",",
"opts",
")",
":"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/events.py#L1015-L1045 | ||
vulscanteam/vulscan | 787397e267c4e6469522ee0abe55b3e98f968d4a | pocsuite/thirdparty/pyparsing/pyparsing.py | python | ParseBaseException.__getattr__ | ( self, aname ) | supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text | supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text | [
"supported",
"attributes",
"by",
"name",
"are",
":",
"-",
"lineno",
"-",
"returns",
"the",
"line",
"number",
"of",
"the",
"exception",
"text",
"-",
"col",
"-",
"returns",
"the",
"column",
"number",
"of",
"the",
"exception",
"text",
"-",
"line",
"-",
"ret... | def __getattr__( self, aname ):
"""supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
"""
if( aname == "line... | [
"def",
"__getattr__",
"(",
"self",
",",
"aname",
")",
":",
"if",
"(",
"aname",
"==",
"\"lineno\"",
")",
":",
"return",
"lineno",
"(",
"self",
".",
"loc",
",",
"self",
".",
"pstr",
")",
"elif",
"(",
"aname",
"in",
"(",
"\"col\"",
",",
"\"column\"",
... | https://github.com/vulscanteam/vulscan/blob/787397e267c4e6469522ee0abe55b3e98f968d4a/pocsuite/thirdparty/pyparsing/pyparsing.py#L181-L194 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/extras/csrf_migration_helper.py | python | get_templates | (dirs) | return templates | Returns all files in dirs that have template extensions, as Template
objects. | Returns all files in dirs that have template extensions, as Template
objects. | [
"Returns",
"all",
"files",
"in",
"dirs",
"that",
"have",
"template",
"extensions",
"as",
"Template",
"objects",
"."
] | def get_templates(dirs):
"""
Returns all files in dirs that have template extensions, as Template
objects.
"""
templates = set()
for root in dirs:
for (dirpath, dirnames, filenames) in os.walk(root):
for f in filenames:
if len([True for e in TEMPLATE_EXTENSION... | [
"def",
"get_templates",
"(",
"dirs",
")",
":",
"templates",
"=",
"set",
"(",
")",
"for",
"root",
"in",
"dirs",
":",
"for",
"(",
"dirpath",
",",
"dirnames",
",",
"filenames",
")",
"in",
"os",
".",
"walk",
"(",
"root",
")",
":",
"for",
"f",
"in",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/extras/csrf_migration_helper.py#L245-L259 | |
Netflix/lemur | 3468be93cc84ba7a29f789155763d087ef68b7fe | lemur/common/celery.py | python | clean_all_sources | () | return log_data | This function will clean unused certificates from sources. This is a destructive operation and should only
be ran periodically. This function triggers one celery task per source. | This function will clean unused certificates from sources. This is a destructive operation and should only
be ran periodically. This function triggers one celery task per source. | [
"This",
"function",
"will",
"clean",
"unused",
"certificates",
"from",
"sources",
".",
"This",
"is",
"a",
"destructive",
"operation",
"and",
"should",
"only",
"be",
"ran",
"periodically",
".",
"This",
"function",
"triggers",
"one",
"celery",
"task",
"per",
"so... | def clean_all_sources():
"""
This function will clean unused certificates from sources. This is a destructive operation and should only
be ran periodically. This function triggers one celery task per source.
"""
function = f"{__name__}.{sys._getframe().f_code.co_name}"
task_id = None
if cele... | [
"def",
"clean_all_sources",
"(",
")",
":",
"function",
"=",
"f\"{__name__}.{sys._getframe().f_code.co_name}\"",
"task_id",
"=",
"None",
"if",
"celery_app",
".",
"current_task",
":",
"task_id",
"=",
"celery_app",
".",
"current_task",
".",
"request",
".",
"id",
"log_d... | https://github.com/Netflix/lemur/blob/3468be93cc84ba7a29f789155763d087ef68b7fe/lemur/common/celery.py#L421-L449 | |
subbarayudu-j/TheAlgorithms-Python | bb29dc55faf5b98b1e9f0b1f11a9dd15525386a3 | strings/knuth_morris_pratt.py | python | get_failure_array | (pattern) | return failure | Calculates the new index we should go to if we fail a comparison
:param pattern:
:return: | Calculates the new index we should go to if we fail a comparison
:param pattern:
:return: | [
"Calculates",
"the",
"new",
"index",
"we",
"should",
"go",
"to",
"if",
"we",
"fail",
"a",
"comparison",
":",
"param",
"pattern",
":",
":",
"return",
":"
] | def get_failure_array(pattern):
"""
Calculates the new index we should go to if we fail a comparison
:param pattern:
:return:
"""
failure = [0]
i = 0
j = 1
while j < len(pattern):
if pattern[i] == pattern[j]:
i += 1
elif i > 0:
i = failure[i-1]... | [
"def",
"get_failure_array",
"(",
"pattern",
")",
":",
"failure",
"=",
"[",
"0",
"]",
"i",
"=",
"0",
"j",
"=",
"1",
"while",
"j",
"<",
"len",
"(",
"pattern",
")",
":",
"if",
"pattern",
"[",
"i",
"]",
"==",
"pattern",
"[",
"j",
"]",
":",
"i",
"... | https://github.com/subbarayudu-j/TheAlgorithms-Python/blob/bb29dc55faf5b98b1e9f0b1f11a9dd15525386a3/strings/knuth_morris_pratt.py#L36-L53 | |
pycontribs/pyrax | a0c022981f76a4cba96a22ecc19bb52843ac4fbe | pyrax/image.py | python | ImageClient.update | (self, img, value_dict) | return self._manager.update(img, value_dict) | Accepts an image reference (object or ID) and dictionary of key/value
pairs, where the key is an attribute of the image, and the value is the
desired new value for that image. | Accepts an image reference (object or ID) and dictionary of key/value
pairs, where the key is an attribute of the image, and the value is the
desired new value for that image. | [
"Accepts",
"an",
"image",
"reference",
"(",
"object",
"or",
"ID",
")",
"and",
"dictionary",
"of",
"key",
"/",
"value",
"pairs",
"where",
"the",
"key",
"is",
"an",
"attribute",
"of",
"the",
"image",
"and",
"the",
"value",
"is",
"the",
"desired",
"new",
... | def update(self, img, value_dict):
"""
Accepts an image reference (object or ID) and dictionary of key/value
pairs, where the key is an attribute of the image, and the value is the
desired new value for that image.
"""
return self._manager.update(img, value_dict) | [
"def",
"update",
"(",
"self",
",",
"img",
",",
"value_dict",
")",
":",
"return",
"self",
".",
"_manager",
".",
"update",
"(",
"img",
",",
"value_dict",
")"
] | https://github.com/pycontribs/pyrax/blob/a0c022981f76a4cba96a22ecc19bb52843ac4fbe/pyrax/image.py#L556-L562 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.