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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
containernet/containernet | 7b2ae38d691b2ed8da2b2700b85ed03562271d01 | examples/sshd.py | python | TreeNet | ( depth=1, fanout=2, **kwargs ) | return Mininet( topo, waitConnected=True, **kwargs ) | Convenience function for creating tree networks. | Convenience function for creating tree networks. | [
"Convenience",
"function",
"for",
"creating",
"tree",
"networks",
"."
] | def TreeNet( depth=1, fanout=2, **kwargs ):
"Convenience function for creating tree networks."
topo = TreeTopo( depth, fanout )
return Mininet( topo, waitConnected=True, **kwargs ) | [
"def",
"TreeNet",
"(",
"depth",
"=",
"1",
",",
"fanout",
"=",
"2",
",",
"*",
"*",
"kwargs",
")",
":",
"topo",
"=",
"TreeTopo",
"(",
"depth",
",",
"fanout",
")",
"return",
"Mininet",
"(",
"topo",
",",
"waitConnected",
"=",
"True",
",",
"*",
"*",
"... | https://github.com/containernet/containernet/blob/7b2ae38d691b2ed8da2b2700b85ed03562271d01/examples/sshd.py#L29-L32 | |
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/assin/assin.py | python | Assin._split_generators | (self, dl_manager) | return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"filepaths": train_paths,
"files": dl_manager.iter_archive(archive),
},
),
datasets.SplitGenerator(
name=d... | Returns SplitGenerators. | Returns SplitGenerators. | [
"Returns",
"SplitGenerators",
"."
] | def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
archive = dl_manager.download(_URL)
train_paths = []
dev_paths = []
test_paths = []
if self.config.name == "full" or self.config.name == "ptpt":
train_paths.append("assin-ptpt-train.xml"... | [
"def",
"_split_generators",
"(",
"self",
",",
"dl_manager",
")",
":",
"archive",
"=",
"dl_manager",
".",
"download",
"(",
"_URL",
")",
"train_paths",
"=",
"[",
"]",
"dev_paths",
"=",
"[",
"]",
"test_paths",
"=",
"[",
"]",
"if",
"self",
".",
"config",
"... | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/assin/assin.py#L110-L150 | |
wonderworks-software/PyFlow | 57e2c858933bf63890d769d985396dfad0fca0f0 | PyFlow/Core/GraphBase.py | python | GraphBase.count | (self) | return self._nodes.__len__() | Returns number of nodes
:rtype: int | Returns number of nodes | [
"Returns",
"number",
"of",
"nodes"
] | def count(self):
"""Returns number of nodes
:rtype: int
"""
return self._nodes.__len__() | [
"def",
"count",
"(",
"self",
")",
":",
"return",
"self",
".",
"_nodes",
".",
"__len__",
"(",
")"
] | https://github.com/wonderworks-software/PyFlow/blob/57e2c858933bf63890d769d985396dfad0fca0f0/PyFlow/Core/GraphBase.py#L481-L486 | |
uqfoundation/mystic | 154e6302d1f2f94e8f13e88ecc5f24241cc28ac7 | mystic/math/measures.py | python | tvariance | (samples, weights=None, k=0, clip=False) | return mean(abs(samples - trim_mean)**2, weights) | calculate the (weighted) trimmed variance for a list of points
Inputs:
samples -- a list of sample points
weights -- a list of sample weights
k -- percent samples to trim (k%) [tuple (lo,hi) or float if lo=hi]
clip -- if True, winsorize instead of trimming k% of samples
NOTE: if all samples are exclud... | calculate the (weighted) trimmed variance for a list of points | [
"calculate",
"the",
"(",
"weighted",
")",
"trimmed",
"variance",
"for",
"a",
"list",
"of",
"points"
] | def tvariance(samples, weights=None, k=0, clip=False):
"""calculate the (weighted) trimmed variance for a list of points
Inputs:
samples -- a list of sample points
weights -- a list of sample weights
k -- percent samples to trim (k%) [tuple (lo,hi) or float if lo=hi]
clip -- if True, winsorize inst... | [
"def",
"tvariance",
"(",
"samples",
",",
"weights",
"=",
"None",
",",
"k",
"=",
"0",
",",
"clip",
"=",
"False",
")",
":",
"samples",
",",
"weights",
"=",
"_sort",
"(",
"samples",
",",
"weights",
")",
"weights",
"=",
"_k",
"(",
"weights",
",",
"k",
... | https://github.com/uqfoundation/mystic/blob/154e6302d1f2f94e8f13e88ecc5f24241cc28ac7/mystic/math/measures.py#L1582-L1596 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py | python | InsertNanotube_EditCommand.getCursorText | (self, endPoint1, endPoint2) | return text , textColor | This is used as a callback method in CntLine mode
@see: NanotubeLineMode.setParams, NanotubeLineMode_GM.Draw | This is used as a callback method in CntLine mode | [
"This",
"is",
"used",
"as",
"a",
"callback",
"method",
"in",
"CntLine",
"mode"
] | def getCursorText(self, endPoint1, endPoint2):
"""
This is used as a callback method in CntLine mode
@see: NanotubeLineMode.setParams, NanotubeLineMode_GM.Draw
"""
text = ""
textColor = env.prefs[cursorTextColor_prefs_key] # Mark 2008-08-28
if endPoint1 is None ... | [
"def",
"getCursorText",
"(",
"self",
",",
"endPoint1",
",",
"endPoint2",
")",
":",
"text",
"=",
"\"\"",
"textColor",
"=",
"env",
".",
"prefs",
"[",
"cursorTextColor_prefs_key",
"]",
"# Mark 2008-08-28",
"if",
"endPoint1",
"is",
"None",
"or",
"endPoint2",
"is",... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py#L324-L359 | |
google-research/pegasus | 649a5978e45a078e1574ed01c92fc12d3aa05f7f | pegasus/params/estimator_utils.py | python | get_assignment_map_from_checkpoint | (tvars, init_checkpoint) | return (assignment_map, initialized_variable_names) | Compute the union of the current variables and checkpoint variables. | Compute the union of the current variables and checkpoint variables. | [
"Compute",
"the",
"union",
"of",
"the",
"current",
"variables",
"and",
"checkpoint",
"variables",
"."
] | def get_assignment_map_from_checkpoint(tvars, init_checkpoint):
"""Compute the union of the current variables and checkpoint variables."""
assignment_map = {}
initialized_variable_names = {}
name_to_variable = collections.OrderedDict()
for var in tvars:
name = var.name
m = re.match("^(.*):\\d+$", nam... | [
"def",
"get_assignment_map_from_checkpoint",
"(",
"tvars",
",",
"init_checkpoint",
")",
":",
"assignment_map",
"=",
"{",
"}",
"initialized_variable_names",
"=",
"{",
"}",
"name_to_variable",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"var",
"in",
"tv... | https://github.com/google-research/pegasus/blob/649a5978e45a078e1574ed01c92fc12d3aa05f7f/pegasus/params/estimator_utils.py#L216-L240 | |
jazzband/django-admin2 | 7770da8a4931db60326f87d9fa7a15b1ef704c4c | example/polls/models.py | python | Choice.__str__ | (self) | return self.choice_text | [] | def __str__(self):
return self.choice_text | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"choice_text"
] | https://github.com/jazzband/django-admin2/blob/7770da8a4931db60326f87d9fa7a15b1ef704c4c/example/polls/models.py#L36-L37 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/distutils/npy_pkg_config.py | python | VariableSet.variables | (self) | return list(self._raw_data.keys()) | Return the list of variable names.
Parameters
----------
None
Returns
-------
names : list of str
The names of all variables in the `VariableSet` instance. | Return the list of variable names. | [
"Return",
"the",
"list",
"of",
"variable",
"names",
"."
] | def variables(self):
"""
Return the list of variable names.
Parameters
----------
None
Returns
-------
names : list of str
The names of all variables in the `VariableSet` instance.
"""
return list(self._raw_data.keys()) | [
"def",
"variables",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_raw_data",
".",
"keys",
"(",
")",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/distutils/npy_pkg_config.py#L197-L211 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/turtledemo/clock.py | python | hand | (laenge, spitze) | [] | def hand(laenge, spitze):
fd(laenge*1.15)
rt(90)
fd(spitze/2.0)
lt(120)
fd(spitze)
lt(120)
fd(spitze)
lt(120)
fd(spitze/2.0) | [
"def",
"hand",
"(",
"laenge",
",",
"spitze",
")",
":",
"fd",
"(",
"laenge",
"*",
"1.15",
")",
"rt",
"(",
"90",
")",
"fd",
"(",
"spitze",
"/",
"2.0",
")",
"lt",
"(",
"120",
")",
"fd",
"(",
"spitze",
")",
"lt",
"(",
"120",
")",
"fd",
"(",
"sp... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/turtledemo/clock.py#L25-L34 | ||||
FoglyOgly/Meowth | 91829c57767ffa4db1083eaac348b220cb984b94 | meowth/exts/map/map_cog.py | python | Mapper.importgymsheet | (self, ctx, *args) | Delete current Gyms and import the fresh list of Gyms from a Google spreadsheet.
Format must match the [template.](https://docs.google.com/spreadsheets/d/1W-VTAzlnDefgBIXoc7kuRcxJIlYo7iojqRRQ0uwTifc/edit?usp=sharing)
Gyms will only be usable by the server they were imported in. | Delete current Gyms and import the fresh list of Gyms from a Google spreadsheet. | [
"Delete",
"current",
"Gyms",
"and",
"import",
"the",
"fresh",
"list",
"of",
"Gyms",
"from",
"a",
"Google",
"spreadsheet",
"."
] | async def importgymsheet(self, ctx, *args):
"""Delete current Gyms and import the fresh list of Gyms from a Google spreadsheet.
Format must match the [template.](https://docs.google.com/spreadsheets/d/1W-VTAzlnDefgBIXoc7kuRcxJIlYo7iojqRRQ0uwTifc/edit?usp=sharing)
Gyms will only be usable by the... | [
"async",
"def",
"importgymsheet",
"(",
"self",
",",
"ctx",
",",
"*",
"args",
")",
":",
"if",
"args",
":",
"url",
"=",
"args",
"[",
"0",
"]",
"ids",
"=",
"self",
".",
"spreadsheet_ids_from_url",
"(",
"url",
")",
"if",
"not",
"ids",
":",
"await",
"ct... | https://github.com/FoglyOgly/Meowth/blob/91829c57767ffa4db1083eaac348b220cb984b94/meowth/exts/map/map_cog.py#L1151-L1188 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/billiard/forkserver.py | python | _serve_one | (s, listener, alive_r, handler) | [] | def _serve_one(s, listener, alive_r, handler):
# close unnecessary stuff and reset SIGCHLD handler
listener.close()
os.close(alive_r)
signal.signal(signal.SIGCHLD, handler)
# receive fds from parent process
fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1)
s.close()
assert len(fds) <= MAXF... | [
"def",
"_serve_one",
"(",
"s",
",",
"listener",
",",
"alive_r",
",",
"handler",
")",
":",
"# close unnecessary stuff and reset SIGCHLD handler",
"listener",
".",
"close",
"(",
")",
"os",
".",
"close",
"(",
"alive_r",
")",
"signal",
".",
"signal",
"(",
"signal"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/billiard/forkserver.py#L205-L232 | ||||
aws-cloudformation/cfn-lint | 16df5d0ca0d8ebcf9330ebea701e83d883b47217 | src/cfnlint/rules/parameters/Used.py | python | Used.searchstring | (self, string, parameter) | return regex.findall(string) | Search string for tokenized fields | Search string for tokenized fields | [
"Search",
"string",
"for",
"tokenized",
"fields"
] | def searchstring(self, string, parameter):
"""Search string for tokenized fields"""
regex = re.compile(r'\${(%s)}' % parameter)
return regex.findall(string) | [
"def",
"searchstring",
"(",
"self",
",",
"string",
",",
"parameter",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r'\\${(%s)}'",
"%",
"parameter",
")",
"return",
"regex",
".",
"findall",
"(",
"string",
")"
] | https://github.com/aws-cloudformation/cfn-lint/blob/16df5d0ca0d8ebcf9330ebea701e83d883b47217/src/cfnlint/rules/parameters/Used.py#L20-L23 | |
Yelp/clusterman | 54beef89c01a2681aafd1fbb93b6ad5f6252d6cf | clusterman/aws/auto_scaling_resource_group.py | python | AutoScalingResourceGroup._get_options_for_instance_type | (
self, instance_type: str, weight: Optional[float] = None,
) | return options | Generate a list of possible ClusterNode types that could be added to this ASG,
given a particular instance type | Generate a list of possible ClusterNode types that could be added to this ASG,
given a particular instance type | [
"Generate",
"a",
"list",
"of",
"possible",
"ClusterNode",
"types",
"that",
"could",
"be",
"added",
"to",
"this",
"ASG",
"given",
"a",
"particular",
"instance",
"type"
] | def _get_options_for_instance_type(
self, instance_type: str, weight: Optional[float] = None,
) -> List[ClusterNodeMetadata]:
""" Generate a list of possible ClusterNode types that could be added to this ASG,
given a particular instance type """
options = []
az_options = sel... | [
"def",
"_get_options_for_instance_type",
"(",
"self",
",",
"instance_type",
":",
"str",
",",
"weight",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
")",
"->",
"List",
"[",
"ClusterNodeMetadata",
"]",
":",
"options",
"=",
"[",
"]",
"az_options",
"=... | https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/clusterman/aws/auto_scaling_resource_group.py#L197-L214 | |
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/platforms/virtual_pinball/virtual_pinball.py | python | VirtualPinballPlatform.vpx_changed_lamps | (self) | return self._get_changed_lights_by_subtype("matrix") | Return changed lamps since last call. | Return changed lamps since last call. | [
"Return",
"changed",
"lamps",
"since",
"last",
"call",
"."
] | def vpx_changed_lamps(self):
"""Return changed lamps since last call."""
return self._get_changed_lights_by_subtype("matrix") | [
"def",
"vpx_changed_lamps",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_changed_lights_by_subtype",
"(",
"\"matrix\"",
")"
] | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/virtual_pinball/virtual_pinball.py#L230-L232 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/hashlib.py | python | __hash_new | (name, data=b'') | new(name, data=b'') - Return a new hashing object using the named algorithm;
optionally initialized with data (which must be bytes). | new(name, data=b'') - Return a new hashing object using the named algorithm;
optionally initialized with data (which must be bytes). | [
"new",
"(",
"name",
"data",
"=",
"b",
")",
"-",
"Return",
"a",
"new",
"hashing",
"object",
"using",
"the",
"named",
"algorithm",
";",
"optionally",
"initialized",
"with",
"data",
"(",
"which",
"must",
"be",
"bytes",
")",
"."
] | def __hash_new(name, data=b''):
"""new(name, data=b'') - Return a new hashing object using the named algorithm;
optionally initialized with data (which must be bytes).
"""
try:
return _hashlib.new(name, data)
except ValueError:
# If the _hashlib module (OpenSSL) doesn't support the n... | [
"def",
"__hash_new",
"(",
"name",
",",
"data",
"=",
"b''",
")",
":",
"try",
":",
"return",
"_hashlib",
".",
"new",
"(",
"name",
",",
"data",
")",
"except",
"ValueError",
":",
"# If the _hashlib module (OpenSSL) doesn't support the named",
"# hash, try using our buil... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/hashlib.py#L117-L128 | ||
Kinto/kinto | a9e46e57de8f33c7be098c6f583de18df03b2824 | kinto/plugins/default_bucket/__init__.py | python | resource_create_object | (request, resource_cls, uri) | return obj | Implicitly create a resource (or fail silently).
In the default bucket, the bucket and collection are implicitly
created. This helper creates one of those resources using a
simulated request and context that is appropriate for the
resource. Also runs create events as though the resource were
create... | Implicitly create a resource (or fail silently). | [
"Implicitly",
"create",
"a",
"resource",
"(",
"or",
"fail",
"silently",
")",
"."
] | def resource_create_object(request, resource_cls, uri):
"""Implicitly create a resource (or fail silently).
In the default bucket, the bucket and collection are implicitly
created. This helper creates one of those resources using a
simulated request and context that is appropriate for the
resource.... | [
"def",
"resource_create_object",
"(",
"request",
",",
"resource_cls",
",",
"uri",
")",
":",
"resource_name",
",",
"matchdict",
"=",
"view_lookup",
"(",
"request",
",",
"uri",
")",
"# Build a fake request, mainly used to populate the create events that",
"# will be triggered... | https://github.com/Kinto/kinto/blob/a9e46e57de8f33c7be098c6f583de18df03b2824/kinto/plugins/default_bucket/__init__.py#L60-L107 | |
dib-lab/khmer | fb65d21eaedf0d397d49ae3debc578897f9d6eb4 | sandbox/sweep-reads.py | python | ReadBuffer.__init__ | (self) | [] | def __init__(self):
self.buf = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"buf",
"=",
"[",
"]"
] | https://github.com/dib-lab/khmer/blob/fb65d21eaedf0d397d49ae3debc578897f9d6eb4/sandbox/sweep-reads.py#L100-L101 | ||||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/lib2to3/btm_matcher.py | python | BottomMatcher.add | (self, pattern, start) | Recursively adds a linear pattern to the AC automaton | Recursively adds a linear pattern to the AC automaton | [
"Recursively",
"adds",
"a",
"linear",
"pattern",
"to",
"the",
"AC",
"automaton"
] | def add(self, pattern, start):
"""Recursively adds a linear pattern to the AC automaton"""
if not pattern:
return [
start]
else:
if isinstance(pattern[0], tuple):
match_nodes = []
for alternative in pattern[0]:
... | [
"def",
"add",
"(",
"self",
",",
"pattern",
",",
"start",
")",
":",
"if",
"not",
"pattern",
":",
"return",
"[",
"start",
"]",
"else",
":",
"if",
"isinstance",
"(",
"pattern",
"[",
"0",
"]",
",",
"tuple",
")",
":",
"match_nodes",
"=",
"[",
"]",
"fo... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib2to3/btm_matcher.py#L53-L77 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/distributed/rpc.py | python | Request.__getstate__ | (self) | Get serializable states.
Must be inherited by subclasses. For array members, return them as
individual return values (i.e., do not put them in containers like
dictionary or list). | Get serializable states. | [
"Get",
"serializable",
"states",
"."
] | def __getstate__(self):
"""Get serializable states.
Must be inherited by subclasses. For array members, return them as
individual return values (i.e., do not put them in containers like
dictionary or list).
""" | [
"def",
"__getstate__",
"(",
"self",
")",
":"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/distributed/rpc.py#L335-L341 | ||
SUSE/DeepSea | 9c7fad93915ba1250c40d50c855011e9fe41ed21 | srv/modules/runners/osd.py | python | OSDUtil.replace | (self) | return self._call() | 1) ceph osd out $id
2) systemctl stop ceph-osd@$id (maybe do more see osd.py (terminate()))
2.1) also maybe wait if not force
3) ceph osd destroy $id --yes-i-really-mean-it
4) ceph-volume lvm zap --osd-id $id | 1) ceph osd out $id
2) systemctl stop ceph-osd | [
"1",
")",
"ceph",
"osd",
"out",
"$id",
"2",
")",
"systemctl",
"stop",
"ceph",
"-",
"osd"
] | def replace(self):
"""
1) ceph osd out $id
2) systemctl stop ceph-osd@$id (maybe do more see osd.py (terminate()))
2.1) also maybe wait if not force
3) ceph osd destroy $id --yes-i-really-mean-it
4) ceph-volume lvm zap --osd-id $id
"""
log.info("Preparing ... | [
"def",
"replace",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"\"Preparing replacement of osd {} on host {}\"",
".",
"format",
"(",
"self",
".",
"osd_id",
",",
"self",
".",
"host",
")",
")",
"return",
"self",
".",
"_call",
"(",
")"
] | https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/modules/runners/osd.py#L167-L177 | |
amazon-archives/aws-security-benchmark | 672cacf5e8244d7b090ed6de613e91139b585dbd | aws_cis_foundation_framework/aws-cis-foundation-benchmark-checklist.py | python | control_2_6_ensure_cloudtrail_bucket_logging | (cloudtrails) | return {'Result': result, 'failReason': failReason, 'Offenders': offenders, 'ScoredControl': scored, 'Description': description, 'ControlId': control} | Summary
Args:
cloudtrails (TYPE): Description
Returns:
TYPE: Description | Summary | [
"Summary"
] | def control_2_6_ensure_cloudtrail_bucket_logging(cloudtrails):
"""Summary
Args:
cloudtrails (TYPE): Description
Returns:
TYPE: Description
"""
result = True
failReason = ""
offenders = []
control = "2.6"
description = "Ensure S3 bucket access logging is enabled on t... | [
"def",
"control_2_6_ensure_cloudtrail_bucket_logging",
"(",
"cloudtrails",
")",
":",
"result",
"=",
"True",
"failReason",
"=",
"\"\"",
"offenders",
"=",
"[",
"]",
"control",
"=",
"\"2.6\"",
"description",
"=",
"\"Ensure S3 bucket access logging is enabled on the CloudTrail ... | https://github.com/amazon-archives/aws-security-benchmark/blob/672cacf5e8244d7b090ed6de613e91139b585dbd/aws_cis_foundation_framework/aws-cis-foundation-benchmark-checklist.py#L1013-L1044 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/core/surface.py | python | SlabGenerator.get_slab | (self, shift=0, tol=0.1, energy=None) | return Slab(
slab.lattice,
slab.species_and_occu,
slab.frac_coords,
self.miller_index,
ouc,
shift,
scale_factor,
energy=energy,
site_properties=slab.site_properties,
reorient_lattice=self.reorient_lat... | This method takes in shift value for the c lattice direction and
generates a slab based on the given shift. You should rarely use this
method. Instead, it is used by other generation algorithms to obtain
all slabs.
Arg:
shift (float): A shift value in Angstrom that determine... | This method takes in shift value for the c lattice direction and
generates a slab based on the given shift. You should rarely use this
method. Instead, it is used by other generation algorithms to obtain
all slabs. | [
"This",
"method",
"takes",
"in",
"shift",
"value",
"for",
"the",
"c",
"lattice",
"direction",
"and",
"generates",
"a",
"slab",
"based",
"on",
"the",
"given",
"shift",
".",
"You",
"should",
"rarely",
"use",
"this",
"method",
".",
"Instead",
"it",
"is",
"u... | def get_slab(self, shift=0, tol=0.1, energy=None):
"""
This method takes in shift value for the c lattice direction and
generates a slab based on the given shift. You should rarely use this
method. Instead, it is used by other generation algorithms to obtain
all slabs.
A... | [
"def",
"get_slab",
"(",
"self",
",",
"shift",
"=",
"0",
",",
"tol",
"=",
"0.1",
",",
"energy",
"=",
"None",
")",
":",
"h",
"=",
"self",
".",
"_proj_height",
"p",
"=",
"round",
"(",
"h",
"/",
"self",
".",
"parent",
".",
"lattice",
".",
"d_hkl",
... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/core/surface.py#L931-L1022 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/tvdbapiv2/models/episode_data_query_params.py | python | EpisodeDataQueryParams.data | (self, data) | Sets the data of this EpisodeDataQueryParams.
:param data: The data of this EpisodeDataQueryParams.
:type: list[text_type] | Sets the data of this EpisodeDataQueryParams. | [
"Sets",
"the",
"data",
"of",
"this",
"EpisodeDataQueryParams",
"."
] | def data(self, data):
"""
Sets the data of this EpisodeDataQueryParams.
:param data: The data of this EpisodeDataQueryParams.
:type: list[text_type]
"""
self._data = data | [
"def",
"data",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_data",
"=",
"data"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tvdbapiv2/models/episode_data_query_params.py#L64-L72 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/topology/simplicial_complex_morphism.py | python | SimplicialComplexMorphism.is_injective | (self) | return True | Return ``True`` if and only if ``self`` is injective.
EXAMPLES::
sage: S = simplicial_complexes.Sphere(1)
sage: T = simplicial_complexes.Sphere(2)
sage: U = simplicial_complexes.Sphere(3)
sage: H = Hom(T,S)
sage: G = Hom(T,U)
sage: f = {0... | Return ``True`` if and only if ``self`` is injective. | [
"Return",
"True",
"if",
"and",
"only",
"if",
"self",
"is",
"injective",
"."
] | def is_injective(self):
"""
Return ``True`` if and only if ``self`` is injective.
EXAMPLES::
sage: S = simplicial_complexes.Sphere(1)
sage: T = simplicial_complexes.Sphere(2)
sage: U = simplicial_complexes.Sphere(3)
sage: H = Hom(T,S)
... | [
"def",
"is_injective",
"(",
"self",
")",
":",
"v",
"=",
"[",
"self",
".",
"_vertex_dictionary",
"[",
"i",
"[",
"0",
"]",
"]",
"for",
"i",
"in",
"self",
".",
"domain",
"(",
")",
".",
"faces",
"(",
")",
"[",
"0",
"]",
"]",
"for",
"i",
"in",
"v"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/topology/simplicial_complex_morphism.py#L494-L519 | |
p5py/p5 | 4ef1580b26179f1973c1669751da4522c5823f17 | p5/core/api.py | python | textDescent | () | return text_descent() | Returns descent of the current font at its current size
:returns: descent of the current font at its current size
:rtype: float | Returns descent of the current font at its current size | [
"Returns",
"descent",
"of",
"the",
"current",
"font",
"at",
"its",
"current",
"size"
] | def textDescent():
"""Returns descent of the current font at its current size
:returns: descent of the current font at its current size
:rtype: float
"""
return text_descent() | [
"def",
"textDescent",
"(",
")",
":",
"return",
"text_descent",
"(",
")"
] | https://github.com/p5py/p5/blob/4ef1580b26179f1973c1669751da4522c5823f17/p5/core/api.py#L428-L435 | |
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | exercises/1901040031/d07/mymodule/stats_word.py | python | stats_text | (text) | 合并统计英文词频和中文词频 | 合并统计英文词频和中文词频 | [
"合并统计英文词频和中文词频"
] | def stats_text(text):
'''合并统计英文词频和中文词频'''
print(stats_text_en(text)+stats_text_cn(text)) | [
"def",
"stats_text",
"(",
"text",
")",
":",
"print",
"(",
"stats_text_en",
"(",
"text",
")",
"+",
"stats_text_cn",
"(",
"text",
")",
")"
] | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901040031/d07/mymodule/stats_word.py#L61-L63 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/plotting/pygletplot/plot_object.py | python | PlotObject.draw | (self) | OpenGL rendering code for the plot object.
Override in base class. | OpenGL rendering code for the plot object.
Override in base class. | [
"OpenGL",
"rendering",
"code",
"for",
"the",
"plot",
"object",
".",
"Override",
"in",
"base",
"class",
"."
] | def draw(self):
"""
OpenGL rendering code for the plot object.
Override in base class.
"""
pass | [
"def",
"draw",
"(",
"self",
")",
":",
"pass"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/plotting/pygletplot/plot_object.py#L14-L19 | ||
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | lib/cmdlib/instance_utils.py | python | NICListToTuple | (lu, nics) | return hooks_nics | Build a list of nic information tuples.
This list is suitable to be passed to _BuildInstanceHookEnv or as a return
value in LUInstanceQueryData.
@type lu: L{LogicalUnit}
@param lu: the logical unit on whose behalf we execute
@type nics: list of L{objects.NIC}
@param nics: list of nics to convert to hooks... | Build a list of nic information tuples. | [
"Build",
"a",
"list",
"of",
"nic",
"information",
"tuples",
"."
] | def NICListToTuple(lu, nics):
"""Build a list of nic information tuples.
This list is suitable to be passed to _BuildInstanceHookEnv or as a return
value in LUInstanceQueryData.
@type lu: L{LogicalUnit}
@param lu: the logical unit on whose behalf we execute
@type nics: list of L{objects.NIC}
@param nic... | [
"def",
"NICListToTuple",
"(",
"lu",
",",
"nics",
")",
":",
"hooks_nics",
"=",
"[",
"]",
"for",
"nic",
"in",
"nics",
":",
"hooks_nics",
".",
"append",
"(",
"NICToTuple",
"(",
"lu",
",",
"nic",
")",
")",
"return",
"hooks_nics"
] | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/cmdlib/instance_utils.py#L407-L422 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/importlib_metadata/__init__.py | python | Distribution.at | (path) | return PathDistribution(pathlib.Path(path)) | Return a Distribution for the indicated metadata path
:param path: a string or path-like object
:return: a concrete Distribution instance for the path | Return a Distribution for the indicated metadata path | [
"Return",
"a",
"Distribution",
"for",
"the",
"indicated",
"metadata",
"path"
] | def at(path):
"""Return a Distribution for the indicated metadata path
:param path: a string or path-like object
:return: a concrete Distribution instance for the path
"""
return PathDistribution(pathlib.Path(path)) | [
"def",
"at",
"(",
"path",
")",
":",
"return",
"PathDistribution",
"(",
"pathlib",
".",
"Path",
"(",
"path",
")",
")"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/importlib_metadata/__init__.py#L555-L561 | |
django/django | 0a17666045de6739ae1c2ac695041823d5f827f7 | django/core/mail/message.py | python | EmailMessage.attach | (self, filename=None, content=None, mimetype=None) | Attach a file with the given filename and content. The filename can
be omitted and the mimetype is guessed, if not provided.
If the first parameter is a MIMEBase subclass, insert it directly
into the resulting message attachments.
For a text/* mimetype (guessed or specified), when a by... | Attach a file with the given filename and content. The filename can
be omitted and the mimetype is guessed, if not provided. | [
"Attach",
"a",
"file",
"with",
"the",
"given",
"filename",
"and",
"content",
".",
"The",
"filename",
"can",
"be",
"omitted",
"and",
"the",
"mimetype",
"is",
"guessed",
"if",
"not",
"provided",
"."
] | def attach(self, filename=None, content=None, mimetype=None):
"""
Attach a file with the given filename and content. The filename can
be omitted and the mimetype is guessed, if not provided.
If the first parameter is a MIMEBase subclass, insert it directly
into the resulting mes... | [
"def",
"attach",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"content",
"=",
"None",
",",
"mimetype",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"filename",
",",
"MIMEBase",
")",
":",
"if",
"content",
"is",
"not",
"None",
"or",
"mimetype",
"... | https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/core/mail/message.py#L286-L320 | ||
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/services/modules/mysql.py | python | MySQLService.slug | (self) | return SERVICE_MYSQL | Return slug of this service. | Return slug of this service. | [
"Return",
"slug",
"of",
"this",
"service",
"."
] | def slug(self) -> str:
"""Return slug of this service."""
return SERVICE_MYSQL | [
"def",
"slug",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SERVICE_MYSQL"
] | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/services/modules/mysql.py#L41-L43 | |
spl0k/supysonic | 62bad3b9878a1d22cf040f25dab0fa28a252ba38 | supysonic/frontend/user.py | python | change_password_post | (uid, user) | return change_password_form(uid, user) | [] | def change_password_post(uid, user):
error = False
if user.id == request.user.id:
current = request.form.get("current")
if not current:
flash("The current password is required")
error = True
new, confirm = map(request.form.get, ("new", "confirm"))
if not new:
... | [
"def",
"change_password_post",
"(",
"uid",
",",
"user",
")",
":",
"error",
"=",
"False",
"if",
"user",
".",
"id",
"==",
"request",
".",
"user",
".",
"id",
":",
"current",
"=",
"request",
".",
"form",
".",
"get",
"(",
"\"current\"",
")",
"if",
"not",
... | https://github.com/spl0k/supysonic/blob/62bad3b9878a1d22cf040f25dab0fa28a252ba38/supysonic/frontend/user.py#L190-L219 | |||
log2timeline/plaso | fe2e316b8c76a0141760c0f2f181d84acb83abc2 | plaso/parsers/presets.py | python | ParserPresetsManager._ReadOperatingSystemArtifactValues | (self, operating_system_values) | return artifacts.OperatingSystemArtifact(
family=family, product=product, version=version) | Reads an operating system artifact from a dictionary.
Args:
operating_system_values (dict[str, object]): operating system values.
Returns:
OperatingSystemArtifact: an operating system artifact attribute container.
Raises:
MalformedPresetError: if the format of the operating system value... | Reads an operating system artifact from a dictionary. | [
"Reads",
"an",
"operating",
"system",
"artifact",
"from",
"a",
"dictionary",
"."
] | def _ReadOperatingSystemArtifactValues(self, operating_system_values):
"""Reads an operating system artifact from a dictionary.
Args:
operating_system_values (dict[str, object]): operating system values.
Returns:
OperatingSystemArtifact: an operating system artifact attribute container.
R... | [
"def",
"_ReadOperatingSystemArtifactValues",
"(",
"self",
",",
"operating_system_values",
")",
":",
"if",
"not",
"operating_system_values",
":",
"raise",
"errors",
".",
"MalformedPresetError",
"(",
"'Missing operating system values.'",
")",
"family",
"=",
"operating_system_... | https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/parsers/presets.py#L42-L67 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/decimal.py | python | Decimal._round | (self, places, rounding) | return ans | Round a nonzero, nonspecial Decimal to a fixed number of
significant figures, using the given rounding mode.
Infinities, NaNs and zeros are returned unaltered.
This operation is quiet: it raises no flags, and uses no
information from the context. | Round a nonzero, nonspecial Decimal to a fixed number of
significant figures, using the given rounding mode. | [
"Round",
"a",
"nonzero",
"nonspecial",
"Decimal",
"to",
"a",
"fixed",
"number",
"of",
"significant",
"figures",
"using",
"the",
"given",
"rounding",
"mode",
"."
] | def _round(self, places, rounding):
"""Round a nonzero, nonspecial Decimal to a fixed number of
significant figures, using the given rounding mode.
Infinities, NaNs and zeros are returned unaltered.
This operation is quiet: it raises no flags, and uses no
information from the c... | [
"def",
"_round",
"(",
"self",
",",
"places",
",",
"rounding",
")",
":",
"if",
"places",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"argument should be at least 1 in _round\"",
")",
"if",
"self",
".",
"_is_special",
"or",
"not",
"self",
":",
"return",
"Dec... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/decimal.py#L2520-L2541 | |
WPO-Foundation/wptagent | 94470f007294213f900dcd9a207678b5b9fce5d3 | internal/chrome_android.py | python | ChromeAndroid.run_task | (self, task) | Run an individual test | Run an individual test | [
"Run",
"an",
"individual",
"test"
] | def run_task(self, task):
"""Run an individual test"""
if self.connected:
DevtoolsBrowser.run_task(self, task) | [
"def",
"run_task",
"(",
"self",
",",
"task",
")",
":",
"if",
"self",
".",
"connected",
":",
"DevtoolsBrowser",
".",
"run_task",
"(",
"self",
",",
"task",
")"
] | https://github.com/WPO-Foundation/wptagent/blob/94470f007294213f900dcd9a207678b5b9fce5d3/internal/chrome_android.py#L290-L293 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/corporate_memberships/admin.py | python | CorporateMembershipTypeAdmin.reps_groups | (self, instance) | return reps_groups_links | [] | def reps_groups(self, instance):
reps_groups_links = ''
if instance.pending_group:
reps_groups_links = '<a href="%s">%s</a>' % (
reverse('group.detail',
args=[instance.pending_group.slug]),
_('Pending'))
if instanc... | [
"def",
"reps_groups",
"(",
"self",
",",
"instance",
")",
":",
"reps_groups_links",
"=",
"''",
"if",
"instance",
".",
"pending_group",
":",
"reps_groups_links",
"=",
"'<a href=\"%s\">%s</a>'",
"%",
"(",
"reverse",
"(",
"'group.detail'",
",",
"args",
"=",
"[",
"... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/corporate_memberships/admin.py#L80-L94 | |||
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mimic/scripts/extern/pyqtgraph_0_11_0_dev0/pyqtgraph/graphicsItems/InfiniteLine.py | python | InfiniteLine.setMovable | (self, m) | Set whether the line is movable by the user. | Set whether the line is movable by the user. | [
"Set",
"whether",
"the",
"line",
"is",
"movable",
"by",
"the",
"user",
"."
] | def setMovable(self, m):
"""Set whether the line is movable by the user."""
self.movable = m
self.setAcceptHoverEvents(m) | [
"def",
"setMovable",
"(",
"self",
",",
"m",
")",
":",
"self",
".",
"movable",
"=",
"m",
"self",
".",
"setAcceptHoverEvents",
"(",
"m",
")"
] | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0_dev0/pyqtgraph/graphicsItems/InfiniteLine.py#L113-L116 | ||
justinsalamon/scaper | 7fc9c2be303715fdd56f222753c8b2ce23e58efb | scaper/core.py | python | _validate_distribution | (dist_tuple) | Check whether a tuple specifying a parameter distribution has a valid
format, if not raise an error.
Parameters
----------
dist_tuple : tuple
Tuple specifying a distribution to sample from. See Scaper.add_event
for details about the expected format of the tuple and allowed values.
... | Check whether a tuple specifying a parameter distribution has a valid
format, if not raise an error. | [
"Check",
"whether",
"a",
"tuple",
"specifying",
"a",
"parameter",
"distribution",
"has",
"a",
"valid",
"format",
"if",
"not",
"raise",
"an",
"error",
"."
] | def _validate_distribution(dist_tuple):
'''
Check whether a tuple specifying a parameter distribution has a valid
format, if not raise an error.
Parameters
----------
dist_tuple : tuple
Tuple specifying a distribution to sample from. See Scaper.add_event
for details about the ex... | [
"def",
"_validate_distribution",
"(",
"dist_tuple",
")",
":",
"# Make sure it's a tuple",
"if",
"not",
"isinstance",
"(",
"dist_tuple",
",",
"tuple",
")",
":",
"raise",
"ScaperError",
"(",
"'Distribution tuple must be of type tuple.'",
")",
"# Make sure the tuple contains a... | https://github.com/justinsalamon/scaper/blob/7fc9c2be303715fdd56f222753c8b2ce23e58efb/scaper/core.py#L427-L527 | ||
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/setting/presenter.py | python | NullPresenter.__init__ | (self, setting, element, *args, **kwargs) | `element` is ignored - its attributes are not read or set. | `element` is ignored - its attributes are not read or set. | [
"element",
"is",
"ignored",
"-",
"its",
"attributes",
"are",
"not",
"read",
"or",
"set",
"."
] | def __init__(self, setting, element, *args, **kwargs):
"""
`element` is ignored - its attributes are not read or set.
"""
self._value = None
self._sensitive = True
self._visible = True
super().__init__(setting, self._NULL_GUI_ELEMENT, *args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"setting",
",",
"element",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_value",
"=",
"None",
"self",
".",
"_sensitive",
"=",
"True",
"self",
".",
"_visible",
"=",
"True",
"super",
"(",
")"... | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/setting/presenter.py#L301-L309 | ||
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/urllib3/_collections.py | python | HTTPHeaderDict.__iter__ | (self) | [] | def __iter__(self):
# Only provide the originally cased names
for vals in self._container.values():
yield vals[0] | [
"def",
"__iter__",
"(",
"self",
")",
":",
"# Only provide the originally cased names",
"for",
"vals",
"in",
"self",
".",
"_container",
".",
"values",
"(",
")",
":",
"yield",
"vals",
"[",
"0",
"]"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/urllib3/_collections.py#L180-L183 | ||||
frobelbest/BANet | 4015642c9dfe8287c5f146d7a90df594625f2560 | legacy/deeptam/python/deeptam_tracker/utils/vis_utils.py | python | convert_array_to_colorimg | (inp) | return Image.fromarray(image_arr) | Returns the img as PIL images | Returns the img as PIL images | [
"Returns",
"the",
"img",
"as",
"PIL",
"images"
] | def convert_array_to_colorimg(inp):
"""Returns the img as PIL images"""
image_arr = inp.copy()
if image_arr.dtype == np.float32:
image_arr += 0.5
image_arr *= 255
image_arr = image_arr.astype(np.uint8)
image_arr = image_arr[0:3,:,:]
image_arr = np.rollaxis(image_arr,0,3)
... | [
"def",
"convert_array_to_colorimg",
"(",
"inp",
")",
":",
"image_arr",
"=",
"inp",
".",
"copy",
"(",
")",
"if",
"image_arr",
".",
"dtype",
"==",
"np",
".",
"float32",
":",
"image_arr",
"+=",
"0.5",
"image_arr",
"*=",
"255",
"image_arr",
"=",
"image_arr",
... | https://github.com/frobelbest/BANet/blob/4015642c9dfe8287c5f146d7a90df594625f2560/legacy/deeptam/python/deeptam_tracker/utils/vis_utils.py#L6-L15 | |
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/Shared/elftools/dwarf/dwarfinfo.py | python | DWARFInfo.range_lists | (self) | Get a RangeLists object representing the .debug_ranges section of
the DWARF data, or None if this section doesn't exist. | Get a RangeLists object representing the .debug_ranges section of
the DWARF data, or None if this section doesn't exist. | [
"Get",
"a",
"RangeLists",
"object",
"representing",
"the",
".",
"debug_ranges",
"section",
"of",
"the",
"DWARF",
"data",
"or",
"None",
"if",
"this",
"section",
"doesn",
"t",
"exist",
"."
] | def range_lists(self):
""" Get a RangeLists object representing the .debug_ranges section of
the DWARF data, or None if this section doesn't exist.
"""
if self.debug_ranges_sec:
return RangeLists(self.debug_ranges_sec.stream, self.structs)
else:
return... | [
"def",
"range_lists",
"(",
"self",
")",
":",
"if",
"self",
".",
"debug_ranges_sec",
":",
"return",
"RangeLists",
"(",
"self",
".",
"debug_ranges_sec",
".",
"stream",
",",
"self",
".",
"structs",
")",
"else",
":",
"return",
"None"
] | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/elftools/dwarf/dwarfinfo.py#L180-L187 | ||
BradNeuberg/cloudless | 052d16e314a24b3ff36d9da94f2e9e53e0e1e0e0 | src/cloudless/train/prepare_data.py | python | _load_numpy_image | (image_path, width, height) | return data | Turns one of our testing image paths into an actual image, converted into a numpy array. | Turns one of our testing image paths into an actual image, converted into a numpy array. | [
"Turns",
"one",
"of",
"our",
"testing",
"image",
"paths",
"into",
"an",
"actual",
"image",
"converted",
"into",
"a",
"numpy",
"array",
"."
] | def _load_numpy_image(image_path, width, height):
"""
Turns one of our testing image paths into an actual image, converted into a numpy array.
"""
im = Image.open(image_path)
# Scale the image to the size required by our neural network.
im = im.resize((width, height))
data = np.asarray(im)
... | [
"def",
"_load_numpy_image",
"(",
"image_path",
",",
"width",
",",
"height",
")",
":",
"im",
"=",
"Image",
".",
"open",
"(",
"image_path",
")",
"# Scale the image to the size required by our neural network.",
"im",
"=",
"im",
".",
"resize",
"(",
"(",
"width",
","... | https://github.com/BradNeuberg/cloudless/blob/052d16e314a24b3ff36d9da94f2e9e53e0e1e0e0/src/cloudless/train/prepare_data.py#L446-L455 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/utils.py | python | LRUCache.items | (self) | return result | Return a list of items. | Return a list of items. | [
"Return",
"a",
"list",
"of",
"items",
"."
] | def items(self):
"""Return a list of items."""
result = [(key, self._mapping[key]) for key in list(self._queue)]
result.reverse()
return result | [
"def",
"items",
"(",
"self",
")",
":",
"result",
"=",
"[",
"(",
"key",
",",
"self",
".",
"_mapping",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"list",
"(",
"self",
".",
"_queue",
")",
"]",
"result",
".",
"reverse",
"(",
")",
"return",
"result"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/utils.py#L654-L658 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/cp855.py | python | IncrementalDecoder.decode | (self, input, final=False) | return codecs.charmap_decode(input,self.errors,decoding_table)[0] | [] | def decode(self, input, final=False):
return codecs.charmap_decode(input,self.errors,decoding_table)[0] | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"final",
"=",
"False",
")",
":",
"return",
"codecs",
".",
"charmap_decode",
"(",
"input",
",",
"self",
".",
"errors",
",",
"decoding_table",
")",
"[",
"0",
"]"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/cp855.py#L22-L23 | |||
urwid/urwid | e2423b5069f51d318ea1ac0f355a0efe5448f7eb | urwid/util.py | python | rle_join_modify | ( rle, rle2 ) | Append attribute list rle2 to rle.
Merge last run of rle with first run of rle2 when possible.
MODIFIES attr parameter contents. Returns None. | Append attribute list rle2 to rle.
Merge last run of rle with first run of rle2 when possible. | [
"Append",
"attribute",
"list",
"rle2",
"to",
"rle",
".",
"Merge",
"last",
"run",
"of",
"rle",
"with",
"first",
"run",
"of",
"rle2",
"when",
"possible",
"."
] | def rle_join_modify( rle, rle2 ):
"""
Append attribute list rle2 to rle.
Merge last run of rle with first run of rle2 when possible.
MODIFIES attr parameter contents. Returns None.
"""
if not rle2:
return
rle_append_modify(rle, rle2[0])
rle += rle2[1:] | [
"def",
"rle_join_modify",
"(",
"rle",
",",
"rle2",
")",
":",
"if",
"not",
"rle2",
":",
"return",
"rle_append_modify",
"(",
"rle",
",",
"rle2",
"[",
"0",
"]",
")",
"rle",
"+=",
"rle2",
"[",
"1",
":",
"]"
] | https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/util.py#L324-L334 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/mws/connection.py | python | MWSConnection.get_capture_details | (self, request, response, **kw) | return self._post_request(request, kw, response) | Returns the status of a particular capture and the total amount
refunded on the capture. | Returns the status of a particular capture and the total amount
refunded on the capture. | [
"Returns",
"the",
"status",
"of",
"a",
"particular",
"capture",
"and",
"the",
"total",
"amount",
"refunded",
"on",
"the",
"capture",
"."
] | def get_capture_details(self, request, response, **kw):
"""Returns the status of a particular capture and the total amount
refunded on the capture.
"""
return self._post_request(request, kw, response) | [
"def",
"get_capture_details",
"(",
"self",
",",
"request",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_post_request",
"(",
"request",
",",
"kw",
",",
"response",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/mws/connection.py#L1135-L1139 | |
Pagure/pagure | 512f23f5cd1f965276969747792edeb1215cba68 | pagure/lib/query.py | python | tokenize_search_string | (pattern) | return custom_search, remaining.strip() | This function tokenizes search patterns into key:value and rest.
It will also correctly parse key values between quotes. | This function tokenizes search patterns into key:value and rest. | [
"This",
"function",
"tokenizes",
"search",
"patterns",
"into",
"key",
":",
"value",
"and",
"rest",
"."
] | def tokenize_search_string(pattern):
"""This function tokenizes search patterns into key:value and rest.
It will also correctly parse key values between quotes.
"""
if pattern is None:
return {}, None
def finalize_token(token, custom_search):
if ":" in token:
# This was... | [
"def",
"tokenize_search_string",
"(",
"pattern",
")",
":",
"if",
"pattern",
"is",
"None",
":",
"return",
"{",
"}",
",",
"None",
"def",
"finalize_token",
"(",
"token",
",",
"custom_search",
")",
":",
"if",
"\":\"",
"in",
"token",
":",
"# This was a \"key:valu... | https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/pagure/lib/query.py#L5339-L5375 | |
NoGameNoLife00/mybolg | afe17ea5bfe405e33766e5682c43a4262232ee12 | libs/jinja2/environment.py | python | Environment.compile_templates | (self, target, extensions=None, filter_func=None,
zip='deflated', log_function=None,
ignore_errors=True, py_compile=False) | Finds all the templates the loader can find, compiles them
and stores them in `target`. If `zip` is `None`, instead of in a
zipfile, the templates will be will be stored in a directory.
By default a deflate zip algorithm is used, to switch to
the stored algorithm, `zip` can be set to ``... | Finds all the templates the loader can find, compiles them
and stores them in `target`. If `zip` is `None`, instead of in a
zipfile, the templates will be will be stored in a directory.
By default a deflate zip algorithm is used, to switch to
the stored algorithm, `zip` can be set to ``... | [
"Finds",
"all",
"the",
"templates",
"the",
"loader",
"can",
"find",
"compiles",
"them",
"and",
"stores",
"them",
"in",
"target",
".",
"If",
"zip",
"is",
"None",
"instead",
"of",
"in",
"a",
"zipfile",
"the",
"templates",
"will",
"be",
"will",
"be",
"store... | def compile_templates(self, target, extensions=None, filter_func=None,
zip='deflated', log_function=None,
ignore_errors=True, py_compile=False):
"""Finds all the templates the loader can find, compiles them
and stores them in `target`. If `zip` is `No... | [
"def",
"compile_templates",
"(",
"self",
",",
"target",
",",
"extensions",
"=",
"None",
",",
"filter_func",
"=",
"None",
",",
"zip",
"=",
"'deflated'",
",",
"log_function",
"=",
"None",
",",
"ignore_errors",
"=",
"True",
",",
"py_compile",
"=",
"False",
")... | https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/jinja2/environment.py#L601-L693 | ||
BlueBrain/BluePyOpt | 6d4185479bc6dddb3daad84fa27e0b8457d69652 | bluepyopt/evaluators.py | python | Evaluator.evaluate_with_lists | (self, params) | Evaluate parameter a parameter set (abstract).
Args:
params (list of Parameters):
The parameter values to be evaluated.
Returns:
objectives (list of Objectives):
List of Objectives with values calculated by the Evaluator. | Evaluate parameter a parameter set (abstract). | [
"Evaluate",
"parameter",
"a",
"parameter",
"set",
"(",
"abstract",
")",
"."
] | def evaluate_with_lists(self, params):
"""Evaluate parameter a parameter set (abstract).
Args:
params (list of Parameters):
The parameter values to be evaluated.
Returns:
objectives (list of Objectives):
List of Objectives with values cal... | [
"def",
"evaluate_with_lists",
"(",
"self",
",",
"params",
")",
":"
] | https://github.com/BlueBrain/BluePyOpt/blob/6d4185479bc6dddb3daad84fa27e0b8457d69652/bluepyopt/evaluators.py#L63-L74 | ||
biosbits/bits | 19da7046a7303f1de8b53165eea1a6f486757c03 | python/bits/__init__.py | python | pci_write | (bus, device, function, register, value, bytes=None) | Write a value of the specified size to the PCI device specified by bus:device.function register | Write a value of the specified size to the PCI device specified by bus:device.function register | [
"Write",
"a",
"value",
"of",
"the",
"specified",
"size",
"to",
"the",
"PCI",
"device",
"specified",
"by",
"bus",
":",
"device",
".",
"function",
"register"
] | def pci_write(bus, device, function, register, value, bytes=None):
"""Write a value of the specified size to the PCI device specified by bus:device.function register"""
bytes, port = _pci_op(bus, device, function, register, bytes)
{ 1: outb, 2: outw, 4: outl }[bytes](port, value) | [
"def",
"pci_write",
"(",
"bus",
",",
"device",
",",
"function",
",",
"register",
",",
"value",
",",
"bytes",
"=",
"None",
")",
":",
"bytes",
",",
"port",
"=",
"_pci_op",
"(",
"bus",
",",
"device",
",",
"function",
",",
"register",
",",
"bytes",
")",
... | https://github.com/biosbits/bits/blob/19da7046a7303f1de8b53165eea1a6f486757c03/python/bits/__init__.py#L118-L121 | ||
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/jax/trainer_lib.py | python | shard_on_batch_dim_partition_spec | (
mesh_names: Sequence[str], x: jax.ShapeDtypeStruct) | return base_layer.to_partition_spec(sharding, mesh_names) | Fully shards x on the batch dimension. | Fully shards x on the batch dimension. | [
"Fully",
"shards",
"x",
"on",
"the",
"batch",
"dimension",
"."
] | def shard_on_batch_dim_partition_spec(
mesh_names: Sequence[str], x: jax.ShapeDtypeStruct) -> pjit.PartitionSpec:
"""Fully shards x on the batch dimension."""
x_dim = len(x.shape)
assert x_dim >= 1
sharding = [-1] * x_dim
# Assume the first dim is batch, and fully shard the batch dim over the entire
# m... | [
"def",
"shard_on_batch_dim_partition_spec",
"(",
"mesh_names",
":",
"Sequence",
"[",
"str",
"]",
",",
"x",
":",
"jax",
".",
"ShapeDtypeStruct",
")",
"->",
"pjit",
".",
"PartitionSpec",
":",
"x_dim",
"=",
"len",
"(",
"x",
".",
"shape",
")",
"assert",
"x_dim... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/jax/trainer_lib.py#L499-L508 | |
HenryAlbu/FB-Messenger-Whatsapp-Discord-message-spammer | 3bcad20e68ee68d01fc720ec694105dce91c2b68 | app.py | python | long_operation_thread | () | [] | def long_operation_thread():
spammer.start_spam() | [
"def",
"long_operation_thread",
"(",
")",
":",
"spammer",
".",
"start_spam",
"(",
")"
] | https://github.com/HenryAlbu/FB-Messenger-Whatsapp-Discord-message-spammer/blob/3bcad20e68ee68d01fc720ec694105dce91c2b68/app.py#L8-L9 | ||||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/homekit_controller/alarm_control_panel.py | python | HomeKitAlarmControlPanelEntity.icon | (self) | return ICON | Return icon. | Return icon. | [
"Return",
"icon",
"."
] | def icon(self):
"""Return icon."""
return ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"ICON"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/homekit_controller/alarm_control_panel.py#L75-L77 | |
limodou/ulipad | 4c7d590234f39cac80bb1d36dca095b646e287fb | modules/meide.py | python | LayoutBase.add | (self, element, name='', proportion=None, flag=None, border=None) | return element | Add a element to it.
element
It could be any Element object, or event Element class name. And you
can also pass a real wx widget object. meide will automatically
wrap it to a SimpleElement or a SimpleValueElement according whether
the element has GetVa... | Add a element to it.
element
It could be any Element object, or event Element class name. And you
can also pass a real wx widget object. meide will automatically
wrap it to a SimpleElement or a SimpleValueElement according whether
the element has GetVa... | [
"Add",
"a",
"element",
"to",
"it",
".",
"element",
"It",
"could",
"be",
"any",
"Element",
"object",
"or",
"event",
"Element",
"class",
"name",
".",
"And",
"you",
"can",
"also",
"pass",
"a",
"real",
"wx",
"widget",
"object",
".",
"meide",
"will",
"autom... | def add(self, element, name='', proportion=None, flag=None, border=None):
"""
Add a element to it.
element
It could be any Element object, or event Element class name. And you
can also pass a real wx widget object. meide will automatically
wrap it t... | [
"def",
"add",
"(",
"self",
",",
"element",
",",
"name",
"=",
"''",
",",
"proportion",
"=",
"None",
",",
"flag",
"=",
"None",
",",
"border",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"self",
".",
"_id",
"+=",
"1",
"name",
"=",
"'_id_%d'",
... | https://github.com/limodou/ulipad/blob/4c7d590234f39cac80bb1d36dca095b646e287fb/modules/meide.py#L489-L531 | |
urinieto/msaf | 17db5b698e06d662dfa5c7442d826022746454b7 | msaf/base.py | python | Features.compute_beat_sync_features | (self, beat_frames, beat_times, pad) | return beatsync_feats, beatsync_times | Make the features beat-synchronous.
Parameters
----------
beat_frames: np.array
The frame indeces of the beat positions.
beat_times: np.array
The time points of the beat positions (in seconds).
pad: boolean
If `True`, `beat_frames` is padded t... | Make the features beat-synchronous. | [
"Make",
"the",
"features",
"beat",
"-",
"synchronous",
"."
] | def compute_beat_sync_features(self, beat_frames, beat_times, pad):
"""Make the features beat-synchronous.
Parameters
----------
beat_frames: np.array
The frame indeces of the beat positions.
beat_times: np.array
The time points of the beat positions (in ... | [
"def",
"compute_beat_sync_features",
"(",
"self",
",",
"beat_frames",
",",
"beat_times",
",",
"pad",
")",
":",
"if",
"beat_frames",
"is",
"None",
":",
"return",
"None",
",",
"None",
"# Make beat synchronous",
"beatsync_feats",
"=",
"librosa",
".",
"util",
".",
... | https://github.com/urinieto/msaf/blob/17db5b698e06d662dfa5c7442d826022746454b7/msaf/base.py#L174-L207 | |
medbenali/CyberScan | ca85794cfce5e83e9cc5fca1512ba6edf2f14dee | pygeoip/util.py | python | ip2long | (ip) | Wrapper function for IPv4 and IPv6 converters.
:arg ip: IPv4 or IPv6 address | Wrapper function for IPv4 and IPv6 converters. | [
"Wrapper",
"function",
"for",
"IPv4",
"and",
"IPv6",
"converters",
"."
] | def ip2long(ip):
"""
Wrapper function for IPv4 and IPv6 converters.
:arg ip: IPv4 or IPv6 address
"""
try:
return int(binascii.hexlify(socket.inet_aton(ip)), 16)
except socket.error:
return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16) | [
"def",
"ip2long",
"(",
"ip",
")",
":",
"try",
":",
"return",
"int",
"(",
"binascii",
".",
"hexlify",
"(",
"socket",
".",
"inet_aton",
"(",
"ip",
")",
")",
",",
"16",
")",
"except",
"socket",
".",
"error",
":",
"return",
"int",
"(",
"binascii",
".",... | https://github.com/medbenali/CyberScan/blob/ca85794cfce5e83e9cc5fca1512ba6edf2f14dee/pygeoip/util.py#L30-L39 | ||
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/xlwt/antlr.py | python | BaseAST.toStringTree | (self) | return ts | [] | def toStringTree(self):
ts = ""
kid = self.getFirstChild()
if kid:
ts += " ("
ts += " " + self.toString()
if kid:
ts += kid.toStringList()
ts += " )"
return ts | [
"def",
"toStringTree",
"(",
"self",
")",
":",
"ts",
"=",
"\"\"",
"kid",
"=",
"self",
".",
"getFirstChild",
"(",
")",
"if",
"kid",
":",
"ts",
"+=",
"\" (\"",
"ts",
"+=",
"\" \"",
"+",
"self",
".",
"toString",
"(",
")",
"if",
"kid",
":",
"ts",
"+="... | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/xlwt/antlr.py#L2495-L2504 | |||
spender-sandbox/cuckoo-modified | eb93ef3d41b8fee51b4330306dcd315d8101e021 | modules/machinery/vsphere.py | python | vSphere.start | (self, label) | Start a machine.
@param label: machine name.
@raise CuckooMachineError: if unable to start machine. | Start a machine. | [
"Start",
"a",
"machine",
"."
] | def start(self, label):
"""Start a machine.
@param label: machine name.
@raise CuckooMachineError: if unable to start machine.
"""
name = self.db.view_machine_by_label(label).snapshot
with SmartConnection(**self.connect_opts) as conn:
vm = self._get_virtual_ma... | [
"def",
"start",
"(",
"self",
",",
"label",
")",
":",
"name",
"=",
"self",
".",
"db",
".",
"view_machine_by_label",
"(",
"label",
")",
".",
"snapshot",
"with",
"SmartConnection",
"(",
"*",
"*",
"self",
".",
"connect_opts",
")",
"as",
"conn",
":",
"vm",
... | https://github.com/spender-sandbox/cuckoo-modified/blob/eb93ef3d41b8fee51b4330306dcd315d8101e021/modules/machinery/vsphere.py#L130-L142 | ||
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/metrics/cluster/_supervised.py | python | entropy | (labels) | return -np.sum((pi / pi_sum) * (np.log(pi) - log(pi_sum))) | Calculates the entropy for a labeling.
Parameters
----------
labels : int array, shape = [n_samples]
The labels
Notes
-----
The logarithm used is the natural logarithm (base-e). | Calculates the entropy for a labeling. | [
"Calculates",
"the",
"entropy",
"for",
"a",
"labeling",
"."
] | def entropy(labels):
"""Calculates the entropy for a labeling.
Parameters
----------
labels : int array, shape = [n_samples]
The labels
Notes
-----
The logarithm used is the natural logarithm (base-e).
"""
if len(labels) == 0:
return 1.0
label_idx = np.unique(la... | [
"def",
"entropy",
"(",
"labels",
")",
":",
"if",
"len",
"(",
"labels",
")",
"==",
"0",
":",
"return",
"1.0",
"label_idx",
"=",
"np",
".",
"unique",
"(",
"labels",
",",
"return_inverse",
"=",
"True",
")",
"[",
"1",
"]",
"pi",
"=",
"np",
".",
"binc... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/metrics/cluster/_supervised.py#L1123-L1143 | |
NervanaSystems/neon | 8c3fb8a93b4a89303467b25817c60536542d08bd | neon/backends/backend.py | python | Backend.exp | (self, a, out=None) | return OpTreeNode.build("exp", a, None, out=out) | Perform element-wise exponential transformation on Tensor `a`, storing
the result in Tensor out. Both Tensor's should have identical shape.
Arguments:
a (Tensor): input to be transformed.
out (Tensor, optional): where the result will be stored. If out is
... | Perform element-wise exponential transformation on Tensor `a`, storing
the result in Tensor out. Both Tensor's should have identical shape. | [
"Perform",
"element",
"-",
"wise",
"exponential",
"transformation",
"on",
"Tensor",
"a",
"storing",
"the",
"result",
"in",
"Tensor",
"out",
".",
"Both",
"Tensor",
"s",
"should",
"have",
"identical",
"shape",
"."
] | def exp(self, a, out=None):
"""
Perform element-wise exponential transformation on Tensor `a`, storing
the result in Tensor out. Both Tensor's should have identical shape.
Arguments:
a (Tensor): input to be transformed.
out (Tensor, optional): where the result wi... | [
"def",
"exp",
"(",
"self",
",",
"a",
",",
"out",
"=",
"None",
")",
":",
"return",
"OpTreeNode",
".",
"build",
"(",
"\"exp\"",
",",
"a",
",",
"None",
",",
"out",
"=",
"out",
")"
] | https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/neon/backends/backend.py#L953-L966 | |
scrapinghub/splash | 802d8391984bae049ef95a3fe1a74feaee95a233 | splash/kernel/kernel.py | python | DeferredSplashRunner.run | (self, main_coro) | return d | Run main_coro Lua coroutine, passing it a Splash
instance as an argument. Return a Deferred. | Run main_coro Lua coroutine, passing it a Splash
instance as an argument. Return a Deferred. | [
"Run",
"main_coro",
"Lua",
"coroutine",
"passing",
"it",
"a",
"Splash",
"instance",
"as",
"an",
"argument",
".",
"Return",
"a",
"Deferred",
"."
] | def run(self, main_coro):
"""
Run main_coro Lua coroutine, passing it a Splash
instance as an argument. Return a Deferred.
"""
d = defer.Deferred()
def return_result(result):
d.callback(result)
def return_error(err):
d.errback(err)
... | [
"def",
"run",
"(",
"self",
",",
"main_coro",
")",
":",
"d",
"=",
"defer",
".",
"Deferred",
"(",
")",
"def",
"return_result",
"(",
"result",
")",
":",
"d",
".",
"callback",
"(",
"result",
")",
"def",
"return_error",
"(",
"err",
")",
":",
"d",
".",
... | https://github.com/scrapinghub/splash/blob/802d8391984bae049ef95a3fe1a74feaee95a233/splash/kernel/kernel.py#L79-L97 | |
BangLiu/ArticlePairMatching | 51745af80e093391f668477d8d00ae59a0481d6f | src/models/CCIG/util/file_utils.py | python | pickle_dump_large_file | (obj, filepath) | This is a defensive way to write pickle.write,
allowing for very large files on all platforms | This is a defensive way to write pickle.write,
allowing for very large files on all platforms | [
"This",
"is",
"a",
"defensive",
"way",
"to",
"write",
"pickle",
".",
"write",
"allowing",
"for",
"very",
"large",
"files",
"on",
"all",
"platforms"
] | def pickle_dump_large_file(obj, filepath):
"""
This is a defensive way to write pickle.write,
allowing for very large files on all platforms
"""
max_bytes = 2**31 - 1
bytes_out = pickle.dumps(obj)
n_bytes = sys.getsizeof(bytes_out)
with open(filepath, 'wb') as f_out:
for idx in r... | [
"def",
"pickle_dump_large_file",
"(",
"obj",
",",
"filepath",
")",
":",
"max_bytes",
"=",
"2",
"**",
"31",
"-",
"1",
"bytes_out",
"=",
"pickle",
".",
"dumps",
"(",
"obj",
")",
"n_bytes",
"=",
"sys",
".",
"getsizeof",
"(",
"bytes_out",
")",
"with",
"ope... | https://github.com/BangLiu/ArticlePairMatching/blob/51745af80e093391f668477d8d00ae59a0481d6f/src/models/CCIG/util/file_utils.py#L32-L42 | ||
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/spack/cmd/pkg.py | python | pkg_removed | (args) | show packages removed since a commit | show packages removed since a commit | [
"show",
"packages",
"removed",
"since",
"a",
"commit"
] | def pkg_removed(args):
"""show packages removed since a commit"""
u1, u2 = diff_packages(args.rev1, args.rev2)
if u1:
colify(sorted(u1)) | [
"def",
"pkg_removed",
"(",
"args",
")",
":",
"u1",
",",
"u2",
"=",
"diff_packages",
"(",
"args",
".",
"rev1",
",",
"args",
".",
"rev2",
")",
"if",
"u1",
":",
"colify",
"(",
"sorted",
"(",
"u1",
")",
")"
] | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/cmd/pkg.py#L158-L162 | ||
google/timesketch | 1ce6b60e125d104e6644947c6f1dbe1b82ac76b6 | api_client/python/timesketch_api_client/view.py | python | View.__init__ | (self, view_id, view_name, sketch_id, api) | Initializes the View object.
Args:
view_id: Primary key ID for the view.
view_name: The name of the view.
sketch_id: ID of a sketch.
api: Instance of a TimesketchApi object. | Initializes the View object. | [
"Initializes",
"the",
"View",
"object",
"."
] | def __init__(self, view_id, view_name, sketch_id, api):
"""Initializes the View object.
Args:
view_id: Primary key ID for the view.
view_name: The name of the view.
sketch_id: ID of a sketch.
api: Instance of a TimesketchApi object.
"""
lo... | [
"def",
"__init__",
"(",
"self",
",",
"view_id",
",",
"view_name",
",",
"sketch_id",
",",
"api",
")",
":",
"logger",
".",
"info",
"(",
"'View objects will be deprecated soon, consider transitioning '",
"'into using the search.Search object instead'",
")",
"self",
".",
"i... | https://github.com/google/timesketch/blob/1ce6b60e125d104e6644947c6f1dbe1b82ac76b6/api_client/python/timesketch_api_client/view.py#L34-L49 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/_structures.py | python | Infinity.__ge__ | (self, other) | return True | [] | def __ge__(self, other):
return True | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"return",
"True"
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/_structures.py#L30-L31 | |||
nutonomy/nuscenes-devkit | 05d05b3c994fb3c17b6643016d9f622a001c7275 | python-sdk/nuscenes/map_expansion/arcline_path_utils.py | python | project_pose_to_lane | (pose: Pose, lane: List[ArcLinePath], resolution_meters: float = 0.5) | return closest_pose, distance_along_lane | Find the closest pose on a lane to a query pose and additionally return the
distance along the lane for this pose. Note that this function does
not take the heading of the query pose into account.
:param pose: Query pose.
:param lane: Will find the closest pose on this lane.
:param resolution_meters... | Find the closest pose on a lane to a query pose and additionally return the
distance along the lane for this pose. Note that this function does
not take the heading of the query pose into account.
:param pose: Query pose.
:param lane: Will find the closest pose on this lane.
:param resolution_meters... | [
"Find",
"the",
"closest",
"pose",
"on",
"a",
"lane",
"to",
"a",
"query",
"pose",
"and",
"additionally",
"return",
"the",
"distance",
"along",
"the",
"lane",
"for",
"this",
"pose",
".",
"Note",
"that",
"this",
"function",
"does",
"not",
"take",
"the",
"he... | def project_pose_to_lane(pose: Pose, lane: List[ArcLinePath], resolution_meters: float = 0.5) -> Tuple[Pose, float]:
"""
Find the closest pose on a lane to a query pose and additionally return the
distance along the lane for this pose. Note that this function does
not take the heading of the query pose ... | [
"def",
"project_pose_to_lane",
"(",
"pose",
":",
"Pose",
",",
"lane",
":",
"List",
"[",
"ArcLinePath",
"]",
",",
"resolution_meters",
":",
"float",
"=",
"0.5",
")",
"->",
"Tuple",
"[",
"Pose",
",",
"float",
"]",
":",
"discretized_lane",
"=",
"discretize_la... | https://github.com/nutonomy/nuscenes-devkit/blob/05d05b3c994fb3c17b6643016d9f622a001c7275/python-sdk/nuscenes/map_expansion/arcline_path_utils.py#L221-L239 | |
amundsen-io/amundsendatabuilder | a0af611350fde12438450d4bfd83b226ef220c3f | databuilder/publisher/mysql_csv_publisher.py | python | MySQLCSVPublisher._publish | (self, record_file: str, session: Session) | Iterate over each row of the given csv file and convert each record to a rds model instance.
Then the model instance will be inserted/updated in mysql.
:param record_file:
:param session:
:return: | Iterate over each row of the given csv file and convert each record to a rds model instance.
Then the model instance will be inserted/updated in mysql.
:param record_file:
:param session:
:return: | [
"Iterate",
"over",
"each",
"row",
"of",
"the",
"given",
"csv",
"file",
"and",
"convert",
"each",
"record",
"to",
"a",
"rds",
"model",
"instance",
".",
"Then",
"the",
"model",
"instance",
"will",
"be",
"inserted",
"/",
"updated",
"in",
"mysql",
".",
":",
... | def _publish(self, record_file: str, session: Session) -> None:
"""
Iterate over each row of the given csv file and convert each record to a rds model instance.
Then the model instance will be inserted/updated in mysql.
:param record_file:
:param session:
:return:
... | [
"def",
"_publish",
"(",
"self",
",",
"record_file",
":",
"str",
",",
"session",
":",
"Session",
")",
"->",
"None",
":",
"with",
"open",
"(",
"record_file",
",",
"'r'",
",",
"encoding",
"=",
"'utf8'",
")",
"as",
"record_csv",
":",
"table_name",
"=",
"se... | https://github.com/amundsen-io/amundsendatabuilder/blob/a0af611350fde12438450d4bfd83b226ef220c3f/databuilder/publisher/mysql_csv_publisher.py#L143-L161 | ||
dansoutner/LSTM | 1817b881d2f03e9d3746f39e734426c00134fda7 | LSTM.py | python | LSTM.save | (self, filename) | cPickle net to filename | cPickle net to filename | [
"cPickle",
"net",
"to",
"filename"
] | def save(self, filename):
"""
cPickle net to filename
"""
# attributes that we want to save
to_save = set(['CEC', 'cell_blocks',
'context', 'dic', 'full_hidden_dimension',
'full_input_dimension', 'hidden_dimension',
'independent', 'input_dimension', 'output_dimension',
... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"# attributes that we want to save",
"to_save",
"=",
"set",
"(",
"[",
"'CEC'",
",",
"'cell_blocks'",
",",
"'context'",
",",
"'dic'",
",",
"'full_hidden_dimension'",
",",
"'full_input_dimension'",
",",
"'hidden... | https://github.com/dansoutner/LSTM/blob/1817b881d2f03e9d3746f39e734426c00134fda7/LSTM.py#L536-L574 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | datadog_checks_base/datadog_checks/base/utils/db/transform.py | python | _compile_service_check_statuses | (modifiers) | return status_map | [] | def _compile_service_check_statuses(modifiers):
# type: (Dict[str, Any]) -> Dict[str, ServiceCheckStatus]
status_map = modifiers.pop('status_map', None)
if status_map is None:
raise ValueError('the `status_map` parameter is required')
elif not isinstance(status_map, dict):
raise ValueErr... | [
"def",
"_compile_service_check_statuses",
"(",
"modifiers",
")",
":",
"# type: (Dict[str, Any]) -> Dict[str, ServiceCheckStatus]",
"status_map",
"=",
"modifiers",
".",
"pop",
"(",
"'status_map'",
",",
"None",
")",
"if",
"status_map",
"is",
"None",
":",
"raise",
"ValueEr... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_base/datadog_checks/base/utils/db/transform.py#L492-L516 | |||
thunlp/ERNIE | 9a4ab4af54bccb70b4eb53cbfe71a2bc16b9e93f | code/knowledge_bert/file_utils.py | python | cached_path | (url_or_filename: Union[str, Path], cache_dir: Union[str, Path] = None) | Given something that might be a URL (or might be a local path),
determine which. If it's a URL, download the file and cache it, and
return the path to the cached file. If it's already a local path,
make sure the file exists and then return the path. | Given something that might be a URL (or might be a local path),
determine which. If it's a URL, download the file and cache it, and
return the path to the cached file. If it's already a local path,
make sure the file exists and then return the path. | [
"Given",
"something",
"that",
"might",
"be",
"a",
"URL",
"(",
"or",
"might",
"be",
"a",
"local",
"path",
")",
"determine",
"which",
".",
"If",
"it",
"s",
"a",
"URL",
"download",
"the",
"file",
"and",
"cache",
"it",
"and",
"return",
"the",
"path",
"to... | def cached_path(url_or_filename: Union[str, Path], cache_dir: Union[str, Path] = None) -> str:
"""
Given something that might be a URL (or might be a local path),
determine which. If it's a URL, download the file and cache it, and
return the path to the cached file. If it's already a local path,
mak... | [
"def",
"cached_path",
"(",
"url_or_filename",
":",
"Union",
"[",
"str",
",",
"Path",
"]",
",",
"cache_dir",
":",
"Union",
"[",
"str",
",",
"Path",
"]",
"=",
"None",
")",
"->",
"str",
":",
"if",
"cache_dir",
"is",
"None",
":",
"cache_dir",
"=",
"PYTOR... | https://github.com/thunlp/ERNIE/blob/9a4ab4af54bccb70b4eb53cbfe71a2bc16b9e93f/code/knowledge_bert/file_utils.py#L74-L101 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/gear.py | python | addBevelGear | (derivation, extrudeDerivation, pitchRadius, positives, teeth, vector3GearProfile) | Get extrude output for a cylinder gear. | Get extrude output for a cylinder gear. | [
"Get",
"extrude",
"output",
"for",
"a",
"cylinder",
"gear",
"."
] | def addBevelGear(derivation, extrudeDerivation, pitchRadius, positives, teeth, vector3GearProfile):
"Get extrude output for a cylinder gear."
totalPitchRadius = derivation.pitchRadiusComplement + derivation.pitchRadius
totalTeeth = derivation.teethPinion + derivation.teethComplement
portionDirections = extrude.getS... | [
"def",
"addBevelGear",
"(",
"derivation",
",",
"extrudeDerivation",
",",
"pitchRadius",
",",
"positives",
",",
"teeth",
",",
"vector3GearProfile",
")",
":",
"totalPitchRadius",
"=",
"derivation",
".",
"pitchRadiusComplement",
"+",
"derivation",
".",
"pitchRadius",
"... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/gear.py#L429-L470 | ||
jay0lee/GAM | c3ddeae3f35be646ce9cb471ba4ade072343be1d | src/gam/gapi/errors.py | python | _create_http_error_dict | (status_code, reason, message) | return {
'error': {
'code': status_code,
'errors': [{
'reason': str(reason),
'message': message,
}]
}
} | Creates a basic error dict similar to most Google API Errors.
Args:
status_code: Int, the error's HTTP response status code.
reason: String, a camelCase reason for the HttpError being given.
message: String, a general error message describing the error that occurred.
Returns:
dict | Creates a basic error dict similar to most Google API Errors. | [
"Creates",
"a",
"basic",
"error",
"dict",
"similar",
"to",
"most",
"Google",
"API",
"Errors",
"."
] | def _create_http_error_dict(status_code, reason, message):
"""Creates a basic error dict similar to most Google API Errors.
Args:
status_code: Int, the error's HTTP response status code.
reason: String, a camelCase reason for the HttpError being given.
message: String, a general error message describ... | [
"def",
"_create_http_error_dict",
"(",
"status_code",
",",
"reason",
",",
"message",
")",
":",
"return",
"{",
"'error'",
":",
"{",
"'code'",
":",
"status_code",
",",
"'errors'",
":",
"[",
"{",
"'reason'",
":",
"str",
"(",
"reason",
")",
",",
"'message'",
... | https://github.com/jay0lee/GAM/blob/c3ddeae3f35be646ce9cb471ba4ade072343be1d/src/gam/gapi/errors.py#L255-L274 | |
Urinx/WeixinBot | d9edcd2c9203fe7dd203b22b71bbc48a31e9492b | wxbot_demo_py3/weixin.py | python | UnicodeStreamFilter.write | (self, s) | [] | def write(self, s):
if type(s) == str:
s = s.encode().decode('utf-8')
s = s.encode(self.encode_to, self.errors).decode(self.encode_to)
self.target.write(s) | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"if",
"type",
"(",
"s",
")",
"==",
"str",
":",
"s",
"=",
"s",
".",
"encode",
"(",
")",
".",
"decode",
"(",
"'utf-8'",
")",
"s",
"=",
"s",
".",
"encode",
"(",
"self",
".",
"encode_to",
",",
"s... | https://github.com/Urinx/WeixinBot/blob/d9edcd2c9203fe7dd203b22b71bbc48a31e9492b/wxbot_demo_py3/weixin.py#L1199-L1203 | ||||
rucio/rucio | 6d0d358e04f5431f0b9a98ae40f31af0ddff4833 | lib/rucio/core/permission/cms.py | python | perm_del_protocol | (issuer, kwargs) | return _is_root(issuer) or has_account_attribute(account=issuer, key='admin') | Checks if an account can delete protocols from an RSE.
:param issuer: Account identifier which issues the command.
:param kwargs: List of arguments for the action.
:returns: True if account is allowed, otherwise False | Checks if an account can delete protocols from an RSE. | [
"Checks",
"if",
"an",
"account",
"can",
"delete",
"protocols",
"from",
"an",
"RSE",
"."
] | def perm_del_protocol(issuer, kwargs):
"""
Checks if an account can delete protocols from an RSE.
:param issuer: Account identifier which issues the command.
:param kwargs: List of arguments for the action.
:returns: True if account is allowed, otherwise False
"""
return _is_root(issuer) or... | [
"def",
"perm_del_protocol",
"(",
"issuer",
",",
"kwargs",
")",
":",
"return",
"_is_root",
"(",
"issuer",
")",
"or",
"has_account_attribute",
"(",
"account",
"=",
"issuer",
",",
"key",
"=",
"'admin'",
")"
] | https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/core/permission/cms.py#L626-L634 | |
tern-tools/tern | 723f43dcaae2f2f0a08a63e5e8de3938031a386e | tern/analyze/default/command_lib/command_lib.py | python | set_command_attrs | (command_obj) | return False | Given the command object, move the install and remove listings to
subcommands and set the flags, then return True. If the command name
is not in the snippets library then return False | Given the command object, move the install and remove listings to
subcommands and set the flags, then return True. If the command name
is not in the snippets library then return False | [
"Given",
"the",
"command",
"object",
"move",
"the",
"install",
"and",
"remove",
"listings",
"to",
"subcommands",
"and",
"set",
"the",
"flags",
"then",
"return",
"True",
".",
"If",
"the",
"command",
"name",
"is",
"not",
"in",
"the",
"snippets",
"library",
"... | def set_command_attrs(command_obj):
'''Given the command object, move the install and remove listings to
subcommands and set the flags, then return True. If the command name
is not in the snippets library then return False'''
command_listing = get_command_listing(command_obj.name)
if command_listing... | [
"def",
"set_command_attrs",
"(",
"command_obj",
")",
":",
"command_listing",
"=",
"get_command_listing",
"(",
"command_obj",
".",
"name",
")",
"if",
"command_listing",
":",
"# the command is in the library",
"# look for install, remove and ignore commands",
"if",
"'install'",... | https://github.com/tern-tools/tern/blob/723f43dcaae2f2f0a08a63e5e8de3938031a386e/tern/analyze/default/command_lib/command_lib.py#L140-L156 | |
GradiusX/HEVD-Python-Solutions | f0594ae6c926558c5a25a23fe2d4f50ce6eb6eb9 | Win7 x86/HEVD_InsecureKernelResourceAccess.py | python | check_admin | (username) | Periodically checks for Admin Privs | Periodically checks for Admin Privs | [
"Periodically",
"checks",
"for",
"Admin",
"Privs"
] | def check_admin(username):
''' Periodically checks for Admin Privs '''
global is_admin
while not is_admin:
members = win32net.NetLocalGroupGetMembers(None,'Administrators',1)
if username in [record['name'] for record in members[0]]:
is_admin = True
break
time.sleep(5) | [
"def",
"check_admin",
"(",
"username",
")",
":",
"global",
"is_admin",
"while",
"not",
"is_admin",
":",
"members",
"=",
"win32net",
".",
"NetLocalGroupGetMembers",
"(",
"None",
",",
"'Administrators'",
",",
"1",
")",
"if",
"username",
"in",
"[",
"record",
"[... | https://github.com/GradiusX/HEVD-Python-Solutions/blob/f0594ae6c926558c5a25a23fe2d4f50ce6eb6eb9/Win7 x86/HEVD_InsecureKernelResourceAccess.py#L40-L48 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/ppcls/arch/backbone/model_zoo/ghostnet.py | python | GhostModule.forward | (self, inputs) | return out | [] | def forward(self, inputs):
x = self.primary_conv(inputs)
y = self.cheap_operation(x)
out = paddle.concat([x, y], axis=1)
return out | [
"def",
"forward",
"(",
"self",
",",
"inputs",
")",
":",
"x",
"=",
"self",
".",
"primary_conv",
"(",
"inputs",
")",
"y",
"=",
"self",
".",
"cheap_operation",
"(",
"x",
")",
"out",
"=",
"paddle",
".",
"concat",
"(",
"[",
"x",
",",
"y",
"]",
",",
... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppcls/arch/backbone/model_zoo/ghostnet.py#L141-L145 | |||
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/pygments/lexers/templates.py | python | RhtmlLexer.analyse_text | (text) | return rv | [] | def analyse_text(text):
rv = ErbLexer.analyse_text(text) - 0.01
if html_doctype_matches(text):
# one more than the XmlErbLexer returns
rv += 0.5
return rv | [
"def",
"analyse_text",
"(",
"text",
")",
":",
"rv",
"=",
"ErbLexer",
".",
"analyse_text",
"(",
"text",
")",
"-",
"0.01",
"if",
"html_doctype_matches",
"(",
"text",
")",
":",
"# one more than the XmlErbLexer returns",
"rv",
"+=",
"0.5",
"return",
"rv"
] | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pygments/lexers/templates.py#L1034-L1039 | |||
donnemartin/gitsome | d7c57abc7cb66e9c910a844f15d4536866da3310 | gitsome/lib/github3/repos/repo.py | python | Repository.readme | (self) | return self._instance_or_null(Contents, json) | Get the README for this repository.
:returns: :class:`Contents <github3.repos.contents.Contents>` | Get the README for this repository. | [
"Get",
"the",
"README",
"for",
"this",
"repository",
"."
] | def readme(self):
"""Get the README for this repository.
:returns: :class:`Contents <github3.repos.contents.Contents>`
"""
url = self._build_url('readme', base_url=self._api)
json = self._json(self._get(url), 200)
return self._instance_or_null(Contents, json) | [
"def",
"readme",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'readme'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return... | https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/gitsome/lib/github3/repos/repo.py#L1726-L1733 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/storage/speckle/python/api/rdbms.py | python | Connection.MakeRequest | (self, stub_method, request) | return response | Makes an ApiProxy request, and possibly raises an appropriate exception.
Args:
stub_method: A string, the name of the method to call.
request: A protobuf; 'instance' and 'connection_id' will be set
when available.
Returns:
A protobuf.
Raises:
DatabaseError: Error from SQL ... | Makes an ApiProxy request, and possibly raises an appropriate exception. | [
"Makes",
"an",
"ApiProxy",
"request",
"and",
"possibly",
"raises",
"an",
"appropriate",
"exception",
"."
] | def MakeRequest(self, stub_method, request):
"""Makes an ApiProxy request, and possibly raises an appropriate exception.
Args:
stub_method: A string, the name of the method to call.
request: A protobuf; 'instance' and 'connection_id' will be set
when available.
Returns:
A protobu... | [
"def",
"MakeRequest",
"(",
"self",
",",
"stub_method",
",",
"request",
")",
":",
"request",
".",
"instance",
"=",
"self",
".",
"_instance",
"if",
"self",
".",
"_connection_id",
"is",
"not",
"None",
":",
"request",
".",
"connection_id",
"=",
"self",
".",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/storage/speckle/python/api/rdbms.py#L920-L947 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/rpc/boot.py | python | get_boot_filenames | (
arch,
subarch,
osystem,
series,
commissioning_osystem=undefined,
commissioning_distro_series=undefined,
) | return kernel, initrd, boot_dtb | Return the filenames of the kernel, initrd, and boot_dtb for the boot
resource. | Return the filenames of the kernel, initrd, and boot_dtb for the boot
resource. | [
"Return",
"the",
"filenames",
"of",
"the",
"kernel",
"initrd",
"and",
"boot_dtb",
"for",
"the",
"boot",
"resource",
"."
] | def get_boot_filenames(
arch,
subarch,
osystem,
series,
commissioning_osystem=undefined,
commissioning_distro_series=undefined,
):
"""Return the filenames of the kernel, initrd, and boot_dtb for the boot
resource."""
if subarch == "generic":
# MAAS doesn't store in the BootRe... | [
"def",
"get_boot_filenames",
"(",
"arch",
",",
"subarch",
",",
"osystem",
",",
"series",
",",
"commissioning_osystem",
"=",
"undefined",
",",
"commissioning_distro_series",
"=",
"undefined",
",",
")",
":",
"if",
"subarch",
"==",
"\"generic\"",
":",
"# MAAS doesn't... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/rpc/boot.py#L93-L143 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/services/rest/google/directions/service.py | python | GoogleDirectionsService.get_default_conf_file | () | return os.path.dirname(__file__) + os.sep + "directions.conf" | [] | def get_default_conf_file():
return os.path.dirname(__file__) + os.sep + "directions.conf" | [
"def",
"get_default_conf_file",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"+",
"os",
".",
"sep",
"+",
"\"directions.conf\""
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/services/rest/google/directions/service.py#L92-L93 | |||
LinOTP/LinOTP | bb3940bbaccea99550e6c063ff824f258dd6d6d7 | linotp/tokens/base/__init__.py | python | TokenClass.is_auth_only_token | (self, user) | return not support_challenge_response | check if token is in the authenticate only mode
this is required to optimize the number of requests
:param user: the user / realm where the token policy is applied
:return: boolean | check if token is in the authenticate only mode
this is required to optimize the number of requests | [
"check",
"if",
"token",
"is",
"in",
"the",
"authenticate",
"only",
"mode",
"this",
"is",
"required",
"to",
"optimize",
"the",
"number",
"of",
"requests"
] | def is_auth_only_token(self, user):
"""
check if token is in the authenticate only mode
this is required to optimize the number of requests
:param user: the user / realm where the token policy is applied
:return: boolean
"""
if len(self.mode) == 1 and "authentica... | [
"def",
"is_auth_only_token",
"(",
"self",
",",
"user",
")",
":",
"if",
"len",
"(",
"self",
".",
"mode",
")",
"==",
"1",
"and",
"\"authenticate\"",
"in",
"self",
".",
"mode",
":",
"return",
"True",
"if",
"len",
"(",
"self",
".",
"mode",
")",
"==",
"... | https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/tokens/base/__init__.py#L122-L142 | |
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/src/psize.py | python | Psize.setLength | (self, maxlen, minlen) | return self.olen | Compute molecule dimensions | Compute molecule dimensions | [
"Compute",
"molecule",
"dimensions"
] | def setLength(self, maxlen, minlen):
""" Compute molecule dimensions """
for i in range(3):
self.olen[i] = maxlen[i] - minlen[i]
if self.olen[i] < 0.1:
self.olen[i] = 0.1
return self.olen | [
"def",
"setLength",
"(",
"self",
",",
"maxlen",
",",
"minlen",
")",
":",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"self",
".",
"olen",
"[",
"i",
"]",
"=",
"maxlen",
"[",
"i",
"]",
"-",
"minlen",
"[",
"i",
"]",
"if",
"self",
".",
"olen",... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/src/psize.py#L137-L143 | |
ethereum/trinity | 6383280c5044feb06695ac2f7bc1100b7bcf4fe0 | p2p/auth.py | python | decode_auth_plain | (ciphertext: bytes, privkey: datatypes.PrivateKey) | return signature, pubkey, nonce, DEVP2P_V4 | Decode legacy pre-EIP-8 auth message format | Decode legacy pre-EIP-8 auth message format | [
"Decode",
"legacy",
"pre",
"-",
"EIP",
"-",
"8",
"auth",
"message",
"format"
] | def decode_auth_plain(ciphertext: bytes, privkey: datatypes.PrivateKey) -> Tuple[
datatypes.Signature, datatypes.PublicKey, bytes, int]:
"""Decode legacy pre-EIP-8 auth message format"""
message = ecies.decrypt(ciphertext, privkey)
if len(message) != AUTH_MSG_LEN:
raise BadAckMessage(f"Unexp... | [
"def",
"decode_auth_plain",
"(",
"ciphertext",
":",
"bytes",
",",
"privkey",
":",
"datatypes",
".",
"PrivateKey",
")",
"->",
"Tuple",
"[",
"datatypes",
".",
"Signature",
",",
"datatypes",
".",
"PublicKey",
",",
"bytes",
",",
"int",
"]",
":",
"message",
"="... | https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/p2p/auth.py#L295-L306 | |
JeremyCCHsu/vae-npvc | 94a83b33bf17593aa402cb38408fdfad1339a120 | util/layers.py | python | lrelu | (x, leak=0.02, name="lrelu") | return tf.maximum(x, leak*x, name=name) | Leaky ReLU | Leaky ReLU | [
"Leaky",
"ReLU"
] | def lrelu(x, leak=0.02, name="lrelu"):
''' Leaky ReLU '''
return tf.maximum(x, leak*x, name=name) | [
"def",
"lrelu",
"(",
"x",
",",
"leak",
"=",
"0.02",
",",
"name",
"=",
"\"lrelu\"",
")",
":",
"return",
"tf",
".",
"maximum",
"(",
"x",
",",
"leak",
"*",
"x",
",",
"name",
"=",
"name",
")"
] | https://github.com/JeremyCCHsu/vae-npvc/blob/94a83b33bf17593aa402cb38408fdfad1339a120/util/layers.py#L147-L149 | |
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/setuptools/setuptools/config.py | python | ConfigOptionsHandler.parse_section_extras_require | (self, section_options) | Parses `extras_require` configuration file section.
:param dict section_options: | Parses `extras_require` configuration file section. | [
"Parses",
"extras_require",
"configuration",
"file",
"section",
"."
] | def parse_section_extras_require(self, section_options):
"""Parses `extras_require` configuration file section.
:param dict section_options:
"""
parse_list = partial(self._parse_list, separator=';')
self['extras_require'] = self._parse_section_to_dict(
section_option... | [
"def",
"parse_section_extras_require",
"(",
"self",
",",
"section_options",
")",
":",
"parse_list",
"=",
"partial",
"(",
"self",
".",
"_parse_list",
",",
"separator",
"=",
"';'",
")",
"self",
"[",
"'extras_require'",
"]",
"=",
"self",
".",
"_parse_section_to_dic... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/config.py#L668-L675 | ||
vivisect/vivisect | 37b0b655d8dedfcf322e86b0f144b096e48d547e | envi/archs/arm/emu.py | python | ArmEmulator.integerSubtraction | (self, op) | return self.intSubBase(src1, src2, Sflag) | Do the core of integer subtraction but only *return* the
resulting value rather than assigning it.
(allows cmp and sub to use the same code) | Do the core of integer subtraction but only *return* the
resulting value rather than assigning it.
(allows cmp and sub to use the same code) | [
"Do",
"the",
"core",
"of",
"integer",
"subtraction",
"but",
"only",
"*",
"return",
"*",
"the",
"resulting",
"value",
"rather",
"than",
"assigning",
"it",
".",
"(",
"allows",
"cmp",
"and",
"sub",
"to",
"use",
"the",
"same",
"code",
")"
] | def integerSubtraction(self, op):
"""
Do the core of integer subtraction but only *return* the
resulting value rather than assigning it.
(allows cmp and sub to use the same code)
"""
# Src op gets sign extended to dst
#FIXME account for same operand with zero resu... | [
"def",
"integerSubtraction",
"(",
"self",
",",
"op",
")",
":",
"# Src op gets sign extended to dst",
"#FIXME account for same operand with zero result for PDE",
"src1",
"=",
"self",
".",
"getOperValue",
"(",
"op",
",",
"1",
")",
"src2",
"=",
"self",
".",
"getOperValue... | https://github.com/vivisect/vivisect/blob/37b0b655d8dedfcf322e86b0f144b096e48d547e/envi/archs/arm/emu.py#L496-L512 | |
openstack/octavia | 27e5b27d31c695ba72fb6750de2bdafd76e0d7d9 | octavia/controller/worker/v1/controller_worker.py | python | ControllerWorker.create_health_monitor | (self, health_monitor_id) | Creates a health monitor.
:param pool_id: ID of the pool to create a health monitor on
:returns: None
:raises NoResultFound: Unable to find the object | Creates a health monitor. | [
"Creates",
"a",
"health",
"monitor",
"."
] | def create_health_monitor(self, health_monitor_id):
"""Creates a health monitor.
:param pool_id: ID of the pool to create a health monitor on
:returns: None
:raises NoResultFound: Unable to find the object
"""
health_mon = self._health_mon_repo.get(db_apis.get_session(),... | [
"def",
"create_health_monitor",
"(",
"self",
",",
"health_monitor_id",
")",
":",
"health_mon",
"=",
"self",
".",
"_health_mon_repo",
".",
"get",
"(",
"db_apis",
".",
"get_session",
"(",
")",
",",
"id",
"=",
"health_monitor_id",
")",
"if",
"not",
"health_mon",
... | https://github.com/openstack/octavia/blob/27e5b27d31c695ba72fb6750de2bdafd76e0d7d9/octavia/controller/worker/v1/controller_worker.py#L116-L143 | ||
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/nba/roster.py | python | Player.percentage_zero_to_three_footers | (self) | return self._percentage_zero_to_three_footers | Returns a ``float`` of the percentage of shots the player takes from
zero to three feet from the basket. Percentage ranges from 0-1. | Returns a ``float`` of the percentage of shots the player takes from
zero to three feet from the basket. Percentage ranges from 0-1. | [
"Returns",
"a",
"float",
"of",
"the",
"percentage",
"of",
"shots",
"the",
"player",
"takes",
"from",
"zero",
"to",
"three",
"feet",
"from",
"the",
"basket",
".",
"Percentage",
"ranges",
"from",
"0",
"-",
"1",
"."
] | def percentage_zero_to_three_footers(self):
"""
Returns a ``float`` of the percentage of shots the player takes from
zero to three feet from the basket. Percentage ranges from 0-1.
"""
return self._percentage_zero_to_three_footers | [
"def",
"percentage_zero_to_three_footers",
"(",
"self",
")",
":",
"return",
"self",
".",
"_percentage_zero_to_three_footers"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nba/roster.py#L1053-L1058 | |
openai/mujoco-worldgen | 39f52b1b47aed499925a6a214b58bdbdb4e2f75e | mujoco_worldgen/objs/obj_from_xml.py | python | ObjFromXML._get_xml_dir_path | (self, *args) | return worldgen_path('assets/xmls', *args) | If you want to use custom XMLs, subclass this class and overwrite this
method to return the path to your 'xmls' folder | If you want to use custom XMLs, subclass this class and overwrite this
method to return the path to your 'xmls' folder | [
"If",
"you",
"want",
"to",
"use",
"custom",
"XMLs",
"subclass",
"this",
"class",
"and",
"overwrite",
"this",
"method",
"to",
"return",
"the",
"path",
"to",
"your",
"xmls",
"folder"
] | def _get_xml_dir_path(self, *args):
'''
If you want to use custom XMLs, subclass this class and overwrite this
method to return the path to your 'xmls' folder
'''
return worldgen_path('assets/xmls', *args) | [
"def",
"_get_xml_dir_path",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"worldgen_path",
"(",
"'assets/xmls'",
",",
"*",
"args",
")"
] | https://github.com/openai/mujoco-worldgen/blob/39f52b1b47aed499925a6a214b58bdbdb4e2f75e/mujoco_worldgen/objs/obj_from_xml.py#L150-L155 | |
OpenMDAO/OpenMDAO1 | 791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317 | openmdao/core/petsc_impl.py | python | PetscDataTransfer.transfer | (self, srcvec, tgtvec, mode='fwd', deriv=False) | Performs data transfer between a distributed source vector and
a distributed target vector.
Args
----
srcvec : `VecWrapper`
Variables that are the source of the transfer in fwd mode and
the destination of the transfer in rev mode.
tgtvec : `VecWrapper`
... | Performs data transfer between a distributed source vector and
a distributed target vector. | [
"Performs",
"data",
"transfer",
"between",
"a",
"distributed",
"source",
"vector",
"and",
"a",
"distributed",
"target",
"vector",
"."
] | def transfer(self, srcvec, tgtvec, mode='fwd', deriv=False):
"""Performs data transfer between a distributed source vector and
a distributed target vector.
Args
----
srcvec : `VecWrapper`
Variables that are the source of the transfer in fwd mode and
the d... | [
"def",
"transfer",
"(",
"self",
",",
"srcvec",
",",
"tgtvec",
",",
"mode",
"=",
"'fwd'",
",",
"deriv",
"=",
"False",
")",
":",
"if",
"mode",
"==",
"'rev'",
":",
"# in reverse mode, srcvec and tgtvec are switched. Note, we only",
"# run in reverse for derivatives, and ... | https://github.com/OpenMDAO/OpenMDAO1/blob/791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317/openmdao/core/petsc_impl.py#L394-L485 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/customer_conversion_goal_service/client.py | python | CustomerConversionGoalServiceClient.transport | (self) | return self._transport | Return the transport used by the client instance.
Returns:
CustomerConversionGoalServiceTransport: The transport used by the client instance. | Return the transport used by the client instance. | [
"Return",
"the",
"transport",
"used",
"by",
"the",
"client",
"instance",
"."
] | def transport(self) -> CustomerConversionGoalServiceTransport:
"""Return the transport used by the client instance.
Returns:
CustomerConversionGoalServiceTransport: The transport used by the client instance.
"""
return self._transport | [
"def",
"transport",
"(",
"self",
")",
"->",
"CustomerConversionGoalServiceTransport",
":",
"return",
"self",
".",
"_transport"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/customer_conversion_goal_service/client.py#L159-L165 | |
leapcode/bitmask_client | d2fe20df24fc6eaf146fa5ce1e847de6ab515688 | pkg/osx/daemon/daemon.py | python | set_signal_handlers | (signal_handler_map) | Set the signal handlers as specified.
:param signal_handler_map: A map from signal number to handler
object.
:return: ``None``.
See the `signal` module for details on signal numbers and signal
handlers. | Set the signal handlers as specified. | [
"Set",
"the",
"signal",
"handlers",
"as",
"specified",
"."
] | def set_signal_handlers(signal_handler_map):
""" Set the signal handlers as specified.
:param signal_handler_map: A map from signal number to handler
object.
:return: ``None``.
See the `signal` module for details on signal numbers and signal
handlers.
"""
f... | [
"def",
"set_signal_handlers",
"(",
"signal_handler_map",
")",
":",
"for",
"(",
"signal_number",
",",
"handler",
")",
"in",
"signal_handler_map",
".",
"items",
"(",
")",
":",
"signal",
".",
"signal",
"(",
"signal_number",
",",
"handler",
")"
] | https://github.com/leapcode/bitmask_client/blob/d2fe20df24fc6eaf146fa5ce1e847de6ab515688/pkg/osx/daemon/daemon.py#L872-L884 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pyparsing.py | python | ParserElement.__and__ | (self, other ) | return Each( [ self, other ] ) | Implementation of & operator - returns C{L{Each}} | Implementation of & operator - returns C{L{Each}} | [
"Implementation",
"of",
"&",
"operator",
"-",
"returns",
"C",
"{",
"L",
"{",
"Each",
"}}"
] | def __and__(self, other ):
"""
Implementation of & operator - returns C{L{Each}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine element of ... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pyparsing.py#L1974-L1984 | |
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/data/hetero_data.py | python | HeteroData.__delattr__ | (self, key: str) | [] | def __delattr__(self, key: str):
delattr(self._global_store, key) | [
"def",
"__delattr__",
"(",
"self",
",",
"key",
":",
"str",
")",
":",
"delattr",
"(",
"self",
".",
"_global_store",
",",
"key",
")"
] | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/data/hetero_data.py#L128-L129 | ||||
rcorcs/NatI | fdf014f4292afdc95250add7b6658468043228e1 | en/parser/nltk_lite/cluster/em.py | python | cosine_distance | (u, v) | return numpy.dot(u, v) / (math.sqrt(numpy.dot(u, u)) * math.sqrt(numpy.dot(v, v))) | Returns the cosine of the angle between vectors v and u. This is equal to
u.v / |u||v|. | Returns the cosine of the angle between vectors v and u. This is equal to
u.v / |u||v|. | [
"Returns",
"the",
"cosine",
"of",
"the",
"angle",
"between",
"vectors",
"v",
"and",
"u",
".",
"This",
"is",
"equal",
"to",
"u",
".",
"v",
"/",
"|u||v|",
"."
] | def cosine_distance(u, v):
"""
Returns the cosine of the angle between vectors v and u. This is equal to
u.v / |u||v|.
"""
return numpy.dot(u, v) / (math.sqrt(numpy.dot(u, u)) * math.sqrt(numpy.dot(v, v))) | [
"def",
"cosine_distance",
"(",
"u",
",",
"v",
")",
":",
"return",
"numpy",
".",
"dot",
"(",
"u",
",",
"v",
")",
"/",
"(",
"math",
".",
"sqrt",
"(",
"numpy",
".",
"dot",
"(",
"u",
",",
"u",
")",
")",
"*",
"math",
".",
"sqrt",
"(",
"numpy",
"... | https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/cluster/em.py#L174-L179 | |
crossbario/autobahn-python | fa9f2da0c5005574e63456a3a04f00e405744014 | autobahn/xbr/_eip712_channel_open.py | python | sign_eip712_channel_open | (eth_privkey: bytes, chainId: int, verifyingContract: bytes, ctype: int,
openedAt: int, marketId: bytes, channelId: bytes, actor: bytes, delegate: bytes,
marketmaker: bytes, recipient: bytes, amount: int) | return sign(eth_privkey, data) | :param eth_privkey: Ethereum address of buyer (a raw 20 bytes Ethereum address).
:type eth_privkey: bytes
:return: The signature according to EIP712 (32+32+1 raw bytes).
:rtype: bytes | [] | def sign_eip712_channel_open(eth_privkey: bytes, chainId: int, verifyingContract: bytes, ctype: int,
openedAt: int, marketId: bytes, channelId: bytes, actor: bytes, delegate: bytes,
marketmaker: bytes, recipient: bytes, amount: int) -> bytes:
"""
:param... | [
"def",
"sign_eip712_channel_open",
"(",
"eth_privkey",
":",
"bytes",
",",
"chainId",
":",
"int",
",",
"verifyingContract",
":",
"bytes",
",",
"ctype",
":",
"int",
",",
"openedAt",
":",
"int",
",",
"marketId",
":",
"bytes",
",",
"channelId",
":",
"bytes",
"... | https://github.com/crossbario/autobahn-python/blob/fa9f2da0c5005574e63456a3a04f00e405744014/autobahn/xbr/_eip712_channel_open.py#L131-L146 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex/interpret/as_data_reader/readers.py | python | preprocess_image | (img, random_mirror=False) | return img | centered, scaled by 1/255.
:param img: np.array: shape: [ns, h, w, 3], color order: rgb.
:return: np.array: shape: [ns, h, w, 3] | centered, scaled by 1/255.
:param img: np.array: shape: [ns, h, w, 3], color order: rgb.
:return: np.array: shape: [ns, h, w, 3] | [
"centered",
"scaled",
"by",
"1",
"/",
"255",
".",
":",
"param",
"img",
":",
"np",
".",
"array",
":",
"shape",
":",
"[",
"ns",
"h",
"w",
"3",
"]",
"color",
"order",
":",
"rgb",
".",
":",
"return",
":",
"np",
".",
"array",
":",
"shape",
":",
"[... | def preprocess_image(img, random_mirror=False):
"""
centered, scaled by 1/255.
:param img: np.array: shape: [ns, h, w, 3], color order: rgb.
:return: np.array: shape: [ns, h, w, 3]
"""
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
# transpose to [ns, 3, h, w]
img = img.as... | [
"def",
"preprocess_image",
"(",
"img",
",",
"random_mirror",
"=",
"False",
")",
":",
"mean",
"=",
"[",
"0.485",
",",
"0.456",
",",
"0.406",
"]",
"std",
"=",
"[",
"0.229",
",",
"0.224",
",",
"0.225",
"]",
"# transpose to [ns, 3, h, w]",
"img",
"=",
"img",... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/interpret/as_data_reader/readers.py#L73-L95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.