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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wrobstory/vincent | c5a06e50179015fbb788a7a42e4570ff4467a9e9 | vincent/scales.py | python | Scale.domain_max | (value) | float, int, or DataRef : Maximum domain value
Only used for quantitative/time scales. This takes precedence over
the maximum of the ``domain`` property. | float, int, or DataRef : Maximum domain value | [
"float",
"int",
"or",
"DataRef",
":",
"Maximum",
"domain",
"value"
] | def domain_max(value):
"""float, int, or DataRef : Maximum domain value
Only used for quantitative/time scales. This takes precedence over
the maximum of the ``domain`` property.
""" | [
"def",
"domain_max",
"(",
"value",
")",
":"
] | https://github.com/wrobstory/vincent/blob/c5a06e50179015fbb788a7a42e4570ff4467a9e9/vincent/scales.py#L77-L82 | ||
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/points.py | python | _Array2LatLon.__repr__ | (self) | return self._repr() | Return a string representation. | Return a string representation. | [
"Return",
"a",
"string",
"representation",
"."
] | def __repr__(self):
'''Return a string representation.
'''
return self._repr() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"_repr",
"(",
")"
] | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/points.py#L629-L632 | |
tchellomello/python-ring-doorbell | 4382c6e54ad7ac342c116fa608d3b45c1e43ed35 | ring_doorbell/doorbot.py | python | RingDoorBell.has_subscription | (self) | return self._attrs.get("features").get("show_recordings") | Return boolean if the account has subscription. | Return boolean if the account has subscription. | [
"Return",
"boolean",
"if",
"the",
"account",
"has",
"subscription",
"."
] | def has_subscription(self):
"""Return boolean if the account has subscription."""
return self._attrs.get("features").get("show_recordings") | [
"def",
"has_subscription",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attrs",
".",
"get",
"(",
"\"features\"",
")",
".",
"get",
"(",
"\"show_recordings\"",
")"
] | https://github.com/tchellomello/python-ring-doorbell/blob/4382c6e54ad7ac342c116fa608d3b45c1e43ed35/ring_doorbell/doorbot.py#L399-L401 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/util/fsa.py | python | Ngram._create_ngram_list | (self) | creates a ngram list from list of lemmas
permute over the created list | creates a ngram list from list of lemmas
permute over the created list | [
"creates",
"a",
"ngram",
"list",
"from",
"list",
"of",
"lemmas",
"permute",
"over",
"the",
"created",
"list"
] | def _create_ngram_list(self):
"""
creates a ngram list from list of lemmas
permute over the created list
"""
for perm in itertools.permutations(self.lemma_list, self.n):
self.ngram_list.append(perm) | [
"def",
"_create_ngram_list",
"(",
"self",
")",
":",
"for",
"perm",
"in",
"itertools",
".",
"permutations",
"(",
"self",
".",
"lemma_list",
",",
"self",
".",
"n",
")",
":",
"self",
".",
"ngram_list",
".",
"append",
"(",
"perm",
")"
] | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/util/fsa.py#L795-L801 | ||
nerdvegas/rez | d392c65bf63b4bca8106f938cec49144ba54e770 | src/rezplugins/release_vcs/svn.py | python | get_last_changed_revision | (client, url) | util func, get last revision of url | util func, get last revision of url | [
"util",
"func",
"get",
"last",
"revision",
"of",
"url"
] | def get_last_changed_revision(client, url):
"""
util func, get last revision of url
"""
try:
svn_entries = client.info2(url,
pysvn.Revision(pysvn.opt_revision_kind.head),
recurse=False)
if not svn_entries:
... | [
"def",
"get_last_changed_revision",
"(",
"client",
",",
"url",
")",
":",
"try",
":",
"svn_entries",
"=",
"client",
".",
"info2",
"(",
"url",
",",
"pysvn",
".",
"Revision",
"(",
"pysvn",
".",
"opt_revision_kind",
".",
"head",
")",
",",
"recurse",
"=",
"Fa... | https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rezplugins/release_vcs/svn.py#L43-L55 | ||
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/xmpp/simplexml.py | python | Node.getTagAttr | (self,tag,attr) | Returns attribute value of the child with specified name (or None if no such attribute). | Returns attribute value of the child with specified name (or None if no such attribute). | [
"Returns",
"attribute",
"value",
"of",
"the",
"child",
"with",
"specified",
"name",
"(",
"or",
"None",
"if",
"no",
"such",
"attribute",
")",
"."
] | def getTagAttr(self,tag,attr):
""" Returns attribute value of the child with specified name (or None if no such attribute)."""
try: return self.getTag(tag).attrs[attr]
except: return None | [
"def",
"getTagAttr",
"(",
"self",
",",
"tag",
",",
"attr",
")",
":",
"try",
":",
"return",
"self",
".",
"getTag",
"(",
"tag",
")",
".",
"attrs",
"[",
"attr",
"]",
"except",
":",
"return",
"None"
] | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/xmpp/simplexml.py#L221-L224 | ||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/odf/odf2moinmoin.py | python | ODF2MoinMoin.processStyles | (self, styleElements) | Runs through "style" elements extracting necessary information. | Runs through "style" elements extracting necessary information. | [
"Runs",
"through",
"style",
"elements",
"extracting",
"necessary",
"information",
"."
] | def processStyles(self, styleElements):
""" Runs through "style" elements extracting necessary information.
"""
for style in styleElements:
name = style.getAttribute("style:name")
if name == "Standard": continue
family = style.getAttribute("style:family")
... | [
"def",
"processStyles",
"(",
"self",
",",
"styleElements",
")",
":",
"for",
"style",
"in",
"styleElements",
":",
"name",
"=",
"style",
".",
"getAttribute",
"(",
"\"style:name\"",
")",
"if",
"name",
"==",
"\"Standard\"",
":",
"continue",
"family",
"=",
"style... | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/odf/odf2moinmoin.py#L251-L270 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/idlelib/run.py | python | MyRPCServer.handle_error | (self, request, client_address) | Override RPCServer method for IDLE
Interrupt the MainThread and exit server if link is dropped. | Override RPCServer method for IDLE | [
"Override",
"RPCServer",
"method",
"for",
"IDLE"
] | def handle_error(self, request, client_address):
"""Override RPCServer method for IDLE
Interrupt the MainThread and exit server if link is dropped.
"""
global quitting
try:
raise
except SystemExit:
raise
except EOFError:
globa... | [
"def",
"handle_error",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"global",
"quitting",
"try",
":",
"raise",
"except",
"SystemExit",
":",
"raise",
"except",
"EOFError",
":",
"global",
"exit_now",
"exit_now",
"=",
"True",
"thread",
".",
"in... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/idlelib/run.py#L259-L285 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/venv/lib/python2.7/site-packages/setuptools/package_index.py | python | find_external_links | (url, page) | Find rel="homepage" and rel="download" links in `page`, yielding URLs | Find rel="homepage" and rel="download" links in `page`, yielding URLs | [
"Find",
"rel",
"=",
"homepage",
"and",
"rel",
"=",
"download",
"links",
"in",
"page",
"yielding",
"URLs"
] | def find_external_links(url, page):
"""Find rel="homepage" and rel="download" links in `page`, yielding URLs"""
for match in REL.finditer(page):
tag, rel = match.groups()
rels = set(map(str.strip, rel.lower().split(',')))
if 'homepage' in rels or 'download' in rels:
for matc... | [
"def",
"find_external_links",
"(",
"url",
",",
"page",
")",
":",
"for",
"match",
"in",
"REL",
".",
"finditer",
"(",
"page",
")",
":",
"tag",
",",
"rel",
"=",
"match",
".",
"groups",
"(",
")",
"rels",
"=",
"set",
"(",
"map",
"(",
"str",
".",
"stri... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/setuptools/package_index.py#L184-L199 | ||
vulscanteam/vulscan | 787397e267c4e6469522ee0abe55b3e98f968d4a | pocsuite/thirdparty/requests/cookies.py | python | morsel_to_cookie | (morsel) | return create_cookie(
comment=morsel['comment'],
comment_url=bool(morsel['comment']),
discard=False,
domain=morsel['domain'],
expires=expires,
name=morsel.key,
path=morsel['path'],
port=None,
rest={'HttpOnly': morsel['httponly']},
rfc2109=F... | Convert a Morsel object into a Cookie containing the one k/v pair. | Convert a Morsel object into a Cookie containing the one k/v pair. | [
"Convert",
"a",
"Morsel",
"object",
"into",
"a",
"Cookie",
"containing",
"the",
"one",
"k",
"/",
"v",
"pair",
"."
] | def morsel_to_cookie(morsel):
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
expires = None
if morsel['max-age']:
expires = time.time() + morsel['max-age']
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = time.mktime(
... | [
"def",
"morsel_to_cookie",
"(",
"morsel",
")",
":",
"expires",
"=",
"None",
"if",
"morsel",
"[",
"'max-age'",
"]",
":",
"expires",
"=",
"time",
".",
"time",
"(",
")",
"+",
"morsel",
"[",
"'max-age'",
"]",
"elif",
"morsel",
"[",
"'expires'",
"]",
":",
... | https://github.com/vulscanteam/vulscan/blob/787397e267c4e6469522ee0abe55b3e98f968d4a/pocsuite/thirdparty/requests/cookies.py#L413-L437 | |
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | api/boto/mturk/connection.py | python | MTurkConnection._process_request | (self, request_type, params, marker_elems=None) | return self._process_response(response, marker_elems) | Helper to process the xml response from AWS | Helper to process the xml response from AWS | [
"Helper",
"to",
"process",
"the",
"xml",
"response",
"from",
"AWS"
] | def _process_request(self, request_type, params, marker_elems=None):
"""
Helper to process the xml response from AWS
"""
response = self.make_request(request_type, params)
return self._process_response(response, marker_elems) | [
"def",
"_process_request",
"(",
"self",
",",
"request_type",
",",
"params",
",",
"marker_elems",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"make_request",
"(",
"request_type",
",",
"params",
")",
"return",
"self",
".",
"_process_response",
"(",
"r... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/api/boto/mturk/connection.py#L379-L384 | |
longld/peda | 84d38bda505941ba823db7f6c1bcca1e485a2d43 | peda.py | python | PEDACmd.show | (self, *arg) | return | Show various PEDA options and other settings
Usage:
MYNAME option [optname]
MYNAME (show all options)
MYNAME args
MYNAME env [envname] | Show various PEDA options and other settings
Usage:
MYNAME option [optname]
MYNAME (show all options)
MYNAME args
MYNAME env [envname] | [
"Show",
"various",
"PEDA",
"options",
"and",
"other",
"settings",
"Usage",
":",
"MYNAME",
"option",
"[",
"optname",
"]",
"MYNAME",
"(",
"show",
"all",
"options",
")",
"MYNAME",
"args",
"MYNAME",
"env",
"[",
"envname",
"]"
] | def show(self, *arg):
"""
Show various PEDA options and other settings
Usage:
MYNAME option [optname]
MYNAME (show all options)
MYNAME args
MYNAME env [envname]
"""
# show options
def _show_option(name=None):
if ... | [
"def",
"show",
"(",
"self",
",",
"*",
"arg",
")",
":",
"# show options",
"def",
"_show_option",
"(",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"\"\"",
"filename",
"=",
"peda",
".",
"getfile",
"(",
")",
"if",
"file... | https://github.com/longld/peda/blob/84d38bda505941ba823db7f6c1bcca1e485a2d43/peda.py#L3181-L3238 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/logging/__init__.py | python | Manager._fixupParents | (self, alogger) | Ensure that there are either loggers or placeholders all the way
from the specified logger to the root of the logger hierarchy. | Ensure that there are either loggers or placeholders all the way
from the specified logger to the root of the logger hierarchy. | [
"Ensure",
"that",
"there",
"are",
"either",
"loggers",
"or",
"placeholders",
"all",
"the",
"way",
"from",
"the",
"specified",
"logger",
"to",
"the",
"root",
"of",
"the",
"logger",
"hierarchy",
"."
] | def _fixupParents(self, alogger):
"""
Ensure that there are either loggers or placeholders all the way
from the specified logger to the root of the logger hierarchy.
"""
name = alogger.name
i = name.rfind(".")
rv = None
while (i > 0) and not rv:
... | [
"def",
"_fixupParents",
"(",
"self",
",",
"alogger",
")",
":",
"name",
"=",
"alogger",
".",
"name",
"i",
"=",
"name",
".",
"rfind",
"(",
"\".\"",
")",
"rv",
"=",
"None",
"while",
"(",
"i",
">",
"0",
")",
"and",
"not",
"rv",
":",
"substr",
"=",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/logging/__init__.py#L1036-L1058 | ||
DragonComputer/Dragonfire | dd21f8e88d9b6390bd229ff73f89a8c3c137b89c | dragonfire/deepconv/__init__.py | python | DeepConversation.getDevice | (self) | Parse the argument to decide on which device run the model
Return:
str: The name of the device on which run the program | Parse the argument to decide on which device run the model
Return:
str: The name of the device on which run the program | [
"Parse",
"the",
"argument",
"to",
"decide",
"on",
"which",
"device",
"run",
"the",
"model",
"Return",
":",
"str",
":",
"The",
"name",
"of",
"the",
"device",
"on",
"which",
"run",
"the",
"program"
] | def getDevice(self):
""" Parse the argument to decide on which device run the model
Return:
str: The name of the device on which run the program
"""
if self.device == 'cpu':
return '/cpu:0'
elif self.device == 'gpu':
return '/gpu:0'
eli... | [
"def",
"getDevice",
"(",
"self",
")",
":",
"if",
"self",
".",
"device",
"==",
"'cpu'",
":",
"return",
"'/cpu:0'",
"elif",
"self",
".",
"device",
"==",
"'gpu'",
":",
"return",
"'/gpu:0'",
"elif",
"self",
".",
"device",
"is",
"None",
":",
"# No specified d... | https://github.com/DragonComputer/Dragonfire/blob/dd21f8e88d9b6390bd229ff73f89a8c3c137b89c/dragonfire/deepconv/__init__.py#L593-L606 | ||
huawei-noah/vega | d9f13deede7f2b584e4b1d32ffdb833856129989 | vega/datasets/common/utils/auto_lane_utils.py | python | load_json | (file_path) | return target_dict | Load annot json.
:param file_path:file path
:type: str
:return:json content
:rtype: dict | Load annot json. | [
"Load",
"annot",
"json",
"."
] | def load_json(file_path):
"""Load annot json.
:param file_path:file path
:type: str
:return:json content
:rtype: dict
"""
with open(file_path) as f:
target_dict = json.load(f)
return target_dict | [
"def",
"load_json",
"(",
"file_path",
")",
":",
"with",
"open",
"(",
"file_path",
")",
"as",
"f",
":",
"target_dict",
"=",
"json",
".",
"load",
"(",
"f",
")",
"return",
"target_dict"
] | https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/datasets/common/utils/auto_lane_utils.py#L206-L216 | |
brendano/tweetmotif | 1b0b1e3a941745cd5a26eba01f554688b7c4b27e | everything_else/djfrontend/django-1.0.2/utils/tree.py | python | Node.__len__ | (self) | return len(self.children) | The size of a node if the number of children it has. | The size of a node if the number of children it has. | [
"The",
"size",
"of",
"a",
"node",
"if",
"the",
"number",
"of",
"children",
"it",
"has",
"."
] | def __len__(self):
"""
The size of a node if the number of children it has.
"""
return len(self.children) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"children",
")"
] | https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/utils/tree.py#L65-L69 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/modern_forms/fan.py | python | ModernFormsFanEntity.async_turn_on | (
self,
speed: int | None = None,
percentage: int | None = None,
preset_mode: int | None = None,
**kwargs: Any,
) | Turn on the fan. | Turn on the fan. | [
"Turn",
"on",
"the",
"fan",
"."
] | async def async_turn_on(
self,
speed: int | None = None,
percentage: int | None = None,
preset_mode: int | None = None,
**kwargs: Any,
) -> None:
"""Turn on the fan."""
data = {OPT_ON: FAN_POWER_ON}
if percentage:
data[OPT_SPEED] = round(
... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
":",
"int",
"|",
"None",
"=",
"None",
",",
"percentage",
":",
"int",
"|",
"None",
"=",
"None",
",",
"preset_mode",
":",
"int",
"|",
"None",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/modern_forms/fan.py#L130-L144 | ||
MPI-IS/mesh | 49e70425cf373ec5269917012bda2944215c5ccd | mesh/meshviewer.py | python | test_for_opengl | () | return test_for_opengl_cached | Tests if opengl is supported.
.. note:: the result of the test is cached | Tests if opengl is supported. | [
"Tests",
"if",
"opengl",
"is",
"supported",
"."
] | def test_for_opengl():
"""Tests if opengl is supported.
.. note:: the result of the test is cached
"""
global test_for_opengl_cached
if test_for_opengl_cached is None:
with open(os.devnull) as dev_null, \
tempfile.TemporaryFile() as out, \
tempfile.TemporaryFile()... | [
"def",
"test_for_opengl",
"(",
")",
":",
"global",
"test_for_opengl_cached",
"if",
"test_for_opengl_cached",
"is",
"None",
":",
"with",
"open",
"(",
"os",
".",
"devnull",
")",
"as",
"dev_null",
",",
"tempfile",
".",
"TemporaryFile",
"(",
")",
"as",
"out",
",... | https://github.com/MPI-IS/mesh/blob/49e70425cf373ec5269917012bda2944215c5ccd/mesh/meshviewer.py#L111-L141 | |
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/linux_packages/speccpu2017.py | python | Install | (vm) | Installs SPECCPU 2017. | Installs SPECCPU 2017. | [
"Installs",
"SPECCPU",
"2017",
"."
] | def Install(vm):
"""Installs SPECCPU 2017."""
speccpu.InstallSPECCPU(vm, GetSpecInstallConfig(vm.GetScratchDir()))
# spec17 tarball comes pre-packages with runner scripts for x86 architecture.
# But because we may have x86 or arm architecture machines, just rerun the
# install script to regenerate the runner ... | [
"def",
"Install",
"(",
"vm",
")",
":",
"speccpu",
".",
"InstallSPECCPU",
"(",
"vm",
",",
"GetSpecInstallConfig",
"(",
"vm",
".",
"GetScratchDir",
"(",
")",
")",
")",
"# spec17 tarball comes pre-packages with runner scripts for x86 architecture.",
"# But because we may hav... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/linux_packages/speccpu2017.py#L78-L86 | ||
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/sql/default_comparator.py | python | _between_impl | (expr, op, cleft, cright, **kw) | return BinaryExpression(
expr,
ClauseList(
coercions.expect(
roles.BinaryElementRole,
cleft,
expr=expr,
operator=operators.and_,
),
coercions.expect(
roles.BinaryElementRole,
... | See :meth:`.ColumnOperators.between`. | See :meth:`.ColumnOperators.between`. | [
"See",
":",
"meth",
":",
".",
"ColumnOperators",
".",
"between",
"."
] | def _between_impl(expr, op, cleft, cright, **kw):
"""See :meth:`.ColumnOperators.between`."""
return BinaryExpression(
expr,
ClauseList(
coercions.expect(
roles.BinaryElementRole,
cleft,
expr=expr,
operator=operators.and... | [
"def",
"_between_impl",
"(",
"expr",
",",
"op",
",",
"cleft",
",",
"cright",
",",
"*",
"*",
"kw",
")",
":",
"return",
"BinaryExpression",
"(",
"expr",
",",
"ClauseList",
"(",
"coercions",
".",
"expect",
"(",
"roles",
".",
"BinaryElementRole",
",",
"cleft... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/sql/default_comparator.py#L229-L255 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/functools.py | python | update_wrapper | (wrapper,
wrapped,
assigned = WRAPPER_ASSIGNMENTS,
updated = WRAPPER_UPDATES) | return wrapper | Update a wrapper function to look like the wrapped function
wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)... | Update a wrapper function to look like the wrapped function | [
"Update",
"a",
"wrapper",
"function",
"to",
"look",
"like",
"the",
"wrapped",
"function"
] | def update_wrapper(wrapper,
wrapped,
assigned = WRAPPER_ASSIGNMENTS,
updated = WRAPPER_UPDATES):
"""Update a wrapper function to look like the wrapped function
wrapper is the function to be updated
wrapped is the original function
assign... | [
"def",
"update_wrapper",
"(",
"wrapper",
",",
"wrapped",
",",
"assigned",
"=",
"WRAPPER_ASSIGNMENTS",
",",
"updated",
"=",
"WRAPPER_UPDATES",
")",
":",
"for",
"attr",
"in",
"assigned",
":",
"setattr",
"(",
"wrapper",
",",
"attr",
",",
"getattr",
"(",
"wrappe... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/functools.py#L17-L37 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/tornado/template.py | python | _parse | (reader, template, in_block=None, in_loop=None) | [] | def _parse(reader, template, in_block=None, in_loop=None):
body = _ChunkList([])
while True:
# Find next template directive
curly = 0
while True:
curly = reader.find("{", curly)
if curly == -1 or curly + 1 == reader.remaining():
# EOF
... | [
"def",
"_parse",
"(",
"reader",
",",
"template",
",",
"in_block",
"=",
"None",
",",
"in_loop",
"=",
"None",
")",
":",
"body",
"=",
"_ChunkList",
"(",
"[",
"]",
")",
"while",
"True",
":",
"# Find next template directive",
"curly",
"=",
"0",
"while",
"True... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/template.py#L795-L976 | ||||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/winproxy/apis/kernel32.py | python | GetCurrentThread | () | return GetCurrentThread.ctypes_function() | [] | def GetCurrentThread():
return GetCurrentThread.ctypes_function() | [
"def",
"GetCurrentThread",
"(",
")",
":",
"return",
"GetCurrentThread",
".",
"ctypes_function",
"(",
")"
] | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winproxy/apis/kernel32.py#L166-L167 | |||
lightkurve/lightkurve | 70d1c4cd1ab30f24c83e54bdcea4dd16624bfd9c | src/lightkurve/interact.py | python | _correct_with_proper_motion | (ra, dec, pm_ra, pm_dec, equinox, new_time) | return new_c.ra, new_c.dec, True | Return proper-motion corrected RA / Dec.
It also return whether proper motion correction is applied or not. | Return proper-motion corrected RA / Dec.
It also return whether proper motion correction is applied or not. | [
"Return",
"proper",
"-",
"motion",
"corrected",
"RA",
"/",
"Dec",
".",
"It",
"also",
"return",
"whether",
"proper",
"motion",
"correction",
"is",
"applied",
"or",
"not",
"."
] | def _correct_with_proper_motion(ra, dec, pm_ra, pm_dec, equinox, new_time):
"""Return proper-motion corrected RA / Dec.
It also return whether proper motion correction is applied or not."""
# all parameters have units
if ra is None or dec is None or \
pm_ra is None or pm_dec is None or (np.al... | [
"def",
"_correct_with_proper_motion",
"(",
"ra",
",",
"dec",
",",
"pm_ra",
",",
"pm_dec",
",",
"equinox",
",",
"new_time",
")",
":",
"# all parameters have units",
"if",
"ra",
"is",
"None",
"or",
"dec",
"is",
"None",
"or",
"pm_ra",
"is",
"None",
"or",
"pm_... | https://github.com/lightkurve/lightkurve/blob/70d1c4cd1ab30f24c83e54bdcea4dd16624bfd9c/src/lightkurve/interact.py#L80-L109 | |
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | lib/cmdlib/cluster/__init__.py | python | LUClusterDestroy.BuildHooksNodes | (self) | return ([], []) | Build hooks nodes. | Build hooks nodes. | [
"Build",
"hooks",
"nodes",
"."
] | def BuildHooksNodes(self):
"""Build hooks nodes.
"""
return ([], []) | [
"def",
"BuildHooksNodes",
"(",
"self",
")",
":",
"return",
"(",
"[",
"]",
",",
"[",
"]",
")"
] | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/cmdlib/cluster/__init__.py#L290-L294 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/sonos/config_flow.py | python | _async_has_devices | (hass: HomeAssistant) | return bool(await ssdp.async_get_discovery_info_by_st(hass, UPNP_ST)) | Return if Sonos devices have been seen recently with SSDP. | Return if Sonos devices have been seen recently with SSDP. | [
"Return",
"if",
"Sonos",
"devices",
"have",
"been",
"seen",
"recently",
"with",
"SSDP",
"."
] | async def _async_has_devices(hass: HomeAssistant) -> bool:
"""Return if Sonos devices have been seen recently with SSDP."""
return bool(await ssdp.async_get_discovery_info_by_st(hass, UPNP_ST)) | [
"async",
"def",
"_async_has_devices",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"await",
"ssdp",
".",
"async_get_discovery_info_by_st",
"(",
"hass",
",",
"UPNP_ST",
")",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/sonos/config_flow.py#L14-L16 | |
dashingsoft/pyarmor | 4bbe0ad4223c04ddc29b2bf3b07ad7158d7f1d87 | src/examples/pybench/pybench.py | python | Benchmark.stat | (self) | return (min_time, avg_time, max_time) | Return benchmark run statistics as tuple:
(minimum round time,
average round time,
maximum round time)
XXX Currently not used, since the benchmark does test
statistics across all rounds. | Return benchmark run statistics as tuple: | [
"Return",
"benchmark",
"run",
"statistics",
"as",
"tuple",
":"
] | def stat(self):
""" Return benchmark run statistics as tuple:
(minimum round time,
average round time,
maximum round time)
XXX Currently not used, since the benchmark does test
statistics across all rounds.
"""
runs = len(self... | [
"def",
"stat",
"(",
"self",
")",
":",
"runs",
"=",
"len",
"(",
"self",
".",
"roundtimes",
")",
"if",
"runs",
"==",
"0",
":",
"return",
"0.0",
",",
"0.0",
"min_time",
"=",
"min",
"(",
"self",
".",
"roundtimes",
")",
"total_time",
"=",
"sum",
"(",
... | https://github.com/dashingsoft/pyarmor/blob/4bbe0ad4223c04ddc29b2bf3b07ad7158d7f1d87/src/examples/pybench/pybench.py#L560-L579 | |
datastax/python-driver | 5fdb0061f56f53b9d8d8ad67b99110899653ad77 | cassandra/policies.py | python | EC2MultiRegionTranslator.translate | (self, addr) | return addr | Reverse DNS the public broadcast_address, then lookup that hostname to get the AWS-resolved IP, which
will point to the private IP address within the same datacenter. | Reverse DNS the public broadcast_address, then lookup that hostname to get the AWS-resolved IP, which
will point to the private IP address within the same datacenter. | [
"Reverse",
"DNS",
"the",
"public",
"broadcast_address",
"then",
"lookup",
"that",
"hostname",
"to",
"get",
"the",
"AWS",
"-",
"resolved",
"IP",
"which",
"will",
"point",
"to",
"the",
"private",
"IP",
"address",
"within",
"the",
"same",
"datacenter",
"."
] | def translate(self, addr):
"""
Reverse DNS the public broadcast_address, then lookup that hostname to get the AWS-resolved IP, which
will point to the private IP address within the same datacenter.
"""
# get family of this address so we translate to the same
family = sock... | [
"def",
"translate",
"(",
"self",
",",
"addr",
")",
":",
"# get family of this address so we translate to the same",
"family",
"=",
"socket",
".",
"getaddrinfo",
"(",
"addr",
",",
"0",
",",
"socket",
".",
"AF_UNSPEC",
",",
"socket",
".",
"SOCK_STREAM",
")",
"[",
... | https://github.com/datastax/python-driver/blob/5fdb0061f56f53b9d8d8ad67b99110899653ad77/cassandra/policies.py#L1034-L1047 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/internet/udp.py | python | Port.connectionLost | (self, reason=None) | Cleans up my socket. | Cleans up my socket. | [
"Cleans",
"up",
"my",
"socket",
"."
] | def connectionLost(self, reason=None):
"""
Cleans up my socket.
"""
log.msg('(UDP Port %s Closed)' % self._realPortNumber)
self._realPortNumber = None
base.BasePort.connectionLost(self, reason)
self.protocol.doStop()
self.socket.close()
del self.so... | [
"def",
"connectionLost",
"(",
"self",
",",
"reason",
"=",
"None",
")",
":",
"log",
".",
"msg",
"(",
"'(UDP Port %s Closed)'",
"%",
"self",
".",
"_realPortNumber",
")",
"self",
".",
"_realPortNumber",
"=",
"None",
"base",
".",
"BasePort",
".",
"connectionLost... | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/internet/udp.py#L230-L243 | ||
santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning | 97ff2ae3ba9f2d478e174444c4e0f5349f28c319 | texar_repo/texar/modules/decoders/rnn_decoder_base.py | python | RNNDecoderBase.cell | (self) | return self._cell | The RNN cell. | The RNN cell. | [
"The",
"RNN",
"cell",
"."
] | def cell(self):
"""The RNN cell.
"""
return self._cell | [
"def",
"cell",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cell"
] | https://github.com/santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning/blob/97ff2ae3ba9f2d478e174444c4e0f5349f28c319/texar_repo/texar/modules/decoders/rnn_decoder_base.py#L486-L489 | |
quantumlib/Cirq | 89f88b01d69222d3f1ec14d649b7b3a85ed9211f | cirq-core/cirq/sim/density_matrix_simulator.py | python | DensityMatrixSimulator.__init__ | (
self,
*,
dtype: 'DTypeLike' = np.complex64,
noise: 'cirq.NOISE_MODEL_LIKE' = None,
seed: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
ignore_measurement_results: bool = False,
split_untangled_states: bool = True,
) | Density matrix simulator.
Args:
dtype: The `numpy.dtype` used by the simulation. One of
`numpy.complex64` or `numpy.complex128`
noise: A noise model to apply while simulating.
seed: The random seed to use for this simulator.
ignore_measurement_res... | Density matrix simulator. | [
"Density",
"matrix",
"simulator",
"."
] | def __init__(
self,
*,
dtype: 'DTypeLike' = np.complex64,
noise: 'cirq.NOISE_MODEL_LIKE' = None,
seed: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
ignore_measurement_results: bool = False,
split_untangled_states: bool = True,
):
"""Density matrix simulato... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"dtype",
":",
"'DTypeLike'",
"=",
"np",
".",
"complex64",
",",
"noise",
":",
"'cirq.NOISE_MODEL_LIKE'",
"=",
"None",
",",
"seed",
":",
"'cirq.RANDOM_STATE_OR_SEED_LIKE'",
"=",
"None",
",",
"ignore_measurement_result... | https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/sim/density_matrix_simulator.py#L120-L173 | ||
wandb/client | 3963364d8112b7dedb928fa423b6878ea1b467d9 | wandb/vendor/watchdog/utils/dirsnapshot.py | python | DirectorySnapshot.path | (self, id) | return self._inode_to_path.get(id) | Returns path for id. None if id is unknown to this snapshot. | Returns path for id. None if id is unknown to this snapshot. | [
"Returns",
"path",
"for",
"id",
".",
"None",
"if",
"id",
"is",
"unknown",
"to",
"this",
"snapshot",
"."
] | def path(self, id):
"""
Returns path for id. None if id is unknown to this snapshot.
"""
return self._inode_to_path.get(id) | [
"def",
"path",
"(",
"self",
",",
"id",
")",
":",
"return",
"self",
".",
"_inode_to_path",
".",
"get",
"(",
"id",
")"
] | https://github.com/wandb/client/blob/3963364d8112b7dedb928fa423b6878ea1b467d9/wandb/vendor/watchdog/utils/dirsnapshot.py#L248-L252 | |
ipython/ipyparallel | d35d4fb9501da5b3280b11e83ed633a95f17be1d | ipyparallel/client/view.py | python | BroadcastView.execute | (self, code, silent=True, targets=None, block=None) | return ar | Executes `code` on `targets` in blocking or nonblocking manner.
``execute`` is always `bound` (affects engine namespace)
Parameters
----------
code : str
the code string to be executed
block : bool
whether or not to wait until done to return
... | Executes `code` on `targets` in blocking or nonblocking manner. | [
"Executes",
"code",
"on",
"targets",
"in",
"blocking",
"or",
"nonblocking",
"manner",
"."
] | def execute(self, code, silent=True, targets=None, block=None):
"""Executes `code` on `targets` in blocking or nonblocking manner.
``execute`` is always `bound` (affects engine namespace)
Parameters
----------
code : str
the code string to be executed
block ... | [
"def",
"execute",
"(",
"self",
",",
"code",
",",
"silent",
"=",
"True",
",",
"targets",
"=",
"None",
",",
"block",
"=",
"None",
")",
":",
"block",
"=",
"self",
".",
"block",
"if",
"block",
"is",
"None",
"else",
"block",
"targets",
"=",
"self",
".",... | https://github.com/ipython/ipyparallel/blob/d35d4fb9501da5b3280b11e83ed633a95f17be1d/ipyparallel/client/view.py#L983-L1026 | |
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractYanyantlsWordpressCom.py | python | extractYanyantlsWordpressCom | (item) | return False | Parser for 'yanyantls.wordpress.com' | Parser for 'yanyantls.wordpress.com' | [
"Parser",
"for",
"yanyantls",
".",
"wordpress",
".",
"com"
] | def extractYanyantlsWordpressCom(item):
'''
Parser for 'yanyantls.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the star light shines when he came', 'the star light shines... | [
"def",
"extractYanyantlsWordpressCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
"i... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractYanyantlsWordpressCom.py#L1-L22 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/distributions/modules.py | python | init_orthogonal_weights_and_constant_biases | (module, gain=1., val=0.) | return module | Initialize the weights of the module to be orthogonal and with a bias of 0s. This is inspired by [1].
Args:
gain (float): optional scaling factor for the orthogonal weights.
val (float): val: the value to fill the bias tensor with.
Returns:
torch.nn.Module: the initialized module.
... | Initialize the weights of the module to be orthogonal and with a bias of 0s. This is inspired by [1]. | [
"Initialize",
"the",
"weights",
"of",
"the",
"module",
"to",
"be",
"orthogonal",
"and",
"with",
"a",
"bias",
"of",
"0s",
".",
"This",
"is",
"inspired",
"by",
"[",
"1",
"]",
"."
] | def init_orthogonal_weights_and_constant_biases(module, gain=1., val=0.):
"""Initialize the weights of the module to be orthogonal and with a bias of 0s. This is inspired by [1].
Args:
gain (float): optional scaling factor for the orthogonal weights.
val (float): val: the value to fill the bias... | [
"def",
"init_orthogonal_weights_and_constant_biases",
"(",
"module",
",",
"gain",
"=",
"1.",
",",
"val",
"=",
"0.",
")",
":",
"weight_init",
"=",
"wrap_init_tensor",
"(",
"torch",
".",
"nn",
".",
"init",
".",
"orthogonal_",
",",
"gain",
"=",
"gain",
")",
"... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/distributions/modules.py#L83-L99 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/motifs/transfac.py | python | Record.__init__ | (self) | Initialize the class. | Initialize the class. | [
"Initialize",
"the",
"class",
"."
] | def __init__(self):
"""Initialize the class."""
self.version = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"version",
"=",
"None"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/motifs/transfac.py#L83-L85 | ||
mikew/ss-plex.bundle | 031566c06205e08a8cb15c57a0c143fba5270493 | Contents/Libraries/Shared/nose/plugins/base.py | python | IPluginInterface.addOptions | (self, parser, env) | Called to allow plugin to register command-line options with the
parser. DO NOT return a value from this method unless you want to stop
all other plugins from setting their options.
.. warning ::
DEPRECATED -- implement
:meth:`options <nose.plugins.base.IPluginInterface.o... | Called to allow plugin to register command-line options with the
parser. DO NOT return a value from this method unless you want to stop
all other plugins from setting their options. | [
"Called",
"to",
"allow",
"plugin",
"to",
"register",
"command",
"-",
"line",
"options",
"with",
"the",
"parser",
".",
"DO",
"NOT",
"return",
"a",
"value",
"from",
"this",
"method",
"unless",
"you",
"want",
"to",
"stop",
"all",
"other",
"plugins",
"from",
... | def addOptions(self, parser, env):
"""Called to allow plugin to register command-line options with the
parser. DO NOT return a value from this method unless you want to stop
all other plugins from setting their options.
.. warning ::
DEPRECATED -- implement
:meth:... | [
"def",
"addOptions",
"(",
"self",
",",
"parser",
",",
"env",
")",
":",
"pass"
] | https://github.com/mikew/ss-plex.bundle/blob/031566c06205e08a8cb15c57a0c143fba5270493/Contents/Libraries/Shared/nose/plugins/base.py#L128-L138 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_secret.py | python | Secret.secrets | (self) | return self._secrets | secret property setter | secret property setter | [
"secret",
"property",
"setter"
] | def secrets(self):
'''secret property setter'''
if self._secrets is None:
self._secrets = self.get_secrets()
return self._secrets | [
"def",
"secrets",
"(",
"self",
")",
":",
"if",
"self",
".",
"_secrets",
"is",
"None",
":",
"self",
".",
"_secrets",
"=",
"self",
".",
"get_secrets",
"(",
")",
"return",
"self",
".",
"_secrets"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_secret.py#L1575-L1579 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/geometry/point.py | python | Point.equals | (self, other) | return all(a.equals(b) for a, b in zip(self, other)) | Returns whether the coordinates of self and other agree. | Returns whether the coordinates of self and other agree. | [
"Returns",
"whether",
"the",
"coordinates",
"of",
"self",
"and",
"other",
"agree",
"."
] | def equals(self, other):
"""Returns whether the coordinates of self and other agree."""
# a point is equal to another point if all its components are equal
if not isinstance(other, Point) or len(self) != len(other):
return False
return all(a.equals(b) for a, b in zip(self, ot... | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"# a point is equal to another point if all its components are equal",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Point",
")",
"or",
"len",
"(",
"self",
")",
"!=",
"len",
"(",
"other",
")",
":",
"return... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/geometry/point.py#L445-L450 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/vcs/__init__.py | python | VcsSupport.get_backend_type | (self, location) | return None | Return the type of the version control backend if found at given
location, e.g. vcs.get_backend_type('/path/to/vcs/checkout') | Return the type of the version control backend if found at given
location, e.g. vcs.get_backend_type('/path/to/vcs/checkout') | [
"Return",
"the",
"type",
"of",
"the",
"version",
"control",
"backend",
"if",
"found",
"at",
"given",
"location",
"e",
".",
"g",
".",
"vcs",
".",
"get_backend_type",
"(",
"/",
"path",
"/",
"to",
"/",
"vcs",
"/",
"checkout",
")"
] | def get_backend_type(self, location):
# type: (str) -> Optional[Type[VersionControl]]
"""
Return the type of the version control backend if found at given
location, e.g. vcs.get_backend_type('/path/to/vcs/checkout')
"""
for vc_type in self._registry.values():
... | [
"def",
"get_backend_type",
"(",
"self",
",",
"location",
")",
":",
"# type: (str) -> Optional[Type[VersionControl]]",
"for",
"vc_type",
"in",
"self",
".",
"_registry",
".",
"values",
"(",
")",
":",
"if",
"vc_type",
".",
"controls_location",
"(",
"location",
")",
... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/vcs/__init__.py#L155-L166 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/bottle/bottle.py | python | JSONPlugin.apply | (self, callback, route) | return wrapper | [] | def apply(self, callback, route):
dumps = self.json_dumps
if not dumps: return callback
def wrapper(*a, **ka):
rv = callback(*a, **ka)
if isinstance(rv, dict):
#Attempt to serialize, raises exception on failure
json_response = dumps(rv)
... | [
"def",
"apply",
"(",
"self",
",",
"callback",
",",
"route",
")",
":",
"dumps",
"=",
"self",
".",
"json_dumps",
"if",
"not",
"dumps",
":",
"return",
"callback",
"def",
"wrapper",
"(",
"*",
"a",
",",
"*",
"*",
"ka",
")",
":",
"rv",
"=",
"callback",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/bottle/bottle.py#L1573-L1585 | |||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/datetime.py | python | _days_before_month | (year, month) | return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year)) | year, month -> number of days in year preceding first day of month. | year, month -> number of days in year preceding first day of month. | [
"year",
"month",
"-",
">",
"number",
"of",
"days",
"in",
"year",
"preceding",
"first",
"day",
"of",
"month",
"."
] | def _days_before_month(year, month):
"year, month -> number of days in year preceding first day of month."
assert 1 <= month <= 12, 'month must be in 1..12'
return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year)) | [
"def",
"_days_before_month",
"(",
"year",
",",
"month",
")",
":",
"assert",
"1",
"<=",
"month",
"<=",
"12",
",",
"'month must be in 1..12'",
"return",
"_DAYS_BEFORE_MONTH",
"[",
"month",
"]",
"+",
"(",
"month",
">",
"2",
"and",
"_is_leap",
"(",
"year",
")"... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/datetime.py#L52-L55 | |
IBM/watson-online-store | 4c8b60883b319f07c3187d9cb433ef9c3ae29aea | watsononlinestore/watson_online_store.py | python | SlackSender.send_message | (self, message) | Sends message via Slack API.
:param str message: The message to be sent to slack | Sends message via Slack API. | [
"Sends",
"message",
"via",
"Slack",
"API",
"."
] | def send_message(self, message):
"""Sends message via Slack API.
:param str message: The message to be sent to slack
"""
self.slack_client.api_call("chat.postMessage",
channel=self.channel,
text=message,
... | [
"def",
"send_message",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"slack_client",
".",
"api_call",
"(",
"\"chat.postMessage\"",
",",
"channel",
"=",
"self",
".",
"channel",
",",
"text",
"=",
"message",
",",
"as_user",
"=",
"True",
")"
] | https://github.com/IBM/watson-online-store/blob/4c8b60883b319f07c3187d9cb433ef9c3ae29aea/watsononlinestore/watson_online_store.py#L44-L52 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/tkinter/__init__.py | python | Text.index | (self, index) | return str(self.tk.call(self._w, 'index', index)) | Return the index in the form line.char for INDEX. | Return the index in the form line.char for INDEX. | [
"Return",
"the",
"index",
"in",
"the",
"form",
"line",
".",
"char",
"for",
"INDEX",
"."
] | def index(self, index):
"""Return the index in the form line.char for INDEX."""
return str(self.tk.call(self._w, 'index', index)) | [
"def",
"index",
"(",
"self",
",",
"index",
")",
":",
"return",
"str",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'index'",
",",
"index",
")",
")"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/__init__.py#L3731-L3733 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/feed_item_target_service/client.py | python | FeedItemTargetServiceClient.campaign_path | (customer_id: str, campaign_id: str,) | return "customers/{customer_id}/campaigns/{campaign_id}".format(
customer_id=customer_id, campaign_id=campaign_id,
) | Return a fully-qualified campaign string. | Return a fully-qualified campaign string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"campaign",
"string",
"."
] | def campaign_path(customer_id: str, campaign_id: str,) -> str:
"""Return a fully-qualified campaign string."""
return "customers/{customer_id}/campaigns/{campaign_id}".format(
customer_id=customer_id, campaign_id=campaign_id,
) | [
"def",
"campaign_path",
"(",
"customer_id",
":",
"str",
",",
"campaign_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/campaigns/{campaign_id}\"",
".",
"format",
"(",
"customer_id",
"=",
"customer_id",
",",
"campaign_id",
"=",
"ca... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/feed_item_target_service/client.py#L192-L196 | |
python-cmd2/cmd2 | c1f6114d52161a3b8a32d3cee1c495d79052e1fb | cmd2/cmd2.py | python | Cmd.flag_based_complete | (
self,
text: str,
line: str,
begidx: int,
endidx: int,
flag_dict: Dict[str, Union[Iterable[str], CompleterFunc]],
*,
all_else: Union[None, Iterable[str], CompleterFunc] = None,
) | return completions_matches | Tab completes based on a particular flag preceding the token being completed.
:param text: the string prefix we are attempting to match (all matches must begin with it)
:param line: the current input line with leading whitespace removed
:param begidx: the beginning index of the prefix text
... | Tab completes based on a particular flag preceding the token being completed. | [
"Tab",
"completes",
"based",
"on",
"a",
"particular",
"flag",
"preceding",
"the",
"token",
"being",
"completed",
"."
] | def flag_based_complete(
self,
text: str,
line: str,
begidx: int,
endidx: int,
flag_dict: Dict[str, Union[Iterable[str], CompleterFunc]],
*,
all_else: Union[None, Iterable[str], CompleterFunc] = None,
) -> List[str]:
"""Tab completes based on a... | [
"def",
"flag_based_complete",
"(",
"self",
",",
"text",
":",
"str",
",",
"line",
":",
"str",
",",
"begidx",
":",
"int",
",",
"endidx",
":",
"int",
",",
"flag_dict",
":",
"Dict",
"[",
"str",
",",
"Union",
"[",
"Iterable",
"[",
"str",
"]",
",",
"Comp... | https://github.com/python-cmd2/cmd2/blob/c1f6114d52161a3b8a32d3cee1c495d79052e1fb/cmd2/cmd2.py#L1381-L1428 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/_vendor/html5lib/_inputstream.py | python | HTMLBinaryInputStream.openStream | (self, source) | return stream | Produces a file object from source.
source can be either a file object, local filename or a string. | Produces a file object from source. | [
"Produces",
"a",
"file",
"object",
"from",
"source",
"."
] | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = BytesIO(source)
t... | [
"def",
"openStream",
"(",
"self",
",",
"source",
")",
":",
"# Already a file object",
"if",
"hasattr",
"(",
"source",
",",
"'read'",
")",
":",
"stream",
"=",
"source",
"else",
":",
"stream",
"=",
"BytesIO",
"(",
"source",
")",
"try",
":",
"stream",
".",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/html5lib/_inputstream.py#L438-L455 | |
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/aui/framemanager.py | python | AuiPaneInfo.SetDockPos | (self, source) | return self | Copies the `source` pane members that pertain to docking position to `self`.
:param `source`: the source pane from where to copy the attributes,
an instance of :class:`AuiPaneInfo`. | Copies the `source` pane members that pertain to docking position to `self`. | [
"Copies",
"the",
"source",
"pane",
"members",
"that",
"pertain",
"to",
"docking",
"position",
"to",
"self",
"."
] | def SetDockPos(self, source):
"""
Copies the `source` pane members that pertain to docking position to `self`.
:param `source`: the source pane from where to copy the attributes,
an instance of :class:`AuiPaneInfo`.
"""
self.dock_direction = source.dock_direction
... | [
"def",
"SetDockPos",
"(",
"self",
",",
"source",
")",
":",
"self",
".",
"dock_direction",
"=",
"source",
".",
"dock_direction",
"self",
".",
"dock_layer",
"=",
"source",
".",
"dock_layer",
"self",
".",
"dock_row",
"=",
"source",
".",
"dock_row",
"self",
".... | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/aui/framemanager.py#L1685-L1702 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/algorithms/factorizers/shor.py | python | ShorResult.total_counts | (self) | return self._total_counts | returns total counts | returns total counts | [
"returns",
"total",
"counts"
] | def total_counts(self) -> int:
"""returns total counts"""
return self._total_counts | [
"def",
"total_counts",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_total_counts"
] | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/algorithms/factorizers/shor.py#L507-L509 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/wled/coordinator.py | python | WLEDDataUpdateCoordinator._use_websocket | (self) | Use WebSocket for updates, instead of polling. | Use WebSocket for updates, instead of polling. | [
"Use",
"WebSocket",
"for",
"updates",
"instead",
"of",
"polling",
"."
] | def _use_websocket(self) -> None:
"""Use WebSocket for updates, instead of polling."""
async def listen() -> None:
"""Listen for state changes via WebSocket."""
try:
await self.wled.connect()
except WLEDError as err:
self.logger.info(e... | [
"def",
"_use_websocket",
"(",
"self",
")",
"->",
"None",
":",
"async",
"def",
"listen",
"(",
")",
"->",
"None",
":",
"\"\"\"Listen for state changes via WebSocket.\"\"\"",
"try",
":",
"await",
"self",
".",
"wled",
".",
"connect",
"(",
")",
"except",
"WLEDError... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/wled/coordinator.py#L63-L104 | ||
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/docutils/writers/_html_base.py | python | HTMLTranslator.check_simple_list | (self, node) | Check for a simple list that can be rendered compactly. | Check for a simple list that can be rendered compactly. | [
"Check",
"for",
"a",
"simple",
"list",
"that",
"can",
"be",
"rendered",
"compactly",
"."
] | def check_simple_list(self, node):
"""Check for a simple list that can be rendered compactly."""
visitor = SimpleListChecker(self.document)
try:
node.walk(visitor)
except nodes.NodeFound:
return False
else:
return True | [
"def",
"check_simple_list",
"(",
"self",
",",
"node",
")",
":",
"visitor",
"=",
"SimpleListChecker",
"(",
"self",
".",
"document",
")",
"try",
":",
"node",
".",
"walk",
"(",
"visitor",
")",
"except",
"nodes",
".",
"NodeFound",
":",
"return",
"False",
"el... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/docutils/writers/_html_base.py#L479-L487 | ||
Runbook/runbook | 7b68622f75ef09f654046f0394540025f3ee7445 | src/monitors/checks/cloudflare-traffic-decrease/__init__.py | python | check | (**kwargs) | Grab Zone Analytics from CloudFlare API and determine status | Grab Zone Analytics from CloudFlare API and determine status | [
"Grab",
"Zone",
"Analytics",
"from",
"CloudFlare",
"API",
"and",
"determine",
"status"
] | def check(**kwargs):
''' Grab Zone Analytics from CloudFlare API and determine status '''
jdata = kwargs['jdata']
logger = kwargs['logger']
# Grab and process metrics
metrics = cloudflare.get_zone_analytics(jdata['data']['email'],
jdata['data']['apikey'],
... | [
"def",
"check",
"(",
"*",
"*",
"kwargs",
")",
":",
"jdata",
"=",
"kwargs",
"[",
"'jdata'",
"]",
"logger",
"=",
"kwargs",
"[",
"'logger'",
"]",
"# Grab and process metrics",
"metrics",
"=",
"cloudflare",
".",
"get_zone_analytics",
"(",
"jdata",
"[",
"'data'",... | https://github.com/Runbook/runbook/blob/7b68622f75ef09f654046f0394540025f3ee7445/src/monitors/checks/cloudflare-traffic-decrease/__init__.py#L6-L50 | ||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | script.module.simplejson/lib/simplejson/scanner.py | python | py_make_scanner | (context) | return scan_once | [] | def py_make_scanner(context):
parse_object = context.parse_object
parse_array = context.parse_array
parse_string = context.parse_string
match_number = NUMBER_RE.match
encoding = context.encoding
strict = context.strict
parse_float = context.parse_float
parse_int = context.parse_int
p... | [
"def",
"py_make_scanner",
"(",
"context",
")",
":",
"parse_object",
"=",
"context",
".",
"parse_object",
"parse_array",
"=",
"context",
".",
"parse_array",
"parse_string",
"=",
"context",
".",
"parse_string",
"match_number",
"=",
"NUMBER_RE",
".",
"match",
"encodi... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.module.simplejson/lib/simplejson/scanner.py#L65-L123 | |||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/miscellaneous/nophead/vector3.py | python | Vector3.__abs__ | (self) | return math.sqrt( self.x * self.x + self.y * self.y + self.z * self.z ) | Get the magnitude of the Vector3. | Get the magnitude of the Vector3. | [
"Get",
"the",
"magnitude",
"of",
"the",
"Vector3",
"."
] | def __abs__(self):
"Get the magnitude of the Vector3."
return math.sqrt( self.x * self.x + self.y * self.y + self.z * self.z ) | [
"def",
"__abs__",
"(",
"self",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"self",
".",
"x",
"*",
"self",
".",
"x",
"+",
"self",
".",
"y",
"*",
"self",
".",
"y",
"+",
"self",
".",
"z",
"*",
"self",
".",
"z",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/miscellaneous/nophead/vector3.py#L53-L55 | |
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/YOLO/darkflow/darkflow/dark/layer.py | python | Layer.__ne__ | (self, other) | return not self.__eq__(other) | [] | def __ne__(self, other):
return not self.__eq__(other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
".",
"__eq__",
"(",
"other",
")"
] | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/YOLO/darkflow/darkflow/dark/layer.py#L57-L58 | |||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/compiler/pyassem.py | python | StackDepthTracker.DUP_TOPX | (self, argc) | return argc | [] | def DUP_TOPX(self, argc):
return argc | [
"def",
"DUP_TOPX",
"(",
"self",
",",
"argc",
")",
":",
"return",
"argc"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/compiler/pyassem.py#L760-L761 | |||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/logging/__init__.py | python | Formatter.formatTime | (self, record, datefmt=None) | return s | Return the creation time of the specified LogRecord as formatted text.
This method should be called from format() by a formatter which
wants to make use of a formatted time. This method can be overridden
in formatters to provide for any specific requirement, but the
basic behaviour is a... | Return the creation time of the specified LogRecord as formatted text. | [
"Return",
"the",
"creation",
"time",
"of",
"the",
"specified",
"LogRecord",
"as",
"formatted",
"text",
"."
] | def formatTime(self, record, datefmt=None):
"""
Return the creation time of the specified LogRecord as formatted text.
This method should be called from format() by a formatter which
wants to make use of a formatted time. This method can be overridden
in formatters to provide fo... | [
"def",
"formatTime",
"(",
"self",
",",
"record",
",",
"datefmt",
"=",
"None",
")",
":",
"ct",
"=",
"self",
".",
"converter",
"(",
"record",
".",
"created",
")",
"if",
"datefmt",
":",
"s",
"=",
"time",
".",
"strftime",
"(",
"datefmt",
",",
"ct",
")"... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/logging/__init__.py#L539-L563 | |
quantumblacklabs/causalnex | 127d9324a3d68c1795299c7522f22cdea880f344 | causalnex/network/network.py | python | BayesianNetwork.nodes | (self) | return list(self._model.nodes) | List of all nodes contained within the Bayesian Network.
Returns:
A list of node names. | List of all nodes contained within the Bayesian Network. | [
"List",
"of",
"all",
"nodes",
"contained",
"within",
"the",
"Bayesian",
"Network",
"."
] | def nodes(self) -> List[str]:
"""
List of all nodes contained within the Bayesian Network.
Returns:
A list of node names.
"""
return list(self._model.nodes) | [
"def",
"nodes",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"self",
".",
"_model",
".",
"nodes",
")"
] | https://github.com/quantumblacklabs/causalnex/blob/127d9324a3d68c1795299c7522f22cdea880f344/causalnex/network/network.py#L166-L173 | |
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/smtplib.py | python | quotedata | (data) | return re.sub(r'(?m)^\.', '..',
re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | Quote data for email.
Double leading '.', and change Unix newline '\\n', or Mac '\\r' into
Internet CRLF end-of-line. | Quote data for email. | [
"Quote",
"data",
"for",
"email",
"."
] | def quotedata(data):
"""Quote data for email.
Double leading '.', and change Unix newline '\\n', or Mac '\\r' into
Internet CRLF end-of-line.
"""
return re.sub(r'(?m)^\.', '..',
re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | [
"def",
"quotedata",
"(",
"data",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'(?m)^\\.'",
",",
"'..'",
",",
"re",
".",
"sub",
"(",
"r'(?:\\r\\n|\\n|\\r(?!\\n))'",
",",
"CRLF",
",",
"data",
")",
")"
] | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/smtplib.py#L160-L167 | |
TadaSoftware/PyNFe | a54de70b92553596f09a57cbe3a207880eafcd93 | pynfe/utils/bar_code_128.py | python | test | () | Execute all tests | Execute all tests | [
"Execute",
"all",
"tests"
] | def test():
""" Execute all tests """
testWithChecksum()
testImage() | [
"def",
"test",
"(",
")",
":",
"testWithChecksum",
"(",
")",
"testImage",
"(",
")"
] | https://github.com/TadaSoftware/PyNFe/blob/a54de70b92553596f09a57cbe3a207880eafcd93/pynfe/utils/bar_code_128.py#L294-L297 | ||
asteroid-team/asteroid | fae2f7d1d4eb83da741818a5c375267fe8d98847 | asteroid/engine/system.py | python | System.common_step | (self, batch, batch_nb, train=True) | return loss | Common forward step between training and validation.
The function of this method is to unpack the data given by the loader,
forward the batch through the model and compute the loss.
Pytorch-lightning handles all the rest.
Args:
batch: the object returned by the loader (a li... | Common forward step between training and validation. | [
"Common",
"forward",
"step",
"between",
"training",
"and",
"validation",
"."
] | def common_step(self, batch, batch_nb, train=True):
"""Common forward step between training and validation.
The function of this method is to unpack the data given by the loader,
forward the batch through the model and compute the loss.
Pytorch-lightning handles all the rest.
A... | [
"def",
"common_step",
"(",
"self",
",",
"batch",
",",
"batch_nb",
",",
"train",
"=",
"True",
")",
":",
"inputs",
",",
"targets",
"=",
"batch",
"est_targets",
"=",
"self",
"(",
"inputs",
")",
"loss",
"=",
"self",
".",
"loss_func",
"(",
"est_targets",
",... | https://github.com/asteroid-team/asteroid/blob/fae2f7d1d4eb83da741818a5c375267fe8d98847/asteroid/engine/system.py#L75-L103 | |
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/plugins/import_export/website_import_plugins/ica_se_plugin.py | python | IcaSePlugin.test_url | (self, url, data) | return WebsiteTestState.FAILED | Is this url from ica.se | Is this url from ica.se | [
"Is",
"this",
"url",
"from",
"ica",
".",
"se"
] | def test_url (self, url, data):
"Is this url from ica.se"
if 'ica.se' in url:
return WebsiteTestState.SUCCESS
return WebsiteTestState.FAILED | [
"def",
"test_url",
"(",
"self",
",",
"url",
",",
"data",
")",
":",
"if",
"'ica.se'",
"in",
"url",
":",
"return",
"WebsiteTestState",
".",
"SUCCESS",
"return",
"WebsiteTestState",
".",
"FAILED"
] | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugins/import_export/website_import_plugins/ica_se_plugin.py#L13-L17 | |
splintered-reality/py_trees | 4c150e8304279faed27deb13b0436833bc8534b7 | py_trees/behaviours.py | python | WaitForBlackboardVariable.update | (self) | Check for existence, wait otherwise.
Returns:
:data:`~py_trees.common.Status.SUCCESS` if key found, :data:`~py_trees.common.Status.RUNNING` otherwise. | Check for existence, wait otherwise. | [
"Check",
"for",
"existence",
"wait",
"otherwise",
"."
] | def update(self) -> common.Status:
"""
Check for existence, wait otherwise.
Returns:
:data:`~py_trees.common.Status.SUCCESS` if key found, :data:`~py_trees.common.Status.RUNNING` otherwise.
"""
self.logger.debug("%s.update()" % self.__class__.__name__)
new_s... | [
"def",
"update",
"(",
"self",
")",
"->",
"common",
".",
"Status",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"%s.update()\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
")",
"new_status",
"=",
"super",
"(",
")",
".",
"update",
"(",
")",
"#... | https://github.com/splintered-reality/py_trees/blob/4c150e8304279faed27deb13b0436833bc8534b7/py_trees/behaviours.py#L424-L439 | ||
jdf/processing.py | 76e48ac855fd34169a7576a5cbc396bda698e781 | mode/formatter/autopep8.py | python | _parse_container | (tokens, index, for_or_if=None) | return (None, None) | Parse a high-level container, such as a list, tuple, etc. | Parse a high-level container, such as a list, tuple, etc. | [
"Parse",
"a",
"high",
"-",
"level",
"container",
"such",
"as",
"a",
"list",
"tuple",
"etc",
"."
] | def _parse_container(tokens, index, for_or_if=None):
"""Parse a high-level container, such as a list, tuple, etc."""
# Store the opening bracket.
items = [Atom(Token(*tokens[index]))]
index += 1
num_tokens = len(tokens)
while index < num_tokens:
tok = Token(*tokens[index])
if ... | [
"def",
"_parse_container",
"(",
"tokens",
",",
"index",
",",
"for_or_if",
"=",
"None",
")",
":",
"# Store the opening bracket.",
"items",
"=",
"[",
"Atom",
"(",
"Token",
"(",
"*",
"tokens",
"[",
"index",
"]",
")",
")",
"]",
"index",
"+=",
"1",
"num_token... | https://github.com/jdf/processing.py/blob/76e48ac855fd34169a7576a5cbc396bda698e781/mode/formatter/autopep8.py#L2024-L2080 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/tensor/tensor.py | python | tensorhead | (name, typ, sym=None, comm=0) | return TensorHead(name, typ, sym, comm) | Function generating tensorhead(s). This method is deprecated,
use TensorHead constructor or tensor_heads() instead.
Parameters
==========
name : name or sequence of names (as in ``symbols``)
typ : index types
sym : same as ``*args`` in ``tensorsymmetry``
comm : commutation group numbe... | Function generating tensorhead(s). This method is deprecated,
use TensorHead constructor or tensor_heads() instead. | [
"Function",
"generating",
"tensorhead",
"(",
"s",
")",
".",
"This",
"method",
"is",
"deprecated",
"use",
"TensorHead",
"constructor",
"or",
"tensor_heads",
"()",
"instead",
"."
] | def tensorhead(name, typ, sym=None, comm=0):
"""
Function generating tensorhead(s). This method is deprecated,
use TensorHead constructor or tensor_heads() instead.
Parameters
==========
name : name or sequence of names (as in ``symbols``)
typ : index types
sym : same as ``*args`` ... | [
"def",
"tensorhead",
"(",
"name",
",",
"typ",
",",
"sym",
"=",
"None",
",",
"comm",
"=",
"0",
")",
":",
"if",
"sym",
"is",
"None",
":",
"sym",
"=",
"[",
"[",
"1",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"typ",
")",
")",
"]",
"sym",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/tensor/tensor.py#L1532-L1552 | |
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/orchestration/metadata.py | python | Metadata._get_outputs_of_execution | (
self, execution_id: int, events: List[metadata_store_pb2.Event]
) | return result | Fetches outputs produced by a historical execution.
Args:
execution_id: the id of the execution that produced the outputs.
events: events related to the execution id.
Returns:
A dict of key -> List[Artifact] as the result | Fetches outputs produced by a historical execution. | [
"Fetches",
"outputs",
"produced",
"by",
"a",
"historical",
"execution",
"."
] | def _get_outputs_of_execution(
self, execution_id: int, events: List[metadata_store_pb2.Event]
) -> Optional[Dict[str, List[Artifact]]]:
"""Fetches outputs produced by a historical execution.
Args:
execution_id: the id of the execution that produced the outputs.
events: events related to th... | [
"def",
"_get_outputs_of_execution",
"(",
"self",
",",
"execution_id",
":",
"int",
",",
"events",
":",
"List",
"[",
"metadata_store_pb2",
".",
"Event",
"]",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"List",
"[",
"Artifact",
"]",
"]",
"]",
":",
... | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/orchestration/metadata.py#L880-L914 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/ledger/merkel_validation/merkel_verifier.py | python | MerkleVerifier.lsb | (self, x) | return x & 1 | Return Least Significant Bits. | Return Least Significant Bits. | [
"Return",
"Least",
"Significant",
"Bits",
"."
] | def lsb(self, x):
"""Return Least Significant Bits."""
return x & 1 | [
"def",
"lsb",
"(",
"self",
",",
"x",
")",
":",
"return",
"x",
"&",
"1"
] | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/ledger/merkel_validation/merkel_verifier.py#L48-L50 | |
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/suds/resolver.py | python | TreeResolver.getchild | (self, name, parent) | get a child by name | get a child by name | [
"get",
"a",
"child",
"by",
"name"
] | def getchild(self, name, parent):
""" get a child by name """
log.debug('searching parent (%s) for (%s)', Repr(parent), name)
if name.startswith('@'):
return parent.get_attribute(name[1:])
else:
return parent.get_child(name) | [
"def",
"getchild",
"(",
"self",
",",
"name",
",",
"parent",
")",
":",
"log",
".",
"debug",
"(",
"'searching parent (%s) for (%s)'",
",",
"Repr",
"(",
"parent",
")",
",",
"name",
")",
"if",
"name",
".",
"startswith",
"(",
"'@'",
")",
":",
"return",
"par... | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/suds/resolver.py#L294-L300 | ||
modelop/hadrian | 7c63e539d79e6e3cad959792d313dfc8b0c523ea | titus/titus/pfaast.py | python | Subs.jsonNode | (self, lineNumbers, memo) | return self | Inserts ``self`` into the Pythonized JSON, which would make it unserializable. | Inserts ``self`` into the Pythonized JSON, which would make it unserializable. | [
"Inserts",
"self",
"into",
"the",
"Pythonized",
"JSON",
"which",
"would",
"make",
"it",
"unserializable",
"."
] | def jsonNode(self, lineNumbers, memo):
"""Inserts ``self`` into the Pythonized JSON, which would make it unserializable."""
return self | [
"def",
"jsonNode",
"(",
"self",
",",
"lineNumbers",
",",
"memo",
")",
":",
"return",
"self"
] | https://github.com/modelop/hadrian/blob/7c63e539d79e6e3cad959792d313dfc8b0c523ea/titus/titus/pfaast.py#L649-L651 | |
nitishsrivastava/deepnet | f4e4ff207923e01552c96038a1e2c29eb5d16160 | deepnet/fastdropoutnet.py | python | FastDropoutNet.SetUpData | (self, skip_outputs=False, skip_layernames=[]) | Setup the data. | Setup the data. | [
"Setup",
"the",
"data",
"."
] | def SetUpData(self, skip_outputs=False, skip_layernames=[]):
"""Setup the data."""
hyp_list = []
name_list = [[], [], []]
for node in self.layer:
if not (node.is_input or node.is_output):
continue
if skip_outputs and node.is_output:
continue
if node.name in skip_layerna... | [
"def",
"SetUpData",
"(",
"self",
",",
"skip_outputs",
"=",
"False",
",",
"skip_layernames",
"=",
"[",
"]",
")",
":",
"hyp_list",
"=",
"[",
"]",
"name_list",
"=",
"[",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"]",
"for",
"node",
"in",
"self",
".",
... | https://github.com/nitishsrivastava/deepnet/blob/f4e4ff207923e01552c96038a1e2c29eb5d16160/deepnet/fastdropoutnet.py#L179-L215 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | asdl/typed_arith_abbrev.py | python | _arith_expr__Unary | (obj) | return p_node | [] | def _arith_expr__Unary(obj):
# type: (arith_expr__Unary) -> hnode__Record
p_node = runtime.NewRecord('U')
p_node.abbrev = True
n = runtime.NewLeaf(str(obj.op), color_e.StringConst)
p_node.unnamed_fields.append(n)
p_node.unnamed_fields.append(obj.a.AbbreviatedTree()) # type: ignore
return p_node | [
"def",
"_arith_expr__Unary",
"(",
"obj",
")",
":",
"# type: (arith_expr__Unary) -> hnode__Record",
"p_node",
"=",
"runtime",
".",
"NewRecord",
"(",
"'U'",
")",
"p_node",
".",
"abbrev",
"=",
"True",
"n",
"=",
"runtime",
".",
"NewLeaf",
"(",
"str",
"(",
"obj",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/asdl/typed_arith_abbrev.py#L8-L16 | |||
wikimedia/pywikibot | 81a01ffaec7271bf5b4b170f85a80388420a4e78 | scripts/interwiki.py | python | Subject.whereReport | (self, page, indent=4) | Report found interlanguage links with conflicts. | Report found interlanguage links with conflicts. | [
"Report",
"found",
"interlanguage",
"links",
"with",
"conflicts",
"."
] | def whereReport(self, page, indent=4):
"""Report found interlanguage links with conflicts."""
for page2 in sorted(self.found_in[page]):
if page2 is None:
pywikibot.output(' ' * indent + 'Given as a hint.')
else:
pywikibot.output(' ' * indent + str(... | [
"def",
"whereReport",
"(",
"self",
",",
"page",
",",
"indent",
"=",
"4",
")",
":",
"for",
"page2",
"in",
"sorted",
"(",
"self",
".",
"found_in",
"[",
"page",
"]",
")",
":",
"if",
"page2",
"is",
"None",
":",
"pywikibot",
".",
"output",
"(",
"' '",
... | https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/scripts/interwiki.py#L1339-L1345 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_label.py | python | Yedit.parse_value | (inc_value, vtype='') | return inc_value | determine value type passed | determine value type passed | [
"determine",
"value",
"type",
"passed"
] | def parse_value(inc_value, vtype=''):
'''determine value type passed'''
true_bools = ['y', 'Y', 'yes', 'Yes', 'YES', 'true', 'True', 'TRUE',
'on', 'On', 'ON', ]
false_bools = ['n', 'N', 'no', 'No', 'NO', 'false', 'False', 'FALSE',
'off', 'Off', 'OFF']... | [
"def",
"parse_value",
"(",
"inc_value",
",",
"vtype",
"=",
"''",
")",
":",
"true_bools",
"=",
"[",
"'y'",
",",
"'Y'",
",",
"'yes'",
",",
"'Yes'",
",",
"'YES'",
",",
"'true'",
",",
"'True'",
",",
"'TRUE'",
",",
"'on'",
",",
"'On'",
",",
"'ON'",
",",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_label.py#L693-L719 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/flows/general/filesystem.py | python | GlobLogic._ConvertGlobIntoPathComponents | (self, pattern) | return components | r"""Converts a glob pattern into a list of pathspec components.
Wildcards are also converted to regular expressions. The pathspec components
do not span directories, and are marked as a regex or a literal component.
We also support recursion into directories using the ** notation. For
example, /home/... | r"""Converts a glob pattern into a list of pathspec components. | [
"r",
"Converts",
"a",
"glob",
"pattern",
"into",
"a",
"list",
"of",
"pathspec",
"components",
"."
] | def _ConvertGlobIntoPathComponents(self, pattern):
r"""Converts a glob pattern into a list of pathspec components.
Wildcards are also converted to regular expressions. The pathspec components
do not span directories, and are marked as a regex or a literal component.
We also support recursion into dire... | [
"def",
"_ConvertGlobIntoPathComponents",
"(",
"self",
",",
"pattern",
")",
":",
"components",
"=",
"[",
"]",
"for",
"path_component",
"in",
"pattern",
".",
"split",
"(",
"\"/\"",
")",
":",
"# A ** in the path component means recurse into directories that match the",
"# ... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/flows/general/filesystem.py#L413-L466 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/policy_v1beta1_api.py | python | PolicyV1beta1Api.delete_collection_pod_security_policy_with_http_info | (self, **kwargs) | return self.api_client.call_api(
'/apis/policy/v1beta1/podsecuritypolicies', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1Status', # ... | delete_collection_pod_security_policy # noqa: E501
delete collection of PodSecurityPolicy # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_collection_pod_security_policy_with_... | delete_collection_pod_security_policy # noqa: E501 | [
"delete_collection_pod_security_policy",
"#",
"noqa",
":",
"E501"
] | def delete_collection_pod_security_policy_with_http_info(self, **kwargs): # noqa: E501
"""delete_collection_pod_security_policy # noqa: E501
delete collection of PodSecurityPolicy # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP reque... | [
"def",
"delete_collection_pod_security_policy_with_http_info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'pretty'",
",",
"'_continue'",
",",
"'dry_run'",
",",
"'field_selecto... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/policy_v1beta1_api.py#L522-L653 | |
zenodo/zenodo | 3c45e52a742ad5a0a7788a67b02fbbc15ab4d8d5 | zenodo/modules/records/models.py | python | ObjectType.get_openaire_subtype | (cls, value) | Get the OpenAIRE community-specific subtype.
OpenAIRE community-specific subtype requires that the record is
accepted to the relevant community.
:param value: Full 'metadata' dictionary. Higher level metadata is
required since we are fetching both 'resource_type' and
... | Get the OpenAIRE community-specific subtype. | [
"Get",
"the",
"OpenAIRE",
"community",
"-",
"specific",
"subtype",
"."
] | def get_openaire_subtype(cls, value):
"""Get the OpenAIRE community-specific subtype.
OpenAIRE community-specific subtype requires that the record is
accepted to the relevant community.
:param value: Full 'metadata' dictionary. Higher level metadata is
required si... | [
"def",
"get_openaire_subtype",
"(",
"cls",
",",
"value",
")",
":",
"comms",
"=",
"value",
".",
"get",
"(",
"'communities'",
",",
"[",
"]",
")",
"oa_type",
"=",
"value",
"[",
"'resource_type'",
"]",
".",
"get",
"(",
"'openaire_subtype'",
")",
"if",
"oa_ty... | https://github.com/zenodo/zenodo/blob/3c45e52a742ad5a0a7788a67b02fbbc15ab4d8d5/zenodo/modules/records/models.py#L242-L259 | ||
bwohlberg/sporco | df67462abcf83af6ab1961bcb0d51b87a66483fa | sporco/admm/cbpdn.py | python | ConvBPDN.obfn_reg | (self) | return (self.lmbda*rl1, rl1) | Compute regularisation term and contribution to objective
function. | Compute regularisation term and contribution to objective
function. | [
"Compute",
"regularisation",
"term",
"and",
"contribution",
"to",
"objective",
"function",
"."
] | def obfn_reg(self):
"""Compute regularisation term and contribution to objective
function.
"""
rl1 = np.linalg.norm((self.wl1 * self.obfn_gvar()).ravel(), 1)
return (self.lmbda*rl1, rl1) | [
"def",
"obfn_reg",
"(",
"self",
")",
":",
"rl1",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"(",
"self",
".",
"wl1",
"*",
"self",
".",
"obfn_gvar",
"(",
")",
")",
".",
"ravel",
"(",
")",
",",
"1",
")",
"return",
"(",
"self",
".",
"lmbda",
"*... | https://github.com/bwohlberg/sporco/blob/df67462abcf83af6ab1961bcb0d51b87a66483fa/sporco/admm/cbpdn.py#L624-L630 | |
dsmrreader/dsmr-reader | c037848e0f96028fb500415b9289df40f81bc14f | dsmr_dropbox/services.py | python | should_sync_file | (abs_file_path: str) | return True | Checks whether we should include this file for sync. | Checks whether we should include this file for sync. | [
"Checks",
"whether",
"we",
"should",
"include",
"this",
"file",
"for",
"sync",
"."
] | def should_sync_file(abs_file_path: str) -> bool:
""" Checks whether we should include this file for sync. """
file_stat = os.stat(abs_file_path)
# Ignore empty files.
if file_stat.st_size == 0:
logger.debug('Dropbox: Ignoring file with zero Bytes: %s', abs_file_path)
return False
... | [
"def",
"should_sync_file",
"(",
"abs_file_path",
":",
"str",
")",
"->",
"bool",
":",
"file_stat",
"=",
"os",
".",
"stat",
"(",
"abs_file_path",
")",
"# Ignore empty files.",
"if",
"file_stat",
".",
"st_size",
"==",
"0",
":",
"logger",
".",
"debug",
"(",
"'... | https://github.com/dsmrreader/dsmr-reader/blob/c037848e0f96028fb500415b9289df40f81bc14f/dsmr_dropbox/services.py#L76-L96 | |
prompt-toolkit/python-prompt-toolkit | e9eac2eb59ec385e81742fa2ac623d4b8de00925 | prompt_toolkit/contrib/regular_languages/compiler.py | python | Match.variables | (self) | return Variables(
[(k, self._unescape(k, v), sl) for k, v, sl in self._nodes_to_values()]
) | Returns :class:`Variables` instance. | Returns :class:`Variables` instance. | [
"Returns",
":",
"class",
":",
"Variables",
"instance",
"."
] | def variables(self) -> "Variables":
"""
Returns :class:`Variables` instance.
"""
return Variables(
[(k, self._unescape(k, v), sl) for k, v, sl in self._nodes_to_values()]
) | [
"def",
"variables",
"(",
"self",
")",
"->",
"\"Variables\"",
":",
"return",
"Variables",
"(",
"[",
"(",
"k",
",",
"self",
".",
"_unescape",
"(",
"k",
",",
"v",
")",
",",
"sl",
")",
"for",
"k",
",",
"v",
",",
"sl",
"in",
"self",
".",
"_nodes_to_va... | https://github.com/prompt-toolkit/python-prompt-toolkit/blob/e9eac2eb59ec385e81742fa2ac623d4b8de00925/prompt_toolkit/contrib/regular_languages/compiler.py#L453-L459 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/util/version/__init__.py | python | _parse_local_version | (local: str) | return None | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). | [
"Takes",
"a",
"string",
"like",
"abc",
".",
"1",
".",
"twelve",
"and",
"turns",
"it",
"into",
"(",
"abc",
"1",
"twelve",
")",
"."
] | def _parse_local_version(local: str) -> LocalType | None:
"""
Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
"""
if local is not None:
return tuple(
part.lower() if not part.isdigit() else int(part)
for part in _local_version_separators.split(loc... | [
"def",
"_parse_local_version",
"(",
"local",
":",
"str",
")",
"->",
"LocalType",
"|",
"None",
":",
"if",
"local",
"is",
"not",
"None",
":",
"return",
"tuple",
"(",
"part",
".",
"lower",
"(",
")",
"if",
"not",
"part",
".",
"isdigit",
"(",
")",
"else",... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/util/version/__init__.py#L507-L516 | |
zigpy/bellows | acf47f6939c28b20b22d5715646e6f1a0bd70064 | bellows/ezsp/protocol.py | python | ProtocolHandler.set_source_routing | (self) | Enable source routing on NCP. | Enable source routing on NCP. | [
"Enable",
"source",
"routing",
"on",
"NCP",
"."
] | async def set_source_routing(self) -> None:
"""Enable source routing on NCP.""" | [
"async",
"def",
"set_source_routing",
"(",
"self",
")",
"->",
"None",
":"
] | https://github.com/zigpy/bellows/blob/acf47f6939c28b20b22d5715646e6f1a0bd70064/bellows/ezsp/protocol.py#L122-L123 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/smhi/weather.py | python | SmhiWeather.retry_update | (self, _: datetime) | Retry refresh weather forecast. | Retry refresh weather forecast. | [
"Retry",
"refresh",
"weather",
"forecast",
"."
] | async def retry_update(self, _: datetime) -> None:
"""Retry refresh weather forecast."""
await self.async_update( # pylint: disable=unexpected-keyword-arg
no_throttle=True
) | [
"async",
"def",
"retry_update",
"(",
"self",
",",
"_",
":",
"datetime",
")",
"->",
"None",
":",
"await",
"self",
".",
"async_update",
"(",
"# pylint: disable=unexpected-keyword-arg",
"no_throttle",
"=",
"True",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/smhi/weather.py#L149-L153 | ||
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | storefront/boto/ec2/connection.py | python | EC2Connection.create_key_pair | (self, key_name) | return self.get_object('CreateKeyPair', params, KeyPair) | Create a new key pair for your account.
This will create the key pair within the region you
are currently connected to.
:type key_name: string
:param key_name: The name of the new keypair
:rtype: :class:`boto.ec2.keypair.KeyPair`
:return: The newly created :class:`boto.... | Create a new key pair for your account.
This will create the key pair within the region you
are currently connected to. | [
"Create",
"a",
"new",
"key",
"pair",
"for",
"your",
"account",
".",
"This",
"will",
"create",
"the",
"key",
"pair",
"within",
"the",
"region",
"you",
"are",
"currently",
"connected",
"to",
"."
] | def create_key_pair(self, key_name):
"""
Create a new key pair for your account.
This will create the key pair within the region you
are currently connected to.
:type key_name: string
:param key_name: The name of the new keypair
:rtype: :class:`boto.ec2.keypair.... | [
"def",
"create_key_pair",
"(",
"self",
",",
"key_name",
")",
":",
"params",
"=",
"{",
"'KeyName'",
":",
"key_name",
"}",
"return",
"self",
".",
"get_object",
"(",
"'CreateKeyPair'",
",",
"params",
",",
"KeyPair",
")"
] | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/storefront/boto/ec2/connection.py#L1215-L1230 | |
kivy/kivy-designer | 20343184a28c2851faf0c1ab451d0286d147a441 | tools/pep8checker/pep8.py | python | Checker.check_physical | (self, line) | Run all physical checks on a raw input line. | Run all physical checks on a raw input line. | [
"Run",
"all",
"physical",
"checks",
"on",
"a",
"raw",
"input",
"line",
"."
] | def check_physical(self, line):
"""
Run all physical checks on a raw input line.
"""
self.physical_line = line
if self.indent_char is None and line[:1] in WHITESPACE:
self.indent_char = line[0]
for name, check, argument_names in self._physical_checks:
... | [
"def",
"check_physical",
"(",
"self",
",",
"line",
")",
":",
"self",
".",
"physical_line",
"=",
"line",
"if",
"self",
".",
"indent_char",
"is",
"None",
"and",
"line",
"[",
":",
"1",
"]",
"in",
"WHITESPACE",
":",
"self",
".",
"indent_char",
"=",
"line",... | https://github.com/kivy/kivy-designer/blob/20343184a28c2851faf0c1ab451d0286d147a441/tools/pep8checker/pep8.py#L1218-L1229 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AdminServer/appscale/admin/base_handler.py | python | BaseHandler.authenticate_access_token | (self, headers, project_id, ua_client) | Method to go through Access Token authentication.
Args:
headers: The headers associated with the request.
project_id: The project that the user wants to access.
ua_client: A UA Client, used to see if the user can access the project.
Raises:
CustomHTTPError specified in called function. | Method to go through Access Token authentication.
Args:
headers: The headers associated with the request.
project_id: The project that the user wants to access.
ua_client: A UA Client, used to see if the user can access the project.
Raises:
CustomHTTPError specified in called function. | [
"Method",
"to",
"go",
"through",
"Access",
"Token",
"authentication",
".",
"Args",
":",
"headers",
":",
"The",
"headers",
"associated",
"with",
"the",
"request",
".",
"project_id",
":",
"The",
"project",
"that",
"the",
"user",
"wants",
"to",
"access",
".",
... | def authenticate_access_token(self, headers, project_id, ua_client):
""" Method to go through Access Token authentication.
Args:
headers: The headers associated with the request.
project_id: The project that the user wants to access.
ua_client: A UA Client, used to see if the user can access t... | [
"def",
"authenticate_access_token",
"(",
"self",
",",
"headers",
",",
"project_id",
",",
"ua_client",
")",
":",
"try",
":",
"token",
"=",
"headers",
"[",
"'Authorization'",
"]",
".",
"split",
"(",
")",
"[",
"1",
"]",
"except",
"IndexError",
":",
"raise",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AdminServer/appscale/admin/base_handler.py#L48-L78 | ||
karmab/kcli | fff2a2632841f54d9346b437821585df0ec659d7 | kvirt/providers/sampleprovider.py | python | Kbase.update_iso | (self, name, iso) | return | :param name:
:param iso:
:return: | [] | def update_iso(self, name, iso):
"""
:param name:
:param iso:
:return:
"""
print("not implemented")
return | [
"def",
"update_iso",
"(",
"self",
",",
"name",
",",
"iso",
")",
":",
"print",
"(",
"\"not implemented\"",
")",
"return"
] | https://github.com/karmab/kcli/blob/fff2a2632841f54d9346b437821585df0ec659d7/kvirt/providers/sampleprovider.py#L344-L352 | ||
faif/python-patterns | 2a469f48cbeeaaecab7c5c76d86266cd26b7a30b | patterns/structural/adapter.py | python | Adapter.__init__ | (self, obj: T, **adapted_methods: Callable) | We set the adapted methods in the object's dict. | We set the adapted methods in the object's dict. | [
"We",
"set",
"the",
"adapted",
"methods",
"in",
"the",
"object",
"s",
"dict",
"."
] | def __init__(self, obj: T, **adapted_methods: Callable):
"""We set the adapted methods in the object's dict."""
self.obj = obj
self.__dict__.update(adapted_methods) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
":",
"T",
",",
"*",
"*",
"adapted_methods",
":",
"Callable",
")",
":",
"self",
".",
"obj",
"=",
"obj",
"self",
".",
"__dict__",
".",
"update",
"(",
"adapted_methods",
")"
] | https://github.com/faif/python-patterns/blob/2a469f48cbeeaaecab7c5c76d86266cd26b7a30b/patterns/structural/adapter.py#L77-L80 | ||
TryCatchHCF/DumpsterFire | 43b46a274663ff694763db6e627975e160bc3597 | FireModules/Websurfing/tor_project_org.py | python | tor_project_org.GetParameters | ( self ) | return "" | [] | def GetParameters( self ):
return "" | [
"def",
"GetParameters",
"(",
"self",
")",
":",
"return",
"\"\""
] | https://github.com/TryCatchHCF/DumpsterFire/blob/43b46a274663ff694763db6e627975e160bc3597/FireModules/Websurfing/tor_project_org.py#L42-L43 | |||
TensorMSA/tensormsa | c36b565159cd934533636429add3c7d7263d622b | master/workflow/data/workflow_data_text.py | python | WorkFlowDataText.get_src_type | (self) | return self.conf.get('source_type') | :param nnid:
:param wfver:
:param node:
:return: | [] | def get_src_type(self):
"""
:param nnid:
:param wfver:
:param node:
:return:
"""
if ('conf' in self.__dict__):
self.conf = self.get_step_source()
return self.conf.get('source_type') | [
"def",
"get_src_type",
"(",
"self",
")",
":",
"if",
"(",
"'conf'",
"in",
"self",
".",
"__dict__",
")",
":",
"self",
".",
"conf",
"=",
"self",
".",
"get_step_source",
"(",
")",
"return",
"self",
".",
"conf",
".",
"get",
"(",
"'source_type'",
")"
] | https://github.com/TensorMSA/tensormsa/blob/c36b565159cd934533636429add3c7d7263d622b/master/workflow/data/workflow_data_text.py#L66-L76 | ||
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/bs4/element.py | python | Tag._should_pretty_print | (self, indent_level) | return (
indent_level is not None and
(self.name not in HTMLAwareEntitySubstitution.preformatted_tags
or self._is_xml)) | Should this tag be pretty-printed? | Should this tag be pretty-printed? | [
"Should",
"this",
"tag",
"be",
"pretty",
"-",
"printed?"
] | def _should_pretty_print(self, indent_level):
"""Should this tag be pretty-printed?"""
return (
indent_level is not None and
(self.name not in HTMLAwareEntitySubstitution.preformatted_tags
or self._is_xml)) | [
"def",
"_should_pretty_print",
"(",
"self",
",",
"indent_level",
")",
":",
"return",
"(",
"indent_level",
"is",
"not",
"None",
"and",
"(",
"self",
".",
"name",
"not",
"in",
"HTMLAwareEntitySubstitution",
".",
"preformatted_tags",
"or",
"self",
".",
"_is_xml",
... | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/bs4/element.py#L995-L1000 | |
ClusterLabs/pcs | 1f225199e02c8d20456bb386f4c913c3ff21ac78 | pcs/lib/sbd.py | python | atb_has_to_be_enabled | (
service_manager: ServiceManagerInterface,
corosync_conf_facade: CorosyncConfFacade,
node_number_modifier: int = 0,
) | return (
not corosync_conf_facade.is_enabled_auto_tie_breaker()
and is_auto_tie_breaker_needed(
service_manager, corosync_conf_facade, node_number_modifier
)
) | Return True whenever quorum option auto tie breaker has to be enabled for
proper working of SBD fencing. False if it's not needed or it is already
enabled.
service_manager --
corosync_conf_facade --
node_number_modifier -- this value vill be added to current number of nodes.
This can be use... | Return True whenever quorum option auto tie breaker has to be enabled for
proper working of SBD fencing. False if it's not needed or it is already
enabled. | [
"Return",
"True",
"whenever",
"quorum",
"option",
"auto",
"tie",
"breaker",
"has",
"to",
"be",
"enabled",
"for",
"proper",
"working",
"of",
"SBD",
"fencing",
".",
"False",
"if",
"it",
"s",
"not",
"needed",
"or",
"it",
"is",
"already",
"enabled",
"."
] | def atb_has_to_be_enabled(
service_manager: ServiceManagerInterface,
corosync_conf_facade: CorosyncConfFacade,
node_number_modifier: int = 0,
) -> bool:
"""
Return True whenever quorum option auto tie breaker has to be enabled for
proper working of SBD fencing. False if it's not needed or it is ... | [
"def",
"atb_has_to_be_enabled",
"(",
"service_manager",
":",
"ServiceManagerInterface",
",",
"corosync_conf_facade",
":",
"CorosyncConfFacade",
",",
"node_number_modifier",
":",
"int",
"=",
"0",
",",
")",
"->",
"bool",
":",
"return",
"(",
"not",
"corosync_conf_facade"... | https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/lib/sbd.py#L82-L103 | |
bert-nmt/bert-nmt | fcb616d28091ac23c9c16f30e6870fe90b8576d6 | fairseq/models/transformer.py | python | TransformerS2Encoder.forward | (self, src_tokens, src_lengths, bert_encoder_out) | return {
'encoder_out': x, # T x B x C
'encoder_padding_mask': encoder_padding_mask, # B x T
} | Args:
src_tokens (LongTensor): tokens in the source language of shape
`(batch, src_len)`
src_lengths (torch.LongTensor): lengths of each source sentence of
shape `(batch)`
Returns:
dict:
- **encoder_out** (Tensor): the last enc... | Args:
src_tokens (LongTensor): tokens in the source language of shape
`(batch, src_len)`
src_lengths (torch.LongTensor): lengths of each source sentence of
shape `(batch)` | [
"Args",
":",
"src_tokens",
"(",
"LongTensor",
")",
":",
"tokens",
"in",
"the",
"source",
"language",
"of",
"shape",
"(",
"batch",
"src_len",
")",
"src_lengths",
"(",
"torch",
".",
"LongTensor",
")",
":",
"lengths",
"of",
"each",
"source",
"sentence",
"of",... | def forward(self, src_tokens, src_lengths, bert_encoder_out):
"""
Args:
src_tokens (LongTensor): tokens in the source language of shape
`(batch, src_len)`
src_lengths (torch.LongTensor): lengths of each source sentence of
shape `(batch)`
R... | [
"def",
"forward",
"(",
"self",
",",
"src_tokens",
",",
"src_lengths",
",",
"bert_encoder_out",
")",
":",
"# embed tokens and positions",
"x",
"=",
"self",
".",
"embed_scale",
"*",
"self",
".",
"embed_tokens",
"(",
"src_tokens",
")",
"if",
"self",
".",
"embed_p... | https://github.com/bert-nmt/bert-nmt/blob/fcb616d28091ac23c9c16f30e6870fe90b8576d6/fairseq/models/transformer.py#L668-L707 | |
google/containerregistry | 8a11dc8c53003ecf5b72ffaf035ba280109356ac | client/v2_2/docker_session_.py | python | Push.upload | (self,
image,
use_digest = False) | Upload the layers of the given image.
Args:
image: the image to upload.
use_digest: use the manifest digest (i.e. not tag) as the image reference. | Upload the layers of the given image. | [
"Upload",
"the",
"layers",
"of",
"the",
"given",
"image",
"."
] | def upload(self,
image,
use_digest = False):
"""Upload the layers of the given image.
Args:
image: the image to upload.
use_digest: use the manifest digest (i.e. not tag) as the image reference.
"""
# If the manifest (by digest) exists, then avoid N layer existence... | [
"def",
"upload",
"(",
"self",
",",
"image",
",",
"use_digest",
"=",
"False",
")",
":",
"# If the manifest (by digest) exists, then avoid N layer existence",
"# checks (they must exist).",
"if",
"self",
".",
"_manifest_exists",
"(",
"image",
")",
":",
"if",
"isinstance",... | https://github.com/google/containerregistry/blob/8a11dc8c53003ecf5b72ffaf035ba280109356ac/client/v2_2/docker_session_.py#L286-L324 | ||
ahkab/ahkab | 1e8939194b689909b8184ce7eba478b485ff9e3a | ahkab/diode.py | python | diode.get_op_info | (self, ports_v_v) | return op_keys, op_info | Information regarding the Operating Point (OP)
**Parameters:**
ports_v : list of lists
The parameter is to be set to ``[[v]]``, where ``v`` is the voltage
applied to the diode terminals.
**Returns:**
op_keys : list of strings
The labels correspondi... | Information regarding the Operating Point (OP) | [
"Information",
"regarding",
"the",
"Operating",
"Point",
"(",
"OP",
")"
] | def get_op_info(self, ports_v_v):
"""Information regarding the Operating Point (OP)
**Parameters:**
ports_v : list of lists
The parameter is to be set to ``[[v]]``, where ``v`` is the voltage
applied to the diode terminals.
**Returns:**
op_keys : list ... | [
"def",
"get_op_info",
"(",
"self",
",",
"ports_v_v",
")",
":",
"vn1n2",
"=",
"float",
"(",
"ports_v_v",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"idiode",
"=",
"self",
".",
"i",
"(",
"0",
",",
"(",
"vn1n2",
",",
")",
")",
"gmdiode",
"=",
"self",
".",... | https://github.com/ahkab/ahkab/blob/1e8939194b689909b8184ce7eba478b485ff9e3a/ahkab/diode.py#L207-L230 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/views/debug.py | python | get_exception_reporter_filter | (request) | [] | def get_exception_reporter_filter(request):
global default_exception_reporter_filter
if default_exception_reporter_filter is None:
# Load the default filter for the first time and cache it.
modpath = settings.DEFAULT_EXCEPTION_REPORTER_FILTER
modname, classname = modpath.rsplit('.', 1)
... | [
"def",
"get_exception_reporter_filter",
"(",
"request",
")",
":",
"global",
"default_exception_reporter_filter",
"if",
"default_exception_reporter_filter",
"is",
"None",
":",
"# Load the default filter for the first time and cache it.",
"modpath",
"=",
"settings",
".",
"DEFAULT_E... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/views/debug.py#L75-L93 | ||||
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/source_space.py | python | _write_source_spaces_to_fid | (fid, src, verbose=None) | Write the source spaces to a FIF file.
Parameters
----------
fid : file descriptor
An open file descriptor.
src : list
The list of source spaces.
%(verbose)s | Write the source spaces to a FIF file. | [
"Write",
"the",
"source",
"spaces",
"to",
"a",
"FIF",
"file",
"."
] | def _write_source_spaces_to_fid(fid, src, verbose=None):
"""Write the source spaces to a FIF file.
Parameters
----------
fid : file descriptor
An open file descriptor.
src : list
The list of source spaces.
%(verbose)s
"""
for s in src:
logger.info(' Write a so... | [
"def",
"_write_source_spaces_to_fid",
"(",
"fid",
",",
"src",
",",
"verbose",
"=",
"None",
")",
":",
"for",
"s",
"in",
"src",
":",
"logger",
".",
"info",
"(",
"' Write a source space...'",
")",
"start_block",
"(",
"fid",
",",
"FIFF",
".",
"FIFFB_MNE_SOURC... | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/source_space.py#L981-L998 | ||
awslabs/aws-servicebroker | c301912e7df3a2f09a9c34d3ae7ffe67c55aa3a0 | sample-apps/rds/sample-app/src/bottle.py | python | Router.add | (self, rule, method, target, name=None) | Add a new rule or replace the target for an existing rule. | Add a new rule or replace the target for an existing rule. | [
"Add",
"a",
"new",
"rule",
"or",
"replace",
"the",
"target",
"for",
"an",
"existing",
"rule",
"."
] | def add(self, rule, method, target, name=None):
''' Add a new rule or replace the target for an existing rule. '''
anons = 0 # Number of anonymous wildcards found
keys = [] # Names of keys
pattern = '' # Regular expression pattern with named groups
filters = [... | [
"def",
"add",
"(",
"self",
",",
"rule",
",",
"method",
",",
"target",
",",
"name",
"=",
"None",
")",
":",
"anons",
"=",
"0",
"# Number of anonymous wildcards found",
"keys",
"=",
"[",
"]",
"# Names of keys",
"pattern",
"=",
"''",
"# Regular expression pattern ... | https://github.com/awslabs/aws-servicebroker/blob/c301912e7df3a2f09a9c34d3ae7ffe67c55aa3a0/sample-apps/rds/sample-app/src/bottle.py#L318-L386 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/Flashpoint/Integrations/Flashpoint/Flashpoint.py | python | get_post_context | (resp) | return post_ec | Prepare context data for forum post
:param resp: forum post api response
:return: dict object | Prepare context data for forum post | [
"Prepare",
"context",
"data",
"for",
"forum",
"post"
] | def get_post_context(resp):
"""
Prepare context data for forum post
:param resp: forum post api response
:return: dict object
"""
post_ec = {
'PostId': resp['id'],
'PublishedAt': resp.get('published_at', ''),
'Url': resp.get('url', ''),
'PlatformUrl': resp.get('p... | [
"def",
"get_post_context",
"(",
"resp",
")",
":",
"post_ec",
"=",
"{",
"'PostId'",
":",
"resp",
"[",
"'id'",
"]",
",",
"'PublishedAt'",
":",
"resp",
".",
"get",
"(",
"'published_at'",
",",
"''",
")",
",",
"'Url'",
":",
"resp",
".",
"get",
"(",
"'url'... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Flashpoint/Integrations/Flashpoint/Flashpoint.py#L393-L410 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/registry/models/versioned_remote_process_group.py | python | VersionedRemoteProcessGroup.name | (self) | return self._name | Gets the name of this VersionedRemoteProcessGroup.
The component's name
:return: The name of this VersionedRemoteProcessGroup.
:rtype: str | Gets the name of this VersionedRemoteProcessGroup.
The component's name | [
"Gets",
"the",
"name",
"of",
"this",
"VersionedRemoteProcessGroup",
".",
"The",
"component",
"s",
"name"
] | def name(self):
"""
Gets the name of this VersionedRemoteProcessGroup.
The component's name
:return: The name of this VersionedRemoteProcessGroup.
:rtype: str
"""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/registry/models/versioned_remote_process_group.py#L155-L163 | |
python/mypy | 17850b3bd77ae9efb5d21f656c4e4e05ac48d894 | mypy/stubdoc.py | python | DocStringParser.add_token | (self, token: tokenize.TokenInfo) | Process next token from the token stream. | Process next token from the token stream. | [
"Process",
"next",
"token",
"from",
"the",
"token",
"stream",
"."
] | def add_token(self, token: tokenize.TokenInfo) -> None:
"""Process next token from the token stream."""
if (token.type == tokenize.NAME and token.string == self.function_name and
self.state[-1] == STATE_INIT):
self.state.append(STATE_FUNCTION_NAME)
elif (token.type =... | [
"def",
"add_token",
"(",
"self",
",",
"token",
":",
"tokenize",
".",
"TokenInfo",
")",
"->",
"None",
":",
"if",
"(",
"token",
".",
"type",
"==",
"tokenize",
".",
"NAME",
"and",
"token",
".",
"string",
"==",
"self",
".",
"function_name",
"and",
"self",
... | https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/stubdoc.py#L89-L189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.