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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/gto/mole.py | python | Mole.ao2mo | (self, mo_coeffs, erifile=None, dataname='eri_mo', intor='int2e',
**kwargs) | return ao2mo.kernel(self, mo_coeffs, erifile, dataname, intor, **kwargs) | Integral transformation for arbitrary orbitals and arbitrary
integrals. See more detalied documentation in func:`ao2mo.kernel`.
Args:
mo_coeffs (an np array or a list of arrays) : A matrix of orbital
coefficients if it is a numpy ndarray, or four sets of orbital
... | Integral transformation for arbitrary orbitals and arbitrary
integrals. See more detalied documentation in func:`ao2mo.kernel`. | [
"Integral",
"transformation",
"for",
"arbitrary",
"orbitals",
"and",
"arbitrary",
"integrals",
".",
"See",
"more",
"detalied",
"documentation",
"in",
"func",
":",
"ao2mo",
".",
"kernel",
"."
] | def ao2mo(self, mo_coeffs, erifile=None, dataname='eri_mo', intor='int2e',
**kwargs):
'''Integral transformation for arbitrary orbitals and arbitrary
integrals. See more detalied documentation in func:`ao2mo.kernel`.
Args:
mo_coeffs (an np array or a list of arrays) :... | [
"def",
"ao2mo",
"(",
"self",
",",
"mo_coeffs",
",",
"erifile",
"=",
"None",
",",
"dataname",
"=",
"'eri_mo'",
",",
"intor",
"=",
"'int2e'",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pyscf",
"import",
"ao2mo",
"return",
"ao2mo",
".",
"kernel",
"(",
... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/gto/mole.py#L3465-L3517 | |
pm4py/pm4py-core | 7807b09a088b02199cd0149d724d0e28793971bf | pm4py/algo/organizational_mining/sna/util.py | python | cluster_affinity_propagation | (sna_results: List[List[Any]], parameters=None) | return ret | Performs a clustering using the affinity propagation algorithm provided by Scikit Learn
Parameters
--------------
sna_results
Values for a SNA metric
parameters
Parameters of the algorithm
Returns
--------------
clustering
Dictionary that contains, for each cluster ... | Performs a clustering using the affinity propagation algorithm provided by Scikit Learn | [
"Performs",
"a",
"clustering",
"using",
"the",
"affinity",
"propagation",
"algorithm",
"provided",
"by",
"Scikit",
"Learn"
] | def cluster_affinity_propagation(sna_results: List[List[Any]], parameters=None) -> Dict[str, List[str]]:
"""
Performs a clustering using the affinity propagation algorithm provided by Scikit Learn
Parameters
--------------
sna_results
Values for a SNA metric
parameters
Parameter... | [
"def",
"cluster_affinity_propagation",
"(",
"sna_results",
":",
"List",
"[",
"List",
"[",
"Any",
"]",
"]",
",",
"parameters",
"=",
"None",
")",
"->",
"Dict",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
":",
"from",
"sklearn",
".",
"cluster",
"import... | https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/algo/organizational_mining/sna/util.py#L73-L109 | |
turicas/brasil.io | f1c371fe828a090510259a5027b49e2e651936b4 | utils/conversion.py | python | csv2sqlite | (
input_filename,
output_filename,
table_name,
samples=30000,
batch_size=10000,
encoding="utf-8",
callback=None,
force_types=None,
) | [] | def csv2sqlite(
input_filename,
output_filename,
table_name,
samples=30000,
batch_size=10000,
encoding="utf-8",
callback=None,
force_types=None,
):
# Identify data types
fobj = open_compressed(input_filename, encoding)
reader = csv.reader(fobj)
header = next(reader)
... | [
"def",
"csv2sqlite",
"(",
"input_filename",
",",
"output_filename",
",",
"table_name",
",",
"samples",
"=",
"30000",
",",
"batch_size",
"=",
"10000",
",",
"encoding",
"=",
"\"utf-8\"",
",",
"callback",
"=",
"None",
",",
"force_types",
"=",
"None",
",",
")",
... | https://github.com/turicas/brasil.io/blob/f1c371fe828a090510259a5027b49e2e651936b4/utils/conversion.py#L21-L53 | ||||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_app_netCDF/serialization.py | python | NetcdfResourceMeta._read_resource_metadata | (self) | [] | def _read_resource_metadata(self):
super(NetcdfResourceMeta, self)._read_resource_metadata()
print("--- NetcdfResourceMeta ---")
# Also parse using SAX so that we can capture certain metadata elements
# in the same order in which they appear in the RDF+XML serialization.
SAX_pa... | [
"def",
"_read_resource_metadata",
"(",
"self",
")",
":",
"super",
"(",
"NetcdfResourceMeta",
",",
"self",
")",
".",
"_read_resource_metadata",
"(",
")",
"print",
"(",
"\"--- NetcdfResourceMeta ---\"",
")",
"# Also parse using SAX so that we can capture certain metadata elemen... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_app_netCDF/serialization.py#L28-L112 | ||||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/contrib/numpy-1.1.0/numpy/oldnumeric/ma.py | python | resize | (a, new_shape) | return result | resize(a, new_shape) returns a new array with the specified shape.
The original array's total size can be any size. | resize(a, new_shape) returns a new array with the specified shape.
The original array's total size can be any size. | [
"resize",
"(",
"a",
"new_shape",
")",
"returns",
"a",
"new",
"array",
"with",
"the",
"specified",
"shape",
".",
"The",
"original",
"array",
"s",
"total",
"size",
"can",
"be",
"any",
"size",
"."
] | def resize (a, new_shape):
"""resize(a, new_shape) returns a new array with the specified shape.
The original array's total size can be any size."""
m = getmask(a)
if m is not nomask:
m = fromnumeric.resize(m, new_shape)
result = array(fromnumeric.resize(filled(a), new_shape), mask=m)
re... | [
"def",
"resize",
"(",
"a",
",",
"new_shape",
")",
":",
"m",
"=",
"getmask",
"(",
"a",
")",
"if",
"m",
"is",
"not",
"nomask",
":",
"m",
"=",
"fromnumeric",
".",
"resize",
"(",
"m",
",",
"new_shape",
")",
"result",
"=",
"array",
"(",
"fromnumeric",
... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/numpy-1.1.0/numpy/oldnumeric/ma.py#L1505-L1513 | |
9miao/G-Firefly | 8fbeeb3ef9782600560be48228c91cfb8f5ff87d | gfirefly/gfirefly/distributed/root.py | python | PBRoot.callChildNotForResult | (self,childname,*args,**kw) | 调用子节点的接口
@param childId: int 子节点的id
return Defered Object | 调用子节点的接口 | [
"调用子节点的接口"
] | def callChildNotForResult(self,childname,*args,**kw):
'''调用子节点的接口
@param childId: int 子节点的id
return Defered Object
'''
self.childsmanager.callChildNotForResult(childname,*args,**kw) | [
"def",
"callChildNotForResult",
"(",
"self",
",",
"childname",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"childsmanager",
".",
"callChildNotForResult",
"(",
"childname",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | https://github.com/9miao/G-Firefly/blob/8fbeeb3ef9782600560be48228c91cfb8f5ff87d/gfirefly/gfirefly/distributed/root.py#L112-L117 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/clustering/hierarchical.py | python | feature_clustering | (data, distance=PearsonR,
linkage=AVERAGE) | return dist_matrix_clustering(matrix, linkage=linkage) | Return the hierarchical clustering of the dataset's columns.
:param Orange.data.Table data: Dataset to cluster.
:param Orange.distance.Distance distance: A distance measure.
:param str linkage: | Return the hierarchical clustering of the dataset's columns. | [
"Return",
"the",
"hierarchical",
"clustering",
"of",
"the",
"dataset",
"s",
"columns",
"."
] | def feature_clustering(data, distance=PearsonR,
linkage=AVERAGE):
"""
Return the hierarchical clustering of the dataset's columns.
:param Orange.data.Table data: Dataset to cluster.
:param Orange.distance.Distance distance: A distance measure.
:param str linkage:
"""
... | [
"def",
"feature_clustering",
"(",
"data",
",",
"distance",
"=",
"PearsonR",
",",
"linkage",
"=",
"AVERAGE",
")",
":",
"matrix",
"=",
"distance",
"(",
"data",
",",
"axis",
"=",
"0",
")",
"return",
"dist_matrix_clustering",
"(",
"matrix",
",",
"linkage",
"="... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/clustering/hierarchical.py#L74-L84 | |
sefakilic/goodreads | 5187100d66b87c87db8b095bbf576e1b92422a23 | goodreads/client.py | python | GoodreadsClient.find_author | (self, author_name) | return self.author(resp['author']['@id']) if 'author' in resp else None | Find an author by name | Find an author by name | [
"Find",
"an",
"author",
"by",
"name"
] | def find_author(self, author_name):
"""Find an author by name"""
resp = self.request("api/author_url/%s" % author_name, {})
return self.author(resp['author']['@id']) if 'author' in resp else None | [
"def",
"find_author",
"(",
"self",
",",
"author_name",
")",
":",
"resp",
"=",
"self",
".",
"request",
"(",
"\"api/author_url/%s\"",
"%",
"author_name",
",",
"{",
"}",
")",
"return",
"self",
".",
"author",
"(",
"resp",
"[",
"'author'",
"]",
"[",
"'@id'",
... | https://github.com/sefakilic/goodreads/blob/5187100d66b87c87db8b095bbf576e1b92422a23/goodreads/client.py#L83-L86 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AdminServer/appscale/admin/utils.py | python | remove_old_archives | (project_id, service_id, version) | Cleans up old revision archives.
Args:
project_id: A string specifying a project ID.
service_id: A string specifying a service ID.
version: A dictionary containing version details. | Cleans up old revision archives. | [
"Cleans",
"up",
"old",
"revision",
"archives",
"."
] | def remove_old_archives(project_id, service_id, version):
""" Cleans up old revision archives.
Args:
project_id: A string specifying a project ID.
service_id: A string specifying a service ID.
version: A dictionary containing version details.
"""
prefix = VERSION_PATH_SEPARATOR.join(
[project_i... | [
"def",
"remove_old_archives",
"(",
"project_id",
",",
"service_id",
",",
"version",
")",
":",
"prefix",
"=",
"VERSION_PATH_SEPARATOR",
".",
"join",
"(",
"[",
"project_id",
",",
"service_id",
",",
"version",
"[",
"'id'",
"]",
"]",
")",
"current_name",
"=",
"o... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AdminServer/appscale/admin/utils.py#L290-L305 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/encodings/iso8859_15.py | python | IncrementalEncoder.encode | (self, input, final=False) | return codecs.charmap_encode(input,self.errors,encoding_table)[0] | [] | def encode(self, input, final=False):
return codecs.charmap_encode(input,self.errors,encoding_table)[0] | [
"def",
"encode",
"(",
"self",
",",
"input",
",",
"final",
"=",
"False",
")",
":",
"return",
"codecs",
".",
"charmap_encode",
"(",
"input",
",",
"self",
".",
"errors",
",",
"encoding_table",
")",
"[",
"0",
"]"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/iso8859_15.py#L18-L19 | |||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/tmdbsimple/movies.py | python | Keywords.info | (self, **kwargs) | return response | Get the details of a keyword.
Args:
None
Returns:
A dict representation of the JSON returned from the API. | Get the details of a keyword. | [
"Get",
"the",
"details",
"of",
"a",
"keyword",
"."
] | def info(self, **kwargs):
"""
Get the details of a keyword.
Args:
None
Returns:
A dict representation of the JSON returned from the API.
"""
path = self._get_id_path('info')
response = self._GET(path, kwargs)
self._set_attrs_to_va... | [
"def",
"info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"self",
".",
"_get_id_path",
"(",
"'info'",
")",
"response",
"=",
"self",
".",
"_GET",
"(",
"path",
",",
"kwargs",
")",
"self",
".",
"_set_attrs_to_values",
"(",
"response",
... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tmdbsimple/movies.py#L690-L704 | |
wasidennis/AdaptSegNet | fca9ff0f09dab45d44bf6d26091377ac66607028 | evaluate_cityscapes.py | python | main | () | Create the model and start the evaluation process. | Create the model and start the evaluation process. | [
"Create",
"the",
"model",
"and",
"start",
"the",
"evaluation",
"process",
"."
] | def main():
"""Create the model and start the evaluation process."""
args = get_arguments()
gpu0 = args.gpu
if not os.path.exists(args.save):
os.makedirs(args.save)
if args.model == 'DeeplabMulti':
model = DeeplabMulti(num_classes=args.num_classes)
elif args.model == 'Oracle'... | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"get_arguments",
"(",
")",
"gpu0",
"=",
"args",
".",
"gpu",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"args",
".",
"save",
")",
":",
"os",
".",
"makedirs",
"(",
"args",
".",
"save",
")",
"if"... | https://github.com/wasidennis/AdaptSegNet/blob/fca9ff0f09dab45d44bf6d26091377ac66607028/evaluate_cityscapes.py#L82-L145 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/util/yaml/loader.py | python | Secrets._load_secret_yaml | (self, secret_dir: Path) | return secrets | Load the secrets yaml from path. | Load the secrets yaml from path. | [
"Load",
"the",
"secrets",
"yaml",
"from",
"path",
"."
] | def _load_secret_yaml(self, secret_dir: Path) -> dict[str, str]:
"""Load the secrets yaml from path."""
if (secret_path := secret_dir / SECRET_YAML) in self._cache:
return self._cache[secret_path]
_LOGGER.debug("Loading %s", secret_path)
try:
secrets = load_yaml(... | [
"def",
"_load_secret_yaml",
"(",
"self",
",",
"secret_dir",
":",
"Path",
")",
"->",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"if",
"(",
"secret_path",
":=",
"secret_dir",
"/",
"SECRET_YAML",
")",
"in",
"self",
".",
"_cache",
":",
"return",
"self",
"."... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/util/yaml/loader.py#L61-L88 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/boson.py | python | BosonOp._eval_commutator_BosonOp | (self, other, **hints) | return None | [] | def _eval_commutator_BosonOp(self, other, **hints):
if self.name == other.name:
# [a^\dagger, a] = -1
if not self.is_annihilation and other.is_annihilation:
return Integer(-1)
elif 'independent' in hints and hints['independent']:
# [a, b] = 0
... | [
"def",
"_eval_commutator_BosonOp",
"(",
"self",
",",
"other",
",",
"*",
"*",
"hints",
")",
":",
"if",
"self",
".",
"name",
"==",
"other",
".",
"name",
":",
"# [a^\\dagger, a] = -1",
"if",
"not",
"self",
".",
"is_annihilation",
"and",
"other",
".",
"is_anni... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/boson.py#L68-L78 | |||
translate/translate | 72816df696b5263abfe80ab59129b299b85ae749 | translate/storage/html.py | python | htmlfile.handle_charref | (self, name) | Handle entries in the form &#NNNN; e.g. ⃡ | Handle entries in the form &#NNNN; e.g. ⃡ | [
"Handle",
"entries",
"in",
"the",
"form",
"&#NNNN",
";",
"e",
".",
"g",
".",
"⃡",
";"
] | def handle_charref(self, name):
"""Handle entries in the form &#NNNN; e.g. ⃡"""
if name.lower().startswith("x"):
self.handle_data(chr(int(name[1:], 16)))
else:
self.handle_data(chr(int(name))) | [
"def",
"handle_charref",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"\"x\"",
")",
":",
"self",
".",
"handle_data",
"(",
"chr",
"(",
"int",
"(",
"name",
"[",
"1",
":",
"]",
",",
"16",
")",
"... | https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/storage/html.py#L461-L466 | ||
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/api/cmdutils.py | python | check_exclusive | (flags: Iterable[bool], names: Iterable[str]) | Check if only one flag is set with exclusive flags.
Raise a CommandError if not.
Args:
flags: The flag values to check.
names: A list of names (corresponding to the flags argument). | Check if only one flag is set with exclusive flags. | [
"Check",
"if",
"only",
"one",
"flag",
"is",
"set",
"with",
"exclusive",
"flags",
"."
] | def check_exclusive(flags: Iterable[bool], names: Iterable[str]) -> None:
"""Check if only one flag is set with exclusive flags.
Raise a CommandError if not.
Args:
flags: The flag values to check.
names: A list of names (corresponding to the flags argument).
"""
if sum(1 for e in f... | [
"def",
"check_exclusive",
"(",
"flags",
":",
"Iterable",
"[",
"bool",
"]",
",",
"names",
":",
"Iterable",
"[",
"str",
"]",
")",
"->",
"None",
":",
"if",
"sum",
"(",
"1",
"for",
"e",
"in",
"flags",
"if",
"e",
")",
">",
"1",
":",
"argstr",
"=",
"... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/api/cmdutils.py#L94-L105 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/ensemble/basic_algorithms/decision_tree/tree_core/g_h_optim.py | python | GHPacker.fixedpoint_encode | (num, mul) | return int_fixpoint | [] | def fixedpoint_encode(num, mul):
int_fixpoint = int(round(num * mul))
return int_fixpoint | [
"def",
"fixedpoint_encode",
"(",
"num",
",",
"mul",
")",
":",
"int_fixpoint",
"=",
"int",
"(",
"round",
"(",
"num",
"*",
"mul",
")",
")",
"return",
"int_fixpoint"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/ensemble/basic_algorithms/decision_tree/tree_core/g_h_optim.py#L95-L97 | |||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | get_function_result.write | (self, oprot) | [] | def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('get_function_result')
if self.success is not None:
oprot.... | [
"def",
"write",
"(",
"self",
",",
"oprot",
")",
":",
"if",
"oprot",
".",
"_fast_encode",
"is",
"not",
"None",
"and",
"self",
".",
"thrift_spec",
"is",
"not",
"None",
":",
"oprot",
".",
"trans",
".",
"write",
"(",
"oprot",
".",
"_fast_encode",
"(",
"s... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L28116-L28134 | ||||
f-dangel/backpack | 1da7e53ebb2c490e2b7dd9f79116583641f3cca1 | backpack/extensions/secondorder/sqrt_ggn/dropout.py | python | SqrtGGNDropout.__init__ | (self) | Pass derivatives for ``torch.nn.Dropout`` module. | Pass derivatives for ``torch.nn.Dropout`` module. | [
"Pass",
"derivatives",
"for",
"torch",
".",
"nn",
".",
"Dropout",
"module",
"."
] | def __init__(self):
"""Pass derivatives for ``torch.nn.Dropout`` module."""
super().__init__(DropoutDerivatives()) | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"DropoutDerivatives",
"(",
")",
")"
] | https://github.com/f-dangel/backpack/blob/1da7e53ebb2c490e2b7dd9f79116583641f3cca1/backpack/extensions/secondorder/sqrt_ggn/dropout.py#L9-L11 | ||
Squarespace/pgbedrock | 58e46f98da72e81ae0c2f69463aa6e97ea7b8936 | pgbedrock/privileges.py | python | PrivilegeAnalyzer.analyze_defaults | (self) | Analyze default privileges. Note that we sort the grants / revokes before issuing
them so the output will be more organized, making it easier for the end user to read | Analyze default privileges. Note that we sort the grants / revokes before issuing
them so the output will be more organized, making it easier for the end user to read | [
"Analyze",
"default",
"privileges",
".",
"Note",
"that",
"we",
"sort",
"the",
"grants",
"/",
"revokes",
"before",
"issuing",
"them",
"so",
"the",
"output",
"will",
"be",
"more",
"organized",
"making",
"it",
"easier",
"for",
"the",
"end",
"user",
"to",
"rea... | def analyze_defaults(self):
""" Analyze default privileges. Note that we sort the grants / revokes before issuing
them so the output will be more organized, making it easier for the end user to read """
defaults_to_grant = self.desired_defaults.difference(self.current_defaults)
logger.de... | [
"def",
"analyze_defaults",
"(",
"self",
")",
":",
"defaults_to_grant",
"=",
"self",
".",
"desired_defaults",
".",
"difference",
"(",
"self",
".",
"current_defaults",
")",
"logger",
".",
"debug",
"(",
"'defaults_to_grant: {}'",
".",
"format",
"(",
"defaults_to_gran... | https://github.com/Squarespace/pgbedrock/blob/58e46f98da72e81ae0c2f69463aa6e97ea7b8936/pgbedrock/privileges.py#L214-L225 | ||
PetterKraabol/Twitch-Chat-Downloader | 7d8b00d1836cbb804489a75b57d6af131fc2cc55 | tcd/logger.py | python | Logger.log | (self, message: str = '', log_type: str = Log.REGULAR, retain: bool = True) | return log | Log a message
:param message: Log message
:param log_type: Log type
:param retain: Save log to memory
:return: None | Log a message
:param message: Log message
:param log_type: Log type
:param retain: Save log to memory
:return: None | [
"Log",
"a",
"message",
":",
"param",
"message",
":",
"Log",
"message",
":",
"param",
"log_type",
":",
"Log",
"type",
":",
"param",
"retain",
":",
"Save",
"log",
"to",
"memory",
":",
"return",
":",
"None"
] | def log(self, message: str = '', log_type: str = Log.REGULAR, retain: bool = True) -> Log:
"""
Log a message
:param message: Log message
:param log_type: Log type
:param retain: Save log to memory
:return: None
"""
# Add log to
log = Log(message, l... | [
"def",
"log",
"(",
"self",
",",
"message",
":",
"str",
"=",
"''",
",",
"log_type",
":",
"str",
"=",
"Log",
".",
"REGULAR",
",",
"retain",
":",
"bool",
"=",
"True",
")",
"->",
"Log",
":",
"# Add log to",
"log",
"=",
"Log",
"(",
"message",
",",
"lo... | https://github.com/PetterKraabol/Twitch-Chat-Downloader/blob/7d8b00d1836cbb804489a75b57d6af131fc2cc55/tcd/logger.py#L42-L65 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/dns/resolver.py | python | Cache.put | (self, key, value) | Associate key and value in the cache.
*key*, a ``(dns.name.Name, int, int)`` tuple whose values are the
query name, rdtype, and rdclass respectively.
*value*, a ``dns.resolver.Answer``, the answer. | Associate key and value in the cache. | [
"Associate",
"key",
"and",
"value",
"in",
"the",
"cache",
"."
] | def put(self, key, value):
"""Associate key and value in the cache.
*key*, a ``(dns.name.Name, int, int)`` tuple whose values are the
query name, rdtype, and rdclass respectively.
*value*, a ``dns.resolver.Answer``, the answer.
"""
with self.lock:
self._may... | [
"def",
"put",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"with",
"self",
".",
"lock",
":",
"self",
".",
"_maybe_clean",
"(",
")",
"self",
".",
"data",
"[",
"key",
"]",
"=",
"value"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/resolver.py#L331-L342 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/locations/management/commands/fix_loc_type_reference.py | python | has_bad_location_types | (domain) | return (SQLLocation.objects
.filter(domain=domain)
.exclude(location_type__domain=domain)
.exists()) | [] | def has_bad_location_types(domain):
return (SQLLocation.objects
.filter(domain=domain)
.exclude(location_type__domain=domain)
.exists()) | [
"def",
"has_bad_location_types",
"(",
"domain",
")",
":",
"return",
"(",
"SQLLocation",
".",
"objects",
".",
"filter",
"(",
"domain",
"=",
"domain",
")",
".",
"exclude",
"(",
"location_type__domain",
"=",
"domain",
")",
".",
"exists",
"(",
")",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/locations/management/commands/fix_loc_type_reference.py#L57-L61 | |||
jd/tenacity | 005ef22015ec4fda8646bf9dce7aaa1a4fa121d2 | tenacity/__init__.py | python | retry | (*dargs: t.Any, **dkw: t.Any) | Wrap a function with a new `Retrying` object.
:param dargs: positional arguments passed to Retrying object
:param dkw: keyword arguments passed to the Retrying object | Wrap a function with a new `Retrying` object. | [
"Wrap",
"a",
"function",
"with",
"a",
"new",
"Retrying",
"object",
"."
] | def retry(*dargs: t.Any, **dkw: t.Any) -> t.Union[WrappedFn, t.Callable[[WrappedFn], WrappedFn]]: # noqa
"""Wrap a function with a new `Retrying` object.
:param dargs: positional arguments passed to Retrying object
:param dkw: keyword arguments passed to the Retrying object
"""
# support both @ret... | [
"def",
"retry",
"(",
"*",
"dargs",
":",
"t",
".",
"Any",
",",
"*",
"*",
"dkw",
":",
"t",
".",
"Any",
")",
"->",
"t",
".",
"Union",
"[",
"WrappedFn",
",",
"t",
".",
"Callable",
"[",
"[",
"WrappedFn",
"]",
",",
"WrappedFn",
"]",
"]",
":",
"# no... | https://github.com/jd/tenacity/blob/005ef22015ec4fda8646bf9dce7aaa1a4fa121d2/tenacity/__init__.py#L105-L131 | ||
MacHu-GWU/uszipcode-project | d5ca6d7bd0544043dfc8fee3393ee17e1c96c01d | uszipcode/search.py | python | SearchEngine.by_land_area_in_sqmi | (
self,
lower: int = -1,
upper: int = 2 ** 31,
zipcode_type: ZipcodeTypeEnum = ZipcodeTypeEnum.Standard,
sort_by: str = SimpleZipcode.land_area_in_sqmi.name,
ascending: bool = False,
returns: int = DEFAULT_LIMIT,
) | return self.query(
land_area_in_sqmi_lower=lower,
land_area_in_sqmi_upper=upper,
sort_by=sort_by, zipcode_type=zipcode_type,
ascending=ascending, returns=returns,
) | Search zipcode information by land area / sq miles range. | Search zipcode information by land area / sq miles range. | [
"Search",
"zipcode",
"information",
"by",
"land",
"area",
"/",
"sq",
"miles",
"range",
"."
] | def by_land_area_in_sqmi(
self,
lower: int = -1,
upper: int = 2 ** 31,
zipcode_type: ZipcodeTypeEnum = ZipcodeTypeEnum.Standard,
sort_by: str = SimpleZipcode.land_area_in_sqmi.name,
ascending: bool = False,
returns: int = DEFAULT_LIMIT,
):
"""
... | [
"def",
"by_land_area_in_sqmi",
"(",
"self",
",",
"lower",
":",
"int",
"=",
"-",
"1",
",",
"upper",
":",
"int",
"=",
"2",
"**",
"31",
",",
"zipcode_type",
":",
"ZipcodeTypeEnum",
"=",
"ZipcodeTypeEnum",
".",
"Standard",
",",
"sort_by",
":",
"str",
"=",
... | https://github.com/MacHu-GWU/uszipcode-project/blob/d5ca6d7bd0544043dfc8fee3393ee17e1c96c01d/uszipcode/search.py#L882-L899 | |
ros/ros | 93d8da32091b8b43702eab5d3202f4511dfeb7dc | tools/rosunit/src/rosunit/pmon.py | python | shutdown_process_monitor | (process_monitor) | @param process_monitor: process monitor to kill
@type process_monitor: L{ProcessMonitor}
@return: True if process_monitor was successfully
shutdown. False if it could not be shutdown cleanly or if there is
a problem with process_monitor
parameter. shutdown_process_monitor() does not throw any excep... | [] | def shutdown_process_monitor(process_monitor):
"""
@param process_monitor: process monitor to kill
@type process_monitor: L{ProcessMonitor}
@return: True if process_monitor was successfully
shutdown. False if it could not be shutdown cleanly or if there is
a problem with process_monitor
par... | [
"def",
"shutdown_process_monitor",
"(",
"process_monitor",
")",
":",
"try",
":",
"if",
"process_monitor",
"is",
"None",
"or",
"process_monitor",
".",
"is_shutdown",
":",
"return",
"False",
"process_monitor",
".",
"shutdown",
"(",
")",
"process_monitor",
".",
"join... | https://github.com/ros/ros/blob/93d8da32091b8b43702eab5d3202f4511dfeb7dc/tools/rosunit/src/rosunit/pmon.py#L92-L114 | |||
simetenn/uncertainpy | ffb2400289743066265b9a8561cdf3b72e478a28 | src/uncertainpy/features/efel_features.py | python | EfelFeatures.reference_feature | (self, time, values, info) | return time, values | An example of an Efel feature. Efel feature functions have the following
requirements, and the given parameters must either be returned by
``model.run`` or ``features.preprocess``.
Parameters
----------
time : {None, numpy.nan, array_like}
Time values of the model. I... | An example of an Efel feature. Efel feature functions have the following
requirements, and the given parameters must either be returned by
``model.run`` or ``features.preprocess``. | [
"An",
"example",
"of",
"an",
"Efel",
"feature",
".",
"Efel",
"feature",
"functions",
"have",
"the",
"following",
"requirements",
"and",
"the",
"given",
"parameters",
"must",
"either",
"be",
"returned",
"by",
"model",
".",
"run",
"or",
"features",
".",
"prepr... | def reference_feature(self, time, values, info):
"""
An example of an Efel feature. Efel feature functions have the following
requirements, and the given parameters must either be returned by
``model.run`` or ``features.preprocess``.
Parameters
----------
time : ... | [
"def",
"reference_feature",
"(",
"self",
",",
"time",
",",
"values",
",",
"info",
")",
":",
"# Perform feature calculations here",
"time",
"=",
"None",
"values",
"=",
"None",
"return",
"time",
",",
"values"
] | https://github.com/simetenn/uncertainpy/blob/ffb2400289743066265b9a8561cdf3b72e478a28/src/uncertainpy/features/efel_features.py#L250-L284 | |
microsoft/MPNet | 081523a788c1556f28dd90cbc629810f48b083fb | pretraining/fairseq/optim/bmuf.py | python | FairseqBMUF.step | (self, closure=None) | Performs a single optimization step. | Performs a single optimization step. | [
"Performs",
"a",
"single",
"optimization",
"step",
"."
] | def step(self, closure=None):
"""Performs a single optimization step."""
self._optimizer.step(closure)
self.set_num_updates(self.get_num_updates() + 1)
if self._is_warmup_end():
self._warmup_sync()
elif self._is_bmuf_iter():
self._block_sync() | [
"def",
"step",
"(",
"self",
",",
"closure",
"=",
"None",
")",
":",
"self",
".",
"_optimizer",
".",
"step",
"(",
"closure",
")",
"self",
".",
"set_num_updates",
"(",
"self",
".",
"get_num_updates",
"(",
")",
"+",
"1",
")",
"if",
"self",
".",
"_is_warm... | https://github.com/microsoft/MPNet/blob/081523a788c1556f28dd90cbc629810f48b083fb/pretraining/fairseq/optim/bmuf.py#L147-L154 | ||
general03/flask-autoindex | 424246242c9f40aeb9ac2c8c63f4d2234024256e | .eggs/Jinja2-3.0.0a1-py3.7.egg/jinja2/environment.py | python | Environment.overlay | (
self,
block_start_string=missing,
block_end_string=missing,
variable_start_string=missing,
variable_end_string=missing,
comment_start_string=missing,
comment_end_string=missing,
line_statement_prefix=missing,
line_comment_prefix=missing,
... | return _environment_sanity_check(rv) | Create a new overlay environment that shares all the data with the
current environment except for cache and the overridden attributes.
Extensions cannot be removed for an overlayed environment. An overlayed
environment automatically gets all the extensions of the environment it
is linke... | Create a new overlay environment that shares all the data with the
current environment except for cache and the overridden attributes.
Extensions cannot be removed for an overlayed environment. An overlayed
environment automatically gets all the extensions of the environment it
is linke... | [
"Create",
"a",
"new",
"overlay",
"environment",
"that",
"shares",
"all",
"the",
"data",
"with",
"the",
"current",
"environment",
"except",
"for",
"cache",
"and",
"the",
"overridden",
"attributes",
".",
"Extensions",
"cannot",
"be",
"removed",
"for",
"an",
"ove... | def overlay(
self,
block_start_string=missing,
block_end_string=missing,
variable_start_string=missing,
variable_end_string=missing,
comment_start_string=missing,
comment_end_string=missing,
line_statement_prefix=missing,
line_comment_prefix=missin... | [
"def",
"overlay",
"(",
"self",
",",
"block_start_string",
"=",
"missing",
",",
"block_end_string",
"=",
"missing",
",",
"variable_start_string",
"=",
"missing",
",",
"variable_end_string",
"=",
"missing",
",",
"comment_start_string",
"=",
"missing",
",",
"comment_en... | https://github.com/general03/flask-autoindex/blob/424246242c9f40aeb9ac2c8c63f4d2234024256e/.eggs/Jinja2-3.0.0a1-py3.7.egg/jinja2/environment.py#L375-L431 | |
cronyo/cronyo | cd5abab0871b68bf31b18aac934303928130a441 | cronyo/vendor/urllib3/util/retry.py | python | Retry.is_exhausted | (self) | return min(retry_counts) < 0 | Are we out of retries? | Are we out of retries? | [
"Are",
"we",
"out",
"of",
"retries?"
] | def is_exhausted(self):
""" Are we out of retries? """
retry_counts = (self.total, self.connect, self.read, self.redirect, self.status)
retry_counts = list(filter(None, retry_counts))
if not retry_counts:
return False
return min(retry_counts) < 0 | [
"def",
"is_exhausted",
"(",
"self",
")",
":",
"retry_counts",
"=",
"(",
"self",
".",
"total",
",",
"self",
".",
"connect",
",",
"self",
".",
"read",
",",
"self",
".",
"redirect",
",",
"self",
".",
"status",
")",
"retry_counts",
"=",
"list",
"(",
"fil... | https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/urllib3/util/retry.py#L346-L353 | |
Fenixin/Minecraft-Region-Fixer | bfafd378ceb65116e4ea48cab24f1e6394051978 | regionfixer_core/util.py | python | get_str_from_traceback | (ty, value, tb) | return s | Return a string from a traceback plus exception.
Inputs:
- ty -- Exception type
- value -- value of the traceback
- tb -- Traceback | Return a string from a traceback plus exception.
Inputs:
- ty -- Exception type
- value -- value of the traceback
- tb -- Traceback | [
"Return",
"a",
"string",
"from",
"a",
"traceback",
"plus",
"exception",
".",
"Inputs",
":",
"-",
"ty",
"--",
"Exception",
"type",
"-",
"value",
"--",
"value",
"of",
"the",
"traceback",
"-",
"tb",
"--",
"Traceback"
] | def get_str_from_traceback(ty, value, tb):
""" Return a string from a traceback plus exception.
Inputs:
- ty -- Exception type
- value -- value of the traceback
- tb -- Traceback
"""
t = traceback.format_exception(ty, value, tb)
s = str(ty) + "\n"
for i in t:
s ... | [
"def",
"get_str_from_traceback",
"(",
"ty",
",",
"value",
",",
"tb",
")",
":",
"t",
"=",
"traceback",
".",
"format_exception",
"(",
"ty",
",",
"value",
",",
"tb",
")",
"s",
"=",
"str",
"(",
"ty",
")",
"+",
"\"\\n\"",
"for",
"i",
"in",
"t",
":",
"... | https://github.com/Fenixin/Minecraft-Region-Fixer/blob/bfafd378ceb65116e4ea48cab24f1e6394051978/regionfixer_core/util.py#L29-L43 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/redis/client.py | python | int_or_none | (response) | return int(response) | [] | def int_or_none(response):
if response is None:
return None
return int(response) | [
"def",
"int_or_none",
"(",
"response",
")",
":",
"if",
"response",
"is",
"None",
":",
"return",
"None",
"return",
"int",
"(",
"response",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/redis/client.py#L229-L232 | |||
gdraheim/docker-systemctl-replacement | 9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c | files/docker/systemctl.py | python | Systemctl.is_active_from | (self, conf) | return self.get_active_from(conf) == "active" | used in try-restart/other commands to check if needed. | used in try-restart/other commands to check if needed. | [
"used",
"in",
"try",
"-",
"restart",
"/",
"other",
"commands",
"to",
"check",
"if",
"needed",
"."
] | def is_active_from(self, conf):
""" used in try-restart/other commands to check if needed. """
if not conf: return False
return self.get_active_from(conf) == "active" | [
"def",
"is_active_from",
"(",
"self",
",",
"conf",
")",
":",
"if",
"not",
"conf",
":",
"return",
"False",
"return",
"self",
".",
"get_active_from",
"(",
"conf",
")",
"==",
"\"active\""
] | https://github.com/gdraheim/docker-systemctl-replacement/blob/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/files/docker/systemctl.py#L4072-L4075 | |
orestis/pysmell | 14382f377f7759a1b6505120990898dd51f175e6 | pysmell/tm_dialog.py | python | item | (val) | [] | def item(val):
if isinstance(val, basestring):
return {"title": val}
if isinstance(val, tuple):
return {"title": val[0]}
elif val is None:
return {"separator": 1} | [
"def",
"item",
"(",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"basestring",
")",
":",
"return",
"{",
"\"title\"",
":",
"val",
"}",
"if",
"isinstance",
"(",
"val",
",",
"tuple",
")",
":",
"return",
"{",
"\"title\"",
":",
"val",
"[",
"0",... | https://github.com/orestis/pysmell/blob/14382f377f7759a1b6505120990898dd51f175e6/pysmell/tm_dialog.py#L22-L28 | ||||
Map-A-Droid/MAD | 81375b5c9ccc5ca3161eb487aa81469d40ded221 | mapadroid/patcher/patch_15.py | python | Patch._execute | (self) | [] | def _execute(self):
try:
with open(self._application_args.mappings, 'rb') as fh:
settings = json.load(fh)
self.__convert_to_id(settings)
with open(self._application_args.mappings, 'w') as outfile:
json.dump(settings, outfile, indent=4, sort_key... | [
"def",
"_execute",
"(",
"self",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_application_args",
".",
"mappings",
",",
"'rb'",
")",
"as",
"fh",
":",
"settings",
"=",
"json",
".",
"load",
"(",
"fh",
")",
"self",
".",
"__convert_to_id",
"("... | https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/patcher/patch_15.py#L10-L18 | ||||
fonttools/fonttools | 892322aaff6a89bea5927379ec06bc0da3dfb7df | Lib/fontTools/ttLib/tables/otConverters.py | python | AATLookupWithDataOffset.write | (self, writer, font, tableDict, value, repeatIndex=None) | [] | def write(self, writer, font, tableDict, value, repeatIndex=None):
# We do not work with OTTableWriter sub-writers because
# the offsets in our AATLookup are relative to our data
# table, for which we need to provide an offset value itself.
# It might have been possible to somehow make a kludge for
# performi... | [
"def",
"write",
"(",
"self",
",",
"writer",
",",
"font",
",",
"tableDict",
",",
"value",
",",
"repeatIndex",
"=",
"None",
")",
":",
"# We do not work with OTTableWriter sub-writers because",
"# the offsets in our AATLookup are relative to our data",
"# table, for which we nee... | https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ttLib/tables/otConverters.py#L965-L998 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | MPNetForMaskedLM.from_pretrained | (cls, *args, **kwargs) | [] | def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["torch"]) | [
"def",
"from_pretrained",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"cls",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L3557-L3558 | ||||
lohriialo/photoshop-scripting-python | 6b97da967a5d0a45e54f7c99631b29773b923f09 | api_reference/photoshop_2020.py | python | Document.MergeVisibleLayers | (self) | return self._oleobj_.InvokeTypes(1299608418, LCID, 1, (24, 0), (),) | flatten all visible layers in the document | flatten all visible layers in the document | [
"flatten",
"all",
"visible",
"layers",
"in",
"the",
"document"
] | def MergeVisibleLayers(self):
'flatten all visible layers in the document'
return self._oleobj_.InvokeTypes(1299608418, LCID, 1, (24, 0), (),) | [
"def",
"MergeVisibleLayers",
"(",
"self",
")",
":",
"return",
"self",
".",
"_oleobj_",
".",
"InvokeTypes",
"(",
"1299608418",
",",
"LCID",
",",
"1",
",",
"(",
"24",
",",
"0",
")",
",",
"(",
")",
",",
")"
] | https://github.com/lohriialo/photoshop-scripting-python/blob/6b97da967a5d0a45e54f7c99631b29773b923f09/api_reference/photoshop_2020.py#L1628-L1630 | |
glutanimate/anki-addons-misc | 835ad28ec0927067b7acb4cd106e9b136205a838 | src/editor_field_history/editor_field_history.py | python | restoreEditorFields | (self, mode) | [] | def restoreEditorFields(self, mode):
if not self.note: # catch invalid state
return
# Gather note info
fld = self.currentField
if fld is None and mode in ("history", "field"):
# only necessary on anki20
tooltip("Please select a field whose last entry you want to restore.")
... | [
"def",
"restoreEditorFields",
"(",
"self",
",",
"mode",
")",
":",
"if",
"not",
"self",
".",
"note",
":",
"# catch invalid state",
"return",
"# Gather note info",
"fld",
"=",
"self",
".",
"currentField",
"if",
"fld",
"is",
"None",
"and",
"mode",
"in",
"(",
... | https://github.com/glutanimate/anki-addons-misc/blob/835ad28ec0927067b7acb4cd106e9b136205a838/src/editor_field_history/editor_field_history.py#L155-L191 | ||||
lazylibrarian/LazyLibrarian | ae3c14e9db9328ce81765e094ab2a14ed7155624 | lib/requests/api.py | python | request | (method, url, **kwargs) | Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
:param data: (optional) Dictionary, b... | Constructs and sends a :class:`Request <Request>`. | [
"Constructs",
"and",
"sends",
"a",
":",
"class",
":",
"Request",
"<Request",
">",
"."
] | def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`... | [
"def",
"request",
"(",
"method",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"# By using the 'with' statement we are sure the session is closed, thus we",
"# avoid leaving sockets open which can trigger a ResourceWarning in some",
"# cases, and look like a memory leak in others.",
"... | https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lib/requests/api.py#L16-L56 | ||
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mFIZ/scripts/mFIZ_extern/serial/serialutil.py | python | SerialBase.__init__ | (self,
port=None,
baudrate=9600,
bytesize=EIGHTBITS,
parity=PARITY_NONE,
stopbits=STOPBITS_ONE,
timeout=None,
xonxoff=False,
rtscts=False,
write_timeout=None,
... | \
Initialize comm port object. If a "port" is given, then the port will be
opened immediately. Otherwise a Serial port object in closed state
is returned. | \
Initialize comm port object. If a "port" is given, then the port will be
opened immediately. Otherwise a Serial port object in closed state
is returned. | [
"\\",
"Initialize",
"comm",
"port",
"object",
".",
"If",
"a",
"port",
"is",
"given",
"then",
"the",
"port",
"will",
"be",
"opened",
"immediately",
".",
"Otherwise",
"a",
"Serial",
"port",
"object",
"in",
"closed",
"state",
"is",
"returned",
"."
] | def __init__(self,
port=None,
baudrate=9600,
bytesize=EIGHTBITS,
parity=PARITY_NONE,
stopbits=STOPBITS_ONE,
timeout=None,
xonxoff=False,
rtscts=False,
write_timeout=No... | [
"def",
"__init__",
"(",
"self",
",",
"port",
"=",
"None",
",",
"baudrate",
"=",
"9600",
",",
"bytesize",
"=",
"EIGHTBITS",
",",
"parity",
"=",
"PARITY_NONE",
",",
"stopbits",
"=",
"STOPBITS_ONE",
",",
"timeout",
"=",
"None",
",",
"xonxoff",
"=",
"False",... | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mFIZ/scripts/mFIZ_extern/serial/serialutil.py#L176-L236 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/site-packages/lxml/html/diff.py | python | split_words | (text) | return words | Splits some text into words. Includes trailing whitespace (one
space) on each word when appropriate. | Splits some text into words. Includes trailing whitespace (one
space) on each word when appropriate. | [
"Splits",
"some",
"text",
"into",
"words",
".",
"Includes",
"trailing",
"whitespace",
"(",
"one",
"space",
")",
"on",
"each",
"word",
"when",
"appropriate",
"."
] | def split_words(text):
""" Splits some text into words. Includes trailing whitespace (one
space) on each word when appropriate. """
if not text or not text.strip():
return []
words = [w + ' ' for w in text.strip().split()]
if not end_whitespace_re.search(text):
words[-1] = words[-1]... | [
"def",
"split_words",
"(",
"text",
")",
":",
"if",
"not",
"text",
"or",
"not",
"text",
".",
"strip",
"(",
")",
":",
"return",
"[",
"]",
"words",
"=",
"[",
"w",
"+",
"' '",
"for",
"w",
"in",
"text",
".",
"strip",
"(",
")",
".",
"split",
"(",
"... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/site-packages/lxml/html/diff.py#L704-L712 | |
google/jax | bebe9845a873b3203f8050395255f173ba3bbb71 | jax/experimental/sparse/transform.py | python | sparsify | (f, use_tracer=False) | Experimental sparsification transform.
Examples:
Decorate JAX functions to make them compatible with :class:`jax.experimental.sparse.BCOO`
matrices:
>>> from jax.experimental import sparse
>>> @sparse.sparsify
... def f(M, v):
... return 2 * M.T @ v
>>> M = sparse.BCOO.fromdense(jnp... | Experimental sparsification transform. | [
"Experimental",
"sparsification",
"transform",
"."
] | def sparsify(f, use_tracer=False):
"""Experimental sparsification transform.
Examples:
Decorate JAX functions to make them compatible with :class:`jax.experimental.sparse.BCOO`
matrices:
>>> from jax.experimental import sparse
>>> @sparse.sparsify
... def f(M, v):
... return 2 * M.T @ ... | [
"def",
"sparsify",
"(",
"f",
",",
"use_tracer",
"=",
"False",
")",
":",
"if",
"use_tracer",
":",
"return",
"_sparsify_with_tracer",
"(",
"f",
")",
"else",
":",
"return",
"_sparsify_with_interpreter",
"(",
"f",
")"
] | https://github.com/google/jax/blob/bebe9845a873b3203f8050395255f173ba3bbb71/jax/experimental/sparse/transform.py#L358-L382 | ||
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/geomopt/geometric_solver.py | python | optimize | (method, assert_convergence=ASSERT_CONV,
include_ghost=INCLUDE_GHOST, constraints=None, callback=None,
maxsteps=100, **kwargs) | return kernel(method, assert_convergence=assert_convergence, include_ghost=include_ghost,
constraints=constraints, callback=callback, maxsteps=maxsteps, **kwargs)[1] | Optimize geometry with geomeTRIC library for the given method.
To adjust the convergence threshold, parameters can be set in kwargs as
below:
.. code-block:: python
conv_params = { # They are default settings
'convergence_energy': 1e-6, # Eh
'convergence_grms': 3e-4, #... | Optimize geometry with geomeTRIC library for the given method. | [
"Optimize",
"geometry",
"with",
"geomeTRIC",
"library",
"for",
"the",
"given",
"method",
"."
] | def optimize(method, assert_convergence=ASSERT_CONV,
include_ghost=INCLUDE_GHOST, constraints=None, callback=None,
maxsteps=100, **kwargs):
'''Optimize geometry with geomeTRIC library for the given method.
To adjust the convergence threshold, parameters can be set in kwargs as
bel... | [
"def",
"optimize",
"(",
"method",
",",
"assert_convergence",
"=",
"ASSERT_CONV",
",",
"include_ghost",
"=",
"INCLUDE_GHOST",
",",
"constraints",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"maxsteps",
"=",
"100",
",",
"*",
"*",
"kwargs",
")",
":",
"# M... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/geomopt/geometric_solver.py#L162-L183 | |
i-pan/kaggle-rsna18 | 2db498fe99615d935aa676f04847d0c562fd8e46 | models/RetinaNet/keras_retinanet/models/vgg.py | python | VGGBackbone.retinanet | (self, *args, **kwargs) | return vgg_retinanet(*args, backbone=self.backbone, **kwargs) | Returns a retinanet model using the correct backbone. | Returns a retinanet model using the correct backbone. | [
"Returns",
"a",
"retinanet",
"model",
"using",
"the",
"correct",
"backbone",
"."
] | def retinanet(self, *args, **kwargs):
""" Returns a retinanet model using the correct backbone.
"""
return vgg_retinanet(*args, backbone=self.backbone, **kwargs) | [
"def",
"retinanet",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"vgg_retinanet",
"(",
"*",
"args",
",",
"backbone",
"=",
"self",
".",
"backbone",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/i-pan/kaggle-rsna18/blob/2db498fe99615d935aa676f04847d0c562fd8e46/models/RetinaNet/keras_retinanet/models/vgg.py#L30-L33 | |
aaPanel/BaoTa | 9bb1336f31ae2893ab513af7a3efed633338c64b | class/clusterDns.py | python | aliyun.check_result | (self,req) | return result | @name 检查响应结果
@author hwliang<2020-10-30>
@param req<requests> 响应结果
@return mixed | [] | def check_result(self,req):
'''
@name 检查响应结果
@author hwliang<2020-10-30>
@param req<requests> 响应结果
@return mixed
'''
result = req.json()
if req.status_code != 200:
if result['Code'] == 'IncorrectDomainUser' or result['Code'] == ... | [
"def",
"check_result",
"(",
"self",
",",
"req",
")",
":",
"result",
"=",
"req",
".",
"json",
"(",
")",
"if",
"req",
".",
"status_code",
"!=",
"200",
":",
"if",
"result",
"[",
"'Code'",
"]",
"==",
"'IncorrectDomainUser'",
"or",
"result",
"[",
"'Code'",
... | https://github.com/aaPanel/BaoTa/blob/9bb1336f31ae2893ab513af7a3efed633338c64b/class/clusterDns.py#L125-L140 | ||
scrapy/scrapy | b04cfa48328d5d5749dca6f50fa34e0cfc664c89 | scrapy/extensions/memusage.py | python | MemoryUsage.engine_started | (self) | [] | def engine_started(self):
self.crawler.stats.set_value('memusage/startup', self.get_virtual_size())
self.tasks = []
tsk = task.LoopingCall(self.update)
self.tasks.append(tsk)
tsk.start(self.check_interval, now=True)
if self.limit:
tsk = task.LoopingCall(self._... | [
"def",
"engine_started",
"(",
"self",
")",
":",
"self",
".",
"crawler",
".",
"stats",
".",
"set_value",
"(",
"'memusage/startup'",
",",
"self",
".",
"get_virtual_size",
"(",
")",
")",
"self",
".",
"tasks",
"=",
"[",
"]",
"tsk",
"=",
"task",
".",
"Loopi... | https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/extensions/memusage.py#L54-L67 | ||||
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/ws/wstrust.py | python | participants_type__primary_from_string | (xml_string) | return saml2.create_class_from_xml_string(ParticipantsType_Primary, xml_string) | [] | def participants_type__primary_from_string(xml_string):
return saml2.create_class_from_xml_string(ParticipantsType_Primary, xml_string) | [
"def",
"participants_type__primary_from_string",
"(",
"xml_string",
")",
":",
"return",
"saml2",
".",
"create_class_from_xml_string",
"(",
"ParticipantsType_Primary",
",",
"xml_string",
")"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/ws/wstrust.py#L1456-L1457 | |||
marcosfede/algorithms | 1ee7c815f9d556c9cef4d4b0d21ee3a409d21629 | tree/binary_tree/is_symmetric/is_symmetric.py | python | _is_symmetric | (p, q) | return _is_symmetric(p.left, q.right) and _is_symmetric(p.right, q.left) | [] | def _is_symmetric(p, q):
if p is None and q is None:
return True
if p is None or q is None or q.val != p.val:
return False
return _is_symmetric(p.left, q.right) and _is_symmetric(p.right, q.left) | [
"def",
"_is_symmetric",
"(",
"p",
",",
"q",
")",
":",
"if",
"p",
"is",
"None",
"and",
"q",
"is",
"None",
":",
"return",
"True",
"if",
"p",
"is",
"None",
"or",
"q",
"is",
"None",
"or",
"q",
".",
"val",
"!=",
"p",
".",
"val",
":",
"return",
"Fa... | https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/tree/binary_tree/is_symmetric/is_symmetric.py#L7-L12 | |||
deeptools/deepTools | ac42d29c298c026aa0c53c9db2553087ebc86b97 | deeptools/plotFingerprint.py | python | getCHANCE | (args, idx, mat) | return [pcenrich, diffenrich, CHANCEdivergence] | Compute the CHANCE p-value
1) In short, sort IP from lowest to highest, cosorting input at the same time.
2) Choose the argmax of the difference of the cumsum() of the above
3) Determine a scale factor according to the ratio at the position at step 2. | Compute the CHANCE p-value | [
"Compute",
"the",
"CHANCE",
"p",
"-",
"value"
] | def getCHANCE(args, idx, mat):
"""
Compute the CHANCE p-value
1) In short, sort IP from lowest to highest, cosorting input at the same time.
2) Choose the argmax of the difference of the cumsum() of the above
3) Determine a scale factor according to the ratio at the position at step 2.
"""
... | [
"def",
"getCHANCE",
"(",
"args",
",",
"idx",
",",
"mat",
")",
":",
"# Get the index of the reference sample",
"if",
"args",
".",
"JSDsample",
"not",
"in",
"args",
".",
"bamfiles",
":",
"return",
"[",
"np",
".",
"NAN",
",",
"np",
".",
"NAN",
",",
"np",
... | https://github.com/deeptools/deepTools/blob/ac42d29c298c026aa0c53c9db2553087ebc86b97/deeptools/plotFingerprint.py#L195-L233 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/android/device_utils.py | python | DeviceUtils._ClearCache | (self) | Clears all caches. | Clears all caches. | [
"Clears",
"all",
"caches",
"."
] | def _ClearCache(self):
"""Clears all caches."""
for client in self._client_caches:
self._client_caches[client].clear()
self._cache = {
# Map of packageId -> list of on-device .apk paths
'package_apk_paths': {},
# Set of packageId that were loaded from LoadCacheData and not yet
... | [
"def",
"_ClearCache",
"(",
"self",
")",
":",
"for",
"client",
"in",
"self",
".",
"_client_caches",
":",
"self",
".",
"_client_caches",
"[",
"client",
"]",
".",
"clear",
"(",
")",
"self",
".",
"_cache",
"=",
"{",
"# Map of packageId -> list of on-device .apk pa... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/android/device_utils.py#L2725-L2746 | ||
microsoft/botbuilder-python | 3d410365461dc434df59bdfeaa2f16d28d9df868 | libraries/botbuilder-core/botbuilder/core/message_factory.py | python | MessageFactory.carousel | (
attachments: List[Attachment],
text: str = None,
speak: str = None,
input_hint: Union[InputHints, str] = None,
) | return attachment_activity(
AttachmentLayoutTypes.carousel, attachments, text, speak, input_hint
) | Returns a message that will display a set of attachments using a carousel layout.
:Example:
message = MessageFactory.carousel([CardFactory.hero_card(HeroCard(title='title1',
images=[CardImage(url='imageUrl1')],
... | Returns a message that will display a set of attachments using a carousel layout. | [
"Returns",
"a",
"message",
"that",
"will",
"display",
"a",
"set",
"of",
"attachments",
"using",
"a",
"carousel",
"layout",
"."
] | def carousel(
attachments: List[Attachment],
text: str = None,
speak: str = None,
input_hint: Union[InputHints, str] = None,
) -> Activity:
"""
Returns a message that will display a set of attachments using a carousel layout.
:Example:
message = Messa... | [
"def",
"carousel",
"(",
"attachments",
":",
"List",
"[",
"Attachment",
"]",
",",
"text",
":",
"str",
"=",
"None",
",",
"speak",
":",
"str",
"=",
"None",
",",
"input_hint",
":",
"Union",
"[",
"InputHints",
",",
"str",
"]",
"=",
"None",
",",
")",
"->... | https://github.com/microsoft/botbuilder-python/blob/3d410365461dc434df59bdfeaa2f16d28d9df868/libraries/botbuilder-core/botbuilder/core/message_factory.py#L160-L189 | |
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/file_import/__init__.py | python | FileImport.import_musicxml | (self) | Opens a MusicXML file. Converts it to ly by using musicxml2ly. | Opens a MusicXML file. Converts it to ly by using musicxml2ly. | [
"Opens",
"a",
"MusicXML",
"file",
".",
"Converts",
"it",
"to",
"ly",
"by",
"using",
"musicxml2ly",
"."
] | def import_musicxml(self):
"""Opens a MusicXML file. Converts it to ly by using musicxml2ly."""
filetypes = '{0} (*.xml *.musicxml *.mxl);;{1} (*)'.format(
_("MusicXML Files"), _("All Files"))
caption = _("dialog title", "Import a MusicXML file")
self.do_import(filetypes, cap... | [
"def",
"import_musicxml",
"(",
"self",
")",
":",
"filetypes",
"=",
"'{0} (*.xml *.musicxml *.mxl);;{1} (*)'",
".",
"format",
"(",
"_",
"(",
"\"MusicXML Files\"",
")",
",",
"_",
"(",
"\"All Files\"",
")",
")",
"caption",
"=",
"_",
"(",
"\"dialog title\"",
",",
... | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/file_import/__init__.py#L129-L134 | ||
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/vsphere.py | python | VSphereNodeDriver.find_by_uuid | (self, node_uuid) | return vm | Searches VMs for a given uuid
returns pyVmomi.VmomiSupport.vim.VirtualMachine | Searches VMs for a given uuid
returns pyVmomi.VmomiSupport.vim.VirtualMachine | [
"Searches",
"VMs",
"for",
"a",
"given",
"uuid",
"returns",
"pyVmomi",
".",
"VmomiSupport",
".",
"vim",
".",
"VirtualMachine"
] | def find_by_uuid(self, node_uuid):
"""Searches VMs for a given uuid
returns pyVmomi.VmomiSupport.vim.VirtualMachine
"""
vm = self.connection.content.searchIndex.FindByUuid(None, node_uuid, True, True)
if not vm:
# perhaps it is a moid
vm = self._get_item_b... | [
"def",
"find_by_uuid",
"(",
"self",
",",
"node_uuid",
")",
":",
"vm",
"=",
"self",
".",
"connection",
".",
"content",
".",
"searchIndex",
".",
"FindByUuid",
"(",
"None",
",",
"node_uuid",
",",
"True",
",",
"True",
")",
"if",
"not",
"vm",
":",
"# perhap... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/vsphere.py#L856-L866 | |
rosedu/wouso | 82fd175354432d29b6623c150d5d82c4fe5260de | wouso/interface/activity/models.py | python | Activity.get_player_activity | (cls, player, **kwargs) | return cls.filter_activity(query) | Return an user's activity. | Return an user's activity. | [
"Return",
"an",
"user",
"s",
"activity",
"."
] | def get_player_activity(cls, player, **kwargs):
"""
Return an user's activity.
"""
query = cls.queryset().filter(Q(user_to=player) | Q(user_from=player)).order_by('-timestamp')
return cls.filter_activity(query) | [
"def",
"get_player_activity",
"(",
"cls",
",",
"player",
",",
"*",
"*",
"kwargs",
")",
":",
"query",
"=",
"cls",
".",
"queryset",
"(",
")",
".",
"filter",
"(",
"Q",
"(",
"user_to",
"=",
"player",
")",
"|",
"Q",
"(",
"user_from",
"=",
"player",
")",... | https://github.com/rosedu/wouso/blob/82fd175354432d29b6623c150d5d82c4fe5260de/wouso/interface/activity/models.py#L78-L83 | |
aws-samples/ecs-blue-green-deployment | f319ca8a1e5c90ad48beaa67c4f6ea6fa51f2efb | scripts/deployer.py | python | find_beta_image_identifier | (targetgrouparn) | return identifier,imagesha | Queries the tags on TargetGroups
Args:
targetgrouparn - Amazon ARN of the Target group that needs to be queried for the Tags
Returns:
identifier : tag key value of the target group , with KeyName as "Identifier"
sha: Sha or the... | Queries the tags on TargetGroups | [
"Queries",
"the",
"tags",
"on",
"TargetGroups"
] | def find_beta_image_identifier(targetgrouparn):
"""Queries the tags on TargetGroups
Args:
targetgrouparn - Amazon ARN of the Target group that needs to be queried for the Tags
Returns:
identifier : tag key value of the target group , with KeyN... | [
"def",
"find_beta_image_identifier",
"(",
"targetgrouparn",
")",
":",
"response",
"=",
"elb_client",
".",
"describe_tags",
"(",
"ResourceArns",
"=",
"[",
"targetgrouparn",
"]",
")",
"identifier",
"=",
"None",
"imagesha",
"=",
"None",
"for",
"tags",
"in",
"respon... | https://github.com/aws-samples/ecs-blue-green-deployment/blob/f319ca8a1e5c90ad48beaa67c4f6ea6fa51f2efb/scripts/deployer.py#L108-L131 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | things/input/environmental/digitemp/device/termometer.py | python | OneWireTemperatureSensor._reset | (self) | Send reset pulse, wait for presence and then select the device. | Send reset pulse, wait for presence and then select the device. | [
"Send",
"reset",
"pulse",
"wait",
"for",
"presence",
"and",
"then",
"select",
"the",
"device",
"."
] | def _reset(self):
"""
Send reset pulse, wait for presence and then select the device.
"""
if self.single_mode:
self._skip_ROM() # because it is single device
else:
self._match_ROM(self.rom_code) | [
"def",
"_reset",
"(",
"self",
")",
":",
"if",
"self",
".",
"single_mode",
":",
"self",
".",
"_skip_ROM",
"(",
")",
"# because it is single device",
"else",
":",
"self",
".",
"_match_ROM",
"(",
"self",
".",
"rom_code",
")"
] | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/things/input/environmental/digitemp/device/termometer.py#L160-L167 | ||
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/scapy/contrib/gsm_um.py | python | activateAaPdpContextReject | (ProtocolConfigurationOptions_presence=0) | return packet | ACTIVATE AA PDP CONTEXT REJECT Section 9.5.12 | ACTIVATE AA PDP CONTEXT REJECT Section 9.5.12 | [
"ACTIVATE",
"AA",
"PDP",
"CONTEXT",
"REJECT",
"Section",
"9",
".",
"5",
".",
"12"
] | def activateAaPdpContextReject(ProtocolConfigurationOptions_presence=0):
"""ACTIVATE AA PDP CONTEXT REJECT Section 9.5.12"""
a = TpPd(pd=0x8)
b = MessageType(mesType=0x52) # 01010010
c = SmCause()
packet = a / b / c
if ProtocolConfigurationOptions_presence is 1:
d = ProtocolConfiguratio... | [
"def",
"activateAaPdpContextReject",
"(",
"ProtocolConfigurationOptions_presence",
"=",
"0",
")",
":",
"a",
"=",
"TpPd",
"(",
"pd",
"=",
"0x8",
")",
"b",
"=",
"MessageType",
"(",
"mesType",
"=",
"0x52",
")",
"# 01010010",
"c",
"=",
"SmCause",
"(",
")",
"pa... | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/scapy/contrib/gsm_um.py#L2777-L2786 | |
openimages/dataset | 077282972acd0ad8628f1526760ad239a38a8a97 | tools/compute_bottleneck.py | python | main | (args) | [] | def main(args):
if not os.path.exists(FLAGS.checkpoint):
tf.logging.fatal(
'Checkpoint %s does not exist. Have you download it? See tools/download_data.sh',
FLAGS.checkpoint)
g = tf.Graph()
with g.as_default():
input_image = PreprocessImage(FLAGS.image_path[0])
with slim.arg_scope(inc... | [
"def",
"main",
"(",
"args",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"FLAGS",
".",
"checkpoint",
")",
":",
"tf",
".",
"logging",
".",
"fatal",
"(",
"'Checkpoint %s does not exist. Have you download it? See tools/download_data.sh'",
",",
"FLA... | https://github.com/openimages/dataset/blob/077282972acd0ad8628f1526760ad239a38a8a97/tools/compute_bottleneck.py#L76-L106 | ||||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | lts/ctp/__init__.py | python | TraderApi.ReqQryTradingAccount | (self, pQryTradingAccount, nRequestID) | return 0 | 请求查询资金账户 | 请求查询资金账户 | [
"请求查询资金账户"
] | def ReqQryTradingAccount(self, pQryTradingAccount, nRequestID):
"""请求查询资金账户"""
return 0 | [
"def",
"ReqQryTradingAccount",
"(",
"self",
",",
"pQryTradingAccount",
",",
"nRequestID",
")",
":",
"return",
"0"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/lts/ctp/__init__.py#L208-L210 | |
ask/carrot | 5889a25cd2e274642071c9bba39772f4b3e3d9da | carrot/connection.py | python | BrokerConnection.info | (self) | return {"hostname": self.hostname,
"userid": self.userid,
"password": self.password,
"virtual_host": self.virtual_host,
"port": port,
"insist": self.insist,
"ssl": self.ssl,
"transport_cls": backend_cls,
... | Get connection info. | Get connection info. | [
"Get",
"connection",
"info",
"."
] | def info(self):
"""Get connection info."""
backend_cls = self.backend_cls or "amqplib"
port = self.port or self.create_backend().default_port
return {"hostname": self.hostname,
"userid": self.userid,
"password": self.password,
"virtual_host... | [
"def",
"info",
"(",
"self",
")",
":",
"backend_cls",
"=",
"self",
".",
"backend_cls",
"or",
"\"amqplib\"",
"port",
"=",
"self",
".",
"port",
"or",
"self",
".",
"create_backend",
"(",
")",
".",
"default_port",
"return",
"{",
"\"hostname\"",
":",
"self",
"... | https://github.com/ask/carrot/blob/5889a25cd2e274642071c9bba39772f4b3e3d9da/carrot/connection.py#L223-L236 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/views/treemodels/treebasemodel.py | python | TreeBaseModel.__rebuild_filter | (self, dfilter, skip, items, gen_cursor, data_map,
add_func) | Rebuild the data map for a single Gramps object type, where a filter
is applied. | Rebuild the data map for a single Gramps object type, where a filter
is applied. | [
"Rebuild",
"the",
"data",
"map",
"for",
"a",
"single",
"Gramps",
"object",
"type",
"where",
"a",
"filter",
"is",
"applied",
"."
] | def __rebuild_filter(self, dfilter, skip, items, gen_cursor, data_map,
add_func):
"""
Rebuild the data map for a single Gramps object type, where a filter
is applied.
"""
pmon = progressdlg.ProgressMonitor(
progressdlg.StatusProgress, (self.ui... | [
"def",
"__rebuild_filter",
"(",
"self",
",",
"dfilter",
",",
"skip",
",",
"items",
",",
"gen_cursor",
",",
"data_map",
",",
"add_func",
")",
":",
"pmon",
"=",
"progressdlg",
".",
"ProgressMonitor",
"(",
"progressdlg",
".",
"StatusProgress",
",",
"(",
"self",... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/views/treemodels/treebasemodel.py#L572-L603 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/galgebra/ncutil.py | python | get_commutative_coef | (expr) | return S.One | [] | def get_commutative_coef(expr):
if isinstance(expr, Mul):
(coefs, bases) = expr.args_cnc()
return Mul(*coefs)
return S.One | [
"def",
"get_commutative_coef",
"(",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"Mul",
")",
":",
"(",
"coefs",
",",
"bases",
")",
"=",
"expr",
".",
"args_cnc",
"(",
")",
"return",
"Mul",
"(",
"*",
"coefs",
")",
"return",
"S",
".",
"One"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/galgebra/ncutil.py#L24-L28 | |||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py | python | Page.__init__ | (self, data, url) | Initialise an instance with the Unicode page contents and the URL they
came from. | Initialise an instance with the Unicode page contents and the URL they
came from. | [
"Initialise",
"an",
"instance",
"with",
"the",
"Unicode",
"page",
"contents",
"and",
"the",
"URL",
"they",
"came",
"from",
"."
] | def __init__(self, data, url):
"""
Initialise an instance with the Unicode page contents and the URL they
came from.
"""
self.data = data
self.base_url = self.url = url
m = self._base.search(self.data)
if m:
self.base_url = m.group(1) | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"url",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"base_url",
"=",
"self",
".",
"url",
"=",
"url",
"m",
"=",
"self",
".",
"_base",
".",
"search",
"(",
"self",
".",
"data",
")",
"if... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py#L461-L470 | ||
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/base_node.py | python | BaseNode.reset | (cls) | Reset the instance count. | Reset the instance count. | [
"Reset",
"the",
"instance",
"count",
"."
] | def reset(cls):
"""
Reset the instance count.
"""
cls._instance_count = 1 | [
"def",
"reset",
"(",
"cls",
")",
":",
"cls",
".",
"_instance_count",
"=",
"1"
] | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/base_node.py#L125-L130 | ||
python-trio/trio | 4edfd41bd5519a2e626e87f6c6ca9fb32b90a6f4 | trio/_core/_traps.py | python | cancel_shielded_checkpoint | () | return (await _async_yield(CancelShieldedCheckpoint)).unwrap() | Introduce a schedule point, but not a cancel point.
This is *not* a :ref:`checkpoint <checkpoints>`, but it is half of a
checkpoint, and when combined with :func:`checkpoint_if_cancelled` it can
make a full checkpoint.
Equivalent to (but potentially more efficient than)::
with trio.CancelScop... | Introduce a schedule point, but not a cancel point. | [
"Introduce",
"a",
"schedule",
"point",
"but",
"not",
"a",
"cancel",
"point",
"."
] | async def cancel_shielded_checkpoint():
"""Introduce a schedule point, but not a cancel point.
This is *not* a :ref:`checkpoint <checkpoints>`, but it is half of a
checkpoint, and when combined with :func:`checkpoint_if_cancelled` it can
make a full checkpoint.
Equivalent to (but potentially more ... | [
"async",
"def",
"cancel_shielded_checkpoint",
"(",
")",
":",
"return",
"(",
"await",
"_async_yield",
"(",
"CancelShieldedCheckpoint",
")",
")",
".",
"unwrap",
"(",
")"
] | https://github.com/python-trio/trio/blob/4edfd41bd5519a2e626e87f6c6ca9fb32b90a6f4/trio/_core/_traps.py#L30-L43 | |
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | video/video_node.py | python | VideoNode.frameCount | (self) | Returns the number of times you can call nextFrame before it starts returning None. | Returns the number of times you can call nextFrame before it starts returning None. | [
"Returns",
"the",
"number",
"of",
"times",
"you",
"can",
"call",
"nextFrame",
"before",
"it",
"starts",
"returning",
"None",
"."
] | def frameCount(self):
"""Returns the number of times you can call nextFrame before it starts returning None."""
raise Exception('frameCount not implimented') | [
"def",
"frameCount",
"(",
"self",
")",
":",
"raise",
"Exception",
"(",
"'frameCount not implimented'",
")"
] | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/video/video_node.py#L46-L48 | ||
mrlesmithjr/Ansible | d44f0dc0d942bdf3bf7334b307e6048f0ee16e36 | roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/index.py | python | HTMLPage.links | (self) | Yields all links in the page | Yields all links in the page | [
"Yields",
"all",
"links",
"in",
"the",
"page"
] | def links(self):
"""Yields all links in the page"""
for anchor in self.parsed.findall(".//a"):
if anchor.get("href"):
href = anchor.get("href")
url = self.clean_link(
urllib_parse.urljoin(self.base_url, href)
)
... | [
"def",
"links",
"(",
"self",
")",
":",
"for",
"anchor",
"in",
"self",
".",
"parsed",
".",
"findall",
"(",
"\".//a\"",
")",
":",
"if",
"anchor",
".",
"get",
"(",
"\"href\"",
")",
":",
"href",
"=",
"anchor",
".",
"get",
"(",
"\"href\"",
")",
"url",
... | https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/index.py#L858-L868 | ||
karanchahal/distiller | a17ec06cbeafcdd2aea19d7c7663033c951392f5 | models/cifar10/shufflenet.py | python | ShuffleNetG3 | () | return ShuffleNet(cfg) | [] | def ShuffleNetG3():
cfg = {
'out_planes': [240,480,960],
'num_blocks': [4,8,4],
'groups': 3
}
return ShuffleNet(cfg) | [
"def",
"ShuffleNetG3",
"(",
")",
":",
"cfg",
"=",
"{",
"'out_planes'",
":",
"[",
"240",
",",
"480",
",",
"960",
"]",
",",
"'num_blocks'",
":",
"[",
"4",
",",
"8",
",",
"4",
"]",
",",
"'groups'",
":",
"3",
"}",
"return",
"ShuffleNet",
"(",
"cfg",
... | https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/models/cifar10/shufflenet.py#L94-L100 | |||
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/released/build/build_client.py | python | BuildClient.add_build_tags | (self, tags, project, build_id) | return self._deserialize('[str]', self._unwrap_collection(response)) | AddBuildTags.
Adds tags to a build.
:param [str] tags: The tags to add.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: [str] | AddBuildTags.
Adds tags to a build.
:param [str] tags: The tags to add.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: [str] | [
"AddBuildTags",
".",
"Adds",
"tags",
"to",
"a",
"build",
".",
":",
"param",
"[",
"str",
"]",
"tags",
":",
"The",
"tags",
"to",
"add",
".",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"param",
"int",
"build_id",... | def add_build_tags(self, tags, project, build_id):
"""AddBuildTags.
Adds tags to a build.
:param [str] tags: The tags to add.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: [str]
"""
route_values = {}
... | [
"def",
"add_build_tags",
"(",
"self",
",",
"tags",
",",
"project",
",",
"build_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
".",
"url",
"... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/released/build/build_client.py#L868-L887 | |
open-io/oio-sds | 16041950b6056a55d5ce7ca77795defe6dfa6c61 | oio/directory/client.py | python | DirectoryClient.unlink | (self, account=None, reference=None, service_type=None, cid=None,
**kwargs) | Remove an associated service from the reference | Remove an associated service from the reference | [
"Remove",
"an",
"associated",
"service",
"from",
"the",
"reference"
] | def unlink(self, account=None, reference=None, service_type=None, cid=None,
**kwargs):
"""
Remove an associated service from the reference
"""
params = self._make_params(account, reference, service_type, cid=cid)
_resp, _body = self._request('POST', '/unlink', para... | [
"def",
"unlink",
"(",
"self",
",",
"account",
"=",
"None",
",",
"reference",
"=",
"None",
",",
"service_type",
"=",
"None",
",",
"cid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"self",
".",
"_make_params",
"(",
"account",
",",
... | https://github.com/open-io/oio-sds/blob/16041950b6056a55d5ce7ca77795defe6dfa6c61/oio/directory/client.py#L147-L154 | ||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/preferences/widgets.py | python | CheckConditional.on_check_condition | (self) | return self.get_condition_value() | Specifies the condition to meet
:returns: Whether the condition is met or not
:rtype: bool | Specifies the condition to meet | [
"Specifies",
"the",
"condition",
"to",
"meet"
] | def on_check_condition(self):
"""
Specifies the condition to meet
:returns: Whether the condition is met or not
:rtype: bool
"""
return self.get_condition_value() | [
"def",
"on_check_condition",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_condition_value",
"(",
")"
] | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/preferences/widgets.py#L237-L244 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/asset_field_type_view_service/client.py | python | AssetFieldTypeViewServiceClient.from_service_account_file | (cls, filename: str, *args, **kwargs) | return cls(*args, **kwargs) | Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the con... | Creates an instance of this client using the provided credentials
file. | [
"Creates",
"an",
"instance",
"of",
"this",
"client",
"using",
"the",
"provided",
"credentials",
"file",
"."
] | def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass ... | [
"def",
"from_service_account_file",
"(",
"cls",
",",
"filename",
":",
"str",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"credentials",
"=",
"service_account",
".",
"Credentials",
".",
"from_service_account_file",
"(",
"filename",
")",
"kwargs",
"[",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/asset_field_type_view_service/client.py#L136-L153 | |
okpy/ok | 50a00190f05363d096478dd8e53aa1a36dd40c4a | migrations/env.py | python | run_migrations_offline | () | Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output. | Run migrations in 'offline' mode. | [
"Run",
"migrations",
"in",
"offline",
"mode",
"."
] | def run_migrations_offline():
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the g... | [
"def",
"run_migrations_offline",
"(",
")",
":",
"url",
"=",
"config",
".",
"get_main_option",
"(",
"\"sqlalchemy.url\"",
")",
"context",
".",
"configure",
"(",
"url",
"=",
"url",
")",
"with",
"context",
".",
"begin_transaction",
"(",
")",
":",
"context",
"."... | https://github.com/okpy/ok/blob/50a00190f05363d096478dd8e53aa1a36dd40c4a/migrations/env.py#L34-L50 | ||
Delta-ML/delta | 31dfebc8f20b7cb282b62f291ff25a87e403cc86 | delta/data/feat/speech_feature.py | python | extract_fbank | (samples,
sr=8000,
winlen=0.025,
winstep=0.01,
feature_size=40) | return np.stack([feat, delta, _delta_delta], axis=-1) | extract logfbank with delta and delta-delta
Return:
ndarray of shape [nfrmae, feature_size * 3] | extract logfbank with delta and delta-delta
Return:
ndarray of shape [nfrmae, feature_size * 3] | [
"extract",
"logfbank",
"with",
"delta",
"and",
"delta",
"-",
"delta",
"Return",
":",
"ndarray",
"of",
"shape",
"[",
"nfrmae",
"feature_size",
"*",
"3",
"]"
] | def extract_fbank(samples,
sr=8000,
winlen=0.025,
winstep=0.01,
feature_size=40):
''' extract logfbank with delta and delta-delta
Return:
ndarray of shape [nfrmae, feature_size * 3]
'''
feat = psf.logfbank(
samples,
nfilt=... | [
"def",
"extract_fbank",
"(",
"samples",
",",
"sr",
"=",
"8000",
",",
"winlen",
"=",
"0.025",
",",
"winstep",
"=",
"0.01",
",",
"feature_size",
"=",
"40",
")",
":",
"feat",
"=",
"psf",
".",
"logfbank",
"(",
"samples",
",",
"nfilt",
"=",
"feature_size",
... | https://github.com/Delta-ML/delta/blob/31dfebc8f20b7cb282b62f291ff25a87e403cc86/delta/data/feat/speech_feature.py#L196-L216 | |
john-hewitt/structural-probes | 4c2e265d6bd071e6ab380fd9806e4c6a128b5e97 | structural-probes/probe.py | python | OneWordPSDProbe.forward | (self, batch) | return norms | Computes all n depths after projection
for each sentence in a batch.
Computes (Bh_i)^T(Bh_i) for all i
Args:
batch: a batch of word representations of the shape
(batch_size, max_seq_len, representation_dim)
Returns:
A tensor of depths of shape (batch_size, max_seq_len) | Computes all n depths after projection
for each sentence in a batch. | [
"Computes",
"all",
"n",
"depths",
"after",
"projection",
"for",
"each",
"sentence",
"in",
"a",
"batch",
"."
] | def forward(self, batch):
""" Computes all n depths after projection
for each sentence in a batch.
Computes (Bh_i)^T(Bh_i) for all i
Args:
batch: a batch of word representations of the shape
(batch_size, max_seq_len, representation_dim)
Returns:
A tensor of depths of shape (bat... | [
"def",
"forward",
"(",
"self",
",",
"batch",
")",
":",
"transformed",
"=",
"torch",
".",
"matmul",
"(",
"batch",
",",
"self",
".",
"proj",
")",
"batchlen",
",",
"seqlen",
",",
"rank",
"=",
"transformed",
".",
"size",
"(",
")",
"norms",
"=",
"torch",
... | https://github.com/john-hewitt/structural-probes/blob/4c2e265d6bd071e6ab380fd9806e4c6a128b5e97/structural-probes/probe.py#L63-L80 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pandas/stats/ols.py | python | OLS.rmse | (self) | return self._rmse_raw | Returns the rmse value. | Returns the rmse value. | [
"Returns",
"the",
"rmse",
"value",
"."
] | def rmse(self):
"""Returns the rmse value."""
return self._rmse_raw | [
"def",
"rmse",
"(",
"self",
")",
":",
"return",
"self",
".",
"_rmse_raw"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/stats/ols.py#L329-L331 | |
kylebebak/Requester | 4a9f9f051fa5fc951a8f7ad098a328261ca2db97 | deps/oauthlib/oauth2/rfc6749/utils.py | python | list_to_scope | (scope) | Convert a list of scopes to a space separated string. | Convert a list of scopes to a space separated string. | [
"Convert",
"a",
"list",
"of",
"scopes",
"to",
"a",
"space",
"separated",
"string",
"."
] | def list_to_scope(scope):
"""Convert a list of scopes to a space separated string."""
if isinstance(scope, unicode_type) or scope is None:
return scope
elif isinstance(scope, (set, tuple, list)):
return " ".join([unicode_type(s) for s in scope])
else:
raise ValueError("Invalid sc... | [
"def",
"list_to_scope",
"(",
"scope",
")",
":",
"if",
"isinstance",
"(",
"scope",
",",
"unicode_type",
")",
"or",
"scope",
"is",
"None",
":",
"return",
"scope",
"elif",
"isinstance",
"(",
"scope",
",",
"(",
"set",
",",
"tuple",
",",
"list",
")",
")",
... | https://github.com/kylebebak/Requester/blob/4a9f9f051fa5fc951a8f7ad098a328261ca2db97/deps/oauthlib/oauth2/rfc6749/utils.py#L25-L32 | ||
aliyun/aliyun-openapi-python-sdk | bda53176cc9cf07605b1cf769f0df444cca626a0 | aliyun-python-sdk-core-v3/aliyunsdkcore/vendored/requests/utils.py | python | guess_filename | (obj) | Tries to guess the filename of the given object. | Tries to guess the filename of the given object. | [
"Tries",
"to",
"guess",
"the",
"filename",
"of",
"the",
"given",
"object",
"."
] | def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if (name and isinstance(name, basestring) and name[0] != '<' and
name[-1] != '>'):
return os.path.basename(name) | [
"def",
"guess_filename",
"(",
"obj",
")",
":",
"name",
"=",
"getattr",
"(",
"obj",
",",
"'name'",
",",
"None",
")",
"if",
"(",
"name",
"and",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"and",
"name",
"[",
"0",
"]",
"!=",
"'<'",
"and",
"name... | https://github.com/aliyun/aliyun-openapi-python-sdk/blob/bda53176cc9cf07605b1cf769f0df444cca626a0/aliyun-python-sdk-core-v3/aliyunsdkcore/vendored/requests/utils.py#L210-L215 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/setuptools/extern/__init__.py | python | VendorImporter.search_path | (self) | Search first the vendor package then as a natural package. | Search first the vendor package then as a natural package. | [
"Search",
"first",
"the",
"vendor",
"package",
"then",
"as",
"a",
"natural",
"package",
"."
] | def search_path(self):
"""
Search first the vendor package then as a natural package.
"""
yield self.vendor_pkg + '.'
yield '' | [
"def",
"search_path",
"(",
"self",
")",
":",
"yield",
"self",
".",
"vendor_pkg",
"+",
"'.'",
"yield",
"''"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/setuptools/extern/__init__.py#L16-L21 | ||
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/viz/topo.py | python | _erfimage_imshow_unified | (bn, ch_idx, tmin, tmax, vmin, vmax, ylim=None,
data=None, epochs=None, sigma=None, order=None,
scalings=None, vline=None, x_label=None,
y_label=None, colorbar=False, cmap='RdBu_r',
vlim_array=None) | Plot erfimage topography using a single axis. | Plot erfimage topography using a single axis. | [
"Plot",
"erfimage",
"topography",
"using",
"a",
"single",
"axis",
"."
] | def _erfimage_imshow_unified(bn, ch_idx, tmin, tmax, vmin, vmax, ylim=None,
data=None, epochs=None, sigma=None, order=None,
scalings=None, vline=None, x_label=None,
y_label=None, colorbar=False, cmap='RdBu_r',
... | [
"def",
"_erfimage_imshow_unified",
"(",
"bn",
",",
"ch_idx",
",",
"tmin",
",",
"tmax",
",",
"vmin",
",",
"vmax",
",",
"ylim",
"=",
"None",
",",
"data",
"=",
"None",
",",
"epochs",
"=",
"None",
",",
"sigma",
"=",
"None",
",",
"order",
"=",
"None",
"... | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/viz/topo.py#L542-L569 | ||
jaychsu/algorithm | 87dac5456b74a515dd97507ac68e9b8588066a04 | other/uneven_random_get.py | python | uneven_random_get | (options, rate) | return options[0] | unevenly fetch the option according to the corresponding rate
:type options: list[str]
:type rate: list[num]
:rtype: str | unevenly fetch the option according to the corresponding rate
:type options: list[str]
:type rate: list[num]
:rtype: str | [
"unevenly",
"fetch",
"the",
"option",
"according",
"to",
"the",
"corresponding",
"rate",
":",
"type",
"options",
":",
"list",
"[",
"str",
"]",
":",
"type",
"rate",
":",
"list",
"[",
"num",
"]",
":",
"rtype",
":",
"str"
] | def uneven_random_get(options, rate):
"""unevenly fetch the option according to the corresponding rate
:type options: list[str]
:type rate: list[num]
:rtype: str
"""
if not options or not rate or len(options) != len(rate):
return ''
num = 0
rand = random.randint(1, sum(rate))
... | [
"def",
"uneven_random_get",
"(",
"options",
",",
"rate",
")",
":",
"if",
"not",
"options",
"or",
"not",
"rate",
"or",
"len",
"(",
"options",
")",
"!=",
"len",
"(",
"rate",
")",
":",
"return",
"''",
"num",
"=",
"0",
"rand",
"=",
"random",
".",
"rand... | https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/other/uneven_random_get.py#L8-L26 | |
DLR-RM/stable-baselines3 | e9a8979022d7005560d43b7a9c1dc1ba85f7989a | stable_baselines3/common/vec_env/vec_normalize.py | python | VecNormalize.__getstate__ | (self) | return state | Gets state for pickling.
Excludes self.venv, as in general VecEnv's may not be pickleable. | Gets state for pickling. | [
"Gets",
"state",
"for",
"pickling",
"."
] | def __getstate__(self) -> Dict[str, Any]:
"""
Gets state for pickling.
Excludes self.venv, as in general VecEnv's may not be pickleable."""
state = self.__dict__.copy()
# these attributes are not pickleable
del state["venv"]
del state["class_attributes"]
... | [
"def",
"__getstate__",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"state",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"# these attributes are not pickleable",
"del",
"state",
"[",
"\"venv\"",
"]",
"del",
"state",
"[",
"\"... | https://github.com/DLR-RM/stable-baselines3/blob/e9a8979022d7005560d43b7a9c1dc1ba85f7989a/stable_baselines3/common/vec_env/vec_normalize.py#L99-L110 | |
DamnWidget/anaconda | a9998fb362320f907d5ccbc6fcf5b62baca677c0 | anaconda_lib/helpers.py | python | valid_languages | (**kwargs) | return ['python'] + languages | Return back valid languages for anaconda plugins | Return back valid languages for anaconda plugins | [
"Return",
"back",
"valid",
"languages",
"for",
"anaconda",
"plugins"
] | def valid_languages(**kwargs):
"""Return back valid languages for anaconda plugins
"""
path = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
languages = [
f.rsplit('_', 1)[1].lower() for f in os.listdir(path)
if f.startswith('anaconda_') and 'vagrant' not in f
]
... | [
"def",
"valid_languages",
"(",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"os",
".",
"pardir",
",",
"os",
".",
"pardir",
")",
"languages",
"=",
"["... | https://github.com/DamnWidget/anaconda/blob/a9998fb362320f907d5ccbc6fcf5b62baca677c0/anaconda_lib/helpers.py#L421-L431 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/mailbox.py | python | _singlefileMailbox.flush | (self) | Write any pending changes to disk. | Write any pending changes to disk. | [
"Write",
"any",
"pending",
"changes",
"to",
"disk",
"."
] | def flush(self):
"""Write any pending changes to disk."""
if not self._pending:
if self._pending_sync:
# Messages have only been added, so syncing the file
# is enough.
_sync_flush(self._file)
self._pending_sync = False
... | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_pending",
":",
"if",
"self",
".",
"_pending_sync",
":",
"# Messages have only been added, so syncing the file",
"# is enough.",
"_sync_flush",
"(",
"self",
".",
"_file",
")",
"self",
".",
"_pendi... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/mailbox.py#L640-L706 | ||
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/lineage_entity.py | python | LineageEntity.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/lineage_entity.py#L104-L108 | |
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/propertyparse.py | python | _property_type | (value_str) | Gets property type from value string by trying to interpret it
as int or float, if both fail it is considered an expression. | Gets property type from value string by trying to interpret it
as int or float, if both fail it is considered an expression. | [
"Gets",
"property",
"type",
"from",
"value",
"string",
"by",
"trying",
"to",
"interpret",
"it",
"as",
"int",
"or",
"float",
"if",
"both",
"fail",
"it",
"is",
"considered",
"an",
"expression",
"."
] | def _property_type(value_str):
"""
Gets property type from value string by trying to interpret it
as int or float, if both fail it is considered an expression.
"""
try:
int(value_str)
return PROP_INT
except:
try:
float(value_str)
return PROP_FLOAT... | [
"def",
"_property_type",
"(",
"value_str",
")",
":",
"try",
":",
"int",
"(",
"value_str",
")",
"return",
"PROP_INT",
"except",
":",
"try",
":",
"float",
"(",
"value_str",
")",
"return",
"PROP_FLOAT",
"except",
":",
"return",
"PROP_EXPRESSION"
] | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/propertyparse.py#L554-L567 | ||
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractSnowbelldotWordpressCom.py | python | extractSnowbelldotWordpressCom | (item) | return False | Parser for 'snowbelldot.wordpress.com' | Parser for 'snowbelldot.wordpress.com' | [
"Parser",
"for",
"snowbelldot",
".",
"wordpress",
".",
"com"
] | def extractSnowbelldotWordpressCom(item):
'''
Parser for 'snowbelldot.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Cold King, the Doctor Fei Is Running Away', 'Cold King,... | [
"def",
"extractSnowbelldotWordpressCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractSnowbelldotWordpressCom.py#L1-L21 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/asyncio/protocols.py | python | BaseProtocol.connection_made | (self, transport) | Called when a connection is made.
The argument is the transport representing the pipe connection.
To receive data, wait for data_received() calls.
When the connection is closed, connection_lost() is called. | Called when a connection is made. | [
"Called",
"when",
"a",
"connection",
"is",
"made",
"."
] | def connection_made(self, transport):
"""Called when a connection is made.
The argument is the transport representing the pipe connection.
To receive data, wait for data_received() calls.
When the connection is closed, connection_lost() is called.
""" | [
"def",
"connection_made",
"(",
"self",
",",
"transport",
")",
":"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/asyncio/protocols.py#L19-L25 | ||
chenjun2hao/CenterFace.pytorch | 37a351be07606136561bc56eae716f8575b61e00 | src/tools/voc_eval_lib/datasets/voc_eval.py | python | voc_eval | (detpath,
annopath,
imagesetfile,
classname,
cachedir,
ovthresh=0.5,
use_07_metric=False,
use_diff=False) | return rec, prec, ap | rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
[ovthresh],
[use_07_metric])
Top level function that does the PASCAL VOC evaluation.
detpath: P... | rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
[ovthresh],
[use_07_metric]) | [
"rec",
"prec",
"ap",
"=",
"voc_eval",
"(",
"detpath",
"annopath",
"imagesetfile",
"classname",
"[",
"ovthresh",
"]",
"[",
"use_07_metric",
"]",
")"
] | def voc_eval(detpath,
annopath,
imagesetfile,
classname,
cachedir,
ovthresh=0.5,
use_07_metric=False,
use_diff=False):
"""rec, prec, ap = voc_eval(detpath,
annopath,
i... | [
"def",
"voc_eval",
"(",
"detpath",
",",
"annopath",
",",
"imagesetfile",
",",
"classname",
",",
"cachedir",
",",
"ovthresh",
"=",
"0.5",
",",
"use_07_metric",
"=",
"False",
",",
"use_diff",
"=",
"False",
")",
":",
"# assumes detections are in detpath.format(classn... | https://github.com/chenjun2hao/CenterFace.pytorch/blob/37a351be07606136561bc56eae716f8575b61e00/src/tools/voc_eval_lib/datasets/voc_eval.py#L70-L215 | |
iclavera/learning_to_adapt | bd7d99ba402521c96631e7d09714128f549db0f1 | learning_to_adapt/mujoco_py/mjtypes.py | python | MjModelWrapper.light_diffuse | (self, value) | [] | def light_diffuse(self, value):
val_ptr = np.array(value, dtype=np.float64).ctypes.data_as(POINTER(c_float))
memmove(self._wrapped.contents.light_diffuse, val_ptr, self.nlight*3 * sizeof(c_float)) | [
"def",
"light_diffuse",
"(",
"self",
",",
"value",
")",
":",
"val_ptr",
"=",
"np",
".",
"array",
"(",
"value",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
".",
"ctypes",
".",
"data_as",
"(",
"POINTER",
"(",
"c_float",
")",
")",
"memmove",
"(",
"s... | https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L4794-L4796 | ||||
codepr/creak | 52b0d74c3f77dad45e97dd7aa22976b83a0d3676 | creak.py | python | get_mitm | (parsed_args) | return (args, changed, original_mac_addr,
cmitm.PcapMitm(dev, utils.parse_mac(mac_addr), args.source,
args.target, debug, verbose)) | create an object of type Mitm based on arguments received | create an object of type Mitm based on arguments received | [
"create",
"an",
"object",
"of",
"type",
"Mitm",
"based",
"on",
"arguments",
"received"
] | def get_mitm(parsed_args):
"""
create an object of type Mitm based on arguments received
"""
args = parsed_args
if not args.dev:
sys.exit(sys.argv[0] + ' -h for help\n[!] Must specify interface')
dev = "%s" % "','".join(args.dev)
original_mac_addr = utils.get_mac_by_dev(dev)
m... | [
"def",
"get_mitm",
"(",
"parsed_args",
")",
":",
"args",
"=",
"parsed_args",
"if",
"not",
"args",
".",
"dev",
":",
"sys",
".",
"exit",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
"+",
"' -h for help\\n[!] Must specify interface'",
")",
"dev",
"=",
"\"%s\"",
... | https://github.com/codepr/creak/blob/52b0d74c3f77dad45e97dd7aa22976b83a0d3676/creak.py#L96-L177 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/analyses/vtable.py | python | VtableFinder.is_cross_referenced | (self, addr) | return addr in self.project.kb.xrefs.xrefs_by_dst | [] | def is_cross_referenced(self, addr):
return addr in self.project.kb.xrefs.xrefs_by_dst | [
"def",
"is_cross_referenced",
"(",
"self",
",",
"addr",
")",
":",
"return",
"addr",
"in",
"self",
".",
"project",
".",
"kb",
".",
"xrefs",
".",
"xrefs_by_dst"
] | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/vtable.py#L42-L43 | |||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/db/backends/base/operations.py | python | BaseDatabaseOperations.max_name_length | (self) | return None | Return the maximum length of table and column names, or None if there
is no limit. | Return the maximum length of table and column names, or None if there
is no limit. | [
"Return",
"the",
"maximum",
"length",
"of",
"table",
"and",
"column",
"names",
"or",
"None",
"if",
"there",
"is",
"no",
"limit",
"."
] | def max_name_length(self):
"""
Return the maximum length of table and column names, or None if there
is no limit.
"""
return None | [
"def",
"max_name_length",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/db/backends/base/operations.py#L272-L277 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python3-alpha/python-libs/pyxmpp2/ext/vcard.py | python | VCardName.as_xml | (self,parent) | return n | Create vcard-tmp XML representation of the field.
:Parameters:
- `parent`: parent node for the element
:Types:
- `parent`: `libxml2.xmlNode`
:return: xml node with the field data.
:returntype: `libxml2.xmlNode` | Create vcard-tmp XML representation of the field. | [
"Create",
"vcard",
"-",
"tmp",
"XML",
"representation",
"of",
"the",
"field",
"."
] | def as_xml(self,parent):
"""Create vcard-tmp XML representation of the field.
:Parameters:
- `parent`: parent node for the element
:Types:
- `parent`: `libxml2.xmlNode`
:return: xml node with the field data.
:returntype: `libxml2.xmlNode`"""
n=pa... | [
"def",
"as_xml",
"(",
"self",
",",
"parent",
")",
":",
"n",
"=",
"parent",
".",
"newChild",
"(",
"None",
",",
"\"N\"",
",",
"None",
")",
"n",
".",
"newTextChild",
"(",
"None",
",",
"\"FAMILY\"",
",",
"to_utf8",
"(",
"self",
".",
"family",
")",
")",... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/pyxmpp2/ext/vcard.py#L323-L339 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/modular/hecke/module.py | python | HeckeModule_free_module._repr_ | (self) | return repr(type(self)) | r"""
EXAMPLES::
sage: M = sage.modular.hecke.module.HeckeModule_free_module(QQ, 12, -4); M
<class 'sage.modular.hecke.module.HeckeModule_free_module_with_category'>
.. TODO::
Implement a nicer repr, or implement the methods required
by :class:`ModulesW... | r""" | [
"r"
] | def _repr_(self):
r"""
EXAMPLES::
sage: M = sage.modular.hecke.module.HeckeModule_free_module(QQ, 12, -4); M
<class 'sage.modular.hecke.module.HeckeModule_free_module_with_category'>
.. TODO::
Implement a nicer repr, or implement the methods required
... | [
"def",
"_repr_",
"(",
"self",
")",
":",
"return",
"repr",
"(",
"type",
"(",
"self",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/hecke/module.py#L512-L526 | |
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/random.py | python | Random.jumpahead | (self, n) | Change the internal state to one that is likely far away
from the current state. This method will not be in Py3.x,
so it is better to simply reseed. | Change the internal state to one that is likely far away
from the current state. This method will not be in Py3.x,
so it is better to simply reseed. | [
"Change",
"the",
"internal",
"state",
"to",
"one",
"that",
"is",
"likely",
"far",
"away",
"from",
"the",
"current",
"state",
".",
"This",
"method",
"will",
"not",
"be",
"in",
"Py3",
".",
"x",
"so",
"it",
"is",
"better",
"to",
"simply",
"reseed",
"."
] | def jumpahead(self, n):
"""Change the internal state to one that is likely far away
from the current state. This method will not be in Py3.x,
so it is better to simply reseed.
"""
# The super.jumpahead() method uses shuffling to change state,
# so it needs a large and "i... | [
"def",
"jumpahead",
"(",
"self",
",",
"n",
")",
":",
"# The super.jumpahead() method uses shuffling to change state,",
"# so it needs a large and \"interesting\" n to work with. Here,",
"# we use hashing to create a large n for the shuffle.",
"s",
"=",
"repr",
"(",
"n",
")",
"+",
... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/random.py#L147-L157 | ||
OpenEndedGroup/Field | 4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c | Contents/lib/python/mailbox.py | python | MH.unlock | (self) | Unlock the mailbox if it is locked. | Unlock the mailbox if it is locked. | [
"Unlock",
"the",
"mailbox",
"if",
"it",
"is",
"locked",
"."
] | def unlock(self):
"""Unlock the mailbox if it is locked."""
if self._locked:
_unlock_file(self._file)
_sync_close(self._file)
self._file.close()
del self._file
self._locked = False | [
"def",
"unlock",
"(",
"self",
")",
":",
"if",
"self",
".",
"_locked",
":",
"_unlock_file",
"(",
"self",
".",
"_file",
")",
"_sync_close",
"(",
"self",
".",
"_file",
")",
"self",
".",
"_file",
".",
"close",
"(",
")",
"del",
"self",
".",
"_file",
"se... | https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/mailbox.py#L953-L960 | ||
Udayraj123/OMRChecker | 4f11cf4a30c9f6c1cf780f300837d50f7db1fda7 | utils.py | python | adjust_gamma | (image, gamma=1.0) | return cv2.LUT(image, table) | [] | def adjust_gamma(image, gamma=1.0):
# build a lookup table mapping the pixel values [0, 255] to
# their adjusted gamma values
invGamma = 1.0 / gamma
table = np.array([((i / 255.0) ** invGamma) * 255
for i in np.arange(0, 256)]).astype("uint8")
# apply gamma correction using th... | [
"def",
"adjust_gamma",
"(",
"image",
",",
"gamma",
"=",
"1.0",
")",
":",
"# build a lookup table mapping the pixel values [0, 255] to",
"# their adjusted gamma values",
"invGamma",
"=",
"1.0",
"/",
"gamma",
"table",
"=",
"np",
".",
"array",
"(",
"[",
"(",
"(",
"i"... | https://github.com/Udayraj123/OMRChecker/blob/4f11cf4a30c9f6c1cf780f300837d50f7db1fda7/utils.py#L451-L459 | |||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_aws_elastic_block_store_volume_source.py | python | V1AWSElasticBlockStoreVolumeSource.read_only | (self) | return self._read_only | Gets the read_only of this V1AWSElasticBlockStoreVolumeSource. # noqa: E501
Specify \"true\" to force and set the ReadOnly property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore # noqa: E501
:ret... | Gets the read_only of this V1AWSElasticBlockStoreVolumeSource. # noqa: E501 | [
"Gets",
"the",
"read_only",
"of",
"this",
"V1AWSElasticBlockStoreVolumeSource",
".",
"#",
"noqa",
":",
"E501"
] | def read_only(self):
"""Gets the read_only of this V1AWSElasticBlockStoreVolumeSource. # noqa: E501
Specify \"true\" to force and set the ReadOnly property in VolumeMounts to \"true\". If omitted, the default is \"false\". More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblocks... | [
"def",
"read_only",
"(",
"self",
")",
":",
"return",
"self",
".",
"_read_only"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_aws_elastic_block_store_volume_source.py#L116-L124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.