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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/autoscaling/v20180419/models.py | python | DescribeLaunchConfigurationsResponse.__init__ | (self) | r"""
:param TotalCount: 符合条件的启动配置数量。
:type TotalCount: int
:param LaunchConfigurationSet: 启动配置详细信息列表。
:type LaunchConfigurationSet: list of LaunchConfiguration
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param TotalCount: 符合条件的启动配置数量。
:type TotalCount: int
:param LaunchConfigurationSet: 启动配置详细信息列表。
:type LaunchConfigurationSet: list of LaunchConfiguration
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"TotalCount",
":",
"符合条件的启动配置数量。",
":",
"type",
"TotalCount",
":",
"int",
":",
"param",
"LaunchConfigurationSet",
":",
"启动配置详细信息列表。",
":",
"type",
"LaunchConfigurationSet",
":",
"list",
"of",
"LaunchConfiguration",
":",
"param",
"RequestId",
":"... | def __init__(self):
r"""
:param TotalCount: 符合条件的启动配置数量。
:type TotalCount: int
:param LaunchConfigurationSet: 启动配置详细信息列表。
:type LaunchConfigurationSet: list of LaunchConfiguration
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"TotalCount",
"=",
"None",
"self",
".",
"LaunchConfigurationSet",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/autoscaling/v20180419/models.py#L2085-L2096 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/logutils/__init__.py | python | NullHandler.emit | (self, record) | Emit a record. This does nothing and shouldn't be called during normal
processing, unless you redefine :meth:`~logutils.NullHandler.handle`. | Emit a record. This does nothing and shouldn't be called during normal
processing, unless you redefine :meth:`~logutils.NullHandler.handle`. | [
"Emit",
"a",
"record",
".",
"This",
"does",
"nothing",
"and",
"shouldn",
"t",
"be",
"called",
"during",
"normal",
"processing",
"unless",
"you",
"redefine",
":",
"meth",
":",
"~logutils",
".",
"NullHandler",
".",
"handle",
"."
] | def emit(self, record):
"""
Emit a record. This does nothing and shouldn't be called during normal
processing, unless you redefine :meth:`~logutils.NullHandler.handle`.
"""
pass | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"pass"
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/logutils/__init__.py#L37-L42 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/authorization/auth_manager.py | python | AuthorizationManager.CheckPermissions | (self, username, subject) | Checks if a given user has access to a given subject. | Checks if a given user has access to a given subject. | [
"Checks",
"if",
"a",
"given",
"user",
"has",
"access",
"to",
"a",
"given",
"subject",
"."
] | def CheckPermissions(self, username, subject):
"""Checks if a given user has access to a given subject."""
if subject in self.authorized_users:
return ((username in self.authorized_users[subject]) or
self.group_access_manager.MemberOfAuthorizedGroup(
username, subject))
... | [
"def",
"CheckPermissions",
"(",
"self",
",",
"username",
",",
"subject",
")",
":",
"if",
"subject",
"in",
"self",
".",
"authorized_users",
":",
"return",
"(",
"(",
"username",
"in",
"self",
".",
"authorized_users",
"[",
"subject",
"]",
")",
"or",
"self",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/authorization/auth_manager.py#L101-L112 | ||
xmengli/H-DenseUNet | 06cc436a43196310fe933d114a353839907cc176 | Keras-2.0.8/keras/backend/tensorflow_backend.py | python | manual_variable_initialization | (value) | Sets the manual variable initialization flag.
This boolean flag determines whether
variables should be initialized
as they are instantiated (default), or if
the user should handle the initialization
(e.g. via `tf.initialize_all_variables()`).
# Arguments
value: Python boolean. | Sets the manual variable initialization flag. | [
"Sets",
"the",
"manual",
"variable",
"initialization",
"flag",
"."
] | def manual_variable_initialization(value):
"""Sets the manual variable initialization flag.
This boolean flag determines whether
variables should be initialized
as they are instantiated (default), or if
the user should handle the initialization
(e.g. via `tf.initialize_all_variables()`).
#... | [
"def",
"manual_variable_initialization",
"(",
"value",
")",
":",
"global",
"_MANUAL_VAR_INIT",
"_MANUAL_VAR_INIT",
"=",
"value"
] | https://github.com/xmengli/H-DenseUNet/blob/06cc436a43196310fe933d114a353839907cc176/Keras-2.0.8/keras/backend/tensorflow_backend.py#L86-L99 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/future/backports/datetime.py | python | date._getstate | (self) | return bytes([yhi, ylo, self._month, self._day]), | [] | def _getstate(self):
yhi, ylo = divmod(self._year, 256)
return bytes([yhi, ylo, self._month, self._day]), | [
"def",
"_getstate",
"(",
"self",
")",
":",
"yhi",
",",
"ylo",
"=",
"divmod",
"(",
"self",
".",
"_year",
",",
"256",
")",
"return",
"bytes",
"(",
"[",
"yhi",
",",
"ylo",
",",
"self",
".",
"_month",
",",
"self",
".",
"_day",
"]",
")",
","
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/backports/datetime.py#L900-L902 | |||
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/future/src/future/backports/email/_policybase.py | python | Policy.header_store_parse | (self, name, value) | Given the header name and the value provided by the application
program, return the (name, value) that should be stored in the model. | Given the header name and the value provided by the application
program, return the (name, value) that should be stored in the model. | [
"Given",
"the",
"header",
"name",
"and",
"the",
"value",
"provided",
"by",
"the",
"application",
"program",
"return",
"the",
"(",
"name",
"value",
")",
"that",
"should",
"be",
"stored",
"in",
"the",
"model",
"."
] | def header_store_parse(self, name, value):
"""Given the header name and the value provided by the application
program, return the (name, value) that should be stored in the model.
"""
raise NotImplementedError | [
"def",
"header_store_parse",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/future/src/future/backports/email/_policybase.py#L228-L232 | ||
ahkab/ahkab | 1e8939194b689909b8184ce7eba478b485ff9e3a | ahkab/ekv.py | python | ekv_mos_model.print_model | (self) | All the internal parameters of the model get printed out,
for visual inspection. Notice some can be set to None
(ie not available) if they were not provided in the netlist
or some not provided are calculated from the others. | All the internal parameters of the model get printed out,
for visual inspection. Notice some can be set to None
(ie not available) if they were not provided in the netlist
or some not provided are calculated from the others. | [
"All",
"the",
"internal",
"parameters",
"of",
"the",
"model",
"get",
"printed",
"out",
"for",
"visual",
"inspection",
".",
"Notice",
"some",
"can",
"be",
"set",
"to",
"None",
"(",
"ie",
"not",
"available",
")",
"if",
"they",
"were",
"not",
"provided",
"i... | def print_model(self):
"""All the internal parameters of the model get printed out,
for visual inspection. Notice some can be set to None
(ie not available) if they were not provided in the netlist
or some not provided are calculated from the others.
"""
arr = []
... | [
"def",
"print_model",
"(",
"self",
")",
":",
"arr",
"=",
"[",
"]",
"TYPE",
"=",
"'N'",
"if",
"self",
".",
"NPMOS",
"==",
"1",
"else",
"\"P\"",
"arr",
".",
"append",
"(",
"[",
"self",
".",
"name",
",",
"\"\"",
",",
"\"\"",
",",
"TYPE",
"+",
"\" ... | https://github.com/ahkab/ahkab/blob/1e8939194b689909b8184ce7eba478b485ff9e3a/ahkab/ekv.py#L461-L479 | ||
OfflineIMAP/imapfw | 740a4fed1a1de28e4134a115a1dd9c6e90e29ec1 | imapfw/imap/imaplib3/imaplib2.py | python | IMAP4.send | (self, data) | send(data)
Send 'data' to remote. | send(data)
Send 'data' to remote. | [
"send",
"(",
"data",
")",
"Send",
"data",
"to",
"remote",
"."
] | def send(self, data):
"""send(data)
Send 'data' to remote."""
if self.compressor is not None:
data = self.compressor.compress(data)
data += self.compressor.flush(zlib.Z_SYNC_FLUSH)
self.sock.sendall(data) | [
"def",
"send",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"compressor",
"is",
"not",
"None",
":",
"data",
"=",
"self",
".",
"compressor",
".",
"compress",
"(",
"data",
")",
"data",
"+=",
"self",
".",
"compressor",
".",
"flush",
"(",
"zl... | https://github.com/OfflineIMAP/imapfw/blob/740a4fed1a1de28e4134a115a1dd9c6e90e29ec1/imapfw/imap/imaplib3/imaplib2.py#L512-L520 | ||
astropy/astroquery | 11c9c83fa8e5f948822f8f73c854ec4b72043016 | astroquery/esa/xmm_newton/core.py | python | XMMNewtonClass.get_epic_spectra | (self, filename, source_number, *,
instrument=[], path="", verbose=False) | return ret | Extracts in path (when set) the EPIC sources spectral products from a
given TAR file.
This function extracts the EPIC sources spectral products in a given
instrument (or instruments) from it
The result is a dictionary containing the paths to the extracted EPIC
sources spectral p... | Extracts in path (when set) the EPIC sources spectral products from a
given TAR file. | [
"Extracts",
"in",
"path",
"(",
"when",
"set",
")",
"the",
"EPIC",
"sources",
"spectral",
"products",
"from",
"a",
"given",
"TAR",
"file",
"."
] | def get_epic_spectra(self, filename, source_number, *,
instrument=[], path="", verbose=False):
"""Extracts in path (when set) the EPIC sources spectral products from a
given TAR file.
This function extracts the EPIC sources spectral products in a given
instrumen... | [
"def",
"get_epic_spectra",
"(",
"self",
",",
"filename",
",",
"source_number",
",",
"*",
",",
"instrument",
"=",
"[",
"]",
",",
"path",
"=",
"\"\"",
",",
"verbose",
"=",
"False",
")",
":",
"_instrument",
"=",
"[",
"\"M1\"",
",",
"\"M2\"",
",",
"\"PN\""... | https://github.com/astropy/astroquery/blob/11c9c83fa8e5f948822f8f73c854ec4b72043016/astroquery/esa/xmm_newton/core.py#L312-L435 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/computing/eggroll/_table.py | python | Table.mapPartitions | (self, func, use_previous_behavior=True, preserves_partitioning=False, **kwargs) | return Table(self._rp.map_partitions(func, options={"shuffle": not preserves_partitioning})) | [] | def mapPartitions(self, func, use_previous_behavior=True, preserves_partitioning=False, **kwargs):
if use_previous_behavior is True:
LOGGER.warning(f"please use `applyPartitions` instead of `mapPartitions` "
f"if the previous behavior was expected. "
... | [
"def",
"mapPartitions",
"(",
"self",
",",
"func",
",",
"use_previous_behavior",
"=",
"True",
",",
"preserves_partitioning",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"use_previous_behavior",
"is",
"True",
":",
"LOGGER",
".",
"warning",
"(",
"f\"... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/computing/eggroll/_table.py#L91-L98 | |||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/lib-tk/Tkinter.py | python | Misc.winfo_class | (self) | return self.tk.call('winfo', 'class', self._w) | Return window class name of this widget. | Return window class name of this widget. | [
"Return",
"window",
"class",
"name",
"of",
"this",
"widget",
"."
] | def winfo_class(self):
"""Return window class name of this widget."""
return self.tk.call('winfo', 'class', self._w) | [
"def",
"winfo_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'class'",
",",
"self",
".",
"_w",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/Tkinter.py#L699-L701 | |
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/pyqode/core/api/client.py | python | BackendProcess._on_process_stdout_ready | (self) | Logs process output | Logs process output | [
"Logs",
"process",
"output"
] | def _on_process_stdout_ready(self):
""" Logs process output """
if not self:
return
o = self.readAllStandardOutput()
try:
output = bytes(o).decode(self._encoding)
except TypeError:
output = bytes(o.data()).decode(self._encoding)
for lin... | [
"def",
"_on_process_stdout_ready",
"(",
"self",
")",
":",
"if",
"not",
"self",
":",
"return",
"o",
"=",
"self",
".",
"readAllStandardOutput",
"(",
")",
"try",
":",
"output",
"=",
"bytes",
"(",
"o",
")",
".",
"decode",
"(",
"self",
".",
"_encoding",
")"... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/api/client.py#L387-L397 | ||
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/spack/installer.py | python | PackageInstaller._update_failed | (self, task, mark=False, exc=None) | Update the task and transitive dependents as failed; optionally mark
externally as failed; and remove associated build tasks.
Args:
task (BuildTask): the build task for the failed package
mark (bool): ``True`` if the package and its dependencies are to
be marked ... | Update the task and transitive dependents as failed; optionally mark
externally as failed; and remove associated build tasks. | [
"Update",
"the",
"task",
"and",
"transitive",
"dependents",
"as",
"failed",
";",
"optionally",
"mark",
"externally",
"as",
"failed",
";",
"and",
"remove",
"associated",
"build",
"tasks",
"."
] | def _update_failed(self, task, mark=False, exc=None):
"""
Update the task and transitive dependents as failed; optionally mark
externally as failed; and remove associated build tasks.
Args:
task (BuildTask): the build task for the failed package
mark (bool): ``Tr... | [
"def",
"_update_failed",
"(",
"self",
",",
"task",
",",
"mark",
"=",
"False",
",",
"exc",
"=",
"None",
")",
":",
"pkg_id",
"=",
"task",
".",
"pkg_id",
"err",
"=",
"''",
"if",
"exc",
"is",
"None",
"else",
"': {0}'",
".",
"format",
"(",
"str",
"(",
... | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/installer.py#L1356-L1387 | ||
hildogjr/KiCost | 227f246d8c0f5dab145390d15c94ee2c3d6c790c | kicost/distributors/api_octopart.py | python | api_octopart.set_options | (key, level) | [] | def set_options(key, level):
if key:
if key.lower() == 'none':
api_octopart.enabled = False
else:
api_octopart.API_KEY = key
api_octopart.enabled = True
# Register our distributors
api_octopart.init_dist_dict... | [
"def",
"set_options",
"(",
"key",
",",
"level",
")",
":",
"if",
"key",
":",
"if",
"key",
".",
"lower",
"(",
")",
"==",
"'none'",
":",
"api_octopart",
".",
"enabled",
"=",
"False",
"else",
":",
"api_octopart",
".",
"API_KEY",
"=",
"key",
"api_octopart",... | https://github.com/hildogjr/KiCost/blob/227f246d8c0f5dab145390d15c94ee2c3d6c790c/kicost/distributors/api_octopart.py#L82-L99 | ||||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/PIL/SpiderImagePlugin.py | python | isInt | (f) | [] | def isInt(f):
try:
i = int(f)
if f - i == 0:
return 1
else:
return 0
except (ValueError, OverflowError):
return 0 | [
"def",
"isInt",
"(",
"f",
")",
":",
"try",
":",
"i",
"=",
"int",
"(",
"f",
")",
"if",
"f",
"-",
"i",
"==",
"0",
":",
"return",
"1",
"else",
":",
"return",
"0",
"except",
"(",
"ValueError",
",",
"OverflowError",
")",
":",
"return",
"0"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/SpiderImagePlugin.py#L42-L50 | ||||
sdispater/orator | 0666e522be914db285b6936e3c36801fc1a9c2e7 | orator/schema/builder.py | python | SchemaBuilder.get_column_listing | (self, table) | return self._connection.get_post_processor().process_column_listing(results) | Get the column listing for a given table.
:param table: The table
:type table: str
:rtype: list | Get the column listing for a given table. | [
"Get",
"the",
"column",
"listing",
"for",
"a",
"given",
"table",
"."
] | def get_column_listing(self, table):
"""
Get the column listing for a given table.
:param table: The table
:type table: str
:rtype: list
"""
table = self._connection.get_table_prefix() + table
results = self._connection.select(self._grammar.compile_colu... | [
"def",
"get_column_listing",
"(",
"self",
",",
"table",
")",
":",
"table",
"=",
"self",
".",
"_connection",
".",
"get_table_prefix",
"(",
")",
"+",
"table",
"results",
"=",
"self",
".",
"_connection",
".",
"select",
"(",
"self",
".",
"_grammar",
".",
"co... | https://github.com/sdispater/orator/blob/0666e522be914db285b6936e3c36801fc1a9c2e7/orator/schema/builder.py#L46-L59 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/analyze_plugins/analyze_utilities/tableau.py | python | getPluginsDirectoryPath | () | return archive.getAnalyzePluginsDirectoryPath('export_canvas_plugins') | Get the plugins directory path. | Get the plugins directory path. | [
"Get",
"the",
"plugins",
"directory",
"path",
"."
] | def getPluginsDirectoryPath():
'Get the plugins directory path.'
return archive.getAnalyzePluginsDirectoryPath('export_canvas_plugins') | [
"def",
"getPluginsDirectoryPath",
"(",
")",
":",
"return",
"archive",
".",
"getAnalyzePluginsDirectoryPath",
"(",
"'export_canvas_plugins'",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/analyze_plugins/analyze_utilities/tableau.py#L51-L53 | |
google/rekall | 55d1925f2df9759a989b35271b4fa48fc54a1c86 | rekall-core/rekall/plugins/response/forensic_artifacts.py | python | DirectoryBasedWriter.write_result | (self, result) | Writes the artifact result. | Writes the artifact result. | [
"Writes",
"the",
"artifact",
"result",
"."
] | def write_result(self, result):
"""Writes the artifact result."""
if self.copy_files and result.result_type == "file_information":
try:
self.write_file(result)
except (IOError, OSError) as e:
self.session.logging.warn("Unable to copy file: %s", e)
... | [
"def",
"write_result",
"(",
"self",
",",
"result",
")",
":",
"if",
"self",
".",
"copy_files",
"and",
"result",
".",
"result_type",
"==",
"\"file_information\"",
":",
"try",
":",
"self",
".",
"write_file",
"(",
"result",
")",
"except",
"(",
"IOError",
",",
... | https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/plugins/response/forensic_artifacts.py#L175-L201 | ||
moinwiki/moin | 568f223231aadecbd3b21a701ec02271f8d8021d | src/moin/items/__init__.py | python | Item.get_subitem_revs | (self) | return revs | Create a list of subitems of this item.
Subitems are in the form of storage Revisions.
trick: an item of empty name can be considered as "virtual root item"
that has all wiki items as sub items, but deleted items have empty names.
If item is trashed we must query name_old field to avo... | Create a list of subitems of this item. | [
"Create",
"a",
"list",
"of",
"subitems",
"of",
"this",
"item",
"."
] | def get_subitem_revs(self):
"""
Create a list of subitems of this item.
Subitems are in the form of storage Revisions.
trick: an item of empty name can be considered as "virtual root item"
that has all wiki items as sub items, but deleted items have empty names.
If ite... | [
"def",
"get_subitem_revs",
"(",
"self",
")",
":",
"query",
"=",
"And",
"(",
"[",
"Term",
"(",
"WIKINAME",
",",
"app",
".",
"cfg",
".",
"interwikiname",
")",
",",
"Term",
"(",
"NAMESPACE",
",",
"self",
".",
"fqname",
".",
"namespace",
")",
"]",
")",
... | https://github.com/moinwiki/moin/blob/568f223231aadecbd3b21a701ec02271f8d8021d/src/moin/items/__init__.py#L1000-L1019 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/tv/series.py | python | Series.get_all_possible_names | (self, season=-1) | return show_names.union(new_show_names) | Get every possible variation of the name for a particular show.
Includes indexer name, and any scene exception names, and country code
at the end of the name (e.g. "Show Name (AU)".
show: a Series object that we should get the names of
:returns: all possible show names | Get every possible variation of the name for a particular show. | [
"Get",
"every",
"possible",
"variation",
"of",
"the",
"name",
"for",
"a",
"particular",
"show",
"."
] | def get_all_possible_names(self, season=-1):
"""Get every possible variation of the name for a particular show.
Includes indexer name, and any scene exception names, and country code
at the end of the name (e.g. "Show Name (AU)".
show: a Series object that we should get the names of
... | [
"def",
"get_all_possible_names",
"(",
"self",
",",
"season",
"=",
"-",
"1",
")",
":",
"show_names",
"=",
"{",
"exception",
".",
"title",
"for",
"exception",
"in",
"get_scene_exceptions",
"(",
"self",
",",
"season",
")",
"}",
"show_names",
".",
"add",
"(",
... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/tv/series.py#L2453-L2490 | |
burke-software/schooldriver | a07262ba864aee0182548ecceb661e49c925725f | ecwsp/sis/management/commands/execute_sql.py | python | Command.load_sql_command_from_file | (self) | return sql_string | load the sql from the raw_sql_file.sql into a string | load the sql from the raw_sql_file.sql into a string | [
"load",
"the",
"sql",
"from",
"the",
"raw_sql_file",
".",
"sql",
"into",
"a",
"string"
] | def load_sql_command_from_file(self):
""" load the sql from the raw_sql_file.sql into a string """
this_folder = os.path.dirname(os.path.realpath(__file__))
output_file_path = this_folder + "/raw_sql_file.sql"
with open (output_file_path, "r") as myfile:
sql_string = myfile.r... | [
"def",
"load_sql_command_from_file",
"(",
"self",
")",
":",
"this_folder",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"output_file_path",
"=",
"this_folder",
"+",
"\"/raw_sql_file.sql\"",
"with",... | https://github.com/burke-software/schooldriver/blob/a07262ba864aee0182548ecceb661e49c925725f/ecwsp/sis/management/commands/execute_sql.py#L24-L30 | |
foremast/foremast | e8eb9bd24e975772532d90efa8a9ba1850e968cc | src/foremast/awslambda/cloudwatch_log_event/destroy_cloudwatch_log_event/destroy_cloudwatch_log_event.py | python | destroy_cloudwatch_log_event | (app='', env='dev', region='') | return True | Destroy Cloudwatch log event.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
bool: True upon successful completion. | Destroy Cloudwatch log event. | [
"Destroy",
"Cloudwatch",
"log",
"event",
"."
] | def destroy_cloudwatch_log_event(app='', env='dev', region=''):
"""Destroy Cloudwatch log event.
Args:
app (str): Spinnaker Application name.
env (str): Deployment environment.
region (str): AWS region.
Returns:
bool: True upon successful completion.
"""
session = b... | [
"def",
"destroy_cloudwatch_log_event",
"(",
"app",
"=",
"''",
",",
"env",
"=",
"'dev'",
",",
"region",
"=",
"''",
")",
":",
"session",
"=",
"boto3",
".",
"Session",
"(",
"profile_name",
"=",
"env",
",",
"region_name",
"=",
"region",
")",
"cloudwatch_client... | https://github.com/foremast/foremast/blob/e8eb9bd24e975772532d90efa8a9ba1850e968cc/src/foremast/awslambda/cloudwatch_log_event/destroy_cloudwatch_log_event/destroy_cloudwatch_log_event.py#L24-L42 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailcore/blocks/struct_block.py | python | BaseStructBlock.media | (self) | return forms.Media(js=[static('wagtailadmin/js/blocks/struct.js')]) | [] | def media(self):
return forms.Media(js=[static('wagtailadmin/js/blocks/struct.js')]) | [
"def",
"media",
"(",
"self",
")",
":",
"return",
"forms",
".",
"Media",
"(",
"js",
"=",
"[",
"static",
"(",
"'wagtailadmin/js/blocks/struct.js'",
")",
"]",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailcore/blocks/struct_block.py#L59-L60 | |||
bannsec/stegoVeritas | 678aa853b75b4a04f902c7f9fbea6ac30bf2af49 | stegoveritas/modules/image/png.py | python | topngbytes | (name, rows, x, y, **k) | return f.getvalue() | Convenience function for creating a PNG file "in memory" as a
string. Creates a :class:`Writer` instance using the keyword arguments,
then passes `rows` to its :meth:`Writer.write` method. The resulting
PNG file is returned as a string. `name` is used to identify the file for
debugging. | Convenience function for creating a PNG file "in memory" as a
string. Creates a :class:`Writer` instance using the keyword arguments,
then passes `rows` to its :meth:`Writer.write` method. The resulting
PNG file is returned as a string. `name` is used to identify the file for
debugging. | [
"Convenience",
"function",
"for",
"creating",
"a",
"PNG",
"file",
"in",
"memory",
"as",
"a",
"string",
".",
"Creates",
"a",
":",
"class",
":",
"Writer",
"instance",
"using",
"the",
"keyword",
"arguments",
"then",
"passes",
"rows",
"to",
"its",
":",
"meth",... | def topngbytes(name, rows, x, y, **k):
"""Convenience function for creating a PNG file "in memory" as a
string. Creates a :class:`Writer` instance using the keyword arguments,
then passes `rows` to its :meth:`Writer.write` method. The resulting
PNG file is returned as a string. `name` is used to iden... | [
"def",
"topngbytes",
"(",
"name",
",",
"rows",
",",
"x",
",",
"y",
",",
"*",
"*",
"k",
")",
":",
"import",
"os",
"print",
"(",
"name",
")",
"f",
"=",
"BytesIO",
"(",
")",
"w",
"=",
"Writer",
"(",
"x",
",",
"y",
",",
"*",
"*",
"k",
")",
"w... | https://github.com/bannsec/stegoVeritas/blob/678aa853b75b4a04f902c7f9fbea6ac30bf2af49/stegoveritas/modules/image/png.py#L2325-L2343 | |
QCoDeS/Qcodes | 3cda2cef44812e2aa4672781f2423bf5f816f9f9 | qcodes/instrument_drivers/rigol/DG1062.py | python | DG1062Channel._set_waveform_param | (self, param: str, value: float) | return self._set_waveform_params(**params_dict) | Set a particular waveform param to the given value. | Set a particular waveform param to the given value. | [
"Set",
"a",
"particular",
"waveform",
"param",
"to",
"the",
"given",
"value",
"."
] | def _set_waveform_param(self, param: str, value: float) -> None:
"""
Set a particular waveform param to the given value.
"""
params_dict = self._get_waveform_params()
if param in params_dict:
params_dict[param] = value
else:
log.warning(f"Warning,... | [
"def",
"_set_waveform_param",
"(",
"self",
",",
"param",
":",
"str",
",",
"value",
":",
"float",
")",
"->",
"None",
":",
"params_dict",
"=",
"self",
".",
"_get_waveform_params",
"(",
")",
"if",
"param",
"in",
"params_dict",
":",
"params_dict",
"[",
"param"... | https://github.com/QCoDeS/Qcodes/blob/3cda2cef44812e2aa4672781f2423bf5f816f9f9/qcodes/instrument_drivers/rigol/DG1062.py#L279-L292 | |
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/core/general.py | python | Attribute.lastPlugAttr | (self, longName=False) | return self.name(includeNode=False,
longName=longName,
fullAttrPath=False) | >>> from pymel.core import *
>>> at = SCENE.persp.t.tx
>>> at.lastPlugAttr(longName=False)
'tx'
>>> at.lastPlugAttr(longName=True)
'translateX'
Returns
-------
str | >>> from pymel.core import *
>>> at = SCENE.persp.t.tx
>>> at.lastPlugAttr(longName=False)
'tx'
>>> at.lastPlugAttr(longName=True)
'translateX' | [
">>>",
"from",
"pymel",
".",
"core",
"import",
"*",
">>>",
"at",
"=",
"SCENE",
".",
"persp",
".",
"t",
".",
"tx",
">>>",
"at",
".",
"lastPlugAttr",
"(",
"longName",
"=",
"False",
")",
"tx",
">>>",
"at",
".",
"lastPlugAttr",
"(",
"longName",
"=",
"T... | def lastPlugAttr(self, longName=False):
# type: (Any) -> str
"""
>>> from pymel.core import *
>>> at = SCENE.persp.t.tx
>>> at.lastPlugAttr(longName=False)
'tx'
>>> at.lastPlugAttr(longName=True)
'translateX'
Returns
... | [
"def",
"lastPlugAttr",
"(",
"self",
",",
"longName",
"=",
"False",
")",
":",
"# type: (Any) -> str",
"return",
"self",
".",
"name",
"(",
"includeNode",
"=",
"False",
",",
"longName",
"=",
"longName",
",",
"fullAttrPath",
"=",
"False",
")"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/core/general.py#L3463-L3479 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/internet/defer.py | python | Deferred.addBoth | (self, callback, *args, **kw) | return self.addCallbacks(callback, callback,
callbackArgs=args, errbackArgs=args,
callbackKeywords=kw, errbackKeywords=kw) | Convenience method for adding a single callable as both a callback
and an errback.
See L{addCallbacks}. | Convenience method for adding a single callable as both a callback
and an errback. | [
"Convenience",
"method",
"for",
"adding",
"a",
"single",
"callable",
"as",
"both",
"a",
"callback",
"and",
"an",
"errback",
"."
] | def addBoth(self, callback, *args, **kw):
"""
Convenience method for adding a single callable as both a callback
and an errback.
See L{addCallbacks}.
"""
return self.addCallbacks(callback, callback,
callbackArgs=args, errbackArgs=args,
... | [
"def",
"addBoth",
"(",
"self",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"addCallbacks",
"(",
"callback",
",",
"callback",
",",
"callbackArgs",
"=",
"args",
",",
"errbackArgs",
"=",
"args",
",",
"callbackK... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/defer.py#L311-L320 | |
cortex-lab/phy | 9a330b9437a3d0b40a37a201d147224e6e7fb462 | phy/plot/visuals.py | python | ScatterVisual.vertex_count | (self, x=None, y=None, pos=None, **kwargs) | return y.size if y is not None else len(pos) | Number of vertices for the requested data. | Number of vertices for the requested data. | [
"Number",
"of",
"vertices",
"for",
"the",
"requested",
"data",
"."
] | def vertex_count(self, x=None, y=None, pos=None, **kwargs):
"""Number of vertices for the requested data."""
return y.size if y is not None else len(pos) | [
"def",
"vertex_count",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"pos",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"y",
".",
"size",
"if",
"y",
"is",
"not",
"None",
"else",
"len",
"(",
"pos",
")"
] | https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/plot/visuals.py#L190-L192 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/dtypes/concat.py | python | _concat_compat | (to_concat, axis=0) | return np.concatenate(to_concat, axis=axis) | provide concatenation of an array of arrays each of which is a single
'normalized' dtypes (in that for example, if it's object, then it is a
non-datetimelike and provide a combined dtype for the resulting array that
preserves the overall dtype if possible)
Parameters
----------
to_concat : arra... | provide concatenation of an array of arrays each of which is a single
'normalized' dtypes (in that for example, if it's object, then it is a
non-datetimelike and provide a combined dtype for the resulting array that
preserves the overall dtype if possible) | [
"provide",
"concatenation",
"of",
"an",
"array",
"of",
"arrays",
"each",
"of",
"which",
"is",
"a",
"single",
"normalized",
"dtypes",
"(",
"in",
"that",
"for",
"example",
"if",
"it",
"s",
"object",
"then",
"it",
"is",
"a",
"non",
"-",
"datetimelike",
"and... | def _concat_compat(to_concat, axis=0):
"""
provide concatenation of an array of arrays each of which is a single
'normalized' dtypes (in that for example, if it's object, then it is a
non-datetimelike and provide a combined dtype for the resulting array that
preserves the overall dtype if possible)
... | [
"def",
"_concat_compat",
"(",
"to_concat",
",",
"axis",
"=",
"0",
")",
":",
"# filter empty arrays",
"# 1-d dtypes always are included here",
"def",
"is_nonempty",
"(",
"x",
")",
":",
"try",
":",
"return",
"x",
".",
"shape",
"[",
"axis",
"]",
">",
"0",
"exce... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/dtypes/concat.py#L101-L170 | |
Ultimaker/Uranium | 66da853cd9a04edd3a8a03526fac81e83c03f5aa | UM/SortedList.py | python | SortedList._islice | (self, min_pos, min_idx, max_pos, max_idx, reverse) | return chain(
map(_lists[min_pos].__getitem__, min_indices),
chain.from_iterable(sublists),
map(_lists[max_pos].__getitem__, max_indices),
) | Return an iterator that slices sorted list using two index pairs.
The index pairs are (min_pos, min_idx) and (max_pos, max_idx), the
first inclusive and the latter exclusive. See `_pos` for details on how
an index is converted to an index pair.
When `reverse` is `True`, values are yiel... | Return an iterator that slices sorted list using two index pairs. | [
"Return",
"an",
"iterator",
"that",
"slices",
"sorted",
"list",
"using",
"two",
"index",
"pairs",
"."
] | def _islice(self, min_pos, min_idx, max_pos, max_idx, reverse):
"""Return an iterator that slices sorted list using two index pairs.
The index pairs are (min_pos, min_idx) and (max_pos, max_idx), the
first inclusive and the latter exclusive. See `_pos` for details on how
an index is con... | [
"def",
"_islice",
"(",
"self",
",",
"min_pos",
",",
"min_idx",
",",
"max_pos",
",",
"max_idx",
",",
"reverse",
")",
":",
"_lists",
"=",
"self",
".",
"_lists",
"if",
"min_pos",
">",
"max_pos",
":",
"return",
"iter",
"(",
"(",
")",
")",
"if",
"min_pos"... | https://github.com/Ultimaker/Uranium/blob/66da853cd9a04edd3a8a03526fac81e83c03f5aa/UM/SortedList.py#L1033-L1094 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py | python | resolve_egg_link | (path) | return next(dist_groups, ()) | Given a path to an .egg-link, resolve distributions
present in the referenced path. | Given a path to an .egg-link, resolve distributions
present in the referenced path. | [
"Given",
"a",
"path",
"to",
"an",
".",
"egg",
"-",
"link",
"resolve",
"distributions",
"present",
"in",
"the",
"referenced",
"path",
"."
] | def resolve_egg_link(path):
"""
Given a path to an .egg-link, resolve distributions
present in the referenced path.
"""
referenced_paths = non_empty_lines(path)
resolved_paths = (
os.path.join(os.path.dirname(path), ref)
for ref in referenced_paths
)
dist_groups = map(fin... | [
"def",
"resolve_egg_link",
"(",
"path",
")",
":",
"referenced_paths",
"=",
"non_empty_lines",
"(",
"path",
")",
"resolved_paths",
"=",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
",",
"ref",
")",
"for"... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L2053-L2064 | |
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/panel.py | python | Panel.showEvent | (self, ev) | Re-implemented to force creation of widget. | Re-implemented to force creation of widget. | [
"Re",
"-",
"implemented",
"to",
"force",
"creation",
"of",
"widget",
"."
] | def showEvent(self, ev):
"""Re-implemented to force creation of widget."""
self.widget() | [
"def",
"showEvent",
"(",
"self",
",",
"ev",
")",
":",
"self",
".",
"widget",
"(",
")"
] | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/panel.py#L79-L81 | ||
tahoe-lafs/tahoe-lafs | 766a53b5208c03c45ca0a98e97eee76870276aa1 | src/allmydata/util/_eliot_updates.py | python | validateLogging | (
assertion, *assertionArgs, **assertionKwargs
) | return decorator | Decorator factory for L{unittest.TestCase} methods to add logging
validation.
1. The decorated test method gets a C{logger} keyword argument, a
L{MemoryLogger}.
2. All messages logged to this logger will be validated at the end of
the test.
3. Any unflushed logged tracebacks will cause th... | Decorator factory for L{unittest.TestCase} methods to add logging
validation. | [
"Decorator",
"factory",
"for",
"L",
"{",
"unittest",
".",
"TestCase",
"}",
"methods",
"to",
"add",
"logging",
"validation",
"."
] | def validateLogging(
assertion, *assertionArgs, **assertionKwargs
):
"""
Decorator factory for L{unittest.TestCase} methods to add logging
validation.
1. The decorated test method gets a C{logger} keyword argument, a
L{MemoryLogger}.
2. All messages logged to this logger will be validate... | [
"def",
"validateLogging",
"(",
"assertion",
",",
"*",
"assertionArgs",
",",
"*",
"*",
"assertionKwargs",
")",
":",
"encoder_",
"=",
"assertionKwargs",
".",
"pop",
"(",
"\"encoder_\"",
",",
"eliot_json_encoder",
")",
"def",
"decorator",
"(",
"function",
")",
":... | https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/util/_eliot_updates.py#L104-L164 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/algebras/quaternion_algebra_element.py | python | unpickle_QuaternionAlgebraElement_generic_v0 | (*args) | return QuaternionAlgebraElement_generic(*args) | EXAMPLES::
sage: K.<X> = QQ[]
sage: Q.<i,j,k> = QuaternionAlgebra(Frac(K), -5,-19); z = 2/3 + i*X - X^2*j + X^3*k
sage: f, t = z.__reduce__()
sage: import sage.algebras.quaternion_algebra_element
sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_ge... | EXAMPLES:: | [
"EXAMPLES",
"::"
] | def unpickle_QuaternionAlgebraElement_generic_v0(*args):
"""
EXAMPLES::
sage: K.<X> = QQ[]
sage: Q.<i,j,k> = QuaternionAlgebra(Frac(K), -5,-19); z = 2/3 + i*X - X^2*j + X^3*k
sage: f, t = z.__reduce__()
sage: import sage.algebras.quaternion_algebra_element
sage: sage.alg... | [
"def",
"unpickle_QuaternionAlgebraElement_generic_v0",
"(",
"*",
"args",
")",
":",
"return",
"QuaternionAlgebraElement_generic",
"(",
"*",
"args",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/algebras/quaternion_algebra_element.py#L9-L22 | |
ncullen93/torchsample | 1f328d1ea3ef533c8c0c4097ed4a3fa16d784ba4 | torchsample/datasets.py | python | CSVDataset.__init__ | (self,
csv,
input_cols=[0],
target_cols=[1],
input_transform=None,
target_transform=None,
co_transform=None) | Initialize a Dataset from a CSV file/dataframe. This does NOT
actually load the data into memory if the CSV contains filepaths.
Arguments
---------
csv : string or pandas.DataFrame
if string, should be a path to a .csv file which
can be loaded as a pandas datafra... | Initialize a Dataset from a CSV file/dataframe. This does NOT
actually load the data into memory if the CSV contains filepaths. | [
"Initialize",
"a",
"Dataset",
"from",
"a",
"CSV",
"file",
"/",
"dataframe",
".",
"This",
"does",
"NOT",
"actually",
"load",
"the",
"data",
"into",
"memory",
"if",
"the",
"CSV",
"contains",
"filepaths",
"."
] | def __init__(self,
csv,
input_cols=[0],
target_cols=[1],
input_transform=None,
target_transform=None,
co_transform=None):
"""
Initialize a Dataset from a CSV file/dataframe. This does NOT
actual... | [
"def",
"__init__",
"(",
"self",
",",
"csv",
",",
"input_cols",
"=",
"[",
"0",
"]",
",",
"target_cols",
"=",
"[",
"1",
"]",
",",
"input_transform",
"=",
"None",
",",
"target_transform",
"=",
"None",
",",
"co_transform",
"=",
"None",
")",
":",
"self",
... | https://github.com/ncullen93/torchsample/blob/1f328d1ea3ef533c8c0c4097ed4a3fa16d784ba4/torchsample/datasets.py#L341-L403 | ||
bytedance/byteps | d0bcf1a87ee87539ceb29bcc976d4da063ffc47b | example/pytorch/train_imagenet_resnet50_byteps.py | python | Metric.update | (self, val) | [] | def update(self, val):
if not isinstance(val, torch.Tensor):
val = torch.tensor(val)
self.sum += val
self.n += 1 | [
"def",
"update",
"(",
"self",
",",
"val",
")",
":",
"if",
"not",
"isinstance",
"(",
"val",
",",
"torch",
".",
"Tensor",
")",
":",
"val",
"=",
"torch",
".",
"tensor",
"(",
"val",
")",
"self",
".",
"sum",
"+=",
"val",
"self",
".",
"n",
"+=",
"1"
... | https://github.com/bytedance/byteps/blob/d0bcf1a87ee87539ceb29bcc976d4da063ffc47b/example/pytorch/train_imagenet_resnet50_byteps.py#L262-L266 | ||||
greyli/flask-origin | 5621ba0562cafd0d6020f67f1172e02600186412 | flask.py | python | render_template | (template_name, **context) | return current_app.jinja_env.get_template(template_name).render(context) | 使用给定的上下文从模板(template)文件夹渲染一个模板。
:param template_name: 要被渲染的模板文件名。
:param context: 在模板上下文中应该可用(available)的变量。 | 使用给定的上下文从模板(template)文件夹渲染一个模板。
:param template_name: 要被渲染的模板文件名。
:param context: 在模板上下文中应该可用(available)的变量。 | [
"使用给定的上下文从模板(template)文件夹渲染一个模板。",
":",
"param",
"template_name",
":",
"要被渲染的模板文件名。",
":",
"param",
"context",
":",
"在模板上下文中应该可用(available)的变量。"
] | def render_template(template_name, **context):
"""使用给定的上下文从模板(template)文件夹渲染一个模板。
:param template_name: 要被渲染的模板文件名。
:param context: 在模板上下文中应该可用(available)的变量。
"""
current_app.update_template_context(context)
return current_app.jinja_env.get_template(template_name).render(context) | [
"def",
"render_template",
"(",
"template_name",
",",
"*",
"*",
"context",
")",
":",
"current_app",
".",
"update_template_context",
"(",
"context",
")",
"return",
"current_app",
".",
"jinja_env",
".",
"get_template",
"(",
"template_name",
")",
".",
"render",
"(",... | https://github.com/greyli/flask-origin/blob/5621ba0562cafd0d6020f67f1172e02600186412/flask.py#L118-L125 | |
tomekwojcik/envelopes | 8ad190a55d0d8b805b6ae545b896e719467253b7 | envelopes/envelope.py | python | Envelope.cc_addr | (self) | return self._cc | List of CC addresses. | List of CC addresses. | [
"List",
"of",
"CC",
"addresses",
"."
] | def cc_addr(self):
"""List of CC addresses."""
return self._cc | [
"def",
"cc_addr",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cc"
] | https://github.com/tomekwojcik/envelopes/blob/8ad190a55d0d8b805b6ae545b896e719467253b7/envelopes/envelope.py#L167-L169 | |
fonttools/fonttools | 892322aaff6a89bea5927379ec06bc0da3dfb7df | Lib/fontTools/ttLib/tables/DefaultTable.py | python | DefaultTable.__repr__ | (self) | return "<'%s' table at %x>" % (self.tableTag, id(self)) | [] | def __repr__(self):
return "<'%s' table at %x>" % (self.tableTag, id(self)) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"<'%s' table at %x>\"",
"%",
"(",
"self",
".",
"tableTag",
",",
"id",
"(",
"self",
")",
")"
] | https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ttLib/tables/DefaultTable.py#L38-L39 | |||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/future/backports/datetime.py | python | _ymd2ord | (year, month, day) | return (_days_before_year(year) +
_days_before_month(year, month) +
day) | year, month, day -> ordinal, considering 01-Jan-0001 as day 1. | year, month, day -> ordinal, considering 01-Jan-0001 as day 1. | [
"year",
"month",
"day",
"-",
">",
"ordinal",
"considering",
"01",
"-",
"Jan",
"-",
"0001",
"as",
"day",
"1",
"."
] | def _ymd2ord(year, month, day):
"year, month, day -> ordinal, considering 01-Jan-0001 as day 1."
assert 1 <= month <= 12, 'month must be in 1..12'
dim = _days_in_month(year, month)
assert 1 <= day <= dim, ('day must be in 1..%d' % dim)
return (_days_before_year(year) +
_days_before_month... | [
"def",
"_ymd2ord",
"(",
"year",
",",
"month",
",",
"day",
")",
":",
"assert",
"1",
"<=",
"month",
"<=",
"12",
",",
"'month must be in 1..12'",
"dim",
"=",
"_days_in_month",
"(",
"year",
",",
"month",
")",
"assert",
"1",
"<=",
"day",
"<=",
"dim",
",",
... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/future/backports/datetime.py#L67-L74 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/algorithms/mis.py | python | maximal_independent_set | (G, nodes=None) | return indep_nodes | Return a random maximal independent set guaranteed to contain
a given set of nodes.
An independent set is a set of nodes such that the subgraph
of G induced by these nodes contains no edges. A maximal
independent set is an independent set such that it is not possible
to add a new node and still get... | Return a random maximal independent set guaranteed to contain
a given set of nodes. | [
"Return",
"a",
"random",
"maximal",
"independent",
"set",
"guaranteed",
"to",
"contain",
"a",
"given",
"set",
"of",
"nodes",
"."
] | def maximal_independent_set(G, nodes=None):
"""Return a random maximal independent set guaranteed to contain
a given set of nodes.
An independent set is a set of nodes such that the subgraph
of G induced by these nodes contains no edges. A maximal
independent set is an independent set such that it ... | [
"def",
"maximal_independent_set",
"(",
"G",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"not",
"nodes",
":",
"nodes",
"=",
"set",
"(",
"[",
"random",
".",
"choice",
"(",
"list",
"(",
"G",
")",
")",
"]",
")",
"else",
":",
"nodes",
"=",
"set",
"(",
... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/algorithms/mis.py#L24-L85 | |
nextgenusfs/funannotate | f737bedfca5c5fd1e9a356bd400a4391926f76e4 | funannotate/aux_scripts/funannotate-BUSCO2-py2.py | python | GeneSetAnalysis.run_analysis | (self) | This function calls all needed steps for running the analysis. | This function calls all needed steps for running the analysis. | [
"This",
"function",
"calls",
"all",
"needed",
"steps",
"for",
"running",
"the",
"analysis",
"."
] | def run_analysis(self):
"""
This function calls all needed steps for running the analysis.
"""
self.check_dataset()
self._check_protein()
self._create_directory()
self._load_score()
self._load_length()
self._hmmer()
self._produce_short_summ... | [
"def",
"run_analysis",
"(",
"self",
")",
":",
"self",
".",
"check_dataset",
"(",
")",
"self",
".",
"_check_protein",
"(",
")",
"self",
".",
"_create_directory",
"(",
")",
"self",
".",
"_load_score",
"(",
")",
"self",
".",
"_load_length",
"(",
")",
"self"... | https://github.com/nextgenusfs/funannotate/blob/f737bedfca5c5fd1e9a356bd400a4391926f76e4/funannotate/aux_scripts/funannotate-BUSCO2-py2.py#L2829-L2840 | ||
benbusby/whoogle-search | f4b65be8763226bc03546673ac75a2ceaa49f758 | app/models/config.py | python | Config.to_params | (self) | return param_str | Generates a set of safe params for using in Whoogle URLs
Returns:
str -- a set of URL parameters | Generates a set of safe params for using in Whoogle URLs | [
"Generates",
"a",
"set",
"of",
"safe",
"params",
"for",
"using",
"in",
"Whoogle",
"URLs"
] | def to_params(self) -> str:
"""Generates a set of safe params for using in Whoogle URLs
Returns:
str -- a set of URL parameters
"""
param_str = ''
for safe_key in self.safe_keys:
if not self[safe_key]:
continue
param_str = para... | [
"def",
"to_params",
"(",
"self",
")",
"->",
"str",
":",
"param_str",
"=",
"''",
"for",
"safe_key",
"in",
"self",
".",
"safe_keys",
":",
"if",
"not",
"self",
"[",
"safe_key",
"]",
":",
"continue",
"param_str",
"=",
"param_str",
"+",
"f'&{safe_key}={self[saf... | https://github.com/benbusby/whoogle-search/blob/f4b65be8763226bc03546673ac75a2ceaa49f758/app/models/config.py#L122-L134 | |
glinscott/fishtest | 8d2b823a63fbe7be169a2177a130018c389d7aea | worker/updater.py | python | do_restart | () | Restarts the worker, using the same arguments | Restarts the worker, using the same arguments | [
"Restarts",
"the",
"worker",
"using",
"the",
"same",
"arguments"
] | def do_restart():
"""Restarts the worker, using the same arguments"""
args = sys.argv[:]
args.insert(0, sys.executable)
if sys.platform == "win32":
args = ['"{}"'.format(arg) for arg in args]
os.chdir(start_dir)
os.execv(sys.executable, args) | [
"def",
"do_restart",
"(",
")",
":",
"args",
"=",
"sys",
".",
"argv",
"[",
":",
"]",
"args",
".",
"insert",
"(",
"0",
",",
"sys",
".",
"executable",
")",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"args",
"=",
"[",
"'\"{}\"'",
".",
"for... | https://github.com/glinscott/fishtest/blob/8d2b823a63fbe7be169a2177a130018c389d7aea/worker/updater.py#L17-L25 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/ctx_mp.py | python | MPContext._nthroot | (ctx, x, n) | return ctx.make_mpc(libmp.mpc_nthroot(x, n, *ctx._prec_rounding)) | [] | def _nthroot(ctx, x, n):
if hasattr(x, '_mpf_'):
try:
return ctx.make_mpf(libmp.mpf_nthroot(x._mpf_, n, *ctx._prec_rounding))
except ComplexResult:
if ctx.trap_complex:
raise
x = (x._mpf_, libmp.fzero)
else:
... | [
"def",
"_nthroot",
"(",
"ctx",
",",
"x",
",",
"n",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"'_mpf_'",
")",
":",
"try",
":",
"return",
"ctx",
".",
"make_mpf",
"(",
"libmp",
".",
"mpf_nthroot",
"(",
"x",
".",
"_mpf_",
",",
"n",
",",
"*",
"ctx",... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/ctx_mp.py#L219-L229 | |||
CCExtractor/vardbg | 8baabb93d2e8afccc5ee837bd8301a5f765635c2 | vardbg/diff_processor.py | python | DiffProcessor.__init__ | (self: "Debugger") | [] | def __init__(self: "Debugger"):
# Full variable + values map
self.vars = {}
# File contents cache
self.file_cache = {}
# Propagate initialization to other mixins
super().__init__() | [
"def",
"__init__",
"(",
"self",
":",
"\"Debugger\"",
")",
":",
"# Full variable + values map",
"self",
".",
"vars",
"=",
"{",
"}",
"# File contents cache",
"self",
".",
"file_cache",
"=",
"{",
"}",
"# Propagate initialization to other mixins",
"super",
"(",
")",
"... | https://github.com/CCExtractor/vardbg/blob/8baabb93d2e8afccc5ee837bd8301a5f765635c2/vardbg/diff_processor.py#L14-L22 | ||||
Xen0ph0n/YaraGenerator | 48f529f0d85e7fff62405d9367901487e29aa28f | modules/pefile.py | python | PE.get_dword_from_data | (self, data, offset) | return struct.unpack('<I', data[offset*4:(offset+1)*4])[0] | Convert four bytes of data to a double word (little endian)
'offset' is assumed to index into a dword array. So setting it to
N will return a dword out of the data starting at offset N*4.
Returns None if the data can't be turned into a double word. | Convert four bytes of data to a double word (little endian)
'offset' is assumed to index into a dword array. So setting it to
N will return a dword out of the data starting at offset N*4.
Returns None if the data can't be turned into a double word. | [
"Convert",
"four",
"bytes",
"of",
"data",
"to",
"a",
"double",
"word",
"(",
"little",
"endian",
")",
"offset",
"is",
"assumed",
"to",
"index",
"into",
"a",
"dword",
"array",
".",
"So",
"setting",
"it",
"to",
"N",
"will",
"return",
"a",
"dword",
"out",
... | def get_dword_from_data(self, data, offset):
"""Convert four bytes of data to a double word (little endian)
'offset' is assumed to index into a dword array. So setting it to
N will return a dword out of the data starting at offset N*4.
Returns None if the data can't be ... | [
"def",
"get_dword_from_data",
"(",
"self",
",",
"data",
",",
"offset",
")",
":",
"if",
"(",
"offset",
"+",
"1",
")",
"*",
"4",
">",
"len",
"(",
"data",
")",
":",
"return",
"None",
"return",
"struct",
".",
"unpack",
"(",
"'<I'",
",",
"data",
"[",
... | https://github.com/Xen0ph0n/YaraGenerator/blob/48f529f0d85e7fff62405d9367901487e29aa28f/modules/pefile.py#L4255-L4267 | |
cournape/Bento | 37de23d784407a7c98a4a15770ffc570d5f32d70 | bento/private/_yaku/examples/c/example.py | python | build | (ctx) | [] | def build(ctx):
builder = ctx.builders["cxxtasks"]
builder.program("foo", ["src/main.cxx"])
builder = ctx.builders["ctasks"]
builder.static_library("bar", ["src/bar.c"]) | [
"def",
"build",
"(",
"ctx",
")",
":",
"builder",
"=",
"ctx",
".",
"builders",
"[",
"\"cxxtasks\"",
"]",
"builder",
".",
"program",
"(",
"\"foo\"",
",",
"[",
"\"src/main.cxx\"",
"]",
")",
"builder",
"=",
"ctx",
".",
"builders",
"[",
"\"ctasks\"",
"]",
"... | https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/private/_yaku/examples/c/example.py#L12-L17 | ||||
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/plugin/builtin/integration/mixins.py | python | NavigationMixin.setup_navigation | (self) | return nav_links | setup navigation links for this plugin | setup navigation links for this plugin | [
"setup",
"navigation",
"links",
"for",
"this",
"plugin"
] | def setup_navigation(self):
"""
setup navigation links for this plugin
"""
nav_links = getattr(self, 'NAVIGATION', None)
if nav_links:
# check if needed values are configured
for link in nav_links:
if False in [a in link for a in ('link', '... | [
"def",
"setup_navigation",
"(",
"self",
")",
":",
"nav_links",
"=",
"getattr",
"(",
"self",
",",
"'NAVIGATION'",
",",
"None",
")",
"if",
"nav_links",
":",
"# check if needed values are configured",
"for",
"link",
"in",
"nav_links",
":",
"if",
"False",
"in",
"[... | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/plugin/builtin/integration/mixins.py#L252-L262 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/hyperlink.py | python | HyperLinkCtrl.GetUnderlines | (self) | return self._LinkUnderline, self._RolloverUnderline, self._VisitedUnderline | Returns if link is underlined, if the mouse rollover is
underlined and if the visited link is underlined. | Returns if link is underlined, if the mouse rollover is
underlined and if the visited link is underlined. | [
"Returns",
"if",
"link",
"is",
"underlined",
"if",
"the",
"mouse",
"rollover",
"is",
"underlined",
"and",
"if",
"the",
"visited",
"link",
"is",
"underlined",
"."
] | def GetUnderlines(self):
"""
Returns if link is underlined, if the mouse rollover is
underlined and if the visited link is underlined.
"""
return self._LinkUnderline, self._RolloverUnderline, self._VisitedUnderline | [
"def",
"GetUnderlines",
"(",
"self",
")",
":",
"return",
"self",
".",
"_LinkUnderline",
",",
"self",
".",
"_RolloverUnderline",
",",
"self",
".",
"_VisitedUnderline"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/hyperlink.py#L494-L500 | |
apache/bloodhound | c3e31294e68af99d4e040e64fbdf52394344df9e | trac/trac/util/__init__.py | python | partition | (iterable, order=None) | return [result[key] for key in order] | >>> partition([(1, "a"), (2, "b"), (3, "a")])
{'a': [1, 3], 'b': [2]}
>>> partition([(1, "a"), (2, "b"), (3, "a")], "ab")
[[1, 3], [2]] | >>> partition([(1, "a"), (2, "b"), (3, "a")])
{'a': [1, 3], 'b': [2]}
>>> partition([(1, "a"), (2, "b"), (3, "a")], "ab")
[[1, 3], [2]] | [
">>>",
"partition",
"(",
"[",
"(",
"1",
"a",
")",
"(",
"2",
"b",
")",
"(",
"3",
"a",
")",
"]",
")",
"{",
"a",
":",
"[",
"1",
"3",
"]",
"b",
":",
"[",
"2",
"]",
"}",
">>>",
"partition",
"(",
"[",
"(",
"1",
"a",
")",
"(",
"2",
"b",
")... | def partition(iterable, order=None):
"""
>>> partition([(1, "a"), (2, "b"), (3, "a")])
{'a': [1, 3], 'b': [2]}
>>> partition([(1, "a"), (2, "b"), (3, "a")], "ab")
[[1, 3], [2]]
"""
result = {}
if order is not None:
for key in order:
result[key] = []
for item, cate... | [
"def",
"partition",
"(",
"iterable",
",",
"order",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"if",
"order",
"is",
"not",
"None",
":",
"for",
"key",
"in",
"order",
":",
"result",
"[",
"key",
"]",
"=",
"[",
"]",
"for",
"item",
",",
"category"... | https://github.com/apache/bloodhound/blob/c3e31294e68af99d4e040e64fbdf52394344df9e/trac/trac/util/__init__.py#L1024-L1039 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/database/database_client_composite_operations.py | python | DatabaseClientCompositeOperations.create_pluggable_database_and_wait_for_state | (self, create_pluggable_database_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}) | Calls :py:func:`~oci.database.DatabaseClient.create_pluggable_database` and waits for the :py:class:`~oci.database.models.PluggableDatabase` acted upon
to enter the given state(s).
:param oci.database.models.CreatePluggableDatabaseDetails create_pluggable_database_details: (required)
Reques... | Calls :py:func:`~oci.database.DatabaseClient.create_pluggable_database` and waits for the :py:class:`~oci.database.models.PluggableDatabase` acted upon
to enter the given state(s). | [
"Calls",
":",
"py",
":",
"func",
":",
"~oci",
".",
"database",
".",
"DatabaseClient",
".",
"create_pluggable_database",
"and",
"waits",
"for",
"the",
":",
"py",
":",
"class",
":",
"~oci",
".",
"database",
".",
"models",
".",
"PluggableDatabase",
"acted",
"... | def create_pluggable_database_and_wait_for_state(self, create_pluggable_database_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}):
"""
Calls :py:func:`~oci.database.DatabaseClient.create_pluggable_database` and waits for the :py:class:`~oci.database.models.PluggableDatabase` acted upo... | [
"def",
"create_pluggable_database_and_wait_for_state",
"(",
"self",
",",
"create_pluggable_database_details",
",",
"wait_for_states",
"=",
"[",
"]",
",",
"operation_kwargs",
"=",
"{",
"}",
",",
"waiter_kwargs",
"=",
"{",
"}",
")",
":",
"operation_result",
"=",
"self... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/database/database_client_composite_operations.py#L2656-L2692 | ||
orbingol/NURBS-Python | 8ae8b127eb0b130a25a6c81e98e90f319733bca0 | geomdl/helpers.py | python | knot_removal_alpha_j | (u, degree, knotvector, num, idx) | return (u - knotvector[idx - num]) / (knotvector[idx + degree + 1] - knotvector[idx - num]) | Computes :math:`\\alpha_{j}` coefficient for knot removal algorithm.
Please refer to Eq. 5.29 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.184 for details.
:param u: knot
:type u: float
:param degree: degree
:type degree: int
:param knotvector: knot vector
:type knotvector: tuple
... | Computes :math:`\\alpha_{j}` coefficient for knot removal algorithm. | [
"Computes",
":",
"math",
":",
"\\\\",
"alpha_",
"{",
"j",
"}",
"coefficient",
"for",
"knot",
"removal",
"algorithm",
"."
] | def knot_removal_alpha_j(u, degree, knotvector, num, idx):
""" Computes :math:`\\alpha_{j}` coefficient for knot removal algorithm.
Please refer to Eq. 5.29 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.184 for details.
:param u: knot
:type u: float
:param degree: degree
:type degree: in... | [
"def",
"knot_removal_alpha_j",
"(",
"u",
",",
"degree",
",",
"knotvector",
",",
"num",
",",
"idx",
")",
":",
"return",
"(",
"u",
"-",
"knotvector",
"[",
"idx",
"-",
"num",
"]",
")",
"/",
"(",
"knotvector",
"[",
"idx",
"+",
"degree",
"+",
"1",
"]",
... | https://github.com/orbingol/NURBS-Python/blob/8ae8b127eb0b130a25a6c81e98e90f319733bca0/geomdl/helpers.py#L765-L783 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/tkinter/ttk.py | python | Treeview.set | (self, item, column=None, value=None) | Query or set the value of given item.
With one argument, return a dictionary of column/value pairs
for the specified item. With two arguments, return the current
value of the specified column. With three arguments, set the
value of given column in given item to the specified value. | Query or set the value of given item. | [
"Query",
"or",
"set",
"the",
"value",
"of",
"given",
"item",
"."
] | def set(self, item, column=None, value=None):
"""Query or set the value of given item.
With one argument, return a dictionary of column/value pairs
for the specified item. With two arguments, return the current
value of the specified column. With three arguments, set the
value o... | [
"def",
"set",
"(",
"self",
",",
"item",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
")",
":",
"res",
"=",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"set\"",
",",
"item",
",",
"column",
",",
"value",
")",
"if",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/ttk.py#L1452-L1464 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/contrib/gis/gdal/geometries.py | python | OGRGeometry.intersection | (self, other) | return self._geomgen(capi.geom_intersection, other) | Returns a new geometry consisting of the region of intersection of this
geometry and the other. | Returns a new geometry consisting of the region of intersection of this
geometry and the other. | [
"Returns",
"a",
"new",
"geometry",
"consisting",
"of",
"the",
"region",
"of",
"intersection",
"of",
"this",
"geometry",
"and",
"the",
"other",
"."
] | def intersection(self, other):
"""
Returns a new geometry consisting of the region of intersection of this
geometry and the other.
"""
return self._geomgen(capi.geom_intersection, other) | [
"def",
"intersection",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"_geomgen",
"(",
"capi",
".",
"geom_intersection",
",",
"other",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/contrib/gis/gdal/geometries.py#L484-L489 | |
alanhamlett/pip-update-requirements | ce875601ef278c8ce00ad586434a978731525561 | pur/packages/pip/_vendor/html5lib/html5parser.py | python | HTMLParser.parse | (self, stream, *args, **kwargs) | return self.tree.getDocument() | Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will be used,
regardless of any BOM or later d... | Parse a HTML document into a well-formed tree | [
"Parse",
"a",
"HTML",
"document",
"into",
"a",
"well",
"-",
"formed",
"tree"
] | def parse(self, stream, *args, **kwargs):
"""Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will ... | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"False",
",",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
"."... | https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_vendor/html5lib/html5parser.py#L267-L290 | |
Garvit244/Leetcode | a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29 | 100-200q/102.py | python | Solution.levelOrder | (self, root) | return result | :type root: TreeNode
:rtype: List[List[int]] | :type root: TreeNode
:rtype: List[List[int]] | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"List",
"[",
"List",
"[",
"int",
"]]"
] | def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not root:
return []
queue = [(root, 0)]
levelMap = {}
while queue:
node, level = queue.pop(0)
if node.left:
queue.append((node.left,... | [
"def",
"levelOrder",
"(",
"self",
",",
"root",
")",
":",
"if",
"not",
"root",
":",
"return",
"[",
"]",
"queue",
"=",
"[",
"(",
"root",
",",
"0",
")",
"]",
"levelMap",
"=",
"{",
"}",
"while",
"queue",
":",
"node",
",",
"level",
"=",
"queue",
"."... | https://github.com/Garvit244/Leetcode/blob/a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29/100-200q/102.py#L30-L57 | |
shunsukesaito/PIFu | 02a6d8643d3267d06cb4a510b30a59e7e07255de | lib/renderer/glm.py | python | identity | () | return np.identity(4, dtype=np.float32) | [] | def identity():
return np.identity(4, dtype=np.float32) | [
"def",
"identity",
"(",
")",
":",
"return",
"np",
".",
"identity",
"(",
"4",
",",
"dtype",
"=",
"np",
".",
"float32",
")"
] | https://github.com/shunsukesaito/PIFu/blob/02a6d8643d3267d06cb4a510b30a59e7e07255de/lib/renderer/glm.py#L12-L13 | |||
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | geraldo/charts.py | python | BaseChart.get_drawing | (self, chart) | return drawing | Create and returns the drawing, to be generated | Create and returns the drawing, to be generated | [
"Create",
"and",
"returns",
"the",
"drawing",
"to",
"be",
"generated"
] | def get_drawing(self, chart):
"""Create and returns the drawing, to be generated"""
drawing = Drawing(self.width, self.height)
# Make the title
title = self.make_title(drawing)
# Setting chart dimensions
chart.height = self.height
chart.width = self.width
... | [
"def",
"get_drawing",
"(",
"self",
",",
"chart",
")",
":",
"drawing",
"=",
"Drawing",
"(",
"self",
".",
"width",
",",
"self",
".",
"height",
")",
"# Make the title",
"title",
"=",
"self",
".",
"make_title",
"(",
"drawing",
")",
"# Setting chart dimensions",
... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/geraldo/charts.py#L123-L151 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/bmvpc/v20180625/bmvpc_client.py | python | BmvpcClient.DescribeVpcResource | (self, request) | 查询黑石私有网络关联资源
:param request: Request instance for DescribeVpcResource.
:type request: :class:`tencentcloud.bmvpc.v20180625.models.DescribeVpcResourceRequest`
:rtype: :class:`tencentcloud.bmvpc.v20180625.models.DescribeVpcResourceResponse` | 查询黑石私有网络关联资源 | [
"查询黑石私有网络关联资源"
] | def DescribeVpcResource(self, request):
"""查询黑石私有网络关联资源
:param request: Request instance for DescribeVpcResource.
:type request: :class:`tencentcloud.bmvpc.v20180625.models.DescribeVpcResourceRequest`
:rtype: :class:`tencentcloud.bmvpc.v20180625.models.DescribeVpcResourceResponse`
... | [
"def",
"DescribeVpcResource",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DescribeVpcResource\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"l... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/bmvpc/v20180625/bmvpc_client.py#L1159-L1184 | ||
hmason/gitmarks | 0b69ff313efca8ea25d6fbd5620bdf7aeec5e826 | bottle.py | python | Bottle._add_hook_wrapper | (self, func) | return wrapper | Add hooks to a callable. See #84 | Add hooks to a callable. See #84 | [
"Add",
"hooks",
"to",
"a",
"callable",
".",
"See",
"#84"
] | def _add_hook_wrapper(self, func):
''' Add hooks to a callable. See #84 '''
@functools.wraps(func)
def wrapper(*a, **ka):
for hook in self.hooks['before_request']: hook()
response.output = func(*a, **ka)
for hook in self.hooks['after_request']: hook()
... | [
"def",
"_add_hook_wrapper",
"(",
"self",
",",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"a",
",",
"*",
"*",
"ka",
")",
":",
"for",
"hook",
"in",
"self",
".",
"hooks",
"[",
"'before_request'",
"]... | https://github.com/hmason/gitmarks/blob/0b69ff313efca8ea25d6fbd5620bdf7aeec5e826/bottle.py#L445-L453 | |
autotest/autotest | 4614ae5f550cc888267b9a419e4b90deb54f8fae | client/shared/utils_cgroup.py | python | cgconfig_exists | () | return service_cgconfig_control("exists") | Check if cgconfig is available on the host or perhaps systemd is used | Check if cgconfig is available on the host or perhaps systemd is used | [
"Check",
"if",
"cgconfig",
"is",
"available",
"on",
"the",
"host",
"or",
"perhaps",
"systemd",
"is",
"used"
] | def cgconfig_exists():
"""
Check if cgconfig is available on the host or perhaps systemd is used
"""
return service_cgconfig_control("exists") | [
"def",
"cgconfig_exists",
"(",
")",
":",
"return",
"service_cgconfig_control",
"(",
"\"exists\"",
")"
] | https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/client/shared/utils_cgroup.py#L764-L768 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/importlib/_bootstrap_external.py | python | FileFinder.find_spec | (self, fullname, target=None) | return None | Try to find a spec for the specified module. Returns the
matching spec, or None if not found. | Try to find a spec for the specified module. Returns the
matching spec, or None if not found. | [
"Try",
"to",
"find",
"a",
"spec",
"for",
"the",
"specified",
"module",
".",
"Returns",
"the",
"matching",
"spec",
"or",
"None",
"if",
"not",
"found",
"."
] | def find_spec(self, fullname, target=None):
"""Try to find a spec for the specified module. Returns the
matching spec, or None if not found."""
is_namespace = False
tail_module = fullname.rpartition('.')[2]
try:
mtime = _path_stat(self.path or _os.getcwd()).st_mtime
... | [
"def",
"find_spec",
"(",
"self",
",",
"fullname",
",",
"target",
"=",
"None",
")",
":",
"is_namespace",
"=",
"False",
"tail_module",
"=",
"fullname",
".",
"rpartition",
"(",
"'.'",
")",
"[",
"2",
"]",
"try",
":",
"mtime",
"=",
"_path_stat",
"(",
"self"... | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/importlib/_bootstrap_external.py#L1217-L1261 | |
googleworkspace/hangouts-chat-samples | cacaba5094864150f23d4fab1fb0c7e418ad2c80 | python/productivity_tracker/productivity_bot/api_helper.py | python | APIHelper.__init__ | (self, keyfile_name) | [] | def __init__(self, keyfile_name):
credentials = service_account.Credentials.from_service_account_file(keyfile_name)
self.credentials = credentials.with_scopes(scopes=APIHelper.scopes)
self.sheets_service = build('sheets', 'v4', credentials=self.credentials)
self.drive_service = build('dr... | [
"def",
"__init__",
"(",
"self",
",",
"keyfile_name",
")",
":",
"credentials",
"=",
"service_account",
".",
"Credentials",
".",
"from_service_account_file",
"(",
"keyfile_name",
")",
"self",
".",
"credentials",
"=",
"credentials",
".",
"with_scopes",
"(",
"scopes",... | https://github.com/googleworkspace/hangouts-chat-samples/blob/cacaba5094864150f23d4fab1fb0c7e418ad2c80/python/productivity_tracker/productivity_bot/api_helper.py#L28-L32 | ||||
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | src/nupic/swarming/exp_generator/experiment_generator.py | python | _generateExperiment | (options, outputDirPath, hsVersion,
claDescriptionTemplateFile) | Executes the --description option, which includes:
1. Perform provider compatibility checks
2. Preprocess the training and testing datasets (filter, join providers)
3. If test dataset omitted, split the training dataset into training
and testing datasets.
4. Gather statistics about the... | Executes the --description option, which includes: | [
"Executes",
"the",
"--",
"description",
"option",
"which",
"includes",
":"
] | def _generateExperiment(options, outputDirPath, hsVersion,
claDescriptionTemplateFile):
""" Executes the --description option, which includes:
1. Perform provider compatibility checks
2. Preprocess the training and testing datasets (filter, join providers)
3. If test da... | [
"def",
"_generateExperiment",
"(",
"options",
",",
"outputDirPath",
",",
"hsVersion",
",",
"claDescriptionTemplateFile",
")",
":",
"_gExperimentDescriptionSchema",
"=",
"_getExperimentDescriptionSchema",
"(",
")",
"# Validate JSON arg using JSON schema validator",
"try",
":",
... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/swarming/exp_generator/experiment_generator.py#L1038-L1615 | ||
qibinlou/SinaWeibo-Emotion-Classification | f336fc104abd68b0ec4180fe2ed80fafe49cb790 | nltk/classify/weka.py | python | ARFF_Formatter.format | (self, tokens) | return self.header_section() + self.data_section(tokens) | Returns a string representation of ARFF output for the given data. | Returns a string representation of ARFF output for the given data. | [
"Returns",
"a",
"string",
"representation",
"of",
"ARFF",
"output",
"for",
"the",
"given",
"data",
"."
] | def format(self, tokens):
"""Returns a string representation of ARFF output for the given data."""
return self.header_section() + self.data_section(tokens) | [
"def",
"format",
"(",
"self",
",",
"tokens",
")",
":",
"return",
"self",
".",
"header_section",
"(",
")",
"+",
"self",
".",
"data_section",
"(",
"tokens",
")"
] | https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/classify/weka.py#L234-L236 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/ftplib.py | python | FTP.getwelcome | (self) | return self.welcome | Get the welcome message from the server.
(this is read and squirreled away by connect()) | Get the welcome message from the server.
(this is read and squirreled away by connect()) | [
"Get",
"the",
"welcome",
"message",
"from",
"the",
"server",
".",
"(",
"this",
"is",
"read",
"and",
"squirreled",
"away",
"by",
"connect",
"()",
")"
] | def getwelcome(self):
'''Get the welcome message from the server.
(this is read and squirreled away by connect())'''
if self.debugging:
print '*welcome*', self.sanitize(self.welcome)
return self.welcome | [
"def",
"getwelcome",
"(",
"self",
")",
":",
"if",
"self",
".",
"debugging",
":",
"print",
"'*welcome*'",
",",
"self",
".",
"sanitize",
"(",
"self",
".",
"welcome",
")",
"return",
"self",
".",
"welcome"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/ftplib.py#L143-L148 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/dynamics/arithmetic_dynamics/wehlerK3.py | python | WehlerK3Surface_ring.sigmaY | (self,P, **kwds) | return self.point(Point, False) | r"""
Function returns the involution on the Wehler K3 surfaces induced by the double covers.
In particular,it fixes the projection to the second coordinate and swaps
the two points in the fiber, i.e. `(x,y) \to (x',y)`.
Note that in the degenerate case, while we can split the fiber into... | r"""
Function returns the involution on the Wehler K3 surfaces induced by the double covers. | [
"r",
"Function",
"returns",
"the",
"involution",
"on",
"the",
"Wehler",
"K3",
"surfaces",
"induced",
"by",
"the",
"double",
"covers",
"."
] | def sigmaY(self,P, **kwds):
r"""
Function returns the involution on the Wehler K3 surfaces induced by the double covers.
In particular,it fixes the projection to the second coordinate and swaps
the two points in the fiber, i.e. `(x,y) \to (x',y)`.
Note that in the degenerate cas... | [
"def",
"sigmaY",
"(",
"self",
",",
"P",
",",
"*",
"*",
"kwds",
")",
":",
"check",
"=",
"kwds",
".",
"get",
"(",
"\"check\"",
",",
"True",
")",
"normalize",
"=",
"kwds",
".",
"get",
"(",
"\"normalize\"",
",",
"True",
")",
"if",
"check",
":",
"if",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py#L1275-L1511 | |
zulip/zulip | 19f891968de50d43920af63526c823bdd233cdee | zerver/lib/import_realm.py | python | get_db_table | (model_class: Any) | return model_class._meta.db_table | E.g. (RealmDomain -> 'zerver_realmdomain') | E.g. (RealmDomain -> 'zerver_realmdomain') | [
"E",
".",
"g",
".",
"(",
"RealmDomain",
"-",
">",
"zerver_realmdomain",
")"
] | def get_db_table(model_class: Any) -> str:
"""E.g. (RealmDomain -> 'zerver_realmdomain')"""
return model_class._meta.db_table | [
"def",
"get_db_table",
"(",
"model_class",
":",
"Any",
")",
"->",
"str",
":",
"return",
"model_class",
".",
"_meta",
".",
"db_table"
] | https://github.com/zulip/zulip/blob/19f891968de50d43920af63526c823bdd233cdee/zerver/lib/import_realm.py#L616-L618 | |
truenas/middleware | b11ec47d6340324f5a32287ffb4012e5d709b934 | src/middlewared/middlewared/plugins/replication.py | python | ReplicationService.create_dataset | (self, dataset, transport, ssh_credentials) | return await self.middleware.call("zettarepl.create_dataset", dataset, transport, ssh_credentials) | Creates dataset on remote side
Accepts `dataset` name, `transport` and SSH credentials ID (for non-local transport)
.. examples(websocket)::
:::javascript
{
"id": "6841f242-840a-11e6-a437-00e04d680384",
"msg": "method",
"method":... | Creates dataset on remote side | [
"Creates",
"dataset",
"on",
"remote",
"side"
] | async def create_dataset(self, dataset, transport, ssh_credentials):
"""
Creates dataset on remote side
Accepts `dataset` name, `transport` and SSH credentials ID (for non-local transport)
.. examples(websocket)::
:::javascript
{
"id": "6841f242... | [
"async",
"def",
"create_dataset",
"(",
"self",
",",
"dataset",
",",
"transport",
",",
"ssh_credentials",
")",
":",
"return",
"await",
"self",
".",
"middleware",
".",
"call",
"(",
"\"zettarepl.create_dataset\"",
",",
"dataset",
",",
"transport",
",",
"ssh_credent... | https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/plugins/replication.py#L711-L732 | |
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | projects/personality_captions/transresnet/transresnet.py | python | TransresnetAgent.reset | (self) | Reset metrics. | Reset metrics. | [
"Reset",
"metrics",
"."
] | def reset(self):
"""
Reset metrics.
"""
super().reset()
self.reset_metrics() | [
"def",
"reset",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"reset",
"(",
")",
"self",
".",
"reset_metrics",
"(",
")"
] | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/projects/personality_captions/transresnet/transresnet.py#L456-L461 | ||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/reportlab/src/reportlab/lib/textsplit.py | python | getCharWidths | (word, fontName, fontSize) | return [stringWidth(uChar, fontName, fontSize) for uChar in word] | Returns a list of glyph widths.
>>> getCharWidths('Hello', 'Courier', 10)
[6.0, 6.0, 6.0, 6.0, 6.0]
>>> from reportlab.pdfbase.cidfonts import UnicodeCIDFont
>>> from reportlab.pdfbase.pdfmetrics import registerFont
>>> registerFont(UnicodeCIDFont('HeiseiMin-W3'))
>>> getCharWidths(u'\u6771\u4E... | Returns a list of glyph widths. | [
"Returns",
"a",
"list",
"of",
"glyph",
"widths",
"."
] | def getCharWidths(word, fontName, fontSize):
"""Returns a list of glyph widths.
>>> getCharWidths('Hello', 'Courier', 10)
[6.0, 6.0, 6.0, 6.0, 6.0]
>>> from reportlab.pdfbase.cidfonts import UnicodeCIDFont
>>> from reportlab.pdfbase.pdfmetrics import registerFont
>>> registerFont(UnicodeCIDFont... | [
"def",
"getCharWidths",
"(",
"word",
",",
"fontName",
",",
"fontSize",
")",
":",
"#character-level function call; the performance is going to SUCK",
"return",
"[",
"stringWidth",
"(",
"uChar",
",",
"fontName",
",",
"fontSize",
")",
"for",
"uChar",
"in",
"word",
"]"
... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/src/reportlab/lib/textsplit.py#L43-L56 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/brain.py | python | Brain._load_pattern_nodes | (self) | [] | def _load_pattern_nodes(self):
self._pattern_factory = PatternNodeFactory()
self._pattern_factory.load(self.bot.client.storage_factory) | [
"def",
"_load_pattern_nodes",
"(",
"self",
")",
":",
"self",
".",
"_pattern_factory",
"=",
"PatternNodeFactory",
"(",
")",
"self",
".",
"_pattern_factory",
".",
"load",
"(",
"self",
".",
"bot",
".",
"client",
".",
"storage_factory",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/brain.py#L334-L336 | ||||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.get_shared_content_remove_invitees | (self) | return self._value | (sharing) Removed invitee from shared file/folder before invite was
accepted
Only call this if :meth:`is_shared_content_remove_invitees` is true.
:rtype: SharedContentRemoveInviteesType | (sharing) Removed invitee from shared file/folder before invite was
accepted | [
"(",
"sharing",
")",
"Removed",
"invitee",
"from",
"shared",
"file",
"/",
"folder",
"before",
"invite",
"was",
"accepted"
] | def get_shared_content_remove_invitees(self):
"""
(sharing) Removed invitee from shared file/folder before invite was
accepted
Only call this if :meth:`is_shared_content_remove_invitees` is true.
:rtype: SharedContentRemoveInviteesType
"""
if not self.is_shared_... | [
"def",
"get_shared_content_remove_invitees",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_shared_content_remove_invitees",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'shared_content_remove_invitees' not set\"",
")",
"return",
"self",
".",
"_value"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L35470-L35481 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/cache.py | python | BaseCache.delete_many | (self, *keys) | return all(self.delete(key) for key in keys) | Deletes multiple keys at once.
:param keys: The function accepts multiple keys as positional
arguments.
:returns: Whether all given keys have been deleted.
:rtype: boolean | Deletes multiple keys at once. | [
"Deletes",
"multiple",
"keys",
"at",
"once",
"."
] | def delete_many(self, *keys):
"""Deletes multiple keys at once.
:param keys: The function accepts multiple keys as positional
arguments.
:returns: Whether all given keys have been deleted.
:rtype: boolean
"""
return all(self.delete(key) for key in ke... | [
"def",
"delete_many",
"(",
"self",
",",
"*",
"keys",
")",
":",
"return",
"all",
"(",
"self",
".",
"delete",
"(",
"key",
")",
"for",
"key",
"in",
"keys",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/cache.py#L199-L207 | |
sphinx-doc/sphinx | e79681c76843c1339863b365747079b2d662d0c1 | sphinx/domains/c.py | python | DefinitionParser._parse_decl_specs_simple | (self, outer: str, typed: bool) | return ASTDeclSpecsSimple(storage, threadLocal, inline,
restrict, volatile, const, attrs) | Just parse the simple ones. | Just parse the simple ones. | [
"Just",
"parse",
"the",
"simple",
"ones",
"."
] | def _parse_decl_specs_simple(self, outer: str, typed: bool) -> ASTDeclSpecsSimple:
"""Just parse the simple ones."""
storage = None
threadLocal = None
inline = None
restrict = None
volatile = None
const = None
attrs = []
while 1: # accept any perm... | [
"def",
"_parse_decl_specs_simple",
"(",
"self",
",",
"outer",
":",
"str",
",",
"typed",
":",
"bool",
")",
"->",
"ASTDeclSpecsSimple",
":",
"storage",
"=",
"None",
"threadLocal",
"=",
"None",
"inline",
"=",
"None",
"restrict",
"=",
"None",
"volatile",
"=",
... | https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/domains/c.py#L2661-L2717 | |
ddbourgin/numpy-ml | b0359af5285fbf9699d64fd5ec059493228af03e | numpy_ml/neural_nets/layers/layers.py | python | FullyConnected.__init__ | (self, n_out, act_fn=None, init="glorot_uniform", optimizer=None) | r"""
A fully-connected (dense) layer.
Notes
-----
A fully connected layer computes the function
.. math::
\mathbf{Y} = f( \mathbf{WX} + \mathbf{b} )
where `f` is the activation nonlinearity, **W** and **b** are
parameters of the layer, and **X** is... | r"""
A fully-connected (dense) layer. | [
"r",
"A",
"fully",
"-",
"connected",
"(",
"dense",
")",
"layer",
"."
] | def __init__(self, n_out, act_fn=None, init="glorot_uniform", optimizer=None):
r"""
A fully-connected (dense) layer.
Notes
-----
A fully connected layer computes the function
.. math::
\mathbf{Y} = f( \mathbf{WX} + \mathbf{b} )
where `f` is the act... | [
"def",
"__init__",
"(",
"self",
",",
"n_out",
",",
"act_fn",
"=",
"None",
",",
"init",
"=",
"\"glorot_uniform\"",
",",
"optimizer",
"=",
"None",
")",
":",
"# noqa: E501",
"super",
"(",
")",
".",
"__init__",
"(",
"optimizer",
")",
"self",
".",
"init",
"... | https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/neural_nets/layers/layers.py#L2011-L2062 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py | python | LimitsProcessor.modifyscripts | (self, contents, index) | Modify the super- and subscript to appear vertically aligned. | Modify the super- and subscript to appear vertically aligned. | [
"Modify",
"the",
"super",
"-",
"and",
"subscript",
"to",
"appear",
"vertically",
"aligned",
"."
] | def modifyscripts(self, contents, index):
"Modify the super- and subscript to appear vertically aligned."
subscript = self.getscript(contents, index)
# subscript removed so instead of index + 1 we get index again
superscript = self.getscript(contents, index)
scripts = TaggedBit().complete([superscri... | [
"def",
"modifyscripts",
"(",
"self",
",",
"contents",
",",
"index",
")",
":",
"subscript",
"=",
"self",
".",
"getscript",
"(",
"contents",
",",
"index",
")",
"# subscript removed so instead of index + 1 we get index again",
"superscript",
"=",
"self",
".",
"getscrip... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py#L4710-L4716 | ||
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/relay/op/tensor.py | python | logical_and | (lhs, rhs) | return _make.logical_and(lhs, rhs) | logical AND with numpy-style broadcasting.
Parameters
----------
lhs : relay.Expr
The left hand side input data
rhs : relay.Expr
The right hand side input data
Returns
-------
result : relay.Expr
The computed result. | logical AND with numpy-style broadcasting. | [
"logical",
"AND",
"with",
"numpy",
"-",
"style",
"broadcasting",
"."
] | def logical_and(lhs, rhs):
"""logical AND with numpy-style broadcasting.
Parameters
----------
lhs : relay.Expr
The left hand side input data
rhs : relay.Expr
The right hand side input data
Returns
-------
result : relay.Expr
The computed result.
"""
ret... | [
"def",
"logical_and",
"(",
"lhs",
",",
"rhs",
")",
":",
"return",
"_make",
".",
"logical_and",
"(",
"lhs",
",",
"rhs",
")"
] | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/op/tensor.py#L668-L683 | |
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/tools/bulkloader.py | python | Exporter.sort_key_from_entity | (self, entity) | return '' | A value to alter sorting of entities in output_entities entity_generator.
Will only be called if calculate_sort_key_from_entity is true.
Args:
entity: A datastore.Entity.
Returns:
A value to store in the intermediate sqlite table. The table will later
be sorted by this value then by the d... | A value to alter sorting of entities in output_entities entity_generator. | [
"A",
"value",
"to",
"alter",
"sorting",
"of",
"entities",
"in",
"output_entities",
"entity_generator",
"."
] | def sort_key_from_entity(self, entity):
"""A value to alter sorting of entities in output_entities entity_generator.
Will only be called if calculate_sort_key_from_entity is true.
Args:
entity: A datastore.Entity.
Returns:
A value to store in the intermediate sqlite table. The table will la... | [
"def",
"sort_key_from_entity",
"(",
"self",
",",
"entity",
")",
":",
"return",
"''"
] | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/tools/bulkloader.py#L3107-L3118 | |
FutunnOpen/py-futu-api | b8f9fb1f26f35f99630ca47863f5595b6e635533 | futu/quote/open_quote_context.py | python | OpenQuoteContext.get_order_book | (self, code, num = 10) | return RET_OK, orderbook | 获取实时摆盘数据
:param code: 股票代码
:param num: 请求摆盘档数,LV2行情用户最多可以获取10档,SF行情用户最多可以获取40档
:return: (ret, data)
ret == RET_OK 返回字典,数据格式如下
ret != RET_OK 返回错误字符串
{‘code’: 股票代码
‘Ask’:[ (ask_price1, ask_volume1, order_num, {order_id1:order_volu... | 获取实时摆盘数据 | [
"获取实时摆盘数据"
] | def get_order_book(self, code, num = 10):
"""
获取实时摆盘数据
:param code: 股票代码
:param num: 请求摆盘档数,LV2行情用户最多可以获取10档,SF行情用户最多可以获取40档
:return: (ret, data)
ret == RET_OK 返回字典,数据格式如下
ret != RET_OK 返回错误字符串
{‘code’: 股票代码
‘Ask... | [
"def",
"get_order_book",
"(",
"self",
",",
"code",
",",
"num",
"=",
"10",
")",
":",
"if",
"code",
"is",
"None",
"or",
"is_str",
"(",
"code",
")",
"is",
"False",
":",
"error_str",
"=",
"ERROR_STR_PREFIX",
"+",
"\"the type of code param is wrong\"",
"return",
... | https://github.com/FutunnOpen/py-futu-api/blob/b8f9fb1f26f35f99630ca47863f5595b6e635533/futu/quote/open_quote_context.py#L1435-L1472 | |
marcosfede/algorithms | 1ee7c815f9d556c9cef4d4b0d21ee3a409d21629 | adventofcode/2018/19/d19.py | python | bori | (r, a, b) | return r[a] | b | [] | def bori(r, a, b):
return r[a] | b | [
"def",
"bori",
"(",
"r",
",",
"a",
",",
"b",
")",
":",
"return",
"r",
"[",
"a",
"]",
"|",
"b"
] | https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/adventofcode/2018/19/d19.py#L30-L31 | |||
descarteslabs/descarteslabs-python | ace8a1a89d58b75df1bcaa613a4b3544d7bdc4be | descarteslabs/workflows/models/workflow.py | python | Workflow.delete | (self, client=None) | Delete this `Workflow` and every `VersionedGraft` it contains.
After deletion, all fields on ``self`` are reset.
**Warning:** this cannot be undone!
Parameters
----------
client: `.workflows.client.Client`, optional
Allows you to use a specific client instance with... | Delete this `Workflow` and every `VersionedGraft` it contains. | [
"Delete",
"this",
"Workflow",
"and",
"every",
"VersionedGraft",
"it",
"contains",
"."
] | def delete(self, client=None):
"""
Delete this `Workflow` and every `VersionedGraft` it contains.
After deletion, all fields on ``self`` are reset.
**Warning:** this cannot be undone!
Parameters
----------
client: `.workflows.client.Client`, optional
... | [
"def",
"delete",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"self",
".",
"_client",
"self",
".",
"delete_id",
"(",
"self",
".",
"id",
",",
"client",
"=",
"client",
")",
"self",
".",
"_messag... | https://github.com/descarteslabs/descarteslabs-python/blob/ace8a1a89d58b75df1bcaa613a4b3544d7bdc4be/descarteslabs/workflows/models/workflow.py#L287-L311 | ||
google/closure-linter | c09c885b4e4fec386ff81cebeb8c66c2b0643d49 | closure_linter/tokenutil.py | python | InsertTokenAfter | (new_token, token) | Insert new_token after token.
Args:
new_token: A token to be added to the stream
token: A token already in the stream | Insert new_token after token. | [
"Insert",
"new_token",
"after",
"token",
"."
] | def InsertTokenAfter(new_token, token):
"""Insert new_token after token.
Args:
new_token: A token to be added to the stream
token: A token already in the stream
"""
new_token.previous = token
new_token.next = token.next
new_token.metadata = copy.copy(token.metadata)
if token.IsCode():
new_t... | [
"def",
"InsertTokenAfter",
"(",
"new_token",
",",
"token",
")",
":",
"new_token",
".",
"previous",
"=",
"token",
"new_token",
".",
"next",
"=",
"token",
".",
"next",
"new_token",
".",
"metadata",
"=",
"copy",
".",
"copy",
"(",
"token",
".",
"metadata",
"... | https://github.com/google/closure-linter/blob/c09c885b4e4fec386ff81cebeb8c66c2b0643d49/closure_linter/tokenutil.py#L290-L324 | ||
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/api.py | python | CobblerAPI.find_package | (self, name: str = "", return_list=False, no_errors=False, **kargs) | return self._collection_mgr.packages().find(name=name, return_list=return_list, no_errors=no_errors, **kargs) | Find a package via a name or keys specified in the ``**kargs``.
:param name: The name to search for.
:param return_list: If only the first result or all results should be returned.
:param no_errors: Silence some errors which would raise if this turned to False.
:param kargs: Additional ... | Find a package via a name or keys specified in the ``**kargs``. | [
"Find",
"a",
"package",
"via",
"a",
"name",
"or",
"keys",
"specified",
"in",
"the",
"**",
"kargs",
"."
] | def find_package(self, name: str = "", return_list=False, no_errors=False, **kargs):
"""
Find a package via a name or keys specified in the ``**kargs``.
:param name: The name to search for.
:param return_list: If only the first result or all results should be returned.
:param no... | [
"def",
"find_package",
"(",
"self",
",",
"name",
":",
"str",
"=",
"\"\"",
",",
"return_list",
"=",
"False",
",",
"no_errors",
"=",
"False",
",",
"*",
"*",
"kargs",
")",
":",
"return",
"self",
".",
"_collection_mgr",
".",
"packages",
"(",
")",
".",
"f... | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/api.py#L981-L991 | |
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/appearance/nayatani95.py | python | illuminance_to_luminance | (E, Y_f) | return Y_f * E / (100 * np.pi) | Converts given *illuminance* :math:`E` value in lux to *luminance* in
:math:`cd/m^2`.
Parameters
----------
E : numeric or array_like
*Illuminance* :math:`E` in lux.
Y_f : numeric or array_like
*Luminance* factor :math:`Y_f` in :math:`cd/m^2`.
Returns
-------
numeric or... | Converts given *illuminance* :math:`E` value in lux to *luminance* in
:math:`cd/m^2`. | [
"Converts",
"given",
"*",
"illuminance",
"*",
":",
"math",
":",
"E",
"value",
"in",
"lux",
"to",
"*",
"luminance",
"*",
"in",
":",
"math",
":",
"cd",
"/",
"m^2",
"."
] | def illuminance_to_luminance(E, Y_f):
"""
Converts given *illuminance* :math:`E` value in lux to *luminance* in
:math:`cd/m^2`.
Parameters
----------
E : numeric or array_like
*Illuminance* :math:`E` in lux.
Y_f : numeric or array_like
*Luminance* factor :math:`Y_f` in :math... | [
"def",
"illuminance_to_luminance",
"(",
"E",
",",
"Y_f",
")",
":",
"E",
"=",
"as_float_array",
"(",
"E",
")",
"Y_f",
"=",
"as_float_array",
"(",
"Y_f",
")",
"return",
"Y_f",
"*",
"E",
"/",
"(",
"100",
"*",
"np",
".",
"pi",
")"
] | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/appearance/nayatani95.py#L342-L368 | |
suragnair/seqGAN | ae8ffcd54977bd9ee177994c751f86d34f5f7aa3 | discriminator.py | python | Discriminator.batchBCELoss | (self, inp, target) | return loss_fn(out, target) | Returns Binary Cross Entropy Loss for discriminator.
Inputs: inp, target
- inp: batch_size x seq_len
- target: batch_size (binary 1/0) | Returns Binary Cross Entropy Loss for discriminator. | [
"Returns",
"Binary",
"Cross",
"Entropy",
"Loss",
"for",
"discriminator",
"."
] | def batchBCELoss(self, inp, target):
"""
Returns Binary Cross Entropy Loss for discriminator.
Inputs: inp, target
- inp: batch_size x seq_len
- target: batch_size (binary 1/0)
"""
loss_fn = nn.BCELoss()
h = self.init_hidden(inp.size()[0])
... | [
"def",
"batchBCELoss",
"(",
"self",
",",
"inp",
",",
"target",
")",
":",
"loss_fn",
"=",
"nn",
".",
"BCELoss",
"(",
")",
"h",
"=",
"self",
".",
"init_hidden",
"(",
"inp",
".",
"size",
"(",
")",
"[",
"0",
"]",
")",
"out",
"=",
"self",
".",
"forw... | https://github.com/suragnair/seqGAN/blob/ae8ffcd54977bd9ee177994c751f86d34f5f7aa3/discriminator.py#L57-L69 | |
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_tools_resource/forms.py | python | VersionFormHelper.__init__ | (self, allow_edit=True, res_short_id=None,
element_id=None, element_name=None, *args, **kwargs) | [] | def __init__(self, allow_edit=True, res_short_id=None,
element_id=None, element_name=None, *args, **kwargs):
# the order in which the model fields are
# listed for the FieldSet is the order these fields will be displayed
field_width = 'form-control input-sm'
layout = Lay... | [
"def",
"__init__",
"(",
"self",
",",
"allow_edit",
"=",
"True",
",",
"res_short_id",
"=",
"None",
",",
"element_id",
"=",
"None",
",",
"element_name",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# the order in which the model fields ar... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_tools_resource/forms.py#L417-L432 | ||||
mit-ll/LL-Fuzzer | 7c532a55cfd7dba9445afa39bd25574a320e1a69 | nfc/llcp/__init__.py | python | getpeername | (sid) | getpeername() returns the address of the peer connected to the
socket *sid*, or None if the socket is presently not connected. | getpeername() returns the address of the peer connected to the
socket *sid*, or None if the socket is presently not connected. | [
"getpeername",
"()",
"returns",
"the",
"address",
"of",
"the",
"peer",
"connected",
"to",
"the",
"socket",
"*",
"sid",
"*",
"or",
"None",
"if",
"the",
"socket",
"is",
"presently",
"not",
"connected",
"."
] | def getpeername(sid):
"""getpeername() returns the address of the peer connected to the
socket *sid*, or None if the socket is presently not connected.
"""
if _llc is not None:
return _llc.getpeername(sid) | [
"def",
"getpeername",
"(",
"sid",
")",
":",
"if",
"_llc",
"is",
"not",
"None",
":",
"return",
"_llc",
".",
"getpeername",
"(",
"sid",
")"
] | https://github.com/mit-ll/LL-Fuzzer/blob/7c532a55cfd7dba9445afa39bd25574a320e1a69/nfc/llcp/__init__.py#L184-L189 | ||
staticafi/symbiotic | 792b3b8112cb837a58d878129e8bc7a919d1a2f7 | lib/symbioticpy/symbiotic/benchexec/tools/smack.py | python | Tool.cmdline | (self, executable, options, tasks, propertyfile=None, rlimits={}) | return [executable] + options + prop + tasks | Allows us to define special actions to be taken or command line argument
modifications to make just before calling SMACK. | Allows us to define special actions to be taken or command line argument
modifications to make just before calling SMACK. | [
"Allows",
"us",
"to",
"define",
"special",
"actions",
"to",
"be",
"taken",
"or",
"command",
"line",
"argument",
"modifications",
"to",
"make",
"just",
"before",
"calling",
"SMACK",
"."
] | def cmdline(self, executable, options, tasks, propertyfile=None, rlimits={}):
"""
Allows us to define special actions to be taken or command line argument
modifications to make just before calling SMACK.
"""
assert len(tasks) == 1
assert propertyfile is not None
p... | [
"def",
"cmdline",
"(",
"self",
",",
"executable",
",",
"options",
",",
"tasks",
",",
"propertyfile",
"=",
"None",
",",
"rlimits",
"=",
"{",
"}",
")",
":",
"assert",
"len",
"(",
"tasks",
")",
"==",
"1",
"assert",
"propertyfile",
"is",
"not",
"None",
"... | https://github.com/staticafi/symbiotic/blob/792b3b8112cb837a58d878129e8bc7a919d1a2f7/lib/symbioticpy/symbiotic/benchexec/tools/smack.py#L66-L74 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/gdata/build/lib/atom/mock_http.py | python | MockHttpClient.add_response | (self, response, operation, url, data=None, headers=None) | Adds a request-response pair to the recordings list.
After the recording is added, future matching requests will receive the
response.
Args:
response: MockResponse
operation: str
url: str
data: str, Currently the data is ignored when looking for matching
requests.... | Adds a request-response pair to the recordings list.
After the recording is added, future matching requests will receive the
response.
Args:
response: MockResponse
operation: str
url: str
data: str, Currently the data is ignored when looking for matching
requests.... | [
"Adds",
"a",
"request",
"-",
"response",
"pair",
"to",
"the",
"recordings",
"list",
".",
"After",
"the",
"recording",
"is",
"added",
"future",
"matching",
"requests",
"will",
"receive",
"the",
"response",
".",
"Args",
":",
"response",
":",
"MockResponse",
"o... | def add_response(self, response, operation, url, data=None, headers=None):
"""Adds a request-response pair to the recordings list.
After the recording is added, future matching requests will receive the
response.
Args:
response: MockResponse
operation: str
url: str
data... | [
"def",
"add_response",
"(",
"self",
",",
"response",
",",
"operation",
",",
"url",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"request",
"=",
"MockRequest",
"(",
"operation",
",",
"url",
",",
"data",
"=",
"data",
",",
"headers",
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/build/lib/atom/mock_http.py#L88-L104 | ||
openstack/trove | be86b79119d16ee77f596172f43b0c97cb2617bd | trove/guestagent/common/operating_system.py | python | FileMode.get_remove_mode | (self) | return self._combine_modes(self._remove) | Get the net (combined) mode that will be removed. | Get the net (combined) mode that will be removed. | [
"Get",
"the",
"net",
"(",
"combined",
")",
"mode",
"that",
"will",
"be",
"removed",
"."
] | def get_remove_mode(self):
"""Get the net (combined) mode that will be removed.
"""
return self._combine_modes(self._remove) | [
"def",
"get_remove_mode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_combine_modes",
"(",
"self",
".",
"_remove",
")"
] | https://github.com/openstack/trove/blob/be86b79119d16ee77f596172f43b0c97cb2617bd/trove/guestagent/common/operating_system.py#L311-L314 | |
getlogbook/logbook | 3e0badb395ed8d0038d02996d38aa0505441327e | logbook/handlers.py | python | MailHandler.get_recipients | (self, record) | return self.recipients | Returns the recipients for a record. By default the
:attr:`recipients` attribute is returned for all records. | Returns the recipients for a record. By default the
:attr:`recipients` attribute is returned for all records. | [
"Returns",
"the",
"recipients",
"for",
"a",
"record",
".",
"By",
"default",
"the",
":",
"attr",
":",
"recipients",
"attribute",
"is",
"returned",
"for",
"all",
"records",
"."
] | def get_recipients(self, record):
"""Returns the recipients for a record. By default the
:attr:`recipients` attribute is returned for all records.
"""
return self.recipients | [
"def",
"get_recipients",
"(",
"self",
",",
"record",
")",
":",
"return",
"self",
".",
"recipients"
] | https://github.com/getlogbook/logbook/blob/3e0badb395ed8d0038d02996d38aa0505441327e/logbook/handlers.py#L1255-L1259 | |
determined-ai/determined | f637264493acc14f12e66550cb51c520b5d27f6c | harness/determined/common/experimental/model.py | python | Model.remove_metadata | (self, keys: List[str]) | Removes user-defined metadata from the model. Any top-level keys that
appear in the ``keys`` list are removed from the model.
Arguments:
keys (List[string]): Top-level keys to remove from the model metadata. | Removes user-defined metadata from the model. Any top-level keys that
appear in the ``keys`` list are removed from the model. | [
"Removes",
"user",
"-",
"defined",
"metadata",
"from",
"the",
"model",
".",
"Any",
"top",
"-",
"level",
"keys",
"that",
"appear",
"in",
"the",
"keys",
"list",
"are",
"removed",
"from",
"the",
"model",
"."
] | def remove_metadata(self, keys: List[str]) -> None:
"""
Removes user-defined metadata from the model. Any top-level keys that
appear in the ``keys`` list are removed from the model.
Arguments:
keys (List[string]): Top-level keys to remove from the model metadata.
"""... | [
"def",
"remove_metadata",
"(",
"self",
",",
"keys",
":",
"List",
"[",
"str",
"]",
")",
"->",
"None",
":",
"for",
"key",
"in",
"keys",
":",
"if",
"key",
"in",
"self",
".",
"metadata",
":",
"del",
"self",
".",
"metadata",
"[",
"key",
"]",
"self",
"... | https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/harness/determined/common/experimental/model.py#L267-L282 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/mailbox.py | python | _unlock_file | (f) | Unlock file f using lockf and dot locking. | Unlock file f using lockf and dot locking. | [
"Unlock",
"file",
"f",
"using",
"lockf",
"and",
"dot",
"locking",
"."
] | def _unlock_file(f):
"""Unlock file f using lockf and dot locking."""
if fcntl:
fcntl.lockf(f, fcntl.LOCK_UN)
if os.path.exists(f.name + '.lock'):
os.remove(f.name + '.lock') | [
"def",
"_unlock_file",
"(",
"f",
")",
":",
"if",
"fcntl",
":",
"fcntl",
".",
"lockf",
"(",
"f",
",",
"fcntl",
".",
"LOCK_UN",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"f",
".",
"name",
"+",
"'.lock'",
")",
":",
"os",
".",
"remove",
"("... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/mailbox.py#L2100-L2105 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/cherrypy/cherrypy/_cptools.py | python | SessionTool.regenerate | (self) | Drop the current session and make a new one (with a new id). | Drop the current session and make a new one (with a new id). | [
"Drop",
"the",
"current",
"session",
"and",
"make",
"a",
"new",
"one",
"(",
"with",
"a",
"new",
"id",
")",
"."
] | def regenerate(self):
"""Drop the current session and make a new one (with a new id)."""
sess = cherrypy.serving.session
sess.regenerate()
# Grab cookie-relevant tool args
conf = dict([(k, v) for k, v in self._merged_args().items()
if k in ('path', '... | [
"def",
"regenerate",
"(",
"self",
")",
":",
"sess",
"=",
"cherrypy",
".",
"serving",
".",
"session",
"sess",
".",
"regenerate",
"(",
")",
"# Grab cookie-relevant tool args",
"conf",
"=",
"dict",
"(",
"[",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/cherrypy/cherrypy/_cptools.py#L305-L314 | ||
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/gui/preview_image.py | python | ExportImagePreview._get_in_memory_preview | (self, layer) | return layer_preview_pixbuf | [] | def _get_in_memory_preview(self, layer):
self._preview_width, self._preview_height = self._get_preview_size(
layer.width, layer.height)
self._preview_scaling_factor = self._preview_width / layer.width
image_preview = self._get_image_preview()
if image_preview is None or not pdb.gimp_imag... | [
"def",
"_get_in_memory_preview",
"(",
"self",
",",
"layer",
")",
":",
"self",
".",
"_preview_width",
",",
"self",
".",
"_preview_height",
"=",
"self",
".",
"_get_preview_size",
"(",
"layer",
".",
"width",
",",
"layer",
".",
"height",
")",
"self",
".",
"_pr... | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/gui/preview_image.py#L321-L355 | |||
Dozed12/df-style-worldgen | 937455d54f4b02df9c4b10ae6418f4c932fd97bf | libtcodpy.py | python | console_fill_background | (con,r,g,b) | [] | def console_fill_background(con,r,g,b) :
if len(r) != len(g) or len(r) != len(b):
raise TypeError('R, G and B must all have the same size.')
if (numpy_available and isinstance(r, numpy.ndarray) and
isinstance(g, numpy.ndarray) and isinstance(b, numpy.ndarray)):
#numpy arrays, use numpy'... | [
"def",
"console_fill_background",
"(",
"con",
",",
"r",
",",
"g",
",",
"b",
")",
":",
"if",
"len",
"(",
"r",
")",
"!=",
"len",
"(",
"g",
")",
"or",
"len",
"(",
"r",
")",
"!=",
"len",
"(",
"b",
")",
":",
"raise",
"TypeError",
"(",
"'R, G and B m... | https://github.com/Dozed12/df-style-worldgen/blob/937455d54f4b02df9c4b10ae6418f4c932fd97bf/libtcodpy.py#L931-L950 | ||||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3codec.py | python | S3Codec.encode | (self, resource, **attr) | API Method to encode a resource in the target format,
to be implemented by the subclass (mandatory)
Args:
resource: the S3Resource
Returns:
a handle to the output | API Method to encode a resource in the target format,
to be implemented by the subclass (mandatory) | [
"API",
"Method",
"to",
"encode",
"a",
"resource",
"in",
"the",
"target",
"format",
"to",
"be",
"implemented",
"by",
"the",
"subclass",
"(",
"mandatory",
")"
] | def encode(self, resource, **attr):
"""
API Method to encode a resource in the target format,
to be implemented by the subclass (mandatory)
Args:
resource: the S3Resource
Returns:
a handle to the output
"""
raise N... | [
"def",
"encode",
"(",
"self",
",",
"resource",
",",
"*",
"*",
"attr",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3codec.py#L84-L95 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/bdb.py | python | Bdb.set_step | (self) | return | Stop after one line of code. | Stop after one line of code. | [
"Stop",
"after",
"one",
"line",
"of",
"code",
"."
] | def set_step(self):
"""Stop after one line of code."""
self._set_stopinfo(None, None)
return | [
"def",
"set_step",
"(",
"self",
")",
":",
"self",
".",
"_set_stopinfo",
"(",
"None",
",",
"None",
")",
"return"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/bdb.py#L176-L179 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.