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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EdwardTyantov/ultrasound-nerve-segmentation | 84a614009cdce6426628b7dbf159fc5a445fe302 | train_generator.py | python | Learner.split_train_and_valid_by_patient | (cls, data, mask, validation_split, shuffle=False) | return (x_train, y_train), (x_valid, y_valid) | [] | def split_train_and_valid_by_patient(cls, data, mask, validation_split, shuffle=False):
print('Shuffle & split...')
patient_nums = load_patient_num()
patient_dict = count_enum(patient_nums)
pnum = len(patient_dict)
val_num = int(pnum * validation_split)
patients = patient... | [
"def",
"split_train_and_valid_by_patient",
"(",
"cls",
",",
"data",
",",
"mask",
",",
"validation_split",
",",
"shuffle",
"=",
"False",
")",
":",
"print",
"(",
"'Shuffle & split...'",
")",
"patient_nums",
"=",
"load_patient_num",
"(",
")",
"patient_dict",
"=",
"... | https://github.com/EdwardTyantov/ultrasound-nerve-segmentation/blob/84a614009cdce6426628b7dbf159fc5a445fe302/train_generator.py#L105-L122 | |||
JinpengLI/deep_ocr | 450148c0c51b3565a96ac2f3c94ee33022e55307 | deep_ocr/ocrolib/toplevel.py | python | checks | (*types,**ktypes) | return argument_check_decorator | Check argument and return types against type specs at runtime. | Check argument and return types against type specs at runtime. | [
"Check",
"argument",
"and",
"return",
"types",
"against",
"type",
"specs",
"at",
"runtime",
"."
] | def checks(*types,**ktypes):
"""Check argument and return types against type specs at runtime."""
def argument_check_decorator(f):
@functools.wraps(f)
def argument_checks(*args,**kw):
# print("@@@", f, "decl", types, ktypes, "call",
# [strc(x) for x in args], kw)
... | [
"def",
"checks",
"(",
"*",
"types",
",",
"*",
"*",
"ktypes",
")",
":",
"def",
"argument_check_decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"argument_checks",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
... | https://github.com/JinpengLI/deep_ocr/blob/450148c0c51b3565a96ac2f3c94ee33022e55307/deep_ocr/ocrolib/toplevel.py#L195-L221 | |
libtcod/python-tcod | e12c4172baa9efdfd74aff6ee9bab8454a835248 | tcod/libtcodpy.py | python | map_get_width | (map: tcod.map.Map) | return map.width | Return the width of a map.
.. deprecated:: 4.5
Check the :any:`tcod.map.Map.width` attribute instead. | Return the width of a map. | [
"Return",
"the",
"width",
"of",
"a",
"map",
"."
] | def map_get_width(map: tcod.map.Map) -> int:
"""Return the width of a map.
.. deprecated:: 4.5
Check the :any:`tcod.map.Map.width` attribute instead.
"""
return map.width | [
"def",
"map_get_width",
"(",
"map",
":",
"tcod",
".",
"map",
".",
"Map",
")",
"->",
"int",
":",
"return",
"map",
".",
"width"
] | https://github.com/libtcod/python-tcod/blob/e12c4172baa9efdfd74aff6ee9bab8454a835248/tcod/libtcodpy.py#L3329-L3335 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/setuptools/_vendor/packaging/markers.py | python | Marker.__str__ | (self) | return _format_marker(self._markers) | [] | def __str__(self):
return _format_marker(self._markers) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"_format_marker",
"(",
"self",
".",
"_markers",
")"
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/setuptools/_vendor/packaging/markers.py#L282-L283 | |||
GalSim-developers/GalSim | a05d4ec3b8d8574f99d3b0606ad882cbba53f345 | galsim/correlatednoise.py | python | BaseCorrelatedNoise.drawImage | (self, image=None, scale=None, wcs=None, dtype=None, add_to_image=False) | return self._profile.drawImage(
image=image, wcs=wcs, dtype=dtype, method='sb', gain=1.,
add_to_image=add_to_image, use_true_center=False) | A method for drawing profiles storing correlation functions.
This is a mild reimplementation of the `GSObject.drawImage` method. The ``method`` is
automatically set to 'sb' and cannot be changed, and the ``gain`` is set to unity.
Also, not all the normal parameters of the `GSObject` method are... | A method for drawing profiles storing correlation functions. | [
"A",
"method",
"for",
"drawing",
"profiles",
"storing",
"correlation",
"functions",
"."
] | def drawImage(self, image=None, scale=None, wcs=None, dtype=None, add_to_image=False):
"""A method for drawing profiles storing correlation functions.
This is a mild reimplementation of the `GSObject.drawImage` method. The ``method`` is
automatically set to 'sb' and cannot be changed, and the ... | [
"def",
"drawImage",
"(",
"self",
",",
"image",
"=",
"None",
",",
"scale",
"=",
"None",
",",
"wcs",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"add_to_image",
"=",
"False",
")",
":",
"wcs",
"=",
"self",
".",
"_profile",
".",
"_determine_wcs",
"(",
... | https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/correlatednoise.py#L658-L695 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/monitor/monitor/api/xmlutil.py | python | SlaveTemplate.__repr__ | (self) | return ("<%s.%s object versions %s-%s at %#x>" %
(self.__class__.__module__, self.__class__.__name__,
self.min_vers, self.max_vers, id(self))) | Return string representation of the template. | Return string representation of the template. | [
"Return",
"string",
"representation",
"of",
"the",
"template",
"."
] | def __repr__(self):
"""Return string representation of the template."""
return ("<%s.%s object versions %s-%s at %#x>" %
(self.__class__.__module__, self.__class__.__name__,
self.min_vers, self.max_vers, id(self))) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"(",
"\"<%s.%s object versions %s-%s at %#x>\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__module__",
",",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"min_vers",
",",
"self",
".",
"max_v... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/api/xmlutil.py#L789-L794 | |
msg-systems/holmes-extractor | fc536f32a5cd02a53d1c32f771adc14227d09f38 | holmes_extractor/parsing.py | python | HolmesDocumentInfo.deserialize_obj | (obj, chain=None) | return obj if chain is None else chain(obj) | [] | def deserialize_obj(obj, chain=None):
if '__holmes_document_info_holder__' in obj:
return pickle.loads(obj['__holmes_document_info_holder__'])
return obj if chain is None else chain(obj) | [
"def",
"deserialize_obj",
"(",
"obj",
",",
"chain",
"=",
"None",
")",
":",
"if",
"'__holmes_document_info_holder__'",
"in",
"obj",
":",
"return",
"pickle",
".",
"loads",
"(",
"obj",
"[",
"'__holmes_document_info_holder__'",
"]",
")",
"return",
"obj",
"if",
"ch... | https://github.com/msg-systems/holmes-extractor/blob/fc536f32a5cd02a53d1c32f771adc14227d09f38/holmes_extractor/parsing.py#L245-L248 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/stat.py | python | S_ISDOOR | (mode) | return False | Return True if mode is from a door. | Return True if mode is from a door. | [
"Return",
"True",
"if",
"mode",
"is",
"from",
"a",
"door",
"."
] | def S_ISDOOR(mode):
"""Return True if mode is from a door."""
return False | [
"def",
"S_ISDOOR",
"(",
"mode",
")",
":",
"return",
"False"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/stat.py#L78-L80 | |
facebookresearch/hydra | 9b2f4d54b328d1551aa70a241a1d638cbe046367 | hydra/_internal/hydra.py | python | Hydra.get_sanitized_cfg | (self, cfg: DictConfig, cfg_type: str) | return cfg | [] | def get_sanitized_cfg(self, cfg: DictConfig, cfg_type: str) -> DictConfig:
assert cfg_type in ["job", "hydra", "all"]
if cfg_type == "job":
with flag_override(cfg, ["struct", "readonly"], [False, False]):
del cfg["hydra"]
elif cfg_type == "hydra":
cfg = se... | [
"def",
"get_sanitized_cfg",
"(",
"self",
",",
"cfg",
":",
"DictConfig",
",",
"cfg_type",
":",
"str",
")",
"->",
"DictConfig",
":",
"assert",
"cfg_type",
"in",
"[",
"\"job\"",
",",
"\"hydra\"",
",",
"\"all\"",
"]",
"if",
"cfg_type",
"==",
"\"job\"",
":",
... | https://github.com/facebookresearch/hydra/blob/9b2f4d54b328d1551aa70a241a1d638cbe046367/hydra/_internal/hydra.py#L156-L163 | |||
nficano/tangerine | 80a1498a3a33625a7a59e5b74da025fdb994b23b | tangerine/bot.py | python | Tangerine.listen_for | (self, rule, **options) | return decorator | Decorator for adding a Rule. See guidelines for rules. | Decorator for adding a Rule. See guidelines for rules. | [
"Decorator",
"for",
"adding",
"a",
"Rule",
".",
"See",
"guidelines",
"for",
"rules",
"."
] | def listen_for(self, rule, **options):
"""Decorator for adding a Rule. See guidelines for rules."""
trigger = None
if isinstance(rule, six.string_types):
trigger = rule
rule = self._verify_rule(rule)
def decorator(f):
self.add_listener(rule, f, trigger, f... | [
"def",
"listen_for",
"(",
"self",
",",
"rule",
",",
"*",
"*",
"options",
")",
":",
"trigger",
"=",
"None",
"if",
"isinstance",
"(",
"rule",
",",
"six",
".",
"string_types",
")",
":",
"trigger",
"=",
"rule",
"rule",
"=",
"self",
".",
"_verify_rule",
"... | https://github.com/nficano/tangerine/blob/80a1498a3a33625a7a59e5b74da025fdb994b23b/tangerine/bot.py#L83-L94 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py | python | MacroFunction.parseoptional | (self, pos, defaults) | Parse optional parameters. | Parse optional parameters. | [
"Parse",
"optional",
"parameters",
"."
] | def parseoptional(self, pos, defaults):
"Parse optional parameters."
optional = []
while self.factory.detecttype(SquareBracket, pos):
optional.append(self.parsesquare(pos))
if len(optional) > len(defaults):
break
for value in optional:
default = defaults.pop()
if len(valu... | [
"def",
"parseoptional",
"(",
"self",
",",
"pos",
",",
"defaults",
")",
":",
"optional",
"=",
"[",
"]",
"while",
"self",
".",
"factory",
".",
"detecttype",
"(",
"SquareBracket",
",",
"pos",
")",
":",
"optional",
".",
"append",
"(",
"self",
".",
"parsesq... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L5262-L5275 | ||
brightmart/multi-label_classification | b5febe17eaf9d937d71cabab56c5da48ee68f7b5 | bert/modeling.py | python | BertModel.__init__ | (self,
config,
is_training,
input_ids,
input_mask=None,
token_type_ids=None,
use_one_hot_embeddings=False,
scope=None) | Constructor for BertModel.
Args:
config: `BertConfig` instance.
is_training: bool. true for training model, false for eval model. Controls
whether dropout will be applied.
input_ids: int32 Tensor of shape [batch_size, seq_length].
input_mask: (optional) int32 Tensor of shape [batch_... | Constructor for BertModel. | [
"Constructor",
"for",
"BertModel",
"."
] | def __init__(self,
config,
is_training,
input_ids,
input_mask=None,
token_type_ids=None,
use_one_hot_embeddings=False,
scope=None):
"""Constructor for BertModel.
Args:
config: `BertConfig` instance.
... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"is_training",
",",
"input_ids",
",",
"input_mask",
"=",
"None",
",",
"token_type_ids",
"=",
"None",
",",
"use_one_hot_embeddings",
"=",
"False",
",",
"scope",
"=",
"None",
")",
":",
"config",
"=",
"copy"... | https://github.com/brightmart/multi-label_classification/blob/b5febe17eaf9d937d71cabab56c5da48ee68f7b5/bert/modeling.py#L131-L232 | ||
s3prl/s3prl | 185e4b060cd96ce5911e258c2fde74a2e8246308 | s3prl/downstream/voxceleb2_amsoftmax_segment_eval/model.py | python | Mean.forward | (self, feature, att_mask) | return torch.stack(agg_vec_list) | Arguments
feature - [BxTxD] Acoustic feature with shape
att_mask - [BxTx1] Attention Mask logits | Arguments
feature - [BxTxD] Acoustic feature with shape
att_mask - [BxTx1] Attention Mask logits | [
"Arguments",
"feature",
"-",
"[",
"BxTxD",
"]",
"Acoustic",
"feature",
"with",
"shape",
"att_mask",
"-",
"[",
"BxTx1",
"]",
"Attention",
"Mask",
"logits"
] | def forward(self, feature, att_mask):
'''
Arguments
feature - [BxTxD] Acoustic feature with shape
att_mask - [BxTx1] Attention Mask logits
'''
feature=self.linear(self.act_fn(feature))
agg_vec_list = []
for i in range(len(feature)):
... | [
"def",
"forward",
"(",
"self",
",",
"feature",
",",
"att_mask",
")",
":",
"feature",
"=",
"self",
".",
"linear",
"(",
"self",
".",
"act_fn",
"(",
"feature",
")",
")",
"agg_vec_list",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"featu... | https://github.com/s3prl/s3prl/blob/185e4b060cd96ce5911e258c2fde74a2e8246308/s3prl/downstream/voxceleb2_amsoftmax_segment_eval/model.py#L41-L57 | |
usb-tools/Facedancer | e688fe61dc34087db333432394e1f90e52ac3794 | facedancer/backends/greatdancer.py | python | GreatDancerApp._is_control_endpoint | (self, endpoint_number) | return endpoint_number == 0 | Returns true iff the given endpoint number corresponds to a control endpoint. | Returns true iff the given endpoint number corresponds to a control endpoint. | [
"Returns",
"true",
"iff",
"the",
"given",
"endpoint",
"number",
"corresponds",
"to",
"a",
"control",
"endpoint",
"."
] | def _is_control_endpoint(self, endpoint_number):
"""
Returns true iff the given endpoint number corresponds to a control endpoint.
"""
# FIXME: Support control endpoints other than EP0.
return endpoint_number == 0 | [
"def",
"_is_control_endpoint",
"(",
"self",
",",
"endpoint_number",
")",
":",
"# FIXME: Support control endpoints other than EP0.",
"return",
"endpoint_number",
"==",
"0"
] | https://github.com/usb-tools/Facedancer/blob/e688fe61dc34087db333432394e1f90e52ac3794/facedancer/backends/greatdancer.py#L515-L521 | |
lahwaacz/arch-wiki-docs | 216a2170262f5b1ee4af3ac9b565fd3be2752df9 | ArchWiki/ArchWiki.py | python | ArchWiki.query_continue | (self, query) | Generator for MediaWiki's query-continue feature.
ref: https://www.mediawiki.org/wiki/API:Query#Continuing_queries | Generator for MediaWiki's query-continue feature.
ref: https://www.mediawiki.org/wiki/API:Query#Continuing_queries | [
"Generator",
"for",
"MediaWiki",
"s",
"query",
"-",
"continue",
"feature",
".",
"ref",
":",
"https",
":",
"//",
"www",
".",
"mediawiki",
".",
"org",
"/",
"wiki",
"/",
"API",
":",
"Query#Continuing_queries"
] | def query_continue(self, query):
""" Generator for MediaWiki's query-continue feature.
ref: https://www.mediawiki.org/wiki/API:Query#Continuing_queries
"""
last_continue = {"continue": ""}
while True:
# clone the original params to clean up old continue params
... | [
"def",
"query_continue",
"(",
"self",
",",
"query",
")",
":",
"last_continue",
"=",
"{",
"\"continue\"",
":",
"\"\"",
"}",
"while",
"True",
":",
"# clone the original params to clean up old continue params",
"query_copy",
"=",
"query",
".",
"copy",
"(",
")",
"# an... | https://github.com/lahwaacz/arch-wiki-docs/blob/216a2170262f5b1ee4af3ac9b565fd3be2752df9/ArchWiki/ArchWiki.py#L111-L133 | ||
mahmoud/boltons | 270e974975984f662f998c8f6eb0ebebd964de82 | boltons/cacheutils.py | python | ThresholdCounter.elements | (self) | return itertools.chain.from_iterable(repeaters) | Return an iterator of all the common elements tracked by the
counter. Yields each key as many times as it has been seen. | Return an iterator of all the common elements tracked by the
counter. Yields each key as many times as it has been seen. | [
"Return",
"an",
"iterator",
"of",
"all",
"the",
"common",
"elements",
"tracked",
"by",
"the",
"counter",
".",
"Yields",
"each",
"key",
"as",
"many",
"times",
"as",
"it",
"has",
"been",
"seen",
"."
] | def elements(self):
"""Return an iterator of all the common elements tracked by the
counter. Yields each key as many times as it has been seen.
"""
repeaters = itertools.starmap(itertools.repeat, self.iteritems())
return itertools.chain.from_iterable(repeaters) | [
"def",
"elements",
"(",
"self",
")",
":",
"repeaters",
"=",
"itertools",
".",
"starmap",
"(",
"itertools",
".",
"repeat",
",",
"self",
".",
"iteritems",
"(",
")",
")",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"repeaters",
")"
] | https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/cacheutils.py#L726-L731 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/keyed_region.py | python | KeyedRegion._canonicalize_size | (self, size: Union[int,'UnknownSize']) | return size | [] | def _canonicalize_size(self, size: Union[int,'UnknownSize']) -> int:
# delayed import
from .knowledge_plugins.key_definitions.unknown_size import UnknownSize # pylint:disable=import-outside-toplevel
if isinstance(size, UnknownSize):
return self._canonical_size
return size | [
"def",
"_canonicalize_size",
"(",
"self",
",",
"size",
":",
"Union",
"[",
"int",
",",
"'UnknownSize'",
"]",
")",
"->",
"int",
":",
"# delayed import",
"from",
".",
"knowledge_plugins",
".",
"key_definitions",
".",
"unknown_size",
"import",
"UnknownSize",
"# pyli... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/keyed_region.py#L364-L371 | |||
vrnetlab/vrnetlab | 28c144042efbf59ae500da6eac3f983ea346ffda | vmx/docker/launch.py | python | VMX_vcp.gen_mgmt | (self) | return res | Generate mgmt interface(s)
We override the default function since we want a virtio NIC to the
vFPC | Generate mgmt interface(s) | [
"Generate",
"mgmt",
"interface",
"(",
"s",
")"
] | def gen_mgmt(self):
""" Generate mgmt interface(s)
We override the default function since we want a virtio NIC to the
vFPC
"""
# call parent function to generate first mgmt interface (e1000)
res = super(VMX_vcp, self).gen_mgmt()
# install mode doesn't nee... | [
"def",
"gen_mgmt",
"(",
"self",
")",
":",
"# call parent function to generate first mgmt interface (e1000)",
"res",
"=",
"super",
"(",
"VMX_vcp",
",",
"self",
")",
".",
"gen_mgmt",
"(",
")",
"# install mode doesn't need host port forwarding rules. if running in",
"# dual-re m... | https://github.com/vrnetlab/vrnetlab/blob/28c144042efbf59ae500da6eac3f983ea346ffda/vmx/docker/launch.py#L81-L103 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/xapi_virt.py | python | _get_metrics_record | (xapi, rectype, record) | return getattr(xapi, "{}_metrics".format(rectype)).get_record(metrics_id) | Internal, returns metrics record for a rectype | Internal, returns metrics record for a rectype | [
"Internal",
"returns",
"metrics",
"record",
"for",
"a",
"rectype"
] | def _get_metrics_record(xapi, rectype, record):
"""
Internal, returns metrics record for a rectype
"""
metrics_id = record["metrics"]
return getattr(xapi, "{}_metrics".format(rectype)).get_record(metrics_id) | [
"def",
"_get_metrics_record",
"(",
"xapi",
",",
"rectype",
",",
"record",
")",
":",
"metrics_id",
"=",
"record",
"[",
"\"metrics\"",
"]",
"return",
"getattr",
"(",
"xapi",
",",
"\"{}_metrics\"",
".",
"format",
"(",
"rectype",
")",
")",
".",
"get_record",
"... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/xapi_virt.py#L154-L159 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/mimify.py | python | mimify | (infile, outfile) | Convert 8bit parts of a MIME mail message to quoted-printable. | Convert 8bit parts of a MIME mail message to quoted-printable. | [
"Convert",
"8bit",
"parts",
"of",
"a",
"MIME",
"mail",
"message",
"to",
"quoted",
"-",
"printable",
"."
] | def mimify(infile, outfile):
"""Convert 8bit parts of a MIME mail message to quoted-printable."""
if type(infile) == type(''):
ifile = open(infile)
if type(outfile) == type('') and infile == outfile:
import os
d, f = os.path.split(infile)
os.rename(infile, os.... | [
"def",
"mimify",
"(",
"infile",
",",
"outfile",
")",
":",
"if",
"type",
"(",
"infile",
")",
"==",
"type",
"(",
"''",
")",
":",
"ifile",
"=",
"open",
"(",
"infile",
")",
"if",
"type",
"(",
"outfile",
")",
"==",
"type",
"(",
"''",
")",
"and",
"in... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/mimify.py#L415-L431 | ||
accelero-cloud/appkernel | 1be8707f535e9f8ad78ef944f2631b15ce03e8f3 | appkernel/reflection.py | python | is_set | (obj) | return type(obj) is set | Helper method to see if the object is a Python set.
>>> is_set(set())
True | Helper method to see if the object is a Python set.
>>> is_set(set())
True | [
"Helper",
"method",
"to",
"see",
"if",
"the",
"object",
"is",
"a",
"Python",
"set",
".",
">>>",
"is_set",
"(",
"set",
"()",
")",
"True"
] | def is_set(obj):
"""Helper method to see if the object is a Python set.
>>> is_set(set())
True
"""
return type(obj) is set | [
"def",
"is_set",
"(",
"obj",
")",
":",
"return",
"type",
"(",
"obj",
")",
"is",
"set"
] | https://github.com/accelero-cloud/appkernel/blob/1be8707f535e9f8ad78ef944f2631b15ce03e8f3/appkernel/reflection.py#L119-L124 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/core/fromnumeric.py | python | amin | (a, axis=None, out=None, keepdims=False) | Return the minimum of an array or minimum along an axis.
Parameters
----------
a : array_like
Input data.
axis : None or int or tuple of ints, optional
Axis or axes along which to operate. By default, flattened input is
used.
.. versionadded: 1.7.0
If this is ... | Return the minimum of an array or minimum along an axis. | [
"Return",
"the",
"minimum",
"of",
"an",
"array",
"or",
"minimum",
"along",
"an",
"axis",
"."
] | def amin(a, axis=None, out=None, keepdims=False):
"""
Return the minimum of an array or minimum along an axis.
Parameters
----------
a : array_like
Input data.
axis : None or int or tuple of ints, optional
Axis or axes along which to operate. By default, flattened input is
... | [
"def",
"amin",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"if",
"type",
"(",
"a",
")",
"is",
"not",
"mu",
".",
"ndarray",
":",
"try",
":",
"amin",
"=",
"a",
".",
"min",
"except",
"Att... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/core/fromnumeric.py#L2252-L2340 | ||
mit-han-lab/amc | 040d83fe9f0288556c8afe363c190e763425a6fe | lib/utils.py | python | accuracy | (output, target, topk=(1,)) | return res + appendices | Computes the precision@k for the specified values of k | Computes the precision | [
"Computes",
"the",
"precision"
] | def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
batch_size = target.size(0)
num = output.size(1)
target_topk = []
appendices = []
for k in topk:
if k <= num:
target_topk.append(k)
else:
appendices.appen... | [
"def",
"accuracy",
"(",
"output",
",",
"target",
",",
"topk",
"=",
"(",
"1",
",",
")",
")",
":",
"batch_size",
"=",
"target",
".",
"size",
"(",
"0",
")",
"num",
"=",
"output",
".",
"size",
"(",
"1",
")",
"target_topk",
"=",
"[",
"]",
"appendices"... | https://github.com/mit-han-lab/amc/blob/040d83fe9f0288556c8afe363c190e763425a6fe/lib/utils.py#L59-L80 | |
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/decimal.py | python | Decimal.is_subnormal | (self, context=None) | return self.adjusted() < context.Emin | Return True if self is subnormal; otherwise return False. | Return True if self is subnormal; otherwise return False. | [
"Return",
"True",
"if",
"self",
"is",
"subnormal",
";",
"otherwise",
"return",
"False",
"."
] | def is_subnormal(self, context=None):
"""Return True if self is subnormal; otherwise return False."""
if self._is_special or not self:
return False
if context is None:
context = getcontext()
return self.adjusted() < context.Emin | [
"def",
"is_subnormal",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_special",
"or",
"not",
"self",
":",
"return",
"False",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"return",
"self",
".",... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/decimal.py#L3055-L3061 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/alembic/util/pyfiles.py | python | load_python_file | (dir_, filename) | return module | Load a file from the given path as a Python module. | Load a file from the given path as a Python module. | [
"Load",
"a",
"file",
"from",
"the",
"given",
"path",
"as",
"a",
"Python",
"module",
"."
] | def load_python_file(dir_, filename):
"""Load a file from the given path as a Python module."""
module_id = re.sub(r'\W', "_", filename)
path = os.path.join(dir_, filename)
_, ext = os.path.splitext(filename)
if ext == ".py":
if os.path.exists(path):
module = load_module_py(modu... | [
"def",
"load_python_file",
"(",
"dir_",
",",
"filename",
")",
":",
"module_id",
"=",
"re",
".",
"sub",
"(",
"r'\\W'",
",",
"\"_\"",
",",
"filename",
")",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dir_",
",",
"filename",
")",
"_",
",",
"ext... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/alembic/util/pyfiles.py#L73-L90 | |
carmaa/inception | 6c09195f1318ae66010d629b1a86c10524251e26 | inception/modules/dump.py | python | calculate | (address, size) | Calculate the start and end memory addresses of the dump | Calculate the start and end memory addresses of the dump | [
"Calculate",
"the",
"start",
"and",
"end",
"memory",
"addresses",
"of",
"the",
"dump"
] | def calculate(address, size):
'''Calculate the start and end memory addresses of the dump'''
try:
# Fix address
if isinstance(address, int):
pass
elif address.startswith('0x'):
address = int(address, 0) & 0xfffff000 # Address
elif address.startswith('p'):... | [
"def",
"calculate",
"(",
"address",
",",
"size",
")",
":",
"try",
":",
"# Fix address",
"if",
"isinstance",
"(",
"address",
",",
"int",
")",
":",
"pass",
"elif",
"address",
".",
"startswith",
"(",
"'0x'",
")",
":",
"address",
"=",
"int",
"(",
"address"... | https://github.com/carmaa/inception/blob/6c09195f1318ae66010d629b1a86c10524251e26/inception/modules/dump.py#L65-L91 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/conversion_adjustment_upload_service/transports/grpc.py | python | ConversionAdjustmentUploadServiceGrpcTransport.create_channel | (
cls,
host: str = "googleads.googleapis.com",
credentials: credentials.Credentials = None,
scopes: Optional[Sequence[str]] = None,
**kwargs,
) | return grpc_helpers.create_channel(
host,
credentials=credentials,
scopes=scopes or cls.AUTH_SCOPES,
**kwargs,
) | Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service.... | Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service.... | [
"Create",
"and",
"return",
"a",
"gRPC",
"channel",
"object",
".",
"Args",
":",
"address",
"(",
"Optionsl",
"[",
"str",
"]",
")",
":",
"The",
"host",
"for",
"the",
"channel",
"to",
"use",
".",
"credentials",
"(",
"Optional",
"[",
"~",
".",
"Credentials"... | def create_channel(
cls,
host: str = "googleads.googleapis.com",
credentials: credentials.Credentials = None,
scopes: Optional[Sequence[str]] = None,
**kwargs,
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
address (Optionsl[s... | [
"def",
"create_channel",
"(",
"cls",
",",
"host",
":",
"str",
"=",
"\"googleads.googleapis.com\"",
",",
"credentials",
":",
"credentials",
".",
"Credentials",
"=",
"None",
",",
"scopes",
":",
"Optional",
"[",
"Sequence",
"[",
"str",
"]",
"]",
"=",
"None",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/conversion_adjustment_upload_service/transports/grpc.py#L182-L210 | |
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/future/backports/http/cookiejar.py | python | CookieJar.clear | (self, domain=None, path=None, name=None) | Clear some cookies.
Invoking this method without arguments will clear all cookies. If
given a single argument, only cookies belonging to that domain will be
removed. If given two arguments, cookies belonging to the specified
path within that domain are removed. If given three argumen... | Clear some cookies. | [
"Clear",
"some",
"cookies",
"."
] | def clear(self, domain=None, path=None, name=None):
"""Clear some cookies.
Invoking this method without arguments will clear all cookies. If
given a single argument, only cookies belonging to that domain will be
removed. If given two arguments, cookies belonging to the specified
... | [
"def",
"clear",
"(",
"self",
",",
"domain",
"=",
"None",
",",
"path",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"not",
"None",
":",
"if",
"(",
"domain",
"is",
"None",
")",
"or",
"(",
"path",
"is",
"None",
")",
":",
... | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/future/backports/http/cookiejar.py#L1671-L1696 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/python-social-auth/social/backends/vk.py | python | VKOAuth2.user_data | (self, access_token, *args, **kwargs) | return data | Loads user data from service | Loads user data from service | [
"Loads",
"user",
"data",
"from",
"service"
] | def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
request_data = ['first_name', 'last_name', 'screen_name', 'nickname',
'photo'] + self.setting('EXTRA_DATA', [])
fields = ','.join(set(request_data))
data = vk_api(self, 'users.... | [
"def",
"user_data",
"(",
"self",
",",
"access_token",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"request_data",
"=",
"[",
"'first_name'",
",",
"'last_name'",
",",
"'screen_name'",
",",
"'nickname'",
",",
"'photo'",
"]",
"+",
"self",
".",
"sett... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/python-social-auth/social/backends/vk.py#L103-L125 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/lib-tk/turtle.py | python | RawTurtle.end_fill | (self) | Fill the shape drawn after the call begin_fill().
No argument.
Example (for a Turtle instance named turtle):
>>> turtle.begin_fill()
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>... | Fill the shape drawn after the call begin_fill(). | [
"Fill",
"the",
"shape",
"drawn",
"after",
"the",
"call",
"begin_fill",
"()",
"."
] | def end_fill(self):
"""Fill the shape drawn after the call begin_fill().
No argument.
Example (for a Turtle instance named turtle):
>>> turtle.begin_fill()
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>> turtle.left(90)
>>... | [
"def",
"end_fill",
"(",
"self",
")",
":",
"self",
".",
"fill",
"(",
"False",
")"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/lib-tk/turtle.py#L3198-L3214 | ||
typemytype/drawbot | b64569bfb352acf3ac54d2a91f0a987985685466 | drawBot/drawBotDrawingTools.py | python | DrawBotDrawingTool.cmykStroke | (self, c, m=None, y=None, k=None, alpha=1) | Set a stroke using a CMYK color before drawing a shape. This is handy if the file is intended for print.
Sets the CMYK stroke color. Each value must be a float between 0.0 and 1.0.
.. downloadcode:: cmykStroke.py
# define x, y and the amount of lines needed
x, y = 20, 20
... | Set a stroke using a CMYK color before drawing a shape. This is handy if the file is intended for print. | [
"Set",
"a",
"stroke",
"using",
"a",
"CMYK",
"color",
"before",
"drawing",
"a",
"shape",
".",
"This",
"is",
"handy",
"if",
"the",
"file",
"is",
"intended",
"for",
"print",
"."
] | def cmykStroke(self, c, m=None, y=None, k=None, alpha=1):
"""
Set a stroke using a CMYK color before drawing a shape. This is handy if the file is intended for print.
Sets the CMYK stroke color. Each value must be a float between 0.0 and 1.0.
.. downloadcode:: cmykStroke.py
... | [
"def",
"cmykStroke",
"(",
"self",
",",
"c",
",",
"m",
"=",
"None",
",",
"y",
"=",
"None",
",",
"k",
"=",
"None",
",",
"alpha",
"=",
"1",
")",
":",
"self",
".",
"_requiresNewFirstPage",
"=",
"True",
"self",
".",
"_addInstruction",
"(",
"\"cmykStroke\"... | https://github.com/typemytype/drawbot/blob/b64569bfb352acf3ac54d2a91f0a987985685466/drawBot/drawBotDrawingTools.py#L897-L923 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/data/url/extended_urllib.py | python | ExtendedUrllib._increase_worker_pool_size | (self) | [] | def _increase_worker_pool_size(self):
w3af_core = self.get_w3af_core()
worker_pool = w3af_core.worker_pool
max_workers = w3af_core.MAX_WORKER_THREADS
error_rate = self.get_error_rate()
# Note that we increase by one here, and decrease by two above
new_worker_count = wor... | [
"def",
"_increase_worker_pool_size",
"(",
"self",
")",
":",
"w3af_core",
"=",
"self",
".",
"get_w3af_core",
"(",
")",
"worker_pool",
"=",
"w3af_core",
".",
"worker_pool",
"max_workers",
"=",
"w3af_core",
".",
"MAX_WORKER_THREADS",
"error_rate",
"=",
"self",
".",
... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/data/url/extended_urllib.py#L1003-L1020 | ||||
inducer/loopy | 55143b21711a534c07bbb14aaa63ff3879a93433 | loopy/kernel/__init__.py | python | LoopKernel.all_inames | (self) | return frozenset(self.inames.keys()) | Returns a :class:`frozenset` of the names of all the inames in the kernel. | Returns a :class:`frozenset` of the names of all the inames in the kernel. | [
"Returns",
"a",
":",
"class",
":",
"frozenset",
"of",
"the",
"names",
"of",
"all",
"the",
"inames",
"in",
"the",
"kernel",
"."
] | def all_inames(self):
"""
Returns a :class:`frozenset` of the names of all the inames in the kernel.
"""
return frozenset(self.inames.keys()) | [
"def",
"all_inames",
"(",
"self",
")",
":",
"return",
"frozenset",
"(",
"self",
".",
"inames",
".",
"keys",
"(",
")",
")"
] | https://github.com/inducer/loopy/blob/55143b21711a534c07bbb14aaa63ff3879a93433/loopy/kernel/__init__.py#L747-L751 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/nuki/lock.py | python | NukiOpenerEntity.lock | (self, **kwargs) | Disable ring-to-open. | Disable ring-to-open. | [
"Disable",
"ring",
"-",
"to",
"-",
"open",
"."
] | def lock(self, **kwargs):
"""Disable ring-to-open."""
self._nuki_device.deactivate_rto() | [
"def",
"lock",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_nuki_device",
".",
"deactivate_rto",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nuki/lock.py#L148-L150 | ||
mahmoud/glom | 67cd5a4ed7b21607dfefbafb86d9f93314afd6e1 | glom/core.py | python | glom | (target, spec, **kwargs) | return ret | Access or construct a value from a given *target* based on the
specification declared by *spec*.
Accessing nested data, aka deep-get:
>>> target = {'a': {'b': 'c'}}
>>> glom(target, 'a.b')
'c'
Here the *spec* was just a string denoting a path,
``'a.b.``. As simple as it should be. The nex... | Access or construct a value from a given *target* based on the
specification declared by *spec*. | [
"Access",
"or",
"construct",
"a",
"value",
"from",
"a",
"given",
"*",
"target",
"*",
"based",
"on",
"the",
"specification",
"declared",
"by",
"*",
"spec",
"*",
"."
] | def glom(target, spec, **kwargs):
"""Access or construct a value from a given *target* based on the
specification declared by *spec*.
Accessing nested data, aka deep-get:
>>> target = {'a': {'b': 'c'}}
>>> glom(target, 'a.b')
'c'
Here the *spec* was just a string denoting a path,
``'a... | [
"def",
"glom",
"(",
"target",
",",
"spec",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: check spec up front",
"default",
"=",
"kwargs",
".",
"pop",
"(",
"'default'",
",",
"None",
"if",
"'skip_exc'",
"in",
"kwargs",
"else",
"_MISSING",
")",
"skip_exc",
"=",
... | https://github.com/mahmoud/glom/blob/67cd5a4ed7b21607dfefbafb86d9f93314afd6e1/glom/core.py#L2085-L2182 | |
stanford-futuredata/noscope | 6c6aa72e09280530dfdcf87871c1ac43df3b6cc3 | optimizer/noscope_accuracy.py | python | window_yolo | (frames) | return smooth_indicator(true_indicator) | [] | def window_yolo(frames):
true_indicator = np.asarray( map(lambda x: int(x.confidence > YOLO_CONFIDENCE), frames) )
# smooth and window the yolo labels
return smooth_indicator(true_indicator) | [
"def",
"window_yolo",
"(",
"frames",
")",
":",
"true_indicator",
"=",
"np",
".",
"asarray",
"(",
"map",
"(",
"lambda",
"x",
":",
"int",
"(",
"x",
".",
"confidence",
">",
"YOLO_CONFIDENCE",
")",
",",
"frames",
")",
")",
"# smooth and window the yolo labels",
... | https://github.com/stanford-futuredata/noscope/blob/6c6aa72e09280530dfdcf87871c1ac43df3b6cc3/optimizer/noscope_accuracy.py#L150-L154 | |||
criteo/biggraphite | 1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30 | biggraphite/utils.py | python | FeatureSwitch.enabled | (self) | Check if the feature is enabled or not. | Check if the feature is enabled or not. | [
"Check",
"if",
"the",
"feature",
"is",
"enabled",
"or",
"not",
"."
] | def enabled(self):
"""Check if the feature is enabled or not."""
if self._default_value:
return not self._flag.is_set()
else:
return self._flag.is_set() | [
"def",
"enabled",
"(",
"self",
")",
":",
"if",
"self",
".",
"_default_value",
":",
"return",
"not",
"self",
".",
"_flag",
".",
"is_set",
"(",
")",
"else",
":",
"return",
"self",
".",
"_flag",
".",
"is_set",
"(",
")"
] | https://github.com/criteo/biggraphite/blob/1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30/biggraphite/utils.py#L75-L80 | ||
awslabs/dgl-ke | e9d4f4916f570d2c9f2e1aa3bdec9196c68120e5 | python/dglke/dataloader/sampler.py | python | EvalDataset.get_edges | (self, eval_type) | Get all edges in this dataset
Parameters
----------
eval_type : str
Sampling type, 'valid' for validation and 'test' for testing
Returns
-------
np.array
Edges | Get all edges in this dataset | [
"Get",
"all",
"edges",
"in",
"this",
"dataset"
] | def get_edges(self, eval_type):
""" Get all edges in this dataset
Parameters
----------
eval_type : str
Sampling type, 'valid' for validation and 'test' for testing
Returns
-------
np.array
Edges
"""
if eval_type == 'valid... | [
"def",
"get_edges",
"(",
"self",
",",
"eval_type",
")",
":",
"if",
"eval_type",
"==",
"'valid'",
":",
"return",
"self",
".",
"valid",
"elif",
"eval_type",
"==",
"'test'",
":",
"return",
"self",
".",
"test",
"else",
":",
"raise",
"Exception",
"(",
"'get i... | https://github.com/awslabs/dgl-ke/blob/e9d4f4916f570d2c9f2e1aa3bdec9196c68120e5/python/dglke/dataloader/sampler.py#L701-L719 | ||
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | api/restapi.py | python | __validate_docid | (docid) | Validates that a document id is a string, a unicode, or an int (for backwards compatibility).
It can't be empty, nor longer than 1024 bytes.
Valid inputs
>>> __validate_docid("a")
>>> __validate_docid("\xc3\xb1")
>>> __validate_docid(u"\xc3\xb1")
>>> # for backwards compatibility
>>> __valid... | Validates that a document id is a string, a unicode, or an int (for backwards compatibility).
It can't be empty, nor longer than 1024 bytes.
Valid inputs
>>> __validate_docid("a")
>>> __validate_docid("\xc3\xb1")
>>> __validate_docid(u"\xc3\xb1")
>>> # for backwards compatibility
>>> __valid... | [
"Validates",
"that",
"a",
"document",
"id",
"is",
"a",
"string",
"a",
"unicode",
"or",
"an",
"int",
"(",
"for",
"backwards",
"compatibility",
")",
".",
"It",
"can",
"t",
"be",
"empty",
"nor",
"longer",
"than",
"1024",
"bytes",
".",
"Valid",
"inputs",
"... | def __validate_docid(docid):
"""
Validates that a document id is a string, a unicode, or an int (for backwards compatibility).
It can't be empty, nor longer than 1024 bytes.
Valid inputs
>>> __validate_docid("a")
>>> __validate_docid("\xc3\xb1")
>>> __validate_docid(u"\xc3\xb1")
>>> # fo... | [
"def",
"__validate_docid",
"(",
"docid",
")",
":",
"if",
"type",
"(",
"docid",
")",
"in",
"[",
"int",
",",
"long",
"]",
":",
"docid",
"=",
"str",
"(",
"docid",
")",
"if",
"not",
"type",
"(",
"docid",
")",
"in",
"[",
"str",
",",
"unicode",
"]",
... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/api/restapi.py#L45-L114 | ||
shaohua0116/Group-Normalization-Tensorflow | 551511c939fc5733a61e2505cc03774a6d224547 | datasets/fashion_mnist.py | python | Dataset.ids | (self) | return self._ids | [] | def ids(self):
return self._ids | [
"def",
"ids",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ids"
] | https://github.com/shaohua0116/Group-Normalization-Tensorflow/blob/551511c939fc5733a61e2505cc03774a6d224547/datasets/fashion_mnist.py#L45-L46 | |||
goace/personal-file-sharing-center | 4a5b903b003f2db1306e77c5e51b6660fc5dbc6a | web/browser.py | python | Browser.get_forms | (self) | return self._forms | Returns all forms in the current document.
The returned form objects implement the ClientForm.HTMLForm interface. | Returns all forms in the current document.
The returned form objects implement the ClientForm.HTMLForm interface. | [
"Returns",
"all",
"forms",
"in",
"the",
"current",
"document",
".",
"The",
"returned",
"form",
"objects",
"implement",
"the",
"ClientForm",
".",
"HTMLForm",
"interface",
"."
] | def get_forms(self):
"""Returns all forms in the current document.
The returned form objects implement the ClientForm.HTMLForm interface.
"""
if self._forms is None:
import ClientForm
self._forms = ClientForm.ParseResponse(self.get_response(), backwards_compat=Fal... | [
"def",
"get_forms",
"(",
"self",
")",
":",
"if",
"self",
".",
"_forms",
"is",
"None",
":",
"import",
"ClientForm",
"self",
".",
"_forms",
"=",
"ClientForm",
".",
"ParseResponse",
"(",
"self",
".",
"get_response",
"(",
")",
",",
"backwards_compat",
"=",
"... | https://github.com/goace/personal-file-sharing-center/blob/4a5b903b003f2db1306e77c5e51b6660fc5dbc6a/web/browser.py#L144-L151 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/site-packages/pip/_vendor/requests/models.py | python | Response.raise_for_status | (self) | Raises stored :class:`HTTPError`, if one occurred. | Raises stored :class:`HTTPError`, if one occurred. | [
"Raises",
"stored",
":",
"class",
":",
"HTTPError",
"if",
"one",
"occurred",
"."
] | def raise_for_status(self):
"""Raises stored :class:`HTTPError`, if one occurred."""
http_error_msg = ''
if isinstance(self.reason, bytes):
# We attempt to decode utf-8 first because some servers
# choose to localize their reason strings. If the string
# isn'... | [
"def",
"raise_for_status",
"(",
"self",
")",
":",
"http_error_msg",
"=",
"''",
"if",
"isinstance",
"(",
"self",
".",
"reason",
",",
"bytes",
")",
":",
"# We attempt to decode utf-8 first because some servers",
"# choose to localize their reason strings. If the string",
"# i... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_vendor/requests/models.py#L917-L940 | ||
inasafe/inasafe | 355eb2ce63f516b9c26af0c86a24f99e53f63f87 | safe/gui/tools/peta_bencana_dialog.py | python | PetaBencanaDialog.accept | (self) | Do PetaBencana download and display it in QGIS.
.. versionadded: 3.3 | Do PetaBencana download and display it in QGIS. | [
"Do",
"PetaBencana",
"download",
"and",
"display",
"it",
"in",
"QGIS",
"."
] | def accept(self):
"""Do PetaBencana download and display it in QGIS.
.. versionadded: 3.3
"""
self.save_state()
try:
self.require_directory()
except CanceledImportDialogError:
return
QgsApplication.instance().setOverrideCursor(
... | [
"def",
"accept",
"(",
"self",
")",
":",
"self",
".",
"save_state",
"(",
")",
"try",
":",
"self",
".",
"require_directory",
"(",
")",
"except",
"CanceledImportDialogError",
":",
"return",
"QgsApplication",
".",
"instance",
"(",
")",
".",
"setOverrideCursor",
... | https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/gui/tools/peta_bencana_dialog.py#L205-L288 | ||
duerrp/pyexperiment | c426565d870d944bd5b9712629d8f1ba2527c67f | pyexperiment/Logger.py | python | MPRotLogHandler.__init__ | (self,
filename,
level=logging.DEBUG,
no_backups=0) | Initializer | Initializer | [
"Initializer"
] | def __init__(self,
filename,
level=logging.DEBUG,
no_backups=0):
"""Initializer
"""
# Init base class
super(MPRotLogHandler, self).__init__(level=level)
# Check if we need to roll_over later
roll_over_file = os.path.isfi... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"level",
"=",
"logging",
".",
"DEBUG",
",",
"no_backups",
"=",
"0",
")",
":",
"# Init base class",
"super",
"(",
"MPRotLogHandler",
",",
"self",
")",
".",
"__init__",
"(",
"level",
"=",
"level",
")",
... | https://github.com/duerrp/pyexperiment/blob/c426565d870d944bd5b9712629d8f1ba2527c67f/pyexperiment/Logger.py#L110-L136 | ||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/ui/tui/spokes/language_support.py | python | LangSpoke.refresh | (self, args=None) | args is None if we want a list of languages; or, it is a list of all
locales for a language. | args is None if we want a list of languages; or, it is a list of all
locales for a language. | [
"args",
"is",
"None",
"if",
"we",
"want",
"a",
"list",
"of",
"languages",
";",
"or",
"it",
"is",
"a",
"list",
"of",
"all",
"locales",
"for",
"a",
"language",
"."
] | def refresh(self, args=None):
"""
args is None if we want a list of languages; or, it is a list of all
locales for a language.
"""
NormalTUISpoke.refresh(self, args)
self._container = ListColumnContainer(3)
if args:
self.window.add(TextWidget(_("Avai... | [
"def",
"refresh",
"(",
"self",
",",
"args",
"=",
"None",
")",
":",
"NormalTUISpoke",
".",
"refresh",
"(",
"self",
",",
"args",
")",
"self",
".",
"_container",
"=",
"ListColumnContainer",
"(",
"3",
")",
"if",
"args",
":",
"self",
".",
"window",
".",
"... | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/ui/tui/spokes/language_support.py#L98-L119 | ||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/requests/packages/urllib3/util/connection.py | python | create_connection | (address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, socket_options=None) | Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the... | Connect to *address* and return the socket object. | [
"Connect",
"to",
"*",
"address",
"*",
"and",
"return",
"the",
"socket",
"object",
"."
] | def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, socket_options=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the o... | [
"def",
"create_connection",
"(",
"address",
",",
"timeout",
"=",
"socket",
".",
"_GLOBAL_DEFAULT_TIMEOUT",
",",
"source_address",
"=",
"None",
",",
"socket_options",
"=",
"None",
")",
":",
"host",
",",
"port",
"=",
"address",
"if",
"host",
".",
"startswith",
... | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/requests/packages/urllib3/util/connection.py#L49-L93 | ||
hhursev/recipe-scrapers | 478b9ddb0dda02b17b14f299eea729bef8131aa9 | recipe_scrapers/hostthetoast.py | python | Hostthetoast.yields | (self) | return self.schema.yields() | [] | def yields(self):
return self.schema.yields() | [
"def",
"yields",
"(",
"self",
")",
":",
"return",
"self",
".",
"schema",
".",
"yields",
"(",
")"
] | https://github.com/hhursev/recipe-scrapers/blob/478b9ddb0dda02b17b14f299eea729bef8131aa9/recipe_scrapers/hostthetoast.py#L15-L16 | |||
pazz/alot | 52f11f089df19cf336ad0983368e880dc5364149 | alot/account.py | python | Address.__cmp | (self, other, comparitor) | return (comparitor(username, ouser) and
comparitor(self.domainname.lower(), odomain.lower())) | Shared helper for rich comparison operators.
This allows the comparison operators to be relatively simple and share
the complex logic.
If the username is not considered case sensitive then lower the
username of both self and the other, and handle that the other can be
either an... | Shared helper for rich comparison operators. | [
"Shared",
"helper",
"for",
"rich",
"comparison",
"operators",
"."
] | def __cmp(self, other, comparitor):
"""Shared helper for rich comparison operators.
This allows the comparison operators to be relatively simple and share
the complex logic.
If the username is not considered case sensitive then lower the
username of both self and the other, and... | [
"def",
"__cmp",
"(",
"self",
",",
"other",
",",
"comparitor",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"str",
")",
":",
"try",
":",
"ouser",
",",
"odomain",
"=",
"other",
".",
"split",
"(",
"'@'",
")",
"except",
"ValueError",
":",
"ouser",
... | https://github.com/pazz/alot/blob/52f11f089df19cf336ad0983368e880dc5364149/alot/account.py#L104-L136 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/flux_led/switch.py | python | async_setup_entry | (
hass: HomeAssistant,
entry: config_entries.ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up the Flux lights. | Set up the Flux lights. | [
"Set",
"up",
"the",
"Flux",
"lights",
"."
] | async def async_setup_entry(
hass: HomeAssistant,
entry: config_entries.ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the Flux lights."""
coordinator: FluxLedUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
entities: list[FluxSwitch | FluxRemoteAccessSwitch | Fl... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"config_entries",
".",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"coordinator",
":",
"FluxLedUpdateCoordinator",
"=",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/flux_led/switch.py#L29-L52 | ||
glumpy/glumpy | 46a7635c08d3a200478397edbe0371a6c59cd9d7 | glumpy/transforms/quantitative_scale.py | python | QuantitativeScale.__init__ | (self, code, *args, **kwargs) | Initialize the transform. | Initialize the transform. | [
"Initialize",
"the",
"transform",
"."
] | def __init__(self, code, *args, **kwargs):
"""
Initialize the transform.
"""
self._clamp = False
self._discard = True
self._domain = np.array([-1,+1], dtype=np.float32)
self._range = np.array([-1,+1], dtype=np.float32)
self.process_kwargs(**kwargs)
... | [
"def",
"__init__",
"(",
"self",
",",
"code",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_clamp",
"=",
"False",
"self",
".",
"_discard",
"=",
"True",
"self",
".",
"_domain",
"=",
"np",
".",
"array",
"(",
"[",
"-",
"1",
",... | https://github.com/glumpy/glumpy/blob/46a7635c08d3a200478397edbe0371a6c59cd9d7/glumpy/transforms/quantitative_scale.py#L30-L41 | ||
fcwu/desktop-mirror | f81c6bff0d022ee404c7adfacc9cbb2e1db788b5 | lib/pybonjour.py | python | DNSServiceConstructFullName | (
service = None,
regtype = _NO_DEFAULT,
domain = _NO_DEFAULT,
) | return fullName.value.decode('utf-8') | Concatenate a three-part domain name (as returned by a callback
function) into a properly-escaped full domain name. Note that
callback functions already escape strings where necessary.
service:
The service name; any dots or backslashes must NOT be escaped.
May be None (to construct a PTR... | [] | def DNSServiceConstructFullName(
service = None,
regtype = _NO_DEFAULT,
domain = _NO_DEFAULT,
):
"""
Concatenate a three-part domain name (as returned by a callback
function) into a properly-escaped full domain name. Note that
callback functions already escape strings where necessary... | [
"def",
"DNSServiceConstructFullName",
"(",
"service",
"=",
"None",
",",
"regtype",
"=",
"_NO_DEFAULT",
",",
"domain",
"=",
"_NO_DEFAULT",
",",
")",
":",
"_NO_DEFAULT",
".",
"check",
"(",
"regtype",
")",
"_NO_DEFAULT",
".",
"check",
"(",
"domain",
")",
"_glob... | https://github.com/fcwu/desktop-mirror/blob/f81c6bff0d022ee404c7adfacc9cbb2e1db788b5/lib/pybonjour.py#L1857-L1897 | ||
maraoz/proofofexistence | 10703675824e989f59a8d36fd8c06394e71a2c25 | babel/core.py | python | Locale.languages | (self) | return self._data['languages'] | Mapping of language codes to translated language names.
>>> Locale('de', 'DE').languages['ja']
u'Japanisch'
See `ISO 639 <http://www.loc.gov/standards/iso639-2/>`_ for
more information. | Mapping of language codes to translated language names. | [
"Mapping",
"of",
"language",
"codes",
"to",
"translated",
"language",
"names",
"."
] | def languages(self):
"""Mapping of language codes to translated language names.
>>> Locale('de', 'DE').languages['ja']
u'Japanisch'
See `ISO 639 <http://www.loc.gov/standards/iso639-2/>`_ for
more information.
"""
return self._data['languages'] | [
"def",
"languages",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data",
"[",
"'languages'",
"]"
] | https://github.com/maraoz/proofofexistence/blob/10703675824e989f59a8d36fd8c06394e71a2c25/babel/core.py#L454-L463 | |
MegEngine/Models | 4c55d28bad03652a4e352bf5e736a75df041d84a | official/vision/detection/layers/basic/functional.py | python | safelog | (x, eps=None) | return F.log(F.maximum(x, eps)) | [] | def safelog(x, eps=None):
if eps is None:
eps = np.finfo(x.dtype).eps
return F.log(F.maximum(x, eps)) | [
"def",
"safelog",
"(",
"x",
",",
"eps",
"=",
"None",
")",
":",
"if",
"eps",
"is",
"None",
":",
"eps",
"=",
"np",
".",
"finfo",
"(",
"x",
".",
"dtype",
")",
".",
"eps",
"return",
"F",
".",
"log",
"(",
"F",
".",
"maximum",
"(",
"x",
",",
"eps... | https://github.com/MegEngine/Models/blob/4c55d28bad03652a4e352bf5e736a75df041d84a/official/vision/detection/layers/basic/functional.py#L53-L56 | |||
PatrickLib/captcha_recognize | e4ed7a1513ddcf3b2aec7620f4d68e7c90ddc5a4 | captcha_model.py | python | inputs | (train, batch_size) | return captcha_input.inputs(train, batch_size=batch_size) | [] | def inputs(train, batch_size):
return captcha_input.inputs(train, batch_size=batch_size) | [
"def",
"inputs",
"(",
"train",
",",
"batch_size",
")",
":",
"return",
"captcha_input",
".",
"inputs",
"(",
"train",
",",
"batch_size",
"=",
"batch_size",
")"
] | https://github.com/PatrickLib/captcha_recognize/blob/e4ed7a1513ddcf3b2aec7620f4d68e7c90ddc5a4/captcha_model.py#L14-L15 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/modular/modsym/boundary.py | python | BoundarySpaceElement._sub_ | (self, other) | return BoundarySpaceElement(self.parent(), z) | Return self - other. Assumes that other is a BoundarySpaceElement.
EXAMPLES::
sage: B = ModularSymbols(Gamma1(16), 4).boundary_space()
sage: x = B(Cusp(2/7)) ; y = B(Cusp(13/16))
sage: x - y # indirect doctest
[2/7] - [13/16]
sage: x - x # indirect d... | Return self - other. Assumes that other is a BoundarySpaceElement. | [
"Return",
"self",
"-",
"other",
".",
"Assumes",
"that",
"other",
"is",
"a",
"BoundarySpaceElement",
"."
] | def _sub_(self, other):
"""
Return self - other. Assumes that other is a BoundarySpaceElement.
EXAMPLES::
sage: B = ModularSymbols(Gamma1(16), 4).boundary_space()
sage: x = B(Cusp(2/7)) ; y = B(Cusp(13/16))
sage: x - y # indirect doctest
[2/7] - ... | [
"def",
"_sub_",
"(",
"self",
",",
"other",
")",
":",
"z",
"=",
"dict",
"(",
"self",
".",
"__x",
")",
"for",
"i",
",",
"c",
"in",
"other",
".",
"__x",
".",
"items",
"(",
")",
":",
"if",
"i",
"in",
"z",
":",
"z",
"[",
"i",
"]",
"-=",
"c",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/modsym/boundary.py#L201-L220 | |
NervanaSystems/ngraph-python | ac032c83c7152b615a9ad129d54d350f9d6a2986 | ngraph/op_graph/op_graph.py | python | InputOp.__init__ | (self, axes, aeon_cfg, label, session_id, *args, **kwargs) | Arguments:
axes : of fake data to generate
aeon_cfg : aeon configuration passed in as a string
Return: | Arguments:
axes : of fake data to generate
aeon_cfg : aeon configuration passed in as a string
Return: | [
"Arguments",
":",
"axes",
":",
"of",
"fake",
"data",
"to",
"generate",
"aeon_cfg",
":",
"aeon",
"configuration",
"passed",
"in",
"as",
"a",
"string",
"Return",
":"
] | def __init__(self, axes, aeon_cfg, label, session_id, *args, **kwargs):
"""
Arguments:
axes : of fake data to generate
aeon_cfg : aeon configuration passed in as a string
Return:
"""
super(InputOp, self).__init__(
axes=axes, *args, **kwargs
... | [
"def",
"__init__",
"(",
"self",
",",
"axes",
",",
"aeon_cfg",
",",
"label",
",",
"session_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"InputOp",
",",
"self",
")",
".",
"__init__",
"(",
"axes",
"=",
"axes",
",",
"*",
"a... | https://github.com/NervanaSystems/ngraph-python/blob/ac032c83c7152b615a9ad129d54d350f9d6a2986/ngraph/op_graph/op_graph.py#L2822-L2836 | ||
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/nltk/tag/sequential.py | python | ContextTagger.size | (self) | return len(self._context_to_tag) | :return: The number of entries in the table used by this
tagger to map from contexts to tags. | :return: The number of entries in the table used by this
tagger to map from contexts to tags. | [
":",
"return",
":",
"The",
"number",
"of",
"entries",
"in",
"the",
"table",
"used",
"by",
"this",
"tagger",
"to",
"map",
"from",
"contexts",
"to",
"tags",
"."
] | def size(self):
"""
:return: The number of entries in the table used by this
tagger to map from contexts to tags.
"""
return len(self._context_to_tag) | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_context_to_tag",
")"
] | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/tag/sequential.py#L142-L147 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/extern/graph_editor/subgraph.py | python | make_view | (*args, **kwargs) | return _check_graph(sgv, graph) | Create a SubGraphView from selected operations and passthrough tensors.
Args:
*args: list of 1) regular expressions (compiled or not) or 2) (array of)
`tf.Operation` 3) (array of) `tf.Tensor`. Those objects will be converted
into a list of operations and a list of candidate for passthrough tensors.
... | Create a SubGraphView from selected operations and passthrough tensors. | [
"Create",
"a",
"SubGraphView",
"from",
"selected",
"operations",
"and",
"passthrough",
"tensors",
"."
] | def make_view(*args, **kwargs):
"""Create a SubGraphView from selected operations and passthrough tensors.
Args:
*args: list of 1) regular expressions (compiled or not) or 2) (array of)
`tf.Operation` 3) (array of) `tf.Tensor`. Those objects will be converted
into a list of operations and a list of... | [
"def",
"make_view",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# get keywords arguments",
"graph",
"=",
"kwargs",
"[",
"\"graph\"",
"]",
"if",
"\"graph\"",
"in",
"kwargs",
"else",
"None",
"# already a view?",
"if",
"len",
"(",
"args",
")",
"==",... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/extern/graph_editor/subgraph.py#L629-L655 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/phylomedb/phylomeDB3.py | python | PhylomeDB3Connector.get_external_ids | (self, ids) | return external_ids | Returns all the external IDs registered in the 'external_id' table that
are associated to the input phylomeDB IDs | Returns all the external IDs registered in the 'external_id' table that
are associated to the input phylomeDB IDs | [
"Returns",
"all",
"the",
"external",
"IDs",
"registered",
"in",
"the",
"external_id",
"table",
"that",
"are",
"associated",
"to",
"the",
"input",
"phylomeDB",
"IDs"
] | def get_external_ids(self, ids):
""" Returns all the external IDs registered in the 'external_id' table that
are associated to the input phylomeDB IDs
"""
ids = self.__parser_ids__(ids)
cmd = 'SELECT DISTINCT CONCAT("Phy", p.protid, "_", s.code) as protid, '
cmd += 'external_db AS db, exte... | [
"def",
"get_external_ids",
"(",
"self",
",",
"ids",
")",
":",
"ids",
"=",
"self",
".",
"__parser_ids__",
"(",
"ids",
")",
"cmd",
"=",
"'SELECT DISTINCT CONCAT(\"Phy\", p.protid, \"_\", s.code) as protid, '",
"cmd",
"+=",
"'external_db AS db, external_id AS id FROM protein A... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phylomedb/phylomeDB3.py#L401-L422 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/artist.py | python | Artist.set_clip_on | (self, b) | Set whether artist uses clipping.
When False artists will be visible out side of the axes which
can lead to unexpected results.
Parameters
----------
b : bool | Set whether artist uses clipping. | [
"Set",
"whether",
"artist",
"uses",
"clipping",
"."
] | def set_clip_on(self, b):
"""
Set whether artist uses clipping.
When False artists will be visible out side of the axes which
can lead to unexpected results.
Parameters
----------
b : bool
"""
self._clipon = b
# This may result in the cal... | [
"def",
"set_clip_on",
"(",
"self",
",",
"b",
")",
":",
"self",
".",
"_clipon",
"=",
"b",
"# This may result in the callbacks being hit twice, but ensures they",
"# are hit at least once",
"self",
".",
"pchanged",
"(",
")",
"self",
".",
"stale",
"=",
"True"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/artist.py#L765-L780 | ||
openvinotoolkit/training_extensions | e7aa33af94a1f8004d3ea2df259d99234dfca046 | ote_sdk/ote_sdk/usecases/tasks/interfaces/optimization_interface.py | python | IOptimizationTask.optimize | (
self,
optimization_type: OptimizationType,
dataset: DatasetEntity,
output_model: ModelEntity,
optimization_parameters: Optional[OptimizationParameters],
) | This method defines the interface for optimization.
:param optimization_type: The type of optimization
:param dataset: Optional dataset which may be used as part of the optimization process
:param output_model: Output model
:param optimization_parameters: Additional optimization paramet... | This method defines the interface for optimization. | [
"This",
"method",
"defines",
"the",
"interface",
"for",
"optimization",
"."
] | def optimize(
self,
optimization_type: OptimizationType,
dataset: DatasetEntity,
output_model: ModelEntity,
optimization_parameters: Optional[OptimizationParameters],
):
"""
This method defines the interface for optimization.
:param optimization_type:... | [
"def",
"optimize",
"(",
"self",
",",
"optimization_type",
":",
"OptimizationType",
",",
"dataset",
":",
"DatasetEntity",
",",
"output_model",
":",
"ModelEntity",
",",
"optimization_parameters",
":",
"Optional",
"[",
"OptimizationParameters",
"]",
",",
")",
":",
"r... | https://github.com/openvinotoolkit/training_extensions/blob/e7aa33af94a1f8004d3ea2df259d99234dfca046/ote_sdk/ote_sdk/usecases/tasks/interfaces/optimization_interface.py#L42-L57 | ||
stanfordnlp/stanza-old | 920c55d8eaa1e7105971059c66eb448a74c100d6 | stanza/nlp/data.py | python | Entity.sentence | (self) | Returns the referring sentence | Returns the referring sentence | [
"Returns",
"the",
"referring",
"sentence"
] | def sentence(self):
"""Returns the referring sentence"""
pass | [
"def",
"sentence",
"(",
"self",
")",
":",
"pass"
] | https://github.com/stanfordnlp/stanza-old/blob/920c55d8eaa1e7105971059c66eb448a74c100d6/stanza/nlp/data.py#L28-L30 | ||
perseas/Pyrseas | 957860839c3b0047293a7a4fa982b1a2b85c7eb4 | pyrseas/dbobject/constraint.py | python | PrimaryKey.to_map | (self, db, dbcols) | return {self.name: dct} | Convert a primary key definition to a YAML-suitable format
:param dbcols: dictionary of dbobject columns
:return: dictionary | Convert a primary key definition to a YAML-suitable format | [
"Convert",
"a",
"primary",
"key",
"definition",
"to",
"a",
"YAML",
"-",
"suitable",
"format"
] | def to_map(self, db, dbcols):
"""Convert a primary key definition to a YAML-suitable format
:param dbcols: dictionary of dbobject columns
:return: dictionary
"""
dct = super(PrimaryKey, self).to_map(db)
if self.access_method == 'btree':
dct.pop('access_method... | [
"def",
"to_map",
"(",
"self",
",",
"db",
",",
"dbcols",
")",
":",
"dct",
"=",
"super",
"(",
"PrimaryKey",
",",
"self",
")",
".",
"to_map",
"(",
"db",
")",
"if",
"self",
".",
"access_method",
"==",
"'btree'",
":",
"dct",
".",
"pop",
"(",
"'access_me... | https://github.com/perseas/Pyrseas/blob/957860839c3b0047293a7a4fa982b1a2b85c7eb4/pyrseas/dbobject/constraint.py#L306-L323 | |
inpanel/inpanel | be53d86a72e30dd5476780ed5ba334315a23004b | lib/pxssh.py | python | pxssh.synch_original_prompt | (self) | return False | This attempts to find the prompt. Basically, press enter and record
the response; press enter again and record the response; if the two
responses are similar then assume we are at the original prompt. | This attempts to find the prompt. Basically, press enter and record
the response; press enter again and record the response; if the two
responses are similar then assume we are at the original prompt. | [
"This",
"attempts",
"to",
"find",
"the",
"prompt",
".",
"Basically",
"press",
"enter",
"and",
"record",
"the",
"response",
";",
"press",
"enter",
"again",
"and",
"record",
"the",
"response",
";",
"if",
"the",
"two",
"responses",
"are",
"similar",
"then",
"... | def synch_original_prompt (self):
"""This attempts to find the prompt. Basically, press enter and record
the response; press enter again and record the response; if the two
responses are similar then assume we are at the original prompt. """
# All of these timing pace values are magic.... | [
"def",
"synch_original_prompt",
"(",
"self",
")",
":",
"# All of these timing pace values are magic.",
"# I came up with these based on what seemed reliable for",
"# connecting to a heavily loaded machine I have.",
"# If latency is worse than these values then this will fail.",
"# bug fix REF: h... | https://github.com/inpanel/inpanel/blob/be53d86a72e30dd5476780ed5ba334315a23004b/lib/pxssh.py#L123-L156 | |
XingangPan/Switchable-Whitening | dc8a9947ee27285ab123db1f152e18959e0e0861 | utils/distributed_utils.py | python | average_gradients | (model) | average gradients | average gradients | [
"average",
"gradients"
] | def average_gradients(model):
""" average gradients """
for param in model.parameters():
if param.requires_grad:
dist.all_reduce(param.grad.data) | [
"def",
"average_gradients",
"(",
"model",
")",
":",
"for",
"param",
"in",
"model",
".",
"parameters",
"(",
")",
":",
"if",
"param",
".",
"requires_grad",
":",
"dist",
".",
"all_reduce",
"(",
"param",
".",
"grad",
".",
"data",
")"
] | https://github.com/XingangPan/Switchable-Whitening/blob/dc8a9947ee27285ab123db1f152e18959e0e0861/utils/distributed_utils.py#L22-L26 | ||
kirthevasank/nasbot | 3c745dc986be30e3721087c8fa768099032a0802 | opt/domains.py | python | NNDomain._rand_ga_maximise | (self, obj, num_evals) | Maximise over the space of neural networks via rand_ga. | Maximise over the space of neural networks via rand_ga. | [
"Maximise",
"over",
"the",
"space",
"of",
"neural",
"networks",
"via",
"rand_ga",
"."
] | def _rand_ga_maximise(self, obj, num_evals):
""" Maximise over the space of neural networks via rand_ga. """
raise NotImplementedError('Not implemented rand_ga for NNDomain yet.') | [
"def",
"_rand_ga_maximise",
"(",
"self",
",",
"obj",
",",
"num_evals",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Not implemented rand_ga for NNDomain yet.'",
")"
] | https://github.com/kirthevasank/nasbot/blob/3c745dc986be30e3721087c8fa768099032a0802/opt/domains.py#L165-L167 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/quota.py | python | DbQuotaDriver.destroy_all_by_project | (self, context, project_id) | Destroy all quotas, usages, and reservations associated with a
project.
:param context: The request context, for access checks.
:param project_id: The ID of the project being deleted. | Destroy all quotas, usages, and reservations associated with a
project. | [
"Destroy",
"all",
"quotas",
"usages",
"and",
"reservations",
"associated",
"with",
"a",
"project",
"."
] | def destroy_all_by_project(self, context, project_id):
"""
Destroy all quotas, usages, and reservations associated with a
project.
:param context: The request context, for access checks.
:param project_id: The ID of the project being deleted.
"""
db.quota_destro... | [
"def",
"destroy_all_by_project",
"(",
"self",
",",
"context",
",",
"project_id",
")",
":",
"db",
".",
"quota_destroy_all_by_project",
"(",
"context",
",",
"project_id",
")"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/quota.py#L359-L368 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | twistedcaldav/directory/addressbook.py | python | DirectoryAddressBookHomeTypeProvisioningResource.principalForRecord | (self, record) | return self._parent.principalForRecord(record) | [] | def principalForRecord(self, record):
return self._parent.principalForRecord(record) | [
"def",
"principalForRecord",
"(",
"self",
",",
"record",
")",
":",
"return",
"self",
".",
"_parent",
".",
"principalForRecord",
"(",
"record",
")"
] | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/directory/addressbook.py#L227-L228 | |||
programa-stic/barf-project | 9547ef843b8eb021c2c32c140e36173c0b4eafa3 | barf/arch/arm/parser.py | python | parse_instruction | (string, location, tokens) | return instr | Parse an ARM instruction. | Parse an ARM instruction. | [
"Parse",
"an",
"ARM",
"instruction",
"."
] | def parse_instruction(string, location, tokens):
"""Parse an ARM instruction.
"""
mnemonic_str = tokens.get("mnemonic")
operands = [op for op in tokens.get("operands", [])]
instr = ArmInstruction(
string,
mnemonic_str["ins"],
operands,
arch_info.architecture_mode
... | [
"def",
"parse_instruction",
"(",
"string",
",",
"location",
",",
"tokens",
")",
":",
"mnemonic_str",
"=",
"tokens",
".",
"get",
"(",
"\"mnemonic\"",
")",
"operands",
"=",
"[",
"op",
"for",
"op",
"in",
"tokens",
".",
"get",
"(",
"\"operands\"",
",",
"[",
... | https://github.com/programa-stic/barf-project/blob/9547ef843b8eb021c2c32c140e36173c0b4eafa3/barf/arch/arm/parser.py#L163-L185 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/xdot/xdot.py | python | DotWindow.set_xdotcode | (self, xdotcode, filename='<stdin>') | [] | def set_xdotcode(self, xdotcode, filename='<stdin>'):
if self.widget.set_xdotcode(xdotcode):
self.set_title(os.path.basename(filename) + ' - Dot Viewer')
self.widget.zoom_to_fit() | [
"def",
"set_xdotcode",
"(",
"self",
",",
"xdotcode",
",",
"filename",
"=",
"'<stdin>'",
")",
":",
"if",
"self",
".",
"widget",
".",
"set_xdotcode",
"(",
"xdotcode",
")",
":",
"self",
".",
"set_title",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"file... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/xdot/xdot.py#L1778-L1781 | ||||
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/lang_python.py | python | PythonImportsEvaluator.eval | (self, mgr) | [] | def eval(self, mgr):
try:
imp_prefix = tuple(self.trg.extra["imp_prefix"])
if imp_prefix:
libs = self.buf.libs
if not imp_prefix[0]:
if not imp_prefix[-1]:
# Deal with last item being empty, i.e. "from ."
... | [
"def",
"eval",
"(",
"self",
",",
"mgr",
")",
":",
"try",
":",
"imp_prefix",
"=",
"tuple",
"(",
"self",
".",
"trg",
".",
"extra",
"[",
"\"imp_prefix\"",
"]",
")",
"if",
"imp_prefix",
":",
"libs",
"=",
"self",
".",
"buf",
".",
"libs",
"if",
"not",
... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/lang_python.py#L208-L280 | ||||
mozilla/foundation.mozilla.org | 6757f8d4a56ea97800d304dd0b43ee23dac6593d | network-api/networkapi/wagtailpages/pagemodels/index.py | python | IndexPage.generate_entries_set_html | (self, request, *args, **kwargs) | return JsonResponse({
'entries_html': html,
'has_next': has_next,
}) | JSON endpoint for getting a set of (pre-rendered) entries | JSON endpoint for getting a set of (pre-rendered) entries | [
"JSON",
"endpoint",
"for",
"getting",
"a",
"set",
"of",
"(",
"pre",
"-",
"rendered",
")",
"entries"
] | def generate_entries_set_html(self, request, *args, **kwargs):
"""
JSON endpoint for getting a set of (pre-rendered) entries
"""
page = 1
if 'page' in request.GET:
try:
page = int(request.GET['page'])
except ValueError:
pas... | [
"def",
"generate_entries_set_html",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"page",
"=",
"1",
"if",
"'page'",
"in",
"request",
".",
"GET",
":",
"try",
":",
"page",
"=",
"int",
"(",
"request",
".",
"GET",
"[... | https://github.com/mozilla/foundation.mozilla.org/blob/6757f8d4a56ea97800d304dd0b43ee23dac6593d/network-api/networkapi/wagtailpages/pagemodels/index.py#L185-L241 | |
enthought/traitsui | b7c38c7a47bf6ae7971f9ddab70c8a358647dd25 | traitsui/wx/text_editor.py | python | ReadonlyEditor.dispose | (self) | Disposes of the contents of an editor. | Disposes of the contents of an editor. | [
"Disposes",
"of",
"the",
"contents",
"of",
"an",
"editor",
"."
] | def dispose(self):
"""Disposes of the contents of an editor."""
if self.factory.view is not None:
control = self.control
control.Unbind(wx.EVT_ENTER_WINDOW)
control.Unbind(wx.EVT_LEAVE_WINDOW)
control.Unbind(wx.EVT_LEFT_DOWN)
control.Unbind(wx.... | [
"def",
"dispose",
"(",
"self",
")",
":",
"if",
"self",
".",
"factory",
".",
"view",
"is",
"not",
"None",
":",
"control",
"=",
"self",
".",
"control",
"control",
".",
"Unbind",
"(",
"wx",
".",
"EVT_ENTER_WINDOW",
")",
"control",
".",
"Unbind",
"(",
"w... | https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/wx/text_editor.py#L200-L209 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/taskrouter/v1/workspace/workflow/__init__.py | python | WorkflowPage.__repr__ | (self) | return '<Twilio.Taskrouter.V1.WorkflowPage>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.Taskrouter.V1.WorkflowPage>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.Taskrouter.V1.WorkflowPage>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py#L212-L219 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/codecs/card.py | python | S3PDFCardTemplate.__init__ | (self,
pagesize,
cardsize,
margins = None,
spacing = None,
title = None,
) | Args:
pagesize: the page size, tuple (w, h)
cardsize: the card size, tuple (w, h)
margins: the page margins, tuple (N, E, S, W)
spacing: the spacing between cards, tuple (H, V)
title: the document title
Note:
- ... | Args:
pagesize: the page size, tuple (w, h)
cardsize: the card size, tuple (w, h)
margins: the page margins, tuple (N, E, S, W)
spacing: the spacing between cards, tuple (H, V)
title: the document title | [
"Args",
":",
"pagesize",
":",
"the",
"page",
"size",
"tuple",
"(",
"w",
"h",
")",
"cardsize",
":",
"the",
"card",
"size",
"tuple",
"(",
"w",
"h",
")",
"margins",
":",
"the",
"page",
"margins",
"tuple",
"(",
"N",
"E",
"S",
"W",
")",
"spacing",
":"... | def __init__(self,
pagesize,
cardsize,
margins = None,
spacing = None,
title = None,
):
"""
Args:
pagesize: the page size, tuple (w, h)
cardsize: the card size, tuple... | [
"def",
"__init__",
"(",
"self",
",",
"pagesize",
",",
"cardsize",
",",
"margins",
"=",
"None",
",",
"spacing",
"=",
"None",
",",
"title",
"=",
"None",
",",
")",
":",
"# Spacing between cards",
"if",
"spacing",
"is",
"None",
":",
"spacing",
"=",
"(",
"1... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/codecs/card.py#L294-L363 | ||
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/utils/events/containers/_evented_list.py | python | EventedList.move | (self, src_index: int, dest_index: int = 0) | return True | Insert object at ``src_index`` before ``dest_index``.
Both indices refer to the list prior to any object removal
(pre-move space). | Insert object at ``src_index`` before ``dest_index``. | [
"Insert",
"object",
"at",
"src_index",
"before",
"dest_index",
"."
] | def move(self, src_index: int, dest_index: int = 0) -> bool:
"""Insert object at ``src_index`` before ``dest_index``.
Both indices refer to the list prior to any object removal
(pre-move space).
"""
if dest_index < 0:
dest_index += len(self) + 1
if dest_index... | [
"def",
"move",
"(",
"self",
",",
"src_index",
":",
"int",
",",
"dest_index",
":",
"int",
"=",
"0",
")",
"->",
"bool",
":",
"if",
"dest_index",
"<",
"0",
":",
"dest_index",
"+=",
"len",
"(",
"self",
")",
"+",
"1",
"if",
"dest_index",
"in",
"(",
"s... | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/events/containers/_evented_list.py#L206-L225 | |
hvac/hvac | ec048ded30d21c13c21cfa950d148c8bfc1467b0 | hvac/api/secrets_engines/identity.py | python | Identity.read_tokens_backend_configuration | (self, mount_point=DEFAULT_MOUNT_POINT) | return self._adapter.get(
url=api_path,
) | Query vault identity tokens configurations.
Supported methods:
GET: {mount_point}/oidc/config.
:return: The response of the read_tokens_backend_configuration request.
:rtype: dict | Query vault identity tokens configurations. | [
"Query",
"vault",
"identity",
"tokens",
"configurations",
"."
] | def read_tokens_backend_configuration(self, mount_point=DEFAULT_MOUNT_POINT):
"""Query vault identity tokens configurations.
Supported methods:
GET: {mount_point}/oidc/config.
:return: The response of the read_tokens_backend_configuration request.
:rtype: dict
"""
... | [
"def",
"read_tokens_backend_configuration",
"(",
"self",
",",
"mount_point",
"=",
"DEFAULT_MOUNT_POINT",
")",
":",
"api_path",
"=",
"utils",
".",
"format_url",
"(",
"\"/v1/{mount_point}/oidc/config\"",
",",
"mount_point",
"=",
"mount_point",
",",
")",
"return",
"self"... | https://github.com/hvac/hvac/blob/ec048ded30d21c13c21cfa950d148c8bfc1467b0/hvac/api/secrets_engines/identity.py#L1261-L1276 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3db/org.py | python | organisation_update_affiliations | (record) | Update affiliations for a branch organisation
Args:
record: the org_organisation_branch record | Update affiliations for a branch organisation | [
"Update",
"affiliations",
"for",
"a",
"branch",
"organisation"
] | def organisation_update_affiliations(record):
"""
Update affiliations for a branch organisation
Args:
record: the org_organisation_branch record
"""
if record.deleted and record.deleted_fk:
try:
fk = json.loads(record.deleted_fk)
branch_id = fk["... | [
"def",
"organisation_update_affiliations",
"(",
"record",
")",
":",
"if",
"record",
".",
"deleted",
"and",
"record",
".",
"deleted_fk",
":",
"try",
":",
"fk",
"=",
"json",
".",
"loads",
"(",
"record",
".",
"deleted_fk",
")",
"branch_id",
"=",
"fk",
"[",
... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3db/org.py#L8272-L8338 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/distutils/fancy_getopt.py | python | FancyGetopt.set_aliases | (self, alias) | Set the aliases for this option parser. | Set the aliases for this option parser. | [
"Set",
"the",
"aliases",
"for",
"this",
"option",
"parser",
"."
] | def set_aliases (self, alias):
"""Set the aliases for this option parser."""
self._check_alias_dict(alias, "alias")
self.alias = alias | [
"def",
"set_aliases",
"(",
"self",
",",
"alias",
")",
":",
"self",
".",
"_check_alias_dict",
"(",
"alias",
",",
"\"alias\"",
")",
"self",
".",
"alias",
"=",
"alias"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/distutils/fancy_getopt.py#L132-L135 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/core/symbol.py | python | symbols | (names, **args) | Transform strings into instances of :class:`Symbol` class.
:func:`symbols` function returns a sequence of symbols with names taken
from ``names`` argument, which can be a comma or whitespace delimited
string, or a sequence of strings::
>>> from sympy import symbols, Function
>>> x, y, z =... | Transform strings into instances of :class:`Symbol` class. | [
"Transform",
"strings",
"into",
"instances",
"of",
":",
"class",
":",
"Symbol",
"class",
"."
] | def symbols(names, **args):
"""
Transform strings into instances of :class:`Symbol` class.
:func:`symbols` function returns a sequence of symbols with names taken
from ``names`` argument, which can be a comma or whitespace delimited
string, or a sequence of strings::
>>> from sympy import ... | [
"def",
"symbols",
"(",
"names",
",",
"*",
"*",
"args",
")",
":",
"result",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"names",
",",
"string_types",
")",
":",
"marker",
"=",
"0",
"literals",
"=",
"[",
"'\\,'",
",",
"'\\:'",
",",
"'\\ '",
"]",
"for",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/core/symbol.py#L301-L511 | ||
projecthamster/hamster | 19d160090de30e756bdc3122ff935bdaa86e2843 | waflib/Tools/ccroot.py | python | accept_node_to_link | (self, node) | return not node.name.endswith('.pdb') | PRIVATE INTERNAL USE ONLY | PRIVATE INTERNAL USE ONLY | [
"PRIVATE",
"INTERNAL",
"USE",
"ONLY"
] | def accept_node_to_link(self, node):
"""
PRIVATE INTERNAL USE ONLY
"""
return not node.name.endswith('.pdb') | [
"def",
"accept_node_to_link",
"(",
"self",
",",
"node",
")",
":",
"return",
"not",
"node",
".",
"name",
".",
"endswith",
"(",
"'.pdb'",
")"
] | https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/waflib/Tools/ccroot.py#L434-L438 | |
PaddlePaddle/models | 511e2e282960ed4c7440c3f1d1e62017acb90e11 | tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_paddle/paddlevision/datasets/vision.py | python | StandardTransform._format_transform_repr | (self, transform: Callable,
head: str) | return (["{}{}".format(head, lines[0])] +
["{}{}".format(" " * len(head), line) for line in lines[1:]]) | [] | def _format_transform_repr(self, transform: Callable,
head: str) -> List[str]:
lines = transform.__repr__().splitlines()
return (["{}{}".format(head, lines[0])] +
["{}{}".format(" " * len(head), line) for line in lines[1:]]) | [
"def",
"_format_transform_repr",
"(",
"self",
",",
"transform",
":",
"Callable",
",",
"head",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"lines",
"=",
"transform",
".",
"__repr__",
"(",
")",
".",
"splitlines",
"(",
")",
"return",
"(",
"[",
... | https://github.com/PaddlePaddle/models/blob/511e2e282960ed4c7440c3f1d1e62017acb90e11/tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_paddle/paddlevision/datasets/vision.py#L99-L103 | |||
kubeflow/pipelines | bea751c9259ff0ae85290f873170aae89284ba8e | backend/api/python_http_client/kfp_server_api/models/report_run_metrics_response_report_run_metric_result.py | python | ReportRunMetricsResponseReportRunMetricResult.metric_node_id | (self) | return self._metric_node_id | Gets the metric_node_id of this ReportRunMetricsResponseReportRunMetricResult. # noqa: E501
Output. The ID of the node which reports the metric. # noqa: E501
:return: The metric_node_id of this ReportRunMetricsResponseReportRunMetricResult. # noqa: E501
:rtype: str | Gets the metric_node_id of this ReportRunMetricsResponseReportRunMetricResult. # noqa: E501 | [
"Gets",
"the",
"metric_node_id",
"of",
"this",
"ReportRunMetricsResponseReportRunMetricResult",
".",
"#",
"noqa",
":",
"E501"
] | def metric_node_id(self):
"""Gets the metric_node_id of this ReportRunMetricsResponseReportRunMetricResult. # noqa: E501
Output. The ID of the node which reports the metric. # noqa: E501
:return: The metric_node_id of this ReportRunMetricsResponseReportRunMetricResult. # noqa: E501
... | [
"def",
"metric_node_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_metric_node_id"
] | https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/backend/api/python_http_client/kfp_server_api/models/report_run_metrics_response_report_run_metric_result.py#L94-L102 | |
google/apitools | 31cad2d904f356872d2965687e84b2d87ee2cdd3 | apitools/base/py/transfer.py | python | Download.__SetTotal | (self, info) | Sets the total size based off info if possible otherwise 0. | Sets the total size based off info if possible otherwise 0. | [
"Sets",
"the",
"total",
"size",
"based",
"off",
"info",
"if",
"possible",
"otherwise",
"0",
"."
] | def __SetTotal(self, info):
"""Sets the total size based off info if possible otherwise 0."""
if 'content-range' in info:
_, _, total = info['content-range'].rpartition('/')
if total != '*':
self.__total_size = int(total)
# Note "total_size is None" means ... | [
"def",
"__SetTotal",
"(",
"self",
",",
"info",
")",
":",
"if",
"'content-range'",
"in",
"info",
":",
"_",
",",
"_",
",",
"total",
"=",
"info",
"[",
"'content-range'",
"]",
".",
"rpartition",
"(",
"'/'",
")",
"if",
"total",
"!=",
"'*'",
":",
"self",
... | https://github.com/google/apitools/blob/31cad2d904f356872d2965687e84b2d87ee2cdd3/apitools/base/py/transfer.py#L291-L302 | ||
VLSIDA/OpenRAM | f66aac3264598eeae31225c62b6a4af52412d407 | compiler/bitcells/pbitcell.py | python | pbitcell.get_wl_name | (self, port=0) | return "wl{}".format(port) | Get wl name by port | Get wl name by port | [
"Get",
"wl",
"name",
"by",
"port"
] | def get_wl_name(self, port=0):
"""Get wl name by port"""
debug.check(port < 2, "Two ports for bitcell_2port only.")
return "wl{}".format(port) | [
"def",
"get_wl_name",
"(",
"self",
",",
"port",
"=",
"0",
")",
":",
"debug",
".",
"check",
"(",
"port",
"<",
"2",
",",
"\"Two ports for bitcell_2port only.\"",
")",
"return",
"\"wl{}\"",
".",
"format",
"(",
"port",
")"
] | https://github.com/VLSIDA/OpenRAM/blob/f66aac3264598eeae31225c62b6a4af52412d407/compiler/bitcells/pbitcell.py#L1121-L1124 | |
pritunl/pritunl | d793ce820f53f31bfc01e86d8b92ec098ab6362d | pritunl/influxdb/client.py | python | InfluxDBClient.from_DSN | (dsn, **kwargs) | return InfluxDBClient(**init_args) | Return an instance of :class:`~.InfluxDBClient` from the provided
data source name. Supported schemes are "influxdb", "https+influxdb"
and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient`
constructor may also be passed to this method.
:param dsn: data source name
:ty... | Return an instance of :class:`~.InfluxDBClient` from the provided
data source name. Supported schemes are "influxdb", "https+influxdb"
and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient`
constructor may also be passed to this method. | [
"Return",
"an",
"instance",
"of",
":",
"class",
":",
"~",
".",
"InfluxDBClient",
"from",
"the",
"provided",
"data",
"source",
"name",
".",
"Supported",
"schemes",
"are",
"influxdb",
"https",
"+",
"influxdb",
"and",
"udp",
"+",
"influxdb",
".",
"Parameters",
... | def from_DSN(dsn, **kwargs):
"""Return an instance of :class:`~.InfluxDBClient` from the provided
data source name. Supported schemes are "influxdb", "https+influxdb"
and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient`
constructor may also be passed to this method.
... | [
"def",
"from_DSN",
"(",
"dsn",
",",
"*",
"*",
"kwargs",
")",
":",
"init_args",
"=",
"parse_dsn",
"(",
"dsn",
")",
"host",
",",
"port",
"=",
"init_args",
".",
"pop",
"(",
"'hosts'",
")",
"[",
"0",
"]",
"init_args",
"[",
"'host'",
"]",
"=",
"host",
... | https://github.com/pritunl/pritunl/blob/d793ce820f53f31bfc01e86d8b92ec098ab6362d/pritunl/influxdb/client.py#L158-L195 | |
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/alembic/operations.py | python | Operations.get_context | (self) | return self.migration_context | Return the :class:`.MigrationContext` object that's
currently in use. | Return the :class:`.MigrationContext` object that's
currently in use. | [
"Return",
"the",
":",
"class",
":",
".",
"MigrationContext",
"object",
"that",
"s",
"currently",
"in",
"use",
"."
] | def get_context(self):
"""Return the :class:`.MigrationContext` object that's
currently in use.
"""
return self.migration_context | [
"def",
"get_context",
"(",
"self",
")",
":",
"return",
"self",
".",
"migration_context"
] | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/alembic/operations.py#L143-L149 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/imghdr.py | python | test_xbm | (h, f) | X bitmap (X10 or X11) | X bitmap (X10 or X11) | [
"X",
"bitmap",
"(",
"X10",
"or",
"X11",
")"
] | def test_xbm(h, f):
"""X bitmap (X10 or X11)"""
if h.startswith(b'#define '):
return 'xbm' | [
"def",
"test_xbm",
"(",
"h",
",",
"f",
")",
":",
"if",
"h",
".",
"startswith",
"(",
"b'#define '",
")",
":",
"return",
"'xbm'"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/imghdr.py#L100-L103 | ||
rootpy/rootpy | 3926935e1f2100d8ba68070c2ab44055d4800f73 | rootpy/extern/byteplay2/__init__.py | python | recompile_all | (path) | recursively recompile all .py files in the directory | recursively recompile all .py files in the directory | [
"recursively",
"recompile",
"all",
".",
"py",
"files",
"in",
"the",
"directory"
] | def recompile_all(path):
"""recursively recompile all .py files in the directory"""
import os
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
for name in files:
if name.endswith('.py'):
filename = os.path.abspath(os.path.join(root, name... | [
"def",
"recompile_all",
"(",
"path",
")",
":",
"import",
"os",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"for",
"name",
"in",
"files",
... | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/byteplay2/__init__.py#L887-L899 | ||
rcorcs/NatI | fdf014f4292afdc95250add7b6658468043228e1 | en/parser/nltk_lite/parse/rd.py | python | RecursiveDescent._expand | (self, remaining_text, tree, frontier, production=None) | return parses | @rtype: C{list} of C{Tree}
@return: A list of all parses that can be generated by
expanding the first element of C{frontier} with
C{production}. In particular, if the first element of
C{frontier} is a subtree whose node type is equal to
C{production}'s left hand ... | [] | def _expand(self, remaining_text, tree, frontier, production=None):
"""
@rtype: C{list} of C{Tree}
@return: A list of all parses that can be generated by
expanding the first element of C{frontier} with
C{production}. In particular, if the first element of
C{f... | [
"def",
"_expand",
"(",
"self",
",",
"remaining_text",
",",
"tree",
",",
"frontier",
",",
"production",
"=",
"None",
")",
":",
"if",
"production",
"is",
"None",
":",
"productions",
"=",
"self",
".",
"_grammar",
".",
"productions",
"(",
")",
"else",
":",
... | https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/parse/rd.py#L174-L225 | ||
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/ext/mypy/infer.py | python | _infer_type_from_decl_composite_property | (
api: SemanticAnalyzerPluginInterface,
stmt: AssignmentStmt,
node: Var,
left_hand_explicit_type: Optional[ProperType],
) | Infer the type of mapping from a CompositeProperty. | Infer the type of mapping from a CompositeProperty. | [
"Infer",
"the",
"type",
"of",
"mapping",
"from",
"a",
"CompositeProperty",
"."
] | def _infer_type_from_decl_composite_property(
api: SemanticAnalyzerPluginInterface,
stmt: AssignmentStmt,
node: Var,
left_hand_explicit_type: Optional[ProperType],
) -> Optional[ProperType]:
"""Infer the type of mapping from a CompositeProperty."""
assert isinstance(stmt.rvalue, CallExpr)
t... | [
"def",
"_infer_type_from_decl_composite_property",
"(",
"api",
":",
"SemanticAnalyzerPluginInterface",
",",
"stmt",
":",
"AssignmentStmt",
",",
"node",
":",
"Var",
",",
"left_hand_explicit_type",
":",
"Optional",
"[",
"ProperType",
"]",
",",
")",
"->",
"Optional",
"... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/ext/mypy/infer.py#L242-L271 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_image.py | python | Yedit._write | (filename, contents) | Actually write the file contents to disk. This helps with mocking. | Actually write the file contents to disk. This helps with mocking. | [
"Actually",
"write",
"the",
"file",
"contents",
"to",
"disk",
".",
"This",
"helps",
"with",
"mocking",
"."
] | def _write(filename, contents):
''' Actually write the file contents to disk. This helps with mocking. '''
tmp_filename = filename + '.yedit'
with open(tmp_filename, 'w') as yfd:
fcntl.flock(yfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
yfd.write(contents)
fcntl.flock... | [
"def",
"_write",
"(",
"filename",
",",
"contents",
")",
":",
"tmp_filename",
"=",
"filename",
"+",
"'.yedit'",
"with",
"open",
"(",
"tmp_filename",
",",
"'w'",
")",
"as",
"yfd",
":",
"fcntl",
".",
"flock",
"(",
"yfd",
",",
"fcntl",
".",
"LOCK_EX",
"|",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_image.py#L342-L352 | ||
pfnet/pytorch-pfn-extras | b7ced31c1e78a0527c36d745ca091ec270da49e3 | pytorch_pfn_extras/nn/parallel/distributed.py | python | DistributedDataParallel.register_comm_hook | (self, hook: HookFun) | return handle | Registers a hook function. This module will invoke the hook before
starting the synchronization.
Args:
hook: Callable object that will be invoked before synchronization | Registers a hook function. This module will invoke the hook before
starting the synchronization. | [
"Registers",
"a",
"hook",
"function",
".",
"This",
"module",
"will",
"invoke",
"the",
"hook",
"before",
"starting",
"the",
"synchronization",
"."
] | def register_comm_hook(self, hook: HookFun) -> hooks.RemovableHandle:
"""Registers a hook function. This module will invoke the hook before
starting the synchronization.
Args:
hook: Callable object that will be invoked before synchronization
"""
handle = hooks.RemovableH... | [
"def",
"register_comm_hook",
"(",
"self",
",",
"hook",
":",
"HookFun",
")",
"->",
"hooks",
".",
"RemovableHandle",
":",
"handle",
"=",
"hooks",
".",
"RemovableHandle",
"(",
"self",
".",
"_comm_hooks",
")",
"self",
".",
"_comm_hooks",
"[",
"handle",
".",
"i... | https://github.com/pfnet/pytorch-pfn-extras/blob/b7ced31c1e78a0527c36d745ca091ec270da49e3/pytorch_pfn_extras/nn/parallel/distributed.py#L246-L255 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/sms/v20190711/models.py | python | AddSmsSignRequest.__init__ | (self) | r"""
:param SignName: 签名名称。
注:不能重复申请已通过或待审核的签名。
:type SignName: str
:param SignType: 签名类型。其中每种类型后面标注了其可选的 DocumentType(证明类型):
0:公司(0,1,2,3)。
1:APP(0,1,2,3,4) 。
2:网站(0,1,2,3,5)。
3:公众号或者小程序(0,1,2,3,6)。
4:商标(7)。
5:政府/机关事业单位/其他机构(2,3)。
注:必须按照对应关系选择证明类型,否则会审核失败。
:type SignType: int
:p... | r"""
:param SignName: 签名名称。
注:不能重复申请已通过或待审核的签名。
:type SignName: str
:param SignType: 签名类型。其中每种类型后面标注了其可选的 DocumentType(证明类型):
0:公司(0,1,2,3)。
1:APP(0,1,2,3,4) 。
2:网站(0,1,2,3,5)。
3:公众号或者小程序(0,1,2,3,6)。
4:商标(7)。
5:政府/机关事业单位/其他机构(2,3)。
注:必须按照对应关系选择证明类型,否则会审核失败。
:type SignType: int
:p... | [
"r",
":",
"param",
"SignName",
":",
"签名名称。",
"注:不能重复申请已通过或待审核的签名。",
":",
"type",
"SignName",
":",
"str",
":",
"param",
"SignType",
":",
"签名类型。其中每种类型后面标注了其可选的",
"DocumentType(证明类型):",
"0:公司(0,1,2,3)。",
"1:APP(0,1,2,3,4)",
"。",
"2:网站(0,1,2,3,5)。",
"3:公众号或者小程序(0,1,2,3,6)。",
... | def __init__(self):
r"""
:param SignName: 签名名称。
注:不能重复申请已通过或待审核的签名。
:type SignName: str
:param SignType: 签名类型。其中每种类型后面标注了其可选的 DocumentType(证明类型):
0:公司(0,1,2,3)。
1:APP(0,1,2,3,4) 。
2:网站(0,1,2,3,5)。
3:公众号或者小程序(0,1,2,3,6)。
4:商标(7)。
5:政府/机关事业单位/其他机构(2,3)。
注:必须按照对应关系选择证明类型,否则会审核失败。
:t... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"SignName",
"=",
"None",
"self",
".",
"SignType",
"=",
"None",
"self",
".",
"DocumentType",
"=",
"None",
"self",
".",
"International",
"=",
"None",
"self",
".",
"UsedMethod",
"=",
"None",
"self",
"... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/sms/v20190711/models.py#L54-L102 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/custom_objects_api.py | python | CustomObjectsApi.get_namespaced_custom_object | (self, group, version, namespace, plural, name, **kwargs) | return self.get_namespaced_custom_object_with_http_info(group, version, namespace, plural, name, **kwargs) | get_namespaced_custom_object # noqa: E501
Returns a namespace scoped custom object # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_namespaced_custom_object(group, version, names... | get_namespaced_custom_object # noqa: E501 | [
"get_namespaced_custom_object",
"#",
"noqa",
":",
"E501"
] | def get_namespaced_custom_object(self, group, version, namespace, plural, name, **kwargs): # noqa: E501
"""get_namespaced_custom_object # noqa: E501
Returns a namespace scoped custom object # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous ... | [
"def",
"get_namespaced_custom_object",
"(",
"self",
",",
"group",
",",
"version",
",",
"namespace",
",",
"plural",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/custom_objects_api.py#L1457-L1484 | |
capitalone/datacompy | 8418a5c55fa7648764c0bca87931cf778dc19d48 | datacompy/core.py | python | Compare.all_rows_overlap | (self) | return len(self.df1_unq_rows) == len(self.df2_unq_rows) == 0 | Whether the rows are all present in both dataframes
Returns
-------
bool
True if all rows in df1 are in df2 and vice versa (based on
existence for join option) | Whether the rows are all present in both dataframes | [
"Whether",
"the",
"rows",
"are",
"all",
"present",
"in",
"both",
"dataframes"
] | def all_rows_overlap(self):
"""Whether the rows are all present in both dataframes
Returns
-------
bool
True if all rows in df1 are in df2 and vice versa (based on
existence for join option)
"""
return len(self.df1_unq_rows) == len(self.df2_unq_ro... | [
"def",
"all_rows_overlap",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"df1_unq_rows",
")",
"==",
"len",
"(",
"self",
".",
"df2_unq_rows",
")",
"==",
"0"
] | https://github.com/capitalone/datacompy/blob/8418a5c55fa7648764c0bca87931cf778dc19d48/datacompy/core.py#L390-L399 | |
jschrewe/django-mongoadmin | c53b8a0e7d3b96c9dd03126576b53ec9602f0a20 | mongoadmin/validation.py | python | ModelAdminValidator.validate_search_fields | (self, cls, model) | Validate search_fields is a sequence. | Validate search_fields is a sequence. | [
"Validate",
"search_fields",
"is",
"a",
"sequence",
"."
] | def validate_search_fields(self, cls, model):
" Validate search_fields is a sequence. "
if hasattr(cls, 'search_fields'):
check_isseq(cls, 'search_fields', cls.search_fields) | [
"def",
"validate_search_fields",
"(",
"self",
",",
"cls",
",",
"model",
")",
":",
"if",
"hasattr",
"(",
"cls",
",",
"'search_fields'",
")",
":",
"check_isseq",
"(",
"cls",
",",
"'search_fields'",
",",
"cls",
".",
"search_fields",
")"
] | https://github.com/jschrewe/django-mongoadmin/blob/c53b8a0e7d3b96c9dd03126576b53ec9602f0a20/mongoadmin/validation.py#L286-L289 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/forms/fields.py | python | FileField.clean | (self, data, initial=None) | return super(FileField, self).clean(data) | [] | def clean(self, data, initial=None):
# If the widget got contradictory inputs, we raise a validation error
if data is FILE_INPUT_CONTRADICTION:
raise ValidationError(self.error_messages['contradiction'], code='contradiction')
# False means the field value should be cleared; further v... | [
"def",
"clean",
"(",
"self",
",",
"data",
",",
"initial",
"=",
"None",
")",
":",
"# If the widget got contradictory inputs, we raise a validation error",
"if",
"data",
"is",
"FILE_INPUT_CONTRADICTION",
":",
"raise",
"ValidationError",
"(",
"self",
".",
"error_messages",... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/forms/fields.py#L583-L600 | |||
eBay/accelerator | 218d9a5e4451ac72b9e65df6c5b32e37d25136c8 | accelerator/web.py | python | BaseWebHandler._bad_request | (self) | [] | def _bad_request(self):
self.do_response(400, "text/plain", "Bad request\n") | [
"def",
"_bad_request",
"(",
"self",
")",
":",
"self",
".",
"do_response",
"(",
"400",
",",
"\"text/plain\"",
",",
"\"Bad request\\n\"",
")"
] | https://github.com/eBay/accelerator/blob/218d9a5e4451ac72b9e65df6c5b32e37d25136c8/accelerator/web.py#L98-L99 | ||||
stopstalk/stopstalk-deployment | 10c3ab44c4ece33ae515f6888c15033db2004bb1 | aws_lambda/spoj_aws_lambda_function/lambda_code/pkg_resources/_vendor/pyparsing.py | python | matchPreviousLiteral | (expr) | return rep | Helper to define an expression that is indirectly defined from
the tokens matched in a previous expression, that is, it looks
for a 'repeat' of a previous expression. For example::
first = Word(nums)
second = matchPreviousLiteral(first)
matchExpr = first + ":" + second
will match C{... | Helper to define an expression that is indirectly defined from
the tokens matched in a previous expression, that is, it looks
for a 'repeat' of a previous expression. For example::
first = Word(nums)
second = matchPreviousLiteral(first)
matchExpr = first + ":" + second
will match C{... | [
"Helper",
"to",
"define",
"an",
"expression",
"that",
"is",
"indirectly",
"defined",
"from",
"the",
"tokens",
"matched",
"in",
"a",
"previous",
"expression",
"that",
"is",
"it",
"looks",
"for",
"a",
"repeat",
"of",
"a",
"previous",
"expression",
".",
"For",
... | def matchPreviousLiteral(expr):
"""
Helper to define an expression that is indirectly defined from
the tokens matched in a previous expression, that is, it looks
for a 'repeat' of a previous expression. For example::
first = Word(nums)
second = matchPreviousLiteral(first)
matchE... | [
"def",
"matchPreviousLiteral",
"(",
"expr",
")",
":",
"rep",
"=",
"Forward",
"(",
")",
"def",
"copyTokenToRepeater",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"if",
"t",
":",
"if",
"len",
"(",
"t",
")",
"==",
"1",
":",
"rep",
"<<",
"t",
"[",
"0",... | https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pkg_resources/_vendor/pyparsing.py#L4509-L4535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.