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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0009/remote.py | python | remote | (function_argument, public = True) | Decorator for methods which are remotely callable. This decorator
works in conjunction with classes which extend ABC Endpoint.
Example:
@remote
def remote_method(arg1, arg2)
Arguments:
function_argument -- a stand-in for either the actual method
OR a new name (string) f... | Decorator for methods which are remotely callable. This decorator
works in conjunction with classes which extend ABC Endpoint.
Example: | [
"Decorator",
"for",
"methods",
"which",
"are",
"remotely",
"callable",
".",
"This",
"decorator",
"works",
"in",
"conjunction",
"with",
"classes",
"which",
"extend",
"ABC",
"Endpoint",
".",
"Example",
":"
] | def remote(function_argument, public = True):
'''
Decorator for methods which are remotely callable. This decorator
works in conjunction with classes which extend ABC Endpoint.
Example:
@remote
def remote_method(arg1, arg2)
Arguments:
function_argument -- a stand-in for eit... | [
"def",
"remote",
"(",
"function_argument",
",",
"public",
"=",
"True",
")",
":",
"if",
"hasattr",
"(",
"function_argument",
",",
"'__call__'",
")",
":",
"return",
"_intercept",
"(",
"function_argument",
",",
"None",
",",
"public",
")",
"else",
":",
"if",
"... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0009/remote.py#L37-L82 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/multiprocessing/managers.py | python | public_methods | (obj) | return [ name for name in all_methods(obj) if name[0] != '_' ] | Return a list of names of methods of `obj` which do not start with '_' | Return a list of names of methods of `obj` which do not start with '_' | [
"Return",
"a",
"list",
"of",
"names",
"of",
"methods",
"of",
"obj",
"which",
"do",
"not",
"start",
"with",
"_"
] | def public_methods(obj):
"""
Return a list of names of methods of `obj` which do not start with '_'
"""
return [ name for name in all_methods(obj) if name[0] != '_' ] | [
"def",
"public_methods",
"(",
"obj",
")",
":",
"return",
"[",
"name",
"for",
"name",
"in",
"all_methods",
"(",
"obj",
")",
"if",
"name",
"[",
"0",
"]",
"!=",
"'_'",
"]"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/multiprocessing/managers.py#L94-L98 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/locators.py | python | SimpleScrapingLocator._prepare_threads | (self) | Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages). | Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages). | [
"Threads",
"are",
"created",
"only",
"when",
"get_project",
"is",
"called",
"and",
"terminate",
"before",
"it",
"returns",
".",
"They",
"are",
"there",
"primarily",
"to",
"parallelise",
"I",
"/",
"O",
"(",
"i",
".",
"e",
".",
"fetching",
"web",
"pages",
... | def _prepare_threads(self):
"""
Threads are created only when get_project is called, and terminate
before it returns. They are there primarily to parallelise I/O (i.e.
fetching web pages).
"""
self._threads = []
for i in range(self.num_workers):
t = th... | [
"def",
"_prepare_threads",
"(",
"self",
")",
":",
"self",
".",
"_threads",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_workers",
")",
":",
"t",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"_fetch",
")",
"t... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/locators.py#L611-L622 | ||
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/parser/template/nodes/xml.py | python | TemplateXMLNode._parse_attrib | (self, graph, expression, attrib_name) | [] | def _parse_attrib(self, graph, expression, attrib_name):
attrib_value = expression.attrib[attrib_name]
if "<" in attrib_value and ">" in attrib_value:
start = attrib_value.find("<")
end = attrib_value.rfind(">")
front = attrib_value[:start]
middle = attri... | [
"def",
"_parse_attrib",
"(",
"self",
",",
"graph",
",",
"expression",
",",
"attrib_name",
")",
":",
"attrib_value",
"=",
"expression",
".",
"attrib",
"[",
"attrib_name",
"]",
"if",
"\"<\"",
"in",
"attrib_value",
"and",
"\">\"",
"in",
"attrib_value",
":",
"st... | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/parser/template/nodes/xml.py#L86-L109 | ||||
spotty-cloud/spotty | 1127c56112b33ac4772582e4edb70e2dfa4292f0 | spotty/deployment/abstract_docker_instance_manager.py | python | AbstractDockerInstanceManager.start_container | (self, output: AbstractOutputWriter, dry_run=False) | Starts or restarts container on the host OS. | Starts or restarts container on the host OS. | [
"Starts",
"or",
"restarts",
"container",
"on",
"the",
"host",
"OS",
"."
] | def start_container(self, output: AbstractOutputWriter, dry_run=False):
"""Starts or restarts container on the host OS."""
# make sure the Dockerfile exists
self._check_dockerfile_exists()
# sync the project with the instance
try:
self.sync(output, dry_run=dry_run)
... | [
"def",
"start_container",
"(",
"self",
",",
"output",
":",
"AbstractOutputWriter",
",",
"dry_run",
"=",
"False",
")",
":",
"# make sure the Dockerfile exists",
"self",
".",
"_check_dockerfile_exists",
"(",
")",
"# sync the project with the instance",
"try",
":",
"self",... | https://github.com/spotty-cloud/spotty/blob/1127c56112b33ac4772582e4edb70e2dfa4292f0/spotty/deployment/abstract_docker_instance_manager.py#L27-L45 | ||
whoosh-community/whoosh | 5421f1ab3bb802114105b3181b7ce4f44ad7d0bb | src/whoosh/lang/snowball/romanian.py | python | RomanianStemmer.stem | (self, word) | return word | Stem a Romanian word and return the stemmed form.
:param word: The word that is stemmed.
:type word: str or unicode
:return: The stemmed form.
:rtype: unicode | Stem a Romanian word and return the stemmed form. | [
"Stem",
"a",
"Romanian",
"word",
"and",
"return",
"the",
"stemmed",
"form",
"."
] | def stem(self, word):
"""
Stem a Romanian word and return the stemmed form.
:param word: The word that is stemmed.
:type word: str or unicode
:return: The stemmed form.
:rtype: unicode
"""
word = word.lower()
step1_success = False
step2_... | [
"def",
"stem",
"(",
"self",
",",
"word",
")",
":",
"word",
"=",
"word",
".",
"lower",
"(",
")",
"step1_success",
"=",
"False",
"step2_success",
"=",
"False",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"word",
")",
"-",
"1",
")",
":",
... | https://github.com/whoosh-community/whoosh/blob/5421f1ab3bb802114105b3181b7ce4f44ad7d0bb/src/whoosh/lang/snowball/romanian.py#L87-L257 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | scylla/datadog_checks/scylla/config_models/defaults.py | python | instance_auth_token | (field, value) | return get_default_field_value(field, value) | [] | def instance_auth_token(field, value):
return get_default_field_value(field, value) | [
"def",
"instance_auth_token",
"(",
"field",
",",
"value",
")",
":",
"return",
"get_default_field_value",
"(",
"field",
",",
"value",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/scylla/datadog_checks/scylla/config_models/defaults.py#L33-L34 | |||
dayorbyte/MongoAlchemy | e64ef0c87feff385637459707fe6090bd789e116 | mongoalchemy/fields/fields.py | python | EnumField.__init__ | (self, item_type, *values, **kwargs) | :param item_type: Instance of :class:`Field` to use for validation, and (un)wrapping
:param values: Possible values. ``item_type.is_valid_wrap(value)`` should be ``True`` | :param item_type: Instance of :class:`Field` to use for validation, and (un)wrapping
:param values: Possible values. ``item_type.is_valid_wrap(value)`` should be ``True`` | [
":",
"param",
"item_type",
":",
"Instance",
"of",
":",
"class",
":",
"Field",
"to",
"use",
"for",
"validation",
"and",
"(",
"un",
")",
"wrapping",
":",
"param",
"values",
":",
"Possible",
"values",
".",
"item_type",
".",
"is_valid_wrap",
"(",
"value",
")... | def __init__(self, item_type, *values, **kwargs):
''' :param item_type: Instance of :class:`Field` to use for validation, and (un)wrapping
:param values: Possible values. ``item_type.is_valid_wrap(value)`` should be ``True``
'''
super(EnumField, self).__init__(**kwargs)
self... | [
"def",
"__init__",
"(",
"self",
",",
"item_type",
",",
"*",
"values",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"EnumField",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"item_type",
"=",
"item_type",
"self",
... | https://github.com/dayorbyte/MongoAlchemy/blob/e64ef0c87feff385637459707fe6090bd789e116/mongoalchemy/fields/fields.py#L318-L324 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/build/lib.linux-x86_64-2.7/flaskbb/user/forms.py | python | ChangeUserDetailsForm.validate_avatar | (self, field) | [] | def validate_avatar(self, field):
if field.data is not None:
error, status = check_image(field.data)
if error is not None:
raise ValidationError(error)
return status | [
"def",
"validate_avatar",
"(",
"self",
",",
"field",
")",
":",
"if",
"field",
".",
"data",
"is",
"not",
"None",
":",
"error",
",",
"status",
"=",
"check_image",
"(",
"field",
".",
"data",
")",
"if",
"error",
"is",
"not",
"None",
":",
"raise",
"Valida... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/build/lib.linux-x86_64-2.7/flaskbb/user/forms.py#L114-L119 | ||||
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/future/backports/email/message.py | python | Message.set_charset | (self, charset) | Set the charset of the payload to a given character set.
charset can be a Charset instance, a string naming a character set, or
None. If it is a string it will be converted to a Charset instance.
If charset is None, the charset parameter will be removed from the
Content-Type field. An... | Set the charset of the payload to a given character set. | [
"Set",
"the",
"charset",
"of",
"the",
"payload",
"to",
"a",
"given",
"character",
"set",
"."
] | def set_charset(self, charset):
"""Set the charset of the payload to a given character set.
charset can be a Charset instance, a string naming a character set, or
None. If it is a string it will be converted to a Charset instance.
If charset is None, the charset parameter will be remov... | [
"def",
"set_charset",
"(",
"self",
",",
"charset",
")",
":",
"if",
"charset",
"is",
"None",
":",
"self",
".",
"del_param",
"(",
"'charset'",
")",
"self",
".",
"_charset",
"=",
"None",
"return",
"if",
"not",
"isinstance",
"(",
"charset",
",",
"Charset",
... | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/future/backports/email/message.py#L287-L323 | ||
sendgrid/sendgrid-python | df13b78b0cdcb410b4516f6761c4d3138edd4b2d | sendgrid/helpers/mail/personalization.py | python | Personalization.add_email | (self, email) | [] | def add_email(self, email):
email_type = type(email)
if email_type.__name__ == 'To':
self.add_to(email)
return
if email_type.__name__ == 'Cc':
self.add_cc(email)
return
if email_type.__name__ == 'Bcc':
self.add_bcc(email)
... | [
"def",
"add_email",
"(",
"self",
",",
"email",
")",
":",
"email_type",
"=",
"type",
"(",
"email",
")",
"if",
"email_type",
".",
"__name__",
"==",
"'To'",
":",
"self",
".",
"add_to",
"(",
"email",
")",
"return",
"if",
"email_type",
".",
"__name__",
"=="... | https://github.com/sendgrid/sendgrid-python/blob/df13b78b0cdcb410b4516f6761c4d3138edd4b2d/sendgrid/helpers/mail/personalization.py#L19-L33 | ||||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/manipulation_shapes/equation.py | python | getManipulatedPaths | (close, elementNode, loop, prefix, sideLength) | return [loop] | Get equated paths. | Get equated paths. | [
"Get",
"equated",
"paths",
"."
] | def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
"Get equated paths."
equatePoints(elementNode, loop, prefix, 0.0)
return [loop] | [
"def",
"getManipulatedPaths",
"(",
"close",
",",
"elementNode",
",",
"loop",
",",
"prefix",
",",
"sideLength",
")",
":",
"equatePoints",
"(",
"elementNode",
",",
"loop",
",",
"prefix",
",",
"0.0",
")",
"return",
"[",
"loop",
"]"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/manipulation_shapes/equation.py#L59-L62 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | twistedcaldav/authkerb.py | python | BasicKerberosCredentialFactory.__init__ | (self, principal=None, serviceType=None, hostname=None) | @param principal: full Kerberos principal (e.g., 'HTTP/server.example.com@EXAMPLE.COM'). If C{None}
then the type and hostname arguments are used instead.
@type principal: str
@param serviceType: service type for Kerberos (e.g., 'HTTP'). Must be C{None} if principal used.
... | [] | def __init__(self, principal=None, serviceType=None, hostname=None):
"""
@param principal: full Kerberos principal (e.g., 'HTTP/server.example.com@EXAMPLE.COM'). If C{None}
then the type and hostname arguments are used instead.
@type principal: str
@param serviceType: ... | [
"def",
"__init__",
"(",
"self",
",",
"principal",
"=",
"None",
",",
"serviceType",
"=",
"None",
",",
"hostname",
"=",
"None",
")",
":",
"super",
"(",
"BasicKerberosCredentialFactory",
",",
"self",
")",
".",
"__init__",
"(",
"principal",
",",
"serviceType",
... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/authkerb.py#L138-L150 | |||
polyaxon/polyaxon | e28d82051c2b61a84d06ce4d2388a40fc8565469 | src/core/polyaxon/config_reader/manager.py | python | ConfigManager.get_auth | (
self,
key,
is_list=False,
is_optional=False,
is_secret=False,
is_local=False,
default=None,
options=None,
) | return self._get(
key=key,
parser_fct=parser.get_auth,
is_list=is_list,
is_optional=is_optional,
is_secret=is_secret,
is_local=is_local,
default=default,
options=options,
) | Get the value corresponding to the key and converts it to `V1AuthType`.
Args
key: the dict key.
is_list: If this is one element or a list of elements.
is_optional: To raise an error if key was not found.
is_secret: If the key is a secret.
is_local: If... | Get the value corresponding to the key and converts it to `V1AuthType`. | [
"Get",
"the",
"value",
"corresponding",
"to",
"the",
"key",
"and",
"converts",
"it",
"to",
"V1AuthType",
"."
] | def get_auth(
self,
key,
is_list=False,
is_optional=False,
is_secret=False,
is_local=False,
default=None,
options=None,
) -> V1AuthType:
"""
Get the value corresponding to the key and converts it to `V1AuthType`.
Args
... | [
"def",
"get_auth",
"(",
"self",
",",
"key",
",",
"is_list",
"=",
"False",
",",
"is_optional",
"=",
"False",
",",
"is_secret",
"=",
"False",
",",
"is_local",
"=",
"False",
",",
"default",
"=",
"None",
",",
"options",
"=",
"None",
",",
")",
"->",
"V1Au... | https://github.com/polyaxon/polyaxon/blob/e28d82051c2b61a84d06ce4d2388a40fc8565469/src/core/polyaxon/config_reader/manager.py#L329-L363 | |
Karmenzind/fp-server | 931fca8fab9d7397c52cf9e76a76b1c60e190403 | src/core/web.py | python | WebHandler.do_complete | (self) | wind up
* may add calculation or logging here | wind up
* may add calculation or logging here | [
"wind",
"up",
"*",
"may",
"add",
"calculation",
"or",
"logging",
"here"
] | async def do_complete(self):
""" wind up
* may add calculation or logging here
"""
middlewares = options.middlewares
for m in middlewares:
await m.finish(self) | [
"async",
"def",
"do_complete",
"(",
"self",
")",
":",
"middlewares",
"=",
"options",
".",
"middlewares",
"for",
"m",
"in",
"middlewares",
":",
"await",
"m",
".",
"finish",
"(",
"self",
")"
] | https://github.com/Karmenzind/fp-server/blob/931fca8fab9d7397c52cf9e76a76b1c60e190403/src/core/web.py#L192-L199 | ||
PlasmaPy/PlasmaPy | 78d63e341216475ce3318e1409296480407c9019 | plasmapy/particles/ionization_state.py | python | IonizationState.kappa | (self, value: Real) | Set the kappa parameter for a kappa distribution function for
electrons. The value must be between ``1.5`` and `~numpy.inf`. | Set the kappa parameter for a kappa distribution function for
electrons. The value must be between ``1.5`` and `~numpy.inf`. | [
"Set",
"the",
"kappa",
"parameter",
"for",
"a",
"kappa",
"distribution",
"function",
"for",
"electrons",
".",
"The",
"value",
"must",
"be",
"between",
"1",
".",
"5",
"and",
"~numpy",
".",
"inf",
"."
] | def kappa(self, value: Real):
"""
Set the kappa parameter for a kappa distribution function for
electrons. The value must be between ``1.5`` and `~numpy.inf`.
"""
kappa_errmsg = "kappa must be a real number greater than 1.5"
if not isinstance(value, Real):
ra... | [
"def",
"kappa",
"(",
"self",
",",
"value",
":",
"Real",
")",
":",
"kappa_errmsg",
"=",
"\"kappa must be a real number greater than 1.5\"",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Real",
")",
":",
"raise",
"TypeError",
"(",
"kappa_errmsg",
")",
"if",
"va... | https://github.com/PlasmaPy/PlasmaPy/blob/78d63e341216475ce3318e1409296480407c9019/plasmapy/particles/ionization_state.py#L684-L694 | ||
facebookresearch/pyrobot | 27ffd64bbb7ce3ff6ec4b2122d84b438d5641d0f | src/pyrobot/locobot/camera.py | python | SimpleCamera.get_link_transform | (self, src, tgt) | return trans, rot, T | Returns the latest transformation from the
target_frame to the source frame,
i.e., the transform of source frame w.r.t
target frame. If the returned
transform is applied to data, it will transform
data in the source_frame into
the target_frame
For more informatio... | Returns the latest transformation from the
target_frame to the source frame,
i.e., the transform of source frame w.r.t
target frame. If the returned
transform is applied to data, it will transform
data in the source_frame into
the target_frame | [
"Returns",
"the",
"latest",
"transformation",
"from",
"the",
"target_frame",
"to",
"the",
"source",
"frame",
"i",
".",
"e",
".",
"the",
"transform",
"of",
"source",
"frame",
"w",
".",
"r",
".",
"t",
"target",
"frame",
".",
"If",
"the",
"returned",
"trans... | def get_link_transform(self, src, tgt):
"""
Returns the latest transformation from the
target_frame to the source frame,
i.e., the transform of source frame w.r.t
target frame. If the returned
transform is applied to data, it will transform
data in the source_fram... | [
"def",
"get_link_transform",
"(",
"self",
",",
"src",
",",
"tgt",
")",
":",
"trans",
",",
"quat",
"=",
"prutil",
".",
"get_tf_transform",
"(",
"self",
".",
"_tf_listener",
",",
"tgt",
",",
"src",
")",
"rot",
"=",
"prutil",
".",
"quat_to_rot_mat",
"(",
... | https://github.com/facebookresearch/pyrobot/blob/27ffd64bbb7ce3ff6ec4b2122d84b438d5641d0f/src/pyrobot/locobot/camera.py#L139-L171 | |
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/Crypto/Random/random.py | python | StrongRandom.choice | (self, seq) | return seq[self.randrange(len(seq))] | Return a random element from a (non-empty) sequence.
If the seqence is empty, raises IndexError. | Return a random element from a (non-empty) sequence. | [
"Return",
"a",
"random",
"element",
"from",
"a",
"(",
"non",
"-",
"empty",
")",
"sequence",
"."
] | def choice(self, seq):
"""Return a random element from a (non-empty) sequence.
If the seqence is empty, raises IndexError.
"""
if len(seq) == 0:
raise IndexError("empty sequence")
return seq[self.randrange(len(seq))] | [
"def",
"choice",
"(",
"self",
",",
"seq",
")",
":",
"if",
"len",
"(",
"seq",
")",
"==",
"0",
":",
"raise",
"IndexError",
"(",
"\"empty sequence\"",
")",
"return",
"seq",
"[",
"self",
".",
"randrange",
"(",
"len",
"(",
"seq",
")",
")",
"]"
] | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/Crypto/Random/random.py#L95-L102 | |
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/cui/settings.py | python | PhonopyConfParser._set_settings | (self) | [] | def _set_settings(self):
self.set_settings()
params = self._parameters
# Create FORCE_SETS
if "create_force_sets" in params:
self._settings.set_create_force_sets(params["create_force_sets"])
if "create_force_sets_zero" in params:
self._settings.set_creat... | [
"def",
"_set_settings",
"(",
"self",
")",
":",
"self",
".",
"set_settings",
"(",
")",
"params",
"=",
"self",
".",
"_parameters",
"# Create FORCE_SETS",
"if",
"\"create_force_sets\"",
"in",
"params",
":",
"self",
".",
"_settings",
".",
"set_create_force_sets",
"(... | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/cui/settings.py#L2104-L2393 | ||||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py | python | GcloudCLI._list_manifests | (self, deployment, mname=None) | return self.gcloud_cmd(cmd, output=True, output_type='json') | list manifests
if a name is specified then perform a describe | list manifests
if a name is specified then perform a describe | [
"list",
"manifests",
"if",
"a",
"name",
"is",
"specified",
"then",
"perform",
"a",
"describe"
] | def _list_manifests(self, deployment, mname=None):
''' list manifests
if a name is specified then perform a describe
'''
cmd = ['deployment-manager', 'manifests', '--deployment', deployment]
if mname:
cmd.extend(['describe', mname])
else:
cmd.a... | [
"def",
"_list_manifests",
"(",
"self",
",",
"deployment",
",",
"mname",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'deployment-manager'",
",",
"'manifests'",
",",
"'--deployment'",
",",
"deployment",
"]",
"if",
"mname",
":",
"cmd",
".",
"extend",
"(",
"[",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py#L143-L155 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/clients/torrent/rtorrent.py | python | RTorrentAPI.test_authentication | (self) | Test connection using authentication.
:return:
:rtype: tuple(bool, str) | Test connection using authentication. | [
"Test",
"connection",
"using",
"authentication",
"."
] | def test_authentication(self):
"""Test connection using authentication.
:return:
:rtype: tuple(bool, str)
"""
try:
self.auth = None
self._get_auth()
except Exception:
return False, f'Error: Unable to connect to {self.name}'
els... | [
"def",
"test_authentication",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"auth",
"=",
"None",
"self",
".",
"_get_auth",
"(",
")",
"except",
"Exception",
":",
"return",
"False",
",",
"f'Error: Unable to connect to {self.name}'",
"else",
":",
"if",
"self",
... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/clients/torrent/rtorrent.py#L127-L142 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/idlelib/AutoCompleteWindow.py | python | AutoCompleteWindow._binary_search | (self, s) | return min(i, len(self.completions)-1) | Find the first index in self.completions where completions[i] is
greater or equal to s, or the last index if there is no such
one. | Find the first index in self.completions where completions[i] is
greater or equal to s, or the last index if there is no such
one. | [
"Find",
"the",
"first",
"index",
"in",
"self",
".",
"completions",
"where",
"completions",
"[",
"i",
"]",
"is",
"greater",
"or",
"equal",
"to",
"s",
"or",
"the",
"last",
"index",
"if",
"there",
"is",
"no",
"such",
"one",
"."
] | def _binary_search(self, s):
"""Find the first index in self.completions where completions[i] is
greater or equal to s, or the last index if there is no such
one."""
i = 0; j = len(self.completions)
while j > i:
m = (i + j) // 2
if self.completions[m] >= s... | [
"def",
"_binary_search",
"(",
"self",
",",
"s",
")",
":",
"i",
"=",
"0",
"j",
"=",
"len",
"(",
"self",
".",
"completions",
")",
"while",
"j",
">",
"i",
":",
"m",
"=",
"(",
"i",
"+",
"j",
")",
"//",
"2",
"if",
"self",
".",
"completions",
"[",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/AutoCompleteWindow.py#L69-L80 | |
viblo/pymunk | 77647ca037d5ceabd728f20f37d2da8a3bfb73a0 | pymunk/vec2d.py | python | Vec2d.rotated | (self, angle_radians: float) | return Vec2d(x, y) | Create and return a new vector by rotating this vector by
angle_radians radians.
:return: Rotated vector | Create and return a new vector by rotating this vector by
angle_radians radians. | [
"Create",
"and",
"return",
"a",
"new",
"vector",
"by",
"rotating",
"this",
"vector",
"by",
"angle_radians",
"radians",
"."
] | def rotated(self, angle_radians: float) -> "Vec2d":
"""Create and return a new vector by rotating this vector by
angle_radians radians.
:return: Rotated vector
"""
cos = math.cos(angle_radians)
sin = math.sin(angle_radians)
x = self.x * cos - self.y * sin
... | [
"def",
"rotated",
"(",
"self",
",",
"angle_radians",
":",
"float",
")",
"->",
"\"Vec2d\"",
":",
"cos",
"=",
"math",
".",
"cos",
"(",
"angle_radians",
")",
"sin",
"=",
"math",
".",
"sin",
"(",
"angle_radians",
")",
"x",
"=",
"self",
".",
"x",
"*",
"... | https://github.com/viblo/pymunk/blob/77647ca037d5ceabd728f20f37d2da8a3bfb73a0/pymunk/vec2d.py#L218-L228 | |
celiao/tmdbsimple | 2c046367866667102b78247db708c0ac275f805d | tmdbsimple/genres.py | python | Genres.movie_list | (self, **kwargs) | return response | Get the list of official genres for movies.
Args:
language: (optional) ISO 639-1 code.
Returns:
A dict respresentation of the JSON returned from the API. | Get the list of official genres for movies. | [
"Get",
"the",
"list",
"of",
"official",
"genres",
"for",
"movies",
"."
] | def movie_list(self, **kwargs):
"""
Get the list of official genres for movies.
Args:
language: (optional) ISO 639-1 code.
Returns:
A dict respresentation of the JSON returned from the API.
"""
path = self._get_path('movie_list')
respons... | [
"def",
"movie_list",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"self",
".",
"_get_path",
"(",
"'movie_list'",
")",
"response",
"=",
"self",
".",
"_GET",
"(",
"path",
",",
"kwargs",
")",
"self",
".",
"_set_attrs_to_values",
"(",
"resp... | https://github.com/celiao/tmdbsimple/blob/2c046367866667102b78247db708c0ac275f805d/tmdbsimple/genres.py#L34-L48 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Tools/gdb/libpython.py | python | PyObjectPtr.as_address | (self) | return long(self._gdbval) | [] | def as_address(self):
return long(self._gdbval) | [
"def",
"as_address",
"(",
"self",
")",
":",
"return",
"long",
"(",
"self",
".",
"_gdbval",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/gdb/libpython.py#L388-L389 | |||
asweigart/PythonStdioGames | 8bdabf93e6b1bb6af3e26fea24da93f85e8314b6 | src/gamesbyexample/guillotine.py | python | getPlayerGuess | (alreadyGuessed) | Returns the letter the player entered. This function makes sure the
player entered a single letter they haven't guessed before. | Returns the letter the player entered. This function makes sure the
player entered a single letter they haven't guessed before. | [
"Returns",
"the",
"letter",
"the",
"player",
"entered",
".",
"This",
"function",
"makes",
"sure",
"the",
"player",
"entered",
"a",
"single",
"letter",
"they",
"haven",
"t",
"guessed",
"before",
"."
] | def getPlayerGuess(alreadyGuessed):
"""Returns the letter the player entered. This function makes sure the
player entered a single letter they haven't guessed before."""
while True: # Keep asking until the player enters a valid letter.
print('Guess a letter.')
guess = input('> ')
gue... | [
"def",
"getPlayerGuess",
"(",
"alreadyGuessed",
")",
":",
"while",
"True",
":",
"# Keep asking until the player enters a valid letter.",
"print",
"(",
"'Guess a letter.'",
")",
"guess",
"=",
"input",
"(",
"'> '",
")",
"guess",
"=",
"guess",
".",
"upper",
"(",
")",... | https://github.com/asweigart/PythonStdioGames/blob/8bdabf93e6b1bb6af3e26fea24da93f85e8314b6/src/gamesbyexample/guillotine.py#L144-L158 | ||
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/db/sqlalchemy/api.py | python | _filter_host | (field, value, match_level=None) | return or_(*conditions) | Generate a filter condition for host and cluster fields.
Levels are:
- 'pool': Will search for an exact match
- 'backend': Will search for exact match and value#*
- 'host'; Will search for exact match, value@* and value#*
If no level is provided we'll determine it based on the value we want to
... | Generate a filter condition for host and cluster fields. | [
"Generate",
"a",
"filter",
"condition",
"for",
"host",
"and",
"cluster",
"fields",
"."
] | def _filter_host(field, value, match_level=None):
"""Generate a filter condition for host and cluster fields.
Levels are:
- 'pool': Will search for an exact match
- 'backend': Will search for exact match and value#*
- 'host'; Will search for exact match, value@* and value#*
If no level is prov... | [
"def",
"_filter_host",
"(",
"field",
",",
"value",
",",
"match_level",
"=",
"None",
")",
":",
"# If we don't set level we'll try to determine it automatically. LIKE",
"# operations are expensive, so we try to reduce them to the minimum.",
"if",
"match_level",
"is",
"None",
":",
... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/db/sqlalchemy/api.py#L372-L415 | |
OpenMDAO/OpenMDAO | f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd | openmdao/core/driver.py | python | RecordingDebugging.__exit__ | (self, *args) | Do things after the code inside the 'with RecordingDebugging' block.
Parameters
----------
*args : array
Solver recording requires extra args. | Do things after the code inside the 'with RecordingDebugging' block. | [
"Do",
"things",
"after",
"the",
"code",
"inside",
"the",
"with",
"RecordingDebugging",
"block",
"."
] | def __exit__(self, *args):
"""
Do things after the code inside the 'with RecordingDebugging' block.
Parameters
----------
*args : array
Solver recording requires extra args.
"""
self.recording_requester()._post_run_model_debug_print()
super().... | [
"def",
"__exit__",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"recording_requester",
"(",
")",
".",
"_post_run_model_debug_print",
"(",
")",
"super",
"(",
")",
".",
"__exit__",
"(",
")"
] | https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/core/driver.py#L1235-L1245 | ||
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/manageorg/_content.py | python | Item.listed | (self) | return self._listed | gets the property value for listed | gets the property value for listed | [
"gets",
"the",
"property",
"value",
"for",
"listed"
] | def listed(self):
'''gets the property value for listed'''
if self._listed is None:
self.__init()
return self._listed | [
"def",
"listed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_listed",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"return",
"self",
".",
"_listed"
] | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L471-L475 | |
amanusk/s-tui | d7a9ee4efbfc6f56b373a16dcd578881c534b2ce | s_tui/helper_functions.py | python | str_to_bool | (string) | Converts a string to a boolean | Converts a string to a boolean | [
"Converts",
"a",
"string",
"to",
"a",
"boolean"
] | def str_to_bool(string):
""" Converts a string to a boolean """
if string == 'True':
return True
if string == 'False':
return False
raise ValueError | [
"def",
"str_to_bool",
"(",
"string",
")",
":",
"if",
"string",
"==",
"'True'",
":",
"return",
"True",
"if",
"string",
"==",
"'False'",
":",
"return",
"False",
"raise",
"ValueError"
] | https://github.com/amanusk/s-tui/blob/d7a9ee4efbfc6f56b373a16dcd578881c534b2ce/s_tui/helper_functions.py#L230-L236 | ||
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/core/layers.py | python | BaseConv2DLayer._GetWeights | (self,
theta,
convolution_lambda,
folded_bn_padding,
cast_dtype=None) | return filter_w, b | Gets a dictionary of weights and biases for the convolution.
This is necessary for some operating modes where the weights are fused
with batch normalization differently for training vs eval.
Args:
theta: A `.NestedMap` object containing underlying weights values of this
layer and its childre... | Gets a dictionary of weights and biases for the convolution. | [
"Gets",
"a",
"dictionary",
"of",
"weights",
"and",
"biases",
"for",
"the",
"convolution",
"."
] | def _GetWeights(self,
theta,
convolution_lambda,
folded_bn_padding,
cast_dtype=None):
"""Gets a dictionary of weights and biases for the convolution.
This is necessary for some operating modes where the weights are fused
with batch nor... | [
"def",
"_GetWeights",
"(",
"self",
",",
"theta",
",",
"convolution_lambda",
",",
"folded_bn_padding",
",",
"cast_dtype",
"=",
"None",
")",
":",
"p",
"=",
"self",
".",
"params",
"# Original weights.",
"filter_w",
"=",
"theta",
".",
"w",
"filter_output_shape",
"... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/layers.py#L379-L455 | |
omergertel/pyformance | b71056eaf9af6cafd3e3c4a416412ae425bdc82e | pyformance/stats/moving_average.py | python | ExpWeightedMovingAvg.get_rate | (self) | return 0 | [] | def get_rate(self):
if self.clock.time() - self.last_tick >= self.interval:
self.tick()
if self.rate >= 0:
return self.rate
return 0 | [
"def",
"get_rate",
"(",
"self",
")",
":",
"if",
"self",
".",
"clock",
".",
"time",
"(",
")",
"-",
"self",
".",
"last_tick",
">=",
"self",
".",
"interval",
":",
"self",
".",
"tick",
"(",
")",
"if",
"self",
".",
"rate",
">=",
"0",
":",
"return",
... | https://github.com/omergertel/pyformance/blob/b71056eaf9af6cafd3e3c4a416412ae425bdc82e/pyformance/stats/moving_average.py#L31-L36 | |||
modflowpy/flopy | eecd1ad193c5972093c9712e5c4b7a83284f0688 | flopy/mf6/data/mfdataarray.py | python | MFTransientArray._get_array | (self, num_sp, apply_mult, **kwargs) | return output | Returns all data up to stress period num_sp in a single array.
If `layer` is None, returns all data for time `layer`.
Parameters
----------
num_sp : int
Zero-based stress period of data to return all data up to
apply_mult : bool
Whether to... | Returns all data up to stress period num_sp in a single array.
If `layer` is None, returns all data for time `layer`. | [
"Returns",
"all",
"data",
"up",
"to",
"stress",
"period",
"num_sp",
"in",
"a",
"single",
"array",
".",
"If",
"layer",
"is",
"None",
"returns",
"all",
"data",
"for",
"time",
"layer",
"."
] | def _get_array(self, num_sp, apply_mult, **kwargs):
"""Returns all data up to stress period num_sp in a single array.
If `layer` is None, returns all data for time `layer`.
Parameters
----------
num_sp : int
Zero-based stress period of data to return all data... | [
"def",
"_get_array",
"(",
"self",
",",
"num_sp",
",",
"apply_mult",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"None",
"output",
"=",
"None",
"for",
"sp",
"in",
"range",
"(",
"0",
",",
"num_sp",
")",
":",
"if",
"sp",
"in",
"self",
".",
"_dat... | https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/mf6/data/mfdataarray.py#L1607-L1648 | |
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/ext/makerbot_driver/errors.py | python | PacketDecodeError.__init__ | (self, actual, expected) | [] | def __init__(self, actual, expected):
self.value = {
'ExpectedValue': expected,
'ActualValue': actual,
} | [
"def",
"__init__",
"(",
"self",
",",
"actual",
",",
"expected",
")",
":",
"self",
".",
"value",
"=",
"{",
"'ExpectedValue'",
":",
"expected",
",",
"'ActualValue'",
":",
"actual",
",",
"}"
] | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/ext/makerbot_driver/errors.py#L16-L20 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/encodings/cp775.py | python | Codec.decode | (self,input,errors='strict') | return codecs.charmap_decode(input,errors,decoding_table) | [] | def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table) | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"return",
"codecs",
".",
"charmap_decode",
"(",
"input",
",",
"errors",
",",
"decoding_table",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/encodings/cp775.py#L14-L15 | |||
tensorwerk/hangar-py | a6deb22854a6c9e9709011b91c1c0eeda7f47bb0 | src/hangar/columns/layout_flat.py | python | FlatSampleReader.schema_type | (self) | return self._schema.schema_type | Schema type of the contained data ('variable_shape', 'fixed_shape', etc). | Schema type of the contained data ('variable_shape', 'fixed_shape', etc). | [
"Schema",
"type",
"of",
"the",
"contained",
"data",
"(",
"variable_shape",
"fixed_shape",
"etc",
")",
"."
] | def schema_type(self):
"""Schema type of the contained data ('variable_shape', 'fixed_shape', etc).
"""
return self._schema.schema_type | [
"def",
"schema_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"_schema",
".",
"schema_type"
] | https://github.com/tensorwerk/hangar-py/blob/a6deb22854a6c9e9709011b91c1c0eeda7f47bb0/src/hangar/columns/layout_flat.py#L270-L273 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/wsgiref/simple_server.py | python | WSGIServer.server_bind | (self) | Override server_bind to store the server name. | Override server_bind to store the server name. | [
"Override",
"server_bind",
"to",
"store",
"the",
"server",
"name",
"."
] | def server_bind(self):
"""Override server_bind to store the server name."""
HTTPServer.server_bind(self)
self.setup_environ() | [
"def",
"server_bind",
"(",
"self",
")",
":",
"HTTPServer",
".",
"server_bind",
"(",
"self",
")",
"self",
".",
"setup_environ",
"(",
")"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/wsgiref/simple_server.py#L48-L51 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/template/defaulttags.py | python | cycle | (parser, token) | return node | Cycles among the given strings each time this tag is encountered.
Within a loop, cycles among the given strings each time through
the loop::
{% for o in some_list %}
<tr class="{% cycle 'row1' 'row2' %}">
...
</tr>
{% endfor %}
Outside of a loop, gi... | Cycles among the given strings each time this tag is encountered. | [
"Cycles",
"among",
"the",
"given",
"strings",
"each",
"time",
"this",
"tag",
"is",
"encountered",
"."
] | def cycle(parser, token):
"""
Cycles among the given strings each time this tag is encountered.
Within a loop, cycles among the given strings each time through
the loop::
{% for o in some_list %}
<tr class="{% cycle 'row1' 'row2' %}">
...
</tr>
{... | [
"def",
"cycle",
"(",
"parser",
",",
"token",
")",
":",
"# Note: This returns the exact same node on each {% cycle name %} call;",
"# that is, the node object returned from {% cycle a b c as name %} and the",
"# one returned from {% cycle name %} are the exact same object. This",
"# shouldn't c... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/template/defaulttags.py#L530-L619 | |
aws/sagemaker-python-sdk | 9d259b316f7f43838c16f35c10e98a110b56735b | src/sagemaker/analytics.py | python | ExperimentAnalytics._reshape_artifacts | (self, artifacts, _artifact_names) | return out | Reshape trial component input/output artifacts to a pandas column.
Args:
artifacts: trial component input/output artifacts
Returns:
dict: Key: artifacts name, Value: artifacts value | Reshape trial component input/output artifacts to a pandas column. | [
"Reshape",
"trial",
"component",
"input",
"/",
"output",
"artifacts",
"to",
"a",
"pandas",
"column",
"."
] | def _reshape_artifacts(self, artifacts, _artifact_names):
"""Reshape trial component input/output artifacts to a pandas column.
Args:
artifacts: trial component input/output artifacts
Returns:
dict: Key: artifacts name, Value: artifacts value
"""
out = Or... | [
"def",
"_reshape_artifacts",
"(",
"self",
",",
"artifacts",
",",
"_artifact_names",
")",
":",
"out",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
",",
"value",
"in",
"sorted",
"(",
"artifacts",
".",
"items",
"(",
")",
")",
":",
"if",
"_artifact_names",
"... | https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/analytics.py#L605-L619 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/PaloAltoNetworks_IoT3rdParty/Scripts/SendAllPANWIoTDevicesToCiscoISE/SendAllPANWIoTDevicesToCiscoISE.py | python | send_status_to_panw_iot_cloud | (status, msg) | Reports status details back to PANW IoT Cloud.
param status: Status (error, disabled, success) to be send to PANW IoT cloud.
param msg: Debug message to be send to PANW IoT cloud. | Reports status details back to PANW IoT Cloud.
param status: Status (error, disabled, success) to be send to PANW IoT cloud.
param msg: Debug message to be send to PANW IoT cloud. | [
"Reports",
"status",
"details",
"back",
"to",
"PANW",
"IoT",
"Cloud",
".",
"param",
"status",
":",
"Status",
"(",
"error",
"disabled",
"success",
")",
"to",
"be",
"send",
"to",
"PANW",
"IoT",
"cloud",
".",
"param",
"msg",
":",
"Debug",
"message",
"to",
... | def send_status_to_panw_iot_cloud(status, msg):
"""
Reports status details back to PANW IoT Cloud.
param status: Status (error, disabled, success) to be send to PANW IoT cloud.
param msg: Debug message to be send to PANW IoT cloud.
"""
resp = demisto.executeCommand("panw-iot-3rd-party-report-sta... | [
"def",
"send_status_to_panw_iot_cloud",
"(",
"status",
",",
"msg",
")",
":",
"resp",
"=",
"demisto",
".",
"executeCommand",
"(",
"\"panw-iot-3rd-party-report-status-to-panw\"",
",",
"{",
"\"status\"",
":",
"status",
",",
"\"message\"",
":",
"msg",
",",
"\"integratio... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/PaloAltoNetworks_IoT3rdParty/Scripts/SendAllPANWIoTDevicesToCiscoISE/SendAllPANWIoTDevicesToCiscoISE.py#L37-L55 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/plat-mac/pimp.py | python | PimpPackage.downloadPackageOnly | (self, output=None) | Download a single package, if needed.
An MD5 signature is used to determine whether download is needed,
and to test that we actually downloaded what we expected.
If output is given it is a file-like object that will receive a log
of what happens.
If anything unforeseen happened... | Download a single package, if needed. | [
"Download",
"a",
"single",
"package",
"if",
"needed",
"."
] | def downloadPackageOnly(self, output=None):
"""Download a single package, if needed.
An MD5 signature is used to determine whether download is needed,
and to test that we actually downloaded what we expected.
If output is given it is a file-like object that will receive a log
of... | [
"def",
"downloadPackageOnly",
"(",
"self",
",",
"output",
"=",
"None",
")",
":",
"scheme",
",",
"loc",
",",
"path",
",",
"query",
",",
"frag",
"=",
"urlparse",
".",
"urlsplit",
"(",
"self",
".",
"_dict",
"[",
"'Download-URL'",
"]",
")",
"path",
"=",
... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/plat-mac/pimp.py#L663-L690 | ||
quantumlib/Cirq | 89f88b01d69222d3f1ec14d649b7b3a85ed9211f | cirq-core/cirq/qis/states.py | python | one_hot | (
*,
index: Union[None, int, Sequence[int]] = None,
shape: Union[int, Sequence[int]],
value: Any = 1,
dtype: 'DTypeLike',
) | return result | Returns a numpy array with all 0s and a single non-zero entry(default 1).
Args:
index: The index that should store the `value` argument instead of 0.
If not specified, defaults to the start of the array.
shape: The shape of the array.
value: The hot value to place at `index` in ... | Returns a numpy array with all 0s and a single non-zero entry(default 1). | [
"Returns",
"a",
"numpy",
"array",
"with",
"all",
"0s",
"and",
"a",
"single",
"non",
"-",
"zero",
"entry",
"(",
"default",
"1",
")",
"."
] | def one_hot(
*,
index: Union[None, int, Sequence[int]] = None,
shape: Union[int, Sequence[int]],
value: Any = 1,
dtype: 'DTypeLike',
) -> np.ndarray:
"""Returns a numpy array with all 0s and a single non-zero entry(default 1).
Args:
index: The index that should store the `value` arg... | [
"def",
"one_hot",
"(",
"*",
",",
"index",
":",
"Union",
"[",
"None",
",",
"int",
",",
"Sequence",
"[",
"int",
"]",
"]",
"=",
"None",
",",
"shape",
":",
"Union",
"[",
"int",
",",
"Sequence",
"[",
"int",
"]",
"]",
",",
"value",
":",
"Any",
"=",
... | https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/qis/states.py#L1048-L1071 | |
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractNoobtransWordpressCom.py | python | extractNoobtransWordpressCom | (item) | return False | Parser for 'noobtrans.wordpress.com' | Parser for 'noobtrans.wordpress.com' | [
"Parser",
"for",
"noobtrans",
".",
"wordpress",
".",
"com"
] | def extractNoobtransWordpressCom(item):
'''
Parser for 'noobtrans.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiter... | [
"def",
"extractNoobtransWordpressCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
"i... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractNoobtransWordpressCom.py#L2-L21 | |
dlenski/vpn-slice | c10c3eaccc658ff12b113e6e017b170a2567c447 | vpn_slice/provider.py | python | RouteProvider.flush_cache | (self) | Flush the routing cache (if necessary). | Flush the routing cache (if necessary). | [
"Flush",
"the",
"routing",
"cache",
"(",
"if",
"necessary",
")",
"."
] | def flush_cache(self):
"""Flush the routing cache (if necessary).""" | [
"def",
"flush_cache",
"(",
"self",
")",
":"
] | https://github.com/dlenski/vpn-slice/blob/c10c3eaccc658ff12b113e6e017b170a2567c447/vpn_slice/provider.py#L68-L69 | ||
BotBotMe/botbot-web | 0ada6213b5f1d8bb0f71eb79aaf37704f4903564 | botbot/apps/logs/templatetags/logs_tags.py | python | bbme_urlizetrunc | (value, limit, autoescape=None) | return mark_safe(urlize_impl(value, trim_url_limit=int(limit), nofollow=True,
autoescape=autoescape)) | Converts URLs into clickable links, truncating URLs to the given character
limit, and adding 'rel=nofollow' attribute to discourage spamming.
Argument: Length to truncate URLs to. | Converts URLs into clickable links, truncating URLs to the given character
limit, and adding 'rel=nofollow' attribute to discourage spamming. | [
"Converts",
"URLs",
"into",
"clickable",
"links",
"truncating",
"URLs",
"to",
"the",
"given",
"character",
"limit",
"and",
"adding",
"rel",
"=",
"nofollow",
"attribute",
"to",
"discourage",
"spamming",
"."
] | def bbme_urlizetrunc(value, limit, autoescape=None):
"""
Converts URLs into clickable links, truncating URLs to the given character
limit, and adding 'rel=nofollow' attribute to discourage spamming.
Argument: Length to truncate URLs to.
"""
return mark_safe(urlize_impl(value, trim_url_limit=int... | [
"def",
"bbme_urlizetrunc",
"(",
"value",
",",
"limit",
",",
"autoescape",
"=",
"None",
")",
":",
"return",
"mark_safe",
"(",
"urlize_impl",
"(",
"value",
",",
"trim_url_limit",
"=",
"int",
"(",
"limit",
")",
",",
"nofollow",
"=",
"True",
",",
"autoescape",... | https://github.com/BotBotMe/botbot-web/blob/0ada6213b5f1d8bb0f71eb79aaf37704f4903564/botbot/apps/logs/templatetags/logs_tags.py#L25-L33 | |
CMA-ES/pycma | f6eed1ef7e747cec1ab2e5c835d6f2fd1ebc097f | cma/evolution_strategy.py | python | CMAOptions.defaults | () | return cma_default_options | return a dictionary with default option values and description | return a dictionary with default option values and description | [
"return",
"a",
"dictionary",
"with",
"default",
"option",
"values",
"and",
"description"
] | def defaults():
"""return a dictionary with default option values and description"""
return cma_default_options | [
"def",
"defaults",
"(",
")",
":",
"return",
"cma_default_options"
] | https://github.com/CMA-ES/pycma/blob/f6eed1ef7e747cec1ab2e5c835d6f2fd1ebc097f/cma/evolution_strategy.py#L583-L585 | |
Xilinx/finn | d1cc9cf94f1c33354cc169c5a6517314d0e94e3b | src/finn/custom_op/fpgadataflow/pool_batch.py | python | Pool_Batch.get_instream_width | (self) | return in_width | [] | def get_instream_width(self):
dt_bits = self.get_input_datatype().bitwidth()
pe = self.get_nodeattr("PE")
in_width = int(dt_bits * pe)
return in_width | [
"def",
"get_instream_width",
"(",
"self",
")",
":",
"dt_bits",
"=",
"self",
".",
"get_input_datatype",
"(",
")",
".",
"bitwidth",
"(",
")",
"pe",
"=",
"self",
".",
"get_nodeattr",
"(",
"\"PE\"",
")",
"in_width",
"=",
"int",
"(",
"dt_bits",
"*",
"pe",
"... | https://github.com/Xilinx/finn/blob/d1cc9cf94f1c33354cc169c5a6517314d0e94e3b/src/finn/custom_op/fpgadataflow/pool_batch.py#L148-L152 | |||
williamSYSU/TextGAN-PyTorch | 891635af6845edfee382de147faa4fc00c7e90eb | instructor/real_data/dgsan_instructor.py | python | DGSANInstructor._test | (self) | [] | def _test(self):
print('>>> Begin test...')
self._run()
pass | [
"def",
"_test",
"(",
"self",
")",
":",
"print",
"(",
"'>>> Begin test...'",
")",
"self",
".",
"_run",
"(",
")",
"pass"
] | https://github.com/williamSYSU/TextGAN-PyTorch/blob/891635af6845edfee382de147faa4fc00c7e90eb/instructor/real_data/dgsan_instructor.py#L73-L77 | ||||
sdnewhop/grinder | 7432531e4a5a4ce3cc8224ac852188ef1d18432d | grinder/nmapconnector.py | python | NmapConnector.scan | (
self, host: str, arguments: str = "", ports: str = "", sudo: bool = False
) | The most basic Nmap caller. This is the "lowest" function in terms
of Grinder Framework, all calls here are going to python-nmap
library. In this function we just puts right arguments, parameters
and other things to call Nmap.
:param host: ip of the host to scan
:param arguments:... | The most basic Nmap caller. This is the "lowest" function in terms
of Grinder Framework, all calls here are going to python-nmap
library. In this function we just puts right arguments, parameters
and other things to call Nmap.
:param host: ip of the host to scan
:param arguments:... | [
"The",
"most",
"basic",
"Nmap",
"caller",
".",
"This",
"is",
"the",
"lowest",
"function",
"in",
"terms",
"of",
"Grinder",
"Framework",
"all",
"calls",
"here",
"are",
"going",
"to",
"python",
"-",
"nmap",
"library",
".",
"In",
"this",
"function",
"we",
"j... | def scan(
self, host: str, arguments: str = "", ports: str = "", sudo: bool = False
) -> None:
"""
The most basic Nmap caller. This is the "lowest" function in terms
of Grinder Framework, all calls here are going to python-nmap
library. In this function we just puts right arg... | [
"def",
"scan",
"(",
"self",
",",
"host",
":",
"str",
",",
"arguments",
":",
"str",
"=",
"\"\"",
",",
"ports",
":",
"str",
"=",
"\"\"",
",",
"sudo",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"# Add special Nmap key to scan ipv6 hosts",
"if",
"s... | https://github.com/sdnewhop/grinder/blob/7432531e4a5a4ce3cc8224ac852188ef1d18432d/grinder/nmapconnector.py#L32-L75 | ||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/pydoc.py | python | HTMLDoc.docroutine | (self, object, name=None, mod=None,
funcs={}, classes={}, methods={}, cl=None) | Produce HTML documentation for a function or method object. | Produce HTML documentation for a function or method object. | [
"Produce",
"HTML",
"documentation",
"for",
"a",
"function",
"or",
"method",
"object",
"."
] | def docroutine(self, object, name=None, mod=None,
funcs={}, classes={}, methods={}, cl=None):
"""Produce HTML documentation for a function or method object."""
realname = object.__name__
name = name or realname
anchor = (cl and cl.__name__ or '') + '-' + name
n... | [
"def",
"docroutine",
"(",
"self",
",",
"object",
",",
"name",
"=",
"None",
",",
"mod",
"=",
"None",
",",
"funcs",
"=",
"{",
"}",
",",
"classes",
"=",
"{",
"}",
",",
"methods",
"=",
"{",
"}",
",",
"cl",
"=",
"None",
")",
":",
"realname",
"=",
... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/pydoc.py#L938-L996 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/apigateway/v20180808/models.py | python | ApiInfo.__init__ | (self) | r"""
:param ServiceId: API 所在的服务唯一 ID。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceId: str
:param ServiceName: API 所在的服务的名称。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceName: str
:param ServiceDesc: API 所在的服务的描述。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceDesc: str
:param ApiId... | r"""
:param ServiceId: API 所在的服务唯一 ID。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceId: str
:param ServiceName: API 所在的服务的名称。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceName: str
:param ServiceDesc: API 所在的服务的描述。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceDesc: str
:param ApiId... | [
"r",
":",
"param",
"ServiceId",
":",
"API",
"所在的服务唯一",
"ID。",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"ServiceId",
":",
"str",
":",
"param",
"ServiceName",
":",
"API",
"所在的服务的名称。",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"ServiceName",
":",
"str",
":... | def __init__(self):
r"""
:param ServiceId: API 所在的服务唯一 ID。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceId: str
:param ServiceName: API 所在的服务的名称。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceName: str
:param ServiceDesc: API 所在的服务的描述。
注意:此字段可能返回 null,表示取不到有效值。
:type ServiceDe... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ServiceId",
"=",
"None",
"self",
".",
"ServiceName",
"=",
"None",
"self",
".",
"ServiceDesc",
"=",
"None",
"self",
".",
"ApiId",
"=",
"None",
"self",
".",
"ApiDesc",
"=",
"None",
"self",
".",
"C... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/apigateway/v20180808/models.py#L533-L739 | ||
wummel/patool | 723006abd43d0926581b11df0cd37e46a30525eb | patoolib/util.py | python | tmpdir | (dir=None) | return tempfile.mkdtemp(suffix='', prefix='Unpack_', dir=dir) | Return a temporary directory for extraction. | Return a temporary directory for extraction. | [
"Return",
"a",
"temporary",
"directory",
"for",
"extraction",
"."
] | def tmpdir (dir=None):
"""Return a temporary directory for extraction."""
return tempfile.mkdtemp(suffix='', prefix='Unpack_', dir=dir) | [
"def",
"tmpdir",
"(",
"dir",
"=",
"None",
")",
":",
"return",
"tempfile",
".",
"mkdtemp",
"(",
"suffix",
"=",
"''",
",",
"prefix",
"=",
"'Unpack_'",
",",
"dir",
"=",
"dir",
")"
] | https://github.com/wummel/patool/blob/723006abd43d0926581b11df0cd37e46a30525eb/patoolib/util.py#L468-L470 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/fci/cistring.py | python | gen_cre_str_index | (orb_list, nelec) | return gen_cre_str_index_o1(orb_list, nelec) | linkstr_index to map between N electron string to N+1 electron string.
It maps the given string to the address of the string which is generated by
the creation operator.
For given string str0, index[str0] is nvir x 4 array. Each entry
[i(cre),--,str1,sign] means starting from str0, creating i, to get ... | linkstr_index to map between N electron string to N+1 electron string.
It maps the given string to the address of the string which is generated by
the creation operator. | [
"linkstr_index",
"to",
"map",
"between",
"N",
"electron",
"string",
"to",
"N",
"+",
"1",
"electron",
"string",
".",
"It",
"maps",
"the",
"given",
"string",
"to",
"the",
"address",
"of",
"the",
"string",
"which",
"is",
"generated",
"by",
"the",
"creation",
... | def gen_cre_str_index(orb_list, nelec):
'''linkstr_index to map between N electron string to N+1 electron string.
It maps the given string to the address of the string which is generated by
the creation operator.
For given string str0, index[str0] is nvir x 4 array. Each entry
[i(cre),--,str1,sign... | [
"def",
"gen_cre_str_index",
"(",
"orb_list",
",",
"nelec",
")",
":",
"return",
"gen_cre_str_index_o1",
"(",
"orb_list",
",",
"nelec",
")"
] | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/fci/cistring.py#L286-L294 | |
nicrusso7/rex-gym | 26663048bd3c3da307714da4458b1a2a9dc81824 | rex_gym/envs/gym/turn_env.py | python | RexTurnEnv._get_true_observation | (self) | return self._true_observation | Get the true observations of this environment.
It includes the roll, the error between current pitch and desired pitch,
roll dot and pitch dot of the base.
Returns:
The observation list. | Get the true observations of this environment. | [
"Get",
"the",
"true",
"observations",
"of",
"this",
"environment",
"."
] | def _get_true_observation(self):
"""Get the true observations of this environment.
It includes the roll, the error between current pitch and desired pitch,
roll dot and pitch dot of the base.
Returns:
The observation list.
"""
observation = []
roll, pi... | [
"def",
"_get_true_observation",
"(",
"self",
")",
":",
"observation",
"=",
"[",
"]",
"roll",
",",
"pitch",
",",
"_",
"=",
"self",
".",
"rex",
".",
"GetTrueBaseRollPitchYaw",
"(",
")",
"roll_rate",
",",
"pitch_rate",
",",
"_",
"=",
"self",
".",
"rex",
"... | https://github.com/nicrusso7/rex-gym/blob/26663048bd3c3da307714da4458b1a2a9dc81824/rex_gym/envs/gym/turn_env.py#L380-L394 | |
softlayer/softlayer-python | cdef7d63c66413197a9a97b0414de9f95887a82a | SoftLayer/CLI/account/events.py | python | cli | (env, ack_all) | Summary and acknowledgement of upcoming and ongoing maintenance events | Summary and acknowledgement of upcoming and ongoing maintenance events | [
"Summary",
"and",
"acknowledgement",
"of",
"upcoming",
"and",
"ongoing",
"maintenance",
"events"
] | def cli(env, ack_all):
"""Summary and acknowledgement of upcoming and ongoing maintenance events"""
manager = AccountManager(env.client)
planned_events = manager.get_upcoming_events("PLANNED")
unplanned_events = manager.get_upcoming_events("UNPLANNED_INCIDENT")
announcement_events = manager.get_upc... | [
"def",
"cli",
"(",
"env",
",",
"ack_all",
")",
":",
"manager",
"=",
"AccountManager",
"(",
"env",
".",
"client",
")",
"planned_events",
"=",
"manager",
".",
"get_upcoming_events",
"(",
"\"PLANNED\"",
")",
"unplanned_events",
"=",
"manager",
".",
"get_upcoming_... | https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/CLI/account/events.py#L15-L30 | ||
ganglia/gmond_python_modules | 2f7fcab3d27926ef4a2feb1b53c09af16a43e729 | xrootd_stats/python_modules/xrootd_stats.py | python | get_xrootd_metrics | (name) | return xrootd[name] | [] | def get_xrootd_metrics(name):
root = ET.fromstring(data['xml'])
for i in root.findall("stats"):
if i.attrib['id'] == "xrootd":
for c in i.getchildren():
if c.tag not in ["ops", "aio", "lgn"]:
tag = NAME_PREFIX + "xrootd_" + c.tag
xrootd... | [
"def",
"get_xrootd_metrics",
"(",
"name",
")",
":",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"data",
"[",
"'xml'",
"]",
")",
"for",
"i",
"in",
"root",
".",
"findall",
"(",
"\"stats\"",
")",
":",
"if",
"i",
".",
"attrib",
"[",
"'id'",
"]",
"==",
... | https://github.com/ganglia/gmond_python_modules/blob/2f7fcab3d27926ef4a2feb1b53c09af16a43e729/xrootd_stats/python_modules/xrootd_stats.py#L241-L262 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/lib2to3/fixer_util.py | python | _is_import_binding | (node, name, package=None) | return None | Will reuturn node if node will import name, or node
will import * from package. None is returned otherwise.
See test cases for examples. | Will reuturn node if node will import name, or node
will import * from package. None is returned otherwise.
See test cases for examples. | [
"Will",
"reuturn",
"node",
"if",
"node",
"will",
"import",
"name",
"or",
"node",
"will",
"import",
"*",
"from",
"package",
".",
"None",
"is",
"returned",
"otherwise",
".",
"See",
"test",
"cases",
"for",
"examples",
"."
] | def _is_import_binding(node, name, package=None):
""" Will reuturn node if node will import name, or node
will import * from package. None is returned otherwise.
See test cases for examples. """
if node.type == syms.import_name and not package:
imp = node.children[1]
if imp.typ... | [
"def",
"_is_import_binding",
"(",
"node",
",",
"name",
",",
"package",
"=",
"None",
")",
":",
"if",
"node",
".",
"type",
"==",
"syms",
".",
"import_name",
"and",
"not",
"package",
":",
"imp",
"=",
"node",
".",
"children",
"[",
"1",
"]",
"if",
"imp",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/lib2to3/fixer_util.py#L393-L432 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/fftpack/_pseudo_diffs.py | python | sc_diff | (x, a, b, period=None, _cache=_cache) | return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x) | Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x.
If x_j and y_j are Fourier coefficients of periodic functions x
and y, respectively, then::
y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j
y_0 = 0
Parameters
----------
x : array_like
Input ar... | Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x. | [
"Return",
"(",
"a",
"b",
")",
"-",
"sinh",
"/",
"cosh",
"pseudo",
"-",
"derivative",
"of",
"a",
"periodic",
"sequence",
"x",
"."
] | def sc_diff(x, a, b, period=None, _cache=_cache):
"""
Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x.
If x_j and y_j are Fourier coefficients of periodic functions x
and y, respectively, then::
y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j
y_0 = 0
... | [
"def",
"sc_diff",
"(",
"x",
",",
"a",
",",
"b",
",",
"period",
"=",
"None",
",",
"_cache",
"=",
"_cache",
")",
":",
"tmp",
"=",
"asarray",
"(",
"x",
")",
"if",
"iscomplexobj",
"(",
"tmp",
")",
":",
"return",
"sc_diff",
"(",
"tmp",
".",
"real",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/fftpack/_pseudo_diffs.py#L336-L383 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/requests/utils.py | python | from_key_val_list | (value) | return OrderedDict(value) | Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('string')
ValueError: need more tha... | Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g., | [
"Take",
"an",
"object",
"and",
"test",
"to",
"see",
"if",
"it",
"can",
"be",
"represented",
"as",
"a",
"dictionary",
".",
"Unless",
"it",
"can",
"not",
"be",
"represented",
"as",
"such",
"return",
"an",
"OrderedDict",
"e",
".",
"g",
"."
] | def from_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('strin... | [
"def",
"from_key_val_list",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"bytes",
",",
"bool",
",",
"int",
")",
")",
":",
"raise",
"ValueError",
"(",
"'cannot encode... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/requests/utils.py#L154-L176 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/idlelib/EditorWindow.py | python | EditorWindow.center_insert_event | (self, event) | [] | def center_insert_event(self, event):
self.center() | [
"def",
"center_insert_event",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"center",
"(",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/EditorWindow.py#L957-L958 | ||||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/tools/proxywin.py | python | ProxiedRequests.config_changed | (self, like_initial) | Propagates the change from the options.
:param like_initial: If the config is like the initial one | Propagates the change from the options. | [
"Propagates",
"the",
"change",
"from",
"the",
"options",
"."
] | def config_changed(self, like_initial):
"""Propagates the change from the options.
:param like_initial: If the config is like the initial one
"""
self.like_initial = like_initial | [
"def",
"config_changed",
"(",
"self",
",",
"like_initial",
")",
":",
"self",
".",
"like_initial",
"=",
"like_initial"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/tools/proxywin.py#L231-L236 | ||
EmuKit/emukit | cdcb0d070d7f1c5585260266160722b636786859 | emukit/examples/preferential_batch_bayesian_optimization/pbbo/gp_models.py | python | ComparisonGP.get_current_best | (self) | return min(self.Y) | :return: minimum of means of predictions at all input locations (needed by q-EI) | :return: minimum of means of predictions at all input locations (needed by q-EI) | [
":",
"return",
":",
"minimum",
"of",
"means",
"of",
"predictions",
"at",
"all",
"input",
"locations",
"(",
"needed",
"by",
"q",
"-",
"EI",
")"
] | def get_current_best(self) -> float:
"""
:return: minimum of means of predictions at all input locations (needed by q-EI)
"""
return min(self.Y) | [
"def",
"get_current_best",
"(",
"self",
")",
"->",
"float",
":",
"return",
"min",
"(",
"self",
".",
"Y",
")"
] | https://github.com/EmuKit/emukit/blob/cdcb0d070d7f1c5585260266160722b636786859/emukit/examples/preferential_batch_bayesian_optimization/pbbo/gp_models.py#L36-L40 | |
gevent/gevent | ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31 | src/gevent/_sslgte279.py | python | SSLSocket.accept | (self) | return newsock, addr | Accepts a new connection from a remote client, and returns
a tuple containing that new connection wrapped with a server-side
SSL channel, and the address of the remote client. | Accepts a new connection from a remote client, and returns
a tuple containing that new connection wrapped with a server-side
SSL channel, and the address of the remote client. | [
"Accepts",
"a",
"new",
"connection",
"from",
"a",
"remote",
"client",
"and",
"returns",
"a",
"tuple",
"containing",
"that",
"new",
"connection",
"wrapped",
"with",
"a",
"server",
"-",
"side",
"SSL",
"channel",
"and",
"the",
"address",
"of",
"the",
"remote",
... | def accept(self):
"""Accepts a new connection from a remote client, and returns
a tuple containing that new connection wrapped with a server-side
SSL channel, and the address of the remote client."""
newsock, addr = socket.accept(self)
newsock._drop_events_and_close(closefd=Fals... | [
"def",
"accept",
"(",
"self",
")",
":",
"newsock",
",",
"addr",
"=",
"socket",
".",
"accept",
"(",
"self",
")",
"newsock",
".",
"_drop_events_and_close",
"(",
"closefd",
"=",
"False",
")",
"# Why, again?",
"newsock",
"=",
"self",
".",
"_context",
".",
"w... | https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/_sslgte279.py#L642-L653 | |
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_core/hydroshare/utils.py | python | add_file_to_resource | (resource, f, folder='', source_name='',
check_target_folder=False, add_to_aggregation=True, user=None) | return ret | Add a ResourceFile to a Resource. Adds the 'format' metadata element to the resource.
:param resource: Resource to which file should be added
:param f: File-like object to add to a resource
:param folder: folder at which the file will live
:param source_name: the logical file name of the resource c... | Add a ResourceFile to a Resource. Adds the 'format' metadata element to the resource.
:param resource: Resource to which file should be added
:param f: File-like object to add to a resource
:param folder: folder at which the file will live
:param source_name: the logical file name of the resource c... | [
"Add",
"a",
"ResourceFile",
"to",
"a",
"Resource",
".",
"Adds",
"the",
"format",
"metadata",
"element",
"to",
"the",
"resource",
".",
":",
"param",
"resource",
":",
"Resource",
"to",
"which",
"file",
"should",
"be",
"added",
":",
"param",
"f",
":",
"File... | def add_file_to_resource(resource, f, folder='', source_name='',
check_target_folder=False, add_to_aggregation=True, user=None):
"""
Add a ResourceFile to a Resource. Adds the 'format' metadata element to the resource.
:param resource: Resource to which file should be added
:p... | [
"def",
"add_file_to_resource",
"(",
"resource",
",",
"f",
",",
"folder",
"=",
"''",
",",
"source_name",
"=",
"''",
",",
"check_target_folder",
"=",
"False",
",",
"add_to_aggregation",
"=",
"True",
",",
"user",
"=",
"None",
")",
":",
"# validate parameters",
... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_core/hydroshare/utils.py#L937-L1013 | |
paulproteus/python-scraping-code-samples | 4e5396d4e311ca66c784a2b5f859308285e511da | new/seleniumrc/selenium-remote-control-1.0-beta-2/selenium-python-client-driver-1.0-beta-2/selenium.py | python | selenium.mouse_down | (self,locator) | Simulates a user pressing the left mouse button (without releasing it yet) on
the specified element.
'locator' is an element locator | Simulates a user pressing the left mouse button (without releasing it yet) on
the specified element.
'locator' is an element locator | [
"Simulates",
"a",
"user",
"pressing",
"the",
"left",
"mouse",
"button",
"(",
"without",
"releasing",
"it",
"yet",
")",
"on",
"the",
"specified",
"element",
".",
"locator",
"is",
"an",
"element",
"locator"
] | def mouse_down(self,locator):
"""
Simulates a user pressing the left mouse button (without releasing it yet) on
the specified element.
'locator' is an element locator
"""
self.do_command("mouseDown", [locator,]) | [
"def",
"mouse_down",
"(",
"self",
",",
"locator",
")",
":",
"self",
".",
"do_command",
"(",
"\"mouseDown\"",
",",
"[",
"locator",
",",
"]",
")"
] | https://github.com/paulproteus/python-scraping-code-samples/blob/4e5396d4e311ca66c784a2b5f859308285e511da/new/seleniumrc/selenium-remote-control-1.0-beta-2/selenium-python-client-driver-1.0-beta-2/selenium.py#L473-L480 | ||
hugorut/neural-cli | a8c1eaabfc7dc9425b59dec0cd3f1bd9fe9edcb4 | neuralcli/neuralnet.py | python | NeuralNet.accuracy | (self, type='train') | get the accuracy of the learned parameters on a specific set | get the accuracy of the learned parameters on a specific set | [
"get",
"the",
"accuracy",
"of",
"the",
"learned",
"parameters",
"on",
"a",
"specific",
"set"
] | def accuracy(self, type='train'):
"""
get the accuracy of the learned parameters on a specific set
"""
examples = len(self.Y)
theta1, theta2 = self.reshape_theta(self.params)
a1, z2, a2, z3, h = self.feed_forward(self.X, theta1, theta2)
y_pred = np.array(np.ar... | [
"def",
"accuracy",
"(",
"self",
",",
"type",
"=",
"'train'",
")",
":",
"examples",
"=",
"len",
"(",
"self",
".",
"Y",
")",
"theta1",
",",
"theta2",
"=",
"self",
".",
"reshape_theta",
"(",
"self",
".",
"params",
")",
"a1",
",",
"z2",
",",
"a2",
",... | https://github.com/hugorut/neural-cli/blob/a8c1eaabfc7dc9425b59dec0cd3f1bd9fe9edcb4/neuralcli/neuralnet.py#L303-L320 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/setuptools/command/easy_install.py | python | PthDistributions.save | (self) | Write changed .pth file back to disk | Write changed .pth file back to disk | [
"Write",
"changed",
".",
"pth",
"file",
"back",
"to",
"disk"
] | def save(self):
"""Write changed .pth file back to disk"""
if not self.dirty:
return
rel_paths = list(map(self.make_relative, self.paths))
if rel_paths:
log.debug("Saving %s", self.filename)
lines = self._wrap_lines(rel_paths)
data = '\n'.... | [
"def",
"save",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"dirty",
":",
"return",
"rel_paths",
"=",
"list",
"(",
"map",
"(",
"self",
".",
"make_relative",
",",
"self",
".",
"paths",
")",
")",
"if",
"rel_paths",
":",
"log",
".",
"debug",
"(",
... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/setuptools/command/easy_install.py#L1616-L1636 | ||
blawar/nut | 2cf351400418399a70164987e28670309f6c9cb5 | Fs/driver/interface.py | python | DirContext.ls | (self) | return [] | [] | def ls(self):
return [] | [
"def",
"ls",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/Fs/driver/interface.py#L15-L16 | |||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/jupyter_console-4.0.3-py3.3.egg/jupyter_console/interactiveshell.py | python | ZMQTerminalInteractiveShell.interact | (self, display_banner=None) | Closely emulate the interactive Python console. | Closely emulate the interactive Python console. | [
"Closely",
"emulate",
"the",
"interactive",
"Python",
"console",
"."
] | def interact(self, display_banner=None):
"""Closely emulate the interactive Python console."""
# batch run -> do not interact
if self.exit_now:
return
if display_banner is None:
display_banner = self.display_banner
if isinstance(display_banner, string_t... | [
"def",
"interact",
"(",
"self",
",",
"display_banner",
"=",
"None",
")",
":",
"# batch run -> do not interact",
"if",
"self",
".",
"exit_now",
":",
"return",
"if",
"display_banner",
"is",
"None",
":",
"display_banner",
"=",
"self",
".",
"display_banner",
"if",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/jupyter_console-4.0.3-py3.3.egg/jupyter_console/interactiveshell.py#L479-L592 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/tkinter/__init__.py | python | PanedWindow.paneconfigure | (self, tagOrId, cnf=None, **kw) | Query or modify the management options for window.
If no option is specified, returns a list describing all
of the available options for pathName. If option is
specified with no value, then the command returns a list
describing the one named option (this list will be identical
... | Query or modify the management options for window. | [
"Query",
"or",
"modify",
"the",
"management",
"options",
"for",
"window",
"."
] | def paneconfigure(self, tagOrId, cnf=None, **kw):
"""Query or modify the management options for window.
If no option is specified, returns a list describing all
of the available options for pathName. If option is
specified with no value, then the command returns a list
describi... | [
"def",
"paneconfigure",
"(",
"self",
",",
"tagOrId",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"cnf",
"is",
"None",
"and",
"not",
"kw",
":",
"return",
"self",
".",
"_getconfigure",
"(",
"self",
".",
"_w",
",",
"'paneconfigure'",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/tkinter/__init__.py#L3904-L3978 | ||
robclewley/pydstool | 939e3abc9dd1f180d35152bacbde57e24c85ff26 | PyDSTool/utils.py | python | architecture | () | return struct.calcsize("P") * 8 | Platform- and version-independent function to determine 32- or 64-bit architecture.
Used primarily to determine need for "-m32" option to C compilers for external library
compilation, e.g. by AUTO, Dopri, Radau.
Returns integer 32 or 64. | Platform- and version-independent function to determine 32- or 64-bit architecture.
Used primarily to determine need for "-m32" option to C compilers for external library
compilation, e.g. by AUTO, Dopri, Radau. | [
"Platform",
"-",
"and",
"version",
"-",
"independent",
"function",
"to",
"determine",
"32",
"-",
"or",
"64",
"-",
"bit",
"architecture",
".",
"Used",
"primarily",
"to",
"determine",
"need",
"for",
"-",
"m32",
"option",
"to",
"C",
"compilers",
"for",
"exter... | def architecture():
"""
Platform- and version-independent function to determine 32- or 64-bit architecture.
Used primarily to determine need for "-m32" option to C compilers for external library
compilation, e.g. by AUTO, Dopri, Radau.
Returns integer 32 or 64.
"""
import struct
return ... | [
"def",
"architecture",
"(",
")",
":",
"import",
"struct",
"return",
"struct",
".",
"calcsize",
"(",
"\"P\"",
")",
"*",
"8"
] | https://github.com/robclewley/pydstool/blob/939e3abc9dd1f180d35152bacbde57e24c85ff26/PyDSTool/utils.py#L733-L742 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/distlib/util.py | python | FileOperator.copy_file | (self, infile, outfile, check=True) | Copy a file respecting dry-run and force flags. | Copy a file respecting dry-run and force flags. | [
"Copy",
"a",
"file",
"respecting",
"dry",
"-",
"run",
"and",
"force",
"flags",
"."
] | def copy_file(self, infile, outfile, check=True):
"""Copy a file respecting dry-run and force flags.
"""
self.ensure_dir(os.path.dirname(outfile))
logger.info('Copying %s to %s', infile, outfile)
if not self.dry_run:
msg = None
if check:
if... | [
"def",
"copy_file",
"(",
"self",
",",
"infile",
",",
"outfile",
",",
"check",
"=",
"True",
")",
":",
"self",
".",
"ensure_dir",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"outfile",
")",
")",
"logger",
".",
"info",
"(",
"'Copying %s to %s'",
",",
"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/distlib/util.py#L353-L368 | ||
explosion/sense2vec | d689bb65ce0f6c597c891cea3ba279ad1f92916f | sense2vec/sense2vec.py | python | Sense2Vec.keys | (self) | YIELDS (unicode): The string keys in the table. | YIELDS (unicode): The string keys in the table. | [
"YIELDS",
"(",
"unicode",
")",
":",
"The",
"string",
"keys",
"in",
"the",
"table",
"."
] | def keys(self):
"""YIELDS (unicode): The string keys in the table."""
for key in self.vectors.keys():
yield self.strings[key] | [
"def",
"keys",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"vectors",
".",
"keys",
"(",
")",
":",
"yield",
"self",
".",
"strings",
"[",
"key",
"]"
] | https://github.com/explosion/sense2vec/blob/d689bb65ce0f6c597c891cea3ba279ad1f92916f/sense2vec/sense2vec.py#L103-L106 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/ttk.py | python | Progressbar.step | (self, amount=None) | Increments the value option by amount.
amount defaults to 1.0 if omitted. | Increments the value option by amount. | [
"Increments",
"the",
"value",
"option",
"by",
"amount",
"."
] | def step(self, amount=None):
"""Increments the value option by amount.
amount defaults to 1.0 if omitted."""
self.tk.call(self._w, "step", amount) | [
"def",
"step",
"(",
"self",
",",
"amount",
"=",
"None",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"step\"",
",",
"amount",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/ttk.py#L1021-L1025 | ||
RasaHQ/rasa-sdk | 231c200d24574bb5908074df6c59f2acaa152606 | scripts/release.py | python | create_release_branch | (version: Version) | return branch | Create a new branch for this release. Returns the branch name. | Create a new branch for this release. Returns the branch name. | [
"Create",
"a",
"new",
"branch",
"for",
"this",
"release",
".",
"Returns",
"the",
"branch",
"name",
"."
] | def create_release_branch(version: Version) -> Text:
"""Create a new branch for this release. Returns the branch name."""
branch = f"{RELEASE_BRANCH_PREFIX}{version}"
check_call(["git", "checkout", "-b", branch])
return branch | [
"def",
"create_release_branch",
"(",
"version",
":",
"Version",
")",
"->",
"Text",
":",
"branch",
"=",
"f\"{RELEASE_BRANCH_PREFIX}{version}\"",
"check_call",
"(",
"[",
"\"git\"",
",",
"\"checkout\"",
",",
"\"-b\"",
",",
"branch",
"]",
")",
"return",
"branch"
] | https://github.com/RasaHQ/rasa-sdk/blob/231c200d24574bb5908074df6c59f2acaa152606/scripts/release.py#L204-L209 | |
bolt-project/bolt | 9cd7104aa085498da3097b72696184b9d3651c51 | bolt/spark/array.py | python | BoltArraySpark.chunk | (self, size="150", axis=None, padding=None) | return chnk._chunk(size, axis, padding) | Chunks records of a distributed array.
Chunking breaks arrays into subarrays, using an specified
size of chunks along each value dimension. Can alternatively
specify an average chunk byte size (in kilobytes) and the size of
chunks (as ints) will be computed automatically.
Param... | Chunks records of a distributed array. | [
"Chunks",
"records",
"of",
"a",
"distributed",
"array",
"."
] | def chunk(self, size="150", axis=None, padding=None):
"""
Chunks records of a distributed array.
Chunking breaks arrays into subarrays, using an specified
size of chunks along each value dimension. Can alternatively
specify an average chunk byte size (in kilobytes) and the size ... | [
"def",
"chunk",
"(",
"self",
",",
"size",
"=",
"\"150\"",
",",
"axis",
"=",
"None",
",",
"padding",
"=",
"None",
")",
":",
"if",
"type",
"(",
"size",
")",
"is",
"not",
"str",
":",
"size",
"=",
"tupleize",
"(",
"(",
"size",
")",
")",
"axis",
"="... | https://github.com/bolt-project/bolt/blob/9cd7104aa085498da3097b72696184b9d3651c51/bolt/spark/array.py#L678-L714 | |
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | gluoncv/data/otb/tracking.py | python | OTBTracking.set_tracker | (self, path, tracker_names) | Args:
path: path to tracker results,
tracker_names: list of tracker name | Args:
path: path to tracker results,
tracker_names: list of tracker name | [
"Args",
":",
"path",
":",
"path",
"to",
"tracker",
"results",
"tracker_names",
":",
"list",
"of",
"tracker",
"name"
] | def set_tracker(self, path, tracker_names):
"""
Args:
path: path to tracker results,
tracker_names: list of tracker name
"""
self.tracker_path = path
self.tracker_names = tracker_names | [
"def",
"set_tracker",
"(",
"self",
",",
"path",
",",
"tracker_names",
")",
":",
"self",
".",
"tracker_path",
"=",
"path",
"self",
".",
"tracker_names",
"=",
"tracker_names"
] | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/data/otb/tracking.py#L212-L219 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/string.py | python | upper | (s) | return s.upper() | upper(s) -> string
Return a copy of the string s converted to uppercase. | upper(s) -> string | [
"upper",
"(",
"s",
")",
"-",
">",
"string"
] | def upper(s):
"""upper(s) -> string
Return a copy of the string s converted to uppercase.
"""
return s.upper() | [
"def",
"upper",
"(",
"s",
")",
":",
"return",
"s",
".",
"upper",
"(",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/string.py#L229-L235 | |
tctianchi/pyvenn | 24d6e1ddf9fb7c9881268dbad28a979da63815fa | venn.py | python | venn6 | (labels, names=['A', 'B', 'C', 'D', 'E'], **options) | return fig, ax | plots a 6-set Venn diagram
@type labels: dict[str, str]
@type names: list[str]
@rtype: (Figure, AxesSubplot)
input
labels: a label dict where keys are identified via binary codes ('000001', '000010', '000100', ...),
hence a valid set could look like: {'000001': 'text 1', '000010': ... | plots a 6-set Venn diagram | [
"plots",
"a",
"6",
"-",
"set",
"Venn",
"diagram"
] | def venn6(labels, names=['A', 'B', 'C', 'D', 'E'], **options):
"""
plots a 6-set Venn diagram
@type labels: dict[str, str]
@type names: list[str]
@rtype: (Figure, AxesSubplot)
input
labels: a label dict where keys are identified via binary codes ('000001', '000010', '000100', ...),
... | [
"def",
"venn6",
"(",
"labels",
",",
"names",
"=",
"[",
"'A'",
",",
"'B'",
",",
"'C'",
",",
"'D'",
",",
"'E'",
"]",
",",
"*",
"*",
"options",
")",
":",
"colors",
"=",
"options",
".",
"get",
"(",
"'colors'",
",",
"[",
"default_colors",
"[",
"i",
... | https://github.com/tctianchi/pyvenn/blob/24d6e1ddf9fb7c9881268dbad28a979da63815fa/venn.py#L356-L467 | |
deepchem/deepchem | 054eb4b2b082e3df8e1a8e77f36a52137ae6e375 | deepchem/dock/binding_pocket.py | python | ConvexHullPocketFinder.__init__ | (self, scoring_model: Optional[Model] = None, pad: float = 5.0) | Initialize the pocket finder.
Parameters
----------
scoring_model: Model, optional (default None)
If specified, use this model to prune pockets.
pad: float, optional (default 5.0)
The number of angstroms to pad around a binding pocket's atoms
to get a binding pocket box. | Initialize the pocket finder. | [
"Initialize",
"the",
"pocket",
"finder",
"."
] | def __init__(self, scoring_model: Optional[Model] = None, pad: float = 5.0):
"""Initialize the pocket finder.
Parameters
----------
scoring_model: Model, optional (default None)
If specified, use this model to prune pockets.
pad: float, optional (default 5.0)
The number of angstroms to ... | [
"def",
"__init__",
"(",
"self",
",",
"scoring_model",
":",
"Optional",
"[",
"Model",
"]",
"=",
"None",
",",
"pad",
":",
"float",
"=",
"5.0",
")",
":",
"self",
".",
"scoring_model",
"=",
"scoring_model",
"self",
".",
"pad",
"=",
"pad"
] | https://github.com/deepchem/deepchem/blob/054eb4b2b082e3df8e1a8e77f36a52137ae6e375/deepchem/dock/binding_pocket.py#L88-L100 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/scripts/sshbackdoors/rpyc/utils/server.py | python | ThreadedServer._accept_method | (self, sock) | [] | def _accept_method(self, sock):
t = threading.Thread(target = self._authenticate_and_serve_client, args = (sock,))
t.setDaemon(True)
t.start() | [
"def",
"_accept_method",
"(",
"self",
",",
"sock",
")",
":",
"t",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"_authenticate_and_serve_client",
",",
"args",
"=",
"(",
"sock",
",",
")",
")",
"t",
".",
"setDaemon",
"(",
"True",
")",... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/rpyc/utils/server.py#L271-L274 | ||||
pyca/pyopenssl | fb26edde0aa27670c7bb24c0daeb05516e83d7b0 | src/OpenSSL/_util.py | python | path_bytes | (s) | Convert a Python path to a :py:class:`bytes` for the path which can be
passed into an OpenSSL API accepting a filename.
:param s: A path (valid for os.fspath).
:return: An instance of :py:class:`bytes`. | Convert a Python path to a :py:class:`bytes` for the path which can be
passed into an OpenSSL API accepting a filename. | [
"Convert",
"a",
"Python",
"path",
"to",
"a",
":",
"py",
":",
"class",
":",
"bytes",
"for",
"the",
"path",
"which",
"can",
"be",
"passed",
"into",
"an",
"OpenSSL",
"API",
"accepting",
"a",
"filename",
"."
] | def path_bytes(s):
"""
Convert a Python path to a :py:class:`bytes` for the path which can be
passed into an OpenSSL API accepting a filename.
:param s: A path (valid for os.fspath).
:return: An instance of :py:class:`bytes`.
"""
b = os.fspath(s)
if isinstance(b, str):
return ... | [
"def",
"path_bytes",
"(",
"s",
")",
":",
"b",
"=",
"os",
".",
"fspath",
"(",
"s",
")",
"if",
"isinstance",
"(",
"b",
",",
"str",
")",
":",
"return",
"b",
".",
"encode",
"(",
"sys",
".",
"getfilesystemencoding",
"(",
")",
")",
"else",
":",
"return... | https://github.com/pyca/pyopenssl/blob/fb26edde0aa27670c7bb24c0daeb05516e83d7b0/src/OpenSSL/_util.py#L74-L88 | ||
jimenbian/DataMining | 6b1fc93319a3cdda835e158029ac133665d13191 | SMO/src/SMO.py | python | selectJrand | (i,m) | return j | [] | def selectJrand(i,m):
j=i #we want to select any J not equal to i
while (j==i):
j = int(random.uniform(0,m))
return j | [
"def",
"selectJrand",
"(",
"i",
",",
"m",
")",
":",
"j",
"=",
"i",
"#we want to select any J not equal to i",
"while",
"(",
"j",
"==",
"i",
")",
":",
"j",
"=",
"int",
"(",
"random",
".",
"uniform",
"(",
"0",
",",
"m",
")",
")",
"return",
"j"
] | https://github.com/jimenbian/DataMining/blob/6b1fc93319a3cdda835e158029ac133665d13191/SMO/src/SMO.py#L14-L18 | |||
project-alice-assistant/ProjectAlice | 9e0ba019643bdae0a5535c9fa4180739231dc361 | core/user/UserManager.py | python | UserManager.checkIfAllUser | (self, state: str) | return self._users and all(self._users[username].state == state for username in self.getAllUserNames()) | Checks if the given state applies to all users (except for guests)
:param state: the state to check
:return: boolean | Checks if the given state applies to all users (except for guests)
:param state: the state to check
:return: boolean | [
"Checks",
"if",
"the",
"given",
"state",
"applies",
"to",
"all",
"users",
"(",
"except",
"for",
"guests",
")",
":",
"param",
"state",
":",
"the",
"state",
"to",
"check",
":",
"return",
":",
"boolean"
] | def checkIfAllUser(self, state: str) -> bool:
"""
Checks if the given state applies to all users (except for guests)
:param state: the state to check
:return: boolean
"""
return self._users and all(self._users[username].state == state for username in self.getAllUserNames()) | [
"def",
"checkIfAllUser",
"(",
"self",
",",
"state",
":",
"str",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_users",
"and",
"all",
"(",
"self",
".",
"_users",
"[",
"username",
"]",
".",
"state",
"==",
"state",
"for",
"username",
"in",
"self",
"."... | https://github.com/project-alice-assistant/ProjectAlice/blob/9e0ba019643bdae0a5535c9fa4180739231dc361/core/user/UserManager.py#L178-L184 | |
anishathalye/git-remote-dropbox | 01b630ab697d9b9423915e88e43dd24072e0d591 | git_remote_dropbox/cli/helper.py | python | main | () | Main entry point for git-remote-dropbox Git remote helper. | Main entry point for git-remote-dropbox Git remote helper. | [
"Main",
"entry",
"point",
"for",
"git",
"-",
"remote",
"-",
"dropbox",
"Git",
"remote",
"helper",
"."
] | def main():
"""
Main entry point for git-remote-dropbox Git remote helper.
"""
# configure system
stdout_to_binary()
url = sys.argv[2]
helper = get_helper(url)
try:
helper.run()
except Exception:
if helper.verbosity >= Level.DEBUG:
raise # re-raise excep... | [
"def",
"main",
"(",
")",
":",
"# configure system",
"stdout_to_binary",
"(",
")",
"url",
"=",
"sys",
".",
"argv",
"[",
"2",
"]",
"helper",
"=",
"get_helper",
"(",
"url",
")",
"try",
":",
"helper",
".",
"run",
"(",
")",
"except",
"Exception",
":",
"if... | https://github.com/anishathalye/git-remote-dropbox/blob/01b630ab697d9b9423915e88e43dd24072e0d591/git_remote_dropbox/cli/helper.py#L13-L31 | ||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/sqlalchemy/dialects/firebird/kinterbasdb.py | python | FBDialect_kinterbasdb._get_server_version_info | (self, connection) | return self._parse_version_info(version) | Get the version of the Firebird server used by a connection.
Returns a tuple of (`major`, `minor`, `build`), three integers
representing the version of the attached server. | Get the version of the Firebird server used by a connection. | [
"Get",
"the",
"version",
"of",
"the",
"Firebird",
"server",
"used",
"by",
"a",
"connection",
"."
] | def _get_server_version_info(self, connection):
"""Get the version of the Firebird server used by a connection.
Returns a tuple of (`major`, `minor`, `build`), three integers
representing the version of the attached server.
"""
# This is the simpler approach (the other uses the... | [
"def",
"_get_server_version_info",
"(",
"self",
",",
"connection",
")",
":",
"# This is the simpler approach (the other uses the services api),",
"# that for backward compatibility reasons returns a string like",
"# LI-V6.3.3.12981 Firebird 2.0",
"# where the first version is a fake one rese... | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/dialects/firebird/kinterbasdb.py#L143-L159 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/tkinter/__init__.py | python | Spinbox.selection_range | (self, start, end) | Set the selection from START to END (not included). | Set the selection from START to END (not included). | [
"Set",
"the",
"selection",
"from",
"START",
"to",
"END",
"(",
"not",
"included",
")",
"."
] | def selection_range(self, start, end):
"""Set the selection from START to END (not included)."""
self.selection('range', start, end) | [
"def",
"selection_range",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"self",
".",
"selection",
"(",
"'range'",
",",
"start",
",",
"end",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/__init__.py#L4355-L4357 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/wsgiref/simple_server.py | python | make_server | (
host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler
) | return server | Create a new WSGI server listening on `host` and `port` for `app` | Create a new WSGI server listening on `host` and `port` for `app` | [
"Create",
"a",
"new",
"WSGI",
"server",
"listening",
"on",
"host",
"and",
"port",
"for",
"app"
] | def make_server(
host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler
):
"""Create a new WSGI server listening on `host` and `port` for `app`"""
server = server_class((host, port), handler_class)
server.set_app(app)
return server | [
"def",
"make_server",
"(",
"host",
",",
"port",
",",
"app",
",",
"server_class",
"=",
"WSGIServer",
",",
"handler_class",
"=",
"WSGIRequestHandler",
")",
":",
"server",
"=",
"server_class",
"(",
"(",
"host",
",",
"port",
")",
",",
"handler_class",
")",
"se... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/wsgiref/simple_server.py#L140-L146 | |
IntelPython/sdc | 1ebf55c00ef38dfbd401a70b3945e352a5a38b87 | sdc/sdc_autogenerated.py | python | sdc_str_arr_operator_ne | (self, other) | return _sdc_str_arr_operator_ne_impl | [] | def sdc_str_arr_operator_ne(self, other):
self_is_str_arr = self == string_array_type
other_is_str_arr = other == string_array_type
operands_are_arrays = self_is_str_arr and other_is_str_arr
if not (operands_are_arrays
or (self_is_str_arr and isinstance(other, types.UnicodeType))
... | [
"def",
"sdc_str_arr_operator_ne",
"(",
"self",
",",
"other",
")",
":",
"self_is_str_arr",
"=",
"self",
"==",
"string_array_type",
"other_is_str_arr",
"=",
"other",
"==",
"string_array_type",
"operands_are_arrays",
"=",
"self_is_str_arr",
"and",
"other_is_str_arr",
"if",... | https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/sdc_autogenerated.py#L2881-L2921 | |||
juanifioren/django-oidc-provider | f0daed07b2ac7608565b80d4c80ccf04d8c416a8 | oidc_provider/lib/utils/token.py | python | create_code | (user, client, scope, nonce, is_authentication,
code_challenge=None, code_challenge_method=None) | return code | Create and populate a Code object.
Return a Code object. | Create and populate a Code object.
Return a Code object. | [
"Create",
"and",
"populate",
"a",
"Code",
"object",
".",
"Return",
"a",
"Code",
"object",
"."
] | def create_code(user, client, scope, nonce, is_authentication,
code_challenge=None, code_challenge_method=None):
"""
Create and populate a Code object.
Return a Code object.
"""
code = Code()
code.user = user
code.client = client
code.code = uuid.uuid4().hex
if code... | [
"def",
"create_code",
"(",
"user",
",",
"client",
",",
"scope",
",",
"nonce",
",",
"is_authentication",
",",
"code_challenge",
"=",
"None",
",",
"code_challenge_method",
"=",
"None",
")",
":",
"code",
"=",
"Code",
"(",
")",
"code",
".",
"user",
"=",
"use... | https://github.com/juanifioren/django-oidc-provider/blob/f0daed07b2ac7608565b80d4c80ccf04d8c416a8/oidc_provider/lib/utils/token.py#L126-L148 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/mailbox.py | python | Mailbox.lock | (self) | Lock the mailbox. | Lock the mailbox. | [
"Lock",
"the",
"mailbox",
"."
] | def lock(self):
"""Lock the mailbox."""
raise NotImplementedError('Method must be implemented by subclass') | [
"def",
"lock",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Method must be implemented by subclass'",
")"
] | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/mailbox.py#L186-L188 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/legacy/transformer/utils/metrics.py | python | padded_accuracy_topk | (logits, labels, k) | Percentage of times that top-k predictions matches labels on non-0s. | Percentage of times that top-k predictions matches labels on non-0s. | [
"Percentage",
"of",
"times",
"that",
"top",
"-",
"k",
"predictions",
"matches",
"labels",
"on",
"non",
"-",
"0s",
"."
] | def padded_accuracy_topk(logits, labels, k):
"""Percentage of times that top-k predictions matches labels on non-0s."""
with tf.variable_scope("padded_accuracy_topk", values=[logits, labels]):
logits, labels = _pad_tensors_to_same_length(logits, labels)
weights = tf.cast(tf.not_equal(labels, 0), tf.float32)... | [
"def",
"padded_accuracy_topk",
"(",
"logits",
",",
"labels",
",",
"k",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"\"padded_accuracy_topk\"",
",",
"values",
"=",
"[",
"logits",
",",
"labels",
"]",
")",
":",
"logits",
",",
"labels",
"=",
"_pad_tens... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/legacy/transformer/utils/metrics.py#L151-L164 | ||
yuanxiaosc/DeepNude-an-Image-to-Image-technology | 87d684ef59d2de4e8b38f66a71cdd392b203ab95 | Neural_style_transfer/train_and_inference_by_image_transfer_model.py | python | ImageTransferBaseOnVGG19.style_content_loss | (self, outputs, style_weight=1e-2, content_weight=1e4) | return loss | [] | def style_content_loss(self, outputs, style_weight=1e-2, content_weight=1e4):
style_outputs = outputs['style']
content_outputs = outputs['content']
style_loss = tf.add_n([tf.reduce_mean((style_outputs[name] - self.style_targets[name]) ** 2)
for name in style_output... | [
"def",
"style_content_loss",
"(",
"self",
",",
"outputs",
",",
"style_weight",
"=",
"1e-2",
",",
"content_weight",
"=",
"1e4",
")",
":",
"style_outputs",
"=",
"outputs",
"[",
"'style'",
"]",
"content_outputs",
"=",
"outputs",
"[",
"'content'",
"]",
"style_loss... | https://github.com/yuanxiaosc/DeepNude-an-Image-to-Image-technology/blob/87d684ef59d2de4e8b38f66a71cdd392b203ab95/Neural_style_transfer/train_and_inference_by_image_transfer_model.py#L81-L92 | |||
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/nephoscale.py | python | NephoscaleNodeDriver.destroy_node | (self, node) | return result.get("response") in VALID_RESPONSE_CODES | destroy a node | destroy a node | [
"destroy",
"a",
"node"
] | def destroy_node(self, node):
"""destroy a node"""
result = self.connection.request(
"/server/cloud/%s/" % node.id, method="DELETE"
).object
return result.get("response") in VALID_RESPONSE_CODES | [
"def",
"destroy_node",
"(",
"self",
",",
"node",
")",
":",
"result",
"=",
"self",
".",
"connection",
".",
"request",
"(",
"\"/server/cloud/%s/\"",
"%",
"node",
".",
"id",
",",
"method",
"=",
"\"DELETE\"",
")",
".",
"object",
"return",
"result",
".",
"get... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/nephoscale.py#L233-L238 | |
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/deploy/openvino/python/transforms/seg_transforms.py | python | RandomDistort.__init__ | (self,
brightness_range=0.5,
brightness_prob=0.5,
contrast_range=0.5,
contrast_prob=0.5,
saturation_range=0.5,
saturation_prob=0.5,
hue_range=18,
hue_prob=0.5) | [] | def __init__(self,
brightness_range=0.5,
brightness_prob=0.5,
contrast_range=0.5,
contrast_prob=0.5,
saturation_range=0.5,
saturation_prob=0.5,
hue_range=18,
hue_prob=0.5):
sel... | [
"def",
"__init__",
"(",
"self",
",",
"brightness_range",
"=",
"0.5",
",",
"brightness_prob",
"=",
"0.5",
",",
"contrast_range",
"=",
"0.5",
",",
"contrast_prob",
"=",
"0.5",
",",
"saturation_range",
"=",
"0.5",
",",
"saturation_prob",
"=",
"0.5",
",",
"hue_r... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/deploy/openvino/python/transforms/seg_transforms.py#L973-L989 | ||||
ewels/MultiQC | 9b953261d3d684c24eef1827a5ce6718c847a5af | multiqc/modules/pycoqc/pycoqc.py | python | MultiqcModule.load_data | (self, f) | Load the PycoQC YAML file | Load the PycoQC YAML file | [
"Load",
"the",
"PycoQC",
"YAML",
"file"
] | def load_data(self, f):
"""Load the PycoQC YAML file"""
try:
return yaml.load(f, Loader=yaml.SafeLoader)
except Exception as e:
log.warning("Could not parse YAML for '{}': \n {}".format(f, e))
return None | [
"def",
"load_data",
"(",
"self",
",",
"f",
")",
":",
"try",
":",
"return",
"yaml",
".",
"load",
"(",
"f",
",",
"Loader",
"=",
"yaml",
".",
"SafeLoader",
")",
"except",
"Exception",
"as",
"e",
":",
"log",
".",
"warning",
"(",
"\"Could not parse YAML for... | https://github.com/ewels/MultiQC/blob/9b953261d3d684c24eef1827a5ce6718c847a5af/multiqc/modules/pycoqc/pycoqc.py#L61-L67 | ||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/nntplib.py | python | NNTP.body | (self, id, file=None) | return self.artcmd('BODY ' + id, file) | Process a BODY command. Argument:
- id: article number or message id
- file: Filename string or file object to store the article in
Returns:
- resp: server response if successful
- nr: article number
- id: message id
- list: the lines of the article's body or an ... | Process a BODY command. Argument:
- id: article number or message id
- file: Filename string or file object to store the article in
Returns:
- resp: server response if successful
- nr: article number
- id: message id
- list: the lines of the article's body or an ... | [
"Process",
"a",
"BODY",
"command",
".",
"Argument",
":",
"-",
"id",
":",
"article",
"number",
"or",
"message",
"id",
"-",
"file",
":",
"Filename",
"string",
"or",
"file",
"object",
"to",
"store",
"the",
"article",
"in",
"Returns",
":",
"-",
"resp",
":"... | def body(self, id, file=None):
"""Process a BODY command. Argument:
- id: article number or message id
- file: Filename string or file object to store the article in
Returns:
- resp: server response if successful
- nr: article number
- id: message id
- li... | [
"def",
"body",
"(",
"self",
",",
"id",
",",
"file",
"=",
"None",
")",
":",
"return",
"self",
".",
"artcmd",
"(",
"'BODY '",
"+",
"id",
",",
"file",
")"
] | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/nntplib.py#L431-L442 | |
DetectionTeamUCAS/R2CNN-Plus-Plus_Tensorflow | 06a1faf36d8f1a127612e428d5475c8f04f345c6 | data/io/image_preprocess.py | python | short_side_resize | (img_tensor, gtboxes_and_label, target_shortside_len) | return img_tensor, tf.transpose(tf.stack([x1, y1, x2, y2, x3, y3, x4, y4, label], axis=0)) | :param img_tensor:[h, w, c], gtboxes_and_label:[-1, 9]
:param target_shortside_len:
:return: | [] | def short_side_resize(img_tensor, gtboxes_and_label, target_shortside_len):
'''
:param img_tensor:[h, w, c], gtboxes_and_label:[-1, 9]
:param target_shortside_len:
:return:
'''
h, w = tf.shape(img_tensor)[0], tf.shape(img_tensor)[1]
new_h, new_w = tf.cond(tf.less(h, w),
... | [
"def",
"short_side_resize",
"(",
"img_tensor",
",",
"gtboxes_and_label",
",",
"target_shortside_len",
")",
":",
"h",
",",
"w",
"=",
"tf",
".",
"shape",
"(",
"img_tensor",
")",
"[",
"0",
"]",
",",
"tf",
".",
"shape",
"(",
"img_tensor",
")",
"[",
"1",
"]... | https://github.com/DetectionTeamUCAS/R2CNN-Plus-Plus_Tensorflow/blob/06a1faf36d8f1a127612e428d5475c8f04f345c6/data/io/image_preprocess.py#L12-L35 | ||
huawei-noah/vega | d9f13deede7f2b584e4b1d32ffdb833856129989 | vega/datasets/common/dataset.py | python | Dataset.transforms | (self) | return self._transforms | Transform function which can replace transforms. | Transform function which can replace transforms. | [
"Transform",
"function",
"which",
"can",
"replace",
"transforms",
"."
] | def transforms(self):
"""Transform function which can replace transforms."""
return self._transforms | [
"def",
"transforms",
"(",
"self",
")",
":",
"return",
"self",
".",
"_transforms"
] | https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/datasets/common/dataset.py#L78-L80 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/qwikswitch/sensor.py | python | QSSensor.__init__ | (self, sensor) | Initialize the sensor. | Initialize the sensor. | [
"Initialize",
"the",
"sensor",
"."
] | def __init__(self, sensor):
"""Initialize the sensor."""
super().__init__(sensor["id"], sensor["name"])
self.channel = sensor["channel"]
sensor_type = sensor["type"]
self._decode, self.unit = SENSORS[sensor_type]
# this cannot happen because it only happens in bool and ... | [
"def",
"__init__",
"(",
"self",
",",
"sensor",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"sensor",
"[",
"\"id\"",
"]",
",",
"sensor",
"[",
"\"name\"",
"]",
")",
"self",
".",
"channel",
"=",
"sensor",
"[",
"\"channel\"",
"]",
"sensor_type",
"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/qwikswitch/sensor.py#L39-L50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.