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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xieyufei1993/InceptText-Tensorflow | bdb5c1bd4a7db277ddf9550e40c5a1fad0230ac4 | lib/networks/factory.py | python | get_network | (name) | Get a network by name. | Get a network by name. | [
"Get",
"a",
"network",
"by",
"name",
"."
] | def get_network(name):
"""Get a network by name."""
if name.split('_')[0] == 'VGGnet':
if name.split('_')[1] == 'test':
return VGGnet_test()
elif name.split('_')[1] == 'train':
return VGGnet_train()
elif name.split('_')[1] == 'testold':
return VGGnet_tes... | [
"def",
"get_network",
"(",
"name",
")",
":",
"if",
"name",
".",
"split",
"(",
"'_'",
")",
"[",
"0",
"]",
"==",
"'VGGnet'",
":",
"if",
"name",
".",
"split",
"(",
"'_'",
")",
"[",
"1",
"]",
"==",
"'test'",
":",
"return",
"VGGnet_test",
"(",
")",
... | https://github.com/xieyufei1993/InceptText-Tensorflow/blob/bdb5c1bd4a7db277ddf9550e40c5a1fad0230ac4/lib/networks/factory.py#L23-L56 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_version.py | python | Yedit.write | (self) | return (True, self.yaml_dict) | write to file | write to file | [
"write",
"to",
"file"
] | def write(self):
''' write to file '''
if not self.filename:
raise YeditException('Please specify a filename.')
if self.backup and self.file_exists():
shutil.copy(self.filename, self.filename + '.orig')
# Try to set format attributes if supported
try:
... | [
"def",
"write",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"filename",
":",
"raise",
"YeditException",
"(",
"'Please specify a filename.'",
")",
"if",
"self",
".",
"backup",
"and",
"self",
".",
"file_exists",
"(",
")",
":",
"shutil",
".",
"copy",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_version.py#L312-L338 | |
zhaoolee/StarsAndClown | b2d4039cad2f9232b691e5976f787b49a0a2c113 | node_modules/npmi/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.HasExplicitAsmRules | (self, spec) | return self._HasExplicitRuleForExtension(spec, 'asm') | Determine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files. | Determine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files. | [
"Determine",
"if",
"there",
"s",
"an",
"explicit",
"rule",
"for",
"asm",
"files",
".",
"When",
"there",
"isn",
"t",
"we",
"need",
"to",
"generate",
"implicit",
"rules",
"to",
"assemble",
".",
"asm",
"files",
"."
] | def HasExplicitAsmRules(self, spec):
"""Determine if there's an explicit rule for asm files. When there isn't we
need to generate implicit rules to assemble .asm files."""
return self._HasExplicitRuleForExtension(spec, 'asm') | [
"def",
"HasExplicitAsmRules",
"(",
"self",
",",
"spec",
")",
":",
"return",
"self",
".",
"_HasExplicitRuleForExtension",
"(",
"spec",
",",
"'asm'",
")"
] | https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npmi/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L835-L838 | |
zigpy/zigpy | db10b078874d93ad1c546ec810706c2e5dc33d7f | zigpy/quirks/registry.py | python | DeviceRegistry.remove | (self, custom_device: CustomDeviceType) | [] | def remove(self, custom_device: CustomDeviceType) -> None:
models_info = custom_device.signature.get(SIG_MODELS_INFO)
if models_info:
for manuf, model in models_info:
self.registry[manuf][model].remove(custom_device)
else:
manufacturer = custom_device.sign... | [
"def",
"remove",
"(",
"self",
",",
"custom_device",
":",
"CustomDeviceType",
")",
"->",
"None",
":",
"models_info",
"=",
"custom_device",
".",
"signature",
".",
"get",
"(",
"SIG_MODELS_INFO",
")",
"if",
"models_info",
":",
"for",
"manuf",
",",
"model",
"in",... | https://github.com/zigpy/zigpy/blob/db10b078874d93ad1c546ec810706c2e5dc33d7f/zigpy/quirks/registry.py#L44-L52 | ||||
Georce/lepus | 5b01bae82b5dc1df00c9e058989e2eb9b89ff333 | lepus/redis-2.10.3/redis/client.py | python | PubSub.listen | (self) | Listen for messages on channels this client has been subscribed to | Listen for messages on channels this client has been subscribed to | [
"Listen",
"for",
"messages",
"on",
"channels",
"this",
"client",
"has",
"been",
"subscribed",
"to"
] | def listen(self):
"Listen for messages on channels this client has been subscribed to"
while self.subscribed:
response = self.handle_message(self.parse_response(block=True))
if response is not None:
yield response | [
"def",
"listen",
"(",
"self",
")",
":",
"while",
"self",
".",
"subscribed",
":",
"response",
"=",
"self",
".",
"handle_message",
"(",
"self",
".",
"parse_response",
"(",
"block",
"=",
"True",
")",
")",
"if",
"response",
"is",
"not",
"None",
":",
"yield... | https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/redis-2.10.3/redis/client.py#L2212-L2217 | ||
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/nn/models/autoencoder.py | python | InnerProductDecoder.forward | (self, z, edge_index, sigmoid=True) | return torch.sigmoid(value) if sigmoid else value | r"""Decodes the latent variables :obj:`z` into edge probabilities for
the given node-pairs :obj:`edge_index`.
Args:
z (Tensor): The latent space :math:`\mathbf{Z}`.
sigmoid (bool, optional): If set to :obj:`False`, does not apply
the logistic sigmoid function to ... | r"""Decodes the latent variables :obj:`z` into edge probabilities for
the given node-pairs :obj:`edge_index`. | [
"r",
"Decodes",
"the",
"latent",
"variables",
":",
"obj",
":",
"z",
"into",
"edge",
"probabilities",
"for",
"the",
"given",
"node",
"-",
"pairs",
":",
"obj",
":",
"edge_index",
"."
] | def forward(self, z, edge_index, sigmoid=True):
r"""Decodes the latent variables :obj:`z` into edge probabilities for
the given node-pairs :obj:`edge_index`.
Args:
z (Tensor): The latent space :math:`\mathbf{Z}`.
sigmoid (bool, optional): If set to :obj:`False`, does not... | [
"def",
"forward",
"(",
"self",
",",
"z",
",",
"edge_index",
",",
"sigmoid",
"=",
"True",
")",
":",
"value",
"=",
"(",
"z",
"[",
"edge_index",
"[",
"0",
"]",
"]",
"*",
"z",
"[",
"edge_index",
"[",
"1",
"]",
"]",
")",
".",
"sum",
"(",
"dim",
"=... | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/nn/models/autoencoder.py#L20-L31 | |
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/engine/interfaces.py | python | Dialect.get_sequence_names | (
self, connection: "Connection", schema: Optional[str] = None, **kw: Any
) | Return a list of all sequence names available in the database.
:param schema: schema name to query, if not the default schema.
.. versionadded:: 1.4 | Return a list of all sequence names available in the database. | [
"Return",
"a",
"list",
"of",
"all",
"sequence",
"names",
"available",
"in",
"the",
"database",
"."
] | def get_sequence_names(
self, connection: "Connection", schema: Optional[str] = None, **kw: Any
) -> List[str]:
"""Return a list of all sequence names available in the database.
:param schema: schema name to query, if not the default schema.
.. versionadded:: 1.4
"""
... | [
"def",
"get_sequence_names",
"(",
"self",
",",
"connection",
":",
"\"Connection\"",
",",
"schema",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"*",
"kw",
":",
"Any",
")",
"->",
"List",
"[",
"str",
"]",
":",
"raise",
"NotImplementedError",
... | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/engine/interfaces.py#L809-L819 | ||
open-mmlab/mmcv | 48419395e3220af5b6df78346d6ce58991e8ba90 | mmcv/image/geometric.py | python | imflip | (img, direction='horizontal') | Flip an image horizontally or vertically.
Args:
img (ndarray): Image to be flipped.
direction (str): The flip direction, either "horizontal" or
"vertical" or "diagonal".
Returns:
ndarray: The flipped image. | Flip an image horizontally or vertically. | [
"Flip",
"an",
"image",
"horizontally",
"or",
"vertically",
"."
] | def imflip(img, direction='horizontal'):
"""Flip an image horizontally or vertically.
Args:
img (ndarray): Image to be flipped.
direction (str): The flip direction, either "horizontal" or
"vertical" or "diagonal".
Returns:
ndarray: The flipped image.
"""
assert ... | [
"def",
"imflip",
"(",
"img",
",",
"direction",
"=",
"'horizontal'",
")",
":",
"assert",
"direction",
"in",
"[",
"'horizontal'",
",",
"'vertical'",
",",
"'diagonal'",
"]",
"if",
"direction",
"==",
"'horizontal'",
":",
"return",
"np",
".",
"flip",
"(",
"img"... | https://github.com/open-mmlab/mmcv/blob/48419395e3220af5b6df78346d6ce58991e8ba90/mmcv/image/geometric.py#L252-L269 | ||
EDCD/EDMarketConnector | d8b29e45b86f36ab3cf540ec1503b9170a8505de | config.py | python | AbstractConfig.delete | (self, key: str, *, suppress=False) | Delete the given key from the config.
:param key: The key to delete.
:param suppress: bool - Whether to suppress any errors. Useful in case
code to migrate settings is blindly removing an old key.
:raises OSError: On Windows, if a registry error occurs. | Delete the given key from the config. | [
"Delete",
"the",
"given",
"key",
"from",
"the",
"config",
"."
] | def delete(self, key: str, *, suppress=False) -> None:
"""
Delete the given key from the config.
:param key: The key to delete.
:param suppress: bool - Whether to suppress any errors. Useful in case
code to migrate settings is blindly removing an old key.
:raises OSEr... | [
"def",
"delete",
"(",
"self",
",",
"key",
":",
"str",
",",
"*",
",",
"suppress",
"=",
"False",
")",
"->",
"None",
":",
"raise",
"NotImplementedError"
] | https://github.com/EDCD/EDMarketConnector/blob/d8b29e45b86f36ab3cf540ec1503b9170a8505de/config.py#L429-L438 | ||
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/clipboard.py | python | FakeProvider.text_available | (self) | return self.text is not None | Check if clipboard with text is available. | Check if clipboard with text is available. | [
"Check",
"if",
"clipboard",
"with",
"text",
"is",
"available",
"."
] | def text_available(self):
"""Check if clipboard with text is available."""
return self.text is not None | [
"def",
"text_available",
"(",
"self",
")",
":",
"return",
"self",
".",
"text",
"is",
"not",
"None"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/clipboard.py#L204-L206 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/federation/rabbitmq/_rabbit_manager.py | python | RabbitManager.delete_vhost | (self, vhost) | return result | [] | def delete_vhost(self, vhost):
url = C_HTTP_TEMPLATE.format(self.endpoint, "vhosts/" + vhost)
result = requests.delete(url, auth=(self.user, self.password))
LOGGER.debug(f"[rabbitmanager.delete_vhost] {result}")
return result | [
"def",
"delete_vhost",
"(",
"self",
",",
"vhost",
")",
":",
"url",
"=",
"C_HTTP_TEMPLATE",
".",
"format",
"(",
"self",
".",
"endpoint",
",",
"\"vhosts/\"",
"+",
"vhost",
")",
"result",
"=",
"requests",
".",
"delete",
"(",
"url",
",",
"auth",
"=",
"(",
... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/federation/rabbitmq/_rabbit_manager.py#L78-L82 | |||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParseResults.get | (self, key, defaultValue=None) | Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + in... | Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified. | [
"Returns",
"named",
"result",
"matching",
"the",
"given",
"key",
"or",
"if",
"there",
"is",
"no",
"such",
"name",
"then",
"returns",
"the",
"given",
"C",
"{",
"defaultValue",
"}",
"or",
"C",
"{",
"None",
"}",
"if",
"no",
"C",
"{",
"defaultValue",
"}",
... | def get(self, key, defaultValue=None):
"""
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
integer = W... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"defaultValue",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"else",
":",
"return",
"defaultValue"
] | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L540-L560 | ||
selfuryon/netdev | 037abbd0ca65f75eef06703e96a151300e6d4b6d | netdev/vendors/infotecs/HW1000.py | python | HW1000.enter_shell_mode | (self,re_flags=re.IGNORECASE) | return output | Enter into shell mode | Enter into shell mode | [
"Enter",
"into",
"shell",
"mode"
] | async def enter_shell_mode(self,re_flags=re.IGNORECASE):
""" Enter into shell mode"""
logger.info('Host {}: Entering to shell mode'.format(self._host))
output = ''
shell_command = type(self)._shell_enter
if not await self.check_shell_mode():
self._stdin.write(self._no... | [
"async",
"def",
"enter_shell_mode",
"(",
"self",
",",
"re_flags",
"=",
"re",
".",
"IGNORECASE",
")",
":",
"logger",
".",
"info",
"(",
"'Host {}: Entering to shell mode'",
".",
"format",
"(",
"self",
".",
"_host",
")",
")",
"output",
"=",
"''",
"shell_command... | https://github.com/selfuryon/netdev/blob/037abbd0ca65f75eef06703e96a151300e6d4b6d/netdev/vendors/infotecs/HW1000.py#L134-L150 | |
menpo/menpo | a61500656c4fc2eea82497684f13cc31a605550b | menpo/base.py | python | MenpoMissingDependencyError._handle_importerror | (self, error) | [] | def _handle_importerror(self, error):
if hasattr(error, "name"):
return error.name
else:
try:
# Python 2 doesn't have ModuleNotFoundError
# (so doesn't have the name attribute)
base_name = error.message.split("No module named ")[1]
... | [
"def",
"_handle_importerror",
"(",
"self",
",",
"error",
")",
":",
"if",
"hasattr",
"(",
"error",
",",
"\"name\"",
")",
":",
"return",
"error",
".",
"name",
"else",
":",
"try",
":",
"# Python 2 doesn't have ModuleNotFoundError",
"# (so doesn't have the name attribut... | https://github.com/menpo/menpo/blob/a61500656c4fc2eea82497684f13cc31a605550b/menpo/base.py#L375-L389 | ||||
trezor/trezor-core | 18c3a6a5bd45923380312b064be96155f5a7377d | mocks/generated/trezorcrypto/monero.py | python | unpack256_modm_noreduce | (r: Optional[Sc25519], a: bytes, offset: int = 0) | Scalar decompression, raw, without modular reduction | Scalar decompression, raw, without modular reduction | [
"Scalar",
"decompression",
"raw",
"without",
"modular",
"reduction"
] | def unpack256_modm_noreduce(r: Optional[Sc25519], a: bytes, offset: int = 0) -> Sc25519:
'''
Scalar decompression, raw, without modular reduction
''' | [
"def",
"unpack256_modm_noreduce",
"(",
"r",
":",
"Optional",
"[",
"Sc25519",
"]",
",",
"a",
":",
"bytes",
",",
"offset",
":",
"int",
"=",
"0",
")",
"->",
"Sc25519",
":"
] | https://github.com/trezor/trezor-core/blob/18c3a6a5bd45923380312b064be96155f5a7377d/mocks/generated/trezorcrypto/monero.py#L124-L127 | ||
mkusner/grammarVAE | ffffe272a8cf1772578dfc92254c55c224cddc02 | Theano-master/theano/gof/fg.py | python | FunctionGraph.clone | (self, check_integrity=True) | return self.clone_get_equiv(check_integrity)[0] | WRITEME | WRITEME | [
"WRITEME"
] | def clone(self, check_integrity=True):
"""
WRITEME
"""
return self.clone_get_equiv(check_integrity)[0] | [
"def",
"clone",
"(",
"self",
",",
"check_integrity",
"=",
"True",
")",
":",
"return",
"self",
".",
"clone_get_equiv",
"(",
"check_integrity",
")",
"[",
"0",
"]"
] | https://github.com/mkusner/grammarVAE/blob/ffffe272a8cf1772578dfc92254c55c224cddc02/Theano-master/theano/gof/fg.py#L822-L827 | |
mtianyan/VueDjangoAntdProBookShop | fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2 | third_party/social_core/backends/box.py | python | BoxOAuth2.get_user_details | (self, response) | return {'username': response.get('login'),
'email': response.get('login') or '',
'fullname': fullname,
'first_name': first_name,
'last_name': last_name} | Return user details Box.net account | Return user details Box.net account | [
"Return",
"user",
"details",
"Box",
".",
"net",
"account"
] | def get_user_details(self, response):
"""Return user details Box.net account"""
fullname, first_name, last_name = self.get_user_names(
response.get('name')
)
return {'username': response.get('login'),
'email': response.get('login') or '',
'full... | [
"def",
"get_user_details",
"(",
"self",
",",
"response",
")",
":",
"fullname",
",",
"first_name",
",",
"last_name",
"=",
"self",
".",
"get_user_names",
"(",
"response",
".",
"get",
"(",
"'name'",
")",
")",
"return",
"{",
"'username'",
":",
"response",
".",... | https://github.com/mtianyan/VueDjangoAntdProBookShop/blob/fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2/third_party/social_core/backends/box.py#L32-L41 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/tkinter/__init__.py | python | PanedWindow.sash_place | (self, index, x, y) | return self.sash("place", index, x, y) | Place the sash given by index at the given coordinates | Place the sash given by index at the given coordinates | [
"Place",
"the",
"sash",
"given",
"by",
"index",
"at",
"the",
"given",
"coordinates"
] | def sash_place(self, index, x, y):
"""Place the sash given by index at the given coordinates
"""
return self.sash("place", index, x, y) | [
"def",
"sash_place",
"(",
"self",
",",
"index",
",",
"x",
",",
"y",
")",
":",
"return",
"self",
".",
"sash",
"(",
"\"place\"",
",",
"index",
",",
"x",
",",
"y",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L3735-L3738 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/setuptools/_vendor/packaging/specifiers.py | python | BaseSpecifier.__eq__ | (self, other) | Returns a boolean representing whether or not the two Specifier like
objects are equal. | Returns a boolean representing whether or not the two Specifier like
objects are equal. | [
"Returns",
"a",
"boolean",
"representing",
"whether",
"or",
"not",
"the",
"two",
"Specifier",
"like",
"objects",
"are",
"equal",
"."
] | def __eq__(self, other):
"""
Returns a boolean representing whether or not the two Specifier like
objects are equal.
""" | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":"
] | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/setuptools/_vendor/packaging/specifiers.py#L36-L40 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/lib-tk/turtle.py | python | RawTurtle.begin_fill | (self) | Called just before drawing a shape to be filled.
No argument.
Example (for a Turtle instance named turtle):
>>> turtle.begin_fill()
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>... | Called just before drawing a shape to be filled. | [
"Called",
"just",
"before",
"drawing",
"a",
"shape",
"to",
"be",
"filled",
"."
] | def begin_fill(self):
"""Called just before drawing a shape to be filled.
No argument.
Example (for a Turtle instance named turtle):
>>> turtle.begin_fill()
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>> turtle.left(90)
>... | [
"def",
"begin_fill",
"(",
"self",
")",
":",
"self",
".",
"fill",
"(",
"True",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/turtle.py#L3179-L3195 | ||
qiucheng025/zao- | 3a5edf3607b3a523f95746bc69b688090c76d89a | tools/effmpeg.py | python | Effmpeg.parse_time | (txt) | return retval | Parse Time | Parse Time | [
"Parse",
"Time"
] | def parse_time(txt):
""" Parse Time """
clean_txt = txt.replace(':', '')
hours = clean_txt[0:2]
minutes = clean_txt[2:4]
seconds = clean_txt[4:6]
retval = hours + ':' + minutes + ':' + seconds
logger.debug("txt: '%s', retval: %s", txt, retval)
return retva... | [
"def",
"parse_time",
"(",
"txt",
")",
":",
"clean_txt",
"=",
"txt",
".",
"replace",
"(",
"':'",
",",
"''",
")",
"hours",
"=",
"clean_txt",
"[",
"0",
":",
"2",
"]",
"minutes",
"=",
"clean_txt",
"[",
"2",
":",
"4",
"]",
"seconds",
"=",
"clean_txt",
... | https://github.com/qiucheng025/zao-/blob/3a5edf3607b3a523f95746bc69b688090c76d89a/tools/effmpeg.py#L587-L595 | |
wakatime/komodo-wakatime | 8923c04ded9fa64d7374fadd8cde3a6fadfe053d | components/wakatime/packages/urllib3/util/selectors.py | python | BaseSelector._fileobj_lookup | (self, fileobj) | Return a file descriptor from a file object.
This wraps _fileobj_to_fd() to do an exhaustive
search in case the object is invalid but we still
have it in our map. Used by unregister() so we can
unregister an object that was previously registered
even if it is closed. It is also u... | Return a file descriptor from a file object.
This wraps _fileobj_to_fd() to do an exhaustive
search in case the object is invalid but we still
have it in our map. Used by unregister() so we can
unregister an object that was previously registered
even if it is closed. It is also u... | [
"Return",
"a",
"file",
"descriptor",
"from",
"a",
"file",
"object",
".",
"This",
"wraps",
"_fileobj_to_fd",
"()",
"to",
"do",
"an",
"exhaustive",
"search",
"in",
"case",
"the",
"object",
"is",
"invalid",
"but",
"we",
"still",
"have",
"it",
"in",
"our",
"... | def _fileobj_lookup(self, fileobj):
""" Return a file descriptor from a file object.
This wraps _fileobj_to_fd() to do an exhaustive
search in case the object is invalid but we still
have it in our map. Used by unregister() so we can
unregister an object that was previously regis... | [
"def",
"_fileobj_lookup",
"(",
"self",
",",
"fileobj",
")",
":",
"try",
":",
"return",
"_fileobj_to_fd",
"(",
"fileobj",
")",
"except",
"ValueError",
":",
"# Search through all our mapped keys.",
"for",
"key",
"in",
"self",
".",
"_fd_to_key",
".",
"values",
"(",... | https://github.com/wakatime/komodo-wakatime/blob/8923c04ded9fa64d7374fadd8cde3a6fadfe053d/components/wakatime/packages/urllib3/util/selectors.py#L172-L190 | ||
yzhq97/cnn-registration | 17475a4d81575485bd33db21ae66b38b6fd20f3f | src/VGG16.py | python | VGG16mo.build | (self, bgr) | [] | def build(self, bgr):
blue, green, red = tf.split(axis=3, num_or_size_splits=3, value=bgr)
assert red.get_shape().as_list()[1:] == [224, 224, 1]
assert green.get_shape().as_list()[1:] == [224, 224, 1]
assert blue.get_shape().as_list()[1:] == [224, 224, 1]
bgr = tf.concat(axis=3, ... | [
"def",
"build",
"(",
"self",
",",
"bgr",
")",
":",
"blue",
",",
"green",
",",
"red",
"=",
"tf",
".",
"split",
"(",
"axis",
"=",
"3",
",",
"num_or_size_splits",
"=",
"3",
",",
"value",
"=",
"bgr",
")",
"assert",
"red",
".",
"get_shape",
"(",
")",
... | https://github.com/yzhq97/cnn-registration/blob/17475a4d81575485bd33db21ae66b38b6fd20f3f/src/VGG16.py#L23-L58 | ||||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/qark/qark/lib/yapsy/PluginManager.py | python | PluginManagerSingleton.get | (self) | return self.__instance | Actually create an instance | Actually create an instance | [
"Actually",
"create",
"an",
"instance"
] | def get(self):
"""
Actually create an instance
"""
if self.__instance is None:
if self.__decoration_chain is not None:
# Get the object to be decorated
# print self.__decoration_chain
pm = self.__decoration_chain[0]()
for cls_item in self.__decoration_chain[1:]:
# print cls_item
pm = ... | [
"def",
"get",
"(",
"self",
")",
":",
"if",
"self",
".",
"__instance",
"is",
"None",
":",
"if",
"self",
".",
"__decoration_chain",
"is",
"not",
"None",
":",
"# Get the object to be decorated",
"#\t\t\t\tprint self.__decoration_chain",
"pm",
"=",
"self",
".",
"__d... | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/yapsy/PluginManager.py#L638-L656 | |
quantumlib/OpenFermion-Cirq | 655b00fee21c94cc96c343c63f7c52ea1aa329dc | dev_tools/git_env_tools.py | python | get_repo_root | () | return shell_tools.output_of('git', 'rev-parse', '--show-toplevel') | Get the root of the git repository the cwd is within. | Get the root of the git repository the cwd is within. | [
"Get",
"the",
"root",
"of",
"the",
"git",
"repository",
"the",
"cwd",
"is",
"within",
"."
] | def get_repo_root() -> str:
"""Get the root of the git repository the cwd is within."""
return shell_tools.output_of('git', 'rev-parse', '--show-toplevel') | [
"def",
"get_repo_root",
"(",
")",
"->",
"str",
":",
"return",
"shell_tools",
".",
"output_of",
"(",
"'git'",
",",
"'rev-parse'",
",",
"'--show-toplevel'",
")"
] | https://github.com/quantumlib/OpenFermion-Cirq/blob/655b00fee21c94cc96c343c63f7c52ea1aa329dc/dev_tools/git_env_tools.py#L23-L25 | |
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_zha_quirks/__init__.py | python | LocalDataCluster.write_attributes | (self, attributes, manufacturer=None) | return (foundation.Status.SUCCESS,) | Prevent remote writes. | Prevent remote writes. | [
"Prevent",
"remote",
"writes",
"."
] | async def write_attributes(self, attributes, manufacturer=None):
"""Prevent remote writes."""
for attrid, value in attributes.items():
if isinstance(attrid, str):
attrid = self.attridx[attrid]
if attrid not in self.attributes:
self.error("%d is not... | [
"async",
"def",
"write_attributes",
"(",
"self",
",",
"attributes",
",",
"manufacturer",
"=",
"None",
")",
":",
"for",
"attrid",
",",
"value",
"in",
"attributes",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"attrid",
",",
"str",
")",
":",
"at... | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_zha_quirks/__init__.py#L92-L101 | |
programa-stic/barf-project | 9547ef843b8eb021c2c32c140e36173c0b4eafa3 | barf/core/reil/emulator/emulator.py | python | ReilEmulator.execute | (self, container, start=None, end=None, registers=None) | return dict(self.__cpu.registers), self.__mem | Execute instructions. | Execute instructions. | [
"Execute",
"instructions",
"."
] | def execute(self, container, start=None, end=None, registers=None):
"""Execute instructions.
"""
if registers:
self.__cpu.registers = dict(registers)
ip = start if start else container[0].address
while ip and ip != end:
try:
instr = conta... | [
"def",
"execute",
"(",
"self",
",",
"container",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"registers",
"=",
"None",
")",
":",
"if",
"registers",
":",
"self",
".",
"__cpu",
".",
"registers",
"=",
"dict",
"(",
"registers",
")",
"ip",
... | https://github.com/programa-stic/barf-project/blob/9547ef843b8eb021c2c32c140e36173c0b4eafa3/barf/core/reil/emulator/emulator.py#L86-L106 | |
googlearchive/appengine-flask-skeleton | 8c25461d003a0bd99a9ff3b339c2791ee6919242 | lib/jinja2/environment.py | python | Environment.list_templates | (self, extensions=None, filter_func=None) | return x | Returns a list of templates for this environment. This requires
that the loader supports the loader's
:meth:`~BaseLoader.list_templates` method.
If there are other files in the template folder besides the
actual templates, the returned list can be filtered. There are two
ways:... | Returns a list of templates for this environment. This requires
that the loader supports the loader's
:meth:`~BaseLoader.list_templates` method. | [
"Returns",
"a",
"list",
"of",
"templates",
"for",
"this",
"environment",
".",
"This",
"requires",
"that",
"the",
"loader",
"supports",
"the",
"loader",
"s",
":",
"meth",
":",
"~BaseLoader",
".",
"list_templates",
"method",
"."
] | def list_templates(self, extensions=None, filter_func=None):
"""Returns a list of templates for this environment. This requires
that the loader supports the loader's
:meth:`~BaseLoader.list_templates` method.
If there are other files in the template folder besides the
actual te... | [
"def",
"list_templates",
"(",
"self",
",",
"extensions",
"=",
"None",
",",
"filter_func",
"=",
"None",
")",
":",
"x",
"=",
"self",
".",
"loader",
".",
"list_templates",
"(",
")",
"if",
"extensions",
"is",
"not",
"None",
":",
"if",
"filter_func",
"is",
... | https://github.com/googlearchive/appengine-flask-skeleton/blob/8c25461d003a0bd99a9ff3b339c2791ee6919242/lib/jinja2/environment.py#L707-L732 | |
sphinx-doc/sphinx | e79681c76843c1339863b365747079b2d662d0c1 | sphinx/ext/apidoc.py | python | has_child_module | (rootpath: str, excludes: List[str], opts: Any) | return False | Check the given directory contains child module/s (at least one). | Check the given directory contains child module/s (at least one). | [
"Check",
"the",
"given",
"directory",
"contains",
"child",
"module",
"/",
"s",
"(",
"at",
"least",
"one",
")",
"."
] | def has_child_module(rootpath: str, excludes: List[str], opts: Any) -> bool:
"""Check the given directory contains child module/s (at least one)."""
for root, subs, files in walk(rootpath, excludes, opts):
if files:
return True
return False | [
"def",
"has_child_module",
"(",
"rootpath",
":",
"str",
",",
"excludes",
":",
"List",
"[",
"str",
"]",
",",
"opts",
":",
"Any",
")",
"->",
"bool",
":",
"for",
"root",
",",
"subs",
",",
"files",
"in",
"walk",
"(",
"rootpath",
",",
"excludes",
",",
"... | https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/ext/apidoc.py#L228-L234 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/modular/modform/element.py | python | GradedModularFormElement.__call__ | (self, x, prec=None) | return self.q_expansion(prec)(x) | r"""
Evaluate the q-expansion of this graded modular form at x.
EXAMPLES::
sage: M = ModularFormsRing(1)
sage: f4 = ModularForms(1, 4).0; f6 = ModularForms(1, 6).0; f8 = ModularForms(1, 8).0
sage: F = M(f4) + M(f6) + M(f8); F # indirect doctest
3 + 216*q... | r"""
Evaluate the q-expansion of this graded modular form at x. | [
"r",
"Evaluate",
"the",
"q",
"-",
"expansion",
"of",
"this",
"graded",
"modular",
"form",
"at",
"x",
"."
] | def __call__(self, x, prec=None):
r"""
Evaluate the q-expansion of this graded modular form at x.
EXAMPLES::
sage: M = ModularFormsRing(1)
sage: f4 = ModularForms(1, 4).0; f6 = ModularForms(1, 6).0; f8 = ModularForms(1, 8).0
sage: F = M(f4) + M(f6) + M(f8); ... | [
"def",
"__call__",
"(",
"self",
",",
"x",
",",
"prec",
"=",
"None",
")",
":",
"return",
"self",
".",
"q_expansion",
"(",
"prec",
")",
"(",
"x",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/modform/element.py#L3409-L3426 | |
gentoo/portage | e5be73709b1a42b40380fd336f9381452b01a723 | repoman/lib/repoman/modules/vcs/git/status.py | python | Status.check | (self, checkdir, checkdir_relative, xpkg) | return True | Perform the git status check
@param checkdir: string of the directory being checked
@param checkdir_relative: string of the relative directory being checked
@param xpkg: string of the package being checked
@returns: boolean | Perform the git status check | [
"Perform",
"the",
"git",
"status",
"check"
] | def check(self, checkdir, checkdir_relative, xpkg):
"""Perform the git status check
@param checkdir: string of the directory being checked
@param checkdir_relative: string of the relative directory being checked
@param xpkg: string of the package being checked
@returns: boolean
... | [
"def",
"check",
"(",
"self",
",",
"checkdir",
",",
"checkdir_relative",
",",
"xpkg",
")",
":",
"with",
"repoman_popen",
"(",
"\"git ls-files --others %s\"",
"%",
"(",
"portage",
".",
"_shell_quote",
"(",
"checkdir_relative",
")",
",",
")",
")",
"as",
"myf",
... | https://github.com/gentoo/portage/blob/e5be73709b1a42b40380fd336f9381452b01a723/repoman/lib/repoman/modules/vcs/git/status.py#L26-L42 | |
julioasotodv/spark-df-profiling | e5108e0891e209c1dc8864ec7fee7f0c5145032f | spark_df_profiling/lookup_object.py | python | BaseLookupObject.lookup | (self, input_col_df, col_name_in_db=None) | Look up all values in given DF in a database or DataFrame
:param input_col_df: A DataFrame column to look up. This MUST contain only 1 column
:param col_name_in_db: The name of the column to use in the lookup db, if this is None, its assumed to be the
same name as the input column
:retur... | Look up all values in given DF in a database or DataFrame
:param input_col_df: A DataFrame column to look up. This MUST contain only 1 column
:param col_name_in_db: The name of the column to use in the lookup db, if this is None, its assumed to be the
same name as the input column
:retur... | [
"Look",
"up",
"all",
"values",
"in",
"given",
"DF",
"in",
"a",
"database",
"or",
"DataFrame",
":",
"param",
"input_col_df",
":",
"A",
"DataFrame",
"column",
"to",
"look",
"up",
".",
"This",
"MUST",
"contain",
"only",
"1",
"column",
":",
"param",
"col_nam... | def lookup(self, input_col_df, col_name_in_db=None):
"""
Look up all values in given DF in a database or DataFrame
:param input_col_df: A DataFrame column to look up. This MUST contain only 1 column
:param col_name_in_db: The name of the column to use in the lookup db, if this is None, i... | [
"def",
"lookup",
"(",
"self",
",",
"input_col_df",
",",
"col_name_in_db",
"=",
"None",
")",
":",
"pass"
] | https://github.com/julioasotodv/spark-df-profiling/blob/e5108e0891e209c1dc8864ec7fee7f0c5145032f/spark_df_profiling/lookup_object.py#L13-L21 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/widgets/photo.py | python | Photo.set_image | (self, full_path, mime_type=None, rectangle=None) | Set the image to be displayed. | Set the image to be displayed. | [
"Set",
"the",
"image",
"to",
"be",
"displayed",
"."
] | def set_image(self, full_path, mime_type=None, rectangle=None):
"""
Set the image to be displayed.
"""
self.full_path = full_path
if full_path:
pixbuf = get_thumbnail_image(full_path, mime_type, rectangle,
self.__size)
... | [
"def",
"set_image",
"(",
"self",
",",
"full_path",
",",
"mime_type",
"=",
"None",
",",
"rectangle",
"=",
"None",
")",
":",
"self",
".",
"full_path",
"=",
"full_path",
"if",
"full_path",
":",
"pixbuf",
"=",
"get_thumbnail_image",
"(",
"full_path",
",",
"mim... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/widgets/photo.py#L63-L74 | ||
honza/anosql | 903d82f7bc00a97452527c6804054ee931cae03c | anosql/core.py | python | get_driver_adapter | (driver_name) | return driver_adapter() | Get the driver adapter instance registered by the ``driver_name``.
Args:
driver_name (str): The database driver name.
Returns:
object: A driver adapter class. | Get the driver adapter instance registered by the ``driver_name``. | [
"Get",
"the",
"driver",
"adapter",
"instance",
"registered",
"by",
"the",
"driver_name",
"."
] | def get_driver_adapter(driver_name):
"""Get the driver adapter instance registered by the ``driver_name``.
Args:
driver_name (str): The database driver name.
Returns:
object: A driver adapter class.
"""
try:
driver_adapter = _ADAPTERS[driver_name]
except KeyError:
... | [
"def",
"get_driver_adapter",
"(",
"driver_name",
")",
":",
"try",
":",
"driver_adapter",
"=",
"_ADAPTERS",
"[",
"driver_name",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"\"Encountered unregistered driver_name: {}\"",
".",
"format",
"(",
"driver_name"... | https://github.com/honza/anosql/blob/903d82f7bc00a97452527c6804054ee931cae03c/anosql/core.py#L74-L88 | |
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/ui/ui_options_fingerprinting.py | python | Ui_FingerprintingOptionsPage.retranslateUi | (self, FingerprintingOptionsPage) | [] | def retranslateUi(self, FingerprintingOptionsPage):
_translate = QtCore.QCoreApplication.translate
self.fingerprinting.setTitle(_("Audio Fingerprinting"))
self.disable_fingerprinting.setText(_("Do not use audio fingerprinting"))
self.use_acoustid.setText(_("Use AcoustID"))
self.a... | [
"def",
"retranslateUi",
"(",
"self",
",",
"FingerprintingOptionsPage",
")",
":",
"_translate",
"=",
"QtCore",
".",
"QCoreApplication",
".",
"translate",
"self",
".",
"fingerprinting",
".",
"setTitle",
"(",
"_",
"(",
"\"Audio Fingerprinting\"",
")",
")",
"self",
... | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/ui/ui_options_fingerprinting.py#L76-L88 | ||||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/werkzeug/http.py | python | parse_www_authenticate_header | (value, on_update=None) | return WWWAuthenticate(auth_type, parse_dict_header(auth_info),
on_update) | Parse an HTTP WWW-Authenticate header into a
:class:`~werkzeug.datastructures.WWWAuthenticate` object.
:param value: a WWW-Authenticate header to parse.
:param on_update: an optional callable that is called every time a value
on the :class:`~werkzeug.datastructures.WWWAuthenticate`
... | Parse an HTTP WWW-Authenticate header into a
:class:`~werkzeug.datastructures.WWWAuthenticate` object. | [
"Parse",
"an",
"HTTP",
"WWW",
"-",
"Authenticate",
"header",
"into",
"a",
":",
"class",
":",
"~werkzeug",
".",
"datastructures",
".",
"WWWAuthenticate",
"object",
"."
] | def parse_www_authenticate_header(value, on_update=None):
"""Parse an HTTP WWW-Authenticate header into a
:class:`~werkzeug.datastructures.WWWAuthenticate` object.
:param value: a WWW-Authenticate header to parse.
:param on_update: an optional callable that is called every time a value
... | [
"def",
"parse_www_authenticate_header",
"(",
"value",
",",
"on_update",
"=",
"None",
")",
":",
"if",
"not",
"value",
":",
"return",
"WWWAuthenticate",
"(",
"on_update",
"=",
"on_update",
")",
"try",
":",
"auth_type",
",",
"auth_info",
"=",
"value",
".",
"spl... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/werkzeug/http.py#L369-L387 | |
cupy/cupy | a47ad3105f0fe817a4957de87d98ddccb8c7491f | cupy/_indexing/indexing.py | python | extract | (condition, a) | return a.take(condition.nonzero()[0]) | Return the elements of an array that satisfy some condition.
This is equivalent to ``np.compress(ravel(condition), ravel(arr))``.
If ``condition`` is boolean, ``np.extract`` is equivalent to
``arr[condition]``.
Args:
condition (int or array_like): An array whose nonzero or True entries
... | Return the elements of an array that satisfy some condition. | [
"Return",
"the",
"elements",
"of",
"an",
"array",
"that",
"satisfy",
"some",
"condition",
"."
] | def extract(condition, a):
"""Return the elements of an array that satisfy some condition.
This is equivalent to ``np.compress(ravel(condition), ravel(arr))``.
If ``condition`` is boolean, ``np.extract`` is equivalent to
``arr[condition]``.
Args:
condition (int or array_like): An array who... | [
"def",
"extract",
"(",
"condition",
",",
"a",
")",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"cupy",
".",
"ndarray",
")",
":",
"raise",
"TypeError",
"(",
"'extract requires input array to be cupy.ndarray'",
")",
"if",
"not",
"isinstance",
"(",
"condition"... | https://github.com/cupy/cupy/blob/a47ad3105f0fe817a4957de87d98ddccb8c7491f/cupy/_indexing/indexing.py#L129-L160 | |
mrkipling/maraschino | c6be9286937783ae01df2d6d8cebfc8b2734a7d7 | lib/sqlalchemy/engine/base.py | python | Connection.reflecttable | (self, table, include_columns=None) | return self.engine.reflecttable(table, self, include_columns) | Load table description from the database.
Given a :class:`.Table` object, reflect its columns and
properties from the database, populating the given :class:`.Table`
object with attributes.. If include_columns (a list or
set) is specified, limit the autoload to the given column
... | Load table description from the database. | [
"Load",
"table",
"description",
"from",
"the",
"database",
"."
] | def reflecttable(self, table, include_columns=None):
"""Load table description from the database.
Given a :class:`.Table` object, reflect its columns and
properties from the database, populating the given :class:`.Table`
object with attributes.. If include_columns (a list or
se... | [
"def",
"reflecttable",
"(",
"self",
",",
"table",
",",
"include_columns",
"=",
"None",
")",
":",
"return",
"self",
".",
"engine",
".",
"reflecttable",
"(",
"table",
",",
"self",
",",
"include_columns",
")"
] | https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/sqlalchemy/engine/base.py#L1824-L1839 | |
modin-project/modin | 0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee | modin/core/execution/dask/common/task_wrapper.py | python | DaskTask.materialize | (cls, future) | return client.gather(future) | Materialize data matching `future` object.
Parameters
----------
future : distributed.Future or list
Future object of list of future objects whereby data needs to be materialized.
Returns
-------
Any
An object(s) from the distributed memory. | Materialize data matching `future` object. | [
"Materialize",
"data",
"matching",
"future",
"object",
"."
] | def materialize(cls, future):
"""
Materialize data matching `future` object.
Parameters
----------
future : distributed.Future or list
Future object of list of future objects whereby data needs to be materialized.
Returns
-------
Any
... | [
"def",
"materialize",
"(",
"cls",
",",
"future",
")",
":",
"client",
"=",
"default_client",
"(",
")",
"return",
"client",
".",
"gather",
"(",
"future",
")"
] | https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/core/execution/dask/common/task_wrapper.py#L49-L64 | |
EricssonResearch/calvin-base | bc4645c2061c30ca305a660e48dc86e3317f5b6f | calvin/runtime/north/calvincontrol.py | python | CalvinControl.close_log_tunnel | (self, handle) | Close log tunnel | Close log tunnel | [
"Close",
"log",
"tunnel"
] | def close_log_tunnel(self, handle):
""" Close log tunnel
"""
for user_id, logger in self.loggers:
if logger.handle == handle:
del self.loggers[user_id] | [
"def",
"close_log_tunnel",
"(",
"self",
",",
"handle",
")",
":",
"for",
"user_id",
",",
"logger",
"in",
"self",
".",
"loggers",
":",
"if",
"logger",
".",
"handle",
"==",
"handle",
":",
"del",
"self",
".",
"loggers",
"[",
"user_id",
"]"
] | https://github.com/EricssonResearch/calvin-base/blob/bc4645c2061c30ca305a660e48dc86e3317f5b6f/calvin/runtime/north/calvincontrol.py#L105-L110 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/iecp/v20210914/models.py | python | DeleteConfigMapRequest.__init__ | (self) | r"""
:param EdgeUnitID: 单元ID
:type EdgeUnitID: int
:param ConfigMapName: ConfigMap名
:type ConfigMapName: str
:param ConfigMapNamespace: ConfigMap命名空间,默认:default
:type ConfigMapNamespace: str | r"""
:param EdgeUnitID: 单元ID
:type EdgeUnitID: int
:param ConfigMapName: ConfigMap名
:type ConfigMapName: str
:param ConfigMapNamespace: ConfigMap命名空间,默认:default
:type ConfigMapNamespace: str | [
"r",
":",
"param",
"EdgeUnitID",
":",
"单元ID",
":",
"type",
"EdgeUnitID",
":",
"int",
":",
"param",
"ConfigMapName",
":",
"ConfigMap名",
":",
"type",
"ConfigMapName",
":",
"str",
":",
"param",
"ConfigMapNamespace",
":",
"ConfigMap命名空间,默认:default",
":",
"type",
"... | def __init__(self):
r"""
:param EdgeUnitID: 单元ID
:type EdgeUnitID: int
:param ConfigMapName: ConfigMap名
:type ConfigMapName: str
:param ConfigMapNamespace: ConfigMap命名空间,默认:default
:type ConfigMapNamespace: str
"""
self.EdgeUnitID = None
se... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"EdgeUnitID",
"=",
"None",
"self",
".",
"ConfigMapName",
"=",
"None",
"self",
".",
"ConfigMapNamespace",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iecp/v20210914/models.py#L1355-L1366 | ||
KvasirSecurity/Kvasir | a5b3775184a8343240e1154a1f762f75df04dc0a | modules/skaldship/passwords/hydra.py | python | process_hydra | (line) | return retval | Process a hydra line and return a dictionary:
{ 'ip' : ip address
'port': port info - can be port # or module name
'user': username,
'pass': password,
'hash': ntlm hash if smbnt hash used
'msg' : status message
} | Process a hydra line and return a dictionary: | [
"Process",
"a",
"hydra",
"line",
"and",
"return",
"a",
"dictionary",
":"
] | def process_hydra(line):
"""
Process a hydra line and return a dictionary:
{ 'ip' : ip address
'port': port info - can be port # or module name
'user': username,
'pass': password,
'hash': ntlm hash if smbnt hash used
'msg' : status message
}
"""
# line: [22][ssh] ... | [
"def",
"process_hydra",
"(",
"line",
")",
":",
"# line: [22][ssh] host: 1.1.1.1 login: username password: pw1234",
"retval",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"line",
".",
"split",
"(",
")",
"except",
"Exception",
",",
"e",
":",
"log",
"(",
"\"Error pr... | https://github.com/KvasirSecurity/Kvasir/blob/a5b3775184a8343240e1154a1f762f75df04dc0a/modules/skaldship/passwords/hydra.py#L22-L71 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/lib2to3/refactor.py | python | RefactoringTool.refactor_dir | (self, dir_name, write=False, doctests_only=False) | Descends down a directory and refactor every Python file found.
Python files are assumed to have a .py extension.
Files and subdirectories starting with '.' are skipped. | Descends down a directory and refactor every Python file found. | [
"Descends",
"down",
"a",
"directory",
"and",
"refactor",
"every",
"Python",
"file",
"found",
"."
] | def refactor_dir(self, dir_name, write=False, doctests_only=False):
"""Descends down a directory and refactor every Python file found.
Python files are assumed to have a .py extension.
Files and subdirectories starting with '.' are skipped.
"""
py_ext = os.extsep + "py"
... | [
"def",
"refactor_dir",
"(",
"self",
",",
"dir_name",
",",
"write",
"=",
"False",
",",
"doctests_only",
"=",
"False",
")",
":",
"py_ext",
"=",
"os",
".",
"extsep",
"+",
"\"py\"",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"wal... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/lib2to3/refactor.py#L298-L316 | ||
awslabs/gluon-ts | 066ec3b7f47aa4ee4c061a28f35db7edbad05a98 | src/gluonts/model/san/_layers.py | python | SelfAttention._merge_head | (self, F, x: Tensor) | return x | Merge multi-heads into one hidden state
Args
----------
x : Tensor [batch, n_head, length, d_head]
Returns
-------
Tensor [batch, length, d_hidden] | Merge multi-heads into one hidden state | [
"Merge",
"multi",
"-",
"heads",
"into",
"one",
"hidden",
"state"
] | def _merge_head(self, F, x: Tensor) -> Tensor:
"""
Merge multi-heads into one hidden state
Args
----------
x : Tensor [batch, n_head, length, d_head]
Returns
-------
Tensor [batch, length, d_hidden]
"""
x = F.swapaxes(data=x, dim1... | [
"def",
"_merge_head",
"(",
"self",
",",
"F",
",",
"x",
":",
"Tensor",
")",
"->",
"Tensor",
":",
"x",
"=",
"F",
".",
"swapaxes",
"(",
"data",
"=",
"x",
",",
"dim1",
"=",
"1",
",",
"dim2",
"=",
"2",
")",
"x",
"=",
"F",
".",
"reshape",
"(",
"d... | https://github.com/awslabs/gluon-ts/blob/066ec3b7f47aa4ee4c061a28f35db7edbad05a98/src/gluonts/model/san/_layers.py#L235-L249 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/thirdparty/bottle/bottle.py | python | SimpleTemplate.render | (self, *args, **kwargs) | return ''.join(stdout) | Render the template using keyword arguments as local variables. | Render the template using keyword arguments as local variables. | [
"Render",
"the",
"template",
"using",
"keyword",
"arguments",
"as",
"local",
"variables",
"."
] | def render(self, *args, **kwargs):
""" Render the template using keyword arguments as local variables. """
for dictarg in args: kwargs.update(dictarg)
stdout = []
self.execute(stdout, kwargs)
return ''.join(stdout) | [
"def",
"render",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"dictarg",
"in",
"args",
":",
"kwargs",
".",
"update",
"(",
"dictarg",
")",
"stdout",
"=",
"[",
"]",
"self",
".",
"execute",
"(",
"stdout",
",",
"kwargs",
"... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/bottle/bottle.py#L3090-L3095 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/click/decorators.py | python | version_option | (
version: t.Optional[str] = None,
*param_decls: str,
package_name: t.Optional[str] = None,
prog_name: t.Optional[str] = None,
message: t.Optional[str] = None,
**kwargs: t.Any,
) | return option(*param_decls, **kwargs) | Add a ``--version`` option which immediately prints the version
number and exits the program.
If ``version`` is not provided, Click will try to detect it using
:func:`importlib.metadata.version` to get the version for the
``package_name``. On Python < 3.8, the ``importlib_metadata``
backport must b... | Add a ``--version`` option which immediately prints the version
number and exits the program. | [
"Add",
"a",
"--",
"version",
"option",
"which",
"immediately",
"prints",
"the",
"version",
"number",
"and",
"exits",
"the",
"program",
"."
] | def version_option(
version: t.Optional[str] = None,
*param_decls: str,
package_name: t.Optional[str] = None,
prog_name: t.Optional[str] = None,
message: t.Optional[str] = None,
**kwargs: t.Any,
) -> t.Callable[[FC], FC]:
"""Add a ``--version`` option which immediately prints the version
... | [
"def",
"version_option",
"(",
"version",
":",
"t",
".",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"param_decls",
":",
"str",
",",
"package_name",
":",
"t",
".",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"prog_name",
":",
"t",
".",
"O... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/click/decorators.py#L294-L405 | |
STVIR/pysot | 9b07c521fd370ba38d35f35f76b275156564a681 | toolkit/datasets/dataset.py | python | Dataset.set_tracker | (self, path, tracker_names) | Args:
path: path to tracker results,
tracker_names: list of tracker name | Args:
path: path to tracker results,
tracker_names: list of tracker name | [
"Args",
":",
"path",
":",
"path",
"to",
"tracker",
"results",
"tracker_names",
":",
"list",
"of",
"tracker",
"name"
] | def set_tracker(self, path, tracker_names):
"""
Args:
path: path to tracker results,
tracker_names: list of tracker name
"""
self.tracker_path = path
self.tracker_names = tracker_names | [
"def",
"set_tracker",
"(",
"self",
",",
"path",
",",
"tracker_names",
")",
":",
"self",
".",
"tracker_path",
"=",
"path",
"self",
".",
"tracker_names",
"=",
"tracker_names"
] | https://github.com/STVIR/pysot/blob/9b07c521fd370ba38d35f35f76b275156564a681/toolkit/datasets/dataset.py#L23-L30 | ||
python-telegram-bot/python-telegram-bot | ade1529986f5b6d394a65372d6a27045a70725b2 | telegram/ext/dictpersistence.py | python | DictPersistence.update_chat_data | (self, chat_id: int, data: Dict) | Will update the chat_data (if changed).
Args:
chat_id (:obj:`int`): The chat the data might have been changed for.
data (:obj:`dict`): The :attr:`telegram.ext.Dispatcher.chat_data` ``[chat_id]``. | Will update the chat_data (if changed). | [
"Will",
"update",
"the",
"chat_data",
"(",
"if",
"changed",
")",
"."
] | def update_chat_data(self, chat_id: int, data: Dict) -> None:
"""Will update the chat_data (if changed).
Args:
chat_id (:obj:`int`): The chat the data might have been changed for.
data (:obj:`dict`): The :attr:`telegram.ext.Dispatcher.chat_data` ``[chat_id]``.
"""
... | [
"def",
"update_chat_data",
"(",
"self",
",",
"chat_id",
":",
"int",
",",
"data",
":",
"Dict",
")",
"->",
"None",
":",
"if",
"self",
".",
"_chat_data",
"is",
"None",
":",
"self",
".",
"_chat_data",
"=",
"defaultdict",
"(",
"dict",
")",
"if",
"self",
"... | https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/ext/dictpersistence.py#L346-L358 | ||
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | TensorFlow/Detection/SSD/models/research/slim/nets/nasnet/nasnet.py | python | nasnet_mobile_arg_scope | (weight_decay=4e-5,
batch_norm_decay=0.9997,
batch_norm_epsilon=1e-3) | Defines the default arg scope for the NASNet-A Mobile ImageNet model.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_decay: Decay for batch norm moving average.
batch_norm_epsilon: Small float added to variance to avoid dividing by zero
in batch norm.
Returns:... | Defines the default arg scope for the NASNet-A Mobile ImageNet model. | [
"Defines",
"the",
"default",
"arg",
"scope",
"for",
"the",
"NASNet",
"-",
"A",
"Mobile",
"ImageNet",
"model",
"."
] | def nasnet_mobile_arg_scope(weight_decay=4e-5,
batch_norm_decay=0.9997,
batch_norm_epsilon=1e-3):
"""Defines the default arg scope for the NASNet-A Mobile ImageNet model.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_no... | [
"def",
"nasnet_mobile_arg_scope",
"(",
"weight_decay",
"=",
"4e-5",
",",
"batch_norm_decay",
"=",
"0.9997",
",",
"batch_norm_epsilon",
"=",
"1e-3",
")",
":",
"batch_norm_params",
"=",
"{",
"# Decay for the moving averages.",
"'decay'",
":",
"batch_norm_decay",
",",
"#... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Detection/SSD/models/research/slim/nets/nasnet/nasnet.py#L155-L188 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/logging/handlers.py | python | SocketHandler.__init__ | (self, host, port) | Initializes the handler with a specific host address and port.
The attribute 'closeOnError' is set to 1 - which means that if
a socket error occurs, the socket is silently closed and then
reopened on the next logging call. | Initializes the handler with a specific host address and port. | [
"Initializes",
"the",
"handler",
"with",
"a",
"specific",
"host",
"address",
"and",
"port",
"."
] | def __init__(self, host, port):
"""
Initializes the handler with a specific host address and port.
The attribute 'closeOnError' is set to 1 - which means that if
a socket error occurs, the socket is silently closed and then
reopened on the next logging call.
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"port",
")",
":",
"logging",
".",
"Handler",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port",
"=",
"port",
"self",
".",
"sock",
"=",
"None",
"self",
".",
"... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/logging/handlers.py#L429-L448 | ||
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/trainer/callback_hook.py | python | TrainerCallbackHookMixin.on_validation_batch_start | (self, batch, batch_idx, dataloader_idx) | r"""
.. deprecated:: v1.6
`TrainerCallbackHookMixin.on_validation_batch_start` was deprecated in v1.6 and will be removed in v1.8.
Called when the validation batch begins. | r"""
.. deprecated:: v1.6
`TrainerCallbackHookMixin.on_validation_batch_start` was deprecated in v1.6 and will be removed in v1.8. | [
"r",
"..",
"deprecated",
"::",
"v1",
".",
"6",
"TrainerCallbackHookMixin",
".",
"on_validation_batch_start",
"was",
"deprecated",
"in",
"v1",
".",
"6",
"and",
"will",
"be",
"removed",
"in",
"v1",
".",
"8",
"."
] | def on_validation_batch_start(self, batch, batch_idx, dataloader_idx):
r"""
.. deprecated:: v1.6
`TrainerCallbackHookMixin.on_validation_batch_start` was deprecated in v1.6 and will be removed in v1.8.
Called when the validation batch begins.
"""
rank_zero_deprecatio... | [
"def",
"on_validation_batch_start",
"(",
"self",
",",
"batch",
",",
"batch_idx",
",",
"dataloader_idx",
")",
":",
"rank_zero_deprecation",
"(",
"\"`TrainerCallbackHookMixin.on_validation_batch_start` was deprecated in v1.6 and will be removed in v1.8.\"",
")",
"for",
"callback",
... | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/trainer/callback_hook.py#L409-L420 | ||
JacksonWuxs/DaPy | b2bf72707ffcc92d05af1ac890e0786d5787816e | DaPy/core/base/BaseSheet.py | python | BaseSheet.shape | (self) | return self._dim | self.shape -> numbers of rows and columns in tuple | self.shape -> numbers of rows and columns in tuple | [
"self",
".",
"shape",
"-",
">",
"numbers",
"of",
"rows",
"and",
"columns",
"in",
"tuple"
] | def shape(self):
'''self.shape -> numbers of rows and columns in tuple'''
return self._dim | [
"def",
"shape",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dim"
] | https://github.com/JacksonWuxs/DaPy/blob/b2bf72707ffcc92d05af1ac890e0786d5787816e/DaPy/core/base/BaseSheet.py#L114-L116 | |
annoviko/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | pyclustering/cluster/gmeans.py | python | gmeans._project_data | (data, vector) | return numpy.divide(numpy.sum(numpy.multiply(data, vector), axis=1), square_norm) | !
@brief Transform input data by project it onto input vector using formula:
\f[
x_{i}^{*}=\frac{\left \langle x_{i}, v \right \rangle}{\left \| v \right \|^{2}}.
\f]
@param[in] data (array_like): Input data that is represented by points.
@param[in] vector (array_like):... | !
@brief Transform input data by project it onto input vector using formula: | [
"!",
"@brief",
"Transform",
"input",
"data",
"by",
"project",
"it",
"onto",
"input",
"vector",
"using",
"formula",
":"
] | def _project_data(data, vector):
"""!
@brief Transform input data by project it onto input vector using formula:
\f[
x_{i}^{*}=\frac{\left \langle x_{i}, v \right \rangle}{\left \| v \right \|^{2}}.
\f]
@param[in] data (array_like): Input data that is represented by poi... | [
"def",
"_project_data",
"(",
"data",
",",
"vector",
")",
":",
"square_norm",
"=",
"numpy",
".",
"sum",
"(",
"numpy",
".",
"multiply",
"(",
"vector",
",",
"vector",
")",
")",
"return",
"numpy",
".",
"divide",
"(",
"numpy",
".",
"sum",
"(",
"numpy",
".... | https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/cluster/gmeans.py#L334-L349 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | mx.graalpython/mx_graalpython_benchmark.py | python | PythonParserBenchmarkSuite.get_vm_registry | (self) | return java_vm_registry | [] | def get_vm_registry(self):
return java_vm_registry | [
"def",
"get_vm_registry",
"(",
"self",
")",
":",
"return",
"java_vm_registry"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/mx.graalpython/mx_graalpython_benchmark.py#L1011-L1012 | |||
HenriWahl/Nagstamon | 16549c6860b51a93141d84881c6ad28c35d8581e | Nagstamon/QUI/__init__.py | python | TreeView.action_response_decorator | (method) | return (decoration_function) | decorate repeatedly called stuff | decorate repeatedly called stuff | [
"decorate",
"repeatedly",
"called",
"stuff"
] | def action_response_decorator(method):
"""
decorate repeatedly called stuff
"""
def decoration_function(self):
# avoid blocked context menu
self.action_menu.available = True
# run decorated method
method(self)
# default act... | [
"def",
"action_response_decorator",
"(",
"method",
")",
":",
"def",
"decoration_function",
"(",
"self",
")",
":",
"# avoid blocked context menu",
"self",
".",
"action_menu",
".",
"available",
"=",
"True",
"# run decorated method",
"method",
"(",
"self",
")",
"# defa... | https://github.com/HenriWahl/Nagstamon/blob/16549c6860b51a93141d84881c6ad28c35d8581e/Nagstamon/QUI/__init__.py#L3707-L3723 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/indexes/multi.py | python | MultiIndex.__array__ | (self, dtype=None) | return self.values | the array interface, return my values | the array interface, return my values | [
"the",
"array",
"interface",
"return",
"my",
"values"
] | def __array__(self, dtype=None):
""" the array interface, return my values """
return self.values | [
"def",
"__array__",
"(",
"self",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"self",
".",
"values"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/indexes/multi.py#L818-L820 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/email/_parseaddr.py | python | AddrlistClass.getquote | (self) | return self.getdelimited('"', '"\r', False) | Get a quote-delimited fragment from self's field. | Get a quote-delimited fragment from self's field. | [
"Get",
"a",
"quote",
"-",
"delimited",
"fragment",
"from",
"self",
"s",
"field",
"."
] | def getquote(self):
"""Get a quote-delimited fragment from self's field."""
return self.getdelimited('"', '"\r', False) | [
"def",
"getquote",
"(",
"self",
")",
":",
"return",
"self",
".",
"getdelimited",
"(",
"'\"'",
",",
"'\"\\r'",
",",
"False",
")"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/email/_parseaddr.py#L406-L408 | |
rustedpy/result | ae2db8a12c0e9ae8a86ff7b0880505904f79366b | src/result/result.py | python | Ok.ok | (self) | return self._value | Return the value. | Return the value. | [
"Return",
"the",
"value",
"."
] | def ok(self) -> T:
"""
Return the value.
"""
return self._value | [
"def",
"ok",
"(",
"self",
")",
"->",
"T",
":",
"return",
"self",
".",
"_value"
] | https://github.com/rustedpy/result/blob/ae2db8a12c0e9ae8a86ff7b0880505904f79366b/src/result/result.py#L71-L75 | |
modflowpy/flopy | eecd1ad193c5972093c9712e5c4b7a83284f0688 | flopy/utils/gridintersect.py | python | parse_shapely_ix_result | (collection, ix_result, shptyps=None) | return collection | Recursive function for parsing shapely intersection results. Returns a
list of shapely shapes matching shptyp.
Parameters
----------
collection : list
state variable for storing result, generally
an empty list
ix_result : shapely.geometry type
any shapely intersection result... | Recursive function for parsing shapely intersection results. Returns a
list of shapely shapes matching shptyp. | [
"Recursive",
"function",
"for",
"parsing",
"shapely",
"intersection",
"results",
".",
"Returns",
"a",
"list",
"of",
"shapely",
"shapes",
"matching",
"shptyp",
"."
] | def parse_shapely_ix_result(collection, ix_result, shptyps=None):
"""Recursive function for parsing shapely intersection results. Returns a
list of shapely shapes matching shptyp.
Parameters
----------
collection : list
state variable for storing result, generally
an empty list
... | [
"def",
"parse_shapely_ix_result",
"(",
"collection",
",",
"ix_result",
",",
"shptyps",
"=",
"None",
")",
":",
"# convert shptyps to list if needed",
"if",
"isinstance",
"(",
"shptyps",
",",
"str",
")",
":",
"shptyps",
"=",
"[",
"shptyps",
"]",
"elif",
"shptyps",... | https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/utils/gridintersect.py#L67-L108 | |
kovidgoyal/calibre | 2b41671370f2a9eb1109b9ae901ccf915f1bd0c8 | src/calibre/utils/imghdr.py | python | ppm | (h) | PPM (portable pixmap) | PPM (portable pixmap) | [
"PPM",
"(",
"portable",
"pixmap",
")"
] | def ppm(h):
"""PPM (portable pixmap)"""
if len(h) >= 3 and \
h[0] == b'P' and h[1] in b'36' and h[2] in b' \t\n\r':
return 'ppm' | [
"def",
"ppm",
"(",
"h",
")",
":",
"if",
"len",
"(",
"h",
")",
">=",
"3",
"and",
"h",
"[",
"0",
"]",
"==",
"b'P'",
"and",
"h",
"[",
"1",
"]",
"in",
"b'36'",
"and",
"h",
"[",
"2",
"]",
"in",
"b' \\t\\n\\r'",
":",
"return",
"'ppm'"
] | https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/utils/imghdr.py#L221-L225 | ||
brad-sp/cuckoo-modified | 038cfbba66ef76557d255aa89f2d4205f376ca45 | modules/processing/network.py | python | flowtuple_from_raw | (raw, linktype=1) | return flowtuple | Parse a packet from a pcap just enough to gain a flow description tuple | Parse a packet from a pcap just enough to gain a flow description tuple | [
"Parse",
"a",
"packet",
"from",
"a",
"pcap",
"just",
"enough",
"to",
"gain",
"a",
"flow",
"description",
"tuple"
] | def flowtuple_from_raw(raw, linktype=1):
"""Parse a packet from a pcap just enough to gain a flow description tuple"""
ip = iplayer_from_raw(raw, linktype)
if isinstance(ip, dpkt.ip.IP):
sip, dip = socket.inet_ntoa(ip.src), socket.inet_ntoa(ip.dst)
proto = ip.p
if proto == dpkt.ip.... | [
"def",
"flowtuple_from_raw",
"(",
"raw",
",",
"linktype",
"=",
"1",
")",
":",
"ip",
"=",
"iplayer_from_raw",
"(",
"raw",
",",
"linktype",
")",
"if",
"isinstance",
"(",
"ip",
",",
"dpkt",
".",
"ip",
".",
"IP",
")",
":",
"sip",
",",
"dip",
"=",
"sock... | https://github.com/brad-sp/cuckoo-modified/blob/038cfbba66ef76557d255aa89f2d4205f376ca45/modules/processing/network.py#L838-L857 | |
gnes-ai/gnes | b4d2c8cf863664a9322f866a72eab8246175ebef | gnes/encoder/audio/vggish_cores/vggish_postprocess.py | python | Postprocessor.__init__ | (self, pca_params_npz_path) | Constructs a postprocessor.
Args:
pca_params_npz_path: Path to a NumPy-format .npz file that
contains the PCA parameters used in postprocessing. | Constructs a postprocessor. | [
"Constructs",
"a",
"postprocessor",
"."
] | def __init__(self, pca_params_npz_path):
"""Constructs a postprocessor.
Args:
pca_params_npz_path: Path to a NumPy-format .npz file that
contains the PCA parameters used in postprocessing.
"""
params = np.load(pca_params_npz_path)
self._pca_matrix = params[... | [
"def",
"__init__",
"(",
"self",
",",
"pca_params_npz_path",
")",
":",
"params",
"=",
"np",
".",
"load",
"(",
"pca_params_npz_path",
")",
"self",
".",
"_pca_matrix",
"=",
"params",
"[",
"vggish_params",
".",
"PCA_EIGEN_VECTORS_NAME",
"]",
"# Load means into a colum... | https://github.com/gnes-ai/gnes/blob/b4d2c8cf863664a9322f866a72eab8246175ebef/gnes/encoder/audio/vggish_cores/vggish_postprocess.py#L21-L36 | ||
vmware/pyvcloud | d72c615fa41b8ea5ab049a929e18d8ba6460fc59 | pyvcloud/vcd/platform.py | python | Platform.delete_external_network | (self, name, force=False) | Delete an external network.
:param str name: name of the external network to be deleted.
:return: an object containing EntityType.TASK XML data which represents
the asynchronous task that is deleting external network.
:rtype: lxml.objectify.ObjectifiedElement
:raises: Ent... | Delete an external network. | [
"Delete",
"an",
"external",
"network",
"."
] | def delete_external_network(self, name, force=False):
"""Delete an external network.
:param str name: name of the external network to be deleted.
:return: an object containing EntityType.TASK XML data which represents
the asynchronous task that is deleting external network.
... | [
"def",
"delete_external_network",
"(",
"self",
",",
"name",
",",
"force",
"=",
"False",
")",
":",
"ext_net_refs",
"=",
"self",
".",
"list_external_networks",
"(",
")",
"for",
"ext_net",
"in",
"ext_net_refs",
":",
"if",
"ext_net",
".",
"get",
"(",
"'name'",
... | https://github.com/vmware/pyvcloud/blob/d72c615fa41b8ea5ab049a929e18d8ba6460fc59/pyvcloud/vcd/platform.py#L197-L215 | ||
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | getRadixEA | (*args) | return _idaapi.getRadixEA(*args) | getRadixEA(ea, n) -> int | getRadixEA(ea, n) -> int | [
"getRadixEA",
"(",
"ea",
"n",
")",
"-",
">",
"int"
] | def getRadixEA(*args):
"""
getRadixEA(ea, n) -> int
"""
return _idaapi.getRadixEA(*args) | [
"def",
"getRadixEA",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"getRadixEA",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L22589-L22593 | |
OpenXenManager/openxenmanager | 1cb5c1cb13358ba584856e99a94f9669d17670ff | src/pygtk_chart/line_chart.py | python | Graph.get_show_title | (self) | return self.get_property("show-title") | Returns True if the title of the graph is shown.
@return: boolean. | Returns True if the title of the graph is shown. | [
"Returns",
"True",
"if",
"the",
"title",
"of",
"the",
"graph",
"is",
"shown",
"."
] | def get_show_title(self):
"""
Returns True if the title of the graph is shown.
@return: boolean.
"""
return self.get_property("show-title") | [
"def",
"get_show_title",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_property",
"(",
"\"show-title\"",
")"
] | https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/pygtk_chart/line_chart.py#L1716-L1722 | |
jtpereyda/boofuzz | 64badab7257117bcadab35e903d723223dde9203 | boofuzz/monitors/network_monitor.py | python | NetworkMonitor.on_new_server | (self, new_uuid) | Restores all set options to the RPC daemon if it has restarted since the last call. | Restores all set options to the RPC daemon if it has restarted since the last call. | [
"Restores",
"all",
"set",
"options",
"to",
"the",
"RPC",
"daemon",
"if",
"it",
"has",
"restarted",
"since",
"the",
"last",
"call",
"."
] | def on_new_server(self, new_uuid):
"""Restores all set options to the RPC daemon if it has restarted since the last call."""
for key, val in self.server_options.items():
self.__hot_transmit(("set_{}".format(key), ((val,), {}))) | [
"def",
"on_new_server",
"(",
"self",
",",
"new_uuid",
")",
":",
"for",
"key",
",",
"val",
"in",
"self",
".",
"server_options",
".",
"items",
"(",
")",
":",
"self",
".",
"__hot_transmit",
"(",
"(",
"\"set_{}\"",
".",
"format",
"(",
"key",
")",
",",
"(... | https://github.com/jtpereyda/boofuzz/blob/64badab7257117bcadab35e903d723223dde9203/boofuzz/monitors/network_monitor.py#L74-L77 | ||
TeaPearce/precipitation-prediction-convLSTM-keras | 03d3492f113637395cbdebbe5adf2a3461dbc0b4 | precip_v09.py | python | fn_h5_to_Xy_2D_timeD | (test_train,i=0,h_select = 3) | return X,y | [] | def fn_h5_to_Xy_2D_timeD(test_train,i=0,h_select = 3):
np_id, np_label, np_data = fn_h5_to_np(test_train=test_train,i=i) # load data from h5
X, y = fn_np_to_Xy_2D_timeD(np_data, np_label, h_select = h_select) # convert to X,y format
X = fn_minus_ones(X)
X, y = fn_norm_Xy(X,y,is_graph=False) # norma... | [
"def",
"fn_h5_to_Xy_2D_timeD",
"(",
"test_train",
",",
"i",
"=",
"0",
",",
"h_select",
"=",
"3",
")",
":",
"np_id",
",",
"np_label",
",",
"np_data",
"=",
"fn_h5_to_np",
"(",
"test_train",
"=",
"test_train",
",",
"i",
"=",
"i",
")",
"# load data from h5",
... | https://github.com/TeaPearce/precipitation-prediction-convLSTM-keras/blob/03d3492f113637395cbdebbe5adf2a3461dbc0b4/precip_v09.py#L410-L418 | |||
rackerlabs/mimic | efd34108b6aa3eb7ecd26e22f1aa155c14a7885e | mimic/model/nova_objects.py | python | metadata_to_creation_behavior | (metadata) | return None | Examine the metadata given to a server creation request, and return a
behavior based on the values present there. | Examine the metadata given to a server creation request, and return a
behavior based on the values present there. | [
"Examine",
"the",
"metadata",
"given",
"to",
"a",
"server",
"creation",
"request",
"and",
"return",
"a",
"behavior",
"based",
"on",
"the",
"values",
"present",
"there",
"."
] | def metadata_to_creation_behavior(metadata):
"""
Examine the metadata given to a server creation request, and return a
behavior based on the values present there.
"""
if 'create_server_failure' in metadata:
return create_fail_behavior(loads(metadata['create_server_failure']))
if 'server_... | [
"def",
"metadata_to_creation_behavior",
"(",
"metadata",
")",
":",
"if",
"'create_server_failure'",
"in",
"metadata",
":",
"return",
"create_fail_behavior",
"(",
"loads",
"(",
"metadata",
"[",
"'create_server_failure'",
"]",
")",
")",
"if",
"'server_building'",
"in",
... | https://github.com/rackerlabs/mimic/blob/efd34108b6aa3eb7ecd26e22f1aa155c14a7885e/mimic/model/nova_objects.py#L652-L665 | |
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/tornado/web.py | python | RequestHandler.clear_cookie | (self, name, path="/", domain=None) | Deletes the cookie with the given name.
Due to limitations of the cookie protocol, you must pass the same
path and domain to clear a cookie as were used when that cookie
was set (but there is no way to find out on the server side
which values were used for a given cookie). | Deletes the cookie with the given name. | [
"Deletes",
"the",
"cookie",
"with",
"the",
"given",
"name",
"."
] | def clear_cookie(self, name, path="/", domain=None):
"""Deletes the cookie with the given name.
Due to limitations of the cookie protocol, you must pass the same
path and domain to clear a cookie as were used when that cookie
was set (but there is no way to find out on the server side
... | [
"def",
"clear_cookie",
"(",
"self",
",",
"name",
",",
"path",
"=",
"\"/\"",
",",
"domain",
"=",
"None",
")",
":",
"expires",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"-",
"datetime",
".",
"timedelta",
"(",
"days",
"=",
"365",
")",
... | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/tornado/web.py#L547-L557 | ||
ChineseGLUE/ChineseGLUE | 1591b85cf5427c2ff60f718d359ecb71d2b44879 | baselines/models/albert/resources/create_pretraining_data_roberta.py | python | get_new_segment | (segment) | return new_segment | 输入一句话,返回一句经过处理的话: 为了支持中文全称mask,将被分开的词,将上特殊标记("#"),使得后续处理模块,能够知道哪些字是属于同一个词的。
:param segment: 一句话
:return: 一句处理过的话 | 输入一句话,返回一句经过处理的话: 为了支持中文全称mask,将被分开的词,将上特殊标记("#"),使得后续处理模块,能够知道哪些字是属于同一个词的。
:param segment: 一句话
:return: 一句处理过的话 | [
"输入一句话,返回一句经过处理的话",
":",
"为了支持中文全称mask,将被分开的词,将上特殊标记",
"(",
"#",
")",
",使得后续处理模块,能够知道哪些字是属于同一个词的。",
":",
"param",
"segment",
":",
"一句话",
":",
"return",
":",
"一句处理过的话"
] | def get_new_segment(segment): # 新增的方法 ####
"""
输入一句话,返回一句经过处理的话: 为了支持中文全称mask,将被分开的词,将上特殊标记("#"),使得后续处理模块,能够知道哪些字是属于同一个词的。
:param segment: 一句话
:return: 一句处理过的话
"""
seq_cws = jieba.lcut("".join(segment))
seq_cws_dict = {x: 1 for x in seq_cws}
new_segment = []
i = 0
while i < len(... | [
"def",
"get_new_segment",
"(",
"segment",
")",
":",
"# 新增的方法 ####",
"seq_cws",
"=",
"jieba",
".",
"lcut",
"(",
"\"\"",
".",
"join",
"(",
"segment",
")",
")",
"seq_cws_dict",
"=",
"{",
"x",
":",
"1",
"for",
"x",
"in",
"seq_cws",
"}",
"new_segment",
"="... | https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/albert/resources/create_pretraining_data_roberta.py#L250-L280 | |
kayousterhout/trace-analysis | a20a1ac8dc2f93d881b22095ab43d2209923e52b | upload.py | python | AbstractRpcServer._CreateRequest | (self, url, data=None) | return req | Creates a new urllib request. | Creates a new urllib request. | [
"Creates",
"a",
"new",
"urllib",
"request",
"."
] | def _CreateRequest(self, url, data=None):
"""Creates a new urllib request."""
logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
req = urllib2.Request(url, data=data, headers={"Accept": "text/plain"})
if self.host_override:
req.add_header("Host", self.host_override)
for k... | [
"def",
"_CreateRequest",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
")",
":",
"logging",
".",
"debug",
"(",
"\"Creating request for: '%s' with payload:\\n%s\"",
",",
"url",
",",
"data",
")",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"url",
",",
"... | https://github.com/kayousterhout/trace-analysis/blob/a20a1ac8dc2f93d881b22095ab43d2209923e52b/upload.py#L223-L231 | |
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | gui/brushmanager.py | python | BrushManager.select_initial_brush | (self) | Select the initial brush using saved app preferences. | Select the initial brush using saved app preferences. | [
"Select",
"the",
"initial",
"brush",
"using",
"saved",
"app",
"preferences",
"."
] | def select_initial_brush(self):
"""Select the initial brush using saved app preferences.
"""
initial_brush = None
# If we recorded which devbrush was last in use, restore it and assume
# that most of the time the user will continue to work with the same
# brush and its se... | [
"def",
"select_initial_brush",
"(",
"self",
")",
":",
"initial_brush",
"=",
"None",
"# If we recorded which devbrush was last in use, restore it and assume",
"# that most of the time the user will continue to work with the same",
"# brush and its settings.",
"app",
"=",
"self",
".",
... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/gui/brushmanager.py#L523-L543 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/ordered_dict.py | python | OrderedDict.viewkeys | (self) | return KeysView(self) | od.viewkeys() -> a set-like object providing a view on od's keys | od.viewkeys() -> a set-like object providing a view on od's keys | [
"od",
".",
"viewkeys",
"()",
"-",
">",
"a",
"set",
"-",
"like",
"object",
"providing",
"a",
"view",
"on",
"od",
"s",
"keys"
] | def viewkeys(self):
"od.viewkeys() -> a set-like object providing a view on od's keys"
return KeysView(self) | [
"def",
"viewkeys",
"(",
"self",
")",
":",
"return",
"KeysView",
"(",
"self",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/ordered_dict.py#L249-L251 | |
mahmoud/boltons | 270e974975984f662f998c8f6eb0ebebd964de82 | boltons/socketutils.py | python | BufferedSocket.recv_until | (self, delimiter, timeout=_UNSET, maxsize=_UNSET,
with_delimiter=False) | return val | Receive until *delimiter* is found, *maxsize* bytes have been read,
or *timeout* is exceeded.
Args:
delimiter (bytes): One or more bytes to be searched for
in the socket stream.
timeout (float): The timeout for this operation. Can be 0 for
nonbloc... | Receive until *delimiter* is found, *maxsize* bytes have been read,
or *timeout* is exceeded. | [
"Receive",
"until",
"*",
"delimiter",
"*",
"is",
"found",
"*",
"maxsize",
"*",
"bytes",
"have",
"been",
"read",
"or",
"*",
"timeout",
"*",
"is",
"exceeded",
"."
] | def recv_until(self, delimiter, timeout=_UNSET, maxsize=_UNSET,
with_delimiter=False):
"""Receive until *delimiter* is found, *maxsize* bytes have been read,
or *timeout* is exceeded.
Args:
delimiter (bytes): One or more bytes to be searched for
in... | [
"def",
"recv_until",
"(",
"self",
",",
"delimiter",
",",
"timeout",
"=",
"_UNSET",
",",
"maxsize",
"=",
"_UNSET",
",",
"with_delimiter",
"=",
"False",
")",
":",
"with",
"self",
".",
"_recv_lock",
":",
"if",
"maxsize",
"is",
"_UNSET",
":",
"maxsize",
"=",... | https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/socketutils.py#L286-L366 | |
RasaHQ/rasa | 54823b68c1297849ba7ae841a4246193cd1223a1 | rasa/core/training/interactive.py | python | _write_nlu_to_file | (export_nlu_path: Text, events: List[Dict[Text, Any]]) | Write the nlu data of the conversation_id to the file paths. | Write the nlu data of the conversation_id to the file paths. | [
"Write",
"the",
"nlu",
"data",
"of",
"the",
"conversation_id",
"to",
"the",
"file",
"paths",
"."
] | def _write_nlu_to_file(export_nlu_path: Text, events: List[Dict[Text, Any]]) -> None:
"""Write the nlu data of the conversation_id to the file paths."""
from rasa.shared.nlu.training_data.training_data import TrainingData
msgs = _collect_messages(events)
msgs = _filter_messages(msgs)
# noinspectio... | [
"def",
"_write_nlu_to_file",
"(",
"export_nlu_path",
":",
"Text",
",",
"events",
":",
"List",
"[",
"Dict",
"[",
"Text",
",",
"Any",
"]",
"]",
")",
"->",
"None",
":",
"from",
"rasa",
".",
"shared",
".",
"nlu",
".",
"training_data",
".",
"training_data",
... | https://github.com/RasaHQ/rasa/blob/54823b68c1297849ba7ae841a4246193cd1223a1/rasa/core/training/interactive.py#L855-L882 | ||
optuna/optuna | 2c44c1a405ba059efd53f4b9c8e849d20fb95c0a | optuna/importance/_mean_decrease_impurity.py | python | MeanDecreaseImpurityImportanceEvaluator.__init__ | (
self, *, n_trees: int = 64, max_depth: int = 64, seed: Optional[int] = None
) | [] | def __init__(
self, *, n_trees: int = 64, max_depth: int = 64, seed: Optional[int] = None
) -> None:
_imports.check()
self._forest = RandomForestRegressor(
n_estimators=n_trees,
max_depth=max_depth,
min_samples_split=2,
min_samples_leaf=1,
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"n_trees",
":",
"int",
"=",
"64",
",",
"max_depth",
":",
"int",
"=",
"64",
",",
"seed",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"None",
":",
"_imports",
".",
"check",
"(",
")",
"s... | https://github.com/optuna/optuna/blob/2c44c1a405ba059efd53f4b9c8e849d20fb95c0a/optuna/importance/_mean_decrease_impurity.py#L43-L54 | ||||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/docutils/utils/math/math2html.py | python | TaggedText.complete | (self, contents, tag, breaklines=False) | return self | Complete the tagged text and return it | Complete the tagged text and return it | [
"Complete",
"the",
"tagged",
"text",
"and",
"return",
"it"
] | def complete(self, contents, tag, breaklines=False):
"Complete the tagged text and return it"
self.contents = contents
self.output.tag = tag
self.output.breaklines = breaklines
return self | [
"def",
"complete",
"(",
"self",
",",
"contents",
",",
"tag",
",",
"breaklines",
"=",
"False",
")",
":",
"self",
".",
"contents",
"=",
"contents",
"self",
".",
"output",
".",
"tag",
"=",
"tag",
"self",
".",
"output",
".",
"breaklines",
"=",
"breaklines"... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/docutils/utils/math/math2html.py#L2318-L2323 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3navigation.py | python | S3NavigationItem.index | (self, item) | return self.components.index(item) | Get the index of a component item within the component list
Args:
@param item: the item | Get the index of a component item within the component list | [
"Get",
"the",
"index",
"of",
"a",
"component",
"item",
"within",
"the",
"component",
"list"
] | def index(self, item):
"""
Get the index of a component item within the component list
Args:
@param item: the item
"""
return self.components.index(item) | [
"def",
"index",
"(",
"self",
",",
"item",
")",
":",
"return",
"self",
".",
"components",
".",
"index",
"(",
"item",
")"
] | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3navigation.py#L1250-L1258 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/site-packages/pkg_resources/_vendor/packaging/version.py | python | _parse_local_version | (local) | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). | [
"Takes",
"a",
"string",
"like",
"abc",
".",
"1",
".",
"twelve",
"and",
"turns",
"it",
"into",
"(",
"abc",
"1",
"twelve",
")",
"."
] | def _parse_local_version(local):
"""
Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
"""
if local is not None:
return tuple(
part.lower() if not part.isdigit() else int(part)
for part in _local_version_seperators.split(local)
) | [
"def",
"_parse_local_version",
"(",
"local",
")",
":",
"if",
"local",
"is",
"not",
"None",
":",
"return",
"tuple",
"(",
"part",
".",
"lower",
"(",
")",
"if",
"not",
"part",
".",
"isdigit",
"(",
")",
"else",
"int",
"(",
"part",
")",
"for",
"part",
"... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pkg_resources/_vendor/packaging/version.py#L332-L340 | ||
Bitmessage/PyBitmessage | 97612b049e0453867d6d90aa628f8e7b007b4d85 | src/network/bmproto.py | python | BMProto.state_bm_command | (self) | return True | Process incoming command | Process incoming command | [
"Process",
"incoming",
"command"
] | def state_bm_command(self): # pylint: disable=too-many-branches
"""Process incoming command"""
self.payload = self.read_buf[:self.payloadLength]
if self.checksum != hashlib.sha512(self.payload).digest()[0:4]:
logger.debug('Bad checksum, ignoring')
self.invalid = True
... | [
"def",
"state_bm_command",
"(",
"self",
")",
":",
"# pylint: disable=too-many-branches",
"self",
".",
"payload",
"=",
"self",
".",
"read_buf",
"[",
":",
"self",
".",
"payloadLength",
"]",
"if",
"self",
".",
"checksum",
"!=",
"hashlib",
".",
"sha512",
"(",
"s... | https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/network/bmproto.py#L106-L158 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/pipes.py | python | Template.clone | (self) | return t | t.clone() returns a new pipeline template with identical
initial state as the current one. | t.clone() returns a new pipeline template with identical
initial state as the current one. | [
"t",
".",
"clone",
"()",
"returns",
"a",
"new",
"pipeline",
"template",
"with",
"identical",
"initial",
"state",
"as",
"the",
"current",
"one",
"."
] | def clone(self):
"""t.clone() returns a new pipeline template with identical
initial state as the current one."""
t = Template()
t.steps = self.steps[:]
t.debugging = self.debugging
return t | [
"def",
"clone",
"(",
"self",
")",
":",
"t",
"=",
"Template",
"(",
")",
"t",
".",
"steps",
"=",
"self",
".",
"steps",
"[",
":",
"]",
"t",
".",
"debugging",
"=",
"self",
".",
"debugging",
"return",
"t"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/pipes.py#L96-L102 | |
airspeed-velocity/asv | 9d5af5713357ccea00a518758fae6822cc69f539 | asv/extern/asizeof.py | python | _isNULL | (obj) | return isinstance(obj, tuple) and len(obj) == 1 \
and repr(obj) == '(<NULL>,)' | Prevent asizeof(all=True, ...) crash.
Sizing gc.get_objects() crashes in Pythonista3 with
Python 3.5.1 on iOS due to 1-tuple (<Null>,) object,
see <http://forum.omz-software.com/user/mrjean1>. | Prevent asizeof(all=True, ...) crash. | [
"Prevent",
"asizeof",
"(",
"all",
"=",
"True",
"...",
")",
"crash",
"."
] | def _isNULL(obj):
'''Prevent asizeof(all=True, ...) crash.
Sizing gc.get_objects() crashes in Pythonista3 with
Python 3.5.1 on iOS due to 1-tuple (<Null>,) object,
see <http://forum.omz-software.com/user/mrjean1>.
'''
return isinstance(obj, tuple) and len(obj) == 1 \
... | [
"def",
"_isNULL",
"(",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"tuple",
")",
"and",
"len",
"(",
"obj",
")",
"==",
"1",
"and",
"repr",
"(",
"obj",
")",
"==",
"'(<NULL>,)'"
] | https://github.com/airspeed-velocity/asv/blob/9d5af5713357ccea00a518758fae6822cc69f539/asv/extern/asizeof.py#L499-L507 | |
modflowpy/flopy | eecd1ad193c5972093c9712e5c4b7a83284f0688 | flopy/utils/triangle.py | python | Triangle.build | (self, verbose=False) | return | Build the triangular mesh
Parameters
----------
verbose : bool
If true, print the results of the triangle command to the terminal
(default is False)
Returns
-------
None | Build the triangular mesh | [
"Build",
"the",
"triangular",
"mesh"
] | def build(self, verbose=False):
"""
Build the triangular mesh
Parameters
----------
verbose : bool
If true, print the results of the triangle command to the terminal
(default is False)
Returns
-------
None
"""
# ... | [
"def",
"build",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"# provide some protection by removing existing files",
"self",
".",
"clean",
"(",
")",
"# write the active domain to a file",
"fname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"m... | https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/utils/triangle.py#L135-L198 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/tkinter/__init__.py | python | Wm.wm_iconposition | (self, x=None, y=None) | return self._getints(self.tk.call(
'wm', 'iconposition', self._w, x, y)) | Set the position of the icon of this widget to X and Y. Return
a tuple of the current values of X and X if None is given. | Set the position of the icon of this widget to X and Y. Return
a tuple of the current values of X and X if None is given. | [
"Set",
"the",
"position",
"of",
"the",
"icon",
"of",
"this",
"widget",
"to",
"X",
"and",
"Y",
".",
"Return",
"a",
"tuple",
"of",
"the",
"current",
"values",
"of",
"X",
"and",
"X",
"if",
"None",
"is",
"given",
"."
] | def wm_iconposition(self, x=None, y=None):
"""Set the position of the icon of this widget to X and Y. Return
a tuple of the current values of X and X if None is given."""
return self._getints(self.tk.call(
'wm', 'iconposition', self._w, x, y)) | [
"def",
"wm_iconposition",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
")",
":",
"return",
"self",
".",
"_getints",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'wm'",
",",
"'iconposition'",
",",
"self",
".",
"_w",
",",
"x",
",",
"y",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/tkinter/__init__.py#L1912-L1916 | |
byt3bl33d3r/pth-toolkit | 3641cdc76c0f52275315c9b18bf08b22521bd4d7 | lib/python2.7/site-packages/samba/provision/sambadns.py | python | setup_ad_dns | (samdb, secretsdb, domainsid, names, paths, lp, logger,
dns_backend, os_level, site, dnspass=None, hostip=None, hostip6=None,
targetdir=None) | Provision DNS information (assuming GC role)
:param samdb: LDB object connected to sam.ldb file
:param secretsdb: LDB object connected to secrets.ldb file
:param domainsid: Domain SID (as dom_sid object)
:param names: Names shortcut
:param paths: Paths shortcut
:param lp: Loadparm object
:p... | Provision DNS information (assuming GC role) | [
"Provision",
"DNS",
"information",
"(",
"assuming",
"GC",
"role",
")"
] | def setup_ad_dns(samdb, secretsdb, domainsid, names, paths, lp, logger,
dns_backend, os_level, site, dnspass=None, hostip=None, hostip6=None,
targetdir=None):
"""Provision DNS information (assuming GC role)
:param samdb: LDB object connected to sam.ldb file
:param secretsdb: LDB object conn... | [
"def",
"setup_ad_dns",
"(",
"samdb",
",",
"secretsdb",
",",
"domainsid",
",",
"names",
",",
"paths",
",",
"lp",
",",
"logger",
",",
"dns_backend",
",",
"os_level",
",",
"site",
",",
"dnspass",
"=",
"None",
",",
"hostip",
"=",
"None",
",",
"hostip6",
"=... | https://github.com/byt3bl33d3r/pth-toolkit/blob/3641cdc76c0f52275315c9b18bf08b22521bd4d7/lib/python2.7/site-packages/samba/provision/sambadns.py#L1001-L1089 | ||
pika/pika | 12dcdf15d0932c388790e0fa990810bfd21b1a32 | pika/adapters/base_connection.py | python | BaseConnection._handle_connection_workflow_failure | (self, error) | Handle failure of self-initiated stack bring-up and call
`Connection._on_stream_terminated()` if connection is not in closed state
yet. Called by adapter layer when the full-stack connection workflow
fails.
:param Exception | None error: exception instance describing the reason
... | Handle failure of self-initiated stack bring-up and call
`Connection._on_stream_terminated()` if connection is not in closed state
yet. Called by adapter layer when the full-stack connection workflow
fails. | [
"Handle",
"failure",
"of",
"self",
"-",
"initiated",
"stack",
"bring",
"-",
"up",
"and",
"call",
"Connection",
".",
"_on_stream_terminated",
"()",
"if",
"connection",
"is",
"not",
"in",
"closed",
"state",
"yet",
".",
"Called",
"by",
"adapter",
"layer",
"when... | def _handle_connection_workflow_failure(self, error):
"""Handle failure of self-initiated stack bring-up and call
`Connection._on_stream_terminated()` if connection is not in closed state
yet. Called by adapter layer when the full-stack connection workflow
fails.
:param Exceptio... | [
"def",
"_handle_connection_workflow_failure",
"(",
"self",
",",
"error",
")",
":",
"if",
"error",
"is",
"None",
":",
"LOGGER",
".",
"info",
"(",
"'Self-initiated stack bring-up aborted.'",
")",
"else",
":",
"LOGGER",
".",
"error",
"(",
"'Self-initiated stack bring-u... | https://github.com/pika/pika/blob/12dcdf15d0932c388790e0fa990810bfd21b1a32/pika/adapters/base_connection.py#L345-L365 | ||
PttCodingMan/PyPtt | 07037ccc31116d0699285d9d00f61d9288a608b7 | PyPtt/_api_loginout.py | python | logout | (api) | [] | def logout(api) -> None:
cmd_list = list()
cmd_list.append(command.GoMainMenu)
cmd_list.append('g')
cmd_list.append(command.Enter)
cmd_list.append('y')
cmd_list.append(command.Enter)
cmd = ''.join(cmd_list)
target_list = [
connect_core.TargetUnit(
[
... | [
"def",
"logout",
"(",
"api",
")",
"->",
"None",
":",
"cmd_list",
"=",
"list",
"(",
")",
"cmd_list",
".",
"append",
"(",
"command",
".",
"GoMainMenu",
")",
"cmd_list",
".",
"append",
"(",
"'g'",
")",
"cmd_list",
".",
"append",
"(",
"command",
".",
"En... | https://github.com/PttCodingMan/PyPtt/blob/07037ccc31116d0699285d9d00f61d9288a608b7/PyPtt/_api_loginout.py#L23-L65 | ||||
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | qa/qa_cluster.py | python | TestDelay | (node) | gnt-debug delay | gnt-debug delay | [
"gnt",
"-",
"debug",
"delay"
] | def TestDelay(node):
"""gnt-debug delay"""
AssertCommand(["gnt-debug", "delay", "1"])
AssertCommand(["gnt-debug", "delay", "--no-master", "1"])
AssertCommand(["gnt-debug", "delay", "--no-master",
"-n", node.primary, "1"]) | [
"def",
"TestDelay",
"(",
"node",
")",
":",
"AssertCommand",
"(",
"[",
"\"gnt-debug\"",
",",
"\"delay\"",
",",
"\"1\"",
"]",
")",
"AssertCommand",
"(",
"[",
"\"gnt-debug\"",
",",
"\"delay\"",
",",
"\"--no-master\"",
",",
"\"1\"",
"]",
")",
"AssertCommand",
"(... | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/qa/qa_cluster.py#L521-L526 | ||
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/common/container_sync_realms.py | python | ContainerSyncRealms.reload | (self) | Forces a reload of the conf file. | Forces a reload of the conf file. | [
"Forces",
"a",
"reload",
"of",
"the",
"conf",
"file",
"."
] | def reload(self):
"""Forces a reload of the conf file."""
self.next_mtime_check = 0
self.conf_path_mtime = 0
self._reload() | [
"def",
"reload",
"(",
"self",
")",
":",
"self",
".",
"next_mtime_check",
"=",
"0",
"self",
".",
"conf_path_mtime",
"=",
"0",
"self",
".",
"_reload",
"(",
")"
] | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/common/container_sync_realms.py#L44-L48 | ||
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | rope/base/builtins.py | python | BuiltinName.get_definition_location | (self) | return (None, None) | [] | def get_definition_location(self):
return (None, None) | [
"def",
"get_definition_location",
"(",
"self",
")",
":",
"return",
"(",
"None",
",",
"None",
")"
] | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/base/builtins.py#L529-L530 | |||
shuup/shuup | 25f78cfe370109b9885b903e503faac295c7b7f2 | shuup/core/taxing/_module.py | python | TaxModule.add_taxes | (self, source, lines) | Add taxes to given OrderSource lines.
Given lines are modified in-place, also new lines may be added
(with ``lines.extend`` for example). If there is any existing
taxes for the `lines`, they are simply replaced.
:type source: shuup.core.order_creator.OrderSource
:param source:... | Add taxes to given OrderSource lines. | [
"Add",
"taxes",
"to",
"given",
"OrderSource",
"lines",
"."
] | def add_taxes(self, source, lines):
"""
Add taxes to given OrderSource lines.
Given lines are modified in-place, also new lines may be added
(with ``lines.extend`` for example). If there is any existing
taxes for the `lines`, they are simply replaced.
:type source: shu... | [
"def",
"add_taxes",
"(",
"self",
",",
"source",
",",
"lines",
")",
":",
"context",
"=",
"self",
".",
"get_context_from_order_source",
"(",
"source",
")",
"lines_without_tax_class",
"=",
"[",
"]",
"taxed_lines",
"=",
"[",
"]",
"for",
"(",
"idx",
",",
"line"... | https://github.com/shuup/shuup/blob/25f78cfe370109b9885b903e503faac295c7b7f2/shuup/core/taxing/_module.py#L111-L140 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_serviceaccount_secret.py | python | OCServiceAccountSecret.__init__ | (self, config, verbose=False) | Constructor for OpenshiftOC | Constructor for OpenshiftOC | [
"Constructor",
"for",
"OpenshiftOC"
] | def __init__(self, config, verbose=False):
''' Constructor for OpenshiftOC '''
super(OCServiceAccountSecret, self).__init__(config.namespace, kubeconfig=config.kubeconfig, verbose=verbose)
self.config = config
self.verbose = verbose
self._service_account = None | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"verbose",
"=",
"False",
")",
":",
"super",
"(",
"OCServiceAccountSecret",
",",
"self",
")",
".",
"__init__",
"(",
"config",
".",
"namespace",
",",
"kubeconfig",
"=",
"config",
".",
"kubeconfig",
",",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_serviceaccount_secret.py#L1592-L1597 | ||
AntixK/PyTorch-VAE | a6896b944c918dd7030e7d795a8c13e5c6345ec7 | models/dip_vae.py | python | DIPVAE.sample | (self,
num_samples:int,
current_device: int, **kwargs) | return samples | Samples from the latent space and return the corresponding
image space map.
:param num_samples: (Int) Number of samples
:param current_device: (Int) Device to run the model
:return: (Tensor) | Samples from the latent space and return the corresponding
image space map.
:param num_samples: (Int) Number of samples
:param current_device: (Int) Device to run the model
:return: (Tensor) | [
"Samples",
"from",
"the",
"latent",
"space",
"and",
"return",
"the",
"corresponding",
"image",
"space",
"map",
".",
":",
"param",
"num_samples",
":",
"(",
"Int",
")",
"Number",
"of",
"samples",
":",
"param",
"current_device",
":",
"(",
"Int",
")",
"Device"... | def sample(self,
num_samples:int,
current_device: int, **kwargs) -> Tensor:
"""
Samples from the latent space and return the corresponding
image space map.
:param num_samples: (Int) Number of samples
:param current_device: (Int) Device to run the mod... | [
"def",
"sample",
"(",
"self",
",",
"num_samples",
":",
"int",
",",
"current_device",
":",
"int",
",",
"*",
"*",
"kwargs",
")",
"->",
"Tensor",
":",
"z",
"=",
"torch",
".",
"randn",
"(",
"num_samples",
",",
"self",
".",
"latent_dim",
")",
"z",
"=",
... | https://github.com/AntixK/PyTorch-VAE/blob/a6896b944c918dd7030e7d795a8c13e5c6345ec7/models/dip_vae.py#L166-L182 | |
modin-project/modin | 0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee | modin/core/execution/ray/generic/partitioning/partition_manager.py | python | GenericRayDataframePartitionManager.to_numpy | (cls, partitions, **kwargs) | return arr | Convert `partitions` into a NumPy array.
Parameters
----------
partitions : NumPy array
A 2-D array of partitions to convert to local NumPy array.
**kwargs : dict
Keyword arguments to pass to each partition ``.to_numpy()`` call.
Returns
-------
... | Convert `partitions` into a NumPy array. | [
"Convert",
"partitions",
"into",
"a",
"NumPy",
"array",
"."
] | def to_numpy(cls, partitions, **kwargs):
"""
Convert `partitions` into a NumPy array.
Parameters
----------
partitions : NumPy array
A 2-D array of partitions to convert to local NumPy array.
**kwargs : dict
Keyword arguments to pass to each parti... | [
"def",
"to_numpy",
"(",
"cls",
",",
"partitions",
",",
"*",
"*",
"kwargs",
")",
":",
"parts",
"=",
"ray",
".",
"get",
"(",
"[",
"obj",
".",
"apply",
"(",
"lambda",
"df",
",",
"*",
"*",
"kwargs",
":",
"df",
".",
"to_numpy",
"(",
"*",
"*",
"kwarg... | https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/core/execution/ray/generic/partitioning/partition_manager.py#L29-L55 | |
uber-archive/focuson | 6035be631853df16f434372194f5619c9c4e5322 | focuson.py | python | Engine.gen_module_name | (self, python_filename) | return module_name | Given a filename return the module it constitutes | Given a filename return the module it constitutes | [
"Given",
"a",
"filename",
"return",
"the",
"module",
"it",
"constitutes"
] | def gen_module_name(self, python_filename):
""" Given a filename return the module it constitutes
"""
# Base dir is relevant because the directory structure determines the modulenames
base_dir = self.__target_dir
# Determine modulename based on file path and make it module-y
... | [
"def",
"gen_module_name",
"(",
"self",
",",
"python_filename",
")",
":",
"# Base dir is relevant because the directory structure determines the modulenames",
"base_dir",
"=",
"self",
".",
"__target_dir",
"# Determine modulename based on file path and make it module-y",
"subfn",
"=",
... | https://github.com/uber-archive/focuson/blob/6035be631853df16f434372194f5619c9c4e5322/focuson.py#L1280-L1296 | |
LagoLunatic/wwrando | 33164143eb9f51c3015be3e31402a79dfcebacfd | wwlib/jpc.py | python | JPC.save_changes | (self) | [] | def save_changes(self):
self.num_particles = len(self.particles)
self.num_textures = len(self.textures)
write_magic_str(self.data, 0, self.magic, 8)
write_u16(self.data, 8, self.num_particles)
write_u16(self.data, 0xA, self.num_textures)
# Cut off the particle list and texture list since we... | [
"def",
"save_changes",
"(",
"self",
")",
":",
"self",
".",
"num_particles",
"=",
"len",
"(",
"self",
".",
"particles",
")",
"self",
".",
"num_textures",
"=",
"len",
"(",
"self",
".",
"textures",
")",
"write_magic_str",
"(",
"self",
".",
"data",
",",
"0... | https://github.com/LagoLunatic/wwrando/blob/33164143eb9f51c3015be3e31402a79dfcebacfd/wwlib/jpc.py#L161-L191 | ||||
VITA-Group/FasterSeg | 478b0265eb9ab626cfbe503ad16d2452878b38cc | search/model_search.py | python | Network_Multi_Path._loss | (self, input, target, pretrain=False) | return loss | [] | def _loss(self, input, target, pretrain=False):
loss = 0
if pretrain is not True:
# "random width": sampled by gambel softmax
self.prun_mode = None
for idx in range(len(self._arch_names)):
self.arch_idx = idx
logits = self(input)
... | [
"def",
"_loss",
"(",
"self",
",",
"input",
",",
"target",
",",
"pretrain",
"=",
"False",
")",
":",
"loss",
"=",
"0",
"if",
"pretrain",
"is",
"not",
"True",
":",
"# \"random width\": sampled by gambel softmax",
"self",
".",
"prun_mode",
"=",
"None",
"for",
... | https://github.com/VITA-Group/FasterSeg/blob/478b0265eb9ab626cfbe503ad16d2452878b38cc/search/model_search.py#L478-L505 | |||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_config_map_list.py | python | V1ConfigMapList.kind | (self, kind) | Sets the kind of this V1ConfigMapList.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventi... | Sets the kind of this V1ConfigMapList. | [
"Sets",
"the",
"kind",
"of",
"this",
"V1ConfigMapList",
"."
] | def kind(self, kind):
"""Sets the kind of this V1ConfigMapList.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/de... | [
"def",
"kind",
"(",
"self",
",",
"kind",
")",
":",
"self",
".",
"_kind",
"=",
"kind"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_config_map_list.py#L129-L138 | ||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/delicious/alp/request/requests_cache/core.py | python | redo_patch | () | Redo ``requests`` monkey patch | Redo ``requests`` monkey patch | [
"Redo",
"requests",
"monkey",
"patch"
] | def redo_patch():
""" Redo ``requests`` monkey patch
"""
Request.send = _request_send_hook | [
"def",
"redo_patch",
"(",
")",
":",
"Request",
".",
"send",
"=",
"_request_send_hook"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/delicious/alp/request/requests_cache/core.py#L118-L121 | ||
catalyst-team/catalyst | 678dc06eda1848242df010b7f34adb572def2598 | examples/self_supervised/common.py | python | get_contrastive_model | (
in_size: int, in_channels: int, feature_dim: int, encoder_dim: int = 512, hidden_dim: int = 512
) | return model | Init contrastive model based on parsed parametrs.
Args:
in_size: size of an image (in_size x in_size)
in_channels: number of channels in an image
feature_dim: dimensinality of contrative projection
encoder_dim: dimensinality of encoder output
hidden_dim: dimensinality of enc... | Init contrastive model based on parsed parametrs. | [
"Init",
"contrastive",
"model",
"based",
"on",
"parsed",
"parametrs",
"."
] | def get_contrastive_model(
in_size: int, in_channels: int, feature_dim: int, encoder_dim: int = 512, hidden_dim: int = 512
) -> ContrastiveModel:
"""Init contrastive model based on parsed parametrs.
Args:
in_size: size of an image (in_size x in_size)
in_channels: number of channels in an im... | [
"def",
"get_contrastive_model",
"(",
"in_size",
":",
"int",
",",
"in_channels",
":",
"int",
",",
"feature_dim",
":",
"int",
",",
"encoder_dim",
":",
"int",
"=",
"512",
",",
"hidden_dim",
":",
"int",
"=",
"512",
")",
"->",
"ContrastiveModel",
":",
"try",
... | https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/examples/self_supervised/common.py#L172-L197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.