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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/nntplib.py | python | NNTP.statcmd | (self, line) | return self.statparse(resp) | Internal: process a STAT, NEXT or LAST command. | Internal: process a STAT, NEXT or LAST command. | [
"Internal",
":",
"process",
"a",
"STAT",
"NEXT",
"or",
"LAST",
"command",
"."
] | def statcmd(self, line):
"""Internal: process a STAT, NEXT or LAST command."""
resp = self.shortcmd(line)
return self.statparse(resp) | [
"def",
"statcmd",
"(",
"self",
",",
"line",
")",
":",
"resp",
"=",
"self",
".",
"shortcmd",
"(",
"line",
")",
"return",
"self",
".",
"statparse",
"(",
"resp",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/nntplib.py#L382-L385 | |
deepmind/hanabi-learning-environment | 54e79594f4b6fb40ebb3004289c6db0e34a8b5fb | hanabi_learning_environment/pyhanabi.py | python | HanabiGame.num_cards | (self, color, rank) | return lib.NumCards(self._game, color, rank) | Returns number of instances of Card(color, rank) in the initial deck. | Returns number of instances of Card(color, rank) in the initial deck. | [
"Returns",
"number",
"of",
"instances",
"of",
"Card",
"(",
"color",
"rank",
")",
"in",
"the",
"initial",
"deck",
"."
] | def num_cards(self, color, rank):
"""Returns number of instances of Card(color, rank) in the initial deck."""
return lib.NumCards(self._game, color, rank) | [
"def",
"num_cards",
"(",
"self",
",",
"color",
",",
"rank",
")",
":",
"return",
"lib",
".",
"NumCards",
"(",
"self",
".",
"_game",
",",
"color",
",",
"rank",
")"
] | https://github.com/deepmind/hanabi-learning-environment/blob/54e79594f4b6fb40ebb3004289c6db0e34a8b5fb/hanabi_learning_environment/pyhanabi.py#L773-L775 | |
OpenMDAO/OpenMDAO | f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd | openmdao/utils/assert_utils.py | python | assert_warning | (category, msg, contains_msg=False) | Context manager asserting that a warning is issued.
Parameters
----------
category : class
The class of the expected warning.
msg : str
The text of the expected warning.
contains_msg : bool
Set to True to check that the warning text contains msg, rather than checking equalit... | Context manager asserting that a warning is issued. | [
"Context",
"manager",
"asserting",
"that",
"a",
"warning",
"is",
"issued",
"."
] | def assert_warning(category, msg, contains_msg=False):
"""
Context manager asserting that a warning is issued.
Parameters
----------
category : class
The class of the expected warning.
msg : str
The text of the expected warning.
contains_msg : bool
Set to True to che... | [
"def",
"assert_warning",
"(",
"category",
",",
"msg",
",",
"contains_msg",
"=",
"False",
")",
":",
"with",
"reset_warning_registry",
"(",
")",
":",
"with",
"warnings",
".",
"catch_warnings",
"(",
"record",
"=",
"True",
")",
"as",
"w",
":",
"warnings",
".",... | https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/utils/assert_utils.py#L21-L62 | ||
openstack/python-keystoneclient | 100253d52e0c62dffffddb6f046ad660a9bce1a9 | keystoneclient/base.py | python | Manager._delete | (self, url, **kwargs) | return resp, self._prepare_return_value(resp, body) | Delete an object.
:param url: a partial URL, e.g., '/servers/my-server'
:param kwargs: Additional arguments will be passed to the request. | Delete an object. | [
"Delete",
"an",
"object",
"."
] | def _delete(self, url, **kwargs):
"""Delete an object.
:param url: a partial URL, e.g., '/servers/my-server'
:param kwargs: Additional arguments will be passed to the request.
"""
resp, body = self.client.delete(url, **kwargs)
return resp, self._prepare_return_value(resp... | [
"def",
"_delete",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"resp",
",",
"body",
"=",
"self",
".",
"client",
".",
"delete",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
"return",
"resp",
",",
"self",
".",
"_prepare_return_value",
"("... | https://github.com/openstack/python-keystoneclient/blob/100253d52e0c62dffffddb6f046ad660a9bce1a9/keystoneclient/base.py#L240-L247 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/op2/op2_interface/op2_scalar.py | python | OP2_Scalar.__init__ | (self, debug=False, log=None, debug_file=None) | Initializes the OP2_Scalar object
Parameters
----------
debug : bool/None; default=True
used to set the logger if no logger is passed in
True: logs debug/info/warning/error messages
False: logs info/warning/error messages
None: logs ... | Initializes the OP2_Scalar object | [
"Initializes",
"the",
"OP2_Scalar",
"object"
] | def __init__(self, debug=False, log=None, debug_file=None):
"""
Initializes the OP2_Scalar object
Parameters
----------
debug : bool/None; default=True
used to set the logger if no logger is passed in
True: logs debug/info/warning/error messages
... | [
"def",
"__init__",
"(",
"self",
",",
"debug",
"=",
"False",
",",
"log",
"=",
"None",
",",
"debug_file",
"=",
"None",
")",
":",
"assert",
"debug",
"is",
"None",
"or",
"isinstance",
"(",
"debug",
",",
"bool",
")",
",",
"'debug=%r'",
"%",
"debug",
"self... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/op2_interface/op2_scalar.py#L535-L589 | ||
miyosuda/unreal | 31d4886149412fa248f6efa490ab65bd2f425cde | train/rmsprop_applier.py | python | RMSPropApplier._slot_dict | (self, slot_name) | return named_slots | [] | def _slot_dict(self, slot_name):
named_slots = self._slots.get(slot_name, None)
if named_slots is None:
named_slots = {}
self._slots[slot_name] = named_slots
return named_slots | [
"def",
"_slot_dict",
"(",
"self",
",",
"slot_name",
")",
":",
"named_slots",
"=",
"self",
".",
"_slots",
".",
"get",
"(",
"slot_name",
",",
"None",
")",
"if",
"named_slots",
"is",
"None",
":",
"named_slots",
"=",
"{",
"}",
"self",
".",
"_slots",
"[",
... | https://github.com/miyosuda/unreal/blob/31d4886149412fa248f6efa490ab65bd2f425cde/train/rmsprop_applier.py#L54-L59 | |||
SymbiFlow/prjxray | 5349556bc2c230801d6df0cf11bccb9cfd171639 | fuzzers/034-cmt-pll-pips/fixup_and_group.py | python | bit_to_str | (bit) | return "{}{}_{:02d}".format(s, bit[0], bit[1]) | Converts a tuple (frame, bit, value) to its string representation. | Converts a tuple (frame, bit, value) to its string representation. | [
"Converts",
"a",
"tuple",
"(",
"frame",
"bit",
"value",
")",
"to",
"its",
"string",
"representation",
"."
] | def bit_to_str(bit):
"""
Converts a tuple (frame, bit, value) to its string representation.
"""
s = "!" if not bit[2] else ""
return "{}{}_{:02d}".format(s, bit[0], bit[1]) | [
"def",
"bit_to_str",
"(",
"bit",
")",
":",
"s",
"=",
"\"!\"",
"if",
"not",
"bit",
"[",
"2",
"]",
"else",
"\"\"",
"return",
"\"{}{}_{:02d}\"",
".",
"format",
"(",
"s",
",",
"bit",
"[",
"0",
"]",
",",
"bit",
"[",
"1",
"]",
")"
] | https://github.com/SymbiFlow/prjxray/blob/5349556bc2c230801d6df0cf11bccb9cfd171639/fuzzers/034-cmt-pll-pips/fixup_and_group.py#L81-L86 | |
jieter/django-tables2 | ce392ee2ee341d7180345a6113919cf9a3925f16 | django_tables2/views.py | python | SingleTableMixin.get_table_class | (self) | Return the class to use for the table. | Return the class to use for the table. | [
"Return",
"the",
"class",
"to",
"use",
"for",
"the",
"table",
"."
] | def get_table_class(self):
"""
Return the class to use for the table.
"""
if self.table_class:
return self.table_class
if self.model:
return tables.table_factory(self.model)
raise ImproperlyConfigured(
"You must either specify {0}.tabl... | [
"def",
"get_table_class",
"(",
"self",
")",
":",
"if",
"self",
".",
"table_class",
":",
"return",
"self",
".",
"table_class",
"if",
"self",
".",
"model",
":",
"return",
"tables",
".",
"table_factory",
"(",
"self",
".",
"model",
")",
"raise",
"ImproperlyCon... | https://github.com/jieter/django-tables2/blob/ce392ee2ee341d7180345a6113919cf9a3925f16/django_tables2/views.py#L86-L97 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/idlelib/pyshell.py | python | PyShell.ResetColorizer | (self) | [] | def ResetColorizer(self):
super().ResetColorizer()
theme = idleConf.CurrentTheme()
tag_colors = {
"stdin": {'background': None, 'foreground': None},
"stdout": idleConf.GetHighlight(theme, "stdout"),
"stderr": idleConf.GetHighlight(theme, "stderr"),
"conso... | [
"def",
"ResetColorizer",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"ResetColorizer",
"(",
")",
"theme",
"=",
"idleConf",
".",
"CurrentTheme",
"(",
")",
"tag_colors",
"=",
"{",
"\"stdin\"",
":",
"{",
"'background'",
":",
"None",
",",
"'foreground'",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/idlelib/pyshell.py#L975-L989 | ||||
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | server/pulp/server/managers/repo/_common.py | python | to_related_repo | (repo_data, configs) | return r | Converts the given database representation of a repository into a plugin's
representation of a related repository. The list of configurations for
the repository's plugins will be included in the returned type.
@param repo_data: database representation of a repository
@type repo_data: dict
@param ... | Converts the given database representation of a repository into a plugin's
representation of a related repository. The list of configurations for
the repository's plugins will be included in the returned type. | [
"Converts",
"the",
"given",
"database",
"representation",
"of",
"a",
"repository",
"into",
"a",
"plugin",
"s",
"representation",
"of",
"a",
"related",
"repository",
".",
"The",
"list",
"of",
"configurations",
"for",
"the",
"repository",
"s",
"plugins",
"will",
... | def to_related_repo(repo_data, configs):
"""
Converts the given database representation of a repository into a plugin's
representation of a related repository. The list of configurations for
the repository's plugins will be included in the returned type.
@param repo_data: database representation of... | [
"def",
"to_related_repo",
"(",
"repo_data",
",",
"configs",
")",
":",
"r",
"=",
"RelatedRepository",
"(",
"repo_data",
"[",
"'id'",
"]",
",",
"configs",
",",
"repo_data",
"[",
"'display_name'",
"]",
",",
"repo_data",
"[",
"'description'",
"]",
",",
"repo_dat... | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/server/pulp/server/managers/repo/_common.py#L25-L42 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/discussion/rest_api/forms.py | python | ThreadListGetForm.clean_following | (self) | Validate following | Validate following | [
"Validate",
"following"
] | def clean_following(self):
"""Validate following"""
value = self.cleaned_data["following"]
if value is False: # lint-amnesty, pylint: disable=no-else-raise
raise ValidationError("The value of the 'following' parameter must be true.")
else:
return value | [
"def",
"clean_following",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"cleaned_data",
"[",
"\"following\"",
"]",
"if",
"value",
"is",
"False",
":",
"# lint-amnesty, pylint: disable=no-else-raise",
"raise",
"ValidationError",
"(",
"\"The value of the 'following' pa... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/discussion/rest_api/forms.py#L82-L88 | ||
lvzhaoyang/DeeperInverseCompositionalAlgorithm | 9a401bf2b03ecfed169c1a655b4fe8be8a4c211d | code/models/LeastSquareTracking.py | python | LeastSquareTracking.__Nto1 | (self, x) | return x.sum(dim=1, keepdim=True) / C | Take the average of multi-dimension feature into one dimensional,
which boostrap the optimization speed | Take the average of multi-dimension feature into one dimensional,
which boostrap the optimization speed | [
"Take",
"the",
"average",
"of",
"multi",
"-",
"dimension",
"feature",
"into",
"one",
"dimensional",
"which",
"boostrap",
"the",
"optimization",
"speed"
] | def __Nto1(self, x):
""" Take the average of multi-dimension feature into one dimensional,
which boostrap the optimization speed
"""
C = x.shape[1]
return x.sum(dim=1, keepdim=True) / C | [
"def",
"__Nto1",
"(",
"self",
",",
"x",
")",
":",
"C",
"=",
"x",
".",
"shape",
"[",
"1",
"]",
"return",
"x",
".",
"sum",
"(",
"dim",
"=",
"1",
",",
"keepdim",
"=",
"True",
")",
"/",
"C"
] | https://github.com/lvzhaoyang/DeeperInverseCompositionalAlgorithm/blob/9a401bf2b03ecfed169c1a655b4fe8be8a4c211d/code/models/LeastSquareTracking.py#L223-L228 | |
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/Crypto/PublicKey/RSA.py | python | _RSAobj.verify | (self, M, signature) | return pubkey.pubkey.verify(self, M, signature) | Verify the validity of an RSA signature.
:attention: this function performs the plain, primitive RSA encryption
(*textbook*). In real applications, you always need to use proper
cryptographic padding, and you should not directly verify data with
this method. Failure to do so may lead... | Verify the validity of an RSA signature. | [
"Verify",
"the",
"validity",
"of",
"an",
"RSA",
"signature",
"."
] | def verify(self, M, signature):
"""Verify the validity of an RSA signature.
:attention: this function performs the plain, primitive RSA encryption
(*textbook*). In real applications, you always need to use proper
cryptographic padding, and you should not directly verify data with
... | [
"def",
"verify",
"(",
"self",
",",
"M",
",",
"signature",
")",
":",
"return",
"pubkey",
".",
"pubkey",
".",
"verify",
"(",
"self",
",",
"M",
",",
"signature",
")"
] | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/Crypto/PublicKey/RSA.py#L201-L221 | |
Kismuz/btgym | 7fb3316e67f1d7a17c620630fb62fb29428b2cec | btgym/envs/base.py | python | BTgymEnv._comm_with_timeout | ( socket, message,) | return response | Exchanges messages via socket, timeout sensitive.
Args:
socket: zmq connected socket to communicate via;
message: message to send;
Note:
socket zmq.RCVTIMEO and zmq.SNDTIMEO should be set to some finite number of milliseconds.
Returns:
dictionar... | Exchanges messages via socket, timeout sensitive. | [
"Exchanges",
"messages",
"via",
"socket",
"timeout",
"sensitive",
"."
] | def _comm_with_timeout( socket, message,):
"""
Exchanges messages via socket, timeout sensitive.
Args:
socket: zmq connected socket to communicate via;
message: message to send;
Note:
socket zmq.RCVTIMEO and zmq.SNDTIMEO should be set to some finite ... | [
"def",
"_comm_with_timeout",
"(",
"socket",
",",
"message",
",",
")",
":",
"response",
"=",
"dict",
"(",
"status",
"=",
"'ok'",
",",
"message",
"=",
"None",
",",
")",
"try",
":",
"socket",
".",
"send_pyobj",
"(",
"message",
")",
"except",
"zmq",
".",
... | https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/envs/base.py#L453-L498 | |
google/python-fire | ed44d8b801fc24e40729abef11b2dcbf6588d361 | fire/console/console_attr.py | python | ConsoleAttr._GetConsoleEncoding | (self) | return None | Gets the encoding as declared by the stdout stream.
Returns:
str, The encoding name or None if it could not be determined. | Gets the encoding as declared by the stdout stream. | [
"Gets",
"the",
"encoding",
"as",
"declared",
"by",
"the",
"stdout",
"stream",
"."
] | def _GetConsoleEncoding(self):
"""Gets the encoding as declared by the stdout stream.
Returns:
str, The encoding name or None if it could not be determined.
"""
console_encoding = getattr(sys.stdout, 'encoding', None)
if not console_encoding:
return None
console_encoding = console_e... | [
"def",
"_GetConsoleEncoding",
"(",
"self",
")",
":",
"console_encoding",
"=",
"getattr",
"(",
"sys",
".",
"stdout",
",",
"'encoding'",
",",
"None",
")",
"if",
"not",
"console_encoding",
":",
"return",
"None",
"console_encoding",
"=",
"console_encoding",
".",
"... | https://github.com/google/python-fire/blob/ed44d8b801fc24e40729abef11b2dcbf6588d361/fire/console/console_attr.py#L307-L321 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/distlib/resources.py | python | Resource.as_stream | (self) | return self.finder.get_stream(self) | Get the resource as a stream.
This is not a property to make it obvious that it returns a new stream
each time. | Get the resource as a stream. | [
"Get",
"the",
"resource",
"as",
"a",
"stream",
"."
] | def as_stream(self):
"""
Get the resource as a stream.
This is not a property to make it obvious that it returns a new stream
each time.
"""
return self.finder.get_stream(self) | [
"def",
"as_stream",
"(",
"self",
")",
":",
"return",
"self",
".",
"finder",
".",
"get_stream",
"(",
"self",
")"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/distlib/resources.py#L85-L92 | |
openstack/openstacksdk | 58384268487fa854f21c470b101641ab382c9897 | openstack/identity/v3/domain.py | python | Domain.assign_role_to_group | (self, session, group, role) | return False | Assign role to group on domain | Assign role to group on domain | [
"Assign",
"role",
"to",
"group",
"on",
"domain"
] | def assign_role_to_group(self, session, group, role):
"""Assign role to group on domain"""
url = utils.urljoin(self.base_path, self.id, 'groups',
group.id, 'roles', role.id)
resp = session.put(url,)
if resp.status_code == 204:
return True
r... | [
"def",
"assign_role_to_group",
"(",
"self",
",",
"session",
",",
"group",
",",
"role",
")",
":",
"url",
"=",
"utils",
".",
"urljoin",
"(",
"self",
".",
"base_path",
",",
"self",
".",
"id",
",",
"'groups'",
",",
"group",
".",
"id",
",",
"'roles'",
","... | https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/identity/v3/domain.py#L78-L85 | |
markj3d/Red9_StudioPack | 1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919 | packages/pydub/pydub/utils.py | python | ratio_to_db | (ratio, val2=None, using_amplitude=True) | Converts the input float to db, which represents the equivalent
to the ratio in power represented by the multiplier passed in. | Converts the input float to db, which represents the equivalent
to the ratio in power represented by the multiplier passed in. | [
"Converts",
"the",
"input",
"float",
"to",
"db",
"which",
"represents",
"the",
"equivalent",
"to",
"the",
"ratio",
"in",
"power",
"represented",
"by",
"the",
"multiplier",
"passed",
"in",
"."
] | def ratio_to_db(ratio, val2=None, using_amplitude=True):
"""
Converts the input float to db, which represents the equivalent
to the ratio in power represented by the multiplier passed in.
"""
ratio = float(ratio)
# accept 2 values and use the ratio of val1 to val2
if val2 is not None:
... | [
"def",
"ratio_to_db",
"(",
"ratio",
",",
"val2",
"=",
"None",
",",
"using_amplitude",
"=",
"True",
")",
":",
"ratio",
"=",
"float",
"(",
"ratio",
")",
"# accept 2 values and use the ratio of val1 to val2",
"if",
"val2",
"is",
"not",
"None",
":",
"ratio",
"=",
... | https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/packages/pydub/pydub/utils.py#L76-L94 | ||
quantumblacklabs/causalnex | 127d9324a3d68c1795299c7522f22cdea880f344 | causalnex/structure/pytorch/sklearn/_base.py | python | DAGBase.fit | (self, X: Union[pd.DataFrame, np.ndarray], y: Union[pd.Series, np.ndarray]) | return self | Fits the sm model using the concat of X and y. | Fits the sm model using the concat of X and y. | [
"Fits",
"the",
"sm",
"model",
"using",
"the",
"concat",
"of",
"X",
"and",
"y",
"."
] | def fit(self, X: Union[pd.DataFrame, np.ndarray], y: Union[pd.Series, np.ndarray]):
"""
Fits the sm model using the concat of X and y.
"""
# defensive X, y checks
check_X_y(X, y, y_numeric=True)
# force X, y to DataFrame, Series for later calculations
X = pd.Dat... | [
"def",
"fit",
"(",
"self",
",",
"X",
":",
"Union",
"[",
"pd",
".",
"DataFrame",
",",
"np",
".",
"ndarray",
"]",
",",
"y",
":",
"Union",
"[",
"pd",
".",
"Series",
",",
"np",
".",
"ndarray",
"]",
")",
":",
"# defensive X, y checks",
"check_X_y",
"(",... | https://github.com/quantumblacklabs/causalnex/blob/127d9324a3d68c1795299c7522f22cdea880f344/causalnex/structure/pytorch/sklearn/_base.py#L175-L255 | |
microsoft/botbuilder-python | 3d410365461dc434df59bdfeaa2f16d28d9df868 | libraries/botbuilder-dialogs/botbuilder/dialogs/memory/dialog_state_manager.py | python | DialogStateManager.remove_item | (self, item: Tuple[str, object]) | Determines whether the dialog state manager contains a specific value (should use __contains__).
:param item: The tuple of the item to locate.
:return bool: True if item is found in the dialog state manager otherwise, False | Determines whether the dialog state manager contains a specific value (should use __contains__).
:param item: The tuple of the item to locate.
:return bool: True if item is found in the dialog state manager otherwise, False | [
"Determines",
"whether",
"the",
"dialog",
"state",
"manager",
"contains",
"a",
"specific",
"value",
"(",
"should",
"use",
"__contains__",
")",
".",
":",
"param",
"item",
":",
"The",
"tuple",
"of",
"the",
"item",
"to",
"locate",
".",
":",
"return",
"bool",
... | def remove_item(self, item: Tuple[str, object]) -> bool:
"""
Determines whether the dialog state manager contains a specific value (should use __contains__).
:param item: The tuple of the item to locate.
:return bool: True if item is found in the dialog state manager otherwise, False
... | [
"def",
"remove_item",
"(",
"self",
",",
"item",
":",
"Tuple",
"[",
"str",
",",
"object",
"]",
")",
"->",
"bool",
":",
"raise",
"RuntimeError",
"(",
"\"Not supported\"",
")"
] | https://github.com/microsoft/botbuilder-python/blob/3d410365461dc434df59bdfeaa2f16d28d9df868/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/dialog_state_manager.py#L534-L540 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.makeunknown | (self, tarinfo, targetpath) | Make a file from a TarInfo object with an unknown type
at targetpath. | Make a file from a TarInfo object with an unknown type
at targetpath. | [
"Make",
"a",
"file",
"from",
"a",
"TarInfo",
"object",
"with",
"an",
"unknown",
"type",
"at",
"targetpath",
"."
] | def makeunknown(self, tarinfo, targetpath):
"""Make a file from a TarInfo object with an unknown type
at targetpath.
"""
self.makefile(tarinfo, targetpath)
self._dbg(1, "tarfile: Unknown file type %r, " \
"extracted as regular file." % tarinfo.type) | [
"def",
"makeunknown",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"self",
".",
"makefile",
"(",
"tarinfo",
",",
"targetpath",
")",
"self",
".",
"_dbg",
"(",
"1",
",",
"\"tarfile: Unknown file type %r, \"",
"\"extracted as regular file.\"",
"%",
"ta... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2312-L2318 | ||
tenzir/threatbus | a26096e7b61b3eddf25c445d40a6cd2ea4420558 | apps/stix-shifter/stix_shifter_threatbus/shifter.py | python | query_indicator | (
indicator: Indicator, module: str, opts: dict, sightings_queue: asyncio.Queue
) | Translates an indicator into a module-specific query and executes it. E.g.,
if the module is `splunk`, the indicator's pattern is first translated into
a valid Splunk query and then executed via the Splunk REST API.
@param indicator The indicator to translate and query
@param module The module's name, e... | Translates an indicator into a module-specific query and executes it. E.g.,
if the module is `splunk`, the indicator's pattern is first translated into
a valid Splunk query and then executed via the Splunk REST API. | [
"Translates",
"an",
"indicator",
"into",
"a",
"module",
"-",
"specific",
"query",
"and",
"executes",
"it",
".",
"E",
".",
"g",
".",
"if",
"the",
"module",
"is",
"splunk",
"the",
"indicator",
"s",
"pattern",
"is",
"first",
"translated",
"into",
"a",
"vali... | async def query_indicator(
indicator: Indicator, module: str, opts: dict, sightings_queue: asyncio.Queue
):
"""
Translates an indicator into a module-specific query and executes it. E.g.,
if the module is `splunk`, the indicator's pattern is first translated into
a valid Splunk query and then execut... | [
"async",
"def",
"query_indicator",
"(",
"indicator",
":",
"Indicator",
",",
"module",
":",
"str",
",",
"opts",
":",
"dict",
",",
"sightings_queue",
":",
"asyncio",
".",
"Queue",
")",
":",
"max_results",
"=",
"opts",
"[",
"\"max_results\"",
"]",
"connection_o... | https://github.com/tenzir/threatbus/blob/a26096e7b61b3eddf25c445d40a6cd2ea4420558/apps/stix-shifter/stix_shifter_threatbus/shifter.py#L360-L442 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | custom/up_nrhm/reports/asha_functionality_checklist_report.py | python | ASHAFunctionalityChecklistReport.ashas | (self) | return sorted(list(self.model_data.data.values()), key=lambda x: x['completed_on']) | [] | def ashas(self):
return sorted(list(self.model_data.data.values()), key=lambda x: x['completed_on']) | [
"def",
"ashas",
"(",
"self",
")",
":",
"return",
"sorted",
"(",
"list",
"(",
"self",
".",
"model_data",
".",
"data",
".",
"values",
"(",
")",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"'completed_on'",
"]",
")"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/custom/up_nrhm/reports/asha_functionality_checklist_report.py#L30-L31 | |||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/xmlrpclib.py | python | gzip_decode | (data) | return decoded | gzip encoded data -> unencoded data
Decode data using the gzip content encoding as described in RFC 1952 | gzip encoded data -> unencoded data | [
"gzip",
"encoded",
"data",
"-",
">",
"unencoded",
"data"
] | def gzip_decode(data):
"""gzip encoded data -> unencoded data
Decode data using the gzip content encoding as described in RFC 1952
"""
if not gzip:
raise NotImplementedError
f = StringIO.StringIO(data)
gzf = gzip.GzipFile(mode="rb", fileobj=f)
try:
decoded = gzf.read()
e... | [
"def",
"gzip_decode",
"(",
"data",
")",
":",
"if",
"not",
"gzip",
":",
"raise",
"NotImplementedError",
"f",
"=",
"StringIO",
".",
"StringIO",
"(",
"data",
")",
"gzf",
"=",
"gzip",
".",
"GzipFile",
"(",
"mode",
"=",
"\"rb\"",
",",
"fileobj",
"=",
"f",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/xmlrpclib.py#L1171-L1186 | |
dorneanu/smalisca | 1aa7a164ee3060afd51d0524b80aa6e8bbec3515 | smalisca/modules/module_graph.py | python | add_nodes | (graph, nodes) | return graph | Add node(s) to graph
Args:
graph (Graph): Graph to add node(s) to
nodes (list): List of nodes
Returns:
Graph: Return the modified graph | Add node(s) to graph | [
"Add",
"node",
"(",
"s",
")",
"to",
"graph"
] | def add_nodes(graph, nodes):
""" Add node(s) to graph
Args:
graph (Graph): Graph to add node(s) to
nodes (list): List of nodes
Returns:
Graph: Return the modified graph
"""
for n in nodes:
if isinstance(n, tuple):
graph.node(n[0], **n[1])
else:
... | [
"def",
"add_nodes",
"(",
"graph",
",",
"nodes",
")",
":",
"for",
"n",
"in",
"nodes",
":",
"if",
"isinstance",
"(",
"n",
",",
"tuple",
")",
":",
"graph",
".",
"node",
"(",
"n",
"[",
"0",
"]",
",",
"*",
"*",
"n",
"[",
"1",
"]",
")",
"else",
"... | https://github.com/dorneanu/smalisca/blob/1aa7a164ee3060afd51d0524b80aa6e8bbec3515/smalisca/modules/module_graph.py#L42-L58 | |
cw1204772/AIC2018_iamai | 9c3720ba5eeb94e02deed303f32acaaa80aa893d | Detection/lib/datasets/json_dataset.py | python | _merge_proposal_boxes_into_roidb | (roidb, box_list) | Add proposal boxes to each roidb entry. | Add proposal boxes to each roidb entry. | [
"Add",
"proposal",
"boxes",
"to",
"each",
"roidb",
"entry",
"."
] | def _merge_proposal_boxes_into_roidb(roidb, box_list):
"""Add proposal boxes to each roidb entry."""
assert len(box_list) == len(roidb)
for i, entry in enumerate(roidb):
boxes = box_list[i]
num_boxes = boxes.shape[0]
gt_overlaps = np.zeros(
(num_boxes, entry['gt_overlaps'... | [
"def",
"_merge_proposal_boxes_into_roidb",
"(",
"roidb",
",",
"box_list",
")",
":",
"assert",
"len",
"(",
"box_list",
")",
"==",
"len",
"(",
"roidb",
")",
"for",
"i",
",",
"entry",
"in",
"enumerate",
"(",
"roidb",
")",
":",
"boxes",
"=",
"box_list",
"[",... | https://github.com/cw1204772/AIC2018_iamai/blob/9c3720ba5eeb94e02deed303f32acaaa80aa893d/Detection/lib/datasets/json_dataset.py#L349-L410 | ||
dbcli/mssql-cli | 6509aa2fc226dde8ce6bab7af9cbb5f03717b936 | build.py | python | build | () | Builds mssql-cli package. | Builds mssql-cli package. | [
"Builds",
"mssql",
"-",
"cli",
"package",
"."
] | def build():
"""
Builds mssql-cli package.
"""
print_heading('Cleanup')
# clean
utility.clean_up(utility.MSSQLCLI_DIST_DIRECTORY)
utility.clean_up_egg_info_sub_directories(utility.ROOT_DIR)
print_heading('Running setup')
# install general requirements.
utility.exec_command... | [
"def",
"build",
"(",
")",
":",
"print_heading",
"(",
"'Cleanup'",
")",
"# clean",
"utility",
".",
"clean_up",
"(",
"utility",
".",
"MSSQLCLI_DIST_DIRECTORY",
")",
"utility",
".",
"clean_up_egg_info_sub_directories",
"(",
"utility",
".",
"ROOT_DIR",
")",
"print_hea... | https://github.com/dbcli/mssql-cli/blob/6509aa2fc226dde8ce6bab7af9cbb5f03717b936/build.py#L41-L94 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/voiper/sulley/impacket/smb.py | python | set_key_odd_parity | (key) | return key | [] | def set_key_odd_parity(key):
""
for i in range(len(key)):
for k in range(7):
bit = 0
t = key[i] >> k
bit = (t ^ bit) & 0x1
key[i] = (key[i] & 0xFE) | bit
return key | [
"def",
"set_key_odd_parity",
"(",
"key",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"key",
")",
")",
":",
"for",
"k",
"in",
"range",
"(",
"7",
")",
":",
"bit",
"=",
"0",
"t",
"=",
"key",
"[",
"i",
"]",
">>",
"k",
"bit",
"=",
"(",... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/impacket/smb.py#L135-L144 | |||
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | fabmetheus_utilities/xml_simple_reader.py | python | DocumentTypeMonad.getNextMonad | (self, character) | return self | Get the next monad. | Get the next monad. | [
"Get",
"the",
"next",
"monad",
"."
] | def getNextMonad(self, character):
'Get the next monad.'
self.input.write(character)
if character == '>':
inputString = self.input.getvalue()
if inputString.endswith('?>'):
textContent = '%s\n' % inputString
self.parentNode.childNodes.append(DocumentTypeNode(self.parentNode, textContent))
return... | [
"def",
"getNextMonad",
"(",
"self",
",",
"character",
")",
":",
"self",
".",
"input",
".",
"write",
"(",
"character",
")",
"if",
"character",
"==",
"'>'",
":",
"inputString",
"=",
"self",
".",
"input",
".",
"getvalue",
"(",
")",
"if",
"inputString",
".... | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/xml_simple_reader.py#L312-L321 | |
GoogleCloudPlatform/datastore-ndb-python | cf4cab3f1f69cd04e1a9229871be466b53729f3f | ndb/eventloop.py | python | get_event_loop | () | return ev | Return a EventLoop instance.
A new instance is created for each new HTTP request. We determine
that we're in a new request by inspecting os.environ, which is reset
at the start of each request. Also, each thread gets its own loop. | Return a EventLoop instance. | [
"Return",
"a",
"EventLoop",
"instance",
"."
] | def get_event_loop():
"""Return a EventLoop instance.
A new instance is created for each new HTTP request. We determine
that we're in a new request by inspecting os.environ, which is reset
at the start of each request. Also, each thread gets its own loop.
"""
ev = _state.event_loop
if not os.getenv(_EV... | [
"def",
"get_event_loop",
"(",
")",
":",
"ev",
"=",
"_state",
".",
"event_loop",
"if",
"not",
"os",
".",
"getenv",
"(",
"_EVENT_LOOP_KEY",
")",
"and",
"ev",
"is",
"not",
"None",
":",
"ev",
".",
"clear",
"(",
")",
"_state",
".",
"event_loop",
"=",
"Non... | https://github.com/GoogleCloudPlatform/datastore-ndb-python/blob/cf4cab3f1f69cd04e1a9229871be466b53729f3f/ndb/eventloop.py#L293-L309 | |
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/progress.py | python | Progress.instance | (parent=None) | return Progress._instance | Singleton to return only one instance of Progress.
:returns: instance of Progress | Singleton to return only one instance of Progress. | [
"Singleton",
"to",
"return",
"only",
"one",
"instance",
"of",
"Progress",
"."
] | def instance(parent=None):
"""
Singleton to return only one instance of Progress.
:returns: instance of Progress
"""
if not hasattr(Progress, "_instance") or Progress._instance is None:
Progress._instance = Progress(parent)
return Progress._instance | [
"def",
"instance",
"(",
"parent",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"Progress",
",",
"\"_instance\"",
")",
"or",
"Progress",
".",
"_instance",
"is",
"None",
":",
"Progress",
".",
"_instance",
"=",
"Progress",
"(",
"parent",
")",
"return... | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/progress.py#L258-L267 | |
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/plugins/poweradminurt/iourt41.py | python | Poweradminurt41Plugin.cmd_pagear | (self, data, client=None, cmd=None) | [<all/none/reset/[+-](nade|snipe|spas|pistol|auto|negev)>] - Set allowed weapons. | [<all/none/reset/[+-](nade|snipe|spas|pistol|auto|negev)>] - Set allowed weapons. | [
"[",
"<all",
"/",
"none",
"/",
"reset",
"/",
"[",
"+",
"-",
"]",
"(",
"nade|snipe|spas|pistol|auto|negev",
")",
">",
"]",
"-",
"Set",
"allowed",
"weapons",
"."
] | def cmd_pagear(self, data, client=None, cmd=None):
"""
[<all/none/reset/[+-](nade|snipe|spas|pistol|auto|negev)>] - Set allowed weapons.
"""
cur_gear = self.console.getCvar('g_gear').getInt()
if not data:
if client:
nade = (cur_gear & 1) != 1
... | [
"def",
"cmd_pagear",
"(",
"self",
",",
"data",
",",
"client",
"=",
"None",
",",
"cmd",
"=",
"None",
")",
":",
"cur_gear",
"=",
"self",
".",
"console",
".",
"getCvar",
"(",
"'g_gear'",
")",
".",
"getInt",
"(",
")",
"if",
"not",
"data",
":",
"if",
... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/plugins/poweradminurt/iourt41.py#L1795-L1852 | ||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/urllib3/poolmanager.py | python | PoolManager.connection_from_host | (self, host, port=None, scheme="http", pool_kwargs=None) | return self.connection_from_context(request_context) | Get a :class:`ConnectionPool` based on the host, port, and scheme.
If ``port`` isn't given, it will be derived from the ``scheme`` using
``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is
provided, it is merged with the instance's ``connection_pool_kw``
variable and used t... | Get a :class:`ConnectionPool` based on the host, port, and scheme. | [
"Get",
"a",
":",
"class",
":",
"ConnectionPool",
"based",
"on",
"the",
"host",
"port",
"and",
"scheme",
"."
] | def connection_from_host(self, host, port=None, scheme="http", pool_kwargs=None):
"""
Get a :class:`ConnectionPool` based on the host, port, and scheme.
If ``port`` isn't given, it will be derived from the ``scheme`` using
``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is... | [
"def",
"connection_from_host",
"(",
"self",
",",
"host",
",",
"port",
"=",
"None",
",",
"scheme",
"=",
"\"http\"",
",",
"pool_kwargs",
"=",
"None",
")",
":",
"if",
"not",
"host",
":",
"raise",
"LocationValueError",
"(",
"\"No host specified.\"",
")",
"reques... | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/urllib3/poolmanager.py#L219-L240 | |
Fantomas42/django-blog-zinnia | 881101a9d1d455b2fc581d6f4ae0947cdd8126c6 | zinnia/feeds.py | python | SearchEntries.description | (self, obj) | return _("The last entries containing the pattern '%(pattern)s'") % {
'pattern': obj} | Description of the feed. | Description of the feed. | [
"Description",
"of",
"the",
"feed",
"."
] | def description(self, obj):
"""
Description of the feed.
"""
return _("The last entries containing the pattern '%(pattern)s'") % {
'pattern': obj} | [
"def",
"description",
"(",
"self",
",",
"obj",
")",
":",
"return",
"_",
"(",
"\"The last entries containing the pattern '%(pattern)s'\"",
")",
"%",
"{",
"'pattern'",
":",
"obj",
"}"
] | https://github.com/Fantomas42/django-blog-zinnia/blob/881101a9d1d455b2fc581d6f4ae0947cdd8126c6/zinnia/feeds.py#L343-L348 | |
achaiah/pywick | 9d663faf0c1660a9b8359a6472c164f658dfc8cb | pywick/models/segmentation/refinenet/refinenet.py | python | BaseRefineNet4Cascade.__init__ | (self,
input_shape,
refinenet_block,
num_classes=1,
features=256,
resnet_factory=models.resnet101,
pretrained=True,
freeze_resnet=False,
**kwargs) | Multi-path 4-Cascaded RefineNet for image segmentation
Args:
input_shape ((int, int)): (channel, size) assumes input has
equal height and width
refinenet_block (block): RefineNet Block
num_classes (int, optional): number of classes
features (int, ... | Multi-path 4-Cascaded RefineNet for image segmentation | [
"Multi",
"-",
"path",
"4",
"-",
"Cascaded",
"RefineNet",
"for",
"image",
"segmentation"
] | def __init__(self,
input_shape,
refinenet_block,
num_classes=1,
features=256,
resnet_factory=models.resnet101,
pretrained=True,
freeze_resnet=False,
**kwargs):
"""Multi-path 4-... | [
"def",
"__init__",
"(",
"self",
",",
"input_shape",
",",
"refinenet_block",
",",
"num_classes",
"=",
"1",
",",
"features",
"=",
"256",
",",
"resnet_factory",
"=",
"models",
".",
"resnet101",
",",
"pretrained",
"=",
"True",
",",
"freeze_resnet",
"=",
"False",... | https://github.com/achaiah/pywick/blob/9d663faf0c1660a9b8359a6472c164f658dfc8cb/pywick/models/segmentation/refinenet/refinenet.py#L17-L94 | ||
runawayhorse001/LearningApacheSpark | 67f3879dce17553195f094f5728b94a01badcf24 | pyspark/mllib/linalg/distributed.py | python | BlockMatrix.add | (self, other) | return BlockMatrix(java_block_matrix, self.rowsPerBlock, self.colsPerBlock) | Adds two block matrices together. The matrices must have the
same size and matching `rowsPerBlock` and `colsPerBlock` values.
If one of the sub matrix blocks that are being added is a
SparseMatrix, the resulting sub matrix block will also be a
SparseMatrix, even if it is being added to a... | Adds two block matrices together. The matrices must have the
same size and matching `rowsPerBlock` and `colsPerBlock` values.
If one of the sub matrix blocks that are being added is a
SparseMatrix, the resulting sub matrix block will also be a
SparseMatrix, even if it is being added to a... | [
"Adds",
"two",
"block",
"matrices",
"together",
".",
"The",
"matrices",
"must",
"have",
"the",
"same",
"size",
"and",
"matching",
"rowsPerBlock",
"and",
"colsPerBlock",
"values",
".",
"If",
"one",
"of",
"the",
"sub",
"matrix",
"blocks",
"that",
"are",
"being... | def add(self, other):
"""
Adds two block matrices together. The matrices must have the
same size and matching `rowsPerBlock` and `colsPerBlock` values.
If one of the sub matrix blocks that are being added is a
SparseMatrix, the resulting sub matrix block will also be a
Sp... | [
"def",
"add",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"BlockMatrix",
")",
":",
"raise",
"TypeError",
"(",
"\"Other should be a BlockMatrix, got %s\"",
"%",
"type",
"(",
"other",
")",
")",
"other_java_block_matrix",
"=... | https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/mllib/linalg/distributed.py#L1186-L1217 | |
xuanyuzhou98/SqueezeSegV2 | 9f02049466fd369398a94de091ca8d7e4fb6ae81 | src/nn_skeleton.py | python | _variable_on_device | (name, shape, initializer, trainable=True) | return var | Helper to create a Variable.
Args:
name: name of the variable
shape: list of ints
initializer: initializer for Variable
Returns:
Variable Tensor | Helper to create a Variable. | [
"Helper",
"to",
"create",
"a",
"Variable",
"."
] | def _variable_on_device(name, shape, initializer, trainable=True):
"""Helper to create a Variable.
Args:
name: name of the variable
shape: list of ints
initializer: initializer for Variable
Returns:
Variable Tensor
"""
# TODO(bichen): fix the hard-coded data type below
dtype = tf.float32
... | [
"def",
"_variable_on_device",
"(",
"name",
",",
"shape",
",",
"initializer",
",",
"trainable",
"=",
"True",
")",
":",
"# TODO(bichen): fix the hard-coded data type below",
"dtype",
"=",
"tf",
".",
"float32",
"if",
"not",
"callable",
"(",
"initializer",
")",
":",
... | https://github.com/xuanyuzhou98/SqueezeSegV2/blob/9f02049466fd369398a94de091ca8d7e4fb6ae81/src/nn_skeleton.py#L16-L34 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/cluster_summary_dto.py | python | ClusterSummaryDTO.connected_to_cluster | (self) | return self._connected_to_cluster | Gets the connected_to_cluster of this ClusterSummaryDTO.
Whether this NiFi instance is connected to a cluster.
:return: The connected_to_cluster of this ClusterSummaryDTO.
:rtype: bool | Gets the connected_to_cluster of this ClusterSummaryDTO.
Whether this NiFi instance is connected to a cluster. | [
"Gets",
"the",
"connected_to_cluster",
"of",
"this",
"ClusterSummaryDTO",
".",
"Whether",
"this",
"NiFi",
"instance",
"is",
"connected",
"to",
"a",
"cluster",
"."
] | def connected_to_cluster(self):
"""
Gets the connected_to_cluster of this ClusterSummaryDTO.
Whether this NiFi instance is connected to a cluster.
:return: The connected_to_cluster of this ClusterSummaryDTO.
:rtype: bool
"""
return self._connected_to_cluster | [
"def",
"connected_to_cluster",
"(",
"self",
")",
":",
"return",
"self",
".",
"_connected_to_cluster"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/cluster_summary_dto.py#L141-L149 | |
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/datastore/data_types.py | python | FuzzTarget.fully_qualified_name | (self) | return fuzz_target_fully_qualified_name(self.engine, self.project,
self.binary) | Get the fully qualified name for this fuzz target. | Get the fully qualified name for this fuzz target. | [
"Get",
"the",
"fully",
"qualified",
"name",
"for",
"this",
"fuzz",
"target",
"."
] | def fully_qualified_name(self):
"""Get the fully qualified name for this fuzz target."""
return fuzz_target_fully_qualified_name(self.engine, self.project,
self.binary) | [
"def",
"fully_qualified_name",
"(",
"self",
")",
":",
"return",
"fuzz_target_fully_qualified_name",
"(",
"self",
".",
"engine",
",",
"self",
".",
"project",
",",
"self",
".",
"binary",
")"
] | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/datastore/data_types.py#L1192-L1195 | |
Instagram/LibCST | 13370227703fe3171e94c57bdd7977f3af696b73 | libcst/_parser/py_whitespace_parser.py | python | _parse_indent | (
config: BaseWhitespaceParserConfig,
state: State,
*,
override_absolute_indent: Optional[str] = None,
) | return False | Returns True if indentation was found, otherwise False. | Returns True if indentation was found, otherwise False. | [
"Returns",
"True",
"if",
"indentation",
"was",
"found",
"otherwise",
"False",
"."
] | def _parse_indent(
config: BaseWhitespaceParserConfig,
state: State,
*,
override_absolute_indent: Optional[str] = None,
) -> bool:
"""
Returns True if indentation was found, otherwise False.
"""
absolute_indent = (
override_absolute_indent
if override_absolute_indent is n... | [
"def",
"_parse_indent",
"(",
"config",
":",
"BaseWhitespaceParserConfig",
",",
"state",
":",
"State",
",",
"*",
",",
"override_absolute_indent",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"->",
"bool",
":",
"absolute_indent",
"=",
"(",
"overrid... | https://github.com/Instagram/LibCST/blob/13370227703fe3171e94c57bdd7977f3af696b73/libcst/_parser/py_whitespace_parser.py#L161-L184 | |
fjarri/reikna | e32e507d74337c13c508ae9ff5f0716a99798a61 | reikna/cluda/api.py | python | Kernel.prepare | (self, global_size, local_size=None, local_mem=0) | Prepare the kernel for execution with given parameters.
:param global_size: an integer or a tuple of integers,
specifying total number of work items to run.
:param local_size: an integer or a tuple of integers,
specifying the size of a single work group.
Should have ... | Prepare the kernel for execution with given parameters. | [
"Prepare",
"the",
"kernel",
"for",
"execution",
"with",
"given",
"parameters",
"."
] | def prepare(self, global_size, local_size=None, local_mem=0):
"""
Prepare the kernel for execution with given parameters.
:param global_size: an integer or a tuple of integers,
specifying total number of work items to run.
:param local_size: an integer or a tuple of integers... | [
"def",
"prepare",
"(",
"self",
",",
"global_size",
",",
"local_size",
"=",
"None",
",",
"local_mem",
"=",
"0",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/fjarri/reikna/blob/e32e507d74337c13c508ae9ff5f0716a99798a61/reikna/cluda/api.py#L695-L707 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/models/plots.py | python | Plot.column | (self, col, gridplot) | return self in gridplot.column(col) | Return whether this plot is in a given column of a GridPlot.
Args:
col (int) : index of the column to test
gridplot (GridPlot) : the GridPlot to check
Returns:
bool | Return whether this plot is in a given column of a GridPlot. | [
"Return",
"whether",
"this",
"plot",
"is",
"in",
"a",
"given",
"column",
"of",
"a",
"GridPlot",
"."
] | def column(self, col, gridplot):
''' Return whether this plot is in a given column of a GridPlot.
Args:
col (int) : index of the column to test
gridplot (GridPlot) : the GridPlot to check
Returns:
bool
'''
return self in gridplot.column(col) | [
"def",
"column",
"(",
"self",
",",
"col",
",",
"gridplot",
")",
":",
"return",
"self",
"in",
"gridplot",
".",
"column",
"(",
"col",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/models/plots.py#L139-L150 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | updateMaker/prepareForWeIOServer/prepareUpdate.py | python | saveConfiguration | (path, conf) | [] | def saveConfiguration(path, conf):
inputFile = open(path+"/updateWeio.json", 'w')
print(inputFile)
ret = inputFile.write(json.dumps(conf, indent=4, sort_keys=True))
inputFile.close() | [
"def",
"saveConfiguration",
"(",
"path",
",",
"conf",
")",
":",
"inputFile",
"=",
"open",
"(",
"path",
"+",
"\"/updateWeio.json\"",
",",
"'w'",
")",
"print",
"(",
"inputFile",
")",
"ret",
"=",
"inputFile",
".",
"write",
"(",
"json",
".",
"dumps",
"(",
... | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/updateMaker/prepareForWeIOServer/prepareUpdate.py#L17-L21 | ||||
nortikin/sverchok | 7b460f01317c15f2681bfa3e337c5e7346f3711b | nodes/number/curve_mapper.py | python | SvCurveMapperNode.save_to_json | (self, node_data: dict) | function to set data for exporting json | function to set data for exporting json | [
"function",
"to",
"set",
"data",
"for",
"exporting",
"json"
] | def save_to_json(self, node_data: dict):
'''function to set data for exporting json'''
curve_node_name = self._get_curve_node_name()
data = get_rgb_curve(node_group_name, curve_node_name)
data_json_str = json.dumps(data)
node_data['curve_data'] = data_json_str | [
"def",
"save_to_json",
"(",
"self",
",",
"node_data",
":",
"dict",
")",
":",
"curve_node_name",
"=",
"self",
".",
"_get_curve_node_name",
"(",
")",
"data",
"=",
"get_rgb_curve",
"(",
"node_group_name",
",",
"curve_node_name",
")",
"data_json_str",
"=",
"json",
... | https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/nodes/number/curve_mapper.py#L138-L143 | ||
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/api.py | python | CobblerAPI.mkloaders | (self) | Create the GRUB installer images via this API call. It utilizes ``grub2-mkimage`` behind the curtain. | Create the GRUB installer images via this API call. It utilizes ``grub2-mkimage`` behind the curtain. | [
"Create",
"the",
"GRUB",
"installer",
"images",
"via",
"this",
"API",
"call",
".",
"It",
"utilizes",
"grub2",
"-",
"mkimage",
"behind",
"the",
"curtain",
"."
] | def mkloaders(self):
"""
Create the GRUB installer images via this API call. It utilizes ``grub2-mkimage`` behind the curtain.
"""
action = mkloaders.MkLoaders(self)
action.run() | [
"def",
"mkloaders",
"(",
"self",
")",
":",
"action",
"=",
"mkloaders",
".",
"MkLoaders",
"(",
"self",
")",
"action",
".",
"run",
"(",
")"
] | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/api.py#L1873-L1878 | ||
tensorflow/tensor2tensor | 2a33b152d7835af66a6d20afe7961751047e28dd | tensor2tensor/models/research/attention_lm_moe.py | python | attention_lm_no_moe_small | () | return hparams | Without the mixture of experts (for comparison).
on lm1b_32k:
~45M params
2 steps/sec on [GeForce GTX TITAN X]
After 50K steps on 8 GPUs (synchronous):
eval_log_ppl_per_token = 3.51
Returns:
an hparams object. | Without the mixture of experts (for comparison). | [
"Without",
"the",
"mixture",
"of",
"experts",
"(",
"for",
"comparison",
")",
"."
] | def attention_lm_no_moe_small():
"""Without the mixture of experts (for comparison).
on lm1b_32k:
~45M params
2 steps/sec on [GeForce GTX TITAN X]
After 50K steps on 8 GPUs (synchronous):
eval_log_ppl_per_token = 3.51
Returns:
an hparams object.
"""
hparams = attention_lm_moe_sma... | [
"def",
"attention_lm_no_moe_small",
"(",
")",
":",
"hparams",
"=",
"attention_lm_moe_small",
"(",
")",
"hparams",
".",
"moe_layers",
"=",
"\"\"",
"return",
"hparams"
] | https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/models/research/attention_lm_moe.py#L681-L695 | |
marcosfede/algorithms | 1ee7c815f9d556c9cef4d4b0d21ee3a409d21629 | adventofcode/2019/d19/d19.py | python | Point.__mul__ | (self, num) | return Point(self.x*num, self.y*num) | [] | def __mul__(self, num):
return Point(self.x*num, self.y*num) | [
"def",
"__mul__",
"(",
"self",
",",
"num",
")",
":",
"return",
"Point",
"(",
"self",
".",
"x",
"*",
"num",
",",
"self",
".",
"y",
"*",
"num",
")"
] | https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/adventofcode/2019/d19/d19.py#L91-L92 | |||
radlab/sparrow | afb8efadeb88524f1394d1abe4ea66c6fd2ac744 | src/main/python/parse_logs.py | python | Task.service_time | (self) | return (self.completion_time - self.node_monitor_launch_time) | Returns the service time (time executing on backend). | Returns the service time (time executing on backend). | [
"Returns",
"the",
"service",
"time",
"(",
"time",
"executing",
"on",
"backend",
")",
"."
] | def service_time(self):
""" Returns the service time (time executing on backend)."""
#print self.node_monitor_address, self.completion_time - self.node_monitor_launch_time
return (self.completion_time - self.node_monitor_launch_time) | [
"def",
"service_time",
"(",
"self",
")",
":",
"#print self.node_monitor_address, self.completion_time - self.node_monitor_launch_time",
"return",
"(",
"self",
".",
"completion_time",
"-",
"self",
".",
"node_monitor_launch_time",
")"
] | https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/src/main/python/parse_logs.py#L128-L131 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/cryptography/hazmat/primitives/serialization/ssh.py | python | _ssh_read_next_mpint | (data) | return (
utils.int_from_bytes(mpint_data, byteorder='big', signed=False), rest
) | Reads the next mpint from the data.
Currently, all mpints are interpreted as unsigned. | Reads the next mpint from the data. | [
"Reads",
"the",
"next",
"mpint",
"from",
"the",
"data",
"."
] | def _ssh_read_next_mpint(data):
"""
Reads the next mpint from the data.
Currently, all mpints are interpreted as unsigned.
"""
mpint_data, rest = _ssh_read_next_string(data)
return (
utils.int_from_bytes(mpint_data, byteorder='big', signed=False), rest
) | [
"def",
"_ssh_read_next_mpint",
"(",
"data",
")",
":",
"mpint_data",
",",
"rest",
"=",
"_ssh_read_next_string",
"(",
"data",
")",
"return",
"(",
"utils",
".",
"int_from_bytes",
"(",
"mpint_data",
",",
"byteorder",
"=",
"'big'",
",",
"signed",
"=",
"False",
")... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/cryptography/hazmat/primitives/serialization/ssh.py#L132-L142 | |
hahnyuan/nn_tools | e04903d2946a75b62128b64ada7eec8b9fbd841f | analysis/MxnetA.py | python | Monitor.install | (self, exe) | [] | def install(self, exe):
exe.set_monitor_callback(self.stat_helper)
self.exes.append(exe) | [
"def",
"install",
"(",
"self",
",",
"exe",
")",
":",
"exe",
".",
"set_monitor_callback",
"(",
"self",
".",
"stat_helper",
")",
"self",
".",
"exes",
".",
"append",
"(",
"exe",
")"
] | https://github.com/hahnyuan/nn_tools/blob/e04903d2946a75b62128b64ada7eec8b9fbd841f/analysis/MxnetA.py#L109-L111 | ||||
chainer/chainercv | 7159616642e0be7c5b3ef380b848e16b7e99355b | chainercv/chainer_experimental/datasets/sliceable/sliceable_dataset.py | python | SliceableDataset.get_example | (self, index) | [] | def get_example(self, index):
if isinstance(self.keys, tuple):
return self.get_example_by_keys(
index, tuple(range(len(self.keys))))
else:
return self.get_example_by_keys(index, (0,))[0] | [
"def",
"get_example",
"(",
"self",
",",
"index",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"keys",
",",
"tuple",
")",
":",
"return",
"self",
".",
"get_example_by_keys",
"(",
"index",
",",
"tuple",
"(",
"range",
"(",
"len",
"(",
"self",
".",
"ke... | https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv/chainer_experimental/datasets/sliceable/sliceable_dataset.py#L95-L100 | ||||
danielzak/sl-quant | 460a55c966192b2bde5497f8502ac24f81a51ddf | ex3-self_learning_quant.py | python | get_reward | (new_state, time_step, action, xdata, signal, terminal_state, eval=False, epoch=0) | return reward | [] | def get_reward(new_state, time_step, action, xdata, signal, terminal_state, eval=False, epoch=0):
reward = 0
signal.fillna(value=0, inplace=True)
if eval == False:
bt = twp.Backtest(pd.Series(data=[x for x in xdata[time_step-2:time_step]], index=signal[time_step-2:time_step].index.values), signal[t... | [
"def",
"get_reward",
"(",
"new_state",
",",
"time_step",
",",
"action",
",",
"xdata",
",",
"signal",
",",
"terminal_state",
",",
"eval",
"=",
"False",
",",
"epoch",
"=",
"0",
")",
":",
"reward",
"=",
"0",
"signal",
".",
"fillna",
"(",
"value",
"=",
"... | https://github.com/danielzak/sl-quant/blob/460a55c966192b2bde5497f8502ac24f81a51ddf/ex3-self_learning_quant.py#L123-L145 | |||
graphcore/examples | 46d2b7687b829778369fc6328170a7b14761e5c6 | code_examples/tensorflow2/abc_covid_19/ABC_IPU.py | python | main | () | Warmup, timing, and stats output handling. | Warmup, timing, and stats output handling. | [
"Warmup",
"timing",
"and",
"stats",
"output",
"handling",
"."
] | def main():
"""Warmup, timing, and stats output handling."""
with strategy.scope():
# Warm-up
if not args.sparse_output:
print("Warming up...")
strategy.run(
loop_collect_samples,
[args.n_samples_target,
tf.constant(1, dtype=tf.int32),
... | [
"def",
"main",
"(",
")",
":",
"with",
"strategy",
".",
"scope",
"(",
")",
":",
"# Warm-up",
"if",
"not",
"args",
".",
"sparse_output",
":",
"print",
"(",
"\"Warming up...\"",
")",
"strategy",
".",
"run",
"(",
"loop_collect_samples",
",",
"[",
"args",
"."... | https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/code_examples/tensorflow2/abc_covid_19/ABC_IPU.py#L305-L380 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/androguard/core/bytecodes/dvm.py | python | AnnotationElement.get_value | (self) | return self.value | Return the element value (EncodedValue)
:rtype: a :class:`EncodedValue` object | Return the element value (EncodedValue) | [
"Return",
"the",
"element",
"value",
"(",
"EncodedValue",
")"
] | def get_value(self) :
"""
Return the element value (EncodedValue)
:rtype: a :class:`EncodedValue` object
"""
return self.value | [
"def",
"get_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"value"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/androguard/core/bytecodes/dvm.py#L1545-L1551 | |
modin-project/modin | 0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee | modin/core/dataframe/pandas/dataframe/dataframe.py | python | PandasDataframe._axes_lengths | (self) | return [self._row_lengths, self._column_widths] | Get a pair of row partitions lengths and column partitions widths.
Returns
-------
list
The pair of row partitions lengths and column partitions widths. | Get a pair of row partitions lengths and column partitions widths. | [
"Get",
"a",
"pair",
"of",
"row",
"partitions",
"lengths",
"and",
"column",
"partitions",
"widths",
"."
] | def _axes_lengths(self):
"""
Get a pair of row partitions lengths and column partitions widths.
Returns
-------
list
The pair of row partitions lengths and column partitions widths.
"""
return [self._row_lengths, self._column_widths] | [
"def",
"_axes_lengths",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"_row_lengths",
",",
"self",
".",
"_column_widths",
"]"
] | https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/core/dataframe/pandas/dataframe/dataframe.py#L142-L151 | |
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | OmsAgent/omsagent.py | python | was_curl_found | (exit_code, output) | return True | Returns false if exit_code indicates that curl was not installed; this can
occur when package lists need to be updated, or when some archives are
out-of-date | Returns false if exit_code indicates that curl was not installed; this can
occur when package lists need to be updated, or when some archives are
out-of-date | [
"Returns",
"false",
"if",
"exit_code",
"indicates",
"that",
"curl",
"was",
"not",
"installed",
";",
"this",
"can",
"occur",
"when",
"package",
"lists",
"need",
"to",
"be",
"updated",
"or",
"when",
"some",
"archives",
"are",
"out",
"-",
"of",
"-",
"date"
] | def was_curl_found(exit_code, output):
"""
Returns false if exit_code indicates that curl was not installed; this can
occur when package lists need to be updated, or when some archives are
out-of-date
"""
if exit_code is InstallErrorCurlNotInstalled:
return False
return True | [
"def",
"was_curl_found",
"(",
"exit_code",
",",
"output",
")",
":",
"if",
"exit_code",
"is",
"InstallErrorCurlNotInstalled",
":",
"return",
"False",
"return",
"True"
] | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/OmsAgent/omsagent.py#L1452-L1460 | |
VITA-Group/FasterSeg | 478b0265eb9ab626cfbe503ad16d2452878b38cc | latency/operations.py | python | FactorizedReduce.__init__ | (self, C_in, C_out, stride=1, slimmable=True, width_mult_list=[1.]) | [] | def __init__(self, C_in, C_out, stride=1, slimmable=True, width_mult_list=[1.]):
super(FactorizedReduce, self).__init__()
assert stride in [1, 2]
assert C_out % 2 == 0
self.C_in = C_in
self.C_out = C_out
self.stride = stride
self.slimmable = slimmable
self... | [
"def",
"__init__",
"(",
"self",
",",
"C_in",
",",
"C_out",
",",
"stride",
"=",
"1",
",",
"slimmable",
"=",
"True",
",",
"width_mult_list",
"=",
"[",
"1.",
"]",
")",
":",
"super",
"(",
"FactorizedReduce",
",",
"self",
")",
".",
"__init__",
"(",
")",
... | https://github.com/VITA-Group/FasterSeg/blob/478b0265eb9ab626cfbe503ad16d2452878b38cc/latency/operations.py#L440-L463 | ||||
grow/grow | 97fc21730b6a674d5d33948d94968e79447ce433 | grow/common/rc_config.py | python | RCConfig.reset_update_check | (self) | Reset the timestamp of the last_checked. | Reset the timestamp of the last_checked. | [
"Reset",
"the",
"timestamp",
"of",
"the",
"last_checked",
"."
] | def reset_update_check(self):
"""Reset the timestamp of the last_checked."""
self.last_checked = self._time() | [
"def",
"reset_update_check",
"(",
"self",
")",
":",
"self",
".",
"last_checked",
"=",
"self",
".",
"_time",
"(",
")"
] | https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/common/rc_config.py#L76-L78 | ||
ArchiveBox/ArchiveBox | 663918a37298d6b7617d1f36d346f95947c5bab2 | archivebox/cli/__init__.py | python | list_subcommands | () | return dict(sorted(COMMANDS, key=display_order)) | find and import all valid archivebox_<subcommand>.py files in CLI_DIR | find and import all valid archivebox_<subcommand>.py files in CLI_DIR | [
"find",
"and",
"import",
"all",
"valid",
"archivebox_<subcommand",
">",
".",
"py",
"files",
"in",
"CLI_DIR"
] | def list_subcommands() -> Dict[str, str]:
"""find and import all valid archivebox_<subcommand>.py files in CLI_DIR"""
COMMANDS = []
for filename in os.listdir(CLI_DIR):
if is_cli_module(filename):
subcommand = filename.replace('archivebox_', '').replace('.py', '')
module = i... | [
"def",
"list_subcommands",
"(",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"COMMANDS",
"=",
"[",
"]",
"for",
"filename",
"in",
"os",
".",
"listdir",
"(",
"CLI_DIR",
")",
":",
"if",
"is_cli_module",
"(",
"filename",
")",
":",
"subcommand",
"... | https://github.com/ArchiveBox/ArchiveBox/blob/663918a37298d6b7617d1f36d346f95947c5bab2/archivebox/cli/__init__.py#L36-L54 | |
Qirky/FoxDot | 76318f9630bede48ff3994146ed644affa27bfa4 | FoxDot/lib/TimeVar.py | python | TimeVar.__radd__ | (self, other) | return new | [] | def __radd__(self, other):
new = self.math_op(other, "__radd__")
if not isinstance(other, (TimeVar, int, float)):
return new
new = self.new(other)
new.evaluate = fetch(rAdd)
return new | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"new",
"=",
"self",
".",
"math_op",
"(",
"other",
",",
"\"__radd__\"",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"(",
"TimeVar",
",",
"int",
",",
"float",
")",
")",
":",
"return",
"ne... | https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/TimeVar.py#L312-L318 | |||
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/tools/appcfg.py | python | AppCfgApp.DeleteVersion | (self) | Deletes the specified version for an app. | Deletes the specified version for an app. | [
"Deletes",
"the",
"specified",
"version",
"for",
"an",
"app",
"."
] | def DeleteVersion(self):
"""Deletes the specified version for an app."""
if not (self.options.app_id and self.options.version):
self.parser.error('Expected an <app_id> argument, a <version> argument '
'and an optional <module> argument.')
if self.options.module:
module = ... | [
"def",
"DeleteVersion",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"options",
".",
"app_id",
"and",
"self",
".",
"options",
".",
"version",
")",
":",
"self",
".",
"parser",
".",
"error",
"(",
"'Expected an <app_id> argument, a <version> argument '",... | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/tools/appcfg.py#L4211-L4227 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/_deprecate/graph.py | python | DGLGraph.clear_cache | (self) | Clear all cached graph structures such as adjmat.
By default, all graph structure related sparse matrices (e.g. adjmat, incmat)
are cached so they could be reused with the cost of extra memory consumption.
This function can be used to clear the cached matrices if memory is an issue. | Clear all cached graph structures such as adjmat. | [
"Clear",
"all",
"cached",
"graph",
"structures",
"such",
"as",
"adjmat",
"."
] | def clear_cache(self):
"""Clear all cached graph structures such as adjmat.
By default, all graph structure related sparse matrices (e.g. adjmat, incmat)
are cached so they could be reused with the cost of extra memory consumption.
This function can be used to clear the cached matrices ... | [
"def",
"clear_cache",
"(",
"self",
")",
":",
"self",
".",
"_graph",
".",
"clear_cache",
"(",
")"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/_deprecate/graph.py#L1743-L1750 | ||
enthought/chaco | 0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f | chaco/tools/dataprinter.py | python | DataPrinter._build_text_from_event | (self, event) | return self.format % (x, y) | Build the text to display from the mouse event. | Build the text to display from the mouse event. | [
"Build",
"the",
"text",
"to",
"display",
"from",
"the",
"mouse",
"event",
"."
] | def _build_text_from_event(self, event):
"""Build the text to display from the mouse event."""
plot = self.component
ndx = plot.map_index((event.x, event.y), index_only=True)
x = plot.index.get_data()[ndx]
y = plot.value.get_data()[ndx]
return self.format % (x, y) | [
"def",
"_build_text_from_event",
"(",
"self",
",",
"event",
")",
":",
"plot",
"=",
"self",
".",
"component",
"ndx",
"=",
"plot",
".",
"map_index",
"(",
"(",
"event",
".",
"x",
",",
"event",
".",
"y",
")",
",",
"index_only",
"=",
"True",
")",
"x",
"... | https://github.com/enthought/chaco/blob/0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f/chaco/tools/dataprinter.py#L51-L57 | |
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | skeinforge_application/skeinforge_plugins/craft_plugins/fill.py | python | YIntersectionPath.__repr__ | (self) | return '%s, %s, %s' % ( self.pathIndex, self.pointIndex, self.y ) | Get the string representation of this y intersection. | Get the string representation of this y intersection. | [
"Get",
"the",
"string",
"representation",
"of",
"this",
"y",
"intersection",
"."
] | def __repr__(self):
'Get the string representation of this y intersection.'
return '%s, %s, %s' % ( self.pathIndex, self.pointIndex, self.y ) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'%s, %s, %s'",
"%",
"(",
"self",
".",
"pathIndex",
",",
"self",
".",
"pointIndex",
",",
"self",
".",
"y",
")"
] | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py#L1384-L1386 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/environment.py | python | Template.debug_info | (self) | return [tuple(map(int, x.split('='))) for x in
self._debug_info.split('&')] | The debug info mapping. | The debug info mapping. | [
"The",
"debug",
"info",
"mapping",
"."
] | def debug_info(self):
"""The debug info mapping."""
return [tuple(map(int, x.split('='))) for x in
self._debug_info.split('&')] | [
"def",
"debug_info",
"(",
"self",
")",
":",
"return",
"[",
"tuple",
"(",
"map",
"(",
"int",
",",
"x",
".",
"split",
"(",
"'='",
")",
")",
")",
"for",
"x",
"in",
"self",
".",
"_debug_info",
".",
"split",
"(",
"'&'",
")",
"]"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/environment.py#L749-L752 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/core/property/descriptors.py | python | PropertyDescriptor.__str__ | (self) | return "PropertyDescriptor(%s)" % (self.name) | Basic string representation of ``PropertyDescriptor``.
**Subclasses must implement this to serve their specific needs.** | Basic string representation of ``PropertyDescriptor``. | [
"Basic",
"string",
"representation",
"of",
"PropertyDescriptor",
"."
] | def __str__(self):
''' Basic string representation of ``PropertyDescriptor``.
**Subclasses must implement this to serve their specific needs.**
'''
return "PropertyDescriptor(%s)" % (self.name) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\"PropertyDescriptor(%s)\"",
"%",
"(",
"self",
".",
"name",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/core/property/descriptors.py#L137-L143 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/lib/linalg_helper.py | python | krylov | (aop, b, x0=None, tol=1e-10, max_cycle=30, dot=numpy.dot,
lindep=DSOLVE_LINDEP, callback=None, hermi=False,
max_memory=MAX_MEMORY, verbose=logger.WARN) | return x | r'''Krylov subspace method to solve (1+a) x = b. Ref:
J. A. Pople et al, Int. J. Quantum. Chem. Symp. 13, 225 (1979).
Args:
aop : function(x) => array_like_x
aop(x) to mimic the matrix vector multiplication :math:`\sum_{j}a_{ij} x_j`.
The argument is a 1D array. The returne... | r'''Krylov subspace method to solve (1+a) x = b. Ref:
J. A. Pople et al, Int. J. Quantum. Chem. Symp. 13, 225 (1979). | [
"r",
"Krylov",
"subspace",
"method",
"to",
"solve",
"(",
"1",
"+",
"a",
")",
"x",
"=",
"b",
".",
"Ref",
":",
"J",
".",
"A",
".",
"Pople",
"et",
"al",
"Int",
".",
"J",
".",
"Quantum",
".",
"Chem",
".",
"Symp",
".",
"13",
"225",
"(",
"1979",
... | def krylov(aop, b, x0=None, tol=1e-10, max_cycle=30, dot=numpy.dot,
lindep=DSOLVE_LINDEP, callback=None, hermi=False,
max_memory=MAX_MEMORY, verbose=logger.WARN):
r'''Krylov subspace method to solve (1+a) x = b. Ref:
J. A. Pople et al, Int. J. Quantum. Chem. Symp. 13, 225 (1979).
... | [
"def",
"krylov",
"(",
"aop",
",",
"b",
",",
"x0",
"=",
"None",
",",
"tol",
"=",
"1e-10",
",",
"max_cycle",
"=",
"30",
",",
"dot",
"=",
"numpy",
".",
"dot",
",",
"lindep",
"=",
"DSOLVE_LINDEP",
",",
"callback",
"=",
"None",
",",
"hermi",
"=",
"Fal... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/lib/linalg_helper.py#L1273-L1428 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | loader_input_t_from_fp | (*args) | return _idaapi.loader_input_t_from_fp(*args) | loader_input_t_from_fp(fp) -> loader_input_t | loader_input_t_from_fp(fp) -> loader_input_t | [
"loader_input_t_from_fp",
"(",
"fp",
")",
"-",
">",
"loader_input_t"
] | def loader_input_t_from_fp(*args):
"""
loader_input_t_from_fp(fp) -> loader_input_t
"""
return _idaapi.loader_input_t_from_fp(*args) | [
"def",
"loader_input_t_from_fp",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"loader_input_t_from_fp",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L25773-L25777 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/flatnotebook.py | python | FlatNotebook.SetRightClickMenu | (self, menu) | Sets the popup menu associated to a right click on a tab.
:param `menu`: an instance of :class:`wx.Menu`. | Sets the popup menu associated to a right click on a tab. | [
"Sets",
"the",
"popup",
"menu",
"associated",
"to",
"a",
"right",
"click",
"on",
"a",
"tab",
"."
] | def SetRightClickMenu(self, menu):
"""
Sets the popup menu associated to a right click on a tab.
:param `menu`: an instance of :class:`wx.Menu`.
"""
self._pages._pRightClickMenu = menu | [
"def",
"SetRightClickMenu",
"(",
"self",
",",
"menu",
")",
":",
"self",
".",
"_pages",
".",
"_pRightClickMenu",
"=",
"menu"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/flatnotebook.py#L4848-L4855 | ||
donnemartin/data-science-ipython-notebooks | 5b3c00d462c6e9200315afe46d0093948621eb95 | scipy/thinkstats2.py | python | Hist.Freq | (self, x) | return self.d.get(x, 0) | Gets the frequency associated with the value x.
Args:
x: number value
Returns:
int frequency | Gets the frequency associated with the value x. | [
"Gets",
"the",
"frequency",
"associated",
"with",
"the",
"value",
"x",
"."
] | def Freq(self, x):
"""Gets the frequency associated with the value x.
Args:
x: number value
Returns:
int frequency
"""
return self.d.get(x, 0) | [
"def",
"Freq",
"(",
"self",
",",
"x",
")",
":",
"return",
"self",
".",
"d",
".",
"get",
"(",
"x",
",",
"0",
")"
] | https://github.com/donnemartin/data-science-ipython-notebooks/blob/5b3c00d462c6e9200315afe46d0093948621eb95/scipy/thinkstats2.py#L373-L382 | |
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/gui/qt/main_window.py | python | ElectrumWindow.tx_from_text | (self, data: Union[str, bytes]) | [] | def tx_from_text(self, data: Union[str, bytes]) -> Union[None, 'PartialTransaction', 'Transaction']:
from electrum.transaction import tx_from_any
try:
return tx_from_any(data)
except BaseException as e:
self.show_critical(_("Electrum was unable to parse your transaction")... | [
"def",
"tx_from_text",
"(",
"self",
",",
"data",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
")",
"->",
"Union",
"[",
"None",
",",
"'PartialTransaction'",
",",
"'Transaction'",
"]",
":",
"from",
"electrum",
".",
"transaction",
"import",
"tx_from_any",
"tr... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/gui/qt/main_window.py#L2827-L2833 | ||||
elastic/elasticsearch-py | 6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb | elasticsearch/_sync/client/rollup.py | python | RollupClient.get_jobs | (
self,
*,
id: Optional[Any] = None,
error_trace: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
human: Optional[bool] = None,
pretty: Optional[bool] = None,
) | return self._perform_request("GET", __target, headers=__headers) | Retrieves the configuration, stats, and status of rollup jobs.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html>`_
:param id: The ID of the job(s) to fetch. Accepts glob patterns, or left blank
for all jobs | Retrieves the configuration, stats, and status of rollup jobs. | [
"Retrieves",
"the",
"configuration",
"stats",
"and",
"status",
"of",
"rollup",
"jobs",
"."
] | def get_jobs(
self,
*,
id: Optional[Any] = None,
error_trace: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
human: Optional[bool] = None,
pretty: Optional[bool] = None,
) -> ObjectApiResponse[Any]:
"""
Retrieves th... | [
"def",
"get_jobs",
"(",
"self",
",",
"*",
",",
"id",
":",
"Optional",
"[",
"Any",
"]",
"=",
"None",
",",
"error_trace",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
"filter_path",
":",
"Optional",
"[",
"Union",
"[",
"List",
"[",
"str",
"]",... | https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_sync/client/rollup.py#L64-L99 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/mako/_ast_util.py | python | get_child_nodes | (node) | return list(iter_child_nodes(node)) | Like `iter_child_nodes` but returns a list. | Like `iter_child_nodes` but returns a list. | [
"Like",
"iter_child_nodes",
"but",
"returns",
"a",
"list",
"."
] | def get_child_nodes(node):
"""Like `iter_child_nodes` but returns a list."""
return list(iter_child_nodes(node)) | [
"def",
"get_child_nodes",
"(",
"node",
")",
":",
"return",
"list",
"(",
"iter_child_nodes",
"(",
"node",
")",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/mako/_ast_util.py#L205-L207 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/signal/ltisys.py | python | TransferFunction.den | (self) | return self._den | Denominator of the `TransferFunction` system. | Denominator of the `TransferFunction` system. | [
"Denominator",
"of",
"the",
"TransferFunction",
"system",
"."
] | def den(self):
"""Denominator of the `TransferFunction` system."""
return self._den | [
"def",
"den",
"(",
"self",
")",
":",
"return",
"self",
".",
"_den"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/signal/ltisys.py#L789-L791 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_policy_rule.py | python | V1PolicyRule.__init__ | (self, api_groups=None, non_resource_ur_ls=None, resource_names=None, resources=None, verbs=None, local_vars_configuration=None) | V1PolicyRule - a model defined in OpenAPI | V1PolicyRule - a model defined in OpenAPI | [
"V1PolicyRule",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, api_groups=None, non_resource_ur_ls=None, resource_names=None, resources=None, verbs=None, local_vars_configuration=None): # noqa: E501
"""V1PolicyRule - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configurat... | [
"def",
"__init__",
"(",
"self",
",",
"api_groups",
"=",
"None",
",",
"non_resource_ur_ls",
"=",
"None",
",",
"resource_names",
"=",
"None",
",",
"resources",
"=",
"None",
",",
"verbs",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"#... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_policy_rule.py#L51-L72 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Tools/pybench/pybench.py | python | Test.get_timer | (self) | return get_timer(self.timer) | Return the timer function to use for the test. | Return the timer function to use for the test. | [
"Return",
"the",
"timer",
"function",
"to",
"use",
"for",
"the",
"test",
"."
] | def get_timer(self):
""" Return the timer function to use for the test.
"""
return get_timer(self.timer) | [
"def",
"get_timer",
"(",
"self",
")",
":",
"return",
"get_timer",
"(",
"self",
".",
"timer",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/pybench/pybench.py#L245-L250 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/logging/__init__.py | python | makeLogRecord | (dict) | return rv | Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance. | Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance. | [
"Make",
"a",
"LogRecord",
"whose",
"attributes",
"are",
"defined",
"by",
"the",
"specified",
"dictionary",
"This",
"function",
"is",
"useful",
"for",
"converting",
"a",
"logging",
"event",
"received",
"over",
"a",
"socket",
"connection",
"(",
"which",
"is",
"s... | def makeLogRecord(dict):
"""
Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance.
"""
rv = _logRecordFactory(None, None, "... | [
"def",
"makeLogRecord",
"(",
"dict",
")",
":",
"rv",
"=",
"_logRecordFactory",
"(",
"None",
",",
"None",
",",
"\"\"",
",",
"0",
",",
"\"\"",
",",
"(",
")",
",",
"None",
",",
"None",
")",
"rv",
".",
"__dict__",
".",
"update",
"(",
"dict",
")",
"re... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/logging/__init__.py#L396-L405 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Tools/scripts/texi2html.py | python | TexinfoParser.bgn_example | (self, args) | [] | def bgn_example(self, args):
self.nofill = self.nofill + 1
self.write('<PRE>') | [
"def",
"bgn_example",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"nofill",
"=",
"self",
".",
"nofill",
"+",
"1",
"self",
".",
"write",
"(",
"'<PRE>'",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/scripts/texi2html.py#L1482-L1484 | ||||
mysql/mysql-connector-python | c5460bcbb0dff8e4e48bf4af7a971c89bf486d85 | lib/mysqlx/result.py | python | Column.get_character_set_name | (self) | return self._character_set_name | Returns the character set name.
Returns:
str: The character set name. | Returns the character set name. | [
"Returns",
"the",
"character",
"set",
"name",
"."
] | def get_character_set_name(self):
"""Returns the character set name.
Returns:
str: The character set name.
"""
return self._character_set_name | [
"def",
"get_character_set_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_character_set_name"
] | https://github.com/mysql/mysql-connector-python/blob/c5460bcbb0dff8e4e48bf4af7a971c89bf486d85/lib/mysqlx/result.py#L725-L731 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | osh/builtin_process.py | python | Fg.Run | (self, cmd_val) | return self.job_state.WhenContinued(pid, self.waiter) | [] | def Run(self, cmd_val):
# type: (cmd_value__Argv) -> int
# Note: 'fg' currently works with processes, but not pipelines. See issue
# #360. Part of it is that we should use posix.killpg().
pid = self.job_state.GetLastStopped()
if pid == -1:
log('No job to put in the foreground')
return... | [
"def",
"Run",
"(",
"self",
",",
"cmd_val",
")",
":",
"# type: (cmd_value__Argv) -> int",
"# Note: 'fg' currently works with processes, but not pipelines. See issue",
"# #360. Part of it is that we should use posix.killpg().",
"pid",
"=",
"self",
".",
"job_state",
".",
"GetLastSto... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/osh/builtin_process.py#L247-L260 | |||
ScottfreeLLC/AlphaPy | e6419cc811c2a3abc1ad522a85a888c8ef386056 | alphapy/transforms.py | python | streak | (vec) | return latest_streak | r"""Determine the length of the latest streak.
Parameters
----------
vec : pandas.Series
The input array for calculating the latest streak.
Returns
-------
latest_streak : int
The length of the latest streak.
Example
-------
>>> vec.rolling(window=20).apply(streak... | r"""Determine the length of the latest streak. | [
"r",
"Determine",
"the",
"length",
"of",
"the",
"latest",
"streak",
"."
] | def streak(vec):
r"""Determine the length of the latest streak.
Parameters
----------
vec : pandas.Series
The input array for calculating the latest streak.
Returns
-------
latest_streak : int
The length of the latest streak.
Example
-------
>>> vec.rolling(wi... | [
"def",
"streak",
"(",
"vec",
")",
":",
"latest_streak",
"=",
"[",
"len",
"(",
"list",
"(",
"g",
")",
")",
"for",
"k",
",",
"g",
"in",
"itertools",
".",
"groupby",
"(",
"vec",
")",
"]",
"[",
"-",
"1",
"]",
"return",
"latest_streak"
] | https://github.com/ScottfreeLLC/AlphaPy/blob/e6419cc811c2a3abc1ad522a85a888c8ef386056/alphapy/transforms.py#L1359-L1379 | |
GoogleCloudPlatform/cloudml-samples | efddc4a9898127e55edc0946557aca4bfaf59705 | tensorflow/standard/legacy/flowers/pipeline.py | python | FlowersE2E.make_request_json | (self, uri, output_json) | Produces a JSON request suitable to send to CloudML Prediction API.
Args:
uri: The input image URI.
output_json: File handle of the output json where request will be written. | Produces a JSON request suitable to send to CloudML Prediction API. | [
"Produces",
"a",
"JSON",
"request",
"suitable",
"to",
"send",
"to",
"CloudML",
"Prediction",
"API",
"."
] | def make_request_json(self, uri, output_json):
"""Produces a JSON request suitable to send to CloudML Prediction API.
Args:
uri: The input image URI.
output_json: File handle of the output json where request will be written.
"""
def _open_file_read_binary(uri):
try:
return fil... | [
"def",
"make_request_json",
"(",
"self",
",",
"uri",
",",
"output_json",
")",
":",
"def",
"_open_file_read_binary",
"(",
"uri",
")",
":",
"try",
":",
"return",
"file_io",
".",
"FileIO",
"(",
"uri",
",",
"mode",
"=",
"'rb'",
")",
"except",
"errors",
".",
... | https://github.com/GoogleCloudPlatform/cloudml-samples/blob/efddc4a9898127e55edc0946557aca4bfaf59705/tensorflow/standard/legacy/flowers/pipeline.py#L349-L372 | ||
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/equinixmetal.py | python | EquinixMetalNodeDriver.create_volume_snapshot | (self, volume, name="") | return volume.list_snapshots()[-1] | Create a new volume snapshot.
:param volume: Volume to create a snapshot for
:type volume: class:`StorageVolume`
:return: The newly created volume snapshot.
:rtype: :class:`VolumeSnapshot` | Create a new volume snapshot. | [
"Create",
"a",
"new",
"volume",
"snapshot",
"."
] | def create_volume_snapshot(self, volume, name=""):
"""
Create a new volume snapshot.
:param volume: Volume to create a snapshot for
:type volume: class:`StorageVolume`
:return: The newly created volume snapshot.
:rtype: :class:`VolumeSnapshot`
"""
path =... | [
"def",
"create_volume_snapshot",
"(",
"self",
",",
"volume",
",",
"name",
"=",
"\"\"",
")",
":",
"path",
"=",
"\"/metal/v1/storage/%s/snapshots\"",
"%",
"volume",
".",
"id",
"res",
"=",
"self",
".",
"connection",
".",
"request",
"(",
"path",
",",
"method",
... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/equinixmetal.py#L856-L869 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/ttk.py | python | Style.theme_create | (self, themename, parent=None, settings=None) | Creates a new theme.
It is an error if themename already exists. If parent is
specified, the new theme will inherit styles, elements and
layouts from the specified parent theme. If settings are present,
they are expected to have the same syntax used for theme_settings. | Creates a new theme. | [
"Creates",
"a",
"new",
"theme",
"."
] | def theme_create(self, themename, parent=None, settings=None):
"""Creates a new theme.
It is an error if themename already exists. If parent is
specified, the new theme will inherit styles, elements and
layouts from the specified parent theme. If settings are present,
they are e... | [
"def",
"theme_create",
"(",
"self",
",",
"themename",
",",
"parent",
"=",
"None",
",",
"settings",
"=",
"None",
")",
":",
"script",
"=",
"_script_from_settings",
"(",
"settings",
")",
"if",
"settings",
"else",
"''",
"if",
"parent",
":",
"self",
".",
"tk"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/ttk.py#L479-L493 | ||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/phases/helmholtz_eos.py | python | HelmholtzEOS.dA_dtau | (self) | return dA_dtau | [] | def dA_dtau(self):
try:
return self._dA_dtau
except:
pass
dA_dtau = self._dA_dtau = self._dAr_dtau_func(self.tau, self.delta) + self.dA0_dtau
return dA_dtau | [
"def",
"dA_dtau",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_dA_dtau",
"except",
":",
"pass",
"dA_dtau",
"=",
"self",
".",
"_dA_dtau",
"=",
"self",
".",
"_dAr_dtau_func",
"(",
"self",
".",
"tau",
",",
"self",
".",
"delta",
")",
"+",
... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/phases/helmholtz_eos.py#L100-L106 | |||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/cognitive_planning/train_supervised_active_vision.py | python | create_modality_types | () | return [conversion_dict[k] for k in modality_types] | Parses the modality_types and returns a list of task_env.ModalityType. | Parses the modality_types and returns a list of task_env.ModalityType. | [
"Parses",
"the",
"modality_types",
"and",
"returns",
"a",
"list",
"of",
"task_env",
".",
"ModalityType",
"."
] | def create_modality_types():
"""Parses the modality_types and returns a list of task_env.ModalityType."""
if not FLAGS.modality_types:
raise ValueError('there needs to be at least one modality type')
modality_types = FLAGS.modality_types.split('_')
for x in modality_types:
if x not in ['image', 'sseg', ... | [
"def",
"create_modality_types",
"(",
")",
":",
"if",
"not",
"FLAGS",
".",
"modality_types",
":",
"raise",
"ValueError",
"(",
"'there needs to be at least one modality type'",
")",
"modality_types",
"=",
"FLAGS",
".",
"modality_types",
".",
"split",
"(",
"'_'",
")",
... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/cognitive_planning/train_supervised_active_vision.py#L138-L153 | |
d6t/d6tflow | ccd161057793e04ac0d090a4968f1ac9abb43e5b | d6tflow/functional.py | python | Workflow.delete | (self, func_to_reset, *args, **kwargs) | Possibly dangerous! `delete(func)` will delete *all files* in the `data/func` directory of the given func.
Useful if you want to delete all function related outputs.
Consider using `reset(func, params)` to reset a specific func | Possibly dangerous! `delete(func)` will delete *all files* in the `data/func` directory of the given func.
Useful if you want to delete all function related outputs.
Consider using `reset(func, params)` to reset a specific func | [
"Possibly",
"dangerous!",
"delete",
"(",
"func",
")",
"will",
"delete",
"*",
"all",
"files",
"*",
"in",
"the",
"data",
"/",
"func",
"directory",
"of",
"the",
"given",
"func",
".",
"Useful",
"if",
"you",
"want",
"to",
"delete",
"all",
"function",
"related... | def delete(self, func_to_reset, *args, **kwargs):
"""Possibly dangerous! `delete(func)` will delete *all files* in the `data/func` directory of the given func.
Useful if you want to delete all function related outputs.
Consider using `reset(func, params)` to reset a specific func
"""
... | [
"def",
"delete",
"(",
"self",
",",
"func_to_reset",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"func_to_reset",
"if",
"isinstance",
"(",
"func_to_reset",
",",
"str",
")",
"else",
"func_to_reset",
".",
"__name__",
"task",
"=",
"self... | https://github.com/d6t/d6tflow/blob/ccd161057793e04ac0d090a4968f1ac9abb43e5b/d6tflow/functional.py#L307-L322 | ||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/models/model.py | python | Model.is_discriminative | () | Return True if the model is discriminative, that is, if the model estimates the conditional probability
:math:`p(y|x)`.
Returns:
bool: True if the model is discriminative. | Return True if the model is discriminative, that is, if the model estimates the conditional probability
:math:`p(y|x)`. | [
"Return",
"True",
"if",
"the",
"model",
"is",
"discriminative",
"that",
"is",
"if",
"the",
"model",
"estimates",
"the",
"conditional",
"probability",
":",
"math",
":",
"p",
"(",
"y|x",
")",
"."
] | def is_discriminative():
"""
Return True if the model is discriminative, that is, if the model estimates the conditional probability
:math:`p(y|x)`.
Returns:
bool: True if the model is discriminative.
"""
raise NotImplementedError | [
"def",
"is_discriminative",
"(",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/models/model.py#L176-L184 | ||
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/engine/interfaces.py | python | Dialect.get_foreign_keys | (
self,
connection: "Connection",
table_name: str,
schema: Optional[str] = None,
**kw: Any,
) | Return information about foreign_keys in ``table_name``.
Given a :class:`_engine.Connection`, a string
``table_name``, and an optional string ``schema``, return foreign
key information as a list of dicts corresponding to the
:class:`.ReflectedForeignKeyConstraint` dictionary. | Return information about foreign_keys in ``table_name``. | [
"Return",
"information",
"about",
"foreign_keys",
"in",
"table_name",
"."
] | def get_foreign_keys(
self,
connection: "Connection",
table_name: str,
schema: Optional[str] = None,
**kw: Any,
) -> List[ReflectedForeignKeyConstraint]:
"""Return information about foreign_keys in ``table_name``.
Given a :class:`_engine.Connection`, a string... | [
"def",
"get_foreign_keys",
"(",
"self",
",",
"connection",
":",
"\"Connection\"",
",",
"table_name",
":",
"str",
",",
"schema",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"*",
"kw",
":",
"Any",
",",
")",
"->",
"List",
"[",
"ReflectedForei... | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/engine/interfaces.py#L764-L780 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/command/egg_info.py | python | FileList.prune | (self, dir) | return self._remove_files(match.match) | Filter out files from 'dir/'. | Filter out files from 'dir/'. | [
"Filter",
"out",
"files",
"from",
"dir",
"/",
"."
] | def prune(self, dir):
"""Filter out files from 'dir/'."""
match = translate_pattern(os.path.join(dir, '**'))
return self._remove_files(match.match) | [
"def",
"prune",
"(",
"self",
",",
"dir",
")",
":",
"match",
"=",
"translate_pattern",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dir",
",",
"'**'",
")",
")",
"return",
"self",
".",
"_remove_files",
"(",
"match",
".",
"match",
")"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/command/egg_info.py#L449-L452 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/mediaroom/media_player.py | python | MediaroomDevice.async_turn_off | (self) | Turn off the receiver. | Turn off the receiver. | [
"Turn",
"off",
"the",
"receiver",
"."
] | async def async_turn_off(self):
"""Turn off the receiver."""
try:
self.set_state(await self.stb.turn_off())
if self._optimistic:
self._state = STATE_STANDBY
self._available = True
except PyMediaroomError:
self._available = False
... | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"set_state",
"(",
"await",
"self",
".",
"stb",
".",
"turn_off",
"(",
")",
")",
"if",
"self",
".",
"_optimistic",
":",
"self",
".",
"_state",
"=",
"STATE_STANDBY",
"self",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mediaroom/media_player.py#L272-L282 | ||
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/packets/zigbee.py | python | RouteRecordIndicatorPacket.create_packet | (raw, operating_mode) | return RouteRecordIndicatorPacket(
XBee64BitAddress(raw[4:12]), XBee16BitAddress(raw[12:14]),
raw[14], hops, op_mode=operating_mode) | Override method.
Returns:
:class:`.RouteRecordIndicatorPacket`.
Raises:
InvalidPacketException: If the bytearray length is less than 17.
(start delim. + length (2 bytes) + frame type + 64bit addr. +
16bit addr. + Receive options + num of addrs + ... | Override method. | [
"Override",
"method",
"."
] | def create_packet(raw, operating_mode):
"""
Override method.
Returns:
:class:`.RouteRecordIndicatorPacket`.
Raises:
InvalidPacketException: If the bytearray length is less than 17.
(start delim. + length (2 bytes) + frame type + 64bit addr. +
... | [
"def",
"create_packet",
"(",
"raw",
",",
"operating_mode",
")",
":",
"if",
"operating_mode",
"not",
"in",
"(",
"OperatingMode",
".",
"ESCAPED_API_MODE",
",",
"OperatingMode",
".",
"API_MODE",
")",
":",
"raise",
"InvalidOperatingModeException",
"(",
"operating_mode",... | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/zigbee.py#L439-L488 | |
number5/cloud-init | 19948dbaf40309355e1a2dbef116efb0ce66245c | cloudinit/util.py | python | blkid | (devs=None, disable_cache=False) | return ret | Get all device tags details from blkid.
@param devs: Optional list of device paths you wish to query.
@param disable_cache: Bool, set True to start with clean cache.
@return: Dict of key value pairs of info for the device. | Get all device tags details from blkid. | [
"Get",
"all",
"device",
"tags",
"details",
"from",
"blkid",
"."
] | def blkid(devs=None, disable_cache=False):
"""Get all device tags details from blkid.
@param devs: Optional list of device paths you wish to query.
@param disable_cache: Bool, set True to start with clean cache.
@return: Dict of key value pairs of info for the device.
"""
if devs is None:
... | [
"def",
"blkid",
"(",
"devs",
"=",
"None",
",",
"disable_cache",
"=",
"False",
")",
":",
"if",
"devs",
"is",
"None",
":",
"devs",
"=",
"[",
"]",
"else",
":",
"devs",
"=",
"list",
"(",
"devs",
")",
"cmd",
"=",
"[",
"\"blkid\"",
",",
"\"-o\"",
",",
... | https://github.com/number5/cloud-init/blob/19948dbaf40309355e1a2dbef116efb0ce66245c/cloudinit/util.py#L1399-L1427 | |
IDArlingTeam/IDArling | d15b9b7c8bdeb992c569efcc49adf7642bb82cdf | idarling/module.py | python | Module._uninstall | (self) | Uninstall the module. Overloaded by the module. | Uninstall the module. Overloaded by the module. | [
"Uninstall",
"the",
"module",
".",
"Overloaded",
"by",
"the",
"module",
"."
] | def _uninstall(self):
"""Uninstall the module. Overloaded by the module."""
raise NotImplementedError("_uninstall() not implemented") | [
"def",
"_uninstall",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"_uninstall() not implemented\"",
")"
] | https://github.com/IDArlingTeam/IDArling/blob/d15b9b7c8bdeb992c569efcc49adf7642bb82cdf/idarling/module.py#L43-L45 | ||
log2timeline/plaso | fe2e316b8c76a0141760c0f2f181d84acb83abc2 | plaso/parsers/plist_plugins/interface.py | python | PlistPathFilter.Match | (self, filename_lower_case) | return bool(filename_lower_case == self._filename_lower_case) | Determines if a plist filename matches the filter.
Note that this method does a case insensitive comparison.
Args:
filename_lower_case (str): filename of the plist in lower case.
Returns:
bool: True if the filename matches the filter. | Determines if a plist filename matches the filter. | [
"Determines",
"if",
"a",
"plist",
"filename",
"matches",
"the",
"filter",
"."
] | def Match(self, filename_lower_case):
"""Determines if a plist filename matches the filter.
Note that this method does a case insensitive comparison.
Args:
filename_lower_case (str): filename of the plist in lower case.
Returns:
bool: True if the filename matches the filter.
"""
r... | [
"def",
"Match",
"(",
"self",
",",
"filename_lower_case",
")",
":",
"return",
"bool",
"(",
"filename_lower_case",
"==",
"self",
".",
"_filename_lower_case",
")"
] | https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/parsers/plist_plugins/interface.py#L30-L41 | |
taolei87/rcnn | 7c45f497d4507047549480c2dc579866c76eec82 | code/rationale/rationale_dependent.py | python | Model.evaluate_data | (self, batches_x, batches_y, eval_func, sampling=False) | return tot_obj/n, tot_mse/n, tot_diff/n, p1/n | [] | def evaluate_data(self, batches_x, batches_y, eval_func, sampling=False):
padding_id = self.embedding_layer.vocab_map["<padding>"]
tot_obj, tot_mse, tot_diff, p1 = 0.0, 0.0, 0.0, 0.0
for bx, by in zip(batches_x, batches_y):
if not sampling:
e, d = eval_func(bx, by)
... | [
"def",
"evaluate_data",
"(",
"self",
",",
"batches_x",
",",
"batches_y",
",",
"eval_func",
",",
"sampling",
"=",
"False",
")",
":",
"padding_id",
"=",
"self",
".",
"embedding_layer",
".",
"vocab_map",
"[",
"\"<padding>\"",
"]",
"tot_obj",
",",
"tot_mse",
","... | https://github.com/taolei87/rcnn/blob/7c45f497d4507047549480c2dc579866c76eec82/code/rationale/rationale_dependent.py#L527-L543 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.3/django/contrib/gis/maps/google/gmap.py | python | GoogleMap.render | (self) | return render_to_string(self.template, params) | Generates the JavaScript necessary for displaying this Google Map. | Generates the JavaScript necessary for displaying this Google Map. | [
"Generates",
"the",
"JavaScript",
"necessary",
"for",
"displaying",
"this",
"Google",
"Map",
"."
] | def render(self):
"""
Generates the JavaScript necessary for displaying this Google Map.
"""
params = {'calc_zoom' : self.calc_zoom,
'center' : self.center,
'dom_id' : self.dom_id,
'js_module' : self.js_module,
'kml_... | [
"def",
"render",
"(",
"self",
")",
":",
"params",
"=",
"{",
"'calc_zoom'",
":",
"self",
".",
"calc_zoom",
",",
"'center'",
":",
"self",
".",
"center",
",",
"'dom_id'",
":",
"self",
".",
"dom_id",
",",
"'js_module'",
":",
"self",
".",
"js_module",
",",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/contrib/gis/maps/google/gmap.py#L90-L106 | |
jfalken/github_commit_crawler | a964d7dcd8b79b680ea142f7c25245babe4fd1e7 | ghcc_process/libs/mongo_utils.py | python | mdb_insert_results | (results) | return oid | inserts result records into mongodb
:param results: a list of result dicts, from `do_audit_events`
returns object id of the insert | inserts result records into mongodb
:param results: a list of result dicts, from `do_audit_events` | [
"inserts",
"result",
"records",
"into",
"mongodb",
":",
"param",
"results",
":",
"a",
"list",
"of",
"result",
"dicts",
"from",
"do_audit_events"
] | def mdb_insert_results(results):
''' inserts result records into mongodb
:param results: a list of result dicts, from `do_audit_events`
returns object id of the insert
'''
db = _connect_mongo()
col = db['results']
col.ensure_index('uid')
col.ensure_index('matched')
oid = col... | [
"def",
"mdb_insert_results",
"(",
"results",
")",
":",
"db",
"=",
"_connect_mongo",
"(",
")",
"col",
"=",
"db",
"[",
"'results'",
"]",
"col",
".",
"ensure_index",
"(",
"'uid'",
")",
"col",
".",
"ensure_index",
"(",
"'matched'",
")",
"oid",
"=",
"col",
... | https://github.com/jfalken/github_commit_crawler/blob/a964d7dcd8b79b680ea142f7c25245babe4fd1e7/ghcc_process/libs/mongo_utils.py#L55-L66 | |
spotty-cloud/spotty | 1127c56112b33ac4772582e4edb70e2dfa4292f0 | spotty/config/abstract_instance_config.py | python | AbstractInstanceConfig._get_instance_volumes | (self) | Returns specific to the provider volumes that should be mounted on the host OS. | Returns specific to the provider volumes that should be mounted on the host OS. | [
"Returns",
"specific",
"to",
"the",
"provider",
"volumes",
"that",
"should",
"be",
"mounted",
"on",
"the",
"host",
"OS",
"."
] | def _get_instance_volumes(self) -> List[AbstractInstanceVolume]:
"""Returns specific to the provider volumes that should be mounted on the host OS."""
raise NotImplementedError | [
"def",
"_get_instance_volumes",
"(",
"self",
")",
"->",
"List",
"[",
"AbstractInstanceVolume",
"]",
":",
"raise",
"NotImplementedError"
] | https://github.com/spotty-cloud/spotty/blob/1127c56112b33ac4772582e4edb70e2dfa4292f0/spotty/config/abstract_instance_config.py#L49-L51 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/thirdparty/odict/odict.py | python | _OrderedDict.__deepcopy__ | (self, memo) | return self.__class__(deepcopy(self.items(), memo), self.strict) | To allow deepcopy to work with OrderedDict.
>>> from copy import deepcopy
>>> a = OrderedDict([(1, 1), (2, 2), (3, 3)])
>>> a['test'] = {}
>>> b = deepcopy(a)
>>> b == a
True
>>> b is a
False
>>> a['test'] is b['test']
False | To allow deepcopy to work with OrderedDict. | [
"To",
"allow",
"deepcopy",
"to",
"work",
"with",
"OrderedDict",
"."
] | def __deepcopy__(self, memo):
"""
To allow deepcopy to work with OrderedDict.
>>> from copy import deepcopy
>>> a = OrderedDict([(1, 1), (2, 2), (3, 3)])
>>> a['test'] = {}
>>> b = deepcopy(a)
>>> b == a
True
>>> b is a
False
>>> a... | [
"def",
"__deepcopy__",
"(",
"self",
",",
"memo",
")",
":",
"from",
"copy",
"import",
"deepcopy",
"return",
"self",
".",
"__class__",
"(",
"deepcopy",
"(",
"self",
".",
"items",
"(",
")",
",",
"memo",
")",
",",
"self",
".",
"strict",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/odict/odict.py#L460-L476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.