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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/algorithms/centrality/eigenvector.py | python | eigenvector_centrality | (G, max_iter=100, tol=1.0e-6, nstart=None,
weight=None) | r"""Compute the eigenvector centrality for the graph `G`.
Eigenvector centrality computes the centrality for a node based on the
centrality of its neighbors. The eigenvector centrality for node $i$ is
.. math::
Ax = \lambda x
where $A$ is the adjacency matrix of the graph `G` with eigenvalue... | r"""Compute the eigenvector centrality for the graph `G`. | [
"r",
"Compute",
"the",
"eigenvector",
"centrality",
"for",
"the",
"graph",
"G",
"."
] | def eigenvector_centrality(G, max_iter=100, tol=1.0e-6, nstart=None,
weight=None):
r"""Compute the eigenvector centrality for the graph `G`.
Eigenvector centrality computes the centrality for a node based on the
centrality of its neighbors. The eigenvector centrality for node $i$... | [
"def",
"eigenvector_centrality",
"(",
"G",
",",
"max_iter",
"=",
"100",
",",
"tol",
"=",
"1.0e-6",
",",
"nstart",
"=",
"None",
",",
"weight",
"=",
"None",
")",
":",
"if",
"len",
"(",
"G",
")",
"==",
"0",
":",
"raise",
"nx",
".",
"NetworkXPointlessCon... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/algorithms/centrality/eigenvector.py#L25-L148 | ||
fossasia/open-event-server | 5ce3b88c0bcf8685944e634701203944b2cf17dd | app/api/helpers/mail.py | python | convert_to_user_locale | (email, date_time=None, date=None, time=None, tz=None, amount=None, currency=None) | return None | Convert date and time and amount to user selected language
:return : datetime/date/time translated to user locale | Convert date and time and amount to user selected language
:return : datetime/date/time translated to user locale | [
"Convert",
"date",
"and",
"time",
"and",
"amount",
"to",
"user",
"selected",
"language",
":",
"return",
":",
"datetime",
"/",
"date",
"/",
"time",
"translated",
"to",
"user",
"locale"
] | def convert_to_user_locale(email, date_time=None, date=None, time=None, tz=None, amount=None, currency=None):
"""
Convert date and time and amount to user selected language
:return : datetime/date/time translated to user locale
"""
if email:
user = User.query.filter(User.email == emai... | [
"def",
"convert_to_user_locale",
"(",
"email",
",",
"date_time",
"=",
"None",
",",
"date",
"=",
"None",
",",
"time",
"=",
"None",
",",
"tz",
"=",
"None",
",",
"amount",
"=",
"None",
",",
"currency",
"=",
"None",
")",
":",
"if",
"email",
":",
"user",
... | https://github.com/fossasia/open-event-server/blob/5ce3b88c0bcf8685944e634701203944b2cf17dd/app/api/helpers/mail.py#L830-L864 | |
fabtools/fabtools | 5fdc7174c3fae5e93a16d677d0466f41dc2be175 | fabtools/supervisor.py | python | start_process | (name) | Start a supervisor process | Start a supervisor process | [
"Start",
"a",
"supervisor",
"process"
] | def start_process(name):
"""
Start a supervisor process
"""
run_as_root("supervisorctl start %(name)s" % locals()) | [
"def",
"start_process",
"(",
"name",
")",
":",
"run_as_root",
"(",
"\"supervisorctl start %(name)s\"",
"%",
"locals",
"(",
")",
")"
] | https://github.com/fabtools/fabtools/blob/5fdc7174c3fae5e93a16d677d0466f41dc2be175/fabtools/supervisor.py#L47-L51 | ||
graalvm/mx | 29c0debab406352df3af246be2f8973be5db69ae | mx_benchmark.py | python | build_name | () | return mx.get_env("BUILD_NAME", default="") | Get the current build name from the BUILD_NAME environment variable, or an empty string otherwise.
:return: the build name
:rtype: basestring | Get the current build name from the BUILD_NAME environment variable, or an empty string otherwise. | [
"Get",
"the",
"current",
"build",
"name",
"from",
"the",
"BUILD_NAME",
"environment",
"variable",
"or",
"an",
"empty",
"string",
"otherwise",
"."
] | def build_name():
"""
Get the current build name from the BUILD_NAME environment variable, or an empty string otherwise.
:return: the build name
:rtype: basestring
"""
return mx.get_env("BUILD_NAME", default="") | [
"def",
"build_name",
"(",
")",
":",
"return",
"mx",
".",
"get_env",
"(",
"\"BUILD_NAME\"",
",",
"default",
"=",
"\"\"",
")"
] | https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_benchmark.py#L2176-L2183 | |
nodejs/node-gyp | a2f298870692022302fa27a1d42363c4a72df407 | gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.__init__ | (
self,
hash_for_rules,
target_outputs,
base_dir,
build_dir,
output_file,
toplevel_build,
output_file_name,
flavor,
toplevel_dir=None,
) | base_dir: path from source root to directory containing this gyp file,
by gyp semantics, all input paths are relative to this
build_dir: path from source root to build output
toplevel_dir: path to the toplevel directory | base_dir: path from source root to directory containing this gyp file,
by gyp semantics, all input paths are relative to this
build_dir: path from source root to build output
toplevel_dir: path to the toplevel directory | [
"base_dir",
":",
"path",
"from",
"source",
"root",
"to",
"directory",
"containing",
"this",
"gyp",
"file",
"by",
"gyp",
"semantics",
"all",
"input",
"paths",
"are",
"relative",
"to",
"this",
"build_dir",
":",
"path",
"from",
"source",
"root",
"to",
"build",
... | def __init__(
self,
hash_for_rules,
target_outputs,
base_dir,
build_dir,
output_file,
toplevel_build,
output_file_name,
flavor,
toplevel_dir=None,
):
"""
base_dir: path from source root to directory containing this gyp f... | [
"def",
"__init__",
"(",
"self",
",",
"hash_for_rules",
",",
"target_outputs",
",",
"base_dir",
",",
"build_dir",
",",
"output_file",
",",
"toplevel_build",
",",
"output_file_name",
",",
"flavor",
",",
"toplevel_dir",
"=",
"None",
",",
")",
":",
"self",
".",
... | https://github.com/nodejs/node-gyp/blob/a2f298870692022302fa27a1d42363c4a72df407/gyp/pylib/gyp/generator/ninja.py#L214-L257 | ||
Azure/azure-cli | 6c1b085a0910c6c2139006fcbd8ade44006eb6dd | src/azure-cli/azure/cli/command_modules/keyvault/custom.py | python | set_policy | (cmd, client, resource_group_name, vault_name,
object_id=None, application_id=None, spn=None, upn=None, key_permissions=None, secret_permissions=None,
certificate_permissions=None, storage_permissions=None, no_wait=False) | return _azure_stack_wrapper(cmd, client, 'create_or_update',
resource_type=ResourceType.MGMT_KEYVAULT,
min_api_version='2018-02-14',
resource_group_name=resource_group_name,
vault_name=vault_n... | Update security policy settings for a Key Vault. | Update security policy settings for a Key Vault. | [
"Update",
"security",
"policy",
"settings",
"for",
"a",
"Key",
"Vault",
"."
] | def set_policy(cmd, client, resource_group_name, vault_name,
object_id=None, application_id=None, spn=None, upn=None, key_permissions=None, secret_permissions=None,
certificate_permissions=None, storage_permissions=None, no_wait=False):
""" Update security policy settings for a Key Vau... | [
"def",
"set_policy",
"(",
"cmd",
",",
"client",
",",
"resource_group_name",
",",
"vault_name",
",",
"object_id",
"=",
"None",
",",
"application_id",
"=",
"None",
",",
"spn",
"=",
"None",
",",
"upn",
"=",
"None",
",",
"key_permissions",
"=",
"None",
",",
... | https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli/azure/cli/command_modules/keyvault/custom.py#L911-L971 | |
sony/nnabla | 5b022f309bf2fa3ade0b6cb9bf05da9ddc67f104 | python/src/nnabla/backward_function/gather_nd.py | python | gather_nd_backward | (inputs) | return dx0, None | Args:
inputs (list of nn.Variable): Incomming grads/inputs to/of the forward function.
kwargs (dict of arguments): Dictionary of the corresponding function arguments.
Return:
list of Variable: Return the gradients wrt inputs of the corresponding function. | Args:
inputs (list of nn.Variable): Incomming grads/inputs to/of the forward function.
kwargs (dict of arguments): Dictionary of the corresponding function arguments. | [
"Args",
":",
"inputs",
"(",
"list",
"of",
"nn",
".",
"Variable",
")",
":",
"Incomming",
"grads",
"/",
"inputs",
"to",
"/",
"of",
"the",
"forward",
"function",
".",
"kwargs",
"(",
"dict",
"of",
"arguments",
")",
":",
"Dictionary",
"of",
"the",
"correspo... | def gather_nd_backward(inputs):
"""
Args:
inputs (list of nn.Variable): Incomming grads/inputs to/of the forward function.
kwargs (dict of arguments): Dictionary of the corresponding function arguments.
Return:
list of Variable: Return the gradients wrt inputs of the corresponding functio... | [
"def",
"gather_nd_backward",
"(",
"inputs",
")",
":",
"dy",
"=",
"inputs",
"[",
"0",
"]",
"x0",
"=",
"inputs",
"[",
"1",
"]",
"idx",
"=",
"inputs",
"[",
"2",
"]",
"dx0",
"=",
"F",
".",
"scatter_nd",
"(",
"dy",
",",
"idx",
",",
"shape",
"=",
"x0... | https://github.com/sony/nnabla/blob/5b022f309bf2fa3ade0b6cb9bf05da9ddc67f104/python/src/nnabla/backward_function/gather_nd.py#L19-L32 | |
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/virtual_machine.py | python | BaseOsMixin.SetupLocalDisks | (self) | Perform OS specific setup on any local disks that exist. | Perform OS specific setup on any local disks that exist. | [
"Perform",
"OS",
"specific",
"setup",
"on",
"any",
"local",
"disks",
"that",
"exist",
"."
] | def SetupLocalDisks(self):
"""Perform OS specific setup on any local disks that exist."""
pass | [
"def",
"SetupLocalDisks",
"(",
"self",
")",
":",
"pass"
] | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/virtual_machine.py#L649-L651 | ||
PyWavelets/pywt | 9a72143be347481e2276371efb41ae0266b9c808 | pywt/_wavelet_packets.py | python | BaseNode._evaluate_maxlevel | (self, evaluate_from='parent') | return None | Try to find the value of maximum decomposition level if it is not
specified explicitly.
Parameters
----------
evaluate_from : {'parent', 'subnodes'} | Try to find the value of maximum decomposition level if it is not
specified explicitly. | [
"Try",
"to",
"find",
"the",
"value",
"of",
"maximum",
"decomposition",
"level",
"if",
"it",
"is",
"not",
"specified",
"explicitly",
"."
] | def _evaluate_maxlevel(self, evaluate_from='parent'):
"""
Try to find the value of maximum decomposition level if it is not
specified explicitly.
Parameters
----------
evaluate_from : {'parent', 'subnodes'}
"""
assert evaluate_from in ('parent', 'subnodes... | [
"def",
"_evaluate_maxlevel",
"(",
"self",
",",
"evaluate_from",
"=",
"'parent'",
")",
":",
"assert",
"evaluate_from",
"in",
"(",
"'parent'",
",",
"'subnodes'",
")",
"if",
"self",
".",
"_maxlevel",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_maxlevel",... | https://github.com/PyWavelets/pywt/blob/9a72143be347481e2276371efb41ae0266b9c808/pywt/_wavelet_packets.py#L126-L153 | |
Theano/Theano | 8fd9203edfeecebced9344b0c70193be292a9ade | theano/sparse/basic.py | python | structured_add | (x) | Structured addition of sparse matrix x and scalar y. | Structured addition of sparse matrix x and scalar y. | [
"Structured",
"addition",
"of",
"sparse",
"matrix",
"x",
"and",
"scalar",
"y",
"."
] | def structured_add(x):
"""
Structured addition of sparse matrix x and scalar y.
""" | [
"def",
"structured_add",
"(",
"x",
")",
":"
] | https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/sparse/basic.py#L3142-L3146 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/engines/vex/lifter.py | python | VEXLifter.lift_vex | (self,
addr=None,
state=None,
clemory=None,
insn_bytes=None,
offset=None,
arch=None,
size=None,
num_inst=None,
traceflags=0,
thumb=False,
extra_stop_points=None,
op... | Lift an IRSB.
There are many possible valid sets of parameters. You at the very least must pass some
source of data, some source of an architecture, and some source of an address.
Sources of data in order of priority: insn_bytes, clemory, state
Sources of an address, in order of prior... | Lift an IRSB. | [
"Lift",
"an",
"IRSB",
"."
] | def lift_vex(self,
addr=None,
state=None,
clemory=None,
insn_bytes=None,
offset=None,
arch=None,
size=None,
num_inst=None,
traceflags=0,
thumb=False,
extra_stop_points=None,
... | [
"def",
"lift_vex",
"(",
"self",
",",
"addr",
"=",
"None",
",",
"state",
"=",
"None",
",",
"clemory",
"=",
"None",
",",
"insn_bytes",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"size",
"=",
"None",
",",
"num_inst",
"=",
... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/engines/vex/lifter.py#L73-L278 | ||
Trusted-AI/adversarial-robustness-toolbox | 9fabffdbb92947efa1ecc5d825d634d30dfbaf29 | art/evaluations/evaluation.py | python | Evaluation.evaluate | (self, *args, **kwargs) | Abstract method running the evaluation. | Abstract method running the evaluation. | [
"Abstract",
"method",
"running",
"the",
"evaluation",
"."
] | def evaluate(self, *args, **kwargs) -> Any:
"""
Abstract method running the evaluation.
"""
raise NotImplementedError | [
"def",
"evaluate",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"->",
"Any",
":",
"raise",
"NotImplementedError"
] | https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/9fabffdbb92947efa1ecc5d825d634d30dfbaf29/art/evaluations/evaluation.py#L31-L35 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/graphy/graphy/common.py | python | BaseChart.GetDependentAxis | (self) | return self.left | Return this chart's main dependent axis (often 'left', but
horizontal bar-charts use 'bottom'). | Return this chart's main dependent axis (often 'left', but
horizontal bar-charts use 'bottom'). | [
"Return",
"this",
"chart",
"s",
"main",
"dependent",
"axis",
"(",
"often",
"left",
"but",
"horizontal",
"bar",
"-",
"charts",
"use",
"bottom",
")",
"."
] | def GetDependentAxis(self):
"""Return this chart's main dependent axis (often 'left', but
horizontal bar-charts use 'bottom').
"""
return self.left | [
"def",
"GetDependentAxis",
"(",
"self",
")",
":",
"return",
"self",
".",
"left"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/graphy/graphy/common.py#L266-L270 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_statuspageio/library/statuspage_incident.py | python | StatusPageIncident.exists | (self) | verify if the incoming incident exists
As per some discussion, this is a difficult task without
a unique identifier on the incident.
Decision: If an incident exists, with the same components, and the components
are in the same state as before then we can say with a ... | verify if the incoming incident exists | [
"verify",
"if",
"the",
"incoming",
"incident",
"exists"
] | def exists(self):
''' verify if the incoming incident exists
As per some discussion, this is a difficult task without
a unique identifier on the incident.
Decision: If an incident exists, with the same components, and the components
are in the same state as ... | [
"def",
"exists",
"(",
"self",
")",
":",
"found",
",",
"_",
",",
"_",
"=",
"self",
".",
"find_incident",
"(",
")",
"if",
"len",
"(",
"found",
")",
"==",
"1",
":",
"return",
"True",
"if",
"len",
"(",
"found",
")",
"==",
"0",
":",
"return",
"False... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_statuspageio/library/statuspage_incident.py#L539-L558 | ||
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mimic/scripts/mimic_prefs_ui.py | python | Window.reload_window | (self) | Relauches the window.
:return: None | Relauches the window.
:return: None | [
"Relauches",
"the",
"window",
".",
":",
"return",
":",
"None"
] | def reload_window(self):
"""
Relauches the window.
:return: None
"""
command = "import sys\n" \
"sys.dont_write_bytecode = True # don't write PYCs\n" \
"import {}\n" \
"reload({})\n" \
"{}.{}()".format(__nam... | [
"def",
"reload_window",
"(",
"self",
")",
":",
"command",
"=",
"\"import sys\\n\"",
"\"sys.dont_write_bytecode = True # don't write PYCs\\n\"",
"\"import {}\\n\"",
"\"reload({})\\n\"",
"\"{}.{}()\"",
".",
"format",
"(",
"__name__",
",",
"__name__",
",",
"__name__",
",",
... | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/mimic_prefs_ui.py#L73-L86 | ||
rockingdingo/deepnlp | dac9793217e513ec19f1bbcc1c119b0b7bbdb883 | deepnlp/ner_tagger.py | python | udf_default | (word, tags, *args) | return tags[0], 1.0 | Default get the first tag
Return: tag, confidence | Default get the first tag
Return: tag, confidence | [
"Default",
"get",
"the",
"first",
"tag",
"Return",
":",
"tag",
"confidence"
] | def udf_default(word, tags, *args):
""" Default get the first tag
Return: tag, confidence
"""
if (len(tags) > 0):
return tags[0], 1.0
else:
return TAG_NONE_ENTITY
return tags[0], 1.0 | [
"def",
"udf_default",
"(",
"word",
",",
"tags",
",",
"*",
"args",
")",
":",
"if",
"(",
"len",
"(",
"tags",
")",
">",
"0",
")",
":",
"return",
"tags",
"[",
"0",
"]",
",",
"1.0",
"else",
":",
"return",
"TAG_NONE_ENTITY",
"return",
"tags",
"[",
"0",... | https://github.com/rockingdingo/deepnlp/blob/dac9793217e513ec19f1bbcc1c119b0b7bbdb883/deepnlp/ner_tagger.py#L42-L50 | |
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models/roberta_wwm_ext/modeling.py | python | get_shape_list | (tensor, expected_rank=None, name=None) | return shape | Returns a list of the shape of tensor, preferring static dimensions.
Args:
tensor: A tf.Tensor object to find the shape of.
expected_rank: (optional) int. The expected rank of `tensor`. If this is
specified and the `tensor` has a different rank, and exception will be
thrown.
name: Optional na... | Returns a list of the shape of tensor, preferring static dimensions. | [
"Returns",
"a",
"list",
"of",
"the",
"shape",
"of",
"tensor",
"preferring",
"static",
"dimensions",
"."
] | def get_shape_list(tensor, expected_rank=None, name=None):
"""Returns a list of the shape of tensor, preferring static dimensions.
Args:
tensor: A tf.Tensor object to find the shape of.
expected_rank: (optional) int. The expected rank of `tensor`. If this is
specified and the `tensor` has a different... | [
"def",
"get_shape_list",
"(",
"tensor",
",",
"expected_rank",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"tensor",
".",
"name",
"if",
"expected_rank",
"is",
"not",
"None",
":",
"assert_rank",
"(",
"te... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/roberta_wwm_ext/modeling.py#L895-L929 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/httplib.py | python | HTTPConnection.endheaders | (self, message_body=None) | Indicate that the last header line has been sent to the server.
This method sends the request to the server. The optional
message_body argument can be used to pass a message body
associated with the request. The message body will be sent in
the same packet as the message headers if it... | Indicate that the last header line has been sent to the server. | [
"Indicate",
"that",
"the",
"last",
"header",
"line",
"has",
"been",
"sent",
"to",
"the",
"server",
"."
] | def endheaders(self, message_body=None):
"""Indicate that the last header line has been sent to the server.
This method sends the request to the server. The optional
message_body argument can be used to pass a message body
associated with the request. The message body will be sent in
... | [
"def",
"endheaders",
"(",
"self",
",",
"message_body",
"=",
"None",
")",
":",
"if",
"self",
".",
"__state",
"==",
"_CS_REQ_STARTED",
":",
"self",
".",
"__state",
"=",
"_CS_REQ_SENT",
"else",
":",
"raise",
"CannotSendHeader",
"(",
")",
"self",
".",
"_send_o... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/httplib.py#L956-L969 | ||
Yelp/bravado-core | 382db874b7b838dcfd169b0ce490d6a447ad6ff2 | bravado_core/spec.py | python | build_http_handlers | (http_client) | return {
'http': download,
'https': download,
# jsonschema ordinarily handles file:// requests, but it assumes that
# all files are json formatted. We override it here so that we can
# load yaml files when necessary.
'file': read_file,
} | Create a mapping of uri schemes to callables that take a uri. The
callable is used by jsonschema's RefResolver to download remote $refs.
:param http_client: http_client with a request() method
:returns: dict like {'http': callable, 'https': callable} | Create a mapping of uri schemes to callables that take a uri. The
callable is used by jsonschema's RefResolver to download remote $refs. | [
"Create",
"a",
"mapping",
"of",
"uri",
"schemes",
"to",
"callables",
"that",
"take",
"a",
"uri",
".",
"The",
"callable",
"is",
"used",
"by",
"jsonschema",
"s",
"RefResolver",
"to",
"download",
"remote",
"$refs",
"."
] | def build_http_handlers(http_client):
"""Create a mapping of uri schemes to callables that take a uri. The
callable is used by jsonschema's RefResolver to download remote $refs.
:param http_client: http_client with a request() method
:returns: dict like {'http': callable, 'https': callable}
"""
... | [
"def",
"build_http_handlers",
"(",
"http_client",
")",
":",
"def",
"download",
"(",
"uri",
")",
":",
"log",
".",
"debug",
"(",
"'Downloading %s'",
",",
"uri",
")",
"request_params",
"=",
"{",
"'method'",
":",
"'GET'",
",",
"'url'",
":",
"uri",
",",
"}",
... | https://github.com/Yelp/bravado-core/blob/382db874b7b838dcfd169b0ce490d6a447ad6ff2/bravado_core/spec.py#L555-L590 | |
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | project_euler/problem_035/sol1.py | python | solution | () | return len(find_circular_primes()) | >>> solution()
55 | >>> solution()
55 | [
">>>",
"solution",
"()",
"55"
] | def solution() -> int:
"""
>>> solution()
55
"""
return len(find_circular_primes()) | [
"def",
"solution",
"(",
")",
"->",
"int",
":",
"return",
"len",
"(",
"find_circular_primes",
"(",
")",
")"
] | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/project_euler/problem_035/sol1.py#L73-L78 | |
natashamjaques/neural_chat | ddb977bb4602a67c460d02231e7bbf7b2cb49a97 | ParlAI/parlai/agents/example_seq2seq/example_seq2seq.py | python | ExampleSeq2seqAgent.zero_grad | (self) | Zero out optimizer. | Zero out optimizer. | [
"Zero",
"out",
"optimizer",
"."
] | def zero_grad(self):
"""Zero out optimizer."""
for optimizer in self.optims.values():
optimizer.zero_grad() | [
"def",
"zero_grad",
"(",
"self",
")",
":",
"for",
"optimizer",
"in",
"self",
".",
"optims",
".",
"values",
"(",
")",
":",
"optimizer",
".",
"zero_grad",
"(",
")"
] | https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/agents/example_seq2seq/example_seq2seq.py#L179-L182 | ||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/distutils/command/sdist.py | python | sdist.make_release_tree | (self, base_dir, files) | Create the directory tree that will become the source
distribution archive. All directories implied by the filenames in
'files' are created under 'base_dir', and then we hard link or copy
(if hard linking is unavailable) those files into place.
Essentially, this duplicates the developer... | Create the directory tree that will become the source
distribution archive. All directories implied by the filenames in
'files' are created under 'base_dir', and then we hard link or copy
(if hard linking is unavailable) those files into place.
Essentially, this duplicates the developer... | [
"Create",
"the",
"directory",
"tree",
"that",
"will",
"become",
"the",
"source",
"distribution",
"archive",
".",
"All",
"directories",
"implied",
"by",
"the",
"filenames",
"in",
"files",
"are",
"created",
"under",
"base_dir",
"and",
"then",
"we",
"hard",
"link... | def make_release_tree(self, base_dir, files):
"""Create the directory tree that will become the source
distribution archive. All directories implied by the filenames in
'files' are created under 'base_dir', and then we hard link or copy
(if hard linking is unavailable) those files into ... | [
"def",
"make_release_tree",
"(",
"self",
",",
"base_dir",
",",
"files",
")",
":",
"# Create all the directories under 'base_dir' necessary to",
"# put 'files' there; the 'mkpath()' is just so we don't die",
"# if the manifest happens to be empty.",
"self",
".",
"mkpath",
"(",
"base... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/distutils/command/sdist.py#L385-L425 | ||
DistrictDataLabs/yellowbrick | 2eb8e3edfbe6f3f22c595b38989a23ba7cea40cf | yellowbrick/features/jointplot.py | python | JointPlot._layout | (self) | Creates the grid layout for the joint plot, adding new axes for the histograms
if necessary and modifying the aspect ratio. Does not modify the axes or the
layout if self.hist is False or None. | Creates the grid layout for the joint plot, adding new axes for the histograms
if necessary and modifying the aspect ratio. Does not modify the axes or the
layout if self.hist is False or None. | [
"Creates",
"the",
"grid",
"layout",
"for",
"the",
"joint",
"plot",
"adding",
"new",
"axes",
"for",
"the",
"histograms",
"if",
"necessary",
"and",
"modifying",
"the",
"aspect",
"ratio",
".",
"Does",
"not",
"modify",
"the",
"axes",
"or",
"the",
"layout",
"if... | def _layout(self):
"""
Creates the grid layout for the joint plot, adding new axes for the histograms
if necessary and modifying the aspect ratio. Does not modify the axes or the
layout if self.hist is False or None.
"""
# Ensure the axes are created if not hist, then ret... | [
"def",
"_layout",
"(",
"self",
")",
":",
"# Ensure the axes are created if not hist, then return.",
"if",
"not",
"self",
".",
"hist",
":",
"self",
".",
"ax",
"return",
"# Ensure matplotlib version compatibility",
"if",
"make_axes_locatable",
"is",
"None",
":",
"raise",
... | https://github.com/DistrictDataLabs/yellowbrick/blob/2eb8e3edfbe6f3f22c595b38989a23ba7cea40cf/yellowbrick/features/jointplot.py#L223-L252 | ||
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/dictionary/pronunciation.py | python | PronunciationDictionaryMixin.words_symbol_path | (self) | return os.path.join(self.dictionary_output_directory, "words.txt") | Path of word to int mapping file for the dictionary | Path of word to int mapping file for the dictionary | [
"Path",
"of",
"word",
"to",
"int",
"mapping",
"file",
"for",
"the",
"dictionary"
] | def words_symbol_path(self) -> str:
"""
Path of word to int mapping file for the dictionary
"""
return os.path.join(self.dictionary_output_directory, "words.txt") | [
"def",
"words_symbol_path",
"(",
"self",
")",
"->",
"str",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dictionary_output_directory",
",",
"\"words.txt\"",
")"
] | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/dictionary/pronunciation.py#L472-L476 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/libs/tinymce/views.py | python | render_to_image_list | (image_list) | return render_to_js_vardef('tinyMCEImageList', image_list) | Returns a HttpResponse whose content is a Javscript file representing a
list of images suitable for use wit the TinyMCE external_image_list_url
configuration option. The image_list parameter must be a list of 2-tuples. | Returns a HttpResponse whose content is a Javscript file representing a
list of images suitable for use wit the TinyMCE external_image_list_url
configuration option. The image_list parameter must be a list of 2-tuples. | [
"Returns",
"a",
"HttpResponse",
"whose",
"content",
"is",
"a",
"Javscript",
"file",
"representing",
"a",
"list",
"of",
"images",
"suitable",
"for",
"use",
"wit",
"the",
"TinyMCE",
"external_image_list_url",
"configuration",
"option",
".",
"The",
"image_list",
"par... | def render_to_image_list(image_list):
"""
Returns a HttpResponse whose content is a Javscript file representing a
list of images suitable for use wit the TinyMCE external_image_list_url
configuration option. The image_list parameter must be a list of 2-tuples.
"""
return render_to_js_vardef('tin... | [
"def",
"render_to_image_list",
"(",
"image_list",
")",
":",
"return",
"render_to_js_vardef",
"(",
"'tinyMCEImageList'",
",",
"image_list",
")"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/libs/tinymce/views.py#L123-L129 | |
ChineseGLUE/ChineseGLUE | 1591b85cf5427c2ff60f718d359ecb71d2b44879 | baselines/models/xlnet/tpu_estimator.py | python | _is_iterable | (obj) | A Python 2 and 3 compatible util to check whether `obj` is iterable. | A Python 2 and 3 compatible util to check whether `obj` is iterable. | [
"A",
"Python",
"2",
"and",
"3",
"compatible",
"util",
"to",
"check",
"whether",
"obj",
"is",
"iterable",
"."
] | def _is_iterable(obj):
"""A Python 2 and 3 compatible util to check whether `obj` is iterable."""
try:
iter(obj)
return True
except TypeError:
return False | [
"def",
"_is_iterable",
"(",
"obj",
")",
":",
"try",
":",
"iter",
"(",
"obj",
")",
"return",
"True",
"except",
"TypeError",
":",
"return",
"False"
] | https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/xlnet/tpu_estimator.py#L114-L120 | ||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/pynvml.py | python | nvmlDeviceSetDefaultAutoBoostedClocksEnabled | (handle, enabled, flags) | return None | [] | def nvmlDeviceSetDefaultAutoBoostedClocksEnabled(handle, enabled, flags):
fn = _nvmlGetFunctionPointer("nvmlDeviceSetDefaultAutoBoostedClocksEnabled")
ret = fn(handle, _nvmlEnableState_t(enabled), c_uint(flags))
_nvmlCheckReturn(ret)
return None | [
"def",
"nvmlDeviceSetDefaultAutoBoostedClocksEnabled",
"(",
"handle",
",",
"enabled",
",",
"flags",
")",
":",
"fn",
"=",
"_nvmlGetFunctionPointer",
"(",
"\"nvmlDeviceSetDefaultAutoBoostedClocksEnabled\"",
")",
"ret",
"=",
"fn",
"(",
"handle",
",",
"_nvmlEnableState_t",
... | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/pynvml.py#L1552-L1556 | |||
polakowo/vectorbt | 6638735c131655760474d72b9f045d1dbdbd8fe9 | vectorbt/utils/config.py | python | get_func_arg_names | (func: tp.Callable, arg_kind: tp.Optional[tp.MaybeTuple[int]] = None) | return [
p.name for p in signature.parameters.values()
if p.kind in arg_kind
] | Get argument names of a function. | Get argument names of a function. | [
"Get",
"argument",
"names",
"of",
"a",
"function",
"."
] | def get_func_arg_names(func: tp.Callable, arg_kind: tp.Optional[tp.MaybeTuple[int]] = None) -> tp.List[str]:
"""Get argument names of a function."""
signature = inspect.signature(func)
if arg_kind is not None and isinstance(arg_kind, int):
arg_kind = (arg_kind,)
if arg_kind is None:
retu... | [
"def",
"get_func_arg_names",
"(",
"func",
":",
"tp",
".",
"Callable",
",",
"arg_kind",
":",
"tp",
".",
"Optional",
"[",
"tp",
".",
"MaybeTuple",
"[",
"int",
"]",
"]",
"=",
"None",
")",
"->",
"tp",
".",
"List",
"[",
"str",
"]",
":",
"signature",
"="... | https://github.com/polakowo/vectorbt/blob/6638735c131655760474d72b9f045d1dbdbd8fe9/vectorbt/utils/config.py#L55-L68 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/cli.py | python | Application.server | (self, parsed_args) | return wsgi.Server(**self.server_args(parsed_args)) | Server. | Server. | [
"Server",
"."
] | def server(self, parsed_args):
"""Server."""
return wsgi.Server(**self.server_args(parsed_args)) | [
"def",
"server",
"(",
"self",
",",
"parsed_args",
")",
":",
"return",
"wsgi",
".",
"Server",
"(",
"*",
"*",
"self",
".",
"server_args",
"(",
"parsed_args",
")",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/cli.py#L113-L115 | |
eirannejad/pyRevit | 49c0b7eb54eb343458ce1365425e6552d0c47d44 | site-packages/sqlalchemy/sql/schema.py | python | Column._make_proxy | (self, selectable, name=None, key=None,
name_is_truncatable=False, **kw) | return c | Create a *proxy* for this column.
This is a copy of this ``Column`` referenced by a different parent
(such as an alias or select statement). The column should
be used only in select scenarios, as its full DDL/default
information is not transferred. | Create a *proxy* for this column. | [
"Create",
"a",
"*",
"proxy",
"*",
"for",
"this",
"column",
"."
] | def _make_proxy(self, selectable, name=None, key=None,
name_is_truncatable=False, **kw):
"""Create a *proxy* for this column.
This is a copy of this ``Column`` referenced by a different parent
(such as an alias or select statement). The column should
be used only in... | [
"def",
"_make_proxy",
"(",
"self",
",",
"selectable",
",",
"name",
"=",
"None",
",",
"key",
"=",
"None",
",",
"name_is_truncatable",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"fk",
"=",
"[",
"ForeignKey",
"(",
"f",
".",
"column",
",",
"_constraint... | https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/sqlalchemy/sql/schema.py#L1420-L1463 | |
django-import-export/django-import-export | 0d4340f02582e86d4515159becb045cad1d53ee0 | import_export/resources.py | python | Resource.bulk_create | (self, using_transactions, dry_run, raise_errors, batch_size=None) | Creates objects by calling ``bulk_create``. | Creates objects by calling ``bulk_create``. | [
"Creates",
"objects",
"by",
"calling",
"bulk_create",
"."
] | def bulk_create(self, using_transactions, dry_run, raise_errors, batch_size=None):
"""
Creates objects by calling ``bulk_create``.
"""
try:
if len(self.create_instances) > 0:
if not using_transactions and dry_run:
pass
else:... | [
"def",
"bulk_create",
"(",
"self",
",",
"using_transactions",
",",
"dry_run",
",",
"raise_errors",
",",
"batch_size",
"=",
"None",
")",
":",
"try",
":",
"if",
"len",
"(",
"self",
".",
"create_instances",
")",
">",
"0",
":",
"if",
"not",
"using_transactions... | https://github.com/django-import-export/django-import-export/blob/0d4340f02582e86d4515159becb045cad1d53ee0/import_export/resources.py#L376-L391 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/bs4/dammit.py | python | UnicodeDammit._sub_ms_char | (self, match) | return sub | Changes a MS smart quote character to an XML or HTML
entity, or an ASCII character. | Changes a MS smart quote character to an XML or HTML
entity, or an ASCII character. | [
"Changes",
"a",
"MS",
"smart",
"quote",
"character",
"to",
"an",
"XML",
"or",
"HTML",
"entity",
"or",
"an",
"ASCII",
"character",
"."
] | def _sub_ms_char(self, match):
"""Changes a MS smart quote character to an XML or HTML
entity, or an ASCII character."""
orig = match.group(1)
if self.smart_quotes_to == 'ascii':
sub = self.MS_CHARS_TO_ASCII.get(orig).encode()
else:
sub = self.MS_CHARS.get... | [
"def",
"_sub_ms_char",
"(",
"self",
",",
"match",
")",
":",
"orig",
"=",
"match",
".",
"group",
"(",
"1",
")",
"if",
"self",
".",
"smart_quotes_to",
"==",
"'ascii'",
":",
"sub",
"=",
"self",
".",
"MS_CHARS_TO_ASCII",
".",
"get",
"(",
"orig",
")",
"."... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/bs4/dammit.py#L2872-L2887 | |
blawar/nut | 2cf351400418399a70164987e28670309f6c9cb5 | gui/table_model.py | python | TableModel.setRowCount | (self, row_count) | [] | def setRowCount(self, row_count):
if row_count == 0:
self.datatable = [] | [
"def",
"setRowCount",
"(",
"self",
",",
"row_count",
")",
":",
"if",
"row_count",
"==",
"0",
":",
"self",
".",
"datatable",
"=",
"[",
"]"
] | https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/gui/table_model.py#L92-L94 | ||||
dswah/pyGAM | b57b4cf8783a90976031e1857e748ca3e6ec650b | pygam/terms.py | python | LinearTerm.build_columns | (self, X, verbose=False) | return sp.sparse.csc_matrix(X[:, self.feature][:, np.newaxis]) | construct the model matrix columns for the term
Parameters
----------
X : array-like
Input dataset with n rows
verbose : bool
whether to show warnings
Returns
-------
scipy sparse array with n rows | construct the model matrix columns for the term | [
"construct",
"the",
"model",
"matrix",
"columns",
"for",
"the",
"term"
] | def build_columns(self, X, verbose=False):
"""construct the model matrix columns for the term
Parameters
----------
X : array-like
Input dataset with n rows
verbose : bool
whether to show warnings
Returns
-------
scipy sparse arr... | [
"def",
"build_columns",
"(",
"self",
",",
"X",
",",
"verbose",
"=",
"False",
")",
":",
"return",
"sp",
".",
"sparse",
".",
"csc_matrix",
"(",
"X",
"[",
":",
",",
"self",
".",
"feature",
"]",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
")"
] | https://github.com/dswah/pyGAM/blob/b57b4cf8783a90976031e1857e748ca3e6ec650b/pygam/terms.py#L556-L571 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/coloraxis/_colorbar.py | python | ColorBar.ticktextsrc | (self) | return self["ticktextsrc"] | Sets the source reference on Chart Studio Cloud for `ticktext`.
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for `ticktext`.
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"ticktext",
".",
"The",
"ticktextsrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def ticktextsrc(self):
"""
Sets the source reference on Chart Studio Cloud for `ticktext`.
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["ticktextsrc"] | [
"def",
"ticktextsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticktextsrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/coloraxis/_colorbar.py#L1062-L1073 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/contrib/gis/gdal/field.py | python | Field.__str__ | (self) | return str(self.value).strip() | Returns the string representation of the Field. | Returns the string representation of the Field. | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"Field",
"."
] | def __str__(self):
"Returns the string representation of the Field."
return str(self.value).strip() | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
".",
"value",
")",
".",
"strip",
"(",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/gis/gdal/field.py#L43-L45 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/internet/iocpreactor/udp.py | python | Port.logPrefix | (self) | return self.logstr | Returns the name of my class, to prefix log entries with. | Returns the name of my class, to prefix log entries with. | [
"Returns",
"the",
"name",
"of",
"my",
"class",
"to",
"prefix",
"log",
"entries",
"with",
"."
] | def logPrefix(self):
"""
Returns the name of my class, to prefix log entries with.
"""
return self.logstr | [
"def",
"logPrefix",
"(",
"self",
")",
":",
"return",
"self",
".",
"logstr"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/iocpreactor/udp.py#L271-L275 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/io/formats/format.py | python | format_percentiles | (
percentiles: (np.ndarray | list[int | float] | list[float] | list[str | float]),
) | return [i + "%" for i in out] | Outputs rounded and formatted percentiles.
Parameters
----------
percentiles : list-like, containing floats from interval [0,1]
Returns
-------
formatted : list of strings
Notes
-----
Rounding precision is chosen so that: (1) if any two elements of
``percentiles`` differ, they... | Outputs rounded and formatted percentiles. | [
"Outputs",
"rounded",
"and",
"formatted",
"percentiles",
"."
] | def format_percentiles(
percentiles: (np.ndarray | list[int | float] | list[float] | list[str | float]),
) -> list[str]:
"""
Outputs rounded and formatted percentiles.
Parameters
----------
percentiles : list-like, containing floats from interval [0,1]
Returns
-------
formatted : l... | [
"def",
"format_percentiles",
"(",
"percentiles",
":",
"(",
"np",
".",
"ndarray",
"|",
"list",
"[",
"int",
"|",
"float",
"]",
"|",
"list",
"[",
"float",
"]",
"|",
"list",
"[",
"str",
"|",
"float",
"]",
")",
",",
")",
"->",
"list",
"[",
"str",
"]",... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/io/formats/format.py#L1667-L1733 | |
danilobellini/audiolazy | dba0a278937909980ed40b976d866b8e97c35dee | audiolazy/lazy_analysis.py | python | maverage | (size) | return sum((1. / size) * z ** -i for i in xrange(size)) | Moving average
Linear filter implementation as a FIR ZFilter.
Parameters
----------
size :
Data block window size. Should be an integer.
Returns
-------
A ZFilter instance with the FIR filter.
See Also
--------
envelope :
Signal envelope (time domain) strategies. | Moving average | [
"Moving",
"average"
] | def maverage(size):
"""
Moving average
Linear filter implementation as a FIR ZFilter.
Parameters
----------
size :
Data block window size. Should be an integer.
Returns
-------
A ZFilter instance with the FIR filter.
See Also
--------
envelope :
Signal envelope (time domain) strategi... | [
"def",
"maverage",
"(",
"size",
")",
":",
"return",
"sum",
"(",
"(",
"1.",
"/",
"size",
")",
"*",
"z",
"**",
"-",
"i",
"for",
"i",
"in",
"xrange",
"(",
"size",
")",
")"
] | https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_analysis.py#L591-L612 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_config_map_list.py | python | V1ConfigMapList.api_version | (self, api_version) | Sets the api_version of this V1ConfigMapList.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#res... | Sets the api_version of this V1ConfigMapList.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#res... | [
"Sets",
"the",
"api_version",
"of",
"this",
"V1ConfigMapList",
".",
"APIVersion",
"defines",
"the",
"versioned",
"schema",
"of",
"this",
"representation",
"of",
"an",
"object",
".",
"Servers",
"should",
"convert",
"recognized",
"schemas",
"to",
"the",
"latest",
... | def api_version(self, api_version):
"""
Sets the api_version of this V1ConfigMapList.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8... | [
"def",
"api_version",
"(",
"self",
",",
"api_version",
")",
":",
"self",
".",
"_api_version",
"=",
"api_version"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_config_map_list.py#L64-L73 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/reprlib.py | python | recursive_repr | (fillvalue='...') | return decorating_function | Decorator to make a repr function return fillvalue for a recursive call | Decorator to make a repr function return fillvalue for a recursive call | [
"Decorator",
"to",
"make",
"a",
"repr",
"function",
"return",
"fillvalue",
"for",
"a",
"recursive",
"call"
] | def recursive_repr(fillvalue='...'):
'Decorator to make a repr function return fillvalue for a recursive call'
def decorating_function(user_function):
repr_running = set()
def wrapper(self):
key = id(self), get_ident()
if key in repr_running:
return fill... | [
"def",
"recursive_repr",
"(",
"fillvalue",
"=",
"'...'",
")",
":",
"def",
"decorating_function",
"(",
"user_function",
")",
":",
"repr_running",
"=",
"set",
"(",
")",
"def",
"wrapper",
"(",
"self",
")",
":",
"key",
"=",
"id",
"(",
"self",
")",
",",
"ge... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/reprlib.py#L12-L37 | |
googlearchive/appengine-flask-skeleton | 8c25461d003a0bd99a9ff3b339c2791ee6919242 | lib/jinja2/compiler.py | python | CodeGenerator.indent | (self) | Indent by one. | Indent by one. | [
"Indent",
"by",
"one",
"."
] | def indent(self):
"""Indent by one."""
self._indentation += 1 | [
"def",
"indent",
"(",
"self",
")",
":",
"self",
".",
"_indentation",
"+=",
"1"
] | https://github.com/googlearchive/appengine-flask-skeleton/blob/8c25461d003a0bd99a9ff3b339c2791ee6919242/lib/jinja2/compiler.py#L455-L457 | ||
lmacken/quantumrandom | 2c2725b3915ae524b4320dd3d54becffc505856f | quantumrandom/__init__.py | python | get_data | (data_type='uint16', array_length=1, block_size=1) | return data['data'] | Fetch data from the ANU Quantum Random Numbers JSON API | Fetch data from the ANU Quantum Random Numbers JSON API | [
"Fetch",
"data",
"from",
"the",
"ANU",
"Quantum",
"Random",
"Numbers",
"JSON",
"API"
] | def get_data(data_type='uint16', array_length=1, block_size=1):
"""Fetch data from the ANU Quantum Random Numbers JSON API"""
if data_type not in DATA_TYPES:
raise Exception("data_type must be one of %s" % DATA_TYPES)
if array_length > MAX_LEN:
raise Exception("array_length cannot be larger ... | [
"def",
"get_data",
"(",
"data_type",
"=",
"'uint16'",
",",
"array_length",
"=",
"1",
",",
"block_size",
"=",
"1",
")",
":",
"if",
"data_type",
"not",
"in",
"DATA_TYPES",
":",
"raise",
"Exception",
"(",
"\"data_type must be one of %s\"",
"%",
"DATA_TYPES",
")",... | https://github.com/lmacken/quantumrandom/blob/2c2725b3915ae524b4320dd3d54becffc505856f/quantumrandom/__init__.py#L48-L64 | |
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | var/spack/repos/builtin/packages/roms/package.py | python | Roms.selected_roms_application | (self) | return self.spec.variants['roms_application'].value | Application type that have been selected in this build | Application type that have been selected in this build | [
"Application",
"type",
"that",
"have",
"been",
"selected",
"in",
"this",
"build"
] | def selected_roms_application(self):
"""
Application type that have been selected in this build
"""
return self.spec.variants['roms_application'].value | [
"def",
"selected_roms_application",
"(",
"self",
")",
":",
"return",
"self",
".",
"spec",
".",
"variants",
"[",
"'roms_application'",
"]",
".",
"value"
] | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/var/spack/repos/builtin/packages/roms/package.py#L56-L60 | |
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/phases/ideal_gas.py | python | IdealGas.d2P_dVdT_TP | (self) | return 0.0 | [] | def d2P_dVdT_TP(self):
return 0.0 | [
"def",
"d2P_dVdT_TP",
"(",
"self",
")",
":",
"return",
"0.0"
] | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/phases/ideal_gas.py#L715-L716 | |||
skarra/ASynK | e908a1ad670a2d79f791a6a7539392e078a64add | asynk/sync.py | python | SyncLists.remove_values_from_mod | (self, v) | return self.set_mods(d) | Remove all the values specified in the array k from the passed
dictionary and return the new dictionary. This routine is typically
used to manipulate one of the self.dictoinaries. | Remove all the values specified in the array k from the passed
dictionary and return the new dictionary. This routine is typically
used to manipulate one of the self.dictoinaries. | [
"Remove",
"all",
"the",
"values",
"specified",
"in",
"the",
"array",
"k",
"from",
"the",
"passed",
"dictionary",
"and",
"return",
"the",
"new",
"dictionary",
".",
"This",
"routine",
"is",
"typically",
"used",
"to",
"manipulate",
"one",
"of",
"the",
"self",
... | def remove_values_from_mod (self, v):
"""Remove all the values specified in the array k from the passed
dictionary and return the new dictionary. This routine is typically
used to manipulate one of the self.dictoinaries."""
d = self.get_mods()
d = dict([(x,y) for x,y in d.iterit... | [
"def",
"remove_values_from_mod",
"(",
"self",
",",
"v",
")",
":",
"d",
"=",
"self",
".",
"get_mods",
"(",
")",
"d",
"=",
"dict",
"(",
"[",
"(",
"x",
",",
"y",
")",
"for",
"x",
",",
"y",
"in",
"d",
".",
"iteritems",
"(",
")",
"if",
"not",
"y",... | https://github.com/skarra/ASynK/blob/e908a1ad670a2d79f791a6a7539392e078a64add/asynk/sync.py#L353-L361 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/flows/general/hardware.py | python | DumpFlashImage.DumpImage | (self, responses) | Store hardware information and initiate dumping of the flash image. | Store hardware information and initiate dumping of the flash image. | [
"Store",
"hardware",
"information",
"and",
"initiate",
"dumping",
"of",
"the",
"flash",
"image",
"."
] | def DumpImage(self, responses):
"""Store hardware information and initiate dumping of the flash image."""
self.state.hardware_info = responses.First()
self.CallClient(
server_stubs.DumpFlashImage,
log_level=self.args.log_level,
chunk_size=self.args.chunk_size,
notify_syslog=s... | [
"def",
"DumpImage",
"(",
"self",
",",
"responses",
")",
":",
"self",
".",
"state",
".",
"hardware_info",
"=",
"responses",
".",
"First",
"(",
")",
"self",
".",
"CallClient",
"(",
"server_stubs",
".",
"DumpFlashImage",
",",
"log_level",
"=",
"self",
".",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/flows/general/hardware.py#L31-L39 | ||
jim-schwoebel/voicebook | 0e8eae0f01487f15589c0daa2cf7ca3c6f3b8ad3 | chapter_7_design/snowboy/snowboydecoder.py | python | HotwordDetector.saveMessage | (self) | return filename | Save the message stored in self.recordedData to a timestamped file. | Save the message stored in self.recordedData to a timestamped file. | [
"Save",
"the",
"message",
"stored",
"in",
"self",
".",
"recordedData",
"to",
"a",
"timestamped",
"file",
"."
] | def saveMessage(self):
"""
Save the message stored in self.recordedData to a timestamped file.
"""
filename = 'output' + str(int(time.time())) + '.wav'
data = b''.join(self.recordedData)
#use wave to save data
wf = wave.open(filename, 'wb')
wf.setnchannel... | [
"def",
"saveMessage",
"(",
"self",
")",
":",
"filename",
"=",
"'output'",
"+",
"str",
"(",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
")",
"+",
"'.wav'",
"data",
"=",
"b''",
".",
"join",
"(",
"self",
".",
"recordedData",
")",
"#use wave to save ... | https://github.com/jim-schwoebel/voicebook/blob/0e8eae0f01487f15589c0daa2cf7ca3c6f3b8ad3/chapter_7_design/snowboy/snowboydecoder.py#L250-L267 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/multiprocessing/process.py | python | BaseProcess.join | (self, timeout=None) | Wait until child process terminates | Wait until child process terminates | [
"Wait",
"until",
"child",
"process",
"terminates"
] | def join(self, timeout=None):
'''
Wait until child process terminates
'''
self._check_closed()
assert self._parent_pid == os.getpid(), 'can only join a child process'
assert self._popen is not None, 'can only join a started process'
res = self._popen.wait(timeout)... | [
"def",
"join",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"_check_closed",
"(",
")",
"assert",
"self",
".",
"_parent_pid",
"==",
"os",
".",
"getpid",
"(",
")",
",",
"'can only join a child process'",
"assert",
"self",
".",
"_popen",
... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/multiprocessing/process.py#L133-L142 | ||
subuser-security/subuser | 8072271f8fc3dded60b048c2dee878f9840c126a | subuserlib/classes/docker/dockerDaemon.py | python | DockerDaemon.getConnection | (self) | return self.__connection | Get an `HTTPConnection <https://docs.python.org/2/library/httplib.html#httplib.HTTPConnection>`_ to the Docker daemon.
Note: You can find more info in the `Docker API docs <https://docs.docker.com/reference/api/docker_remote_api_v1.13/>`_ | Get an `HTTPConnection <https://docs.python.org/2/library/httplib.html#httplib.HTTPConnection>`_ to the Docker daemon. | [
"Get",
"an",
"HTTPConnection",
"<https",
":",
"//",
"docs",
".",
"python",
".",
"org",
"/",
"2",
"/",
"library",
"/",
"httplib",
".",
"html#httplib",
".",
"HTTPConnection",
">",
"_",
"to",
"the",
"Docker",
"daemon",
"."
] | def getConnection(self):
"""
Get an `HTTPConnection <https://docs.python.org/2/library/httplib.html#httplib.HTTPConnection>`_ to the Docker daemon.
Note: You can find more info in the `Docker API docs <https://docs.docker.com/reference/api/docker_remote_api_v1.13/>`_
"""
if not self.__connection:... | [
"def",
"getConnection",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__connection",
":",
"subuserlib",
".",
"docker",
".",
"getAndVerifyExecutable",
"(",
")",
"try",
":",
"self",
".",
"__connection",
"=",
"UHTTPConnection",
"(",
"\"/var/run/docker.sock\"",
... | https://github.com/subuser-security/subuser/blob/8072271f8fc3dded60b048c2dee878f9840c126a/subuserlib/classes/docker/dockerDaemon.py#L109-L121 | |
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/drivers/modules/redfish/raid.py | python | RedfishRAID._clear_raid_configs | (self, node) | Clears RAID configurations from driver_internal_info
Note that the caller must have an exclusive lock on the node.
:param node: the node to clear the RAID configs from | Clears RAID configurations from driver_internal_info | [
"Clears",
"RAID",
"configurations",
"from",
"driver_internal_info"
] | def _clear_raid_configs(self, node):
"""Clears RAID configurations from driver_internal_info
Note that the caller must have an exclusive lock on the node.
:param node: the node to clear the RAID configs from
"""
node.del_driver_internal_info('raid_configs')
node.save() | [
"def",
"_clear_raid_configs",
"(",
"self",
",",
"node",
")",
":",
"node",
".",
"del_driver_internal_info",
"(",
"'raid_configs'",
")",
"node",
".",
"save",
"(",
")"
] | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/drivers/modules/redfish/raid.py#L999-L1007 | ||
jbjorne/TEES | caf19a4a1352ac59f5dc13a8684cc42ce4342d9d | Detectors/ToolChain.py | python | ToolChain.defAlias | (self, name, steps) | [] | def defAlias(self, name, steps):
assert name not in self.definedStepDict
steps = [self.definedStepDict[x] for x in steps]
step = Step(name, steps, None, None, None, None, self.group)
self.definedStepDict[name] = step
self.definedSteps.append(step) | [
"def",
"defAlias",
"(",
"self",
",",
"name",
",",
"steps",
")",
":",
"assert",
"name",
"not",
"in",
"self",
".",
"definedStepDict",
"steps",
"=",
"[",
"self",
".",
"definedStepDict",
"[",
"x",
"]",
"for",
"x",
"in",
"steps",
"]",
"step",
"=",
"Step",... | https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/Detectors/ToolChain.py#L113-L118 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/api/v2010/account/available_phone_number/local.py | python | LocalInstance.iso_country | (self) | return self._properties['iso_country'] | :returns: The ISO country code of this phone number
:rtype: unicode | :returns: The ISO country code of this phone number
:rtype: unicode | [
":",
"returns",
":",
"The",
"ISO",
"country",
"code",
"of",
"this",
"phone",
"number",
":",
"rtype",
":",
"unicode"
] | def iso_country(self):
"""
:returns: The ISO country code of this phone number
:rtype: unicode
"""
return self._properties['iso_country'] | [
"def",
"iso_country",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'iso_country'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/available_phone_number/local.py#L417-L422 | |
zopefoundation/Zope | ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb | src/webdav/PropertySheets.py | python | DAVProperties.dav__lockdiscovery | (self) | return out | [] | def dav__lockdiscovery(self):
security = getSecurityManager()
user = security.getUser().getId()
vself = self.v_self()
out = '\n'
if IWriteLock.providedBy(vself):
locks = vself.wl_lockValues(killinvalids=1)
for lock in locks:
creator = loc... | [
"def",
"dav__lockdiscovery",
"(",
"self",
")",
":",
"security",
"=",
"getSecurityManager",
"(",
")",
"user",
"=",
"security",
".",
"getUser",
"(",
")",
".",
"getId",
"(",
")",
"vself",
"=",
"self",
".",
"v_self",
"(",
")",
"out",
"=",
"'\\n'",
"if",
... | https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/webdav/PropertySheets.py#L126-L146 | |||
Yuliang-Liu/Box_Discretization_Network | 5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6 | maskrcnn_benchmark/data/datasets/word_dataset.py | python | WordDataset.get_img_info | (self, index) | return img_data | [] | def get_img_info(self, index):
img_id = self.id_to_img_map[index]
img_data = self.coco.imgs[img_id]
return img_data | [
"def",
"get_img_info",
"(",
"self",
",",
"index",
")",
":",
"img_id",
"=",
"self",
".",
"id_to_img_map",
"[",
"index",
"]",
"img_data",
"=",
"self",
".",
"coco",
".",
"imgs",
"[",
"img_id",
"]",
"return",
"img_data"
] | https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/data/datasets/word_dataset.py#L105-L108 | |||
StackStorm/st2 | 85ae05b73af422efd3097c9c05351f7f1cc8369e | st2common/st2common/metrics/base.py | python | get_driver | () | return METRICS | Return metrics driver instance | Return metrics driver instance | [
"Return",
"metrics",
"driver",
"instance"
] | def get_driver():
"""
Return metrics driver instance
"""
if not METRICS:
return metrics_initialize()
return METRICS | [
"def",
"get_driver",
"(",
")",
":",
"if",
"not",
"METRICS",
":",
"return",
"metrics_initialize",
"(",
")",
"return",
"METRICS"
] | https://github.com/StackStorm/st2/blob/85ae05b73af422efd3097c9c05351f7f1cc8369e/st2common/st2common/metrics/base.py#L237-L244 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/chapters/fields.py | python | ChapterMembershipTypeModelChoiceField.label_from_instance | (self, obj) | return obj.get_price_display(renew_mode=self.renew_mode,
chapter=self.chapter) | [] | def label_from_instance(self, obj):
return obj.get_price_display(renew_mode=self.renew_mode,
chapter=self.chapter) | [
"def",
"label_from_instance",
"(",
"self",
",",
"obj",
")",
":",
"return",
"obj",
".",
"get_price_display",
"(",
"renew_mode",
"=",
"self",
".",
"renew_mode",
",",
"chapter",
"=",
"self",
".",
"chapter",
")"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/chapters/fields.py#L9-L11 | |||
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/api/openstack/compute/flavors.py | python | FlavorsController._get_flavors | (self, req) | return limited_flavors | Helper function that returns a list of flavor dicts. | Helper function that returns a list of flavor dicts. | [
"Helper",
"function",
"that",
"returns",
"a",
"list",
"of",
"flavor",
"dicts",
"."
] | def _get_flavors(self, req):
"""Helper function that returns a list of flavor dicts."""
filters = {}
sort_key = req.params.get('sort_key') or 'flavorid'
sort_dir = req.params.get('sort_dir') or 'asc'
limit, marker = common.get_limit_and_marker(req)
context = req.environ[... | [
"def",
"_get_flavors",
"(",
"self",
",",
"req",
")",
":",
"filters",
"=",
"{",
"}",
"sort_key",
"=",
"req",
".",
"params",
".",
"get",
"(",
"'sort_key'",
")",
"or",
"'flavorid'",
"sort_dir",
"=",
"req",
".",
"params",
".",
"get",
"(",
"'sort_dir'",
"... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/api/openstack/compute/flavors.py#L96-L135 | |
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/odf/element.py | python | Element.addElement | (self, element, check_grammar=True) | adds an element to an Element
Element.addElement(Element) | adds an element to an Element | [
"adds",
"an",
"element",
"to",
"an",
"Element"
] | def addElement(self, element, check_grammar=True):
""" adds an element to an Element
Element.addElement(Element)
"""
if check_grammar and self.allowed_children is not None:
if element.qname not in self.allowed_children:
raise IllegalChild("<%s> is not all... | [
"def",
"addElement",
"(",
"self",
",",
"element",
",",
"check_grammar",
"=",
"True",
")",
":",
"if",
"check_grammar",
"and",
"self",
".",
"allowed_children",
"is",
"not",
"None",
":",
"if",
"element",
".",
"qname",
"not",
"in",
"self",
".",
"allowed_childr... | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/odf/element.py#L368-L379 | ||
quantumlib/Cirq | 89f88b01d69222d3f1ec14d649b7b3a85ed9211f | cirq-core/cirq/work/observable_measurement_data.py | python | BitstringAccumulator.variance | (self, setting: InitObsSetting, *, atol: float = 1e-8) | return var | Compute the variance of the estimators of the given setting.
This is the normal variance divided by the number of samples to estimate
the certainty of our estimate of the mean. It is the standard error
of the mean, squared.
This uses `ddof=1` during the call to `np.var` for an unbiased... | Compute the variance of the estimators of the given setting. | [
"Compute",
"the",
"variance",
"of",
"the",
"estimators",
"of",
"the",
"given",
"setting",
"."
] | def variance(self, setting: InitObsSetting, *, atol: float = 1e-8):
"""Compute the variance of the estimators of the given setting.
This is the normal variance divided by the number of samples to estimate
the certainty of our estimate of the mean. It is the standard error
of the mean, s... | [
"def",
"variance",
"(",
"self",
",",
"setting",
":",
"InitObsSetting",
",",
"*",
",",
"atol",
":",
"float",
"=",
"1e-8",
")",
":",
"if",
"len",
"(",
"self",
".",
"bitstrings",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"No measurements\"",
")",... | https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/work/observable_measurement_data.py#L444-L490 | |
bearpaw/pytorch-classification | 24f1c456f48c78133088c4eefd182ca9e6199b03 | models/cifar/resnext.py | python | ResNeXtBottleneck.__init__ | (self, in_channels, out_channels, stride, cardinality, widen_factor) | Constructor
Args:
in_channels: input channel dimensionality
out_channels: output channel dimensionality
stride: conv stride. Replaces pooling layer.
cardinality: num of convolution groups.
widen_factor: factor to reduce the input dimensionality before ... | Constructor
Args:
in_channels: input channel dimensionality
out_channels: output channel dimensionality
stride: conv stride. Replaces pooling layer.
cardinality: num of convolution groups.
widen_factor: factor to reduce the input dimensionality before ... | [
"Constructor",
"Args",
":",
"in_channels",
":",
"input",
"channel",
"dimensionality",
"out_channels",
":",
"output",
"channel",
"dimensionality",
"stride",
":",
"conv",
"stride",
".",
"Replaces",
"pooling",
"layer",
".",
"cardinality",
":",
"num",
"of",
"convoluti... | def __init__(self, in_channels, out_channels, stride, cardinality, widen_factor):
""" Constructor
Args:
in_channels: input channel dimensionality
out_channels: output channel dimensionality
stride: conv stride. Replaces pooling layer.
cardinality: num of c... | [
"def",
"__init__",
"(",
"self",
",",
"in_channels",
",",
"out_channels",
",",
"stride",
",",
"cardinality",
",",
"widen_factor",
")",
":",
"super",
"(",
"ResNeXtBottleneck",
",",
"self",
")",
".",
"__init__",
"(",
")",
"D",
"=",
"cardinality",
"*",
"out_ch... | https://github.com/bearpaw/pytorch-classification/blob/24f1c456f48c78133088c4eefd182ca9e6199b03/models/cifar/resnext.py#L19-L40 | ||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/transpiler/passes/synthesis/unitary_synthesis.py | python | UnitarySynthesis.run | (self, dag: DAGCircuit) | return dag | Run the UnitarySynthesis pass on `dag`.
Args:
dag: input dag.
Returns:
Output dag with UnitaryGates synthesized to target basis.
Raises:
TranspilerError: if a 'method' was specified for the class and is not
found in the installed plugins lis... | Run the UnitarySynthesis pass on `dag`. | [
"Run",
"the",
"UnitarySynthesis",
"pass",
"on",
"dag",
"."
] | def run(self, dag: DAGCircuit) -> DAGCircuit:
"""Run the UnitarySynthesis pass on `dag`.
Args:
dag: input dag.
Returns:
Output dag with UnitaryGates synthesized to target basis.
Raises:
TranspilerError: if a 'method' was specified for the class and ... | [
"def",
"run",
"(",
"self",
",",
"dag",
":",
"DAGCircuit",
")",
"->",
"DAGCircuit",
":",
"if",
"self",
".",
"method",
"not",
"in",
"self",
".",
"plugins",
".",
"ext_plugins",
":",
"raise",
"TranspilerError",
"(",
"\"Specified method: %s not found in plugin list\"... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/transpiler/passes/synthesis/unitary_synthesis.py#L192-L283 | |
mylar3/mylar3 | fce4771c5b627f8de6868dd4ab6bc53f7b22d303 | lib/rarfile/rarfile.py | python | RarExtFile.writable | (self) | return False | Returns False.
Writing is not supported. | Returns False. | [
"Returns",
"False",
"."
] | def writable(self):
"""Returns False.
Writing is not supported.
"""
return False | [
"def",
"writable",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/mylar3/mylar3/blob/fce4771c5b627f8de6868dd4ab6bc53f7b22d303/lib/rarfile/rarfile.py#L2296-L2301 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/shutil.py | python | copystat | (src, dst) | Copy all stat info (mode bits, atime, mtime, flags) from src to dst | Copy all stat info (mode bits, atime, mtime, flags) from src to dst | [
"Copy",
"all",
"stat",
"info",
"(",
"mode",
"bits",
"atime",
"mtime",
"flags",
")",
"from",
"src",
"to",
"dst"
] | def copystat(src, dst):
"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
st = os.stat(src)
mode = stat.S_IMODE(st.st_mode)
if hasattr(os, 'utime'):
os.utime(dst, (st.st_atime, st.st_mtime))
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chfl... | [
"def",
"copystat",
"(",
"src",
",",
"dst",
")",
":",
"st",
"=",
"os",
".",
"stat",
"(",
"src",
")",
"mode",
"=",
"stat",
".",
"S_IMODE",
"(",
"st",
".",
"st_mode",
")",
"if",
"hasattr",
"(",
"os",
",",
"'utime'",
")",
":",
"os",
".",
"utime",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/shutil.py#L92-L106 | ||
openstack/kuryr-kubernetes | 513ada72685ef02cd9f3aca418ac1b2e0dc1b8ba | kuryr_kubernetes/controller/drivers/network_policy.py | python | NetworkPolicyDriver._create_svc_egress_sg_rule | (self, policy_namespace, sg_rule_body_list,
resource=None, port=None, protocol=None) | [] | def _create_svc_egress_sg_rule(self, policy_namespace, sg_rule_body_list,
resource=None, port=None, protocol=None):
# FIXME(dulek): We could probably filter by namespace here for pods
# and namespace resources?
services = driver_utils.get_services... | [
"def",
"_create_svc_egress_sg_rule",
"(",
"self",
",",
"policy_namespace",
",",
"sg_rule_body_list",
",",
"resource",
"=",
"None",
",",
"port",
"=",
"None",
",",
"protocol",
"=",
"None",
")",
":",
"# FIXME(dulek): We could probably filter by namespace here for pods",
"#... | https://github.com/openstack/kuryr-kubernetes/blob/513ada72685ef02cd9f3aca418ac1b2e0dc1b8ba/kuryr_kubernetes/controller/drivers/network_policy.py#L570-L633 | ||||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cdb/v20170320/models.py | python | SlaveInfo.__init__ | (self) | r"""
:param First: 第一备机信息
:type First: :class:`tencentcloud.cdb.v20170320.models.SlaveInstanceInfo`
:param Second: 第二备机信息
注意:此字段可能返回 null,表示取不到有效值。
:type Second: :class:`tencentcloud.cdb.v20170320.models.SlaveInstanceInfo` | r"""
:param First: 第一备机信息
:type First: :class:`tencentcloud.cdb.v20170320.models.SlaveInstanceInfo`
:param Second: 第二备机信息
注意:此字段可能返回 null,表示取不到有效值。
:type Second: :class:`tencentcloud.cdb.v20170320.models.SlaveInstanceInfo` | [
"r",
":",
"param",
"First",
":",
"第一备机信息",
":",
"type",
"First",
":",
":",
"class",
":",
"tencentcloud",
".",
"cdb",
".",
"v20170320",
".",
"models",
".",
"SlaveInstanceInfo",
":",
"param",
"Second",
":",
"第二备机信息",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"typ... | def __init__(self):
r"""
:param First: 第一备机信息
:type First: :class:`tencentcloud.cdb.v20170320.models.SlaveInstanceInfo`
:param Second: 第二备机信息
注意:此字段可能返回 null,表示取不到有效值。
:type Second: :class:`tencentcloud.cdb.v20170320.models.SlaveInstanceInfo`
"""
self.First = None... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"First",
"=",
"None",
"self",
".",
"Second",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cdb/v20170320/models.py#L9428-L9437 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Parser/asdl.py | python | Check.__init__ | (self) | [] | def __init__(self):
super(Check, self).__init__(skip=True)
self.cons = {}
self.errors = 0
self.types = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"Check",
",",
"self",
")",
".",
"__init__",
"(",
"skip",
"=",
"True",
")",
"self",
".",
"cons",
"=",
"{",
"}",
"self",
".",
"errors",
"=",
"0",
"self",
".",
"types",
"=",
"{",
"}"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Parser/asdl.py#L331-L335 | ||||
PaddlePaddle/ERNIE | 15eddb022ce1beb281777e9ab8807a1bdfa7a76e | propeller/paddle/train/hooks.py | python | CheckpointSaverHook.after_run | (self, res_list, state) | doc | doc | [
"doc"
] | def after_run(self, res_list, state):
"""doc"""
if state.gstep % self.per_step == 0 and \
state.step > self.skip_step:
self.saver.save(state) | [
"def",
"after_run",
"(",
"self",
",",
"res_list",
",",
"state",
")",
":",
"if",
"state",
".",
"gstep",
"%",
"self",
".",
"per_step",
"==",
"0",
"and",
"state",
".",
"step",
">",
"self",
".",
"skip_step",
":",
"self",
".",
"saver",
".",
"save",
"(",... | https://github.com/PaddlePaddle/ERNIE/blob/15eddb022ce1beb281777e9ab8807a1bdfa7a76e/propeller/paddle/train/hooks.py#L336-L340 | ||
elastic/apm-agent-python | 67ce41e492f91d0aaf9fdb599e11d42e5f0ea198 | elasticapm/base.py | python | Client.get_user_agent | (self) | Compiles the user agent, which will be added as a header to all requests
to the APM Server | Compiles the user agent, which will be added as a header to all requests
to the APM Server | [
"Compiles",
"the",
"user",
"agent",
"which",
"will",
"be",
"added",
"as",
"a",
"header",
"to",
"all",
"requests",
"to",
"the",
"APM",
"Server"
] | def get_user_agent(self) -> str:
"""
Compiles the user agent, which will be added as a header to all requests
to the APM Server
"""
if self.config.service_version:
service_version = re.sub(r"[^\t _\x21-\x27\x2a-\x5b\x5d-\x7e\x80-\xff]", "_", self.config.service_versio... | [
"def",
"get_user_agent",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"config",
".",
"service_version",
":",
"service_version",
"=",
"re",
".",
"sub",
"(",
"r\"[^\\t _\\x21-\\x27\\x2a-\\x5b\\x5d-\\x7e\\x80-\\xff]\"",
",",
"\"_\"",
",",
"self",
".",
"co... | https://github.com/elastic/apm-agent-python/blob/67ce41e492f91d0aaf9fdb599e11d42e5f0ea198/elasticapm/base.py#L423-L432 | ||
microsoft/ptvsd | 99c8513921021d2cc7cd82e132b65c644c256768 | src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_api.py | python | PyDevdAPI.request_load_source | (self, py_db, seq, filename) | :param str filename:
Note: must be sent as it was received in the protocol. It may be translated in this
function. | :param str filename:
Note: must be sent as it was received in the protocol. It may be translated in this
function. | [
":",
"param",
"str",
"filename",
":",
"Note",
":",
"must",
"be",
"sent",
"as",
"it",
"was",
"received",
"in",
"the",
"protocol",
".",
"It",
"may",
"be",
"translated",
"in",
"this",
"function",
"."
] | def request_load_source(self, py_db, seq, filename):
'''
:param str filename:
Note: must be sent as it was received in the protocol. It may be translated in this
function.
'''
try:
filename = self.filename_to_server(filename)
assert filenam... | [
"def",
"request_load_source",
"(",
"self",
",",
"py_db",
",",
"seq",
",",
"filename",
")",
":",
"try",
":",
"filename",
"=",
"self",
".",
"filename_to_server",
"(",
"filename",
")",
"assert",
"filename",
".",
"__class__",
"==",
"str",
"# i.e.: bytes on py2 and... | https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_api.py#L616-L632 | ||
joke2k/faker | 0ebe46fc9b9793fe315cf0fce430258ce74df6f8 | faker/providers/ssn/en_GB/__init__.py | python | Provider.vat_id | (self) | return self.bothify(self.random_element(self.vat_id_formats)) | http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
:return: A random British VAT ID | http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
:return: A random British VAT ID | [
"http",
":",
"//",
"ec",
".",
"europa",
".",
"eu",
"/",
"taxation_customs",
"/",
"vies",
"/",
"faq",
".",
"html#item_11",
":",
"return",
":",
"A",
"random",
"British",
"VAT",
"ID"
] | def vat_id(self) -> str:
"""
http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
:return: A random British VAT ID
"""
return self.bothify(self.random_element(self.vat_id_formats)) | [
"def",
"vat_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"bothify",
"(",
"self",
".",
"random_element",
"(",
"self",
".",
"vat_id_formats",
")",
")"
] | https://github.com/joke2k/faker/blob/0ebe46fc9b9793fe315cf0fce430258ce74df6f8/faker/providers/ssn/en_GB/__init__.py#L34-L39 | |
RussBaz/enforce | caf1dc3984c595a120882337fa6c2a7d23d90201 | enforce/enforcers.py | python | Enforcer.reset | (self) | Clears validator internal state | Clears validator internal state | [
"Clears",
"validator",
"internal",
"state"
] | def reset(self):
"""
Clears validator internal state
"""
self.validator.reset() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"validator",
".",
"reset",
"(",
")"
] | https://github.com/RussBaz/enforce/blob/caf1dc3984c595a120882337fa6c2a7d23d90201/enforce/enforcers.py#L104-L108 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/chardet/chardistribution.py | python | CharDistributionAnalysis.reset | (self) | reset analyser, clear any state | reset analyser, clear any state | [
"reset",
"analyser",
"clear",
"any",
"state"
] | def reset(self):
"""reset analyser, clear any state"""
# If this flag is set to True, detection is done and conclusion has
# been made
self._done = False
self._total_chars = 0 # Total characters encountered
# The number of characters whose frequency order is less than 51... | [
"def",
"reset",
"(",
"self",
")",
":",
"# If this flag is set to True, detection is done and conclusion has",
"# been made",
"self",
".",
"_done",
"=",
"False",
"self",
".",
"_total_chars",
"=",
"0",
"# Total characters encountered",
"# The number of characters whose frequency ... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/chardet/chardistribution.py#L61-L68 | ||
jacexh/pyautoit | 6bc67acbbe59d5c8620836c90d38b833c6ffaed2 | autoit/control.py | python | control_list_view_by_handle | (hwnd, h_ctrl, command, **kwargs) | return result.value.rstrip() | :param hwnd:
:param h_ctrl:
:param command:
:param kwargs:
:return: | [] | def control_list_view_by_handle(hwnd, h_ctrl, command, **kwargs):
"""
:param hwnd:
:param h_ctrl:
:param command:
:param kwargs:
:return:
"""
extra1 = kwargs.get("extra1", "")
extra2 = kwargs.get("extra2", "")
buf_size = kwargs.get("buf_size", 256)
result = ctypes.create_uni... | [
"def",
"control_list_view_by_handle",
"(",
"hwnd",
",",
"h_ctrl",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"extra1",
"=",
"kwargs",
".",
"get",
"(",
"\"extra1\"",
",",
"\"\"",
")",
"extra2",
"=",
"kwargs",
".",
"get",
"(",
"\"extra2\"",
",",
... | https://github.com/jacexh/pyautoit/blob/6bc67acbbe59d5c8620836c90d38b833c6ffaed2/autoit/control.py#L120-L138 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/colors.py | python | get_named_colors_mapping | () | return _colors_full_map | Return the global mapping of names to named colors. | Return the global mapping of names to named colors. | [
"Return",
"the",
"global",
"mapping",
"of",
"names",
"to",
"named",
"colors",
"."
] | def get_named_colors_mapping():
"""Return the global mapping of names to named colors."""
return _colors_full_map | [
"def",
"get_named_colors_mapping",
"(",
")",
":",
"return",
"_colors_full_map"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/colors.py#L101-L103 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/userreports/pillow.py | python | UcrTableManager.bootstrap_if_needed | (self) | Bootstrap the manager with data sources or else check for updated data sources | Bootstrap the manager with data sources or else check for updated data sources | [
"Bootstrap",
"the",
"manager",
"with",
"data",
"sources",
"or",
"else",
"check",
"for",
"updated",
"data",
"sources"
] | def bootstrap_if_needed(self):
"""Bootstrap the manager with data sources or else check for updated data sources"""
if self.needs_bootstrap():
self.bootstrap()
else:
self._update_modified_data_sources() | [
"def",
"bootstrap_if_needed",
"(",
"self",
")",
":",
"if",
"self",
".",
"needs_bootstrap",
"(",
")",
":",
"self",
".",
"bootstrap",
"(",
")",
"else",
":",
"self",
".",
"_update_modified_data_sources",
"(",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/userreports/pillow.py#L136-L141 | ||
robinhood/thorn | 486a53ebcf6373ff306a8d17dc016d78e880fcd6 | thorn/events.py | python | ModelEvent._connect_model_signal | (self, model) | [] | def _connect_model_signal(self, model):
# type: (Any) -> None
if self.signal_dispatcher:
self.signal_dispatcher.connect(sender=model) | [
"def",
"_connect_model_signal",
"(",
"self",
",",
"model",
")",
":",
"# type: (Any) -> None",
"if",
"self",
".",
"signal_dispatcher",
":",
"self",
".",
"signal_dispatcher",
".",
"connect",
"(",
"sender",
"=",
"model",
")"
] | https://github.com/robinhood/thorn/blob/486a53ebcf6373ff306a8d17dc016d78e880fcd6/thorn/events.py#L390-L393 | ||||
uuvsimulator/uuv_simulator | bfb40cb153684a0703173117b6bbf4258e8e71c5 | tools/cpplint.py | python | CheckForUnicodeReplacementCharacters | (filename, lines, error) | Logs an error for each line containing Unicode replacement characters.
These indicate that either the file contained invalid UTF-8 (likely)
or Unicode replacement characters (which it shouldn't). Note that
it's possible for this to throw off line numbering if the invalid
UTF-8 occurred adjacent to a newline.
... | Logs an error for each line containing Unicode replacement characters. | [
"Logs",
"an",
"error",
"for",
"each",
"line",
"containing",
"Unicode",
"replacement",
"characters",
"."
] | def CheckForUnicodeReplacementCharacters(filename, lines, error):
"""Logs an error for each line containing Unicode replacement characters.
These indicate that either the file contained invalid UTF-8 (likely)
or Unicode replacement characters (which it shouldn't). Note that
it's possible for this to throw off... | [
"def",
"CheckForUnicodeReplacementCharacters",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"for",
"linenum",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"u'\\ufffd'",
"in",
"line",
":",
"error",
"(",
"filename",
",",
"linenum",
... | https://github.com/uuvsimulator/uuv_simulator/blob/bfb40cb153684a0703173117b6bbf4258e8e71c5/tools/cpplint.py#L1100-L1116 | ||
ucsb-seclab/karonte | 427ac313e596f723e40768b95d13bd7a9fc92fd8 | tool/bbf/border_binaries_finder.py | python | BorderBinariesFinder.run | (self, pickle_file=None, bins=None) | return self._border_binaries | Run the this module algorithm
:param pickle_file: path to pickle file
:param bins: binaries to consider
:return: the list of border binaries | Run the this module algorithm
:param pickle_file: path to pickle file
:param bins: binaries to consider
:return: the list of border binaries | [
"Run",
"the",
"this",
"module",
"algorithm",
":",
"param",
"pickle_file",
":",
"path",
"to",
"pickle",
"file",
":",
"param",
"bins",
":",
"binaries",
"to",
"consider",
":",
"return",
":",
"the",
"list",
"of",
"border",
"binaries"
] | def run(self, pickle_file=None, bins=None):
"""
Run the this module algorithm
:param pickle_file: path to pickle file
:param bins: binaries to consider
:return: the list of border binaries
"""
self._start_time = time.time()
if pickle_file and os.path.isfi... | [
"def",
"run",
"(",
"self",
",",
"pickle_file",
"=",
"None",
",",
"bins",
"=",
"None",
")",
":",
"self",
".",
"_start_time",
"=",
"time",
".",
"time",
"(",
")",
"if",
"pickle_file",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"pickle_file",
")",
"... | https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/tool/bbf/border_binaries_finder.py#L569-L594 | |
craffel/mir_eval | 576aad4e0b5931e7c697c078a1153c99b885c64f | mir_eval/transcription.py | python | validate | (ref_intervals, ref_pitches, est_intervals, est_pitches) | Checks that the input annotations to a metric look like time intervals
and a pitch list, and throws helpful errors if not.
Parameters
----------
ref_intervals : np.ndarray, shape=(n,2)
Array of reference notes time intervals (onset and offset times)
ref_pitches : np.ndarray, shape=(n,)
... | Checks that the input annotations to a metric look like time intervals
and a pitch list, and throws helpful errors if not. | [
"Checks",
"that",
"the",
"input",
"annotations",
"to",
"a",
"metric",
"look",
"like",
"time",
"intervals",
"and",
"a",
"pitch",
"list",
"and",
"throws",
"helpful",
"errors",
"if",
"not",
"."
] | def validate(ref_intervals, ref_pitches, est_intervals, est_pitches):
"""Checks that the input annotations to a metric look like time intervals
and a pitch list, and throws helpful errors if not.
Parameters
----------
ref_intervals : np.ndarray, shape=(n,2)
Array of reference notes time int... | [
"def",
"validate",
"(",
"ref_intervals",
",",
"ref_pitches",
",",
"est_intervals",
",",
"est_pitches",
")",
":",
"# Validate intervals",
"validate_intervals",
"(",
"ref_intervals",
",",
"est_intervals",
")",
"# Make sure intervals and pitches match in length",
"if",
"not",
... | https://github.com/craffel/mir_eval/blob/576aad4e0b5931e7c697c078a1153c99b885c64f/mir_eval/transcription.py#L117-L149 | ||
taowen/es-monitor | c4deceb4964857f495d13bfaf2d92f36734c9e1c | es_sql/sqlparse/sql_select.py | python | SqlSelect.on_GROUP_BY | (self, tokens, idx) | [] | def on_GROUP_BY(self, tokens, idx):
while idx < len(tokens):
token = tokens[idx]
idx += 1
if token.is_whitespace():
continue
self.group_by = OrderedDict()
if isinstance(token, stypes.IdentifierList):
ids = list(token.get... | [
"def",
"on_GROUP_BY",
"(",
"self",
",",
"tokens",
",",
"idx",
")",
":",
"while",
"idx",
"<",
"len",
"(",
"tokens",
")",
":",
"token",
"=",
"tokens",
"[",
"idx",
"]",
"idx",
"+=",
"1",
"if",
"token",
".",
"is_whitespace",
"(",
")",
":",
"continue",
... | https://github.com/taowen/es-monitor/blob/c4deceb4964857f495d13bfaf2d92f36734c9e1c/es_sql/sqlparse/sql_select.py#L187-L219 | ||||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/plugins/dbms/hsqldb/connector.py | python | Connector.fetchall | (self) | [] | def fetchall(self):
try:
return self.cursor.fetchall()
except Exception, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
return None | [
"def",
"fetchall",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"cursor",
".",
"fetchall",
"(",
")",
"except",
"Exception",
",",
"msg",
":",
"logger",
".",
"log",
"(",
"logging",
".",
"WARN",
"if",
"conf",
".",
"dbmsHandler",
"else",
"lo... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/plugins/dbms/hsqldb/connector.py#L60-L65 | ||||
openstack/openstacksdk | 58384268487fa854f21c470b101641ab382c9897 | openstack/compute/v2/_proxy.py | python | Proxy.get_limits | (self) | return self._get(limits.Limits) | Retrieve limits that are applied to the project's account
:returns: A Limits object, including both
:class:`~openstack.compute.v2.limits.AbsoluteLimits` and
:class:`~openstack.compute.v2.limits.RateLimits`
:rtype: :class:`~openstack.compute.v2.limits.Limits` | Retrieve limits that are applied to the project's account | [
"Retrieve",
"limits",
"that",
"are",
"applied",
"to",
"the",
"project",
"s",
"account"
] | def get_limits(self):
"""Retrieve limits that are applied to the project's account
:returns: A Limits object, including both
:class:`~openstack.compute.v2.limits.AbsoluteLimits` and
:class:`~openstack.compute.v2.limits.RateLimits`
:rtype: :class:`~openstack.c... | [
"def",
"get_limits",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get",
"(",
"limits",
".",
"Limits",
")"
] | https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/compute/v2/_proxy.py#L591-L599 | |
theislab/anndata | 664e32b0aa6625fe593370d37174384c05abfd4e | anndata/_core/aligned_mapping.py | python | AlignedViewMixin.__setitem__ | (self, key: str, value: V) | [] | def __setitem__(self, key: str, value: V):
value = self._validate_value(value, key) # Validate before mutating
adata = self.parent.copy()
new_mapping = getattr(adata, self.attrname)
new_mapping[key] = value
self.parent._init_as_actual(adata) | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
":",
"str",
",",
"value",
":",
"V",
")",
":",
"value",
"=",
"self",
".",
"_validate_value",
"(",
"value",
",",
"key",
")",
"# Validate before mutating",
"adata",
"=",
"self",
".",
"parent",
".",
"copy",
"(... | https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_core/aligned_mapping.py#L117-L122 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/xml/sax/xmlreader.py | python | XMLReader.parse | (self, source) | Parse an XML document from a system identifier or an InputSource. | Parse an XML document from a system identifier or an InputSource. | [
"Parse",
"an",
"XML",
"document",
"from",
"a",
"system",
"identifier",
"or",
"an",
"InputSource",
"."
] | def parse(self, source):
"Parse an XML document from a system identifier or an InputSource."
raise NotImplementedError("This method must be implemented!") | [
"def",
"parse",
"(",
"self",
",",
"source",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This method must be implemented!\"",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/xml/sax/xmlreader.py#L30-L32 | ||
x1ah/Daily_scripts | fa6ad8a4f820876d98b919012e74017e9363badd | GitHubThon/github_marathon.py | python | CreatCommit.write_json | (self, pre_json) | return new_json | [] | def write_json(self, pre_json):
times = int(pre_json['commit_times']) + 1
start_from = pre_json['first_robot_commit']
start_from = ctime() if not start_from else start_from
pre_json['current_time'] = ctime()
pre_json['commit_times'] = times
pre_json['first_robot_commit'] ... | [
"def",
"write_json",
"(",
"self",
",",
"pre_json",
")",
":",
"times",
"=",
"int",
"(",
"pre_json",
"[",
"'commit_times'",
"]",
")",
"+",
"1",
"start_from",
"=",
"pre_json",
"[",
"'first_robot_commit'",
"]",
"start_from",
"=",
"ctime",
"(",
")",
"if",
"no... | https://github.com/x1ah/Daily_scripts/blob/fa6ad8a4f820876d98b919012e74017e9363badd/GitHubThon/github_marathon.py#L21-L31 | |||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | BigBirdForQuestionAnswering.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"]) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"self",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L985-L986 | ||||
angr/cle | 7dea3e72a06c7596b9ef7b884c42cb19bca7620a | cle/backends/symbol.py | python | Symbol.is_function | (self) | return self.type is SymbolType.TYPE_FUNCTION | Whether this symbol is a function | Whether this symbol is a function | [
"Whether",
"this",
"symbol",
"is",
"a",
"function"
] | def is_function(self):
"""
Whether this symbol is a function
"""
return self.type is SymbolType.TYPE_FUNCTION | [
"def",
"is_function",
"(",
"self",
")",
":",
"return",
"self",
".",
"type",
"is",
"SymbolType",
".",
"TYPE_FUNCTION"
] | https://github.com/angr/cle/blob/7dea3e72a06c7596b9ef7b884c42cb19bca7620a/cle/backends/symbol.py#L100-L104 | |
spotify/chartify | 5ac3a88e54cf620389741f396cc19d60fe032822 | chartify/_core/style.py | python | AccentPalette.set_default_color | (self, color) | Set default color of values in the 'color_column'
that are not accented. | Set default color of values in the 'color_column'
that are not accented. | [
"Set",
"default",
"color",
"of",
"values",
"in",
"the",
"color_column",
"that",
"are",
"not",
"accented",
"."
] | def set_default_color(self, color):
"""
Set default color of values in the 'color_column'
that are not accented."""
color = colors.Color(color).get_hex_l()
self._default_color = color | [
"def",
"set_default_color",
"(",
"self",
",",
"color",
")",
":",
"color",
"=",
"colors",
".",
"Color",
"(",
"color",
")",
".",
"get_hex_l",
"(",
")",
"self",
".",
"_default_color",
"=",
"color"
] | https://github.com/spotify/chartify/blob/5ac3a88e54cf620389741f396cc19d60fe032822/chartify/_core/style.py#L180-L185 | ||
Ha0Tang/SelectionGAN | 80aa7ad9f79f643c28633c40c621f208f3fb0121 | semantic_synthesis/data/ade20k_dataset.py | python | ADE20KDataset.modify_commandline_options | (parser, is_train) | return parser | [] | def modify_commandline_options(parser, is_train):
parser = Pix2pixDataset.modify_commandline_options(parser, is_train)
parser.set_defaults(preprocess_mode='resize_and_crop')
if is_train:
parser.set_defaults(load_size=286)
else:
parser.set_defaults(load_size=256)
... | [
"def",
"modify_commandline_options",
"(",
"parser",
",",
"is_train",
")",
":",
"parser",
"=",
"Pix2pixDataset",
".",
"modify_commandline_options",
"(",
"parser",
",",
"is_train",
")",
"parser",
".",
"set_defaults",
"(",
"preprocess_mode",
"=",
"'resize_and_crop'",
"... | https://github.com/Ha0Tang/SelectionGAN/blob/80aa7ad9f79f643c28633c40c621f208f3fb0121/semantic_synthesis/data/ade20k_dataset.py#L13-L27 | |||
nicolargo/glances | 00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2 | glances/main.py | python | GlancesMain.parse_args | (self) | return args | Parse command line arguments. | Parse command line arguments. | [
"Parse",
"command",
"line",
"arguments",
"."
] | def parse_args(self):
"""Parse command line arguments."""
args = self.init_args().parse_args()
# Load the configuration file, if it exists
# This function should be called after the parse_args
# because the configuration file path can be defined
self.config = Config(args... | [
"def",
"parse_args",
"(",
"self",
")",
":",
"args",
"=",
"self",
".",
"init_args",
"(",
")",
".",
"parse_args",
"(",
")",
"# Load the configuration file, if it exists",
"# This function should be called after the parse_args",
"# because the configuration file path can be define... | https://github.com/nicolargo/glances/blob/00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2/glances/main.py#L478-L656 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/landing_page_view_service/transports/grpc.py | python | LandingPageViewServiceGrpcTransport.get_landing_page_view | (
self,
) | return self._stubs["get_landing_page_view"] | r"""Return a callable for the
get landing page view
method over gRPC.
Returns the requested landing page view in full detail.
List of thrown errors: `AuthenticationError <>`__
`AuthorizationError <>`__ `HeaderError <>`__
`InternalError <>`__ `QuotaError <>`__ `Request... | r"""Return a callable for the
get landing page view
method over gRPC. | [
"r",
"Return",
"a",
"callable",
"for",
"the",
"get",
"landing",
"page",
"view",
"method",
"over",
"gRPC",
"."
] | def get_landing_page_view(
self,
) -> Callable[
[landing_page_view_service.GetLandingPageViewRequest],
landing_page_view.LandingPageView,
]:
r"""Return a callable for the
get landing page view
method over gRPC.
Returns the requested landing page view in... | [
"def",
"get_landing_page_view",
"(",
"self",
",",
")",
"->",
"Callable",
"[",
"[",
"landing_page_view_service",
".",
"GetLandingPageViewRequest",
"]",
",",
"landing_page_view",
".",
"LandingPageView",
",",
"]",
":",
"# Generate a \"stub function\" on-the-fly which will actu... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/landing_page_view_service/transports/grpc.py#L213-L247 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/pulse/instructions/phase.py | python | SetPhase.__init__ | (
self,
phase: Union[complex, ParameterExpression],
channel: PulseChannel,
name: Optional[str] = None,
) | Instantiate a set phase instruction, setting the output signal phase on ``channel``
to ``phase`` [radians].
Args:
phase: The rotation angle in radians.
channel: The channel this instruction operates on.
name: Display name for this instruction. | Instantiate a set phase instruction, setting the output signal phase on ``channel``
to ``phase`` [radians]. | [
"Instantiate",
"a",
"set",
"phase",
"instruction",
"setting",
"the",
"output",
"signal",
"phase",
"on",
"channel",
"to",
"phase",
"[",
"radians",
"]",
"."
] | def __init__(
self,
phase: Union[complex, ParameterExpression],
channel: PulseChannel,
name: Optional[str] = None,
):
"""Instantiate a set phase instruction, setting the output signal phase on ``channel``
to ``phase`` [radians].
Args:
phase: The r... | [
"def",
"__init__",
"(",
"self",
",",
"phase",
":",
"Union",
"[",
"complex",
",",
"ParameterExpression",
"]",
",",
"channel",
":",
"PulseChannel",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
":",
"super",
"(",
")",
".",
"__in... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/pulse/instructions/phase.py#L98-L112 | ||
robclewley/pydstool | 939e3abc9dd1f180d35152bacbde57e24c85ff26 | PyDSTool/Generator/baseclasses.py | python | Generator._infostr | (self, verbose=1) | return outputStr | Return detailed information about the Generator
specification. | Return detailed information about the Generator
specification. | [
"Return",
"detailed",
"information",
"about",
"the",
"Generator",
"specification",
"."
] | def _infostr(self, verbose=1):
"""Return detailed information about the Generator
specification."""
if verbose == 0:
outputStr = "Generator "+self.name
else:
outputStr = '**************************************************'
outputStr += '\n G... | [
"def",
"_infostr",
"(",
"self",
",",
"verbose",
"=",
"1",
")",
":",
"if",
"verbose",
"==",
"0",
":",
"outputStr",
"=",
"\"Generator \"",
"+",
"self",
".",
"name",
"else",
":",
"outputStr",
"=",
"'**************************************************'",
"outputStr",... | https://github.com/robclewley/pydstool/blob/939e3abc9dd1f180d35152bacbde57e24c85ff26/PyDSTool/Generator/baseclasses.py#L905-L934 | |
CastagnaIT/plugin.video.netflix | 5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a | packages/h11/_connection.py | python | Connection.our_state | (self) | return self._cstate.states[self.our_role] | The current state of whichever role we are playing. See
:ref:`state-machine` for details. | The current state of whichever role we are playing. See
:ref:`state-machine` for details. | [
"The",
"current",
"state",
"of",
"whichever",
"role",
"we",
"are",
"playing",
".",
"See",
":",
"ref",
":",
"state",
"-",
"machine",
"for",
"details",
"."
] | def our_state(self):
"""The current state of whichever role we are playing. See
:ref:`state-machine` for details.
"""
return self._cstate.states[self.our_role] | [
"def",
"our_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cstate",
".",
"states",
"[",
"self",
".",
"our_role",
"]"
] | https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/packages/h11/_connection.py#L176-L180 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | oil_lang/funcs_builtin.py | python | _Shvar_get.__call__ | (self, *args) | return expr_eval.LookupVar(self.mem, name, scope_e.Dynamic) | [] | def __call__(self, *args):
name = args[0]
return expr_eval.LookupVar(self.mem, name, scope_e.Dynamic) | [
"def",
"__call__",
"(",
"self",
",",
"*",
"args",
")",
":",
"name",
"=",
"args",
"[",
"0",
"]",
"return",
"expr_eval",
".",
"LookupVar",
"(",
"self",
".",
"mem",
",",
"name",
",",
"scope_e",
".",
"Dynamic",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/oil_lang/funcs_builtin.py#L124-L126 | |||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.gzopen | (cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs) | return t | Open gzip compressed tar archive name for reading or writing.
Appending is not allowed. | Open gzip compressed tar archive name for reading or writing.
Appending is not allowed. | [
"Open",
"gzip",
"compressed",
"tar",
"archive",
"name",
"for",
"reading",
"or",
"writing",
".",
"Appending",
"is",
"not",
"allowed",
"."
] | def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
"""Open gzip compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'")
try:
... | [
"def",
"gzopen",
"(",
"cls",
",",
"name",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"compresslevel",
"=",
"9",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"mode",
")",
">",
"1",
"or",
"mode",
"not",
"in",
"\"rw\"",
"... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L1798-L1826 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/zoneinfo/_tzpath.py | python | find_tzfile | (key) | return None | Retrieve the path to a TZif file from a key. | Retrieve the path to a TZif file from a key. | [
"Retrieve",
"the",
"path",
"to",
"a",
"TZif",
"file",
"from",
"a",
"key",
"."
] | def find_tzfile(key):
"""Retrieve the path to a TZif file from a key."""
_validate_tzfile_path(key)
for search_path in TZPATH:
filepath = os.path.join(search_path, key)
if os.path.isfile(filepath):
return filepath
return None | [
"def",
"find_tzfile",
"(",
"key",
")",
":",
"_validate_tzfile_path",
"(",
"key",
")",
"for",
"search_path",
"in",
"TZPATH",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"search_path",
",",
"key",
")",
"if",
"os",
".",
"path",
".",
"isfile... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/zoneinfo/_tzpath.py#L65-L73 | |
yhlleo/tensorflow.cifar10 | cd950323e7157e30391c123b665804b6276e38a6 | cifar10_input.py | python | read_cifar10 | (filename_queue) | return result | Reads and parses examples from CIFAR10 data files.
Recommendation: if you want N-way read parallelism, call this function
N times. This will give you N independent Readers reading different
files & positions within those files, which will give better mixing of
examples.
Args:
filename_queue: A queue of... | Reads and parses examples from CIFAR10 data files. | [
"Reads",
"and",
"parses",
"examples",
"from",
"CIFAR10",
"data",
"files",
"."
] | def read_cifar10(filename_queue):
"""Reads and parses examples from CIFAR10 data files.
Recommendation: if you want N-way read parallelism, call this function
N times. This will give you N independent Readers reading different
files & positions within those files, which will give better mixing of
examples.
... | [
"def",
"read_cifar10",
"(",
"filename_queue",
")",
":",
"class",
"CIFAR10Record",
"(",
"object",
")",
":",
"pass",
"result",
"=",
"CIFAR10Record",
"(",
")",
"# Dimensions of the images in the CIFAR-10 dataset.",
"# See http://www.cs.toronto.edu/~kriz/cifar.html for a descriptio... | https://github.com/yhlleo/tensorflow.cifar10/blob/cd950323e7157e30391c123b665804b6276e38a6/cifar10_input.py#L41-L99 | |
newsdev/elex | 0e5918e127daba3eca4a6eff03f7b228d76ec675 | elex/cli/app.py | python | ElexBaseController.clear_cache | (self) | ``elex clear-cache``
Returns data about the next election with an optional date
to start searching.
Command:
.. code:: bash
elex clear-cache
If no cache entries exist, elex will close with exit code 65. | ``elex clear-cache`` | [
"elex",
"clear",
"-",
"cache"
] | def clear_cache(self):
"""
``elex clear-cache``
Returns data about the next election with an optional date
to start searching.
Command:
.. code:: bash
elex clear-cache
If no cache entries exist, elex will close with exit code 65.
"""
... | [
"def",
"clear_cache",
"(",
"self",
")",
":",
"from",
"elex",
"import",
"cache",
"adapter",
"=",
"cache",
".",
"get_adapter",
"(",
"'http://'",
")",
"self",
".",
"app",
".",
"log",
".",
"info",
"(",
"'Clearing cache ({0})'",
".",
"format",
"(",
"adapter",
... | https://github.com/newsdev/elex/blob/0e5918e127daba3eca4a6eff03f7b228d76ec675/elex/cli/app.py#L498-L522 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.