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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/plugin.py | python | PrefsPlugin.remove | (self) | [] | def remove (self):
if self.notebook:
self.notebook.remove_page(self.page_no) | [
"def",
"remove",
"(",
"self",
")",
":",
"if",
"self",
".",
"notebook",
":",
"self",
".",
"notebook",
".",
"remove_page",
"(",
"self",
".",
"page_no",
")"
] | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugin.py#L610-L612 | ||||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/motech/dhis2/entities_helpers.py | python | generate_value | (requests, attr_id, generator_params, case_trigger_info) | return response.json()["value"] | Sends a request to DHIS2 to generate a value for a generated
attribute, like a unique ID. DHIS2 may require parameters to
generate the value. Returns the value.
Example value source::
{
"case_property": "dhis2_unique_id",
"is_generated": True,
"generator_params"... | Sends a request to DHIS2 to generate a value for a generated
attribute, like a unique ID. DHIS2 may require parameters to
generate the value. Returns the value. | [
"Sends",
"a",
"request",
"to",
"DHIS2",
"to",
"generate",
"a",
"value",
"for",
"a",
"generated",
"attribute",
"like",
"a",
"unique",
"ID",
".",
"DHIS2",
"may",
"require",
"parameters",
"to",
"generate",
"the",
"value",
".",
"Returns",
"the",
"value",
"."
] | def generate_value(requests, attr_id, generator_params, case_trigger_info):
"""
Sends a request to DHIS2 to generate a value for a generated
attribute, like a unique ID. DHIS2 may require parameters to
generate the value. Returns the value.
Example value source::
{
"case_proper... | [
"def",
"generate_value",
"(",
"requests",
",",
"attr_id",
",",
"generator_params",
",",
"case_trigger_info",
")",
":",
"params",
"=",
"{",
"name",
":",
"get_value",
"(",
"vsc",
",",
"case_trigger_info",
")",
"for",
"name",
",",
"vsc",
"in",
"generator_params",... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/motech/dhis2/entities_helpers.py#L373-L397 | |
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/FreeBSD/x86_64/ucs4/cryptography/x509/base.py | python | CertificateBuilder.public_key | (self, key) | return CertificateBuilder(
self._issuer_name, self._subject_name, key,
self._serial_number, self._not_valid_before,
self._not_valid_after, self._extensions
) | Sets the requestor's public key (as found in the signing request). | Sets the requestor's public key (as found in the signing request). | [
"Sets",
"the",
"requestor",
"s",
"public",
"key",
"(",
"as",
"found",
"in",
"the",
"signing",
"request",
")",
"."
] | def public_key(self, key):
"""
Sets the requestor's public key (as found in the signing request).
"""
if not isinstance(key, (dsa.DSAPublicKey, rsa.RSAPublicKey,
ec.EllipticCurvePublicKey)):
raise TypeError('Expecting one of DSAPublicKey, RSAPu... | [
"def",
"public_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"not",
"isinstance",
"(",
"key",
",",
"(",
"dsa",
".",
"DSAPublicKey",
",",
"rsa",
".",
"RSAPublicKey",
",",
"ec",
".",
"EllipticCurvePublicKey",
")",
")",
":",
"raise",
"TypeError",
"(",
"'... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/FreeBSD/x86_64/ucs4/cryptography/x509/base.py#L418-L432 | |
perdy/flama | 8c429eaa909ccb2cbcd1cd09dcf50da73af2f00e | flama/injection.py | python | Injector.resolve | (self, func) | return kwargs, consts, steps | Inspects a function and creates a resolution list of all components needed to run it. returning
:param func: function to resolve.
:return: the keyword arguments, consts for that function and the steps to resolve all components. | Inspects a function and creates a resolution list of all components needed to run it. returning | [
"Inspects",
"a",
"function",
"and",
"creates",
"a",
"resolution",
"list",
"of",
"all",
"components",
"needed",
"to",
"run",
"it",
".",
"returning"
] | def resolve(self, func) -> typing.Tuple[typing.Dict, typing.Dict, typing.List]:
"""
Inspects a function and creates a resolution list of all components needed to run it. returning
:param func: function to resolve.
:return: the keyword arguments, consts for that function and the steps to... | [
"def",
"resolve",
"(",
"self",
",",
"func",
")",
"->",
"typing",
".",
"Tuple",
"[",
"typing",
".",
"Dict",
",",
"typing",
".",
"Dict",
",",
"typing",
".",
"List",
"]",
":",
"seen_state",
"=",
"set",
"(",
"self",
".",
"initial",
")",
"steps",
"=",
... | https://github.com/perdy/flama/blob/8c429eaa909ccb2cbcd1cd09dcf50da73af2f00e/flama/injection.py#L121-L143 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/sloane_functions.py | python | A000961.__init__ | (self) | r"""
Prime powers
INPUT:
- ``n`` -- non negative integer
OUTPUT:
- ``integer`` -- function value
EXAMPLES::
sage: a = sloane.A000961;a
Prime powers.
sage: a(0)
Traceback (most recent call last):
...
... | r"""
Prime powers | [
"r",
"Prime",
"powers"
] | def __init__(self):
r"""
Prime powers
INPUT:
- ``n`` -- non negative integer
OUTPUT:
- ``integer`` -- function value
EXAMPLES::
sage: a = sloane.A000961;a
Prime powers.
sage: a(0)
Traceback (most recent call la... | [
"def",
"__init__",
"(",
"self",
")",
":",
"SloaneSequence",
".",
"__init__",
"(",
"self",
",",
"offset",
"=",
"1",
")",
"self",
".",
"_b",
"=",
"[",
"1",
"]",
"self",
".",
"_n",
"=",
"2"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/sloane_functions.py#L3555-L3588 | ||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/modules/network/installation.py | python | NetworkInstallationTask._copy_file_to_root | (self, root, config_file, overwrite=False, follow_symlinks=True) | Copy the file to target system.
:param root: path to the root of the target system
:type root: str
:param config_file: path of the file
:type config_file: str
:param overwrite: overwrite existing configuration file
:type overwrite: bool | Copy the file to target system. | [
"Copy",
"the",
"file",
"to",
"target",
"system",
"."
] | def _copy_file_to_root(self, root, config_file, overwrite=False, follow_symlinks=True):
"""Copy the file to target system.
:param root: path to the root of the target system
:type root: str
:param config_file: path of the file
:type config_file: str
:param overwrite: ove... | [
"def",
"_copy_file_to_root",
"(",
"self",
",",
"root",
",",
"config_file",
",",
"overwrite",
"=",
"False",
",",
"follow_symlinks",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config_file",
")",
":",
"return",
"fpath",
"=",... | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/network/installation.py#L230-L247 | ||
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/parted3/fs_module.py | python | get_uuid | (part) | return "" | Get partition UUID | Get partition UUID | [
"Get",
"partition",
"UUID"
] | def get_uuid(part):
""" Get partition UUID """
info = get_info(part)
if "UUID" in info.keys():
return info['UUID']
logging.error("Can't get partition %s UUID", part)
return "" | [
"def",
"get_uuid",
"(",
"part",
")",
":",
"info",
"=",
"get_info",
"(",
"part",
")",
"if",
"\"UUID\"",
"in",
"info",
".",
"keys",
"(",
")",
":",
"return",
"info",
"[",
"'UUID'",
"]",
"logging",
".",
"error",
"(",
"\"Can't get partition %s UUID\"",
",",
... | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/parted3/fs_module.py#L52-L58 | |
isnowfy/pydown | 71ecc891868cd2a34b7e5fe662c99474f2d0fd7f | pygments/lexers/text.py | python | TexLexer.analyse_text | (text) | [] | def analyse_text(text):
for start in ("\\documentclass", "\\input", "\\documentstyle",
"\\relax"):
if text[:len(start)] == start:
return True | [
"def",
"analyse_text",
"(",
"text",
")",
":",
"for",
"start",
"in",
"(",
"\"\\\\documentclass\"",
",",
"\"\\\\input\"",
",",
"\"\\\\documentstyle\"",
",",
"\"\\\\relax\"",
")",
":",
"if",
"text",
"[",
":",
"len",
"(",
"start",
")",
"]",
"==",
"start",
":",... | https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/pygments/lexers/text.py#L449-L453 | ||||
Droidtown/ArticutAPI | ee415bb30c9722a85334d54d7015d5ad3870205f | ArticutAPI.py | python | Articut.getContentWordLIST | (self, parseResultDICT, indexWithPOS=True) | return self.POS.getContentWordLIST(parseResultDICT, indexWithPOS) | 取出斷詞結果中的實詞 (content word)。
每個句子內的實詞為一個 list。 | 取出斷詞結果中的實詞 (content word)。
每個句子內的實詞為一個 list。 | [
"取出斷詞結果中的實詞",
"(",
"content",
"word",
")",
"。",
"每個句子內的實詞為一個",
"list。"
] | def getContentWordLIST(self, parseResultDICT, indexWithPOS=True):
'''
取出斷詞結果中的實詞 (content word)。
每個句子內的實詞為一個 list。
'''
return self.POS.getContentWordLIST(parseResultDICT, indexWithPOS) | [
"def",
"getContentWordLIST",
"(",
"self",
",",
"parseResultDICT",
",",
"indexWithPOS",
"=",
"True",
")",
":",
"return",
"self",
".",
"POS",
".",
"getContentWordLIST",
"(",
"parseResultDICT",
",",
"indexWithPOS",
")"
] | https://github.com/Droidtown/ArticutAPI/blob/ee415bb30c9722a85334d54d7015d5ad3870205f/ArticutAPI.py#L250-L255 | |
mit-han-lab/data-efficient-gans | 6858275f08f43a33026844c8c2ac4e703e8a07ba | DiffAugment-biggan-cifar/eval.py | python | run_eval | (config) | [] | def run_eval(config):
# update config (see train.py for explanation)
config['resolution'] = utils.imsize_dict[config['dataset']]
config['n_classes'] = utils.nclass_dict[config['dataset']]
config['G_activation'] = utils.activation_dict[config['G_nl']]
config['D_activation'] = utils.activation_dict[co... | [
"def",
"run_eval",
"(",
"config",
")",
":",
"# update config (see train.py for explanation)",
"config",
"[",
"'resolution'",
"]",
"=",
"utils",
".",
"imsize_dict",
"[",
"config",
"[",
"'dataset'",
"]",
"]",
"config",
"[",
"'n_classes'",
"]",
"=",
"utils",
".",
... | https://github.com/mit-han-lab/data-efficient-gans/blob/6858275f08f43a33026844c8c2ac4e703e8a07ba/DiffAugment-biggan-cifar/eval.py#L11-L49 | ||||
9miao/Firefly | fd2795b8c26de6ab63bbec23d11f18c3dfb39a50 | gfirefly/netconnect/protoc.py | python | LiberateFactory.doConnectionMade | (self,conn) | 当连接建立时的处理 | 当连接建立时的处理 | [
"当连接建立时的处理"
] | def doConnectionMade(self,conn):
'''当连接建立时的处理'''
pass | [
"def",
"doConnectionMade",
"(",
"self",
",",
"conn",
")",
":",
"pass"
] | https://github.com/9miao/Firefly/blob/fd2795b8c26de6ab63bbec23d11f18c3dfb39a50/gfirefly/netconnect/protoc.py#L86-L88 | ||
nedbat/coveragepy | d004b18a1ad59ec89b89c96c03a789a55cc51693 | coverage/control.py | python | Coverage.current | (cls) | Get the latest started `Coverage` instance, if any.
Returns: a `Coverage` instance, or None.
.. versionadded:: 5.0 | Get the latest started `Coverage` instance, if any. | [
"Get",
"the",
"latest",
"started",
"Coverage",
"instance",
"if",
"any",
"."
] | def current(cls):
"""Get the latest started `Coverage` instance, if any.
Returns: a `Coverage` instance, or None.
.. versionadded:: 5.0
"""
if cls._instances:
return cls._instances[-1]
else:
return None | [
"def",
"current",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"_instances",
":",
"return",
"cls",
".",
"_instances",
"[",
"-",
"1",
"]",
"else",
":",
"return",
"None"
] | https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/control.py#L90-L101 | ||
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/alignment/base.py | python | CorpusAligner.ctms_to_textgrids_non_mp | (self) | Parse CTM files to TextGrids without using multiprocessing | Parse CTM files to TextGrids without using multiprocessing | [
"Parse",
"CTM",
"files",
"to",
"TextGrids",
"without",
"using",
"multiprocessing"
] | def ctms_to_textgrids_non_mp(self) -> None:
"""
Parse CTM files to TextGrids without using multiprocessing
"""
self.log_debug("Not using multiprocessing for TextGrid export")
export_errors = {}
w_args = self.word_ctm_arguments()
p_args = self.phone_ctm_arguments()... | [
"def",
"ctms_to_textgrids_non_mp",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"log_debug",
"(",
"\"Not using multiprocessing for TextGrid export\"",
")",
"export_errors",
"=",
"{",
"}",
"w_args",
"=",
"self",
".",
"word_ctm_arguments",
"(",
")",
"p_args",
"... | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/alignment/base.py#L372-L433 | ||
brannondorsey/PassGAN | 5eeca016908d3ecc7a78a2d2b66154cb61d19f44 | tflib/__init__.py | python | delete_param_aliases | () | [] | def delete_param_aliases():
_param_aliases.clear() | [
"def",
"delete_param_aliases",
"(",
")",
":",
"_param_aliases",
".",
"clear",
"(",
")"
] | https://github.com/brannondorsey/PassGAN/blob/5eeca016908d3ecc7a78a2d2b66154cb61d19f44/tflib/__init__.py#L47-L48 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/core/cache/backends/base.py | python | BaseCache.clear | (self) | Remove *all* values from the cache at once. | Remove *all* values from the cache at once. | [
"Remove",
"*",
"all",
"*",
"values",
"from",
"the",
"cache",
"at",
"once",
"."
] | def clear(self):
"""Remove *all* values from the cache at once."""
raise NotImplementedError | [
"def",
"clear",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/core/cache/backends/base.py#L183-L185 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/base64.py | python | urlsafe_b64encode | (s) | return b64encode(s).translate(_urlsafe_encode_translation) | Encode a byte string using a url-safe Base64 alphabet.
s is the byte string to encode. The encoded byte string is
returned. The alphabet uses '-' instead of '+' and '_' instead of
'/'. | Encode a byte string using a url-safe Base64 alphabet. | [
"Encode",
"a",
"byte",
"string",
"using",
"a",
"url",
"-",
"safe",
"Base64",
"alphabet",
"."
] | def urlsafe_b64encode(s):
"""Encode a byte string using a url-safe Base64 alphabet.
s is the byte string to encode. The encoded byte string is
returned. The alphabet uses '-' instead of '+' and '_' instead of
'/'.
"""
return b64encode(s).translate(_urlsafe_encode_translation) | [
"def",
"urlsafe_b64encode",
"(",
"s",
")",
":",
"return",
"b64encode",
"(",
"s",
")",
".",
"translate",
"(",
"_urlsafe_encode_translation",
")"
] | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/base64.py#L114-L121 | |
aws/sagemaker-python-sdk | 9d259b316f7f43838c16f35c10e98a110b56735b | src/sagemaker/session.py | python | Session.wait_for_compilation_job | (self, job, poll=5) | return desc | Wait for an Amazon SageMaker Neo compilation job to complete.
Args:
job (str): Name of the compilation job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value from the ``DescribeCompilationJob`` API.
Raises:
... | Wait for an Amazon SageMaker Neo compilation job to complete. | [
"Wait",
"for",
"an",
"Amazon",
"SageMaker",
"Neo",
"compilation",
"job",
"to",
"complete",
"."
] | def wait_for_compilation_job(self, job, poll=5):
"""Wait for an Amazon SageMaker Neo compilation job to complete.
Args:
job (str): Name of the compilation job to wait for.
poll (int): Polling interval in seconds (default: 5).
Returns:
(dict): Return value fr... | [
"def",
"wait_for_compilation_job",
"(",
"self",
",",
"job",
",",
"poll",
"=",
"5",
")",
":",
"desc",
"=",
"_wait_until",
"(",
"lambda",
":",
"_compilation_job_status",
"(",
"self",
".",
"sagemaker_client",
",",
"job",
")",
",",
"poll",
")",
"self",
".",
... | https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/session.py#L3212-L3227 | |
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/vector/stemmer.py | python | case_sensitive | (stem, word) | return "".join(ch) | Applies the letter case of the word to the stem:
Ponies => Poni | Applies the letter case of the word to the stem:
Ponies => Poni | [
"Applies",
"the",
"letter",
"case",
"of",
"the",
"word",
"to",
"the",
"stem",
":",
"Ponies",
"=",
">",
"Poni"
] | def case_sensitive(stem, word):
""" Applies the letter case of the word to the stem:
Ponies => Poni
"""
ch = []
for i in range(len(stem)):
if word[i] == word[i].upper():
ch.append(stem[i].upper())
else:
ch.append(stem[i])
return "".join(ch) | [
"def",
"case_sensitive",
"(",
"stem",
",",
"word",
")",
":",
"ch",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"stem",
")",
")",
":",
"if",
"word",
"[",
"i",
"]",
"==",
"word",
"[",
"i",
"]",
".",
"upper",
"(",
")",
":",
"ch"... | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/vector/stemmer.py#L319-L329 | |
ninuxorg/nodeshot | 2466f0a55f522b2696026f196436ce7ba3f1e5c6 | nodeshot/networking/links/models/link.py | python | Link.ensure | (self, status, cost) | ensure link properties correspond to the specified ones
perform save operation only if necessary | ensure link properties correspond to the specified ones
perform save operation only if necessary | [
"ensure",
"link",
"properties",
"correspond",
"to",
"the",
"specified",
"ones",
"perform",
"save",
"operation",
"only",
"if",
"necessary"
] | def ensure(self, status, cost):
"""
ensure link properties correspond to the specified ones
perform save operation only if necessary
"""
changed = False
status_id = LINK_STATUS[status]
if self.status != status_id:
self.status = status_id
ch... | [
"def",
"ensure",
"(",
"self",
",",
"status",
",",
"cost",
")",
":",
"changed",
"=",
"False",
"status_id",
"=",
"LINK_STATUS",
"[",
"status",
"]",
"if",
"self",
".",
"status",
"!=",
"status_id",
":",
"self",
".",
"status",
"=",
"status_id",
"changed",
"... | https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/networking/links/models/link.py#L280-L294 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | openedx/core/lib/blockstore_api/methods.py | python | write_draft_file | (draft_uuid, path, contents) | Create or overwrite the file at 'path' in the specified draft with the given
contents. To delete a file, pass contents=None.
If you don't know the draft's UUID, look it up using
get_or_create_bundle_draft()
Does not return anything. | Create or overwrite the file at 'path' in the specified draft with the given
contents. To delete a file, pass contents=None. | [
"Create",
"or",
"overwrite",
"the",
"file",
"at",
"path",
"in",
"the",
"specified",
"draft",
"with",
"the",
"given",
"contents",
".",
"To",
"delete",
"a",
"file",
"pass",
"contents",
"=",
"None",
"."
] | def write_draft_file(draft_uuid, path, contents):
"""
Create or overwrite the file at 'path' in the specified draft with the given
contents. To delete a file, pass contents=None.
If you don't know the draft's UUID, look it up using
get_or_create_bundle_draft()
Does not return anything.
"""... | [
"def",
"write_draft_file",
"(",
"draft_uuid",
",",
"path",
",",
"contents",
")",
":",
"api_request",
"(",
"'patch'",
",",
"api_url",
"(",
"'drafts'",
",",
"str",
"(",
"draft_uuid",
")",
")",
",",
"json",
"=",
"{",
"'files'",
":",
"{",
"path",
":",
"enc... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/lib/blockstore_api/methods.py#L373-L387 | ||
Textualize/rich | d39626143036188cb2c9e1619e836540f5b627f8 | rich/__main__.py | python | make_test_card | () | return table | Get a renderable that demonstrates a number of features. | Get a renderable that demonstrates a number of features. | [
"Get",
"a",
"renderable",
"that",
"demonstrates",
"a",
"number",
"of",
"features",
"."
] | def make_test_card() -> Table:
"""Get a renderable that demonstrates a number of features."""
table = Table.grid(padding=1, pad_edge=True)
table.title = "Rich features"
table.add_column("Feature", no_wrap=True, justify="center", style="bold red")
table.add_column("Demonstration")
color_table = ... | [
"def",
"make_test_card",
"(",
")",
"->",
"Table",
":",
"table",
"=",
"Table",
".",
"grid",
"(",
"padding",
"=",
"1",
",",
"pad_edge",
"=",
"True",
")",
"table",
".",
"title",
"=",
"\"Rich features\"",
"table",
".",
"add_column",
"(",
"\"Feature\"",
",",
... | https://github.com/Textualize/rich/blob/d39626143036188cb2c9e1619e836540f5b627f8/rich/__main__.py#L39-L207 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/logic/boolalg.py | python | Equivalent.args | (self) | return tuple(ordered(self._argset)) | [] | def args(self):
return tuple(ordered(self._argset)) | [
"def",
"args",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"ordered",
"(",
"self",
".",
"_argset",
")",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/logic/boolalg.py#L714-L715 | |||
dpgaspar/Flask-AppBuilder | 557249f33b66d02a48c1322ef21324b815abe18e | flask_appbuilder/security/registerviews.py | python | BaseRegisterUser.add_registration | (self, username, first_name, last_name, email, password="") | Add a registration request for the user.
:rtype : RegisterUser | Add a registration request for the user. | [
"Add",
"a",
"registration",
"request",
"for",
"the",
"user",
"."
] | def add_registration(self, username, first_name, last_name, email, password=""):
"""
Add a registration request for the user.
:rtype : RegisterUser
"""
register_user = self.appbuilder.sm.add_register_user(
username, first_name, last_name, email, password
... | [
"def",
"add_registration",
"(",
"self",
",",
"username",
",",
"first_name",
",",
"last_name",
",",
"email",
",",
"password",
"=",
"\"\"",
")",
":",
"register_user",
"=",
"self",
".",
"appbuilder",
".",
"sm",
".",
"add_register_user",
"(",
"username",
",",
... | https://github.com/dpgaspar/Flask-AppBuilder/blob/557249f33b66d02a48c1322ef21324b815abe18e/flask_appbuilder/security/registerviews.py#L102-L118 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/templatetags/i18n.py | python | do_translate | (parser, token) | return TranslateNode(message_string, noop, asvar, message_context) | This will mark a string for translation and will
translate the string for the current language.
Usage::
{% trans "this is a test" %}
This will mark the string for translation so it will
be pulled out by mark-messages.py into the .po files
and will run the string through the translation en... | This will mark a string for translation and will
translate the string for the current language. | [
"This",
"will",
"mark",
"a",
"string",
"for",
"translation",
"and",
"will",
"translate",
"the",
"string",
"for",
"the",
"current",
"language",
"."
] | def do_translate(parser, token):
"""
This will mark a string for translation and will
translate the string for the current language.
Usage::
{% trans "this is a test" %}
This will mark the string for translation so it will
be pulled out by mark-messages.py into the .po files
and w... | [
"def",
"do_translate",
"(",
"parser",
",",
"token",
")",
":",
"bits",
"=",
"token",
".",
"split_contents",
"(",
")",
"if",
"len",
"(",
"bits",
")",
"<",
"2",
":",
"raise",
"TemplateSyntaxError",
"(",
"\"'%s' takes at least one argument\"",
"%",
"bits",
"[",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/templatetags/i18n.py#L328-L416 | |
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/misc/sessions.py | python | SessionManager._save_all | (self, *, only_window=None, with_private=False) | return data | Get a dict with data for all windows/tabs. | Get a dict with data for all windows/tabs. | [
"Get",
"a",
"dict",
"with",
"data",
"for",
"all",
"windows",
"/",
"tabs",
"."
] | def _save_all(self, *, only_window=None, with_private=False):
"""Get a dict with data for all windows/tabs."""
data: _JsonType = {'windows': []}
if only_window is not None:
winlist: Iterable[int] = [only_window]
else:
winlist = objreg.window_registry
for ... | [
"def",
"_save_all",
"(",
"self",
",",
"*",
",",
"only_window",
"=",
"None",
",",
"with_private",
"=",
"False",
")",
":",
"data",
":",
"_JsonType",
"=",
"{",
"'windows'",
":",
"[",
"]",
"}",
"if",
"only_window",
"is",
"not",
"None",
":",
"winlist",
":... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/misc/sessions.py#L267-L300 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/gdata/youtube/service.py | python | YouTubeService.GetYouTubeVideoCommentFeed | (self, uri=None, video_id=None) | return self.Get(
uri, converter=gdata.youtube.YouTubeVideoCommentFeedFromString) | Retrieve a YouTubeVideoCommentFeed.
Either a uri or a video_id must be provided.
Args:
uri: An optional string representing the URI of the comment feed that
is to be retrieved.
video_id: An optional string representing the ID of the video for which
to retrieve the comment feed.... | Retrieve a YouTubeVideoCommentFeed. | [
"Retrieve",
"a",
"YouTubeVideoCommentFeed",
"."
] | def GetYouTubeVideoCommentFeed(self, uri=None, video_id=None):
"""Retrieve a YouTubeVideoCommentFeed.
Either a uri or a video_id must be provided.
Args:
uri: An optional string representing the URI of the comment feed that
is to be retrieved.
video_id: An optional string representing... | [
"def",
"GetYouTubeVideoCommentFeed",
"(",
"self",
",",
"uri",
"=",
"None",
",",
"video_id",
"=",
"None",
")",
":",
"if",
"uri",
"is",
"None",
"and",
"video_id",
"is",
"None",
":",
"raise",
"YouTubeError",
"(",
"'You must provide at least a uri or a video_id '",
... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/gdata/youtube/service.py#L241-L265 | |
cms-dev/cms | 0401c5336b34b1731736045da4877fef11889274 | cms/grading/scoring.py | python | _task_score_max | (score_details_tokened) | return max_score | Compute score using the "max" score mode.
This was used in IOI 2013-2016. The score of a participant on a task is
the maximum score amongst all submissions (not yet computed scores count
as 0.0).
score_details_tokened ([(float|None, object|None, bool)]): a tuple for each
submission of the user... | Compute score using the "max" score mode. | [
"Compute",
"score",
"using",
"the",
"max",
"score",
"mode",
"."
] | def _task_score_max(score_details_tokened):
"""Compute score using the "max" score mode.
This was used in IOI 2013-2016. The score of a participant on a task is
the maximum score amongst all submissions (not yet computed scores count
as 0.0).
score_details_tokened ([(float|None, object|None, bool)... | [
"def",
"_task_score_max",
"(",
"score_details_tokened",
")",
":",
"max_score",
"=",
"0.0",
"for",
"score",
",",
"_",
",",
"_",
"in",
"score_details_tokened",
":",
"if",
"score",
"is",
"not",
"None",
":",
"max_score",
"=",
"max",
"(",
"max_score",
",",
"sco... | https://github.com/cms-dev/cms/blob/0401c5336b34b1731736045da4877fef11889274/cms/grading/scoring.py#L257-L277 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/solids/group.py | python | Group.__init__ | (self) | Add empty lists. | Add empty lists. | [
"Add",
"empty",
"lists",
"."
] | def __init__(self):
"Add empty lists."
dictionary.Dictionary.__init__(self)
self.matrix4X4 = matrix.Matrix() | [
"def",
"__init__",
"(",
"self",
")",
":",
"dictionary",
".",
"Dictionary",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"matrix4X4",
"=",
"matrix",
".",
"Matrix",
"(",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/solids/group.py#L43-L46 | ||
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/src/common/spelling/spellcheck.py | python | SpellChecker.Suggest | (self,word,count=None) | return [self._decode(s) for s in suggestions] | Return a list of suggested replacement words if the word is spelled incorrectly
Returns an empty list if the word is correctly spelled | Return a list of suggested replacement words if the word is spelled incorrectly
Returns an empty list if the word is correctly spelled | [
"Return",
"a",
"list",
"of",
"suggested",
"replacement",
"words",
"if",
"the",
"word",
"is",
"spelled",
"incorrectly",
"Returns",
"an",
"empty",
"list",
"if",
"the",
"word",
"is",
"correctly",
"spelled"
] | def Suggest(self,word,count=None):
"""
Return a list of suggested replacement words if the word is spelled incorrectly
Returns an empty list if the word is correctly spelled
"""
if self.spellengine is None:
return []
if not word:
return [... | [
"def",
"Suggest",
"(",
"self",
",",
"word",
",",
"count",
"=",
"None",
")",
":",
"if",
"self",
".",
"spellengine",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"not",
"word",
":",
"return",
"[",
"]",
"if",
"not",
"count",
":",
"count",
"=",
"self... | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/common/spelling/spellcheck.py#L412-L432 | |
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | lib/floodfill.py | python | FloodFillArguments.skip_empty_dst | (self) | return (
self.lock_alpha or self.mode in [
myplib.CombineSourceAtop,
myplib.CombineDestinationOut,
myplib.CombineDestinationIn,
]
) | If true, compositing to empty tiles does nothing | If true, compositing to empty tiles does nothing | [
"If",
"true",
"compositing",
"to",
"empty",
"tiles",
"does",
"nothing"
] | def skip_empty_dst(self):
"""If true, compositing to empty tiles does nothing"""
return (
self.lock_alpha or self.mode in [
myplib.CombineSourceAtop,
myplib.CombineDestinationOut,
myplib.CombineDestinationIn,
]
) | [
"def",
"skip_empty_dst",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"lock_alpha",
"or",
"self",
".",
"mode",
"in",
"[",
"myplib",
".",
"CombineSourceAtop",
",",
"myplib",
".",
"CombineDestinationOut",
",",
"myplib",
".",
"CombineDestinationIn",
",",
... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/floodfill.py#L246-L254 | |
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | external/linux32/lib/python2.6/site-packages/matplotlib/ticker.py | python | LogFormatter.format_data_short | (self,value) | return '%1.3g'%value | return a short formatted string representation of a number | return a short formatted string representation of a number | [
"return",
"a",
"short",
"formatted",
"string",
"representation",
"of",
"a",
"number"
] | def format_data_short(self,value):
'return a short formatted string representation of a number'
return '%1.3g'%value | [
"def",
"format_data_short",
"(",
"self",
",",
"value",
")",
":",
"return",
"'%1.3g'",
"%",
"value"
] | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/ticker.py#L526-L528 | |
Yelp/paasta | 6c08c04a577359509575c794b973ea84d72accf9 | paasta_tools/marathon_tools.py | python | MarathonServiceConfig.get_healthchecks | (
self, service_namespace_config: ServiceNamespaceConfig
) | return healthchecks | Returns a list of healthchecks per `the Marathon docs`_.
If you have an http service, it uses the default endpoint that smartstack uses.
(/status currently)
Otherwise these do *not* use the same thresholds as smartstack in order to not
produce a negative feedback loop, where mesos aggr... | Returns a list of healthchecks per `the Marathon docs`_. | [
"Returns",
"a",
"list",
"of",
"healthchecks",
"per",
"the",
"Marathon",
"docs",
"_",
"."
] | def get_healthchecks(
self, service_namespace_config: ServiceNamespaceConfig
) -> List[HealthcheckDict]:
"""Returns a list of healthchecks per `the Marathon docs`_.
If you have an http service, it uses the default endpoint that smartstack uses.
(/status currently)
Otherwise... | [
"def",
"get_healthchecks",
"(",
"self",
",",
"service_namespace_config",
":",
"ServiceNamespaceConfig",
")",
"->",
"List",
"[",
"HealthcheckDict",
"]",
":",
"mode",
"=",
"self",
".",
"get_healthcheck_mode",
"(",
"service_namespace_config",
")",
"graceperiodseconds",
"... | https://github.com/Yelp/paasta/blob/6c08c04a577359509575c794b973ea84d72accf9/paasta_tools/marathon_tools.py#L768-L848 | |
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/gui/main_window.py | python | MainWindow.register_column_editor_extension | (self, extension) | Register column editor extension | Register column editor extension | [
"Register",
"column",
"editor",
"extension"
] | def register_column_editor_extension(self, extension):
"""Register column editor extension"""
self.column_editor_extensions.append(extension) | [
"def",
"register_column_editor_extension",
"(",
"self",
",",
"extension",
")",
":",
"self",
".",
"column_editor_extensions",
".",
"append",
"(",
"extension",
")"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/gui/main_window.py#L2273-L2275 | ||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | script.yandex.tvguide/source.py | python | Channel.__init__ | (self, id, title, logo = None) | [] | def __init__(self, id, title, logo = None):
self.id = id
self.title = title
self.logo = logo | [
"def",
"__init__",
"(",
"self",
",",
"id",
",",
"title",
",",
"logo",
"=",
"None",
")",
":",
"self",
".",
"id",
"=",
"id",
"self",
".",
"title",
"=",
"title",
"self",
".",
"logo",
"=",
"logo"
] | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.yandex.tvguide/source.py#L17-L20 | ||||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/ogl/composit.py | python | CompositeShape.OnEndDragLeft | (self, x, y, keys = 0, attachment = 0) | The end drag left handler. | The end drag left handler. | [
"The",
"end",
"drag",
"left",
"handler",
"."
] | def OnEndDragLeft(self, x, y, keys = 0, attachment = 0):
"""The end drag left handler."""
if self._canvas.HasCapture():
self._canvas.ReleaseMouse()
if not self._draggable:
if self._parent:
self._parent.GetEventHandler().OnEndDragLeft(x, y, keys, 0)
... | [
"def",
"OnEndDragLeft",
"(",
"self",
",",
"x",
",",
"y",
",",
"keys",
"=",
"0",
",",
"attachment",
"=",
"0",
")",
":",
"if",
"self",
".",
"_canvas",
".",
"HasCapture",
"(",
")",
":",
"self",
".",
"_canvas",
".",
"ReleaseMouse",
"(",
")",
"if",
"n... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/ogl/composit.py#L501-L524 | ||
ChineseGLUE/ChineseGLUE | 1591b85cf5427c2ff60f718d359ecb71d2b44879 | baselines/models/ernie/run_squad.py | python | read_squad_examples | (input_file, is_training) | return examples | Read a SQuAD json file into a list of SquadExample. | Read a SQuAD json file into a list of SquadExample. | [
"Read",
"a",
"SQuAD",
"json",
"file",
"into",
"a",
"list",
"of",
"SquadExample",
"."
] | def read_squad_examples(input_file, is_training):
"""Read a SQuAD json file into a list of SquadExample."""
with tf.gfile.Open(input_file, "r") as reader:
input_data = json.load(reader)["data"]
def is_whitespace(c):
if c == " " or c == "\t" or c == "\r" or c == "\n" or ord(c) == 0x202F:
return True... | [
"def",
"read_squad_examples",
"(",
"input_file",
",",
"is_training",
")",
":",
"with",
"tf",
".",
"gfile",
".",
"Open",
"(",
"input_file",
",",
"\"r\"",
")",
"as",
"reader",
":",
"input_data",
"=",
"json",
".",
"load",
"(",
"reader",
")",
"[",
"\"data\""... | https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/ernie/run_squad.py#L227-L306 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_adm_ca_server_cert.py | python | CAServerCert.__init__ | (self,
config,
verbose=False) | Constructor for oadm ca | Constructor for oadm ca | [
"Constructor",
"for",
"oadm",
"ca"
] | def __init__(self,
config,
verbose=False):
''' Constructor for oadm ca '''
super(CAServerCert, self).__init__(None, config.kubeconfig, verbose)
self.config = config
self.verbose = verbose | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"verbose",
"=",
"False",
")",
":",
"super",
"(",
"CAServerCert",
",",
"self",
")",
".",
"__init__",
"(",
"None",
",",
"config",
".",
"kubeconfig",
",",
"verbose",
")",
"self",
".",
"config",
"=",
"c... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_adm_ca_server_cert.py#L1504-L1510 | ||
Bitmessage/PyBitmessage | 97612b049e0453867d6d90aa628f8e7b007b4d85 | src/bitmessageqt/messageview.py | python | MessageView.setContent | (self, data) | Set message content from argument | Set message content from argument | [
"Set",
"message",
"content",
"from",
"argument"
] | def setContent(self, data):
"""Set message content from argument"""
self.html = SafeHTMLParser()
self.html.reset()
self.html.reset_safe()
self.html.allow_picture = True
self.html.feed(data)
self.html.close()
self.showPlain() | [
"def",
"setContent",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"html",
"=",
"SafeHTMLParser",
"(",
")",
"self",
".",
"html",
".",
"reset",
"(",
")",
"self",
".",
"html",
".",
"reset_safe",
"(",
")",
"self",
".",
"html",
".",
"allow_picture",
... | https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/bitmessageqt/messageview.py#L155-L163 | ||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | numpy/core/__init__.py | python | int8.__rand__ | (self, *args, **kwargs) | Return value&self. | Return value&self. | [
"Return",
"value&self",
"."
] | def __rand__(self, *args, **kwargs): # real signature unknown
""" Return value&self. """
pass | [
"def",
"__rand__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# real signature unknown",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L1221-L1223 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/conch/insults/insults.py | python | ITerminalTransport.shiftOut | () | Activate the G1 character set. | Activate the G1 character set. | [
"Activate",
"the",
"G1",
"character",
"set",
"."
] | def shiftOut():
"""Activate the G1 character set.
""" | [
"def",
"shiftOut",
"(",
")",
":"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/conch/insults/insults.py#L165-L167 | ||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/requests/packages/urllib3/util/ssl_.py | python | assert_fingerprint | (cert, fingerprint) | Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons. | Checks if given fingerprint matches the supplied certificate. | [
"Checks",
"if",
"given",
"fingerprint",
"matches",
"the",
"supplied",
"certificate",
"."
] | def assert_fingerprint(cert, fingerprint):
"""
Checks if given fingerprint matches the supplied certificate.
:param cert:
Certificate as bytes object.
:param fingerprint:
Fingerprint as string of hexdigits, can be interspersed by colons.
"""
fingerprint = fingerprint.replace(':... | [
"def",
"assert_fingerprint",
"(",
"cert",
",",
"fingerprint",
")",
":",
"fingerprint",
"=",
"fingerprint",
".",
"replace",
"(",
"':'",
",",
"''",
")",
".",
"lower",
"(",
")",
"digest_length",
"=",
"len",
"(",
"fingerprint",
")",
"hashfunc",
"=",
"HASHFUNC_... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/requests/packages/urllib3/util/ssl_.py#L148-L172 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/utils/safestring.py | python | mark_safe | (s) | return SafeString(str(s)) | Explicitly mark a string as safe for (HTML) output purposes. The returned
object can be used everywhere a string or unicode object is appropriate.
Can be called multiple times on a single string. | Explicitly mark a string as safe for (HTML) output purposes. The returned
object can be used everywhere a string or unicode object is appropriate. | [
"Explicitly",
"mark",
"a",
"string",
"as",
"safe",
"for",
"(",
"HTML",
")",
"output",
"purposes",
".",
"The",
"returned",
"object",
"can",
"be",
"used",
"everywhere",
"a",
"string",
"or",
"unicode",
"object",
"is",
"appropriate",
"."
] | def mark_safe(s):
"""
Explicitly mark a string as safe for (HTML) output purposes. The returned
object can be used everywhere a string or unicode object is appropriate.
Can be called multiple times on a single string.
"""
if isinstance(s, SafeData):
return s
if isinstance(s, str) or... | [
"def",
"mark_safe",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"SafeData",
")",
":",
"return",
"s",
"if",
"isinstance",
"(",
"s",
",",
"str",
")",
"or",
"(",
"isinstance",
"(",
"s",
",",
"Promise",
")",
"and",
"s",
".",
"_delegate_str",... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/utils/safestring.py#L89-L102 | |
ni/nidaqmx-python | 62fc6b48cbbb330fe1bcc9aedadc86610a1269b6 | nidaqmx/_task_modules/channels/ci_channel.py | python | CIChannel.ci_pulse_ticks_dig_fltr_timebase_rate | (self, val) | [] | def ci_pulse_ticks_dig_fltr_timebase_rate(self, val):
cfunc = lib_importer.windll.DAQmxSetCIPulseTicksDigFltrTimebaseRate
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task... | [
"def",
"ci_pulse_ticks_dig_fltr_timebase_rate",
"(",
"self",
",",
"val",
")",
":",
"cfunc",
"=",
"lib_importer",
".",
"windll",
".",
"DAQmxSetCIPulseTicksDigFltrTimebaseRate",
"if",
"cfunc",
".",
"argtypes",
"is",
"None",
":",
"with",
"cfunc",
".",
"arglock",
":",... | https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/ci_channel.py#L7529-L7540 | ||||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/auth/__init__.py | python | create_auth_code | (hass, client_id: str, credential: Credentials) | return hass.data[DOMAIN](client_id, credential) | Create an authorization code to fetch tokens. | Create an authorization code to fetch tokens. | [
"Create",
"an",
"authorization",
"code",
"to",
"fetch",
"tokens",
"."
] | def create_auth_code(hass, client_id: str, credential: Credentials) -> str:
"""Create an authorization code to fetch tokens."""
return hass.data[DOMAIN](client_id, credential) | [
"def",
"create_auth_code",
"(",
"hass",
",",
"client_id",
":",
"str",
",",
"credential",
":",
"Credentials",
")",
"->",
"str",
":",
"return",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"(",
"client_id",
",",
"credential",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/auth/__init__.py#L185-L187 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/future/backports/urllib/request.py | python | URLopener.retrieve | (self, url, filename=None, reporthook=None, data=None) | return result | retrieve(url) returns (filename, headers) for a local object
or (tempfilename, headers) for a remote object. | retrieve(url) returns (filename, headers) for a local object
or (tempfilename, headers) for a remote object. | [
"retrieve",
"(",
"url",
")",
"returns",
"(",
"filename",
"headers",
")",
"for",
"a",
"local",
"object",
"or",
"(",
"tempfilename",
"headers",
")",
"for",
"a",
"remote",
"object",
"."
] | def retrieve(self, url, filename=None, reporthook=None, data=None):
"""retrieve(url) returns (filename, headers) for a local object
or (tempfilename, headers) for a remote object."""
url = unwrap(to_bytes(url))
if self.tempcache and url in self.tempcache:
return self.tempcach... | [
"def",
"retrieve",
"(",
"self",
",",
"url",
",",
"filename",
"=",
"None",
",",
"reporthook",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"url",
"=",
"unwrap",
"(",
"to_bytes",
"(",
"url",
")",
")",
"if",
"self",
".",
"tempcache",
"and",
"url",... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/backports/urllib/request.py#L1722-L1784 | |
amymcgovern/pyparrot | bf4775ec1199b282e4edde1e4a8e018dcc8725e0 | pyparrot/utils/vlc.py | python | libvlc_set_app_id | (p_instance, id, version, icon) | return f(p_instance, id, version, icon) | Sets some meta-information about the application.
See also L{libvlc_set_user_agent}().
@param p_instance: LibVLC instance.
@param id: Java-style application identifier, e.g. "com.acme.foobar".
@param version: application version numbers, e.g. "1.2.3".
@param icon: application icon name, e.g. "foobar... | Sets some meta-information about the application.
See also L{libvlc_set_user_agent}(). | [
"Sets",
"some",
"meta",
"-",
"information",
"about",
"the",
"application",
".",
"See",
"also",
"L",
"{",
"libvlc_set_user_agent",
"}",
"()",
"."
] | def libvlc_set_app_id(p_instance, id, version, icon):
'''Sets some meta-information about the application.
See also L{libvlc_set_user_agent}().
@param p_instance: LibVLC instance.
@param id: Java-style application identifier, e.g. "com.acme.foobar".
@param version: application version numbers, e.g. ... | [
"def",
"libvlc_set_app_id",
"(",
"p_instance",
",",
"id",
",",
"version",
",",
"icon",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_set_app_id'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_set_app_id'",
",",
"(",
"(",
"1",
",",
"... | https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/utils/vlc.py#L4453-L4465 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/oozebane.py | python | OozebaneSkein.getAddBeforeStartupLines | (self, line) | return self.getLinearMoveWithFeedRate( self.operatingFeedRateMinute, location ) | Get and / or add before the startup lines. | Get and / or add before the startup lines. | [
"Get",
"and",
"/",
"or",
"add",
"before",
"the",
"startup",
"lines",
"."
] | def getAddBeforeStartupLines(self, line):
"Get and / or add before the startup lines."
distanceThreadBeginning = self.getDistanceToThreadBeginning()
if distanceThreadBeginning == None:
return line
splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
self.extruderInactiveLongEnough = False
self.isS... | [
"def",
"getAddBeforeStartupLines",
"(",
"self",
",",
"line",
")",
":",
"distanceThreadBeginning",
"=",
"self",
".",
"getDistanceToThreadBeginning",
"(",
")",
"if",
"distanceThreadBeginning",
"==",
"None",
":",
"return",
"line",
"splitLine",
"=",
"gcodec",
".",
"ge... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/oozebane.py#L202-L225 | |
jrzaurin/pytorch-widedeep | 8b4c3a8acbf06b385c821d7111b1139a16b4f480 | pytorch_widedeep/models/tabnet/_utils.py | python | create_explain_matrix | (model: WideDeep) | return csc_matrix(reducing_matrix) | Returns a sparse matrix used to compute the feature importances after
training
Parameters
----------
model: WideDeep
object of type ``WideDeep``
Examples
--------
>>> from pytorch_widedeep.models import TabNet, WideDeep
>>> from pytorch_widedeep.models.tabnet._utils import crea... | Returns a sparse matrix used to compute the feature importances after
training | [
"Returns",
"a",
"sparse",
"matrix",
"used",
"to",
"compute",
"the",
"feature",
"importances",
"after",
"training"
] | def create_explain_matrix(model: WideDeep) -> csc_matrix:
"""
Returns a sparse matrix used to compute the feature importances after
training
Parameters
----------
model: WideDeep
object of type ``WideDeep``
Examples
--------
>>> from pytorch_widedeep.models import TabNet, W... | [
"def",
"create_explain_matrix",
"(",
"model",
":",
"WideDeep",
")",
"->",
"csc_matrix",
":",
"(",
"embed_input",
",",
"column_idx",
",",
"embed_and_cont_dim",
",",
")",
"=",
"_extract_tabnet_params",
"(",
"model",
")",
"n_feat",
"=",
"len",
"(",
"column_idx",
... | https://github.com/jrzaurin/pytorch-widedeep/blob/8b4c3a8acbf06b385c821d7111b1139a16b4f480/pytorch_widedeep/models/tabnet/_utils.py#L7-L66 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/services/rest/newsapi/newsapi.py | python | NewsAPI.hacker_news | (api_key, max_articles, sort, reverse) | return NewsAPI._get_data(NewsAPI.HACKER_NEWS, api_key, max_articles, sort, reverse) | [] | def hacker_news(api_key, max_articles, sort, reverse):
return NewsAPI._get_data(NewsAPI.HACKER_NEWS, api_key, max_articles, sort, reverse) | [
"def",
"hacker_news",
"(",
"api_key",
",",
"max_articles",
",",
"sort",
",",
"reverse",
")",
":",
"return",
"NewsAPI",
".",
"_get_data",
"(",
"NewsAPI",
".",
"HACKER_NEWS",
",",
"api_key",
",",
"max_articles",
",",
"sort",
",",
"reverse",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/services/rest/newsapi/newsapi.py#L364-L365 | |||
ClusterLabs/pcs | 1f225199e02c8d20456bb386f4c913c3ff21ac78 | pcs/resource.py | python | _format_desc | (indentation, desc) | return output.rstrip() | Commandline options: no options | Commandline options: no options | [
"Commandline",
"options",
":",
"no",
"options"
] | def _format_desc(indentation, desc):
"""
Commandline options: no options
"""
desc = " ".join(desc.split())
dummy_rows, columns = utils.getTerminalSize()
columns = max(int(columns), 40)
afterindent = columns - indentation
if afterindent < 1:
afterindent = columns
output = ""
... | [
"def",
"_format_desc",
"(",
"indentation",
",",
"desc",
")",
":",
"desc",
"=",
"\" \"",
".",
"join",
"(",
"desc",
".",
"split",
"(",
")",
")",
"dummy_rows",
",",
"columns",
"=",
"utils",
".",
"getTerminalSize",
"(",
")",
"columns",
"=",
"max",
"(",
"... | https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/resource.py#L544-L564 | |
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbYingXiao.taobao_ump_tool_add | (
self,
content
) | return self._top_request(
"taobao.ump.tool.add",
{
"content": content
},
result_processor=lambda x: x["tool_id"]
) | 新增优惠工具
新增优惠工具。通过ump sdk来完成将积木块拼装成为工具的操作,再使用本接口上传优惠工具。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=10713
:param content: 工具内容,由sdk里面的MarketingTool生成的json字符串 | 新增优惠工具
新增优惠工具。通过ump sdk来完成将积木块拼装成为工具的操作,再使用本接口上传优惠工具。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=10713 | [
"新增优惠工具",
"新增优惠工具。通过ump",
"sdk来完成将积木块拼装成为工具的操作,再使用本接口上传优惠工具。",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"10713"
] | def taobao_ump_tool_add(
self,
content
):
"""
新增优惠工具
新增优惠工具。通过ump sdk来完成将积木块拼装成为工具的操作,再使用本接口上传优惠工具。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=10713
:param content: 工具内容,由sdk里面的MarketingTool生成的json字符串
"""
return self._top_re... | [
"def",
"taobao_ump_tool_add",
"(",
"self",
",",
"content",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"taobao.ump.tool.add\"",
",",
"{",
"\"content\"",
":",
"content",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"\"tool_id\"",... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L25409-L25426 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | is_type_ptr | (*args) | return _idaapi.is_type_ptr(*args) | is_type_ptr(t) -> bool | is_type_ptr(t) -> bool | [
"is_type_ptr",
"(",
"t",
")",
"-",
">",
"bool"
] | def is_type_ptr(*args):
"""
is_type_ptr(t) -> bool
"""
return _idaapi.is_type_ptr(*args) | [
"def",
"is_type_ptr",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"is_type_ptr",
"(",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L28310-L28314 | |
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | server/pulp/plugins/profiler.py | python | Profiler.update_profile | (self, consumer, content_type, profile, config) | return profile | Notification that the consumer has reported the installed unit
profile. The profiler has this opportunity to translate the
reported profile. If a profile cannot be translated, the profiler
should raise an appropriate exception. See: Profile Translation
examples in class documentation.... | Notification that the consumer has reported the installed unit
profile. The profiler has this opportunity to translate the
reported profile. If a profile cannot be translated, the profiler
should raise an appropriate exception. See: Profile Translation
examples in class documentation. | [
"Notification",
"that",
"the",
"consumer",
"has",
"reported",
"the",
"installed",
"unit",
"profile",
".",
"The",
"profiler",
"has",
"this",
"opportunity",
"to",
"translate",
"the",
"reported",
"profile",
".",
"If",
"a",
"profile",
"cannot",
"be",
"translated",
... | def update_profile(self, consumer, content_type, profile, config):
"""
Notification that the consumer has reported the installed unit
profile. The profiler has this opportunity to translate the
reported profile. If a profile cannot be translated, the profiler
should raise an ap... | [
"def",
"update_profile",
"(",
"self",
",",
"consumer",
",",
"content_type",
",",
"profile",
",",
"config",
")",
":",
"return",
"profile"
] | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/server/pulp/plugins/profiler.py#L97-L116 | |
JulianEberius/SublimePythonIDE | d70e40abc0c9f347af3204c7b910e0d6bfd6e459 | server/lib/python_all/jedi/evaluate/docstrings.py | python | _execute_types_in_stmt | (evaluator, stmt) | return chain.from_iterable(_execute_array_values(evaluator, d) for d in definitions) | Executing all types or general elements that we find in a statement. This
doesn't include tuple, list and dict literals, because the stuff they
contain is executed. (Used as type information). | Executing all types or general elements that we find in a statement. This
doesn't include tuple, list and dict literals, because the stuff they
contain is executed. (Used as type information). | [
"Executing",
"all",
"types",
"or",
"general",
"elements",
"that",
"we",
"find",
"in",
"a",
"statement",
".",
"This",
"doesn",
"t",
"include",
"tuple",
"list",
"and",
"dict",
"literals",
"because",
"the",
"stuff",
"they",
"contain",
"is",
"executed",
".",
"... | def _execute_types_in_stmt(evaluator, stmt):
"""
Executing all types or general elements that we find in a statement. This
doesn't include tuple, list and dict literals, because the stuff they
contain is executed. (Used as type information).
"""
definitions = evaluator.eval_element(stmt)
ret... | [
"def",
"_execute_types_in_stmt",
"(",
"evaluator",
",",
"stmt",
")",
":",
"definitions",
"=",
"evaluator",
".",
"eval_element",
"(",
"stmt",
")",
"return",
"chain",
".",
"from_iterable",
"(",
"_execute_array_values",
"(",
"evaluator",
",",
"d",
")",
"for",
"d"... | https://github.com/JulianEberius/SublimePythonIDE/blob/d70e40abc0c9f347af3204c7b910e0d6bfd6e459/server/lib/python_all/jedi/evaluate/docstrings.py#L150-L157 | |
aalto-speech/morfessor | 5314d3ebc1bea60b2145e96e0efaf8b21211af71 | morfessor/baseline.py | python | AnnotatedCorpusEncoding.set_count | (self, construction, count) | Set an initial count for each construction. Missing constructions
are penalized | Set an initial count for each construction. Missing constructions
are penalized | [
"Set",
"an",
"initial",
"count",
"for",
"each",
"construction",
".",
"Missing",
"constructions",
"are",
"penalized"
] | def set_count(self, construction, count):
"""Set an initial count for each construction. Missing constructions
are penalized
"""
annot_count = self.constructions[construction]
if count > 0:
self.logtokensum += annot_count * math.log(count)
else:
se... | [
"def",
"set_count",
"(",
"self",
",",
"construction",
",",
"count",
")",
":",
"annot_count",
"=",
"self",
".",
"constructions",
"[",
"construction",
"]",
"if",
"count",
">",
"0",
":",
"self",
".",
"logtokensum",
"+=",
"annot_count",
"*",
"math",
".",
"lo... | https://github.com/aalto-speech/morfessor/blob/5314d3ebc1bea60b2145e96e0efaf8b21211af71/morfessor/baseline.py#L1308-L1316 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/lti_provider/signature_validator.py | python | SignatureValidator.check_nonce | (self, nonce) | return nonce is not None and 0 < len(nonce) <= 64 | Verify that the nonce value that accompanies the OAuth signature is
valid. This method is concerned only with the structure of the nonce;
the validate_timestamp_and_nonce method will check that the nonce has
not been used within the specified time frame. This method signature is
required... | Verify that the nonce value that accompanies the OAuth signature is
valid. This method is concerned only with the structure of the nonce;
the validate_timestamp_and_nonce method will check that the nonce has
not been used within the specified time frame. This method signature is
required... | [
"Verify",
"that",
"the",
"nonce",
"value",
"that",
"accompanies",
"the",
"OAuth",
"signature",
"is",
"valid",
".",
"This",
"method",
"is",
"concerned",
"only",
"with",
"the",
"structure",
"of",
"the",
"nonce",
";",
"the",
"validate_timestamp_and_nonce",
"method"... | def check_nonce(self, nonce):
"""
Verify that the nonce value that accompanies the OAuth signature is
valid. This method is concerned only with the structure of the nonce;
the validate_timestamp_and_nonce method will check that the nonce has
not been used within the specified tim... | [
"def",
"check_nonce",
"(",
"self",
",",
"nonce",
")",
":",
"return",
"nonce",
"is",
"not",
"None",
"and",
"0",
"<",
"len",
"(",
"nonce",
")",
"<=",
"64"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/lti_provider/signature_validator.py#L45-L55 | |
certtools/intelmq | 7c1ab88b77bcbb30c7cabca5bb3525ad4aaac138 | intelmq/lib/bot.py | python | Bot.__handle_sigterm_signal | (self, signum: int, stack: Optional[object]) | Calls when a SIGTERM is received. Stops the bot. | Calls when a SIGTERM is received. Stops the bot. | [
"Calls",
"when",
"a",
"SIGTERM",
"is",
"received",
".",
"Stops",
"the",
"bot",
"."
] | def __handle_sigterm_signal(self, signum: int, stack: Optional[object]):
"""
Calls when a SIGTERM is received. Stops the bot.
"""
self.logger.info("Received SIGTERM.")
self.stop(exitcode=0) | [
"def",
"__handle_sigterm_signal",
"(",
"self",
",",
"signum",
":",
"int",
",",
"stack",
":",
"Optional",
"[",
"object",
"]",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Received SIGTERM.\"",
")",
"self",
".",
"stop",
"(",
"exitcode",
"=",
"0",
... | https://github.com/certtools/intelmq/blob/7c1ab88b77bcbb30c7cabca5bb3525ad4aaac138/intelmq/lib/bot.py#L255-L260 | ||
celery/celery | 95015a1d5a60d94d8e1e02da4b9cf16416c747e2 | celery/utils/timer2.py | python | Timer.__bool__ | (self) | return True | ``bool(timer)``. | ``bool(timer)``. | [
"bool",
"(",
"timer",
")",
"."
] | def __bool__(self):
"""``bool(timer)``."""
return True | [
"def",
"__bool__",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/celery/celery/blob/95015a1d5a60d94d8e1e02da4b9cf16416c747e2/celery/utils/timer2.py#L147-L149 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/traceback.py | python | FrameSummary.__init__ | (self, filename, lineno, name, *, lookup_line=True,
locals=None, line=None) | Construct a FrameSummary.
:param lookup_line: If True, `linecache` is consulted for the source
code line. Otherwise, the line will be looked up when first needed.
:param locals: If supplied the frame locals, which will be captured as
object representations.
:param line: ... | Construct a FrameSummary. | [
"Construct",
"a",
"FrameSummary",
"."
] | def __init__(self, filename, lineno, name, *, lookup_line=True,
locals=None, line=None):
"""Construct a FrameSummary.
:param lookup_line: If True, `linecache` is consulted for the source
code line. Otherwise, the line will be looked up when first needed.
:param locals: I... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"lineno",
",",
"name",
",",
"*",
",",
"lookup_line",
"=",
"True",
",",
"locals",
"=",
"None",
",",
"line",
"=",
"None",
")",
":",
"self",
".",
"filename",
"=",
"filename",
"self",
".",
"lineno",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/traceback.py#L259-L276 | ||
SebKuzminsky/pycam | 55e3129f518e470040e79bb00515b4bfcf36c172 | pycam/Gui/ControlsGTK.py | python | ParameterSection._update_widgets_visibility | (self, widget=None) | [] | def _update_widgets_visibility(self, widget=None):
# Hide and show labels (or other items) that share a row with a
# configured item (according to its visibility).
visibility_collector = []
for widget in self._widgets:
table_row = self._get_table_row_of_widget(widget.widget)
... | [
"def",
"_update_widgets_visibility",
"(",
"self",
",",
"widget",
"=",
"None",
")",
":",
"# Hide and show labels (or other items) that share a row with a",
"# configured item (according to its visibility).",
"visibility_collector",
"=",
"[",
"]",
"for",
"widget",
"in",
"self",
... | https://github.com/SebKuzminsky/pycam/blob/55e3129f518e470040e79bb00515b4bfcf36c172/pycam/Gui/ControlsGTK.py#L329-L349 | ||||
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | solutionbox/ml_workbench/tensorflow/transform.py | python | EmitAsBatchDoFn.process | (self, element) | [] | def process(self, element):
self._cached.append(element)
if len(self._cached) >= self._batch_size:
emit = self._cached
self._cached = []
yield emit | [
"def",
"process",
"(",
"self",
",",
"element",
")",
":",
"self",
".",
"_cached",
".",
"append",
"(",
"element",
")",
"if",
"len",
"(",
"self",
".",
"_cached",
")",
">=",
"self",
".",
"_batch_size",
":",
"emit",
"=",
"self",
".",
"_cached",
"self",
... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/solutionbox/ml_workbench/tensorflow/transform.py#L253-L258 | ||||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/idlelib/AutoCompleteWindow.py | python | AutoCompleteWindow._complete_string | (self, s) | return first_comp[:i] | Assuming that s is the prefix of a string in self.completions,
return the longest string which is a prefix of all the strings which
s is a prefix of them. If s is not a prefix of a string, return s. | Assuming that s is the prefix of a string in self.completions,
return the longest string which is a prefix of all the strings which
s is a prefix of them. If s is not a prefix of a string, return s. | [
"Assuming",
"that",
"s",
"is",
"the",
"prefix",
"of",
"a",
"string",
"in",
"self",
".",
"completions",
"return",
"the",
"longest",
"string",
"which",
"is",
"a",
"prefix",
"of",
"all",
"the",
"strings",
"which",
"s",
"is",
"a",
"prefix",
"of",
"them",
"... | def _complete_string(self, s):
"""Assuming that s is the prefix of a string in self.completions,
return the longest string which is a prefix of all the strings which
s is a prefix of them. If s is not a prefix of a string, return s."""
first = self._binary_search(s)
if self.compl... | [
"def",
"_complete_string",
"(",
"self",
",",
"s",
")",
":",
"first",
"=",
"self",
".",
"_binary_search",
"(",
"s",
")",
"if",
"self",
".",
"completions",
"[",
"first",
"]",
"[",
":",
"len",
"(",
"s",
")",
"]",
"!=",
"s",
":",
"# There is not even one... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/idlelib/AutoCompleteWindow.py#L82-L111 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/orm/session.py | python | _SessionClassMethods.close_all | (cls) | Close *all* sessions in memory. | Close *all* sessions in memory. | [
"Close",
"*",
"all",
"*",
"sessions",
"in",
"memory",
"."
] | def close_all(cls):
"""Close *all* sessions in memory."""
for sess in _sessions.values():
sess.close() | [
"def",
"close_all",
"(",
"cls",
")",
":",
"for",
"sess",
"in",
"_sessions",
".",
"values",
"(",
")",
":",
"sess",
".",
"close",
"(",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/orm/session.py#L52-L56 | ||
dragonbook/V2V-PoseNet-pytorch | 90045b61c45f18dc20b410e2de14bd22be55fe0e | src/v2v_util.py | python | discretize | (coord, cropped_size) | return (coord - min_normalized) / scale | [-1, 1] -> [0, cropped_size] | [-1, 1] -> [0, cropped_size] | [
"[",
"-",
"1",
"1",
"]",
"-",
">",
"[",
"0",
"cropped_size",
"]"
] | def discretize(coord, cropped_size):
'''[-1, 1] -> [0, cropped_size]'''
min_normalized = -1
max_normalized = 1
scale = (max_normalized - min_normalized) / cropped_size
return (coord - min_normalized) / scale | [
"def",
"discretize",
"(",
"coord",
",",
"cropped_size",
")",
":",
"min_normalized",
"=",
"-",
"1",
"max_normalized",
"=",
"1",
"scale",
"=",
"(",
"max_normalized",
"-",
"min_normalized",
")",
"/",
"cropped_size",
"return",
"(",
"coord",
"-",
"min_normalized",
... | https://github.com/dragonbook/V2V-PoseNet-pytorch/blob/90045b61c45f18dc20b410e2de14bd22be55fe0e/src/v2v_util.py#L5-L10 | |
chromium/web-page-replay | 472351e1122bb1beb936952c7e75ae58bf8a69f1 | adb_install_cert.py | python | AndroidCertInstaller._remove | (file_name) | Deletes file. | Deletes file. | [
"Deletes",
"file",
"."
] | def _remove(file_name):
"""Deletes file."""
if os.path.exists(file_name):
os.remove(file_name) | [
"def",
"_remove",
"(",
"file_name",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"file_name",
")",
":",
"os",
".",
"remove",
"(",
"file_name",
")"
] | https://github.com/chromium/web-page-replay/blob/472351e1122bb1beb936952c7e75ae58bf8a69f1/adb_install_cert.py#L129-L132 | ||
pvlib/pvlib-python | 1ab0eb20f9cd9fb9f7a0ddf35f81283f2648e34a | pvlib/pvsystem.py | python | PVSystem.i_from_v | (self, resistance_shunt, resistance_series, nNsVth, voltage,
saturation_current, photocurrent) | return i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
saturation_current, photocurrent) | Wrapper around the :py:func:`pvlib.pvsystem.i_from_v` function.
See :py:func:`pvsystem.i_from_v` for details | Wrapper around the :py:func:`pvlib.pvsystem.i_from_v` function. | [
"Wrapper",
"around",
"the",
":",
"py",
":",
"func",
":",
"pvlib",
".",
"pvsystem",
".",
"i_from_v",
"function",
"."
] | def i_from_v(self, resistance_shunt, resistance_series, nNsVth, voltage,
saturation_current, photocurrent):
"""Wrapper around the :py:func:`pvlib.pvsystem.i_from_v` function.
See :py:func:`pvsystem.i_from_v` for details
"""
return i_from_v(resistance_shunt, resistance_s... | [
"def",
"i_from_v",
"(",
"self",
",",
"resistance_shunt",
",",
"resistance_series",
",",
"nNsVth",
",",
"voltage",
",",
"saturation_current",
",",
"photocurrent",
")",
":",
"return",
"i_from_v",
"(",
"resistance_shunt",
",",
"resistance_series",
",",
"nNsVth",
",",... | https://github.com/pvlib/pvlib-python/blob/1ab0eb20f9cd9fb9f7a0ddf35f81283f2648e34a/pvlib/pvsystem.py#L935-L942 | |
project-alice-assistant/ProjectAlice | 9e0ba019643bdae0a5535c9fa4180739231dc361 | core/base/SkillManager.py | python | SkillManager.downloadSkills | (self, skills: Union[str, List[str]]) | return repositories | Clones skills. Existence of the skill online is checked
:param skills:
:return: Dict: a dict of created repositories | Clones skills. Existence of the skill online is checked
:param skills:
:return: Dict: a dict of created repositories | [
"Clones",
"skills",
".",
"Existence",
"of",
"the",
"skill",
"online",
"is",
"checked",
":",
"param",
"skills",
":",
":",
"return",
":",
"Dict",
":",
"a",
"dict",
"of",
"created",
"repositories"
] | def downloadSkills(self, skills: Union[str, List[str]]) -> Optional[Dict]:
"""
Clones skills. Existence of the skill online is checked
:param skills:
:return: Dict: a dict of created repositories
"""
if isinstance(skills, str):
skills = [skills]
repositories = dict()
for skillName in skills:
try... | [
"def",
"downloadSkills",
"(",
"self",
",",
"skills",
":",
"Union",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
")",
"->",
"Optional",
"[",
"Dict",
"]",
":",
"if",
"isinstance",
"(",
"skills",
",",
"str",
")",
":",
"skills",
"=",
"[",
"skills",
... | https://github.com/project-alice-assistant/ProjectAlice/blob/9e0ba019643bdae0a5535c9fa4180739231dc361/core/base/SkillManager.py#L410-L474 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_adm_registry.py | python | Service.find_external_ips | (self, inc_external_ip) | return val | find a specific external IP | find a specific external IP | [
"find",
"a",
"specific",
"external",
"IP"
] | def find_external_ips(self, inc_external_ip):
''' find a specific external IP '''
val = None
try:
idx = self.get_external_ips().index(inc_external_ip)
val = self.get_external_ips()[idx]
except ValueError:
pass
return val | [
"def",
"find_external_ips",
"(",
"self",
",",
"inc_external_ip",
")",
":",
"val",
"=",
"None",
"try",
":",
"idx",
"=",
"self",
".",
"get_external_ips",
"(",
")",
".",
"index",
"(",
"inc_external_ip",
")",
"val",
"=",
"self",
".",
"get_external_ips",
"(",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_registry.py#L2207-L2216 | |
DongjunLee/transformer-tensorflow | b6585fa7504f0f35327f2a3994dac7b06b6036f7 | data_loader.py | python | IteratorInitializerHook.__init__ | (self) | [] | def __init__(self):
super(IteratorInitializerHook, self).__init__()
self.iterator_initializer_func = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"IteratorInitializerHook",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"iterator_initializer_func",
"=",
"None"
] | https://github.com/DongjunLee/transformer-tensorflow/blob/b6585fa7504f0f35327f2a3994dac7b06b6036f7/data_loader.py#L24-L26 | ||||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/mako/codegen.py | python | _GenerateRenderMethod.write_def_decl | (self, node, identifiers) | write a locally-available callable referencing a top-level def | write a locally-available callable referencing a top-level def | [
"write",
"a",
"locally",
"-",
"available",
"callable",
"referencing",
"a",
"top",
"-",
"level",
"def"
] | def write_def_decl(self, node, identifiers):
"""write a locally-available callable referencing a top-level def"""
funcname = node.funcname
namedecls = node.get_argument_expressions()
nameargs = node.get_argument_expressions(include_defaults=False)
if not self.in_def and (
... | [
"def",
"write_def_decl",
"(",
"self",
",",
"node",
",",
"identifiers",
")",
":",
"funcname",
"=",
"node",
".",
"funcname",
"namedecls",
"=",
"node",
".",
"get_argument_expressions",
"(",
")",
"nameargs",
"=",
"node",
".",
"get_argument_expressions",
"(",
"incl... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/mako/codegen.py#L535-L550 | ||
floooh/fips | 5ce5aebfc7c69778cab03ef5f8830928f2bad6d4 | mod/tools/cmake.py | python | run_gen | (cfg, fips_dir, project_dir, build_dir, toolchain_path, defines) | return res == 0 | run cmake tool to generate build files
:param cfg: a fips config object
:param project_dir: absolute path to project (must have root CMakeLists.txt file)
:param build_dir: absolute path to build directory (where cmake files are generated)
:param toolchain: toolchain path or ... | run cmake tool to generate build files | [
"run",
"cmake",
"tool",
"to",
"generate",
"build",
"files"
] | def run_gen(cfg, fips_dir, project_dir, build_dir, toolchain_path, defines) :
"""run cmake tool to generate build files
:param cfg: a fips config object
:param project_dir: absolute path to project (must have root CMakeLists.txt file)
:param build_dir: absolute path to build direc... | [
"def",
"run_gen",
"(",
"cfg",
",",
"fips_dir",
",",
"project_dir",
",",
"build_dir",
",",
"toolchain_path",
",",
"defines",
")",
":",
"cmdLine",
"=",
"'cmake'",
"if",
"cfg",
"[",
"'generator'",
"]",
"!=",
"'Default'",
":",
"cmdLine",
"+=",
"' -G \"{}\"'",
... | https://github.com/floooh/fips/blob/5ce5aebfc7c69778cab03ef5f8830928f2bad6d4/mod/tools/cmake.py#L33-L67 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/requests/utils.py | python | guess_json_utf | (data) | return None | :rtype: str | :rtype: str | [
":",
"rtype",
":",
"str"
] | def guess_json_utf(data):
"""
:rtype: str
"""
# JSON always starts with two ASCII characters, so detection is as
# easy as counting the nulls and from their location and count
# determine the encoding. Also detect a BOM, if present.
sample = data[:4]
if sample in (codecs.BOM_UTF32_LE, co... | [
"def",
"guess_json_utf",
"(",
"data",
")",
":",
"# JSON always starts with two ASCII characters, so detection is as",
"# easy as counting the nulls and from their location and count",
"# determine the encoding. Also detect a BOM, if present.",
"sample",
"=",
"data",
"[",
":",
"4",
"]",... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/requests/utils.py#L697-L726 | |
karmab/kcli | fff2a2632841f54d9346b437821585df0ec659d7 | kvirt/krpc/kcli_pb2_grpc.py | python | KconfigServicer.delete_plan | (self, request, context) | Missing associated documentation comment in .proto file | Missing associated documentation comment in .proto file | [
"Missing",
"associated",
"documentation",
"comment",
"in",
".",
"proto",
"file"
] | def delete_plan(self, request, context):
"""Missing associated documentation comment in .proto file"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | [
"def",
"delete_plan",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"'Method not implemented!'",
")",
"raise",
"NotImplementedErro... | https://github.com/karmab/kcli/blob/fff2a2632841f54d9346b437821585df0ec659d7/kvirt/krpc/kcli_pb2_grpc.py#L978-L982 | ||
pavlov99/json-rpc | 00b24a9e811d9ca89ec3b1570195c881687bbef4 | jsonrpc/dispatcher.py | python | Dispatcher.add_method | (self, f=None, name=None) | return f | Add a method to the dispatcher.
Parameters
----------
f : callable
Callable to be added.
name : str, optional
Name to register (the default is function **f** name)
Notes
-----
When used as a decorator keeps callable object unmodified.
... | Add a method to the dispatcher. | [
"Add",
"a",
"method",
"to",
"the",
"dispatcher",
"."
] | def add_method(self, f=None, name=None):
""" Add a method to the dispatcher.
Parameters
----------
f : callable
Callable to be added.
name : str, optional
Name to register (the default is function **f** name)
Notes
-----
When used... | [
"def",
"add_method",
"(",
"self",
",",
"f",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"and",
"not",
"f",
":",
"return",
"functools",
".",
"partial",
"(",
"self",
".",
"add_method",
",",
"name",
"=",
"name",
")",
"self",
".",
... | https://github.com/pavlov99/json-rpc/blob/00b24a9e811d9ca89ec3b1570195c881687bbef4/jsonrpc/dispatcher.py#L70-L111 | |
rasterio/rasterio | a66f8731d30399ff6a6a640510139550792d4d2b | rasterio/env.py | python | Env.default_options | (cls) | return {
'GTIFF_IMPLICIT_JPEG_OVR': False,
"RASTERIO_ENV": True
} | Default configuration options
Parameters
----------
None
Returns
-------
dict | Default configuration options | [
"Default",
"configuration",
"options"
] | def default_options(cls):
"""Default configuration options
Parameters
----------
None
Returns
-------
dict
"""
return {
'GTIFF_IMPLICIT_JPEG_OVR': False,
"RASTERIO_ENV": True
} | [
"def",
"default_options",
"(",
"cls",
")",
":",
"return",
"{",
"'GTIFF_IMPLICIT_JPEG_OVR'",
":",
"False",
",",
"\"RASTERIO_ENV\"",
":",
"True",
"}"
] | https://github.com/rasterio/rasterio/blob/a66f8731d30399ff6a6a640510139550792d4d2b/rasterio/env.py#L95-L109 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/settings/views.py | python | ApiKeyView.column_names | (self) | return [
_("Name"),
_("API Key"),
_("Project"),
_("IP Allowlist"),
_("Created"),
_("Delete"),
] | [] | def column_names(self):
return [
_("Name"),
_("API Key"),
_("Project"),
_("IP Allowlist"),
_("Created"),
_("Delete"),
] | [
"def",
"column_names",
"(",
"self",
")",
":",
"return",
"[",
"_",
"(",
"\"Name\"",
")",
",",
"_",
"(",
"\"API Key\"",
")",
",",
"_",
"(",
"\"Project\"",
")",
",",
"_",
"(",
"\"IP Allowlist\"",
")",
",",
"_",
"(",
"\"Created\"",
")",
",",
"_",
"(",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/settings/views.py#L619-L627 | |||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/osp_gateway/invoice_service_client.py | python | InvoiceServiceClient.get_invoice | (self, osp_home_region, compartment_id, internal_invoice_id, **kwargs) | Returns an invoice by invoice id
:param str osp_home_region: (required)
The home region's public name of the logged in user.
:param str compartment_id: (required)
The `OCID`__ of the compartment.
__ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/ident... | Returns an invoice by invoice id | [
"Returns",
"an",
"invoice",
"by",
"invoice",
"id"
] | def get_invoice(self, osp_home_region, compartment_id, internal_invoice_id, **kwargs):
"""
Returns an invoice by invoice id
:param str osp_home_region: (required)
The home region's public name of the logged in user.
:param str compartment_id: (required)
The `OC... | [
"def",
"get_invoice",
"(",
"self",
",",
"osp_home_region",
",",
"compartment_id",
",",
"internal_invoice_id",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/invoices/{internalInvoiceId}\"",
"method",
"=",
"\"GET\"",
"# Don't accept unknown kwargs",
"expect... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/osp_gateway/invoice_service_client.py#L197-L291 | ||
menpo/menpo | a61500656c4fc2eea82497684f13cc31a605550b | menpo/shape/graph.py | python | Graph.vertices | (self) | return range(self.adjacency_matrix.shape[0]) | r"""
Returns the `list` of vertices.
:type: `list` | r"""
Returns the `list` of vertices. | [
"r",
"Returns",
"the",
"list",
"of",
"vertices",
"."
] | def vertices(self):
r"""
Returns the `list` of vertices.
:type: `list`
"""
return range(self.adjacency_matrix.shape[0]) | [
"def",
"vertices",
"(",
"self",
")",
":",
"return",
"range",
"(",
"self",
".",
"adjacency_matrix",
".",
"shape",
"[",
"0",
"]",
")"
] | https://github.com/menpo/menpo/blob/a61500656c4fc2eea82497684f13cc31a605550b/menpo/shape/graph.py#L262-L268 | |
jkehler/awslambda-psycopg2 | c7b1b2f6382bbe5893d95c4e7f4b5ffdf05ab3b4 | with_ssl_support/psycopg2-3.7/pool.py | python | AbstractConnectionPool._putconn | (self, conn, key=None, close=False) | Put away a connection. | Put away a connection. | [
"Put",
"away",
"a",
"connection",
"."
] | def _putconn(self, conn, key=None, close=False):
"""Put away a connection."""
if self.closed:
raise PoolError("connection pool is closed")
if key is None:
key = self._rused.get(id(conn))
if key is None:
raise PoolError("trying to put unkeyed c... | [
"def",
"_putconn",
"(",
"self",
",",
"conn",
",",
"key",
"=",
"None",
",",
"close",
"=",
"False",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"PoolError",
"(",
"\"connection pool is closed\"",
")",
"if",
"key",
"is",
"None",
":",
"key",
"=",
... | https://github.com/jkehler/awslambda-psycopg2/blob/c7b1b2f6382bbe5893d95c4e7f4b5ffdf05ab3b4/with_ssl_support/psycopg2-3.7/pool.py#L94-L127 | ||
nitishsrivastava/deepnet | f4e4ff207923e01552c96038a1e2c29eb5d16160 | cudamat/cudamat.py | python | CUDAMatrix.apply_softmax_grad | (self, labels, target = None) | return target | Apply softmax derivative, where labels are the correct labels. | Apply softmax derivative, where labels are the correct labels. | [
"Apply",
"softmax",
"derivative",
"where",
"labels",
"are",
"the",
"correct",
"labels",
"."
] | def apply_softmax_grad(self, labels, target = None):
"""
Apply softmax derivative, where labels are the correct labels.
"""
if not target:
target = self
assert labels.shape == (1, self.shape[1])
assert target.shape == self.shape
if isinstance(labels, ... | [
"def",
"apply_softmax_grad",
"(",
"self",
",",
"labels",
",",
"target",
"=",
"None",
")",
":",
"if",
"not",
"target",
":",
"target",
"=",
"self",
"assert",
"labels",
".",
"shape",
"==",
"(",
"1",
",",
"self",
".",
"shape",
"[",
"1",
"]",
")",
"asse... | https://github.com/nitishsrivastava/deepnet/blob/f4e4ff207923e01552c96038a1e2c29eb5d16160/cudamat/cudamat.py#L1319-L1336 | |
cloudkick/libcloud | 9c8605e1518c6b5e2511f0780e1946089a7256dd | libcloud/compute/drivers/dummy.py | python | DummyNodeDriver.list_nodes | (self) | return self.nl | List the nodes known to a particular driver;
There are two default nodes created at the beginning
>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node_list=driver.list_nodes()
>>> sorted([node.name for node in node_list ])
... | List the nodes known to a particular driver;
There are two default nodes created at the beginning | [
"List",
"the",
"nodes",
"known",
"to",
"a",
"particular",
"driver",
";",
"There",
"are",
"two",
"default",
"nodes",
"created",
"at",
"the",
"beginning"
] | def list_nodes(self):
"""
List the nodes known to a particular driver;
There are two default nodes created at the beginning
>>> from libcloud.compute.drivers.dummy import DummyNodeDriver
>>> driver = DummyNodeDriver(0)
>>> node_list=driver.list_nodes()
>>> sorted... | [
"def",
"list_nodes",
"(",
"self",
")",
":",
"return",
"self",
".",
"nl"
] | https://github.com/cloudkick/libcloud/blob/9c8605e1518c6b5e2511f0780e1946089a7256dd/libcloud/compute/drivers/dummy.py#L108-L131 | |
TurboWay/spiderman | 168f18552e0abb06187388b542d6a0df057ba852 | download.py | python | DownLoad.delete | (self) | return self.redisctrl.keys_del([self.redis_key]) | :return: 删除 redis key | :return: 删除 redis key | [
":",
"return",
":",
"删除",
"redis",
"key"
] | def delete(self):
"""
:return: 删除 redis key
"""
return self.redisctrl.keys_del([self.redis_key]) | [
"def",
"delete",
"(",
"self",
")",
":",
"return",
"self",
".",
"redisctrl",
".",
"keys_del",
"(",
"[",
"self",
".",
"redis_key",
"]",
")"
] | https://github.com/TurboWay/spiderman/blob/168f18552e0abb06187388b542d6a0df057ba852/download.py#L67-L71 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/encodings/cp1026.py | python | Codec.decode | (self,input,errors='strict') | return codecs.charmap_decode(input,errors,decoding_table) | [] | def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table) | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"return",
"codecs",
".",
"charmap_decode",
"(",
"input",
",",
"errors",
",",
"decoding_table",
")"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/encodings/cp1026.py#L14-L15 | |||
cirla/tulipy | 5f3049a47574f97e28fb78e9cf3787ed610941f9 | tulipy/__init__.py | python | atr | (high, low, close, period) | return lib.atr([high, low, close], [period]) | Average True Range | Average True Range | [
"Average",
"True",
"Range"
] | def atr(high, low, close, period):
"""
Average True Range
"""
return lib.atr([high, low, close], [period]) | [
"def",
"atr",
"(",
"high",
",",
"low",
",",
"close",
",",
"period",
")",
":",
"return",
"lib",
".",
"atr",
"(",
"[",
"high",
",",
"low",
",",
"close",
"]",
",",
"[",
"period",
"]",
")"
] | https://github.com/cirla/tulipy/blob/5f3049a47574f97e28fb78e9cf3787ed610941f9/tulipy/__init__.py#L214-L219 | |
TurboWay/spiderman | 168f18552e0abb06187388b542d6a0df057ba852 | SP/pipelines/pipelines_hdfs.py | python | HdfsPipeline.buckets2db | (self, bucketsize=None) | :param bucketsize: 桶大小
:return: 遍历每个桶,将满足条件的桶,入库并清空桶 | :param bucketsize: 桶大小
:return: 遍历每个桶,将满足条件的桶,入库并清空桶 | [
":",
"param",
"bucketsize",
":",
"桶大小",
":",
"return",
":",
"遍历每个桶,将满足条件的桶,入库并清空桶"
] | def buckets2db(self, bucketsize=None):
"""
:param bucketsize: 桶大小
:return: 遍历每个桶,将满足条件的桶,入库并清空桶
"""
if bucketsize is None:
bucketsize = self.bucketsize
for tablename, items in self.buckets_map.items(): # 遍历每个桶,将满足条件的桶,入库并清空桶
if len(items) >= buck... | [
"def",
"buckets2db",
"(",
"self",
",",
"bucketsize",
"=",
"None",
")",
":",
"if",
"bucketsize",
"is",
"None",
":",
"bucketsize",
"=",
"self",
".",
"bucketsize",
"for",
"tablename",
",",
"items",
"in",
"self",
".",
"buckets_map",
".",
"items",
"(",
")",
... | https://github.com/TurboWay/spiderman/blob/168f18552e0abb06187388b542d6a0df057ba852/SP/pipelines/pipelines_hdfs.py#L79-L127 | ||
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/loops/optimization/manual_loop.py | python | ManualOptimization.on_run_end | (self) | return output | Returns the result of this loop, i.e., the post-processed outputs from the training step. | Returns the result of this loop, i.e., the post-processed outputs from the training step. | [
"Returns",
"the",
"result",
"of",
"this",
"loop",
"i",
".",
"e",
".",
"the",
"post",
"-",
"processed",
"outputs",
"from",
"the",
"training",
"step",
"."
] | def on_run_end(self) -> _OUTPUTS_TYPE:
"""Returns the result of this loop, i.e., the post-processed outputs from the training step."""
output, self._output = self._output, {} # free memory
return output | [
"def",
"on_run_end",
"(",
"self",
")",
"->",
"_OUTPUTS_TYPE",
":",
"output",
",",
"self",
".",
"_output",
"=",
"self",
".",
"_output",
",",
"{",
"}",
"# free memory",
"return",
"output"
] | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/loops/optimization/manual_loop.py#L126-L129 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/voiper/sulley/impacket/smb.py | python | SMB.disconnect_tree | (self, tid) | [] | def disconnect_tree(self, tid):
smb = NewSMBPacket()
smb['Tid'] = tid
smb.addCommand(SMBCommand(SMB.SMB_COM_TREE_DISCONNECT))
self.sendSMB(smb)
smb = self.recvSMB() | [
"def",
"disconnect_tree",
"(",
"self",
",",
"tid",
")",
":",
"smb",
"=",
"NewSMBPacket",
"(",
")",
"smb",
"[",
"'Tid'",
"]",
"=",
"tid",
"smb",
".",
"addCommand",
"(",
"SMBCommand",
"(",
"SMB",
".",
"SMB_COM_TREE_DISCONNECT",
")",
")",
"self",
".",
"se... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/impacket/smb.py#L1496-L1502 | ||||
CPqD/RouteFlow | 3f406b9c1a0796f40a86eb1194990cdd2c955f4d | pox/pox/lib/ioworker/io_worker.py | python | IOWorker.close_handler | (self, callback) | Handler to call when data is available to read | Handler to call when data is available to read | [
"Handler",
"to",
"call",
"when",
"data",
"is",
"available",
"to",
"read"
] | def close_handler (self, callback):
"""
Handler to call when data is available to read
"""
# Not sure if this is a good idea, but it might be...
if self.close_handler is not None or callback is not None:
log.debug("Resetting close_handler on %s?", self)
if callback is None: callback = _dum... | [
"def",
"close_handler",
"(",
"self",
",",
"callback",
")",
":",
"# Not sure if this is a good idea, but it might be...",
"if",
"self",
".",
"close_handler",
"is",
"not",
"None",
"or",
"callback",
"is",
"not",
"None",
":",
"log",
".",
"debug",
"(",
"\"Resetting clo... | https://github.com/CPqD/RouteFlow/blob/3f406b9c1a0796f40a86eb1194990cdd2c955f4d/pox/pox/lib/ioworker/io_worker.py#L153-L161 | ||
sabnzbd/sabnzbd | 52d21e94d3cc6e30764a833fe2a256783d1a8931 | sabnzbd/dirscanner.py | python | DirScanner.newspeed | (self) | We're notified of a scan speed change | We're notified of a scan speed change | [
"We",
"re",
"notified",
"of",
"a",
"scan",
"speed",
"change"
] | def newspeed(self):
"""We're notified of a scan speed change"""
# If set to 0, use None so the wait() is forever
self.dirscan_speed = cfg.dirscan_speed() or None
with self.loop_condition:
self.loop_condition.notify() | [
"def",
"newspeed",
"(",
"self",
")",
":",
"# If set to 0, use None so the wait() is forever",
"self",
".",
"dirscan_speed",
"=",
"cfg",
".",
"dirscan_speed",
"(",
")",
"or",
"None",
"with",
"self",
".",
"loop_condition",
":",
"self",
".",
"loop_condition",
".",
... | https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/sabnzbd/dirscanner.py#L98-L103 | ||
openstack/tempest | fe0ac89a5a1c43fa908a76759cd99eea3b1f9853 | tempest/lib/services/image/v2/namespaces_client.py | python | NamespacesClient.show_namespace | (self, namespace) | return rest_client.ResponseBody(resp, body) | Show namespace details.
For a full list of available parameters, please refer to the official
API reference:
https://docs.openstack.org/api-ref/image/v2/metadefs-index.html#get-namespace-details | Show namespace details. | [
"Show",
"namespace",
"details",
"."
] | def show_namespace(self, namespace):
"""Show namespace details.
For a full list of available parameters, please refer to the official
API reference:
https://docs.openstack.org/api-ref/image/v2/metadefs-index.html#get-namespace-details
"""
url = 'metadefs/namespaces/%s' %... | [
"def",
"show_namespace",
"(",
"self",
",",
"namespace",
")",
":",
"url",
"=",
"'metadefs/namespaces/%s'",
"%",
"namespace",
"resp",
",",
"body",
"=",
"self",
".",
"get",
"(",
"url",
")",
"self",
".",
"expected_success",
"(",
"200",
",",
"resp",
".",
"sta... | https://github.com/openstack/tempest/blob/fe0ac89a5a1c43fa908a76759cd99eea3b1f9853/tempest/lib/services/image/v2/namespaces_client.py#L50-L61 | |
microsoft/MPNet | 081523a788c1556f28dd90cbc629810f48b083fb | pretraining/fairseq/trainer.py | python | Trainer.get_model | (self) | return self._model | Get the (non-wrapped) model instance. | Get the (non-wrapped) model instance. | [
"Get",
"the",
"(",
"non",
"-",
"wrapped",
")",
"model",
"instance",
"."
] | def get_model(self):
"""Get the (non-wrapped) model instance."""
return self._model | [
"def",
"get_model",
"(",
"self",
")",
":",
"return",
"self",
".",
"_model"
] | https://github.com/microsoft/MPNet/blob/081523a788c1556f28dd90cbc629810f48b083fb/pretraining/fairseq/trainer.py#L575-L577 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/helpdesk/signals.py | python | init_signals | () | [] | def init_signals():
post_save.connect(create_usersettings, sender=User, weak=False) | [
"def",
"init_signals",
"(",
")",
":",
"post_save",
".",
"connect",
"(",
"create_usersettings",
",",
"sender",
"=",
"User",
",",
"weak",
"=",
"False",
")"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/helpdesk/signals.py#L19-L20 | ||||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/django/db/models/sql/compiler.py | python | SQLDateCompiler.results_iter | (self) | Returns an iterator over the results from executing this query. | Returns an iterator over the results from executing this query. | [
"Returns",
"an",
"iterator",
"over",
"the",
"results",
"from",
"executing",
"this",
"query",
"."
] | def results_iter(self):
"""
Returns an iterator over the results from executing this query.
"""
resolve_columns = hasattr(self, 'resolve_columns')
if resolve_columns:
from django.db.models.fields import DateTimeField
fields = [DateTimeField()]
else... | [
"def",
"results_iter",
"(",
"self",
")",
":",
"resolve_columns",
"=",
"hasattr",
"(",
"self",
",",
"'resolve_columns'",
")",
"if",
"resolve_columns",
":",
"from",
"django",
".",
"db",
".",
"models",
".",
"fields",
"import",
"DateTimeField",
"fields",
"=",
"[... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/db/models/sql/compiler.py#L1095-L1115 | ||
networkx/networkx | 1620568e36702b1cfeaf1c0277b167b6cb93e48d | networkx/algorithms/clique.py | python | make_max_clique_graph | (G, create_using=None) | return B | Returns the maximal clique graph of the given graph.
The nodes of the maximal clique graph of `G` are the cliques of
`G` and an edge joins two cliques if the cliques are not disjoint.
Parameters
----------
G : NetworkX graph
create_using : NetworkX graph constructor, optional (default=nx.Grap... | Returns the maximal clique graph of the given graph. | [
"Returns",
"the",
"maximal",
"clique",
"graph",
"of",
"the",
"given",
"graph",
"."
] | def make_max_clique_graph(G, create_using=None):
"""Returns the maximal clique graph of the given graph.
The nodes of the maximal clique graph of `G` are the cliques of
`G` and an edge joins two cliques if the cliques are not disjoint.
Parameters
----------
G : NetworkX graph
create_using... | [
"def",
"make_max_clique_graph",
"(",
"G",
",",
"create_using",
"=",
"None",
")",
":",
"if",
"create_using",
"is",
"None",
":",
"B",
"=",
"G",
".",
"__class__",
"(",
")",
"else",
":",
"B",
"=",
"nx",
".",
"empty_graph",
"(",
"0",
",",
"create_using",
... | https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/networkx/algorithms/clique.py#L301-L344 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/search/search_space_grid.py | python | search_space_to_grids | (hp: SearchSpace) | return SearchSpaceToGridVisitor.run(hp) | [] | def search_space_to_grids(hp: SearchSpace) -> List[SearchSpaceGrid]:
return SearchSpaceToGridVisitor.run(hp) | [
"def",
"search_space_to_grids",
"(",
"hp",
":",
"SearchSpace",
")",
"->",
"List",
"[",
"SearchSpaceGrid",
"]",
":",
"return",
"SearchSpaceToGridVisitor",
".",
"run",
"(",
"hp",
")"
] | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/search/search_space_grid.py#L112-L113 | |||
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/baselib/general.py | python | detach_process | () | Detach the current process from the controlling terminal by using a
double fork. Can be used only on platforms with fork (no Windows). | Detach the current process from the controlling terminal by using a
double fork. Can be used only on platforms with fork (no Windows). | [
"Detach",
"the",
"current",
"process",
"from",
"the",
"controlling",
"terminal",
"by",
"using",
"a",
"double",
"fork",
".",
"Can",
"be",
"used",
"only",
"on",
"platforms",
"with",
"fork",
"(",
"no",
"Windows",
")",
"."
] | def detach_process():
"""
Detach the current process from the controlling terminal by using a
double fork. Can be used only on platforms with fork (no Windows).
"""
# see https://pagure.io/python-daemon/blob/master/f/daemon/daemon.py and
# https://stackoverflow.com/questions/45911705/why-use-os-... | [
"def",
"detach_process",
"(",
")",
":",
"# see https://pagure.io/python-daemon/blob/master/f/daemon/daemon.py and",
"# https://stackoverflow.com/questions/45911705/why-use-os-setsid-in-python",
"def",
"fork_then_exit_parent",
"(",
")",
":",
"pid",
"=",
"os",
".",
"fork",
"(",
")"... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/baselib/general.py#L1267-L1280 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/skew_tableau.py | python | StandardSkewTableaux_shape.__iter__ | (self) | An iterator for all the standard skew tableaux whose shape is
the skew partition ``skp``. The standard skew tableaux are
ordered lexicographically by the word obtained from their row
reading.
EXAMPLES::
sage: StandardSkewTableaux([[3, 2, 1], [1, 1]]).list()
[[[N... | An iterator for all the standard skew tableaux whose shape is
the skew partition ``skp``. The standard skew tableaux are
ordered lexicographically by the word obtained from their row
reading. | [
"An",
"iterator",
"for",
"all",
"the",
"standard",
"skew",
"tableaux",
"whose",
"shape",
"is",
"the",
"skew",
"partition",
"skp",
".",
"The",
"standard",
"skew",
"tableaux",
"are",
"ordered",
"lexicographically",
"by",
"the",
"word",
"obtained",
"from",
"their... | def __iter__(self):
"""
An iterator for all the standard skew tableaux whose shape is
the skew partition ``skp``. The standard skew tableaux are
ordered lexicographically by the word obtained from their row
reading.
EXAMPLES::
sage: StandardSkewTableaux([[3,... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"dag",
"=",
"self",
".",
"skp",
".",
"to_dag",
"(",
"format",
"=",
"\"tuple\"",
")",
"le_list",
"=",
"list",
"(",
"dag",
".",
"topological_sort_generator",
"(",
")",
")",
"empty",
"=",
"[",
"[",
"None",
"]",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/skew_tableau.py#L2040-L2065 | ||
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/pyparsing.py | python | ParserElement.split | (self, instring, maxsplit=_MAX_INT, includeSeparators=False) | Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (default=C{False}), if the separating
matching text should be included in the split result... | Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (default=C{False}), if the separating
matching text should be included in the split result... | [
"Generator",
"method",
"to",
"split",
"a",
"string",
"using",
"the",
"given",
"expression",
"as",
"a",
"separator",
".",
"May",
"be",
"called",
"with",
"optional",
"C",
"{",
"maxsplit",
"}",
"argument",
"to",
"limit",
"the",
"number",
"of",
"splits",
";",
... | def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
"""
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (defaul... | [
"def",
"split",
"(",
"self",
",",
"instring",
",",
"maxsplit",
"=",
"_MAX_INT",
",",
"includeSeparators",
"=",
"False",
")",
":",
"splits",
"=",
"0",
"last",
"=",
"0",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/pyparsing.py#L1758-L1778 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/http/cookiejar.py | python | DefaultCookiePolicy.is_not_allowed | (self, domain) | return True | [] | def is_not_allowed(self, domain):
if self._allowed_domains is None:
return False
for allowed_domain in self._allowed_domains:
if user_domain_match(domain, allowed_domain):
return False
return True | [
"def",
"is_not_allowed",
"(",
"self",
",",
"domain",
")",
":",
"if",
"self",
".",
"_allowed_domains",
"is",
"None",
":",
"return",
"False",
"for",
"allowed_domain",
"in",
"self",
".",
"_allowed_domains",
":",
"if",
"user_domain_match",
"(",
"domain",
",",
"a... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/http/cookiejar.py#L925-L931 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/beat.py | python | Scheduler.send_task | (self, *args, **kwargs) | return self.app.send_task(*args, **kwargs) | [] | def send_task(self, *args, **kwargs):
return self.app.send_task(*args, **kwargs) | [
"def",
"send_task",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"app",
".",
"send_task",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/beat.py#L313-L314 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.