From 431f4e6ff07027fda52012480ba98c5ea882fa33 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 23 Dec 2024 02:04:39 -0500 Subject: [PATCH 01/15] first pass --- lib/ts_utils/metadata.py | 9 ++-- lib/ts_utils/utils.py | 1 - pyproject.toml | 52 ++++++++++++++++--- scripts/stubsabot.py | 15 +++--- scripts/sync_protobuf/_utils.py | 6 ++- scripts/sync_protobuf/google_protobuf.py | 18 +++---- scripts/sync_protobuf/s2clientprotocol.py | 13 +++-- scripts/sync_protobuf/tensorflow.py | 12 ++--- stubs/protobuf/google/protobuf/any_pb2.pyi | 3 +- stubs/protobuf/google/protobuf/api_pb2.pyi | 3 +- .../google/protobuf/compiler/plugin_pb2.pyi | 3 +- .../google/protobuf/descriptor_pb2.pyi | 4 +- .../protobuf/google/protobuf/duration_pb2.pyi | 3 +- stubs/protobuf/google/protobuf/empty_pb2.pyi | 3 +- .../google/protobuf/field_mask_pb2.pyi | 3 +- .../google/protobuf/source_context_pb2.pyi | 3 +- stubs/protobuf/google/protobuf/struct_pb2.pyi | 3 +- .../google/protobuf/timestamp_pb2.pyi | 3 +- stubs/protobuf/google/protobuf/type_pb2.pyi | 3 +- .../protobuf/google/protobuf/wrappers_pb2.pyi | 3 +- .../s2clientprotocol/common_pb2.pyi | 3 +- .../s2clientprotocol/data_pb2.pyi | 3 +- .../s2clientprotocol/debug_pb2.pyi | 3 +- .../s2clientprotocol/error_pb2.pyi | 3 +- .../s2clientprotocol/query_pb2.pyi | 3 +- .../s2clientprotocol/raw_pb2.pyi | 15 ++---- .../s2clientprotocol/sc2api_pb2.pyi | 15 ++---- .../s2clientprotocol/score_pb2.pyi | 3 +- .../s2clientprotocol/spatial_pb2.pyi | 15 ++---- .../s2clientprotocol/ui_pb2.pyi | 11 ++-- .../compiler/xla/service/hlo_pb2.pyi | 3 +- .../service/hlo_profile_printer_data_pb2.pyi | 3 +- .../compiler/xla/service/metrics_pb2.pyi | 3 +- .../test_compilation_environment_pb2.pyi | 3 +- .../xla/service/xla_compile_result_pb2.pyi | 3 +- .../xla/tsl/protobuf/bfc_memory_map_pb2.pyi | 3 +- .../xla/tsl/protobuf/test_log_pb2.pyi | 6 +-- .../tensorflow/compiler/xla/xla_data_pb2.pyi | 3 +- .../tensorflow/compiler/xla/xla_pb2.pyi | 3 +- .../example_parser_configuration_pb2.pyi | 6 +-- .../tensorflow/core/example/example_pb2.pyi | 3 +- .../tensorflow/core/example/feature_pb2.pyi | 3 +- .../framework/allocation_description_pb2.pyi | 3 +- .../tensorflow/core/framework/api_def_pb2.pyi | 3 +- .../core/framework/attr_value_pb2.pyi | 5 +- .../core/framework/cost_graph_pb2.pyi | 3 +- .../framework/cpp_shape_inference_pb2.pyi | 3 +- .../core/framework/dataset_metadata_pb2.pyi | 3 +- .../core/framework/dataset_options_pb2.pyi | 3 +- .../tensorflow/core/framework/dataset_pb2.pyi | 3 +- .../core/framework/device_attributes_pb2.pyi | 3 +- .../core/framework/full_type_pb2.pyi | 3 +- .../core/framework/function_pb2.pyi | 3 +- .../core/framework/graph_debug_info_pb2.pyi | 3 +- .../tensorflow/core/framework/graph_pb2.pyi | 3 +- .../framework/graph_transfer_info_pb2.pyi | 3 +- .../core/framework/kernel_def_pb2.pyi | 3 +- .../core/framework/log_memory_pb2.pyi | 3 +- .../tensorflow/core/framework/model_pb2.pyi | 3 +- .../core/framework/node_def_pb2.pyi | 3 +- .../tensorflow/core/framework/op_def_pb2.pyi | 3 +- .../optimized_function_graph_pb2.pyi | 3 +- .../core/framework/reader_base_pb2.pyi | 3 +- .../core/framework/resource_handle_pb2.pyi | 3 +- .../core/framework/step_stats_pb2.pyi | 3 +- .../tensorflow/core/framework/summary_pb2.pyi | 3 +- .../core/framework/tensor_description_pb2.pyi | 3 +- .../tensorflow/core/framework/tensor_pb2.pyi | 3 +- .../core/framework/tensor_shape_pb2.pyi | 6 +-- .../core/framework/tensor_slice_pb2.pyi | 6 +-- .../tensorflow/core/framework/types_pb2.pyi | 3 +- .../core/framework/variable_pb2.pyi | 3 +- .../core/framework/versions_pb2.pyi | 3 +- .../core/protobuf/bfc_memory_map_pb2.pyi | 3 +- .../tensorflow/core/protobuf/cluster_pb2.pyi | 7 ++- .../protobuf/composite_tensor_variant_pb2.pyi | 3 +- .../tensorflow/core/protobuf/config_pb2.pyi | 6 +-- .../core/protobuf/control_flow_pb2.pyi | 3 +- .../protobuf/core_platform_payloads_pb2.pyi | 3 +- .../core/protobuf/data_service_pb2.pyi | 3 +- .../core/protobuf/debug_event_pb2.pyi | 3 +- .../tensorflow/core/protobuf/debug_pb2.pyi | 3 +- .../core/protobuf/device_filters_pb2.pyi | 7 ++- .../core/protobuf/device_properties_pb2.pyi | 3 +- .../core/protobuf/error_codes_pb2.pyi | 3 +- .../core/protobuf/fingerprint_pb2.pyi | 3 +- .../core/protobuf/meta_graph_pb2.pyi | 3 +- .../core/protobuf/named_tensor_pb2.pyi | 3 +- .../core/protobuf/queue_runner_pb2.pyi | 3 +- .../protobuf/remote_tensor_handle_pb2.pyi | 3 +- .../core/protobuf/rewriter_config_pb2.pyi | 5 +- .../core/protobuf/rpc_options_pb2.pyi | 3 +- .../core/protobuf/saved_model_pb2.pyi | 3 +- .../core/protobuf/saved_object_graph_pb2.pyi | 3 +- .../tensorflow/core/protobuf/saver_pb2.pyi | 3 +- .../core/protobuf/service_config_pb2.pyi | 3 +- .../tensorflow/core/protobuf/snapshot_pb2.pyi | 3 +- .../tensorflow/core/protobuf/status_pb2.pyi | 3 +- .../tensorflow/core/protobuf/struct_pb2.pyi | 3 +- .../core/protobuf/tensor_bundle_pb2.pyi | 3 +- .../core/protobuf/tensorflow_server_pb2.pyi | 3 +- .../protobuf/tpu/compilation_result_pb2.pyi | 3 +- .../core/protobuf/tpu/dynamic_padding_pb2.pyi | 3 +- .../tpu/optimization_parameters_pb2.pyi | 3 +- .../core/protobuf/tpu/topology_pb2.pyi | 3 +- .../tpu/tpu_embedding_configuration_pb2.pyi | 3 +- .../protobuf/trackable_object_graph_pb2.pyi | 3 +- .../core/protobuf/transport_options_pb2.pyi | 3 +- .../core/protobuf/verifier_config_pb2.pyi | 3 +- .../tensorflow/core/util/event_pb2.pyi | 3 +- .../core/util/memmapped_file_system_pb2.pyi | 3 +- .../core/util/saved_tensor_slice_pb2.pyi | 3 +- .../tensorflow/core/util/test_log_pb2.pyi | 6 +-- .../keras/protobuf/projector_config_pb2.pyi | 3 +- .../keras/protobuf/saved_metadata_pb2.pyi | 6 +-- .../python/keras/protobuf/versions_pb2.pyi | 3 +- .../tsl/protobuf/coordination_config_pb2.pyi | 3 +- .../tsl/protobuf/coordination_service_pb2.pyi | 3 +- .../distributed_runtime_payloads_pb2.pyi | 3 +- .../tensorflow/tsl/protobuf/dnn_pb2.pyi | 6 +-- .../tsl/protobuf/error_codes_pb2.pyi | 5 +- .../tensorflow/tsl/protobuf/histogram_pb2.pyi | 3 +- .../tsl/protobuf/rpc_options_pb2.pyi | 3 +- .../tensorflow/tsl/protobuf/status_pb2.pyi | 3 +- tests/check_typeshed_structure.py | 3 +- tests/mypy_test.py | 17 +++--- tests/pytype_test.py | 2 +- tests/regr_test.py | 1 - tests/stubtest_stdlib.py | 2 +- tests/stubtest_third_party.py | 5 +- 130 files changed, 243 insertions(+), 344 deletions(-) diff --git a/lib/ts_utils/metadata.py b/lib/ts_utils/metadata.py index 2ae052d64799..625fa517d5dd 100644 --- a/lib/ts_utils/metadata.py +++ b/lib/ts_utils/metadata.py @@ -23,8 +23,8 @@ __all__ = [ "NoSuchStubError", - "StubMetadata", "PackageDependencies", + "StubMetadata", "StubtestSettings", "get_recursive_requirements", "read_dependencies", @@ -184,7 +184,7 @@ def is_obsolete(self) -> bool: class NoSuchStubError(ValueError): - """Raise NoSuchStubError to indicate that a stubs/{distribution} directory doesn't exist""" + """Raise NoSuchStubError to indicate that a stubs/{distribution} directory doesn't exist.""" @cache @@ -304,7 +304,8 @@ def read_metadata(distribution: str) -> StubMetadata: def update_metadata(distribution: str, **new_values: object) -> tomlkit.TOMLDocument: """Updates a distribution's METADATA.toml. - Return the updated TOML dictionary for use without having to open the file separately.""" + Return the updated TOML dictionary for use without having to open the file separately. + """ path = metadata_path(distribution) try: with path.open("rb") as file: @@ -329,7 +330,7 @@ class PackageDependencies(NamedTuple): @cache def get_pypi_name_to_typeshed_name_mapping() -> Mapping[str, str]: - return {read_metadata(dir.name).stub_distribution: dir.name for dir in STUBS_PATH.iterdir()} + return {read_metadata(directory.name).stub_distribution: directory.name for directory in STUBS_PATH.iterdir()} @cache diff --git a/lib/ts_utils/utils.py b/lib/ts_utils/utils.py index 4dfe05488275..4cee6797837e 100644 --- a/lib/ts_utils/utils.py +++ b/lib/ts_utils/utils.py @@ -92,7 +92,6 @@ def venv_python(venv_dir: Path) -> Path: @cache def parse_requirements() -> Mapping[str, Requirement]: """Return a dictionary of requirements from the requirements file.""" - with REQUIREMENTS_PATH.open(encoding="UTF-8") as requirements_file: stripped_lines = map(strip_comments, requirements_file) stripped_more = [li for li in stripped_lines if not li.startswith("-")] diff --git a/pyproject.toml b/pyproject.toml index 501066318b0b..e47eb870a27a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,11 +37,19 @@ exclude = ["**/test_cases/**/*.py"] # tell ruff not to flag these as e.g. "unused noqa comments" external = ["F821", "NQA", "Y"] select = [ + "A", # flake8-builtins + "ASYNC", # flake8-async "B", # flake8-bugbear + "BLE", # flake8-blind-except + "D", # pydocstyle "FA", # flake8-future-annotations + "FBT", # flake8-boolean-trap "I", # isort + "N", # pep8-naming "RUF", # Ruff-specific and unused-noqa + "S", # flake8-bandit "UP", # pyupgrade + "YTT", # flake8-2020 # Flake8 base rules "E", # pycodestyle Error "F", # Pyflakes @@ -71,10 +79,8 @@ extend-safe-fixes = [ "UP036", # Remove unnecessary `sys.version_info` blocks ] ignore = [ - # TODO: Ruff 0.8.0 added sorting of __all__ and __slots_. Validate whether we want this in stubs - "RUF022", - "RUF023", - + # TODO + "ASYNC221", ### # Rules that can conflict with the formatter (Black) # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules @@ -86,11 +92,26 @@ ignore = [ ### # Rules we don't want or don't agree with ### - # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871 - "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` + # We're not a library, no need to document everything + "D1", # Missing docstring in ... + # We want D211: No blank lines allowed before class docstring + "D203", # 1 blank line required before class docstring + # Doesn't support split "summary line" + "D205", # 1 blank line required between summary line and description + # We want D212: Multi-line docstring summary should start at the first line + "D213", # Multi-line docstring summary should start at the second line + "D401", # First line of docstring should be in imperative mood # Used for direct, non-subclass type comparison, for example: `type(val) is str` # see https://github.com/astral-sh/ruff/issues/6465 "E721", # Do not compare types, use `isinstance()` + # Typeshed tests and scripts are never run in optimized mode + "S101", # Use of assert detected + # Prone to false positives astral-sh/ruff#4045 + "S603", # subprocess call: check for execution of untrusted input + # Full paths would make cross-environment compatibility a nightmare + "S607", # Starting a process with a partial executable path + # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871 + "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` ### # False-positives, but already checked by type-checkers ### @@ -100,17 +121,32 @@ ignore = [ [tool.ruff.lint.per-file-ignores] "*.pyi" = [ - # Most flake8-bugbear rules don't apply for third-party stubs like typeshed. + # TODO: Ruff 0.8.0 added sorting of __all__ and __slots_. Validate whether we want this in stubs + "RUF022", + "RUF023", + # Most flake8-bugbear and pep8-naming rules don't apply for third-party stubs like typeshed. # B033 could be slightly useful but Ruff doesn't have per-file select "B", # flake8-bugbear + "N", # pep8-naming # Rules that are out of the control of stub authors: + "A001", # builtin-variable-shadowing + "A002", # builtin-argument-shadowing + "A004", # builtin-import-shadowing "F403", # `from . import *` used; unable to detect undefined names + "S105", + "S107", # Stubs can sometimes re-export entire modules. # Issues with using a star-imported name will be caught by type-checkers. "F405", # may be undefined, or defined from star imports ] -# See comment on black's force-exclude config above "*_pb2.pyi" = [ + # Non-autofixable docstring lints on autogenerated modules + "D210", # No whitespaces allowed surrounding docstring text + # These modify the docstring content + "D301", # Use r""" if any backslashes in a docstring + "D40", + "D415", # First line should end with a period, question mark, or exclamation point + # See comment on black's force-exclude config above "E501", # Line too long ] diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index aee09eb3e8a2..418e00338ff6 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -248,8 +248,7 @@ async def find_first_release_with_py_typed(pypi_info: PypiInfo, *, session: aioh def get_updated_version_spec(spec: Specifier, version: packaging.version.Version) -> Specifier: - """ - Given the old specifier and an updated version, returns an updated specifier that has the + """Given the old specifier and an updated version, returns an updated specifier that has the specificity of the old specifier, but matches the updated version. For example: @@ -293,8 +292,7 @@ class GitHubInfo: async def get_github_repo_info(session: aiohttp.ClientSession, stub_info: StubMetadata) -> GitHubInfo | None: - """ - If the project represented by `stub_info` is hosted on GitHub, + """If the project represented by `stub_info` is hosted on GitHub, return information regarding the project as it exists on GitHub. Else, return None. @@ -374,8 +372,7 @@ class DiffAnalysis: @property def runtime_definitely_has_consistent_directory_structure_with_typeshed(self) -> bool: - """ - If 0 .py files in the GitHub diff exist in typeshed's stubs, + """If 0 .py files in the GitHub diff exist in typeshed's stubs, there's a possibility that the .py files might be found in a different directory at runtime. @@ -632,13 +629,13 @@ def latest_commit_is_different_to_last_commit_on_origin(branch: str) -> bool: return True -class RemoteConflict(Exception): +class RemoteConflictError(Exception): pass def somewhat_safe_force_push(branch: str) -> None: if has_non_stubsabot_commits(branch): - raise RemoteConflict(f"origin/{branch} has non-stubsabot changes that are not on {branch}!") + raise RemoteConflictError(f"origin/{branch} has non-stubsabot changes that are not on {branch}!") subprocess.check_call(["git", "push", "origin", branch, "--force"]) @@ -808,7 +805,7 @@ async def main() -> None: if isinstance(update, Obsolete): # pyright: ignore[reportUnnecessaryIsInstance] await suggest_typeshed_obsolete(update, session, action_level=args.action_level) continue - except RemoteConflict as e: + except RemoteConflictError as e: print(colored(f"... but ran into {type(e).__qualname__}: {e}", "red")) continue raise AssertionError diff --git a/scripts/sync_protobuf/_utils.py b/scripts/sync_protobuf/_utils.py index b27b566ad3d8..7ad1b39cf408 100644 --- a/scripts/sync_protobuf/_utils.py +++ b/scripts/sync_protobuf/_utils.py @@ -18,9 +18,11 @@ def download_file(url: str, destination: StrPath) -> None: + if not url.startswith(("http:", "https:")): + raise ValueError("URL must start with 'http:' or 'https:'") print(f"Downloading '{url}' to '{destination}'") resp: HTTPResponse - with urlopen(url) as resp, open(destination, "wb") as file: + with urlopen(url) as resp, open(destination, "wb") as file: # noqa: S310 # Validated file.write(resp.read()) @@ -33,7 +35,7 @@ def extract_archive(archive_path: StrPath, destination: StrPath) -> None: def run_protoc( proto_paths: Iterable[StrPath], mypy_out: StrPath, proto_globs: Iterable[str], cwd: StrOrBytesPath | None = None ) -> str: - """TODO: Describe parameters and return""" + """TODO: Describe parameters and return.""" protoc_version = ( subprocess.run([sys.executable, "-m", "grpc_tools.protoc", "--version"], capture_output=True).stdout.decode().strip() ) diff --git a/scripts/sync_protobuf/google_protobuf.py b/scripts/sync_protobuf/google_protobuf.py index da2ced6f9fc7..0bd69dbf83db 100644 --- a/scripts/sync_protobuf/google_protobuf.py +++ b/scripts/sync_protobuf/google_protobuf.py @@ -1,5 +1,4 @@ -""" -Generates the protobuf stubs for the given protobuf version using mypy-protobuf. +"""Generates the protobuf stubs for the given protobuf version using mypy-protobuf. Generally, new minor versions are a good time to update the stubs. """ @@ -31,7 +30,7 @@ def extract_python_version(file_path: Path) -> str: - """Extract the Python version from https://github.com/protocolbuffers/protobuf/blob/main/version.json""" + """Extract the Python version from https://github.com/protocolbuffers/protobuf/blob/main/version.json .""" with open(file_path) as file: data: dict[str, Any] = json.load(file) # The root key will be the protobuf source code version @@ -41,10 +40,9 @@ def extract_python_version(file_path: Path) -> str: def extract_proto_file_paths(temp_dir: Path) -> list[str]: - """ - Roughly reproduce the subset of .proto files on the public interface + """Roughly reproduce the subset of .proto files on the public interface as described in py_proto_library calls in - https://github.com/protocolbuffers/protobuf/blob/main/python/dist/BUILD.bazel + https://github.com/protocolbuffers/protobuf/blob/main/python/dist/BUILD.bazel . """ with open(temp_dir / EXTRACTED_PACKAGE_DIR / "python" / "dist" / "BUILD.bazel") as file: matched_lines = filter(None, (re.search(PROTO_FILE_PATTERN, line) for line in file)) @@ -66,14 +64,14 @@ def main() -> None: for old_stub in STUBS_FOLDER.rglob("*_pb2.pyi"): old_stub.unlink() - PROTOC_VERSION = run_protoc( + protoc_version = run_protoc( proto_paths=(f"{EXTRACTED_PACKAGE_DIR}/src",), mypy_out=STUBS_FOLDER, proto_globs=extract_proto_file_paths(temp_dir), cwd=temp_dir, ) - PYTHON_PROTOBUF_VERSION = extract_python_version(temp_dir / EXTRACTED_PACKAGE_DIR / "version.json") + python_protobuf_version = extract_python_version(temp_dir / EXTRACTED_PACKAGE_DIR / "version.json") # Cleanup after ourselves, this is a temp dir, but it can still grow fast if run multiple times shutil.rmtree(temp_dir) @@ -82,9 +80,9 @@ def main() -> None: "protobuf", extra_description=f"""Partially generated using \ [mypy-protobuf=={MYPY_PROTOBUF_VERSION}](https://github.com/nipunn1313/mypy-protobuf/tree/v{MYPY_PROTOBUF_VERSION}) \ -and {PROTOC_VERSION} on \ +and {protoc_version} on \ [protobuf v{PACKAGE_VERSION}](https://github.com/protocolbuffers/protobuf/releases/tag/v{PACKAGE_VERSION}) \ -(python `protobuf=={PYTHON_PROTOBUF_VERSION}`).""", +(python `protobuf=={python_protobuf_version}`).""", ) print("Updated protobuf/METADATA.toml") diff --git a/scripts/sync_protobuf/s2clientprotocol.py b/scripts/sync_protobuf/s2clientprotocol.py index 8f86fe5dccdd..61312a63669d 100644 --- a/scripts/sync_protobuf/s2clientprotocol.py +++ b/scripts/sync_protobuf/s2clientprotocol.py @@ -1,5 +1,4 @@ -""" -Generates the protobuf stubs for the given s2clientprotocol version using mypy-protobuf. +"""Generates the protobuf stubs for the given s2clientprotocol version using mypy-protobuf. Generally, new minor versions are a good time to update the stubs. """ @@ -29,7 +28,7 @@ def extract_python_version(file_path: Path) -> str: - """Extract Python version from s2clientprotocol's build file""" + """Extract Python version from s2clientprotocol's build file.""" match = re.search(VERSION_PATTERN, file_path.read_text()) assert match return match.group(1) @@ -46,14 +45,14 @@ def main() -> None: for old_stub in STUBS_FOLDER.rglob("*_pb2.pyi"): old_stub.unlink() - PROTOC_VERSION = run_protoc( + protoc_version = run_protoc( proto_paths=(EXTRACTED_PACKAGE_DIR,), mypy_out=STUBS_FOLDER, proto_globs=(f"{EXTRACTED_PACKAGE_DIR}/s2clientprotocol/*.proto",), cwd=temp_dir, ) - PYTHON_S2_CLIENT_PROTO_VERSION = extract_python_version(temp_dir / EXTRACTED_PACKAGE_DIR / "s2clientprotocol" / "build.py") + python_s2_client_proto_version = extract_python_version(temp_dir / EXTRACTED_PACKAGE_DIR / "s2clientprotocol" / "build.py") # Cleanup after ourselves, this is a temp dir, but it can still grow fast if run multiple times shutil.rmtree(temp_dir) @@ -62,8 +61,8 @@ def main() -> None: "s2clientprotocol", extra_description=f"""Partially generated using \ [mypy-protobuf=={MYPY_PROTOBUF_VERSION}](https://github.com/nipunn1313/mypy-protobuf/tree/v{MYPY_PROTOBUF_VERSION}) \ -and {PROTOC_VERSION} on \ -[s2client-proto {PYTHON_S2_CLIENT_PROTO_VERSION}](https://github.com/Blizzard/s2client-proto/tree/{PACKAGE_VERSION}).""", +and {protoc_version} on \ +[s2client-proto {python_s2_client_proto_version}](https://github.com/Blizzard/s2client-proto/tree/{PACKAGE_VERSION}).""", ) print("Updated s2clientprotocol/METADATA.toml") diff --git a/scripts/sync_protobuf/tensorflow.py b/scripts/sync_protobuf/tensorflow.py index 8328ca2c0e09..ff1aca962706 100644 --- a/scripts/sync_protobuf/tensorflow.py +++ b/scripts/sync_protobuf/tensorflow.py @@ -1,5 +1,4 @@ -""" -Generates the protobuf stubs for the given tensorflow version using mypy-protobuf. +"""Generates the protobuf stubs for the given tensorflow version using mypy-protobuf. Generally, new minor versions are a good time to update the stubs. """ @@ -56,14 +55,15 @@ def move_tree(source: Path, destination: Path) -> None: """Move directory and merge if destination already exists. - Can't use shutil.move because it can't merge existing directories.""" + Can't use shutil.move because it can't merge existing directories. + """ print(f"Moving '{source}' to '{destination}'") shutil.copytree(source, destination, dirs_exist_ok=True) shutil.rmtree(source) def post_creation() -> None: - """Move third-party and fix imports""" + """Move third-party and fix imports.""" print() move_tree(STUBS_FOLDER / "tsl", STUBS_FOLDER / "tensorflow" / "tsl") move_tree(STUBS_FOLDER / "xla", STUBS_FOLDER / "tensorflow" / "compiler" / "xla") @@ -99,7 +99,7 @@ def main() -> None: for old_stub in STUBS_FOLDER.rglob("*_pb2.pyi"): old_stub.unlink() - PROTOC_VERSION = run_protoc( + protoc_version = run_protoc( proto_paths=( f"{EXTRACTED_PACKAGE_DIR}/third_party/xla/third_party/tsl", f"{EXTRACTED_PACKAGE_DIR}/third_party/xla", @@ -130,7 +130,7 @@ def main() -> None: "tensorflow", extra_description=f"""Partially generated using \ [mypy-protobuf=={MYPY_PROTOBUF_VERSION}](https://github.com/nipunn1313/mypy-protobuf/tree/v{MYPY_PROTOBUF_VERSION}) \ -and {PROTOC_VERSION} on `tensorflow=={PACKAGE_VERSION}`.""", +and {protoc_version} on `tensorflow=={PACKAGE_VERSION}`.""", ) print("Updated tensorflow/METADATA.toml") diff --git a/stubs/protobuf/google/protobuf/any_pb2.pyi b/stubs/protobuf/google/protobuf/any_pb2.pyi index 2edfefbfcacd..7344e0f6f5af 100644 --- a/stubs/protobuf/google/protobuf/any_pb2.pyi +++ b/stubs/protobuf/google/protobuf/any_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/api_pb2.pyi b/stubs/protobuf/google/protobuf/api_pb2.pyi index f48ce3dd2de2..d75c51fdc32c 100644 --- a/stubs/protobuf/google/protobuf/api_pb2.pyi +++ b/stubs/protobuf/google/protobuf/api_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi index 4ba99eafb811..52dd8543986b 100644 --- a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi +++ b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Author: kenton@google.com (Kenton Varda) diff --git a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi index ddf523d56c8b..1b68ffcf1d35 100644 --- a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +++ b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Author: kenton@google.com (Kenton Varda) Based on original Protocol Buffers design by @@ -2069,6 +2068,7 @@ class SourceCodeInfo(google.protobuf.message.Message): - Code which tries to interpret locations should probably be designed to ignore those that it doesn't understand, as more types of locations could be recorded in the future. + """ def __init__( diff --git a/stubs/protobuf/google/protobuf/duration_pb2.pyi b/stubs/protobuf/google/protobuf/duration_pb2.pyi index 4beb927266cb..907064f35407 100644 --- a/stubs/protobuf/google/protobuf/duration_pb2.pyi +++ b/stubs/protobuf/google/protobuf/duration_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/empty_pb2.pyi b/stubs/protobuf/google/protobuf/empty_pb2.pyi index 593917f63474..d745e7cdbe60 100644 --- a/stubs/protobuf/google/protobuf/empty_pb2.pyi +++ b/stubs/protobuf/google/protobuf/empty_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi index 1cc4929f00b5..3b0d18f756d2 100644 --- a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi +++ b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/source_context_pb2.pyi b/stubs/protobuf/google/protobuf/source_context_pb2.pyi index a2d35937211d..1ad9140c37e8 100644 --- a/stubs/protobuf/google/protobuf/source_context_pb2.pyi +++ b/stubs/protobuf/google/protobuf/source_context_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/struct_pb2.pyi b/stubs/protobuf/google/protobuf/struct_pb2.pyi index 684f3c9d4e08..cd70942ce23e 100644 --- a/stubs/protobuf/google/protobuf/struct_pb2.pyi +++ b/stubs/protobuf/google/protobuf/struct_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi index 017a881de8b9..a0cad7210b2c 100644 --- a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi +++ b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/type_pb2.pyi b/stubs/protobuf/google/protobuf/type_pb2.pyi index 78e6b5b355a2..cd6a3d79ebbd 100644 --- a/stubs/protobuf/google/protobuf/type_pb2.pyi +++ b/stubs/protobuf/google/protobuf/type_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi index f3c923fea88b..7032c3a5a076 100644 --- a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi +++ b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi index 298ef9bf1c76..4bc5d8b4cd0a 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi index 6c33927e724e..fd11a728b833 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi index 658d5bd20590..3604e6b34eaf 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi index c21b03cbc1b8..501956969fe0 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi index ea772e2f6242..a15262236654 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi index 35a08c2337ea..39d99ffa8ee0 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -92,9 +91,7 @@ global___CloakState = CloakState @typing.final class StartRaw(google.protobuf.message.Message): - """ - Start - """ + """Start""" DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -145,9 +142,7 @@ global___StartRaw = StartRaw @typing.final class ObservationRaw(google.protobuf.message.Message): - """ - Observation - """ + """Observation""" DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -580,9 +575,7 @@ global___Effect = Effect @typing.final class ActionRaw(google.protobuf.message.Message): - """ - Action - """ + """Action""" DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi index b979697237f5..a778a10a2246 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -86,9 +85,7 @@ class _DifficultyEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._Enu CheatInsane: _Difficulty.ValueType # 10 class Difficulty(_Difficulty, metaclass=_DifficultyEnumTypeWrapper): - """ - Game Setup - """ + """Game Setup""" VeryEasy: Difficulty.ValueType # 1 Easy: Difficulty.ValueType # 2 @@ -218,9 +215,7 @@ global___Result = Result @typing.final class Request(google.protobuf.message.Message): - """ - Request/Response - """ + """Request/Response""" DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1784,9 +1779,7 @@ global___PlayerInfo = PlayerInfo @typing.final class PlayerCommon(google.protobuf.message.Message): - """ - During Game - """ + """During Game""" DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi index 95ee7dd7fde5..4fc1fdfec371 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi index f2e686f08242..ae28f560df63 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -23,9 +22,7 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor @typing.final class ObservationFeatureLayer(google.protobuf.message.Message): - """ - Observation - Feature Layer - """ + """Observation - Feature Layer""" DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -304,9 +301,7 @@ global___FeatureLayersMinimap = FeatureLayersMinimap @typing.final class ObservationRender(google.protobuf.message.Message): - """ - Observation - Rendered - """ + """Observation - Rendered""" DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -329,9 +324,7 @@ global___ObservationRender = ObservationRender @typing.final class ActionSpatial(google.protobuf.message.Message): - """ - Action - """ + """Action""" DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi index 65a0e165a43d..e127a222f35e 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -22,9 +21,7 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor @typing.final class ObservationUI(google.protobuf.message.Message): - """ - Observation - """ + """Observation""" DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -250,9 +247,7 @@ global___ProductionPanel = ProductionPanel @typing.final class ActionUI(google.protobuf.message.Message): - """ - Action - """ + """Action""" DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi index 25dd0678d051..f76e42f7771b 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file This proto file defines messages which represent the HLO module. This is a full fidelity serialization of the c++ HLO constructs. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi index d1871110d55b..3a93a9af0591 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2018 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi index 44592002fdd9..c5ee24d84d35 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi index c7a849570d8d..cb721e45766c 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2022 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi index 3c5dde2bac5c..23b12f7d405d 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2023 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi index 9e1871be16a8..b446e877b588 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi index 0e06ea85faa7..a0f40743c9d5 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -Protocol messages for describing the results of benchmarks and unit tests.""" +Protocol messages for describing the results of benchmarks and unit tests. +""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi index 572077b07eaa..ba9828b015cc 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2017 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi index 086a41fc6528..b4e7efc0d46b 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2017 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi b/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi index 6b5c255da3b4..fbaf06b20aa8 100644 --- a/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -Protocol messages for describing the configuration of the ExampleParserOp.""" +Protocol messages for describing the configuration of the ExampleParserOp. +""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi b/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi index 562a6c44cf55..b03293fe94ba 100644 --- a/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol messages for describing input data Examples for machine learning model training or inference. diff --git a/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi b/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi index 3fbc881cbaa2..4098fe2da198 100644 --- a/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol messages for describing features for machine learning model training or inference. diff --git a/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi index 6e0f0cb22534..c1838ee64789 100644 --- a/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi index 30f81032a88d..f434102d9d80 100644 --- a/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Defines the text format for including per-op API definition and overrides for client language op code generators. diff --git a/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi index 80bdde459e0f..e4ed286e428f 100644 --- a/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -124,7 +123,7 @@ class AttrValue(google.protobuf.message.Message): @property def list(self) -> global___AttrValue.ListValue: - """any "list(...)" """ + """Any "list(...)" """ @property def func(self) -> global___NameAttrList: diff --git a/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi index d54c0196320a..542fa33f595b 100644 --- a/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi index 070c7c3cdb63..59f3b8302a26 100644 --- a/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi index a1c7b19143c5..22bde157eda6 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi index 5837446a1e77..457834f086ee 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi index 72392b2b7698..093020bb7264 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi index aafdc2c8a51e..68469b276699 100644 --- a/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi index e37ac0ff0495..6bb5dfe8f420 100644 --- a/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi index c0908173a958..fe4849f36993 100644 --- a/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi index 739c2b5bd300..be84ea827670 100644 --- a/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi index 1158f045aba3..47818173ad8f 100644 --- a/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi index ab4dd51228cd..206c6650a2b6 100644 --- a/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi index ea1844b41fbc..e705e26421fc 100644 --- a/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi index ba0e1700fc9f..b1a32d2fc493 100644 --- a/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi index 1fc78e2d7b8b..f658e1c7607e 100644 --- a/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi index 663e4d216ec9..3f29a242b660 100644 --- a/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi index 6656ddcadf3f..93b6225b9a85 100644 --- a/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi index 7f48d2d4b519..b9facdfdffa9 100644 --- a/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi index 7e6e6ea31932..a5f16a42b1d6 100644 --- a/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi index 8767e1768bce..ce40b009deef 100644 --- a/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi index 947cbdb41683..c2ec0f20d8bc 100644 --- a/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi index 5df66b7e7978..3524f7eb5757 100644 --- a/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi index 71a5df5340a2..80a0ef5638c6 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi index 8e1a764d7021..cff0c72874a7 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi index 2d852a920271..23a4006a0dad 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -Protocol buffer representing the shape of tensors.""" +Protocol buffer representing the shape of tensors. +""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi index 949fd0f1d6a3..589fddccf415 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -Protocol buffer representing slices of a tensor""" +Protocol buffer representing slices of a tensor +""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi index a07d25c40e0e..6131811f3870 100644 --- a/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi index 2d2320096e66..abdd172cf95d 100644 --- a/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi index 7ca17c36bdfd..5bc193d80af1 100644 --- a/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi index 286fc179d807..abb4f56cb3c9 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi index ae19698d703d..c18363ff05e3 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016 The TensorFlow Authors. All Rights Reserved. @@ -32,9 +31,8 @@ class JobDef(google.protobuf.message.Message): """This file contains protos to be used when defining a TensorFlow cluster. - EXAMPLES + Examples -------- - 1. A single-process cluster, containing "/job:local/task:0". Cluster: @@ -71,6 +69,7 @@ class JobDef(google.protobuf.message.Message): cluster { $CLUSTER } job_name: 'ps' task_index: 1 Defines a single job in a TensorFlow cluster. + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi index 1dbe6e5573b5..9c70d5c0535e 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi index a655ef204b81..894efbf8c332 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -288,12 +287,13 @@ class GPUOptions(google.protobuf.message.Message): /device:GPU:2 -> visible GPU 1 with 2GB memory (ordinal 20) /device:GPU:3 -> visible GPU 0 with 4GB memory (ordinal 20) - NOTE: + Note: 1. It's invalid to set both this and "per_process_gpu_memory_fraction" at the same time. 2. Currently this setting is per-process, not per-session. Using different settings in different sessions within same process will result in undefined behavior. + """ @property diff --git a/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi index 713544819ed5..5b9e4bfae8c0 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi index 44eea2b74e65..40ca92a3be05 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi index 3c149e5ee5ac..df0d1cff3d9b 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi index 8ee6e76d65da..7f7933343bd6 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi index 5ee6b532d850..8c0e905df03e 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi index f4e0c8efe920..a0a14e637ec3 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2020 The TensorFlow Authors. All Rights Reserved. @@ -38,9 +37,8 @@ class TaskDeviceFilters(google.protobuf.message.Message): configured at the cluster startup, and cannot be updated once the cluster is up and running. - EXAMPLES + Examples -------- - A two-job cluster with the following ClusterDef: Cluster: @@ -60,6 +58,7 @@ class TaskDeviceFilters(google.protobuf.message.Message): device_filter '/job:worker/task:1' } } Defines the device filters for a remote task. + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi index af4bdd7a1f88..592c0bc1c533 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2017 The TensorFlow Authors. All Rights Reserved. diff --git a/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi index 10cb20051e70..fd1c3396bed4 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Add a dummy package name. Having no package, like core/lib/core/error_codes.proto, or having tensorflow.error, like diff --git a/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi index 83956b31c972..f778a7a4cd31 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi index 78ea938af3f4..c12fd7fb7d66 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi index c1c17417d31c..4b4585270934 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi index f93fe61c3752..0a3fb346bda3 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi index 6558122b328b..4831b66c37f2 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi index ebe2295bc872..ba840fa1826a 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -439,7 +438,7 @@ class RewriterConfig(google.protobuf.message.Message): @property def custom_optimizers(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___RewriterConfig.CustomGraphOptimizer]: - """list of CustomGraphOptimizers to apply.""" + """List of CustomGraphOptimizers to apply.""" @property def inter_optimizer_verifier_config(self) -> tensorflow.core.protobuf.verifier_config_pb2.VerifierConfig: diff --git a/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi index acc9e9bdb45a..aea6637f87d2 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi index cd2bdb7a2a13..07a7bd5bb4a2 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi index 4a6f0c1d51e0..65731fa9a559 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi index 1f89eebf8f98..867f3487da5a 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi index d5e74f6d52f9..4373d434837e 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi index daeb2da4ad65..daed1d99f878 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi index fa50e2989c68..8ca8d40947ba 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Add a dummy package name. Having no package like core/lib/core/error_codes.proto, or having tensorflow like diff --git a/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi index 0081e3011610..29a4c304f96c 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi index b1b95ae3fab4..191f02e53ca4 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi index e5120748aeef..30da97fdb993 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016 The TensorFlow Authors. All Rights Reserved. diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi index 6d04ebf01637..3d47a9326663 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi index e8e639bc0b2d..ab6bb3b45f25 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi index 5e08f7ce0e06..9d6cfc3e0b97 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi index d9d75f0b13da..a1550583e222 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi index c33925975268..72ed6ab9606c 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi index 63730b6360c6..dfea1dffd0ab 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi index 26d7b1406dae..28c7aa33efe3 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi index 405ab99a2dd5..0a6197c1d0af 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi index 9d6a986624bc..37e1528b55c9 100644 --- a/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi index 266b0ed6e5d3..54a84d0a092b 100644 --- a/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016 The TensorFlow Authors. All Rights Reserved. diff --git a/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi index 9b492465ac4f..9f56e7438315 100644 --- a/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file A checkpoint file is an sstable. The value for each record is a serialized SavedTensorSlices message (defined below). diff --git a/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi index 88bdc15d87ec..6eee8dc56b1c 100644 --- a/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -Protocol messages for describing the results of benchmarks and unit tests.""" +Protocol messages for describing the results of benchmarks and unit tests. +""" import google.protobuf.descriptor from tensorflow.compiler.xla.tsl.protobuf.test_log_pb2 import ( diff --git a/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi b/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi index 22be35d7d6bc..32ddbd8773b5 100644 --- a/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file This file is a copy of the TensorBoard ProjectorConfig proto. Keep this file in sync with the source proto definition at diff --git a/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi b/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi index 0133517d273f..752cf21a120d 100644 --- a/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi +++ b/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -Protobuf containing the metadata for each Keras object saved in a SavedModel.""" +Protobuf containing the metadata for each Keras object saved in a SavedModel. +""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi b/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi index 55d2e725bc0d..aa434bfb688a 100644 --- a/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi +++ b/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi index a2eb29dda885..6236e18bc7e8 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi index 82468c997f24..f97477d9e040 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi index 57202db5c159..2fd75c214d8c 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi index 929709311d04..f3f717231b7c 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi @@ -1,7 +1,7 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file -LINT: LEGACY_NAMES""" +LINT: LEGACY_NAMES +""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi index 3b0b8dcf4b37..a05bc19aa30f 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file TODO(b/247876220): Change package and java_package once we figure out how to migrate. @@ -152,7 +151,6 @@ class Code(_Code, metaclass=_CodeEnumTypeWrapper): """The canonical error codes for TensorFlow APIs. Warnings: - - Do not change any numeric assignments. - Changes to this list should only be made if there is a compelling need that can't be satisfied in another way. Such changes @@ -164,6 +162,7 @@ class Code(_Code, metaclass=_CodeEnumTypeWrapper): the most specific error code that applies. For example, prefer OUT_OF_RANGE over FAILED_PRECONDITION if both codes apply. Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION. + """ OK: Code.ValueType # 0 diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi index a33728dc47e4..908c4f828098 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi index 6e08a2bf99ef..a4166740f884 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi index 77e0f5b7bf39..3faf1fb9701b 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi @@ -1,5 +1,4 @@ -""" -@generated by mypy-protobuf. Do not edit manually! +"""@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/tests/check_typeshed_structure.py b/tests/check_typeshed_structure.py index 81adb8c74269..0be9f1a1011e 100755 --- a/tests/check_typeshed_structure.py +++ b/tests/check_typeshed_structure.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 -""" -Check that the typeshed repository contains the correct files in the +"""Check that the typeshed repository contains the correct files in the correct places, and that various configuration files are correct. """ diff --git a/tests/mypy_test.py b/tests/mypy_test.py index b1ad54735be9..5679aee7943a 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -62,7 +62,7 @@ class CommandLineArgs: def valid_path(cmd_arg: str) -> Path: - """Helper function for argument-parsing""" + """Helper function for argument-parsing.""" path = Path(cmd_arg) if not path.exists(): raise argparse.ArgumentTypeError(f'"{path}" does not exist in typeshed!') @@ -72,7 +72,7 @@ def valid_path(cmd_arg: str) -> Path: def remove_dev_suffix(version: str) -> str: - """Helper function for argument-parsing""" + """Helper function for argument-parsing.""" if version.endswith("-dev"): return version[: -len("-dev")] return version @@ -303,7 +303,6 @@ def test_third_party_distribution( Return a tuple, where the first element indicates mypy's return code and the second element is the number of checked files. """ - files: list[Path] = [] configurations: list[MypyDistConf] = [] seen_dists: set[str] = set() @@ -585,15 +584,15 @@ def test_typeshed(args: TestConfig, tempdir: Path) -> TestSummary: def main() -> None: args = parser.parse_args(namespace=CommandLineArgs()) - versions = args.python_version or SUPPORTED_VERSIONS - platforms = args.platform or [sys.platform] - filter = args.filter or DIRECTORIES_TO_TEST - exclude = args.exclude or [] + args.python_version = args.python_version or SUPPORTED_VERSIONS + args.platform = args.platform or [sys.platform] + args.filter = args.filter or DIRECTORIES_TO_TEST + args.exclude = args.exclude or [] summary = TestSummary() with tempfile.TemporaryDirectory() as td: td_path = Path(td) - for version, platform in product(versions, platforms): - config = TestConfig(args.verbose, filter, exclude, version, platform) + for version, platform in product(args.python_version, args.platform): + config = TestConfig(args.verbose, args.filter, args.exclude, version, platform) version_summary = test_typeshed(args=config, tempdir=td_path) summary.merge(version_summary) diff --git a/tests/pytype_test.py b/tests/pytype_test.py index 366d279f2844..d4ee7d3fca27 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -87,7 +87,7 @@ def run_pytype(*, filename: str, python_version: str, missing_modules: Iterable[ with pytype_config.verbosity_from(options): ast = loader.load_file(_get_module_name(filename), filename) loader.finish_and_verify_ast(ast) - except Exception: + except Exception: # noqa: BLE001 # We do want to catch any and all exceptions here stderr = traceback.format_exc() else: stderr = None diff --git a/tests/regr_test.py b/tests/regr_test.py index 0889b3fb6bfc..5101373fca13 100755 --- a/tests/regr_test.py +++ b/tests/regr_test.py @@ -45,7 +45,6 @@ def distribution_with_test_cases(distribution_name: str) -> DistributionTests: """Helper function for argument-parsing.""" - try: return distribution_info(distribution_name) except RuntimeError as exc: diff --git a/tests/stubtest_stdlib.py b/tests/stubtest_stdlib.py index 5134f8270db8..a2d2afa90ba2 100755 --- a/tests/stubtest_stdlib.py +++ b/tests/stubtest_stdlib.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Test typeshed's stdlib using stubtest +"""Test typeshed's stdlib using stubtest. stubtest is a script in the mypy project that compares stubs to the actual objects at runtime. Note that therefore the output of stubtest depends on which Python version it is run with. diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index e10fbf96c8f8..dd95414d9203 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Test typeshed's third party stubs using stubtest""" +"""Test typeshed's third party stubs using stubtest.""" from __future__ import annotations @@ -189,8 +189,7 @@ def run_stubtest( def setup_gdb_stubtest_command(venv_dir: Path, stubtest_cmd: list[str]) -> bool: - """ - Use wrapper scripts to run stubtest inside gdb. + """Use wrapper scripts to run stubtest inside gdb. The wrapper script is used to pass the arguments to the gdb script. """ if sys.platform == "win32": From f9575be06931cea6968c005441d597caba54a2e1 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 13:52:22 -0500 Subject: [PATCH 02/15] Second pass, with preview --- lib/ts_utils/metadata.py | 2 +- lib/ts_utils/paths.py | 6 +- lib/ts_utils/utils.py | 9 ++- pyproject.toml | 57 ++++++++++++++++++- scripts/create_baseline_stubs.py | 16 +++--- scripts/stubsabot.py | 24 +++----- scripts/sync_protobuf/google_protobuf.py | 3 +- stdlib/_ssl.pyi | 4 +- stdlib/ast.pyi | 6 +- stdlib/importlib/readers.pyi | 4 +- stdlib/mmap.pyi | 31 +++++----- stdlib/typing.pyi | 2 +- stdlib/xml/dom/pulldom.pyi | 16 +++--- stubs/gevent/gevent/hub.pyi | 2 +- stubs/gevent/gevent/libev/corecext.pyi | 2 +- stubs/gevent/gevent/libev/corecffi.pyi | 2 +- stubs/gevent/gevent/libuv/loop.pyi | 2 +- stubs/m3u8/m3u8/httpclient.pyi | 2 +- stubs/mysqlclient/MySQLdb/cursors.pyi | 2 +- .../networkx/classes/multidigraph.pyi | 2 +- stubs/pyxdg/xdg/Menu.pyi | 2 +- stubs/regex/regex/regex.pyi | 6 +- .../tensorflow/keras/layers/__init__.pyi | 2 +- stubs/tensorflow/tensorflow/keras/metrics.pyi | 2 +- tests/mypy_test.py | 9 ++- tests/pytype_test.py | 9 +-- tests/runtests.py | 26 ++++----- tests/stubtest_third_party.py | 20 +++---- 28 files changed, 147 insertions(+), 123 deletions(-) diff --git a/lib/ts_utils/metadata.py b/lib/ts_utils/metadata.py index 625fa517d5dd..b237f288d28a 100644 --- a/lib/ts_utils/metadata.py +++ b/lib/ts_utils/metadata.py @@ -250,7 +250,7 @@ def read_metadata(distribution: str) -> StubMetadata: f"Invalid upstream_repository for {distribution!r}: " "URLs for GitHub repositories always have two parts in their paths" ) - assert num_url_path_parts == 2, bad_github_url_msg + assert num_url_path_parts == 2, bad_github_url_msg # noqa: PLR2004 # astral-sh/ruff#10009 obsolete_since: object = data.get("obsolete_since") assert isinstance(obsolete_since, (str, type(None))) diff --git a/lib/ts_utils/paths.py b/lib/ts_utils/paths.py index 63119231720d..adec14a57d53 100644 --- a/lib/ts_utils/paths.py +++ b/lib/ts_utils/paths.py @@ -24,8 +24,7 @@ def distribution_path(distribution_name: str) -> Path: def tests_path(distribution_name: str) -> Path: if distribution_name == "stdlib": return STDLIB_PATH / TESTS_DIR - else: - return STUBS_PATH / distribution_name / TESTS_DIR + return STUBS_PATH / distribution_name / TESTS_DIR def test_cases_path(distribution_name: str) -> Path: @@ -35,5 +34,4 @@ def test_cases_path(distribution_name: str) -> Path: def allowlists_path(distribution_name: str) -> Path: if distribution_name == "stdlib": return tests_path("stdlib") / "stubtest_allowlists" - else: - return tests_path(distribution_name) + return tests_path(distribution_name) diff --git a/lib/ts_utils/utils.py b/lib/ts_utils/utils.py index 4cee6797837e..ea8480b56507 100644 --- a/lib/ts_utils/utils.py +++ b/lib/ts_utils/utils.py @@ -14,7 +14,7 @@ from packaging.requirements import Requirement try: - from termcolor import colored as colored # pyright: ignore[reportAssignmentType] + from termcolor import colored as colored # pyright: ignore[reportAssignmentType] # noqa: PLC0414 except ImportError: def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type: ignore[misc] @@ -119,8 +119,8 @@ def parse_stdlib_versions_file() -> SupportedVersionsDict: result: dict[str, tuple[VersionTuple, VersionTuple]] = {} with VERSIONS_PATH.open(encoding="UTF-8") as f: for line in f: - line = strip_comments(line) - if line == "": + line = strip_comments(line) # noqa: PLW2901 + if not line: continue m = VERSION_LINE_RE.match(line) assert m, f"invalid VERSIONS line: {line}" @@ -193,8 +193,7 @@ def allowlists(distribution_name: str) -> list[str]: if distribution_name == "stdlib": return ["common.txt", platform_allowlist, version_allowlist, combined_allowlist, local_version_allowlist] - else: - return ["stubtest_allowlist.txt", platform_allowlist] + return ["stubtest_allowlist.txt", platform_allowlist] # ==================================================================== diff --git a/pyproject.toml b/pyproject.toml index e47eb870a27a..20f03e85d0ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,8 @@ force-exclude = ".*_pb2.pyi" line-length = 130 # Oldest supported Python version target-version = "py38" -fix = true +preview = true # Help catch typing-related lint issues early +# fix = true exclude = [ # virtual environment ".env", @@ -37,17 +38,38 @@ exclude = ["**/test_cases/**/*.py"] # tell ruff not to flag these as e.g. "unused noqa comments" external = ["F821", "NQA", "Y"] select = [ + # "PTH", # TODO ! + # "TD", # TODO ! "A", # flake8-builtins "ASYNC", # flake8-async "B", # flake8-bugbear "BLE", # flake8-blind-except + "C4", # flake8-comprehensions "D", # pydocstyle + "DOC", # pydoclint + "DTZ", # flake8-datetimez + "EXE", # flake8-executable "FA", # flake8-future-annotations "FBT", # flake8-boolean-trap + "FLY", # flynt + "FURB", # refurb + "G", # flake8-logging-format "I", # isort + "ISC", # flake8-implicit-str-concat + "LOG", # flake8-logging "N", # pep8-naming + "NPY", # NumPy-specific rules + "PERF", # Perflint + "PGH", # pygrep-hooks + "PIE", # flake8-pie + "PL", # Pylint + "RET", # flake8-return + "RSE", # flake8-raise "RUF", # Ruff-specific and unused-noqa "S", # flake8-bandit + "SIM", # flake8-simplify + "SLOT", # flake8-slots + "TRY", # tryceratops "UP", # pyupgrade "YTT", # flake8-2020 # Flake8 base rules @@ -81,6 +103,14 @@ extend-safe-fixes = [ ignore = [ # TODO "ASYNC221", + "DOC501", + "FURB101", # TODO with PTH + "FURB103", # TODO with PTH + "PLC0105", + "PLW1510", + "PLW1514", + "RUF036", + "S404", # not sure ### # Rules that can conflict with the formatter (Black) # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules @@ -101,20 +131,32 @@ ignore = [ # We want D212: Multi-line docstring summary should start at the first line "D213", # Multi-line docstring summary should start at the second line "D401", # First line of docstring should be in imperative mood + # Return/yield type is enough documentation for us + "DOC201", # return is not documented in docstring + "DOC402", # yield is not documented in docstring # Used for direct, non-subclass type comparison, for example: `type(val) is str` # see https://github.com/astral-sh/ruff/issues/6465 "E721", # Do not compare types, use `isinstance()` + # Prefer explicit, but allow implicit multiline + # (hence lint.flake8-implicit-str-concat.allow-multiline isn't set to false) + "ISC003", # Explicitly concatenated string should be implicitly concatenated + # Python 3.11 introduced "zero cost" exception handling, our tests & scripts run on modern Python versions + "PERF203", # try-except within a loop incurs performance overhead + "PLR09", # Too many ... # Typeshed tests and scripts are never run in optimized mode "S101", # Use of assert detected # Prone to false positives astral-sh/ruff#4045 "S603", # subprocess call: check for execution of untrusted input # Full paths would make cross-environment compatibility a nightmare "S607", # Starting a process with a partial executable path + "TRY003", # Avoid specifying long messages outside the exception class # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871 "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` ### # False-positives, but already checked by type-checkers ### + # Configuring namespace-packages = ["scripts/sync_protobuf"] doesn't work ? + "PLC2701", # Private name import {name} from external module {module} # Ruff doesn't support multi-file analysis yet: https://github.com/astral-sh/ruff/issues/5295 "RUF013", # PEP 484 prohibits implicit `Optional` ] @@ -133,8 +175,17 @@ ignore = [ "A002", # builtin-argument-shadowing "A004", # builtin-import-shadowing "F403", # `from . import *` used; unable to detect undefined names - "S105", - "S107", + "FURB189", # Subclassing {subclass} can be error prone, use collections.{replacement} instead + "PIE796", # Enum contains duplicate value # astral-sh/ruff#15132 + "PLC2701", # Private name import from external module + "PLW1641", # Object does not implement __hash__ method + "S105", # Possible hardcoded password assigned + "S106", # Possible hardcoded password assigned to argument + "S107", # Possible hardcoded password assigned to function default + "S4", # Insecure and vulnerable libraries + "S406", # xml.sax methods are vulnerable to XML attacks + # Often breaks mypy/stubtest + "FURB180", # Use of metaclass=abc.ABCMeta to define abstract base class # Stubs can sometimes re-export entire modules. # Issues with using a star-imported name will be caught by type-checkers. "F405", # may be undefined, or defined from star imports diff --git a/scripts/create_baseline_stubs.py b/scripts/create_baseline_stubs.py index 69f5d2b307e3..20d3c70d6a57 100755 --- a/scripts/create_baseline_stubs.py +++ b/scripts/create_baseline_stubs.py @@ -18,6 +18,7 @@ import subprocess import sys import urllib.parse +from http import HTTPStatus from importlib.metadata import distribution import aiohttp @@ -72,7 +73,7 @@ def run_ruff(stub_dir: str) -> None: async def get_project_urls_from_pypi(project: str, session: aiohttp.ClientSession) -> dict[str, str]: pypi_root = f"https://pypi.org/pypi/{urllib.parse.quote(project)}" async with session.get(f"{pypi_root}/json") as response: - if response.status != 200: + if response.status != HTTPStatus.OK: return {} j: dict[str, dict[str, dict[str, str]]] j = await response.json() @@ -90,24 +91,23 @@ async def get_upstream_repo_url(project: str) -> str | None: # Order the project URLs so that we put the ones # that are most likely to point to the source code first - urls_to_check: list[str] = [] url_names_probably_pointing_to_source = ("Source", "Repository", "Homepage") - for url_name in url_names_probably_pointing_to_source: - if url := project_urls.get(url_name): - urls_to_check.append(url) + urls_to_check: list[str] = [ + url for url in (project_urls.get(url_name) for url_name in url_names_probably_pointing_to_source) if url + ] urls_to_check.extend( url for url_name, url in project_urls.items() if url_name not in url_names_probably_pointing_to_source ) for url in urls_to_check: # Remove `www.`; replace `http://` with `https://` - url = re.sub(r"^(https?://)?(www\.)?", "https://", url) + url = re.sub(r"^(https?://)?(www\.)?", "https://", url) # noqa: PLW2901 netloc = urllib.parse.urlparse(url).netloc if netloc in {"gitlab.com", "github.com", "bitbucket.org", "foss.heptapod.net"}: # truncate to https://site.com/user/repo upstream_repo_url = "/".join(url.split("/")[:5]) async with session.get(upstream_repo_url) as response: - if response.status == 200: + if response.status == HTTPStatus.OK: return upstream_repo_url return None @@ -218,7 +218,7 @@ def main() -> None: info = get_installed_package_info(project) if info is None: print(f'Error: "{project}" is not installed', file=sys.stderr) - print("", file=sys.stderr) + print(file=sys.stderr) print(f'Suggestion: Run "python3 -m pip install {project}" and try again', file=sys.stderr) sys.exit(1) project, version = info diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index 418e00338ff6..f1c4e61e7a22 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -92,7 +92,7 @@ class PypiInfo: def get_release(self, *, version: VersionString) -> PypiReleaseDownload: # prefer wheels, since it's what most users will get / it's pretty easy to mess up MANIFEST - release_info = sorted(self.releases[version], key=lambda x: bool(x["packagetype"] == "bdist_wheel"))[-1] + release_info = max(self.releases[version], key=lambda x: bool(x["packagetype"] == "bdist_wheel")) return PypiReleaseDownload( distribution=self.distribution, url=release_info["url"], @@ -134,8 +134,7 @@ def __str__(self) -> str: def new_version(self) -> str: if self.new_version_spec.operator == "==": return str(self.new_version_spec)[2:] - else: - return str(self.new_version_spec) + return str(self.new_version_spec) @dataclass @@ -200,10 +199,7 @@ def all_py_files_in_source_are_in_py_typed_dirs(source: zipfile.ZipFile | tarfil if not all_python_files: return False - for path in all_python_files: - if not any(py_typed_dir in path.parents for py_typed_dir in py_typed_dirs): - return False - return True + return all(any(py_typed_dir in path.parents for py_typed_dir in py_typed_dirs) for path in all_python_files) async def release_contains_py_typed(release_to_download: PypiReleaseDownload, *, session: aiohttp.ClientSession) -> bool: @@ -303,10 +299,10 @@ async def get_github_repo_info(session: aiohttp.ClientSession, stub_info: StubMe split_url = urllib.parse.urlsplit(stub_info.upstream_repository) if split_url.netloc == "github.com": url_path = split_url.path.strip("/") - assert len(Path(url_path).parts) == 2 + assert len(Path(url_path).parts) == 2 # noqa: PLR2004 # astral-sh/ruff#10009 github_tags_info_url = f"https://api.github.com/repos/{url_path}/tags" async with session.get(github_tags_info_url, headers=get_github_api_headers()) as response: - if response.status == 200: + if response.status == HTTPStatus.OK: tags: list[dict[str, Any]] = await response.json() assert isinstance(tags, list) return GitHubInfo(repo_path=url_path, tags=tags) @@ -744,10 +740,7 @@ async def main() -> None: parser.add_argument("distributions", nargs="*", help="Distributions to update, default = all") args = parser.parse_args() - if args.distributions: - dists_to_update = args.distributions - else: - dists_to_update = [path.name for path in STUBS_PATH.iterdir()] + dists_to_update = args.distributions or [path.name for path in STUBS_PATH.iterdir()] if args.action_level > ActionLevel.nothing: subprocess.run(["git", "update-index", "--refresh"], capture_output=True) @@ -762,9 +755,8 @@ async def main() -> None: print(f"Cannot run stubsabot, as uncommitted changes are present in {changed_files}!") sys.exit(1) - if args.action_level > ActionLevel.fork: - if os.environ.get("GITHUB_TOKEN") is None: - raise ValueError("GITHUB_TOKEN environment variable must be set") + if args.action_level > ActionLevel.fork and os.environ.get("GITHUB_TOKEN") is None: + raise ValueError("GITHUB_TOKEN environment variable must be set") denylist = {"gdb"} # gdb is not a pypi distribution diff --git a/scripts/sync_protobuf/google_protobuf.py b/scripts/sync_protobuf/google_protobuf.py index 0bd69dbf83db..43d554c0cf93 100644 --- a/scripts/sync_protobuf/google_protobuf.py +++ b/scripts/sync_protobuf/google_protobuf.py @@ -46,11 +46,10 @@ def extract_proto_file_paths(temp_dir: Path) -> list[str]: """ with open(temp_dir / EXTRACTED_PACKAGE_DIR / "python" / "dist" / "BUILD.bazel") as file: matched_lines = filter(None, (re.search(PROTO_FILE_PATTERN, line) for line in file)) - proto_files = [ + return [ EXTRACTED_PACKAGE_DIR + "/src/google/protobuf/" + match.group(1).replace("compiler_", "compiler/") + ".proto" for match in matched_lines ] - return proto_files def main() -> None: diff --git a/stdlib/_ssl.pyi b/stdlib/_ssl.pyi index 938135eb1192..d5bb456de850 100644 --- a/stdlib/_ssl.pyi +++ b/stdlib/_ssl.pyi @@ -239,9 +239,7 @@ OP_SINGLE_ECDH_USE: int OP_NO_COMPRESSION: int OP_ENABLE_MIDDLEBOX_COMPAT: int OP_NO_RENEGOTIATION: int -if sys.version_info >= (3, 11): - OP_IGNORE_UNEXPECTED_EOF: int -elif sys.version_info >= (3, 8) and sys.platform == "linux": +if sys.version_info >= (3, 11) or (sys.version_info >= (3, 8) and sys.platform == "linux"): OP_IGNORE_UNEXPECTED_EOF: int if sys.version_info >= (3, 12): OP_LEGACY_SERVER_CONNECT: int diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 351a4af2fb75..4053b2df6bce 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -1477,11 +1477,11 @@ if sys.version_info >= (3, 10): class MatchSingleton(pattern): __match_args__ = ("value",) - value: Literal[True, False] | None - def __init__(self, value: Literal[True, False] | None, **kwargs: Unpack[_Attributes[int]]) -> None: ... + value: bool | None + def __init__(self, value: bool | None, **kwargs: Unpack[_Attributes[int]]) -> None: ... if sys.version_info >= (3, 14): - def __replace__(self, *, value: Literal[True, False] | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ... + def __replace__(self, *, value: bool | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ... class MatchSequence(pattern): __match_args__ = ("patterns",) diff --git a/stdlib/importlib/readers.pyi b/stdlib/importlib/readers.pyi index 41d7af966d58..8f6074a16738 100644 --- a/stdlib/importlib/readers.pyi +++ b/stdlib/importlib/readers.pyi @@ -12,9 +12,9 @@ from typing import Literal, NoReturn, TypeVar from typing_extensions import Never if sys.version_info >= (3, 11): - import importlib.resources.abc as abc + from importlib.resources import abc else: - import importlib.abc as abc + from importlib import abc if sys.version_info >= (3, 10): if sys.version_info >= (3, 11): diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index f94e876237d1..f821b7e6a7e1 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -33,23 +33,22 @@ PAGESIZE: int class mmap: if sys.platform == "win32": def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ... + elif sys.version_info >= (3, 13): + def __init__( + self, + fileno: int, + length: int, + flags: int = ..., + prot: int = ..., + access: int = ..., + offset: int = ..., + *, + trackfd: bool = True, + ) -> None: ... else: - if sys.version_info >= (3, 13): - def __init__( - self, - fileno: int, - length: int, - flags: int = ..., - prot: int = ..., - access: int = ..., - offset: int = ..., - *, - trackfd: bool = True, - ) -> None: ... - else: - def __init__( - self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... - ) -> None: ... + def __init__( + self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... + ) -> None: ... def close(self) -> None: ... def flush(self, offset: int = ..., size: int = ...) -> None: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 741e7b8a3167..5c5c8f097896 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1,4 +1,4 @@ -# Since this module defines "overload" it is not recognized by Ruff as typing.overload +# Since this module defines "overload", it is not recognized by Ruff as typing.overload # ruff: noqa: F811 # TODO: The collections import is required, otherwise mypy crashes. # https://github.com/python/mypy/issues/16744 diff --git a/stdlib/xml/dom/pulldom.pyi b/stdlib/xml/dom/pulldom.pyi index 50250de5cb2f..51f34e1fb08b 100644 --- a/stdlib/xml/dom/pulldom.pyi +++ b/stdlib/xml/dom/pulldom.pyi @@ -21,14 +21,14 @@ _Node: TypeAlias = Document | Element | Text _Event: TypeAlias = tuple[ Literal[ - Literal["START_ELEMENT"], - Literal["END_ELEMENT"], - Literal["COMMENT"], - Literal["START_DOCUMENT"], - Literal["END_DOCUMENT"], - Literal["PROCESSING_INSTRUCTION"], - Literal["IGNORABLE_WHITESPACE"], - Literal["CHARACTERS"], + "START_ELEMENT", + "END_ELEMENT", + "COMMENT", + "START_DOCUMENT", + "END_DOCUMENT", + "PROCESSING_INSTRUCTION", + "IGNORABLE_WHITESPACE", + "CHARACTERS", ], _Node, ] diff --git a/stubs/gevent/gevent/hub.pyi b/stubs/gevent/gevent/hub.pyi index b949c9817ae0..44a8282ae316 100644 --- a/stubs/gevent/gevent/hub.pyi +++ b/stubs/gevent/gevent/hub.pyi @@ -29,7 +29,7 @@ class _DefaultReturnProperty(Protocol[_T]): @overload def __get__(self, obj: object, owner: type[object] | None = None) -> _T: ... def __set__(self, obj: object, value: _T | None) -> None: ... - def __del__(self, obj: object) -> None: ... + def __del__(self) -> None: ... def spawn_raw(function: Callable[..., object], *args: object, **kwargs: object) -> greenlet.greenlet: ... def sleep(seconds: float = 0, ref: bool = True) -> None: ... diff --git a/stubs/gevent/gevent/libev/corecext.pyi b/stubs/gevent/gevent/libev/corecext.pyi index 994793ee8a25..35a46bbf3655 100644 --- a/stubs/gevent/gevent/libev/corecext.pyi +++ b/stubs/gevent/gevent/libev/corecext.pyi @@ -5,9 +5,9 @@ from types import TracebackType from typing import Any from typing_extensions import ParamSpec -import gevent.libev.watcher as watcher from gevent._ffi.loop import _ErrorHandler from gevent._types import _Callback +from gevent.libev import watcher # this c extension is only available on posix if sys.platform != "win32": diff --git a/stubs/gevent/gevent/libev/corecffi.pyi b/stubs/gevent/gevent/libev/corecffi.pyi index 4dc59a997f30..e814fb9b90b3 100644 --- a/stubs/gevent/gevent/libev/corecffi.pyi +++ b/stubs/gevent/gevent/libev/corecffi.pyi @@ -2,8 +2,8 @@ import sys from _typeshed import FileDescriptor from collections.abc import Sequence -import gevent.libev.watcher as watcher from gevent._ffi.loop import AbstractLoop +from gevent.libev import watcher def get_version() -> str: ... def get_header_version() -> str: ... diff --git a/stubs/gevent/gevent/libuv/loop.pyi b/stubs/gevent/gevent/libuv/loop.pyi index e5d539acb3c0..950b82118375 100644 --- a/stubs/gevent/gevent/libuv/loop.pyi +++ b/stubs/gevent/gevent/libuv/loop.pyi @@ -2,9 +2,9 @@ import sys from _typeshed import FileDescriptor from typing import NamedTuple -import gevent.libuv.watcher as watcher from gevent._ffi.loop import AbstractLoop from gevent._types import _IoWatcher +from gevent.libuv import watcher def get_version() -> str: ... def get_header_version() -> str: ... diff --git a/stubs/m3u8/m3u8/httpclient.pyi b/stubs/m3u8/m3u8/httpclient.pyi index de76c1b84164..96569e96e167 100644 --- a/stubs/m3u8/m3u8/httpclient.pyi +++ b/stubs/m3u8/m3u8/httpclient.pyi @@ -16,4 +16,4 @@ class DefaultHTTPClient: ) -> tuple[str, str]: ... class HTTPSHandler: - def __new__(cls, verify_ssl: bool = True) -> urllib.request.HTTPSHandler: ... # type: ignore + def __new__(cls, verify_ssl: bool = True) -> urllib.request.HTTPSHandler: ... # type: ignore[misc] diff --git a/stubs/mysqlclient/MySQLdb/cursors.pyi b/stubs/mysqlclient/MySQLdb/cursors.pyi index f572c38e1ab3..a659540c913f 100644 --- a/stubs/mysqlclient/MySQLdb/cursors.pyi +++ b/stubs/mysqlclient/MySQLdb/cursors.pyi @@ -10,7 +10,7 @@ _Arguments: TypeAlias = dict[str, _Literal] | dict[bytes, _Literal] | Iterable[_ RE_INSERT_VALUES: Pattern[str] class BaseCursor: - from ._exceptions import ( + from ._exceptions import ( # noqa: PLC0415 DatabaseError as DatabaseError, DataError as DataError, Error as Error, diff --git a/stubs/networkx/networkx/classes/multidigraph.pyi b/stubs/networkx/networkx/classes/multidigraph.pyi index e9a2b91b1c5b..fac4ea0c0acd 100644 --- a/stubs/networkx/networkx/classes/multidigraph.pyi +++ b/stubs/networkx/networkx/classes/multidigraph.pyi @@ -20,6 +20,6 @@ class MultiDiGraph(MultiGraph[_Node], DiGraph[_Node]): def in_degree(self) -> InMultiDegreeView[_Node]: ... @cached_property def out_degree(self) -> OutMultiDegreeView[_Node]: ... - def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> MultiGraph[_Node]: ... # type: ignore + def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> MultiGraph[_Node]: ... # type: ignore[override] def reverse(self, copy: bool = True) -> MultiDiGraph[_Node]: ... def copy(self, as_view: bool = False) -> MultiDiGraph[_Node]: ... diff --git a/stubs/pyxdg/xdg/Menu.pyi b/stubs/pyxdg/xdg/Menu.pyi index 77738a4615a7..256334668478 100644 --- a/stubs/pyxdg/xdg/Menu.pyi +++ b/stubs/pyxdg/xdg/Menu.pyi @@ -94,7 +94,7 @@ class MenuEntry: TYPE_SYSTEM: Literal["System"] TYPE_BOTH: Literal["Both"] DesktopEntry: DesktopEntry - Show: Literal[True, False, "Deleted", "NoDisplay", "Hidden", "Empty", "NotShowIn", "NoExec"] + Show: Literal["Deleted", "NoDisplay", "Hidden", "Empty", "NotShowIn", "NoExec"] | bool Visible: Literal[1, 0, "Deleted", "NoDisplay", "Hidden", "Empty", "NotShowIn", "NoExec"] Original: MenuEntry | None Parents: list[Menu] diff --git a/stubs/regex/regex/regex.pyi b/stubs/regex/regex/regex.pyi index 8b35a370ad8c..642bdd8468e7 100644 --- a/stubs/regex/regex/regex.pyi +++ b/stubs/regex/regex/regex.pyi @@ -1,5 +1,5 @@ import sys -from _typeshed import ReadableBuffer +from _typeshed import ReadableBuffer, Unused from collections.abc import Callable, Mapping from typing import Any, AnyStr, Generic, Literal, TypeVar, final, overload from typing_extensions import Self @@ -568,7 +568,7 @@ class Pattern(Generic[AnyStr]): timeout: float | None = None, ) -> _regex.Scanner[bytes]: ... def __copy__(self) -> Self: ... - def __deepcopy__(self) -> Self: ... + def __deepcopy__(self, memo: Unused) -> Self: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -647,6 +647,6 @@ class Match(Generic[AnyStr]): @overload def __getitem__(self, key: int | str, /) -> AnyStr | Any: ... def __copy__(self) -> Self: ... - def __deepcopy__(self) -> Self: ... + def __deepcopy__(self, memo: Unused) -> Self: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... diff --git a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi index 48a32b9eb07a..a2a2211b56cf 100644 --- a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi +++ b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi @@ -394,7 +394,7 @@ class MultiHeadAttention(Layer[Any, tf.Tensor]): name: str | None = None, ) -> None: ... # @override - @overload # type: ignore + @overload # type: ignore[override] def __call__( self, query: tf.Tensor, diff --git a/stubs/tensorflow/tensorflow/keras/metrics.pyi b/stubs/tensorflow/tensorflow/keras/metrics.pyi index 245e6b2276d9..9e3d1e4564de 100644 --- a/stubs/tensorflow/tensorflow/keras/metrics.pyi +++ b/stubs/tensorflow/tensorflow/keras/metrics.pyi @@ -23,7 +23,7 @@ class Metric(tf.keras.layers.Layer[tf.Tensor, tf.Tensor], metaclass=ABCMeta): def result(self) -> _Output: ... # Metric inherits from keras.Layer, but its add_weight method is incompatible with the one from "Layer". @override - def add_weight( # type: ignore + def add_weight( # type: ignore[override] self, name: str, shape: Iterable[int | None] | None = (), diff --git a/tests/mypy_test.py b/tests/mypy_test.py index 5679aee7943a..8d8c8372b339 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -119,7 +119,7 @@ class TestConfig: def log(args: TestConfig, *varargs: object) -> None: - if args.verbose >= 2: + if args.verbose >= 2: # noqa: PLR2004 # astral-sh/ruff#10009 print(colored(" ".join(map(str, varargs)), "blue")) @@ -268,10 +268,9 @@ def run_mypy( print_success_msg() if result.returncode == 0: return MypyResult.SUCCESS - elif result.returncode == 1: + if result.returncode == 1: return MypyResult.FAILURE - else: - return MypyResult.CRASH + return MypyResult.CRASH def add_third_party_files( @@ -335,7 +334,7 @@ def test_third_party_distribution( def test_stdlib(args: TestConfig) -> TestResult: files: list[Path] = [] for file in STDLIB_PATH.iterdir(): - if file.name in ("VERSIONS", TESTS_DIR) or file.name.startswith("."): + if file.name in {"VERSIONS", TESTS_DIR} or file.name.startswith("."): continue add_files(files, file, args) diff --git a/tests/pytype_test.py b/tests/pytype_test.py index d4ee7d3fca27..a5b8727a6c75 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -172,7 +172,7 @@ def _get_pkgs_associated_with_requirement(req_name: str) -> list[str]: toplevel_txt_contents = dist.read_text("top_level.txt") if toplevel_txt_contents is None: if dist.files is None: - raise RuntimeError("Can't read find the packages associated with requirement {req_name!r}") + raise RuntimeError(f"Can't read find the packages associated with requirement {req_name!r}") maybe_modules = [f.parts[0] if len(f.parts) > 1 else inspect.getmodulename(f) for f in dist.files] packages = [name for name in maybe_modules if name is not None and "." not in name] else: @@ -215,7 +215,7 @@ def get_missing_modules(files_to_test: Sequence[str]) -> Iterable[str]: # Skips comments, empty lines, and stdlib files, which are in # the exclude list because pytype has its own version. continue - unused_stubs_prefix, unused_pkg, mod_path = fi.split("/", 2) # pyright: ignore[reportUnusedVariable] + _stubs_prefix, _pkg, mod_path = fi.split("/", 2) # pyright: ignore[reportUnusedVariable] missing_modules.add(os.path.splitext(mod_path)[0]) return missing_modules @@ -228,10 +228,7 @@ def run_all_tests(*, files_to_test: Sequence[str], print_stderr: bool, dry_run: python_version = f"{sys.version_info.major}.{sys.version_info.minor}" print("Testing files with pytype...") for i, f in enumerate(files_to_test): - if dry_run: - stderr = None - else: - stderr = run_pytype(filename=f, python_version=python_version, missing_modules=missing_modules) + stderr = None if dry_run else run_pytype(filename=f, python_version=python_version, missing_modules=missing_modules) if stderr: if print_stderr: print(f"\n{stderr}") diff --git a/tests/runtests.py b/tests/runtests.py index 1c5ba0c18ab9..fb1294eae293 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -29,8 +29,7 @@ def _parse_jsonc(json_text: str) -> str: # strip comments from the file lines = [line for line in json_text.split("\n") if not line.strip().startswith("//")] # strip trailing commas from the file - valid_json = re.sub(r",(\s*?[\}\]])", r"\1", "\n".join(lines)) - return valid_json + return re.sub(r",(\s*?[\}\]])", r"\1", "\n".join(lines)) def _get_strict_params(stub_path: str) -> list[str]: @@ -65,7 +64,7 @@ def main() -> None: python_version: str = args.python_version path_tokens = Path(path).parts - if len(path_tokens) != 2: + if len(path_tokens) != 2: # noqa: PLR2004 # astral-sh/ruff#10009 parser.error("'path' argument should be in format /.") folder, stub = path_tokens if folder not in {"stdlib", "stubs"}: @@ -104,19 +103,18 @@ def main() -> None: if folder == "stdlib": print("\nRunning stubtest...") stubtest_result = subprocess.run([sys.executable, "tests/stubtest_stdlib.py", stub]) + elif run_stubtest: + print("\nRunning stubtest...") + stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub]) else: - if run_stubtest: - print("\nRunning stubtest...") - stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub]) - else: - print( - colored( - f"\nSkipping stubtest for {stub!r}..." - + "\nNOTE: Running third-party stubtest involves downloading and executing arbitrary code from PyPI." - + f"\nOnly run stubtest if you trust the {stub!r} package.", - "yellow", - ) + print( + colored( + f"\nSkipping stubtest for {stub!r}..." + + "\nNOTE: Running third-party stubtest involves downloading and executing arbitrary code from PyPI." + + f"\nOnly run stubtest if you trust the {stub!r} package.", + "yellow", ) + ) else: print(colored("\nSkipping stubtest since mypy failed.", "yellow")) diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index dd95414d9203..48befff02cad 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -4,6 +4,7 @@ from __future__ import annotations import argparse +import contextlib import os import re import subprocess @@ -125,13 +126,11 @@ def run_stubtest( stubtest_env = os.environ | {"MYPYPATH": mypypath, "MYPY_FORCE_COLOR": "1"} # Perform some black magic in order to run stubtest inside uWSGI - if dist_name == "uWSGI": - if not setup_uwsgi_stubtest_command(dist, venv_dir, stubtest_cmd): - return False + if dist_name == "uWSGI" and not setup_uwsgi_stubtest_command(dist, venv_dir, stubtest_cmd): + return False - if dist_name == "gdb": - if not setup_gdb_stubtest_command(venv_dir, stubtest_cmd): - return False + if dist_name == "gdb" and not setup_gdb_stubtest_command(venv_dir, stubtest_cmd): + return False try: subprocess.run(stubtest_cmd, env=stubtest_env, check=True, capture_output=True) @@ -389,10 +388,7 @@ def main() -> NoReturn: parser.add_argument("dists", metavar="DISTRIBUTION", type=str, nargs=argparse.ZERO_OR_MORE) args = parser.parse_args() - if len(args.dists) == 0: - dists = sorted(STUBS_PATH.iterdir()) - else: - dists = [STUBS_PATH / d for d in args.dists] + dists = sorted(STUBS_PATH.iterdir()) if len(args.dists) == 0 else [STUBS_PATH / d for d in args.dists] result = 0 for i, dist in enumerate(dists): @@ -410,7 +406,5 @@ def main() -> NoReturn: if __name__ == "__main__": - try: + with contextlib.suppress(KeyboardInterrupt): main() - except KeyboardInterrupt: - pass From 154b54727b50baada093d7844390a32566fcb6ff Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 14:22:19 -0500 Subject: [PATCH 03/15] PLC0105 --- pyproject.toml | 12 +-- stdlib/builtins.pyi | 44 +++++----- stdlib/inspect.pyi | 12 +-- stdlib/multiprocessing/connection.pyi | 18 ++-- stdlib/typing.pyi | 14 +-- stubs/WTForms/wtforms/validators.pyi | 18 ++-- .../networkx/algorithms/operators/binary.pyi | 8 +- stubs/pyserial/serial/tools/miniterm.pyi | 4 +- stubs/tensorflow/tensorflow/data/__init__.pyi | 86 +++++++++---------- .../distribute/experimental/coordinator.pyi | 6 +- .../tensorflow/keras/layers/__init__.pyi | 18 ++-- .../tensorflow/saved_model/__init__.pyi | 8 +- .../tensorflow/types/experimental.pyi | 16 ++-- 13 files changed, 138 insertions(+), 126 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 20f03e85d0ae..726b36125320 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,15 +102,13 @@ extend-safe-fixes = [ ] ignore = [ # TODO - "ASYNC221", - "DOC501", + "ASYNC221", # i don't know how to improve subprocess.check_call calls to satisfy this "FURB101", # TODO with PTH "FURB103", # TODO with PTH - "PLC0105", + # "PLC0105", "PLW1510", "PLW1514", - "RUF036", - "S404", # not sure + "RUF036", # None not at the end of the type annotation. # Request for autofix: astral-sh/ruff#15136 ### # Rules that can conflict with the formatter (Black) # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules @@ -134,6 +132,8 @@ ignore = [ # Return/yield type is enough documentation for us "DOC201", # return is not documented in docstring "DOC402", # yield is not documented in docstring + # We're not a public library, users are contributors that already directly reads teh code, clear error messages are sufficient + "DOC501", # Raised exception missing from docstring # Used for direct, non-subclass type comparison, for example: `type(val) is str` # see https://github.com/astral-sh/ruff/issues/6465 "E721", # Do not compare types, use `isinstance()` @@ -145,6 +145,8 @@ ignore = [ "PLR09", # Too many ... # Typeshed tests and scripts are never run in optimized mode "S101", # Use of assert detected + # We use subprocess a lot in scripts and tests + "S404", # subprocess module is possibly insecure # Prone to false positives astral-sh/ruff#4045 "S603", # subprocess call: check for execution of untrusted input # Full paths would make cross-environment compatibility a nightmare diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index ef78bea69e51..2d9c2e9939f5 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -90,14 +90,14 @@ _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") -_SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=True) -_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True) +_SupportsNextT_co = TypeVar("_SupportsNextT_co", bound=SupportsNext[Any], covariant=True) +_SupportsAnextT_co = TypeVar("_SupportsAnextT_co", bound=SupportsAnext[Any], covariant=True) _AwaitableT = TypeVar("_AwaitableT", bound=Awaitable[Any]) _AwaitableT_co = TypeVar("_AwaitableT_co", bound=Awaitable[Any], covariant=True) _P = ParamSpec("_P") -_StartT = TypeVar("_StartT", covariant=True, default=Any) -_StopT = TypeVar("_StopT", covariant=True, default=Any) -_StepT = TypeVar("_StepT", covariant=True, default=Any) +_StartT_co = TypeVar("_StartT_co", covariant=True, default=Any) +_StopT_co = TypeVar("_StopT_co", covariant=True, default=Any) +_StepT_co = TypeVar("_StepT_co", covariant=True, default=Any) class object: __doc__: str | None @@ -940,13 +940,13 @@ class bool(int): def __invert__(self) -> int: ... @final -class slice(Generic[_StartT, _StopT, _StepT]): +class slice(Generic[_StartT_co, _StopT_co, _StepT_co]): @property - def start(self) -> _StartT: ... + def start(self) -> _StartT_co: ... @property - def step(self) -> _StepT: ... + def step(self) -> _StepT_co: ... @property - def stop(self) -> _StopT: ... + def stop(self) -> _StopT_co: ... @overload def __new__(cls, stop: int | None, /) -> slice[int | MaybeNone, int | MaybeNone, int | MaybeNone]: ... @overload @@ -1303,7 +1303,7 @@ class _PathLike(Protocol[AnyStr_co]): def __fspath__(self) -> AnyStr_co: ... if sys.version_info >= (3, 10): - def aiter(async_iterable: SupportsAiter[_SupportsAnextT], /) -> _SupportsAnextT: ... + def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: ... class _SupportsSynchronousAnext(Protocol[_AwaitableT_co]): def __anext__(self) -> _AwaitableT_co: ... @@ -1465,7 +1465,7 @@ class _GetItemIterable(Protocol[_T_co]): def __getitem__(self, i: int, /) -> _T_co: ... @overload -def iter(object: SupportsIter[_SupportsNextT], /) -> _SupportsNextT: ... +def iter(object: SupportsIter[_SupportsNextT_co], /) -> _SupportsNextT_co: ... @overload def iter(object: _GetItemIterable[_T], /) -> Iterator[_T]: ... @overload @@ -1672,17 +1672,17 @@ def print( *values: object, sep: str | None = " ", end: str | None = "\n", file: _SupportsWriteAndFlush[str] | None = None, flush: bool ) -> None: ... -_E = TypeVar("_E", contravariant=True) -_M = TypeVar("_M", contravariant=True) +_E_contra = TypeVar("_E_contra", contravariant=True) +_M_contra = TypeVar("_M_contra", contravariant=True) -class _SupportsPow2(Protocol[_E, _T_co]): - def __pow__(self, other: _E, /) -> _T_co: ... +class _SupportsPow2(Protocol[_E_contra, _T_co]): + def __pow__(self, other: _E_contra, /) -> _T_co: ... -class _SupportsPow3NoneOnly(Protocol[_E, _T_co]): - def __pow__(self, other: _E, modulo: None = None, /) -> _T_co: ... +class _SupportsPow3NoneOnly(Protocol[_E_contra, _T_co]): + def __pow__(self, other: _E_contra, modulo: None = None, /) -> _T_co: ... -class _SupportsPow3(Protocol[_E, _M, _T_co]): - def __pow__(self, other: _E, modulo: _M, /) -> _T_co: ... +class _SupportsPow3(Protocol[_E_contra, _M_contra, _T_co]): + def __pow__(self, other: _E_contra, modulo: _M_contra, /) -> _T_co: ... _SupportsSomeKindOfPow = ( # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed _SupportsPow2[Any, Any] | _SupportsPow3NoneOnly[Any, Any] | _SupportsPow3[Any, Any, Any] @@ -1718,11 +1718,11 @@ def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> @overload def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ... @overload -def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] +def pow(base: _SupportsPow2[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] @overload -def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] +def pow(base: _SupportsPow3NoneOnly[_E_contra, _T_co], exp: _E_contra, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] @overload -def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ... +def pow(base: _SupportsPow3[_E_contra, _M_contra, _T_co], exp: _E_contra, mod: _M_contra) -> _T_co: ... @overload def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ... @overload diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index 8b408e8426cc..00015ee05b92 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -143,8 +143,8 @@ if sys.version_info >= (3, 11): _P = ParamSpec("_P") _T = TypeVar("_T") _F = TypeVar("_F", bound=Callable[..., Any]) -_T_cont = TypeVar("_T_cont", contravariant=True) -_V_cont = TypeVar("_V_cont", contravariant=True) +_T_contra = TypeVar("_T_contra", contravariant=True) +_V_contra = TypeVar("_V_contra", contravariant=True) # # Types and members @@ -228,11 +228,11 @@ def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGe @overload def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ... -class _SupportsSet(Protocol[_T_cont, _V_cont]): - def __set__(self, instance: _T_cont, value: _V_cont, /) -> None: ... +class _SupportsSet(Protocol[_T_contra, _V_contra]): + def __set__(self, instance: _T_contra, value: _V_contra, /) -> None: ... -class _SupportsDelete(Protocol[_T_cont]): - def __delete__(self, instance: _T_cont, /) -> None: ... +class _SupportsDelete(Protocol[_T_contra]): + def __delete__(self, instance: _T_contra, /) -> None: ... def isasyncgen(object: object) -> TypeIs[AsyncGeneratorType[Any, Any]]: ... def istraceback(object: object) -> TypeIs[TracebackType]: ... diff --git a/stdlib/multiprocessing/connection.pyi b/stdlib/multiprocessing/connection.pyi index 9998239d3119..cd4fa102c0f3 100644 --- a/stdlib/multiprocessing/connection.pyi +++ b/stdlib/multiprocessing/connection.pyi @@ -12,10 +12,10 @@ __all__ = ["Client", "Listener", "Pipe", "wait"] _Address: TypeAlias = str | tuple[str, int] # Defaulting to Any to avoid forcing generics on a lot of pre-existing code -_SendT = TypeVar("_SendT", contravariant=True, default=Any) -_RecvT = TypeVar("_RecvT", covariant=True, default=Any) +_SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=Any) +_RecvT_co = TypeVar("_RecvT_co", covariant=True, default=Any) -class _ConnectionBase(Generic[_SendT, _RecvT]): +class _ConnectionBase(Generic[_SendT_contra, _RecvT_co]): def __init__(self, handle: SupportsIndex, readable: bool = True, writable: bool = True) -> None: ... @property def closed(self) -> bool: ... # undocumented @@ -26,10 +26,10 @@ class _ConnectionBase(Generic[_SendT, _RecvT]): def fileno(self) -> int: ... def close(self) -> None: ... def send_bytes(self, buf: ReadableBuffer, offset: int = 0, size: int | None = None) -> None: ... - def send(self, obj: _SendT) -> None: ... + def send(self, obj: _SendT_contra) -> None: ... def recv_bytes(self, maxlength: int | None = None) -> bytes: ... def recv_bytes_into(self, buf: Any, offset: int = 0) -> int: ... - def recv(self) -> _RecvT: ... + def recv(self) -> _RecvT_co: ... def poll(self, timeout: float | None = 0.0) -> bool: ... def __enter__(self) -> Self: ... def __exit__( @@ -37,10 +37,10 @@ class _ConnectionBase(Generic[_SendT, _RecvT]): ) -> None: ... def __del__(self) -> None: ... -class Connection(_ConnectionBase[_SendT, _RecvT]): ... +class Connection(_ConnectionBase[_SendT_contra, _RecvT_co]): ... if sys.platform == "win32": - class PipeConnection(_ConnectionBase[_SendT, _RecvT]): ... + class PipeConnection(_ConnectionBase[_SendT_contra, _RecvT_co]): ... class Listener: def __init__( @@ -66,8 +66,8 @@ else: def answer_challenge(connection: Connection[Any, Any], authkey: bytes) -> None: ... def wait( - object_list: Iterable[Connection[_SendT, _RecvT] | socket.socket | int], timeout: float | None = None -) -> list[Connection[_SendT, _RecvT] | socket.socket | int]: ... + object_list: Iterable[Connection[_SendT_contra, _RecvT_co] | socket.socket | int], timeout: float | None = None +) -> list[Connection[_SendT_contra, _RecvT_co] | socket.socket | int]: ... def Client(address: _Address, family: str | None = None, authkey: bytes | None = None) -> Connection[Any, Any]: ... # N.B. Keep this in sync with multiprocessing.context.BaseContext.Pipe. diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 5c5c8f097896..1251c63ee1dc 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -496,10 +496,10 @@ class Awaitable(Protocol[_T_co]): def __await__(self) -> Generator[Any, Any, _T_co]: ... # Non-default variations to accommodate couroutines, and `AwaitableGenerator` having a 4th type parameter. -_SendT_contra_nd = TypeVar("_SendT_contra_nd", contravariant=True) -_ReturnT_co_nd = TypeVar("_ReturnT_co_nd", covariant=True) +_SendT_nd_contra = TypeVar("_SendT_nd_contra", contravariant=True) +_ReturnT_nd_co = TypeVar("_ReturnT_nd_co", covariant=True) -class Coroutine(Awaitable[_ReturnT_co_nd], Generic[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd]): +class Coroutine(Awaitable[_ReturnT_nd_co], Generic[_YieldT_co, _SendT_nd_contra, _ReturnT_nd_co]): __name__: str __qualname__: str @property @@ -511,7 +511,7 @@ class Coroutine(Awaitable[_ReturnT_co_nd], Generic[_YieldT_co, _SendT_contra_nd, @property def cr_running(self) -> bool: ... @abstractmethod - def send(self, value: _SendT_contra_nd, /) -> _YieldT_co: ... + def send(self, value: _SendT_nd_contra, /) -> _YieldT_co: ... @overload @abstractmethod def throw( @@ -527,9 +527,9 @@ class Coroutine(Awaitable[_ReturnT_co_nd], Generic[_YieldT_co, _SendT_contra_nd, # The parameters correspond to Generator, but the 4th is the original type. @type_check_only class AwaitableGenerator( - Awaitable[_ReturnT_co_nd], - Generator[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd], - Generic[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd, _S], + Awaitable[_ReturnT_nd_co], + Generator[_YieldT_co, _SendT_nd_contra, _ReturnT_nd_co], + Generic[_YieldT_co, _SendT_nd_contra, _ReturnT_nd_co, _S], metaclass=ABCMeta, ): ... diff --git a/stubs/WTForms/wtforms/validators.pyi b/stubs/WTForms/wtforms/validators.pyi index a5d1c4ca6304..cbe04b288fc4 100644 --- a/stubs/WTForms/wtforms/validators.pyi +++ b/stubs/WTForms/wtforms/validators.pyi @@ -42,7 +42,7 @@ __all__ = ( "Disabled", ) -_ValuesT = TypeVar("_ValuesT", bound=Collection[Any], contravariant=True) +_ValuesT_contra = TypeVar("_ValuesT_contra", bound=Collection[Any], contravariant=True) class ValidationError(ValueError): def __init__(self, message: str = "", *args: object) -> None: ... @@ -150,9 +150,13 @@ class AnyOf: @overload def __init__(self, values: Collection[Any], message: str | None = None, values_formatter: None = None) -> None: ... @overload - def __init__(self, values: _ValuesT, message: str | None, values_formatter: Callable[[_ValuesT], str]) -> None: ... + def __init__( + self, values: _ValuesT_contra, message: str | None, values_formatter: Callable[[_ValuesT_contra], str] + ) -> None: ... @overload - def __init__(self, values: _ValuesT, message: str | None = None, *, values_formatter: Callable[[_ValuesT], str]) -> None: ... + def __init__( + self, values: _ValuesT_contra, message: str | None = None, *, values_formatter: Callable[[_ValuesT_contra], str] + ) -> None: ... def __call__(self, form: BaseForm, field: Field) -> None: ... @staticmethod def default_values_formatter(values: Iterable[object]) -> str: ... @@ -164,9 +168,13 @@ class NoneOf: @overload def __init__(self, values: Collection[Any], message: str | None = None, values_formatter: None = None) -> None: ... @overload - def __init__(self, values: _ValuesT, message: str | None, values_formatter: Callable[[_ValuesT], str]) -> None: ... + def __init__( + self, values: _ValuesT_contra, message: str | None, values_formatter: Callable[[_ValuesT_contra], str] + ) -> None: ... @overload - def __init__(self, values: _ValuesT, message: str | None = None, *, values_formatter: Callable[[_ValuesT], str]) -> None: ... + def __init__( + self, values: _ValuesT_contra, message: str | None = None, *, values_formatter: Callable[[_ValuesT_contra], str] + ) -> None: ... def __call__(self, form: BaseForm, field: Field) -> None: ... @staticmethod def default_values_formatter(v: Iterable[object]) -> str: ... diff --git a/stubs/networkx/networkx/algorithms/operators/binary.pyi b/stubs/networkx/networkx/algorithms/operators/binary.pyi index ef7f4943ca52..52b58c2b19d7 100644 --- a/stubs/networkx/networkx/algorithms/operators/binary.pyi +++ b/stubs/networkx/networkx/algorithms/operators/binary.pyi @@ -13,12 +13,12 @@ def difference(G, H): ... @_dispatchable def symmetric_difference(G, H): ... -_X = TypeVar("_X", bound=Hashable, covariant=True) -_Y = TypeVar("_Y", bound=Hashable, covariant=True) +_X_co = TypeVar("_X_co", bound=Hashable, covariant=True) +_Y_co = TypeVar("_Y_co", bound=Hashable, covariant=True) # GT = TypeVar('GT', bound=Graph[_Node]) # TODO: This does not handle the cases when graphs of different types are passed which is allowed @_dispatchable -def compose(G: DiGraph[_X], H: DiGraph[_Y]) -> DiGraph[_X | _Y]: ... +def compose(G: DiGraph[_X_co], H: DiGraph[_Y_co]) -> DiGraph[_X_co | _Y_co]: ... @_dispatchable -def union(G: DiGraph[_X], H: DiGraph[_Y], rename=()) -> DiGraph[_X | _Y]: ... +def union(G: DiGraph[_X_co], H: DiGraph[_Y_co], rename=()) -> DiGraph[_X_co | _Y_co]: ... diff --git a/stubs/pyserial/serial/tools/miniterm.pyi b/stubs/pyserial/serial/tools/miniterm.pyi index b53d8d074a61..3fc0bff77aa9 100644 --- a/stubs/pyserial/serial/tools/miniterm.pyi +++ b/stubs/pyserial/serial/tools/miniterm.pyi @@ -8,10 +8,10 @@ from typing_extensions import Self from serial import Serial -_AnyStr_T = TypeVar("_AnyStr_T", contravariant=True) +_AnyStr_T_contra = TypeVar("_AnyStr_T_contra", contravariant=True) @type_check_only -class _SupportsWriteAndFlush(SupportsWrite[_AnyStr_T], SupportsFlush, Protocol): ... +class _SupportsWriteAndFlush(SupportsWrite[_AnyStr_T_contra], SupportsFlush, Protocol): ... @type_check_only class _SupportsRead(Protocol): diff --git a/stubs/tensorflow/tensorflow/data/__init__.pyi b/stubs/tensorflow/tensorflow/data/__init__.pyi index 0ff8a7ea6a91..305043f7248f 100644 --- a/stubs/tensorflow/tensorflow/data/__init__.pyi +++ b/stubs/tensorflow/tensorflow/data/__init__.pyi @@ -14,21 +14,21 @@ from tensorflow.dtypes import DType from tensorflow.io import _CompressionTypes from tensorflow.python.trackable.base import Trackable -_T1 = TypeVar("_T1", covariant=True) +_T1_co = TypeVar("_T1_co", covariant=True) _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") -class Iterator(_Iterator[_T1], Trackable, ABC): +class Iterator(_Iterator[_T1_co], Trackable, ABC): @property @abstractmethod def element_spec(self) -> ContainerGeneric[TypeSpec[Any]]: ... @abstractmethod - def get_next(self) -> _T1: ... + def get_next(self) -> _T1_co: ... @abstractmethod - def get_next_as_optional(self) -> tf.experimental.Optional[_T1]: ... + def get_next_as_optional(self) -> tf.experimental.Optional[_T1_co]: ... -class Dataset(ABC, Generic[_T1]): - def apply(self, transformation_func: Callable[[Dataset[_T1]], Dataset[_T2]]) -> Dataset[_T2]: ... +class Dataset(ABC, Generic[_T1_co]): + def apply(self, transformation_func: Callable[[Dataset[_T1_co]], Dataset[_T2]]) -> Dataset[_T2]: ... def as_numpy_iterator(self) -> Iterator[np.ndarray[Any, Any]]: ... def batch( self, @@ -37,10 +37,10 @@ class Dataset(ABC, Generic[_T1]): num_parallel_calls: int | None = None, deterministic: bool | None = None, name: str | None = None, - ) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... def bucket_by_sequence_length( self, - element_length_func: Callable[[_T1], ScalarTensorCompatible], + element_length_func: Callable[[_T1_co], ScalarTensorCompatible], bucket_boundaries: Sequence[int], bucket_batch_sizes: Sequence[int], padded_shapes: ContainerGeneric[tf.TensorShape | TensorCompatible] | None = None, @@ -49,14 +49,14 @@ class Dataset(ABC, Generic[_T1]): no_padding: bool = False, drop_remainder: bool = False, name: str | None = None, - ) -> Dataset[_T1]: ... - def cache(self, filename: str = "", name: str | None = None) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... + def cache(self, filename: str = "", name: str | None = None) -> Dataset[_T1_co]: ... def cardinality(self) -> int: ... @staticmethod def choose_from_datasets( datasets: Sequence[Dataset[_T2]], choice_dataset: Dataset[tf.Tensor], stop_on_empty_dataset: bool = True ) -> Dataset[_T2]: ... - def concatenate(self, dataset: Dataset[_T1], name: str | None = None) -> Dataset[_T1]: ... + def concatenate(self, dataset: Dataset[_T1_co], name: str | None = None) -> Dataset[_T1_co]: ... @staticmethod def counter( start: ScalarTensorCompatible = 0, step: ScalarTensorCompatible = 1, dtype: DType = ..., name: str | None = None @@ -64,9 +64,9 @@ class Dataset(ABC, Generic[_T1]): @property @abstractmethod def element_spec(self) -> ContainerGeneric[TypeSpec[Any]]: ... - def enumerate(self, start: ScalarTensorCompatible = 0, name: str | None = None) -> Dataset[tuple[int, _T1]]: ... - def filter(self, predicate: Callable[[_T1], bool | tf.Tensor], name: str | None = None) -> Dataset[_T1]: ... - def flat_map(self, map_func: Callable[[_T1], Dataset[_T2]], name: str | None = None) -> Dataset[_T2]: ... + def enumerate(self, start: ScalarTensorCompatible = 0, name: str | None = None) -> Dataset[tuple[int, _T1_co]]: ... + def filter(self, predicate: Callable[[_T1_co], bool | tf.Tensor], name: str | None = None) -> Dataset[_T1_co]: ... + def flat_map(self, map_func: Callable[[_T1_co], Dataset[_T2]], name: str | None = None) -> Dataset[_T2]: ... # PEP 646 can be used here for a more precise type when better supported. @staticmethod def from_generator( @@ -81,26 +81,26 @@ class Dataset(ABC, Generic[_T1]): def from_tensors(tensors: Any, name: str | None = None) -> Dataset[Any]: ... @staticmethod def from_tensor_slices(tensors: TensorCompatible, name: str | None = None) -> Dataset[Any]: ... - def get_single_element(self, name: str | None = None) -> _T1: ... + def get_single_element(self, name: str | None = None) -> _T1_co: ... def group_by_window( self, - key_func: Callable[[_T1], tf.Tensor], - reduce_func: Callable[[tf.Tensor, Dataset[_T1]], Dataset[_T2]], + key_func: Callable[[_T1_co], tf.Tensor], + reduce_func: Callable[[tf.Tensor, Dataset[_T1_co]], Dataset[_T2]], window_size: ScalarTensorCompatible | None = None, window_size_func: Callable[[tf.Tensor], tf.Tensor] | None = None, name: str | None = None, ) -> Dataset[_T2]: ... - def ignore_errors(self, log_warning: bool = False, name: str | None = None) -> Dataset[_T1]: ... + def ignore_errors(self, log_warning: bool = False, name: str | None = None) -> Dataset[_T1_co]: ... def interleave( self, - map_func: Callable[[_T1], Dataset[_T2]], + map_func: Callable[[_T1_co], Dataset[_T2]], cycle_length: int | None = None, block_length: int | None = None, num_parallel_calls: int | None = None, deterministic: bool | None = None, name: str | None = None, ) -> Dataset[_T2]: ... - def __iter__(self) -> Iterator[_T1]: ... + def __iter__(self) -> Iterator[_T1_co]: ... @staticmethod def list_files( file_pattern: str | Sequence[str] | TensorCompatible, @@ -134,8 +134,8 @@ class Dataset(ABC, Generic[_T1]): padding_values: ContainerGeneric[ScalarTensorCompatible] | None = None, drop_remainder: bool = False, name: str | None = None, - ) -> Dataset[_T1]: ... - def prefetch(self, buffer_size: ScalarTensorCompatible, name: str | None = None) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... + def prefetch(self, buffer_size: ScalarTensorCompatible, name: str | None = None) -> Dataset[_T1_co]: ... def ragged_batch( self, batch_size: ScalarTensorCompatible, @@ -162,62 +162,62 @@ class Dataset(ABC, Generic[_T1]): ) -> Dataset[tf.Tensor]: ... def rebatch( self, batch_size: ScalarTensorCompatible, drop_remainder: bool = False, name: str | None = None - ) -> Dataset[_T1]: ... - def reduce(self, initial_state: _T2, reduce_func: Callable[[_T2, _T1], _T2], name: str | None = None) -> _T2: ... + ) -> Dataset[_T1_co]: ... + def reduce(self, initial_state: _T2, reduce_func: Callable[[_T2, _T1_co], _T2], name: str | None = None) -> _T2: ... def rejection_resample( self, - class_func: Callable[[_T1], ScalarTensorCompatible], + class_func: Callable[[_T1_co], ScalarTensorCompatible], target_dist: TensorCompatible, initial_dist: TensorCompatible | None = None, seed: int | None = None, name: str | None = None, - ) -> Dataset[_T1]: ... - def repeat(self, count: ScalarTensorCompatible | None = None, name: str | None = None) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... + def repeat(self, count: ScalarTensorCompatible | None = None, name: str | None = None) -> Dataset[_T1_co]: ... @staticmethod def sample_from_datasets( - datasets: Sequence[Dataset[_T1]], + datasets: Sequence[Dataset[_T1_co]], weights: TensorCompatible | None = None, seed: int | None = None, stop_on_empty_dataset: bool = False, rerandomize_each_iteration: bool | None = None, - ) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... # Incomplete as tf.train.CheckpointOptions not yet covered. def save( self, path: str, compression: _CompressionTypes = None, - shard_func: Callable[[_T1], int] | None = None, + shard_func: Callable[[_T1_co], int] | None = None, checkpoint_args: Incomplete | None = None, ) -> None: ... def scan( - self, initial_state: _T2, scan_func: Callable[[_T2, _T1], tuple[_T2, _T3]], name: str | None = None + self, initial_state: _T2, scan_func: Callable[[_T2, _T1_co], tuple[_T2, _T3]], name: str | None = None ) -> Dataset[_T3]: ... def shard( self, num_shards: ScalarTensorCompatible, index: ScalarTensorCompatible, name: str | None = None - ) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... def shuffle( self, buffer_size: ScalarTensorCompatible, seed: int | None = None, reshuffle_each_iteration: bool = True, name: str | None = None, - ) -> Dataset[_T1]: ... - def skip(self, count: ScalarTensorCompatible, name: str | None = None) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... + def skip(self, count: ScalarTensorCompatible, name: str | None = None) -> Dataset[_T1_co]: ... def snapshot( self, path: str, compression: _CompressionTypes = "AUTO", - reader_func: Callable[[Dataset[Dataset[_T1]]], Dataset[_T1]] | None = None, - shard_func: Callable[[_T1], ScalarTensorCompatible] | None = None, + reader_func: Callable[[Dataset[Dataset[_T1_co]]], Dataset[_T1_co]] | None = None, + shard_func: Callable[[_T1_co], ScalarTensorCompatible] | None = None, name: str | None = None, - ) -> Dataset[_T1]: ... + ) -> Dataset[_T1_co]: ... def sparse_batch( self, batch_size: ScalarTensorCompatible, row_shape: tf.TensorShape | TensorCompatible, name: str | None = None ) -> Dataset[tf.SparseTensor]: ... - def take(self, count: ScalarTensorCompatible, name: str | None = None) -> Dataset[_T1]: ... - def take_while(self, predicate: Callable[[_T1], ScalarTensorCompatible], name: str | None = None) -> Dataset[_T1]: ... - def unbatch(self, name: str | None = None) -> Dataset[_T1]: ... - def unique(self, name: str | None = None) -> Dataset[_T1]: ... + def take(self, count: ScalarTensorCompatible, name: str | None = None) -> Dataset[_T1_co]: ... + def take_while(self, predicate: Callable[[_T1_co], ScalarTensorCompatible], name: str | None = None) -> Dataset[_T1_co]: ... + def unbatch(self, name: str | None = None) -> Dataset[_T1_co]: ... + def unique(self, name: str | None = None) -> Dataset[_T1_co]: ... def window( self, size: ScalarTensorCompatible, @@ -225,8 +225,8 @@ class Dataset(ABC, Generic[_T1]): stride: ScalarTensorCompatible = 1, drop_remainder: bool = False, name: str | None = None, - ) -> Dataset[Dataset[_T1]]: ... - def with_options(self, options: Options, name: str | None = None) -> Dataset[_T1]: ... + ) -> Dataset[Dataset[_T1_co]]: ... + def with_options(self, options: Options, name: str | None = None) -> Dataset[_T1_co]: ... @overload @staticmethod def zip( diff --git a/stubs/tensorflow/tensorflow/distribute/experimental/coordinator.pyi b/stubs/tensorflow/tensorflow/distribute/experimental/coordinator.pyi index cc59692e72ec..92d1f6bcb9ed 100644 --- a/stubs/tensorflow/tensorflow/distribute/experimental/coordinator.pyi +++ b/stubs/tensorflow/tensorflow/distribute/experimental/coordinator.pyi @@ -3,10 +3,10 @@ from typing import Generic, TypeVar from tensorflow._aliases import AnyArray -_Value = TypeVar("_Value", covariant=True) +_Value_co = TypeVar("_Value_co", covariant=True) -class RemoteValue(Generic[_Value]): +class RemoteValue(Generic[_Value_co]): def fetch(self) -> AnyArray: ... - def get(self) -> _Value: ... + def get(self) -> _Value_co: ... def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi index a2a2211b56cf..21e4606f6680 100644 --- a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi +++ b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi @@ -11,8 +11,8 @@ from tensorflow.keras.constraints import Constraint from tensorflow.keras.initializers import _Initializer from tensorflow.keras.regularizers import Regularizer, _Regularizer -_InputT = TypeVar("_InputT", contravariant=True) -_OutputT = TypeVar("_OutputT", covariant=True) +_InputT_contra = TypeVar("_InputT_contra", contravariant=True) +_OutputT_co = TypeVar("_OutputT_co", covariant=True) class InputSpec: dtype: str | None @@ -39,9 +39,9 @@ class InputSpec: # Most layers have input and output type of just Tensor and when we support default type variables, # maybe worth trying. -class Layer(tf.Module, Generic[_InputT, _OutputT]): +class Layer(tf.Module, Generic[_InputT_contra, _OutputT_co]): # The most general type is ContainerGeneric[InputSpec] as it really - # depends on _InputT. For most Layers it is just InputSpec + # depends on _InputT_contra. For most Layers it is just InputSpec # though. Maybe describable with HKT? input_spec: InputSpec | Any @@ -65,11 +65,13 @@ class Layer(tf.Module, Generic[_InputT, _OutputT]): # *args/**kwargs are allowed, but have obscure footguns and tensorflow documentation discourages their usage. # First argument will automatically be cast to layer's compute dtype, but any other tensor arguments will not be. # Also various tensorflow tools/apis can misbehave if they encounter a layer with *args/**kwargs. - def __call__(self, inputs: _InputT, *, training: bool = False, mask: TensorCompatible | None = None) -> _OutputT: ... - def call(self, inputs: _InputT, /) -> _OutputT: ... + def __call__( + self, inputs: _InputT_contra, *, training: bool = False, mask: TensorCompatible | None = None + ) -> _OutputT_co: ... + def call(self, inputs: _InputT_contra, /) -> _OutputT_co: ... - # input_shape's real type depends on _InputT, but we can't express that without HKT. - # For example _InputT tf.Tensor -> tf.TensorShape, _InputT dict[str, tf.Tensor] -> dict[str, tf.TensorShape]. + # input_shape's real type depends on _InputT_contra, but we can't express that without HKT. + # For example _InputT_contra tf.Tensor -> tf.TensorShape, _InputT_contra dict[str, tf.Tensor] -> dict[str, tf.TensorShape]. def build(self, input_shape: Any, /) -> None: ... @overload def compute_output_shape(self: Layer[tf.Tensor, tf.Tensor], input_shape: tf.TensorShape, /) -> tf.TensorShape: ... diff --git a/stubs/tensorflow/tensorflow/saved_model/__init__.pyi b/stubs/tensorflow/tensorflow/saved_model/__init__.pyi index 538e8acabdbe..203d144c751f 100644 --- a/stubs/tensorflow/tensorflow/saved_model/__init__.pyi +++ b/stubs/tensorflow/tensorflow/saved_model/__init__.pyi @@ -10,7 +10,7 @@ from tensorflow.saved_model.experimental import VariablePolicy from tensorflow.types.experimental import ConcreteFunction, PolymorphicFunction _P = ParamSpec("_P") -_R = TypeVar("_R", covariant=True) +_R_co = TypeVar("_R_co", covariant=True) class Asset: @property @@ -77,10 +77,10 @@ class SaveOptions: def contains_saved_model(export_dir: str | Path) -> bool: ... -class _LoadedAttributes(Generic[_P, _R]): - signatures: Mapping[str, ConcreteFunction[_P, _R]] +class _LoadedAttributes(Generic[_P, _R_co]): + signatures: Mapping[str, ConcreteFunction[_P, _R_co]] -class _LoadedModel(AutoTrackable, _LoadedAttributes[_P, _R]): +class _LoadedModel(AutoTrackable, _LoadedAttributes[_P, _R_co]): variables: list[tf.Variable] trainable_variables: list[tf.Variable] # TF1 model artifact specific diff --git a/stubs/tensorflow/tensorflow/types/experimental.pyi b/stubs/tensorflow/tensorflow/types/experimental.pyi index 15d2ee854093..5d4a792cb2e3 100644 --- a/stubs/tensorflow/tensorflow/types/experimental.pyi +++ b/stubs/tensorflow/tensorflow/types/experimental.pyi @@ -7,23 +7,23 @@ import tensorflow as tf from tensorflow._aliases import ContainerGeneric _P = ParamSpec("_P") -_R = TypeVar("_R", covariant=True) +_R_co = TypeVar("_R_co", covariant=True) -class Callable(Generic[_P, _R], metaclass=abc.ABCMeta): - def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ... +class Callable(Generic[_P, _R_co], metaclass=abc.ABCMeta): + def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ... -class ConcreteFunction(Callable[_P, _R], metaclass=abc.ABCMeta): - def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ... +class ConcreteFunction(Callable[_P, _R_co], metaclass=abc.ABCMeta): + def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ... -class PolymorphicFunction(Callable[_P, _R], metaclass=abc.ABCMeta): +class PolymorphicFunction(Callable[_P, _R_co], metaclass=abc.ABCMeta): @overload @abc.abstractmethod - def get_concrete_function(self, *args: _P.args, **kwargs: _P.kwargs) -> ConcreteFunction[_P, _R]: ... + def get_concrete_function(self, *args: _P.args, **kwargs: _P.kwargs) -> ConcreteFunction[_P, _R_co]: ... @overload @abc.abstractmethod def get_concrete_function( self, *args: ContainerGeneric[tf.TypeSpec[Any]], **kwargs: ContainerGeneric[tf.TypeSpec[Any]] - ) -> ConcreteFunction[_P, _R]: ... + ) -> ConcreteFunction[_P, _R_co]: ... def experimental_get_compiler_ir(self, *args, **kwargs): ... GenericFunction = PolymorphicFunction From df6683f5c6d6b71b8cb37868f73d79c500294a1e Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 14:47:15 -0500 Subject: [PATCH 04/15] PLW1510 --- pyproject.toml | 2 -- scripts/create_baseline_stubs.py | 11 +++++------ scripts/stubsabot.py | 14 +++++--------- scripts/sync_protobuf/_utils.py | 6 ++---- scripts/sync_protobuf/google_protobuf.py | 2 +- scripts/sync_protobuf/s2clientprotocol.py | 2 +- scripts/sync_protobuf/tensorflow.py | 2 +- tests/mypy_test.py | 8 ++++---- tests/pyright_test.py | 4 ++-- tests/regr_test.py | 8 +++----- tests/runtests.py | 16 +++++++++------- tests/stubtest_stdlib.py | 2 +- tests/stubtest_third_party.py | 12 ++++++------ tests/typecheck_typeshed.py | 2 +- 14 files changed, 41 insertions(+), 50 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 726b36125320..2c3d166c62fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,8 +105,6 @@ ignore = [ "ASYNC221", # i don't know how to improve subprocess.check_call calls to satisfy this "FURB101", # TODO with PTH "FURB103", # TODO with PTH - # "PLC0105", - "PLW1510", "PLW1514", "RUF036", # None not at the end of the type annotation. # Request for autofix: astral-sh/ruff#15136 ### diff --git a/scripts/create_baseline_stubs.py b/scripts/create_baseline_stubs.py index 20d3c70d6a57..f59d04d242c3 100755 --- a/scripts/create_baseline_stubs.py +++ b/scripts/create_baseline_stubs.py @@ -46,28 +46,27 @@ def get_installed_package_info(project: str) -> tuple[str, str] | None: Return (normalized project name, installed version) if successful. """ - r = subprocess.run(["pip", "freeze"], capture_output=True, text=True, check=True) - return search_pip_freeze_output(project, r.stdout) + return search_pip_freeze_output(project, subprocess.check_output(["pip", "freeze"], text=True)) def run_stubgen(package: str, output: str) -> None: print(f"Running stubgen: stubgen -o {output} -p {package}") - subprocess.run(["stubgen", "-o", output, "-p", package, "--export-less"], check=True) + subprocess.check_call(["stubgen", "-o", output, "-p", package, "--export-less"]) def run_stubdefaulter(stub_dir: str) -> None: print(f"Running stubdefaulter: stubdefaulter --packages {stub_dir}") - subprocess.run(["stubdefaulter", "--packages", stub_dir]) + subprocess.run(["stubdefaulter", "--packages", stub_dir], check=False) def run_black(stub_dir: str) -> None: print(f"Running Black: black {stub_dir}") - subprocess.run(["pre-commit", "run", "black", "--files", *glob.iglob(f"{stub_dir}/**/*.pyi")]) + subprocess.run(["pre-commit", "run", "black", "--files", *glob.iglob(f"{stub_dir}/**/*.pyi")], check=False) def run_ruff(stub_dir: str) -> None: print(f"Running Ruff: ruff check {stub_dir} --fix-only") - subprocess.run([sys.executable, "-m", "ruff", "check", stub_dir, "--fix-only"]) + subprocess.run([sys.executable, "-m", "ruff", "check", stub_dir, "--fix-only"], check=False) async def get_project_urls_from_pypi(project: str, session: aiohttp.ClientSession) -> dict[str, str]: diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index f1c4e61e7a22..79a4ea32d149 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -616,10 +616,8 @@ def latest_commit_is_different_to_last_commit_on_origin(branch: str) -> bool: # If the number of lines is >1, # it indicates that something about our commit is different to the last commit # (Could be the commit "content", or the commit message). - commit_comparison = subprocess.run( - ["git", "range-diff", f"origin/{branch}~1..origin/{branch}", "HEAD~1..HEAD"], check=True, capture_output=True - ) - return len(commit_comparison.stdout.splitlines()) > 1 + commit_comparison = subprocess.check_output(["git", "range-diff", f"origin/{branch}~1..origin/{branch}", "HEAD~1..HEAD"]) + return len(commit_comparison.splitlines()) > 1 except subprocess.CalledProcessError: # origin/branch does not exist return True @@ -743,8 +741,8 @@ async def main() -> None: dists_to_update = args.distributions or [path.name for path in STUBS_PATH.iterdir()] if args.action_level > ActionLevel.nothing: - subprocess.run(["git", "update-index", "--refresh"], capture_output=True) - diff_result = subprocess.run(["git", "diff-index", "HEAD", "--name-only"], text=True, capture_output=True) + subprocess.run(["git", "update-index", "--refresh"], capture_output=True, check=False) + diff_result = subprocess.run(["git", "diff-index", "HEAD", "--name-only"], text=True, capture_output=True, check=False) if diff_result.returncode: print("Unexpected exception!") print(diff_result.stdout) @@ -760,9 +758,7 @@ async def main() -> None: denylist = {"gdb"} # gdb is not a pypi distribution - original_branch = subprocess.run( - ["git", "branch", "--show-current"], text=True, capture_output=True, check=True - ).stdout.strip() + original_branch = subprocess.check_output(["git", "branch", "--show-current"], text=True).strip() if args.action_level >= ActionLevel.local: subprocess.check_call(["git", "fetch", "--prune", "--all"]) diff --git a/scripts/sync_protobuf/_utils.py b/scripts/sync_protobuf/_utils.py index 7ad1b39cf408..2ef0db58a9e2 100644 --- a/scripts/sync_protobuf/_utils.py +++ b/scripts/sync_protobuf/_utils.py @@ -36,9 +36,7 @@ def run_protoc( proto_paths: Iterable[StrPath], mypy_out: StrPath, proto_globs: Iterable[str], cwd: StrOrBytesPath | None = None ) -> str: """TODO: Describe parameters and return.""" - protoc_version = ( - subprocess.run([sys.executable, "-m", "grpc_tools.protoc", "--version"], capture_output=True).stdout.decode().strip() - ) + protoc_version = subprocess.check_output([sys.executable, "-m", "grpc_tools.protoc", "--version"], text=True).strip() print() print(protoc_version) protoc_args = [ @@ -48,5 +46,5 @@ def run_protoc( *proto_globs, ] print("Running: protoc\n " + "\n ".join(protoc_args) + "\n") - subprocess.run((sys.executable, "-m", "grpc_tools.protoc", *protoc_args), cwd=cwd, check=True) + subprocess.check_call((sys.executable, "-m", "grpc_tools.protoc", *protoc_args), cwd=cwd) return protoc_version diff --git a/scripts/sync_protobuf/google_protobuf.py b/scripts/sync_protobuf/google_protobuf.py index 43d554c0cf93..9bbd4c905499 100644 --- a/scripts/sync_protobuf/google_protobuf.py +++ b/scripts/sync_protobuf/google_protobuf.py @@ -86,7 +86,7 @@ def main() -> None: print("Updated protobuf/METADATA.toml") # Run pre-commit to cleanup the stubs - subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi"))) + subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")), check=False) if __name__ == "__main__": diff --git a/scripts/sync_protobuf/s2clientprotocol.py b/scripts/sync_protobuf/s2clientprotocol.py index 61312a63669d..59e21905b51c 100644 --- a/scripts/sync_protobuf/s2clientprotocol.py +++ b/scripts/sync_protobuf/s2clientprotocol.py @@ -67,7 +67,7 @@ def main() -> None: print("Updated s2clientprotocol/METADATA.toml") # Run pre-commit to cleanup the stubs - subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi"))) + subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")), check=False) if __name__ == "__main__": diff --git a/scripts/sync_protobuf/tensorflow.py b/scripts/sync_protobuf/tensorflow.py index ff1aca962706..b452cc2d41ee 100644 --- a/scripts/sync_protobuf/tensorflow.py +++ b/scripts/sync_protobuf/tensorflow.py @@ -135,7 +135,7 @@ def main() -> None: print("Updated tensorflow/METADATA.toml") # Run pre-commit to cleanup the stubs - subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi"))) + subprocess.run((sys.executable, "-m", "pre_commit", "run", "--files", *STUBS_FOLDER.rglob("*_pb2.pyi")), check=False) if __name__ == "__main__": diff --git a/tests/mypy_test.py b/tests/mypy_test.py index 8d8c8372b339..bf7f86aed802 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -253,7 +253,7 @@ def run_mypy( mypy_command = [python_path, "-m", "mypy", *mypy_args] if args.verbose: print(colored(f"running {' '.join(mypy_command)}", "blue")) - result = subprocess.run(mypy_command, capture_output=True, text=True, env=env_vars) + result = subprocess.run(mypy_command, capture_output=True, text=True, env=env_vars, check=False) if result.returncode: print_error(f"failure (exit code {result.returncode})\n") if result.stdout: @@ -262,7 +262,7 @@ def run_mypy( print_error(result.stderr) if non_types_dependencies and args.verbose: print("Ran with the following environment:") - subprocess.run(["uv", "pip", "freeze"], env={**os.environ, "VIRTUAL_ENV": str(venv_dir)}) + subprocess.run(["uv", "pip", "freeze"], env={**os.environ, "VIRTUAL_ENV": str(venv_dir)}, check=False) print() else: print_success_msg() @@ -409,7 +409,7 @@ def setup_venv_for_external_requirements_set( uv_command = ["uv", "venv", str(venv_dir)] if not args.verbose: uv_command.append("--quiet") - subprocess.run(uv_command, check=True) + subprocess.check_call(uv_command) return requirements_set, venv_dir @@ -423,7 +423,7 @@ def install_requirements_for_venv(venv_dir: Path, args: TestConfig, external_req else: uv_command.append("--quiet") try: - subprocess.run(uv_command, check=True, text=True, env={**os.environ, "VIRTUAL_ENV": str(venv_dir)}) + subprocess.check_call(uv_command, text=True, env={**os.environ, "VIRTUAL_ENV": str(venv_dir)}) except subprocess.CalledProcessError as e: print(e.stderr) raise diff --git a/tests/pyright_test.py b/tests/pyright_test.py index 46986a112b4d..21bdf404896f 100755 --- a/tests/pyright_test.py +++ b/tests/pyright_test.py @@ -24,7 +24,7 @@ def main() -> None: sys.exit(1) try: - subprocess.run([npx, "--version"]) + subprocess.check_call([npx, "--version"]) except OSError: print("error running npx; is Node.js installed?", file=sys.stderr) sys.exit(1) @@ -40,7 +40,7 @@ def main() -> None: command = [npx, f"pyright@{pyright_version}"] + sys.argv[1:] print_command(command) - ret = subprocess.run(command).returncode + ret = subprocess.run(command, check=False).returncode sys.exit(ret) diff --git a/tests/regr_test.py b/tests/regr_test.py index 5101373fca13..3ecad32dfae4 100755 --- a/tests/regr_test.py +++ b/tests/regr_test.py @@ -144,7 +144,7 @@ def setup_testcase_dir(package: DistributionTests, tempdir: Path, verbosity: Ver if requirements.external_pkgs: venv_location = str(tempdir / VENV_DIR) - subprocess.run(["uv", "venv", venv_location], check=True, capture_output=True) + subprocess.check_output(["uv", "venv", venv_location]) ext_requirements = [str(r) for r in requirements.external_pkgs] uv_command = ["uv", "pip", "install", get_mypy_req(), *ext_requirements] if sys.platform == "win32": @@ -155,9 +155,7 @@ def setup_testcase_dir(package: DistributionTests, tempdir: Path, verbosity: Ver if verbosity is Verbosity.VERBOSE: verbose_log(f"{package.name}: Setting up venv in {venv_location}. {uv_command=}\n") try: - subprocess.run( - uv_command, check=True, capture_output=True, text=True, env=os.environ | {"VIRTUAL_ENV": venv_location} - ) + subprocess.check_output(uv_command, text=True, env=os.environ | {"VIRTUAL_ENV": venv_location}) except subprocess.CalledProcessError as e: _PRINT_QUEUE.put(f"{package.name}\n{e.stderr}") raise @@ -224,7 +222,7 @@ def run_testcases( msg += f"{description}: MYPYPATH not set" msg += "\n" verbose_log(msg) - return subprocess.run(mypy_command, capture_output=True, text=True, env=env_vars) + return subprocess.run(mypy_command, capture_output=True, text=True, env=env_vars, check=False) @dataclass(frozen=True) diff --git a/tests/runtests.py b/tests/runtests.py index fb1294eae293..1525e06223da 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -75,10 +75,10 @@ def main() -> None: pytype_result: subprocess.CompletedProcess[bytes] | None = None print("\nRunning pre-commit...") - pre_commit_result = subprocess.run(["pre-commit", "run", "--files", *Path(path).rglob("*")]) + pre_commit_result = subprocess.run(["pre-commit", "run", "--files", *Path(path).rglob("*")], check=False) print("\nRunning check_typeshed_structure.py...") - check_structure_result = subprocess.run([sys.executable, "tests/check_typeshed_structure.py"]) + check_structure_result = subprocess.run([sys.executable, "tests/check_typeshed_structure.py"], check=False) strict_params = _get_strict_params(path) print(f"\nRunning Pyright ({'stricter' if strict_params else 'base' } configs) for Python {python_version}...") @@ -86,6 +86,7 @@ def main() -> None: [sys.executable, "tests/pyright_test.py", path, "--pythonversion", python_version, *strict_params], stderr=subprocess.PIPE, text=True, + check=False, ) if re.match(_NPX_ERROR_PATTERN, pyright_result.stderr): print(_NPX_ERROR_MESSAGE) @@ -97,15 +98,15 @@ def main() -> None: pyright_skipped = False print(f"\nRunning mypy for Python {python_version}...") - mypy_result = subprocess.run([sys.executable, "tests/mypy_test.py", path, "--python-version", python_version]) + mypy_result = subprocess.run([sys.executable, "tests/mypy_test.py", path, "--python-version", python_version], check=False) # If mypy failed, stubtest will fail without any helpful error if mypy_result.returncode == 0: if folder == "stdlib": print("\nRunning stubtest...") - stubtest_result = subprocess.run([sys.executable, "tests/stubtest_stdlib.py", stub]) + stubtest_result = subprocess.run([sys.executable, "tests/stubtest_stdlib.py", stub], check=False) elif run_stubtest: print("\nRunning stubtest...") - stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub]) + stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub], check=False) else: print( colored( @@ -120,7 +121,7 @@ def main() -> None: if find_spec("pytype"): print("\nRunning pytype...") - pytype_result = subprocess.run([sys.executable, "tests/pytype_test.py", path]) + pytype_result = subprocess.run([sys.executable, "tests/pytype_test.py", path], check=False) else: print(colored("\nSkipping pytype on Windows. You need to install it first: `pip install pytype`.", "yellow")) @@ -142,7 +143,7 @@ def main() -> None: "-p", _TESTCASES_CONFIG_FILE, ] - pyright_testcases_result = subprocess.run(command, stderr=subprocess.PIPE, text=True) + pyright_testcases_result = subprocess.run(command, stderr=subprocess.PIPE, text=True, check=False) if re.match(_NPX_ERROR_PATTERN, pyright_testcases_result.stderr): print(_NPX_ERROR_MESSAGE) pyright_testcases_returncode = 0 @@ -157,6 +158,7 @@ def main() -> None: [sys.executable, "tests/regr_test.py", "stdlib" if folder == "stdlib" else stub, "--python-version", python_version], stderr=subprocess.PIPE, text=True, + check=False, ) # No test means they all ran successfully (0 out of 0). Not all 3rd-party stubs have regression tests. if "No test cases found" in regr_test_result.stderr: diff --git a/tests/stubtest_stdlib.py b/tests/stubtest_stdlib.py index a2d2afa90ba2..1a0718ee8cb4 100755 --- a/tests/stubtest_stdlib.py +++ b/tests/stubtest_stdlib.py @@ -37,7 +37,7 @@ def run_stubtest(typeshed_dir: Path) -> int: cmd += ["--ignore-positional-only"] print(" ".join(cmd), file=sys.stderr) try: - subprocess.run(cmd, check=True) + subprocess.check_call(cmd) except subprocess.CalledProcessError as e: print( "\nNB: stubtest output depends on the Python version (and system) it is run with. " diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index 48befff02cad..b650c06001ec 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -63,7 +63,7 @@ def run_stubtest( venv_dir = Path(tmp) try: try: - subprocess.run(["uv", "venv", venv_dir, "--seed"], capture_output=True, check=True) + subprocess.check_output(["uv", "venv", venv_dir, "--seed"]) except subprocess.CalledProcessError as e: print_command_failure("Failed to create a virtualenv (likely a bug in uv?)", e) return False @@ -93,7 +93,7 @@ def run_stubtest( pip_cmd = [pip_exe, "install", *dists_to_install] try: - subprocess.run(pip_cmd, check=True, capture_output=True) + subprocess.check_output(pip_cmd) except subprocess.CalledProcessError as e: print_command_failure("Failed to install", e) return False @@ -133,7 +133,7 @@ def run_stubtest( return False try: - subprocess.run(stubtest_cmd, env=stubtest_env, check=True, capture_output=True) + subprocess.check_output(stubtest_cmd, env=stubtest_env) except subprocess.CalledProcessError as e: print_error("fail") @@ -147,11 +147,11 @@ def run_stubtest( print_divider() print("Python version: ", end="", flush=True) - ret = subprocess.run([sys.executable, "-VV"], capture_output=True) + ret = subprocess.run([sys.executable, "-VV"], capture_output=True, check=False) print_command_output(ret) print("\nRan with the following environment:") - ret = subprocess.run([pip_exe, "freeze", "--all"], capture_output=True) + ret = subprocess.run([pip_exe, "freeze", "--all"], capture_output=True, check=False) print_command_output(ret) if keep_tmp_dir: print("Path to virtual environment:", venv_dir, flush=True) @@ -163,7 +163,7 @@ def run_stubtest( print() else: print(f"Re-running stubtest with --generate-allowlist.\nAdd the following to {main_allowlist_path}:") - ret = subprocess.run([*stubtest_cmd, "--generate-allowlist"], env=stubtest_env, capture_output=True) + ret = subprocess.run([*stubtest_cmd, "--generate-allowlist"], env=stubtest_env, capture_output=True, check=False) print_command_output(ret) print_divider() diff --git a/tests/typecheck_typeshed.py b/tests/typecheck_typeshed.py index ea90b0ac0d0f..6a84022b6e47 100755 --- a/tests/typecheck_typeshed.py +++ b/tests/typecheck_typeshed.py @@ -70,7 +70,7 @@ def run_mypy_as_subprocess(directory: str, platform: str, version: str) -> Retur "--custom-typeshed-dir", ".", ] - result = subprocess.run(command, capture_output=True, text=True) + result = subprocess.run(command, capture_output=True, text=True, check=False) if result.stderr: print_error(result.stderr) if result.stdout: From bb420ea1d3792385b5c9db6c65acca8452b8abb7 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 14:55:52 -0500 Subject: [PATCH 05/15] PLW1514 --- pyproject.toml | 3 +-- scripts/sync_protobuf/google_protobuf.py | 4 ++-- scripts/sync_protobuf/tensorflow.py | 4 ++-- tests/mypy_test.py | 2 +- tests/pytype_test.py | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2c3d166c62fb..15dd18f386b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,10 +102,9 @@ extend-safe-fixes = [ ] ignore = [ # TODO - "ASYNC221", # i don't know how to improve subprocess.check_call calls to satisfy this + "ASYNC221", # I don't know how to improve subprocess.check_call calls to satisfy this "FURB101", # TODO with PTH "FURB103", # TODO with PTH - "PLW1514", "RUF036", # None not at the end of the type annotation. # Request for autofix: astral-sh/ruff#15136 ### # Rules that can conflict with the formatter (Black) diff --git a/scripts/sync_protobuf/google_protobuf.py b/scripts/sync_protobuf/google_protobuf.py index 9bbd4c905499..96d0ca5f5b8a 100644 --- a/scripts/sync_protobuf/google_protobuf.py +++ b/scripts/sync_protobuf/google_protobuf.py @@ -31,7 +31,7 @@ def extract_python_version(file_path: Path) -> str: """Extract the Python version from https://github.com/protocolbuffers/protobuf/blob/main/version.json .""" - with open(file_path) as file: + with open(file_path, encoding="utf-8") as file: data: dict[str, Any] = json.load(file) # The root key will be the protobuf source code version version = next(iter(data.values()))["languages"]["python"] @@ -44,7 +44,7 @@ def extract_proto_file_paths(temp_dir: Path) -> list[str]: as described in py_proto_library calls in https://github.com/protocolbuffers/protobuf/blob/main/python/dist/BUILD.bazel . """ - with open(temp_dir / EXTRACTED_PACKAGE_DIR / "python" / "dist" / "BUILD.bazel") as file: + with open(temp_dir / EXTRACTED_PACKAGE_DIR / "python" / "dist" / "BUILD.bazel", encoding="utf-8") as file: matched_lines = filter(None, (re.search(PROTO_FILE_PATTERN, line) for line in file)) return [ EXTRACTED_PACKAGE_DIR + "/src/google/protobuf/" + match.group(1).replace("compiler_", "compiler/") + ".proto" diff --git a/scripts/sync_protobuf/tensorflow.py b/scripts/sync_protobuf/tensorflow.py index b452cc2d41ee..27e28824affc 100644 --- a/scripts/sync_protobuf/tensorflow.py +++ b/scripts/sync_protobuf/tensorflow.py @@ -70,7 +70,7 @@ def post_creation() -> None: for path in STUBS_FOLDER.rglob("*_pb2.pyi"): print(f"Fixing imports in '{path}'") - with open(path) as file: + with open(path, encoding="utf-8") as file: filedata = file.read() # Replace the target string @@ -78,7 +78,7 @@ def post_creation() -> None: filedata = re.sub(XLA_IMPORT_PATTERN, "\\1tensorflow.compiler.xla.", filedata) # Write the file out again - with open(path, "w") as file: + with open(path, "w", encoding="utf-8") as file: file.write(filedata) print() diff --git a/tests/mypy_test.py b/tests/mypy_test.py index bf7f86aed802..2835ba0e3d7e 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -211,7 +211,7 @@ def run_mypy( env_vars = dict(os.environ) if mypypath is not None: env_vars["MYPYPATH"] = mypypath - with tempfile.NamedTemporaryFile("w+") as temp: + with tempfile.NamedTemporaryFile("w+", encoding="utf-8") as temp: temp.write("[mypy]\n") for dist_conf in configurations: temp.write(f"[mypy-{dist_conf.module_name}]\n") diff --git a/tests/pytype_test.py b/tests/pytype_test.py index a5b8727a6c75..b2c0c8d23dd2 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -208,7 +208,7 @@ def get_missing_modules(files_to_test: Sequence[str]) -> Iterable[str]: test_dir = os.path.dirname(__file__) exclude_list = os.path.join(test_dir, "pytype_exclude_list.txt") - with open(exclude_list) as f: + with open(exclude_list, encoding="utf-8") as f: excluded_files = f.readlines() for fi in excluded_files: if not fi.startswith("stubs/"): From 9676aa9992d1b32f900b3db54f00146ed086a541 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 15:14:36 -0500 Subject: [PATCH 06/15] Fix import issue --- stubs/tensorflow/tensorflow/keras/models.pyi | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/stubs/tensorflow/tensorflow/keras/models.pyi b/stubs/tensorflow/tensorflow/keras/models.pyi index e024ed5c26fb..262bd49c897f 100644 --- a/stubs/tensorflow/tensorflow/keras/models.pyi +++ b/stubs/tensorflow/tensorflow/keras/models.pyi @@ -9,14 +9,14 @@ import numpy.typing as npt import tensorflow as tf from tensorflow import Variable from tensorflow._aliases import ContainerGeneric, ShapeLike, TensorCompatible -from tensorflow.keras.layers import Layer, _InputT, _OutputT +from tensorflow.keras.layers import Layer, _InputT_contra, _OutputT_co from tensorflow.keras.optimizers import Optimizer _Loss: TypeAlias = str | tf.keras.losses.Loss | Callable[[TensorCompatible, TensorCompatible], tf.Tensor] _Metric: TypeAlias = str | tf.keras.metrics.Metric | Callable[[TensorCompatible, TensorCompatible], tf.Tensor] | None # Missing keras.src.backend.tensorflow.trainer.TensorFlowTrainer as a base class, which is not exposed by tensorflow -class Model(Layer[_InputT, _OutputT]): +class Model(Layer[_InputT_contra, _OutputT_co]): _train_counter: tf.Variable _test_counter: tf.Variable optimizer: Optimizer | None @@ -27,13 +27,15 @@ class Model(Layer[_InputT, _OutputT]): ) -> tf.Tensor | None: ... stop_training: bool - def __new__(cls, *args: Any, **kwargs: Any) -> Model[_InputT, _OutputT]: ... + def __new__(cls, *args: Any, **kwargs: Any) -> Model[_InputT_contra, _OutputT_co]: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... def __setattr__(self, name: str, value: Any) -> None: ... def __reduce__(self): ... def build(self, input_shape: ShapeLike) -> None: ... - def __call__(self, inputs: _InputT, *, training: bool = False, mask: TensorCompatible | None = None) -> _OutputT: ... - def call(self, inputs: _InputT, training: bool | None = None, mask: TensorCompatible | None = None) -> _OutputT: ... + def __call__( + self, inputs: _InputT_contra, *, training: bool = False, mask: TensorCompatible | None = None + ) -> _OutputT_co: ... + def call(self, inputs: _InputT_contra, training: bool | None = None, mask: TensorCompatible | None = None) -> _OutputT_co: ... # Ideally loss/metrics/output would share the same structure but higher kinded types are not supported. def compile( self, @@ -106,8 +108,8 @@ class Model(Layer[_InputT, _OutputT]): return_dict: bool = False, **kwargs: Any, ) -> float | list[float]: ... - def predict_step(self, data: _InputT) -> _OutputT: ... - def make_predict_function(self, force: bool = False) -> Callable[[tf.data.Iterator[Incomplete]], _OutputT]: ... + def predict_step(self, data: _InputT_contra) -> _OutputT_co: ... + def make_predict_function(self, force: bool = False) -> Callable[[tf.data.Iterator[Incomplete]], _OutputT_co]: ... def predict( self, x: TensorCompatible | tf.data.Dataset[Incomplete], @@ -115,7 +117,7 @@ class Model(Layer[_InputT, _OutputT]): verbose: Literal["auto", 0, 1, 2] = "auto", steps: int | None = None, callbacks: list[tf.keras.callbacks.Callback] | None = None, - ) -> _OutputT: ... + ) -> _OutputT_co: ... def reset_metrics(self) -> None: ... def train_on_batch( self, @@ -132,7 +134,7 @@ class Model(Layer[_InputT, _OutputT]): sample_weight: npt.NDArray[np.float64] | None = None, return_dict: bool = False, ) -> float | list[float]: ... - def predict_on_batch(self, x: Iterator[_InputT]) -> npt.NDArray[Incomplete]: ... + def predict_on_batch(self, x: Iterator[_InputT_contra]) -> npt.NDArray[Incomplete]: ... @property def trainable_weights(self) -> list[Variable]: ... @property From 1c491f7af19d6549153da0fe84944a9f5d49e7d0 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 15:27:10 -0500 Subject: [PATCH 07/15] Revert some subprocess.check_output --- stubs/gevent/@tests/stubtest_allowlist.txt | 1 - tests/regr_test.py | 4 +++- tests/stubtest_third_party.py | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/stubs/gevent/@tests/stubtest_allowlist.txt b/stubs/gevent/@tests/stubtest_allowlist.txt index a2e812a8125b..0b0da22fc238 100644 --- a/stubs/gevent/@tests/stubtest_allowlist.txt +++ b/stubs/gevent/@tests/stubtest_allowlist.txt @@ -213,7 +213,6 @@ gevent.socket.wait_write # we have punted on ssl, the gevent version of these functions have an additional # argument for timeouts/blocking and there are some with different default values # for nbytes/length, for now we ignore that fact -gevent.ssl.Purpose.__new__ gevent.ssl.SSLSocket.__init__ gevent.ssl.SSLSocket.do_handshake gevent.ssl.SSLSocket.read diff --git a/tests/regr_test.py b/tests/regr_test.py index 3ecad32dfae4..ef297b7b54f5 100755 --- a/tests/regr_test.py +++ b/tests/regr_test.py @@ -155,7 +155,9 @@ def setup_testcase_dir(package: DistributionTests, tempdir: Path, verbosity: Ver if verbosity is Verbosity.VERBOSE: verbose_log(f"{package.name}: Setting up venv in {venv_location}. {uv_command=}\n") try: - subprocess.check_output(uv_command, text=True, env=os.environ | {"VIRTUAL_ENV": venv_location}) + subprocess.run( + uv_command, check=True, capture_output=True, text=True, env=os.environ | {"VIRTUAL_ENV": venv_location} + ) except subprocess.CalledProcessError as e: _PRINT_QUEUE.put(f"{package.name}\n{e.stderr}") raise diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index b650c06001ec..8565df77c324 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -63,7 +63,7 @@ def run_stubtest( venv_dir = Path(tmp) try: try: - subprocess.check_output(["uv", "venv", venv_dir, "--seed"]) + subprocess.run(["uv", "venv", venv_dir, "--seed"], capture_output=True, check=True) except subprocess.CalledProcessError as e: print_command_failure("Failed to create a virtualenv (likely a bug in uv?)", e) return False @@ -93,7 +93,7 @@ def run_stubtest( pip_cmd = [pip_exe, "install", *dists_to_install] try: - subprocess.check_output(pip_cmd) + subprocess.run(pip_cmd, check=True, capture_output=True) except subprocess.CalledProcessError as e: print_command_failure("Failed to install", e) return False @@ -133,7 +133,7 @@ def run_stubtest( return False try: - subprocess.check_output(stubtest_cmd, env=stubtest_env) + subprocess.run(stubtest_cmd, env=stubtest_env, check=True, capture_output=True) except subprocess.CalledProcessError as e: print_error("fail") From 705378f3031db298088bc364ffcba106c7d0efea Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 16:17:50 -0500 Subject: [PATCH 08/15] pep8-naming --- pyproject.toml | 9 +++++---- stdlib/asyncio/trsock.pyi | 2 +- stdlib/csv.pyi | 2 +- stdlib/dataclasses.pyi | 2 +- stdlib/hmac.pyi | 2 +- stdlib/multiprocessing/reduction.pyi | 2 +- stdlib/sre_parse.pyi | 4 ++-- stubs/gevent/gevent/_threading.pyi | 2 +- stubs/gevent/gevent/backdoor.pyi | 2 +- stubs/gevent/gevent/baseserver.pyi | 2 +- stubs/gevent/gevent/pywsgi.pyi | 2 +- stubs/gevent/gevent/server.pyi | 2 +- stubs/pexpect/pexpect/socket_pexpect.pyi | 6 +++--- stubs/python-xlib/Xlib/protocol/rq.pyi | 4 +--- 14 files changed, 21 insertions(+), 22 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 15dd18f386b9..a8eef218f0de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -165,10 +165,11 @@ ignore = [ # TODO: Ruff 0.8.0 added sorting of __all__ and __slots_. Validate whether we want this in stubs "RUF022", "RUF023", - # Most flake8-bugbear and pep8-naming rules don't apply for third-party stubs like typeshed. - # B033 could be slightly useful but Ruff doesn't have per-file select - "B", # flake8-bugbear - "N", # pep8-naming + # Most pep8-naming rules don't apply for third-party stubs like typeshed. + "N80", # pep8-naming + "N815", # pep8-naming + "N816", # pep8-naming + "N818", # pep8-naming # Rules that are out of the control of stub authors: "A001", # builtin-variable-shadowing "A002", # builtin-argument-shadowing diff --git a/stdlib/asyncio/trsock.pyi b/stdlib/asyncio/trsock.pyi index e74cf6fd4e05..53c3f74fe97f 100644 --- a/stdlib/asyncio/trsock.pyi +++ b/stdlib/asyncio/trsock.pyi @@ -1,7 +1,7 @@ import socket import sys from _typeshed import ReadableBuffer -from builtins import type as Type # alias to avoid name clashes with property named "type" +from builtins import type as Type # noqa: N812 # alias to avoid name clashes with property named "type" from collections.abc import Iterable from types import TracebackType from typing import Any, BinaryIO, NoReturn, overload diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 4a82de638136..b14c8f7dd7f5 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -22,7 +22,7 @@ if sys.version_info >= (3, 12): if sys.version_info >= (3, 10): from _csv import Reader, Writer else: - from _csv import _reader as Reader, _writer as Writer + from _csv import _reader as Reader, _writer as Writer # noqa: N812 from _typeshed import SupportsWrite from collections.abc import Collection, Iterable, Mapping, Sequence diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index 3d89b830352b..3ac8a55b1478 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -2,7 +2,7 @@ import enum import sys import types from _typeshed import DataclassInstance -from builtins import type as Type # alias to avoid name clashes with fields named "type" +from builtins import type as Type # noqa: N812 # alias to avoid name clashes with fields named "type" from collections.abc import Callable, Iterable, Mapping from typing import Any, Generic, Literal, Protocol, TypeVar, overload from typing_extensions import Never, TypeAlias, TypeIs diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index efd649ec39a8..dcb11c517807 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -1,5 +1,5 @@ import sys -from _hashlib import HASH as _HashlibHash +from _hashlib import HASH as _HashlibHash # noqa: N811 # Not a constant from _typeshed import ReadableBuffer, SizedBuffer from collections.abc import Callable from types import ModuleType diff --git a/stdlib/multiprocessing/reduction.pyi b/stdlib/multiprocessing/reduction.pyi index 942e92ce530e..2e8b3b96ad84 100644 --- a/stdlib/multiprocessing/reduction.pyi +++ b/stdlib/multiprocessing/reduction.pyi @@ -3,7 +3,7 @@ import sys from _pickle import _ReducedType from _typeshed import HasFileno, SupportsWrite, Unused from abc import ABCMeta -from builtins import type as Type # alias to avoid name clash +from builtins import type as Type # noqa: N812 # alias to avoid name clash from collections.abc import Callable from copyreg import _DispatchTableType from multiprocessing import connection diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index c242bd2a065f..dbf43ded2590 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -2,7 +2,7 @@ import sys from collections.abc import Iterable from re import Match, Pattern as _Pattern from sre_constants import * -from sre_constants import _NamedIntConstant as _NIC, error as _Error +from sre_constants import _NamedIntConstant as _NIC, error as _error from typing import Any, overload from typing_extensions import TypeAlias @@ -74,7 +74,7 @@ class Tokenizer: def pos(self) -> int: ... def tell(self) -> int: ... def seek(self, index: int) -> None: ... - def error(self, msg: str, offset: int = 0) -> _Error: ... + def error(self, msg: str, offset: int = 0) -> _error: ... if sys.version_info >= (3, 12): def checkgroupname(self, name: str, offset: int) -> None: ... diff --git a/stubs/gevent/gevent/_threading.pyi b/stubs/gevent/gevent/_threading.pyi index 0eeaaf454716..50ec8808caf6 100644 --- a/stubs/gevent/gevent/_threading.pyi +++ b/stubs/gevent/gevent/_threading.pyi @@ -1,4 +1,4 @@ -from _thread import LockType, allocate_lock as Lock +from _thread import LockType, allocate_lock as Lock # noqa: N812 # Shouldn't apply to re-exports from typing import Generic, NewType, TypeVar __all__ = ["Lock", "Queue", "EmptyTimeout"] diff --git a/stubs/gevent/gevent/backdoor.pyi b/stubs/gevent/gevent/backdoor.pyi index a9fd2a8eca7c..f8fafb07139a 100644 --- a/stubs/gevent/gevent/backdoor.pyi +++ b/stubs/gevent/gevent/backdoor.pyi @@ -3,7 +3,7 @@ from typing import Any, overload from gevent.baseserver import _Spawner from gevent.server import StreamServer, _Address -from gevent.socket import socket as _GeventSocket +from gevent.socket import socket as _GeventSocket # noqa: N812 from gevent.ssl import SSLContext class BackdoorServer(StreamServer): diff --git a/stubs/gevent/gevent/baseserver.pyi b/stubs/gevent/gevent/baseserver.pyi index 3a8ac540ae45..0000a4579150 100644 --- a/stubs/gevent/gevent/baseserver.pyi +++ b/stubs/gevent/gevent/baseserver.pyi @@ -5,7 +5,7 @@ from typing_extensions import ParamSpec, Self, TypeAlias from gevent._types import _Loop from gevent.pool import Pool -from gevent.socket import socket as _GeventSocket +from gevent.socket import socket as _GeventSocket # noqa: N812 from greenlet import greenlet _P = ParamSpec("_P") diff --git a/stubs/gevent/gevent/pywsgi.pyi b/stubs/gevent/gevent/pywsgi.pyi index 8c25035fd2cb..3b81a72981b9 100644 --- a/stubs/gevent/gevent/pywsgi.pyi +++ b/stubs/gevent/gevent/pywsgi.pyi @@ -10,7 +10,7 @@ from typing_extensions import Self from gevent.baseserver import _Spawner from gevent.server import StreamServer -from gevent.socket import socket as _GeventSocket +from gevent.socket import socket as _GeventSocket # noqa: N812 from gevent.ssl import SSLContext __all__ = ["WSGIServer", "WSGIHandler", "LoggingLogAdapter", "Environ", "SecureEnviron", "WSGISecureEnviron"] diff --git a/stubs/gevent/gevent/server.pyi b/stubs/gevent/gevent/server.pyi index 36ce8d951f6e..b4c950d8a803 100644 --- a/stubs/gevent/gevent/server.pyi +++ b/stubs/gevent/gevent/server.pyi @@ -5,7 +5,7 @@ from typing import Any, ClassVar, TypedDict, overload from typing_extensions import TypeAlias from gevent.baseserver import BaseServer, _Spawner -from gevent.socket import socket as _GeventSocket +from gevent.socket import socket as _GeventSocket # noqa: N812 from gevent.ssl import SSLContext, wrap_socket as ssl_wrap_socket # For simplicity we treat _Address as Any, we could be more strict and use the definition diff --git a/stubs/pexpect/pexpect/socket_pexpect.pyi b/stubs/pexpect/pexpect/socket_pexpect.pyi index f3c8d42d0b56..56aa0fde21cb 100644 --- a/stubs/pexpect/pexpect/socket_pexpect.pyi +++ b/stubs/pexpect/pexpect/socket_pexpect.pyi @@ -1,5 +1,5 @@ from collections.abc import Iterable -from socket import socket as Socket +from socket import socket from typing import AnyStr from .spawnbase import SpawnBase, _Logfile @@ -9,14 +9,14 @@ __all__ = ["SocketSpawn"] class SocketSpawn(SpawnBase[AnyStr]): args: None command: None - socket: Socket + socket: socket child_fd: int closed: bool name: str use_poll: bool def __init__( self, - socket: Socket, + socket: socket, args: None = None, timeout: float | None = 30, maxread: int = 2000, diff --git a/stubs/python-xlib/Xlib/protocol/rq.pyi b/stubs/python-xlib/Xlib/protocol/rq.pyi index b429499d38a0..9d7a01ca47e8 100644 --- a/stubs/python-xlib/Xlib/protocol/rq.pyi +++ b/stubs/python-xlib/Xlib/protocol/rq.pyi @@ -1,8 +1,6 @@ from _typeshed import ConvertibleToInt, SliceableBuffer, Unused from array import array - -# Avoid name collision with List.type -from builtins import type as Type +from builtins import type as Type # noqa: N812 # Avoid name collision with List.type from collections.abc import Callable, Iterable, Sequence from typing import Any, Final, Literal, SupportsIndex, TypeVar, overload, type_check_only from typing_extensions import LiteralString, TypeAlias From 5d9205489fb664582f12de54317a18243fcad5fb Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 24 Dec 2024 16:35:17 -0500 Subject: [PATCH 09/15] S406 is redundant --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a8eef218f0de..6713880ecfa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -183,7 +183,6 @@ ignore = [ "S106", # Possible hardcoded password assigned to argument "S107", # Possible hardcoded password assigned to function default "S4", # Insecure and vulnerable libraries - "S406", # xml.sax methods are vulnerable to XML attacks # Often breaks mypy/stubtest "FURB180", # Use of metaclass=abc.ABCMeta to define abstract base class # Stubs can sometimes re-export entire modules. From 250c180e977089b1a799b55871b4887d69ed20b9 Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 3 Jan 2025 21:39:00 -0500 Subject: [PATCH 10/15] Duplicated selects --- pyproject.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fccc62c2f6f5..5dac12bdb36e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,11 +44,9 @@ select = [ "ARG", # flake8-unused-arguments "ASYNC", # flake8-async "B", # flake8-bugbear - "B", # flake8-bugbear "BLE", # flake8-blind-except "C4", # flake8-comprehensions "D", # pydocstyle - "D", # pydocstyle "DOC", # pydoclint "DTZ", # flake8-datetimez "EXE", # flake8-executable @@ -60,17 +58,14 @@ select = [ "ISC", # flake8-implicit-str-concat "LOG", # flake8-logging "N", # pep8-naming - "N", # pep8-naming "NPY", # NumPy-specific rules "PERF", # Perflint "PGH", # pygrep-hooks - "PGH", # pygrep-hooks "PIE", # flake8-pie "PL", # Pylint "RET", # flake8-return "RSE", # flake8-raise "RUF", # Ruff-specific and unused-noqa - "RUF", # Ruff-specific and unused-noqa "S", # flake8-bandit "SIM", # flake8-simplify "SLOT", # flake8-slots From f81f82eea3bbc1e5369a2fe5863b73114e7981cd Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 10 Feb 2025 15:00:54 -0500 Subject: [PATCH 11/15] Rerun ruff check --fix --- scripts/stubsabot.py | 2 +- stdlib/typing.pyi | 2 +- stubs/PyYAML/yaml/representer.pyi | 5 +++-- stubs/protobuf/google/protobuf/internal/containers.pyi | 9 +++++---- stubs/protobuf/google/protobuf/message.pyi | 6 +++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index 79a4ea32d149..58cc5262144b 100755 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -651,7 +651,7 @@ def get_update_pr_body(update: Update, metadata: Mapping[str, Any]) -> str: body += f"\n\n{update.diff_analysis}" stubtest_settings: dict[str, Any] = metadata.get("tool", {}).get("stubtest", {}) - stubtest_will_run = not stubtest_settings.get("skip", False) + stubtest_will_run = not stubtest_settings.get("skip") if stubtest_will_run: body += textwrap.dedent( """ diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 973a8d4ea247..8b2e538f261d 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -957,7 +957,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): def setdefault(self, k: _Never, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. def pop(self, k: _Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] - def update(self: _T, m: _T, /) -> None: ... + def update(self, m: typing_extensions.Self, /) -> None: ... def __delitem__(self, k: _Never) -> None: ... def items(self) -> dict_items[str, object]: ... def keys(self) -> dict_keys[str, object]: ... diff --git a/stubs/PyYAML/yaml/representer.pyi b/stubs/PyYAML/yaml/representer.pyi index c84c56218871..e3360eae7493 100644 --- a/stubs/PyYAML/yaml/representer.pyi +++ b/stubs/PyYAML/yaml/representer.pyi @@ -3,6 +3,7 @@ from _typeshed import Incomplete, ReadableBuffer, SupportsItems from collections.abc import Callable, Iterable, Mapping from types import BuiltinFunctionType, FunctionType, ModuleType from typing import Any, ClassVar, NoReturn, TypeVar +from typing_extensions import Self from yaml.error import YAMLError as YAMLError from yaml.nodes import MappingNode as MappingNode, Node as Node, ScalarNode as ScalarNode, SequenceNode as SequenceNode @@ -25,9 +26,9 @@ class BaseRepresenter: def represent(self, data) -> None: ... def represent_data(self, data) -> Node: ... @classmethod - def add_representer(cls: type[_R], data_type: type[_T], representer: Callable[[_R, _T], Node]) -> None: ... + def add_representer(cls, data_type: type[_T], representer: Callable[[Self, _T], Node]) -> None: ... @classmethod - def add_multi_representer(cls: type[_R], data_type: type[_T], representer: Callable[[_R, _T], Node]) -> None: ... + def add_multi_representer(cls, data_type: type[_T], representer: Callable[[Self, _T], Node]) -> None: ... def represent_scalar(self, tag: str, value, style: str | None = None) -> ScalarNode: ... def represent_sequence(self, tag: str, sequence: Iterable[Any], flow_style: bool | None = None) -> SequenceNode: ... def represent_mapping( diff --git a/stubs/protobuf/google/protobuf/internal/containers.pyi b/stubs/protobuf/google/protobuf/internal/containers.pyi index aaa970439216..0ce35d235676 100644 --- a/stubs/protobuf/google/protobuf/internal/containers.pyi +++ b/stubs/protobuf/google/protobuf/internal/containers.pyi @@ -1,5 +1,6 @@ from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence from typing import Any, Protocol, SupportsIndex, TypeVar, overload +from typing_extensions import Self from google.protobuf.descriptor import Descriptor from google.protobuf.internal.message_listener import MessageListener @@ -33,7 +34,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]): def append(self, value: _ScalarV) -> None: ... def insert(self, key: int, value: _ScalarV) -> None: ... def extend(self, elem_seq: Iterable[_ScalarV] | None) -> None: ... - def MergeFrom(self: _M, other: _M | Iterable[_ScalarV]) -> None: ... + def MergeFrom(self, other: Self | Iterable[_ScalarV]) -> None: ... def remove(self, elem: _ScalarV) -> None: ... def pop(self, key: int = -1) -> _ScalarV: ... @overload @@ -49,7 +50,7 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]): def append(self, value: _MessageV) -> None: ... def insert(self, key: int, value: _MessageV) -> None: ... def extend(self, elem_seq: Iterable[_MessageV]) -> None: ... - def MergeFrom(self: _M, other: _M | Iterable[_MessageV]) -> None: ... + def MergeFrom(self, other: Self | Iterable[_MessageV]) -> None: ... def remove(self, elem: _MessageV) -> None: ... def pop(self, key: int = -1) -> _MessageV: ... def __delitem__(self, key: int | slice) -> None: ... @@ -73,7 +74,7 @@ class ScalarMap(MutableMapping[_K, _ScalarV]): def get(self, key: _K, default: None = None) -> _ScalarV | None: ... @overload def get(self, key: _K, default: _ScalarV | _T) -> _ScalarV | _T: ... - def MergeFrom(self: _M, other: _M): ... + def MergeFrom(self, other: Self): ... def InvalidateIterators(self) -> None: ... def GetEntryClass(self) -> GeneratedProtocolMessageType: ... @@ -96,6 +97,6 @@ class MessageMap(MutableMapping[_K, _MessageV]): @overload def get(self, key: _K, default: _MessageV | _T) -> _MessageV | _T: ... def get_or_create(self, key: _K) -> _MessageV: ... - def MergeFrom(self: _M, other: _M): ... + def MergeFrom(self, other: Self): ... def InvalidateIterators(self) -> None: ... def GetEntryClass(self) -> GeneratedProtocolMessageType: ... diff --git a/stubs/protobuf/google/protobuf/message.pyi b/stubs/protobuf/google/protobuf/message.pyi index 819ad7aad5d2..f4ab9b3accaf 100644 --- a/stubs/protobuf/google/protobuf/message.pyi +++ b/stubs/protobuf/google/protobuf/message.pyi @@ -27,11 +27,11 @@ class Message: def SerializePartialToString(self, *, deterministic: bool = ...) -> bytes: ... def ListFields(self) -> Sequence[tuple[FieldDescriptor, Any]]: ... # The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `HasExtension` & `ClearExtension` - def HasExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> bool: ... - def ClearExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> None: ... + def HasExtension(self, field_descriptor: _ExtensionFieldDescriptor[Self, Any]) -> bool: ... + def ClearExtension(self, field_descriptor: _ExtensionFieldDescriptor[Self, Any]) -> None: ... # The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `Extensions` @property - def Extensions(self: _M) -> _ExtensionDict[_M]: ... + def Extensions(self) -> _ExtensionDict[Self]: ... def ByteSize(self) -> int: ... @classmethod def FromString(cls, s: bytes) -> Self: ... From 0e71a426337fb481b25558636c09f9a5bbf9f36a Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 10 Feb 2025 15:12:11 -0500 Subject: [PATCH 12/15] Update to ruff 0.9.6 --- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 + requirements-tests.txt | 2 +- stdlib/_typeshed/__init__.pyi | 4 ++-- stdlib/typing_extensions.pyi | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 66fd399115a8..2b043c128938 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: args: [--fix=lf] - id: check-case-conflict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.3 # must match requirements-tests.txt + rev: v0.9.6 # must match requirements-tests.txt hooks: - id: ruff name: Run ruff on stubs, tests and scripts diff --git a/pyproject.toml b/pyproject.toml index ae4d67e6f5d8..aa19d96c8e7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -186,6 +186,7 @@ ignore = [ "A002", # builtin-argument-shadowing "A004", # builtin-import-shadowing "F403", # `from . import *` used; unable to detect undefined names + "S3", # Use of insecure ... # Most pep8-naming rules don't apply for third-party stubs like typeshed. # N811 to N814 could apply, but we often use them to disambiguate a name whilst making it look like a more common one "N8", diff --git a/requirements-tests.txt b/requirements-tests.txt index f49905636e83..6bd0689d278f 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -13,7 +13,7 @@ packaging==24.2 pathspec>=0.11.1 pre-commit # Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml. -ruff==0.9.3 +ruff==0.9.6 stubdefaulter==0.1.0 termcolor>=2.3 tomli==2.2.1 diff --git a/stdlib/_typeshed/__init__.pyi b/stdlib/_typeshed/__init__.pyi index 7201819b25ed..66847840688e 100644 --- a/stdlib/_typeshed/__init__.pyi +++ b/stdlib/_typeshed/__init__.pyi @@ -325,9 +325,9 @@ class structseq(Generic[_T_co]): # The second parameter will accept a dict of any kind without raising an exception, # but only has any meaning if you supply it a dict where the keys are strings. # https://github.com/python/typeshed/pull/6560#discussion_r767149830 - def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ... + def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ... # noqa: PYI019 if sys.version_info >= (3, 13): - def __replace__(self: Self, **kwargs: Any) -> Self: ... + def __replace__(self: Self, **kwargs: Any) -> Self: ... # noqa: PYI019 # Superset of typing.AnyStr that also includes LiteralString AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001 diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 33af1a388aa5..2ba7eddb69ef 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -236,7 +236,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): def setdefault(self, k: Never, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] - def update(self: _T, m: _T, /) -> None: ... + def update(self, m: Self, /) -> None: ... def items(self) -> dict_items[str, object]: ... def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... From e552538de661be1dbabf51345968ed322397bd6d Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 10 Feb 2025 15:37:26 -0500 Subject: [PATCH 13/15] Revert **_pb2.pyi to upstream --- stubs/protobuf/google/protobuf/any_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/api_pb2.pyi | 3 ++- .../google/protobuf/compiler/plugin_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/descriptor_pb2.pyi | 4 ++-- stubs/protobuf/google/protobuf/duration_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/empty_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/field_mask_pb2.pyi | 3 ++- .../google/protobuf/source_context_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/struct_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/timestamp_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/type_pb2.pyi | 3 ++- stubs/protobuf/google/protobuf/wrappers_pb2.pyi | 3 ++- .../s2clientprotocol/common_pb2.pyi | 3 ++- .../s2clientprotocol/data_pb2.pyi | 3 ++- .../s2clientprotocol/debug_pb2.pyi | 3 ++- .../s2clientprotocol/error_pb2.pyi | 3 ++- .../s2clientprotocol/query_pb2.pyi | 3 ++- .../s2clientprotocol/s2clientprotocol/raw_pb2.pyi | 15 +++++++++++---- .../s2clientprotocol/sc2api_pb2.pyi | 15 +++++++++++---- .../s2clientprotocol/score_pb2.pyi | 3 ++- .../s2clientprotocol/spatial_pb2.pyi | 15 +++++++++++---- .../s2clientprotocol/s2clientprotocol/ui_pb2.pyi | 11 ++++++++--- .../tensorflow/compiler/xla/service/hlo_pb2.pyi | 3 ++- .../xla/service/hlo_profile_printer_data_pb2.pyi | 3 ++- .../compiler/xla/service/metrics_pb2.pyi | 3 ++- .../service/test_compilation_environment_pb2.pyi | 3 ++- .../xla/service/xla_compile_result_pb2.pyi | 3 ++- .../xla/tsl/protobuf/bfc_memory_map_pb2.pyi | 3 ++- .../compiler/xla/tsl/protobuf/test_log_pb2.pyi | 6 +++--- .../tensorflow/compiler/xla/xla_data_pb2.pyi | 3 ++- .../tensorflow/compiler/xla/xla_pb2.pyi | 3 ++- .../example/example_parser_configuration_pb2.pyi | 6 +++--- .../tensorflow/core/example/example_pb2.pyi | 3 ++- .../tensorflow/core/example/feature_pb2.pyi | 3 ++- .../core/framework/allocation_description_pb2.pyi | 3 ++- .../tensorflow/core/framework/api_def_pb2.pyi | 3 ++- .../tensorflow/core/framework/attr_value_pb2.pyi | 5 +++-- .../tensorflow/core/framework/cost_graph_pb2.pyi | 3 ++- .../core/framework/cpp_shape_inference_pb2.pyi | 3 ++- .../core/framework/dataset_metadata_pb2.pyi | 3 ++- .../core/framework/dataset_options_pb2.pyi | 3 ++- .../tensorflow/core/framework/dataset_pb2.pyi | 3 ++- .../core/framework/device_attributes_pb2.pyi | 3 ++- .../tensorflow/core/framework/full_type_pb2.pyi | 3 ++- .../tensorflow/core/framework/function_pb2.pyi | 3 ++- .../core/framework/graph_debug_info_pb2.pyi | 3 ++- .../tensorflow/core/framework/graph_pb2.pyi | 3 ++- .../core/framework/graph_transfer_info_pb2.pyi | 3 ++- .../tensorflow/core/framework/kernel_def_pb2.pyi | 3 ++- .../tensorflow/core/framework/log_memory_pb2.pyi | 3 ++- .../tensorflow/core/framework/model_pb2.pyi | 3 ++- .../tensorflow/core/framework/node_def_pb2.pyi | 3 ++- .../tensorflow/core/framework/op_def_pb2.pyi | 3 ++- .../framework/optimized_function_graph_pb2.pyi | 3 ++- .../tensorflow/core/framework/reader_base_pb2.pyi | 3 ++- .../core/framework/resource_handle_pb2.pyi | 3 ++- .../tensorflow/core/framework/step_stats_pb2.pyi | 3 ++- .../tensorflow/core/framework/summary_pb2.pyi | 3 ++- .../core/framework/tensor_description_pb2.pyi | 3 ++- .../tensorflow/core/framework/tensor_pb2.pyi | 3 ++- .../core/framework/tensor_shape_pb2.pyi | 6 +++--- .../core/framework/tensor_slice_pb2.pyi | 6 +++--- .../tensorflow/core/framework/types_pb2.pyi | 3 ++- .../tensorflow/core/framework/variable_pb2.pyi | 3 ++- .../tensorflow/core/framework/versions_pb2.pyi | 3 ++- .../core/protobuf/bfc_memory_map_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/cluster_pb2.pyi | 7 ++++--- .../protobuf/composite_tensor_variant_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/config_pb2.pyi | 6 +++--- .../tensorflow/core/protobuf/control_flow_pb2.pyi | 3 ++- .../core/protobuf/core_platform_payloads_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/data_service_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/debug_event_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/debug_pb2.pyi | 3 ++- .../core/protobuf/device_filters_pb2.pyi | 7 ++++--- .../core/protobuf/device_properties_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/error_codes_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/fingerprint_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/meta_graph_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/named_tensor_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/queue_runner_pb2.pyi | 3 ++- .../core/protobuf/remote_tensor_handle_pb2.pyi | 3 ++- .../core/protobuf/rewriter_config_pb2.pyi | 5 +++-- .../tensorflow/core/protobuf/rpc_options_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/saved_model_pb2.pyi | 3 ++- .../core/protobuf/saved_object_graph_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/saver_pb2.pyi | 3 ++- .../core/protobuf/service_config_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/snapshot_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/status_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/struct_pb2.pyi | 3 ++- .../core/protobuf/tensor_bundle_pb2.pyi | 3 ++- .../core/protobuf/tensorflow_server_pb2.pyi | 3 ++- .../core/protobuf/tpu/compilation_result_pb2.pyi | 3 ++- .../core/protobuf/tpu/dynamic_padding_pb2.pyi | 3 ++- .../protobuf/tpu/optimization_parameters_pb2.pyi | 3 ++- .../tensorflow/core/protobuf/tpu/topology_pb2.pyi | 3 ++- .../tpu/tpu_embedding_configuration_pb2.pyi | 3 ++- .../core/protobuf/trackable_object_graph_pb2.pyi | 3 ++- .../core/protobuf/transport_options_pb2.pyi | 3 ++- .../core/protobuf/verifier_config_pb2.pyi | 3 ++- .../tensorflow/tensorflow/core/util/event_pb2.pyi | 3 ++- .../core/util/memmapped_file_system_pb2.pyi | 3 ++- .../core/util/saved_tensor_slice_pb2.pyi | 3 ++- .../tensorflow/core/util/test_log_pb2.pyi | 6 +++--- .../keras/protobuf/projector_config_pb2.pyi | 3 ++- .../python/keras/protobuf/saved_metadata_pb2.pyi | 6 +++--- .../python/keras/protobuf/versions_pb2.pyi | 3 ++- .../tsl/protobuf/coordination_config_pb2.pyi | 3 ++- .../tsl/protobuf/coordination_service_pb2.pyi | 3 ++- .../protobuf/distributed_runtime_payloads_pb2.pyi | 3 ++- .../tensorflow/tsl/protobuf/dnn_pb2.pyi | 6 +++--- .../tensorflow/tsl/protobuf/error_codes_pb2.pyi | 5 +++-- .../tensorflow/tsl/protobuf/histogram_pb2.pyi | 3 ++- .../tensorflow/tsl/protobuf/rpc_options_pb2.pyi | 3 ++- .../tensorflow/tsl/protobuf/status_pb2.pyi | 3 ++- 116 files changed, 280 insertions(+), 151 deletions(-) diff --git a/stubs/protobuf/google/protobuf/any_pb2.pyi b/stubs/protobuf/google/protobuf/any_pb2.pyi index 7344e0f6f5af..2edfefbfcacd 100644 --- a/stubs/protobuf/google/protobuf/any_pb2.pyi +++ b/stubs/protobuf/google/protobuf/any_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/api_pb2.pyi b/stubs/protobuf/google/protobuf/api_pb2.pyi index d75c51fdc32c..f48ce3dd2de2 100644 --- a/stubs/protobuf/google/protobuf/api_pb2.pyi +++ b/stubs/protobuf/google/protobuf/api_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi index 52dd8543986b..4ba99eafb811 100644 --- a/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi +++ b/stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Author: kenton@google.com (Kenton Varda) diff --git a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi index 1b68ffcf1d35..ddf523d56c8b 100644 --- a/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +++ b/stubs/protobuf/google/protobuf/descriptor_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Author: kenton@google.com (Kenton Varda) Based on original Protocol Buffers design by @@ -2068,7 +2069,6 @@ class SourceCodeInfo(google.protobuf.message.Message): - Code which tries to interpret locations should probably be designed to ignore those that it doesn't understand, as more types of locations could be recorded in the future. - """ def __init__( diff --git a/stubs/protobuf/google/protobuf/duration_pb2.pyi b/stubs/protobuf/google/protobuf/duration_pb2.pyi index 907064f35407..4beb927266cb 100644 --- a/stubs/protobuf/google/protobuf/duration_pb2.pyi +++ b/stubs/protobuf/google/protobuf/duration_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/empty_pb2.pyi b/stubs/protobuf/google/protobuf/empty_pb2.pyi index d745e7cdbe60..593917f63474 100644 --- a/stubs/protobuf/google/protobuf/empty_pb2.pyi +++ b/stubs/protobuf/google/protobuf/empty_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi index 3b0d18f756d2..1cc4929f00b5 100644 --- a/stubs/protobuf/google/protobuf/field_mask_pb2.pyi +++ b/stubs/protobuf/google/protobuf/field_mask_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/source_context_pb2.pyi b/stubs/protobuf/google/protobuf/source_context_pb2.pyi index 1ad9140c37e8..a2d35937211d 100644 --- a/stubs/protobuf/google/protobuf/source_context_pb2.pyi +++ b/stubs/protobuf/google/protobuf/source_context_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/struct_pb2.pyi b/stubs/protobuf/google/protobuf/struct_pb2.pyi index cd70942ce23e..684f3c9d4e08 100644 --- a/stubs/protobuf/google/protobuf/struct_pb2.pyi +++ b/stubs/protobuf/google/protobuf/struct_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi index a0cad7210b2c..017a881de8b9 100644 --- a/stubs/protobuf/google/protobuf/timestamp_pb2.pyi +++ b/stubs/protobuf/google/protobuf/timestamp_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/type_pb2.pyi b/stubs/protobuf/google/protobuf/type_pb2.pyi index cd6a3d79ebbd..78e6b5b355a2 100644 --- a/stubs/protobuf/google/protobuf/type_pb2.pyi +++ b/stubs/protobuf/google/protobuf/type_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi index 7032c3a5a076..f3c923fea88b 100644 --- a/stubs/protobuf/google/protobuf/wrappers_pb2.pyi +++ b/stubs/protobuf/google/protobuf/wrappers_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. All rights reserved. diff --git a/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi index 4bc5d8b4cd0a..298ef9bf1c76 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/common_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi index fd11a728b833..6c33927e724e 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/data_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi index 3604e6b34eaf..658d5bd20590 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/debug_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi index 501956969fe0..c21b03cbc1b8 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/error_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi index a15262236654..ea772e2f6242 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/query_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi index 39d99ffa8ee0..35a08c2337ea 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/raw_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -91,7 +92,9 @@ global___CloakState = CloakState @typing.final class StartRaw(google.protobuf.message.Message): - """Start""" + """ + Start + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -142,7 +145,9 @@ global___StartRaw = StartRaw @typing.final class ObservationRaw(google.protobuf.message.Message): - """Observation""" + """ + Observation + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -575,7 +580,9 @@ global___Effect = Effect @typing.final class ActionRaw(google.protobuf.message.Message): - """Action""" + """ + Action + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi index a778a10a2246..b979697237f5 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/sc2api_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -85,7 +86,9 @@ class _DifficultyEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._Enu CheatInsane: _Difficulty.ValueType # 10 class Difficulty(_Difficulty, metaclass=_DifficultyEnumTypeWrapper): - """Game Setup""" + """ + Game Setup + """ VeryEasy: Difficulty.ValueType # 1 Easy: Difficulty.ValueType # 2 @@ -215,7 +218,9 @@ global___Result = Result @typing.final class Request(google.protobuf.message.Message): - """Request/Response""" + """ + Request/Response + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -1779,7 +1784,9 @@ global___PlayerInfo = PlayerInfo @typing.final class PlayerCommon(google.protobuf.message.Message): - """During Game""" + """ + During Game + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi index 4fc1fdfec371..95ee7dd7fde5 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/score_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi index ae28f560df63..f2e686f08242 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/spatial_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -22,7 +23,9 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor @typing.final class ObservationFeatureLayer(google.protobuf.message.Message): - """Observation - Feature Layer""" + """ + Observation - Feature Layer + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -301,7 +304,9 @@ global___FeatureLayersMinimap = FeatureLayersMinimap @typing.final class ObservationRender(google.protobuf.message.Message): - """Observation - Rendered""" + """ + Observation - Rendered + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -324,7 +329,9 @@ global___ObservationRender = ObservationRender @typing.final class ActionSpatial(google.protobuf.message.Message): - """Action""" + """ + Action + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi b/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi index e127a222f35e..65a0e165a43d 100644 --- a/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi +++ b/stubs/s2clientprotocol/s2clientprotocol/ui_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -21,7 +22,9 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor @typing.final class ObservationUI(google.protobuf.message.Message): - """Observation""" + """ + Observation + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -247,7 +250,9 @@ global___ProductionPanel = ProductionPanel @typing.final class ActionUI(google.protobuf.message.Message): - """Action""" + """ + Action + """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi index f76e42f7771b..25dd0678d051 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file This proto file defines messages which represent the HLO module. This is a full fidelity serialization of the c++ HLO constructs. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi index 3a93a9af0591..d1871110d55b 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/hlo_profile_printer_data_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2018 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi index c5ee24d84d35..44592002fdd9 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/metrics_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi index cb721e45766c..c7a849570d8d 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/test_compilation_environment_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2022 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi index 23b12f7d405d..3c5dde2bac5c 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/service/xla_compile_result_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2023 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi index b446e877b588..9e1871be16a8 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/bfc_memory_map_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi index a0f40743c9d5..0e06ea85faa7 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/tsl/protobuf/test_log_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -Protocol messages for describing the results of benchmarks and unit tests. """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Protocol messages for describing the results of benchmarks and unit tests.""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi index ba9828b015cc..572077b07eaa 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/xla_data_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2017 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi b/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi index b4e7efc0d46b..086a41fc6528 100644 --- a/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi +++ b/stubs/tensorflow/tensorflow/compiler/xla/xla_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2017 The OpenXLA Authors. diff --git a/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi b/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi index fbaf06b20aa8..6b5c255da3b4 100644 --- a/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/example/example_parser_configuration_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -Protocol messages for describing the configuration of the ExampleParserOp. """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Protocol messages for describing the configuration of the ExampleParserOp.""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi b/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi index b03293fe94ba..562a6c44cf55 100644 --- a/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/example/example_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol messages for describing input data Examples for machine learning model training or inference. diff --git a/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi b/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi index 4098fe2da198..3fbc881cbaa2 100644 --- a/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/example/feature_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Protocol messages for describing features for machine learning model training or inference. diff --git a/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi index c1838ee64789..6e0f0cb22534 100644 --- a/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/allocation_description_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi index f434102d9d80..30f81032a88d 100644 --- a/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/api_def_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Defines the text format for including per-op API definition and overrides for client language op code generators. diff --git a/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi index e4ed286e428f..80bdde459e0f 100644 --- a/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/attr_value_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -123,7 +124,7 @@ class AttrValue(google.protobuf.message.Message): @property def list(self) -> global___AttrValue.ListValue: - """Any "list(...)" """ + """any "list(...)" """ @property def func(self) -> global___NameAttrList: diff --git a/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi index 542fa33f595b..d54c0196320a 100644 --- a/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/cost_graph_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi index 59f3b8302a26..070c7c3cdb63 100644 --- a/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/cpp_shape_inference_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi index 22bde157eda6..a1c7b19143c5 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_metadata_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi index 457834f086ee..5837446a1e77 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_options_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi index 093020bb7264..72392b2b7698 100644 --- a/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/dataset_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi index 68469b276699..aafdc2c8a51e 100644 --- a/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/device_attributes_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi index 6bb5dfe8f420..e37ac0ff0495 100644 --- a/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/full_type_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi index fe4849f36993..c0908173a958 100644 --- a/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/function_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi index be84ea827670..739c2b5bd300 100644 --- a/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/graph_debug_info_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi index 47818173ad8f..1158f045aba3 100644 --- a/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/graph_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi index 206c6650a2b6..ab4dd51228cd 100644 --- a/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/graph_transfer_info_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi index e705e26421fc..ea1844b41fbc 100644 --- a/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/kernel_def_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi index b1a32d2fc493..ba0e1700fc9f 100644 --- a/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/log_memory_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi index f658e1c7607e..1fc78e2d7b8b 100644 --- a/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/model_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi index 3f29a242b660..663e4d216ec9 100644 --- a/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/node_def_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi index 93b6225b9a85..6656ddcadf3f 100644 --- a/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/op_def_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi index b9facdfdffa9..7f48d2d4b519 100644 --- a/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/optimized_function_graph_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi index a5f16a42b1d6..7e6e6ea31932 100644 --- a/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/reader_base_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi index ce40b009deef..8767e1768bce 100644 --- a/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/resource_handle_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi index c2ec0f20d8bc..947cbdb41683 100644 --- a/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/step_stats_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi index 3524f7eb5757..5df66b7e7978 100644 --- a/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/summary_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi index 80a0ef5638c6..71a5df5340a2 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_description_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi index cff0c72874a7..8e1a764d7021 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi index 23a4006a0dad..2d852a920271 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_shape_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -Protocol buffer representing the shape of tensors. """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Protocol buffer representing the shape of tensors.""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi index 589fddccf415..949fd0f1d6a3 100644 --- a/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/tensor_slice_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -Protocol buffer representing slices of a tensor """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Protocol buffer representing slices of a tensor""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi index 6131811f3870..a07d25c40e0e 100644 --- a/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/types_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi index abdd172cf95d..2d2320096e66 100644 --- a/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/variable_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi b/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi index 5bc193d80af1..7ca17c36bdfd 100644 --- a/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/framework/versions_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi index abb4f56cb3c9..286fc179d807 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/bfc_memory_map_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi index c18363ff05e3..ae19698d703d 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/cluster_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016 The TensorFlow Authors. All Rights Reserved. @@ -31,8 +32,9 @@ class JobDef(google.protobuf.message.Message): """This file contains protos to be used when defining a TensorFlow cluster. - Examples + EXAMPLES -------- + 1. A single-process cluster, containing "/job:local/task:0". Cluster: @@ -69,7 +71,6 @@ class JobDef(google.protobuf.message.Message): cluster { $CLUSTER } job_name: 'ps' task_index: 1 Defines a single job in a TensorFlow cluster. - """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi index 9c70d5c0535e..1dbe6e5573b5 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/composite_tensor_variant_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi index 894efbf8c332..a655ef204b81 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/config_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -287,13 +288,12 @@ class GPUOptions(google.protobuf.message.Message): /device:GPU:2 -> visible GPU 1 with 2GB memory (ordinal 20) /device:GPU:3 -> visible GPU 0 with 4GB memory (ordinal 20) - Note: + NOTE: 1. It's invalid to set both this and "per_process_gpu_memory_fraction" at the same time. 2. Currently this setting is per-process, not per-session. Using different settings in different sessions within same process will result in undefined behavior. - """ @property diff --git a/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi index 5b9e4bfae8c0..713544819ed5 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/control_flow_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi index 40ca92a3be05..44eea2b74e65 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/core_platform_payloads_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi index df0d1cff3d9b..3c149e5ee5ac 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/data_service_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi index 7f7933343bd6..8ee6e76d65da 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/debug_event_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi index 8c0e905df03e..5ee6b532d850 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/debug_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi index a0a14e637ec3..f4e0c8efe920 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/device_filters_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2020 The TensorFlow Authors. All Rights Reserved. @@ -37,8 +38,9 @@ class TaskDeviceFilters(google.protobuf.message.Message): configured at the cluster startup, and cannot be updated once the cluster is up and running. - Examples + EXAMPLES -------- + A two-job cluster with the following ClusterDef: Cluster: @@ -58,7 +60,6 @@ class TaskDeviceFilters(google.protobuf.message.Message): device_filter '/job:worker/task:1' } } Defines the device filters for a remote task. - """ DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi index 592c0bc1c533..af4bdd7a1f88 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/device_properties_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2017 The TensorFlow Authors. All Rights Reserved. diff --git a/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi index fd1c3396bed4..10cb20051e70 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/error_codes_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Add a dummy package name. Having no package, like core/lib/core/error_codes.proto, or having tensorflow.error, like diff --git a/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi index f778a7a4cd31..83956b31c972 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/fingerprint_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi index c12fd7fb7d66..78ea938af3f4 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/meta_graph_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi index 4b4585270934..c1c17417d31c 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/named_tensor_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi index 0a3fb346bda3..f93fe61c3752 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/queue_runner_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi index 4831b66c37f2..6558122b328b 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/remote_tensor_handle_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi index ba840fa1826a..ebe2295bc872 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/rewriter_config_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ @@ -438,7 +439,7 @@ class RewriterConfig(google.protobuf.message.Message): @property def custom_optimizers(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___RewriterConfig.CustomGraphOptimizer]: - """List of CustomGraphOptimizers to apply.""" + """list of CustomGraphOptimizers to apply.""" @property def inter_optimizer_verifier_config(self) -> tensorflow.core.protobuf.verifier_config_pb2.VerifierConfig: diff --git a/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi index aea6637f87d2..acc9e9bdb45a 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/rpc_options_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi index 07a7bd5bb4a2..cd2bdb7a2a13 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/saved_model_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi index 65731fa9a559..4a6f0c1d51e0 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/saved_object_graph_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi index 867f3487da5a..1f89eebf8f98 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/saver_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi index 4373d434837e..d5e74f6d52f9 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/service_config_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi index daed1d99f878..daeb2da4ad65 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/snapshot_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi index 8ca8d40947ba..fa50e2989c68 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/status_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Add a dummy package name. Having no package like core/lib/core/error_codes.proto, or having tensorflow like diff --git a/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi index 29a4c304f96c..0081e3011610 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/struct_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi index 191f02e53ca4..b1b95ae3fab4 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tensor_bundle_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi index 30da97fdb993..e5120748aeef 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tensorflow_server_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016 The TensorFlow Authors. All Rights Reserved. diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi index 3d47a9326663..6d04ebf01637 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/compilation_result_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi index ab6bb3b45f25..e8e639bc0b2d 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/dynamic_padding_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi index 9d6cfc3e0b97..5e08f7ce0e06 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/optimization_parameters_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi index a1550583e222..d9d75f0b13da 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/topology_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi index 72ed6ab9606c..c33925975268 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/tpu/tpu_embedding_configuration_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi index dfea1dffd0ab..63730b6360c6 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/trackable_object_graph_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi index 28c7aa33efe3..26d7b1406dae 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/transport_options_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi b/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi index 0a6197c1d0af..405ab99a2dd5 100644 --- a/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/protobuf/verifier_config_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi index 37e1528b55c9..9d6a986624bc 100644 --- a/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/event_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi index 54a84d0a092b..266b0ed6e5d3 100644 --- a/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/memmapped_file_system_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016 The TensorFlow Authors. All Rights Reserved. diff --git a/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi index 9f56e7438315..9b492465ac4f 100644 --- a/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/saved_tensor_slice_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file A checkpoint file is an sstable. The value for each record is a serialized SavedTensorSlices message (defined below). diff --git a/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi b/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi index 6eee8dc56b1c..88bdc15d87ec 100644 --- a/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi +++ b/stubs/tensorflow/tensorflow/core/util/test_log_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -Protocol messages for describing the results of benchmarks and unit tests. """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Protocol messages for describing the results of benchmarks and unit tests.""" import google.protobuf.descriptor from tensorflow.compiler.xla.tsl.protobuf.test_log_pb2 import ( diff --git a/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi b/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi index 32ddbd8773b5..22be35d7d6bc 100644 --- a/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/python/keras/protobuf/projector_config_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file This file is a copy of the TensorBoard ProjectorConfig proto. Keep this file in sync with the source proto definition at diff --git a/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi b/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi index 752cf21a120d..0133517d273f 100644 --- a/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi +++ b/stubs/tensorflow/tensorflow/python/keras/protobuf/saved_metadata_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -Protobuf containing the metadata for each Keras object saved in a SavedModel. """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +Protobuf containing the metadata for each Keras object saved in a SavedModel.""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi b/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi index aa434bfb688a..55d2e725bc0d 100644 --- a/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi +++ b/stubs/tensorflow/tensorflow/python/keras/protobuf/versions_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi index 6236e18bc7e8..a2eb29dda885 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_config_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi index f97477d9e040..82468c997f24 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/coordination_service_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi index 2fd75c214d8c..57202db5c159 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/distributed_runtime_payloads_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi index f3f717231b7c..929709311d04 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/dnn_pb2.pyi @@ -1,7 +1,7 @@ -"""@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -LINT: LEGACY_NAMES """ +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +LINT: LEGACY_NAMES""" import builtins import collections.abc diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi index a05bc19aa30f..3b0b8dcf4b37 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/error_codes_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file TODO(b/247876220): Change package and java_package once we figure out how to migrate. @@ -151,6 +152,7 @@ class Code(_Code, metaclass=_CodeEnumTypeWrapper): """The canonical error codes for TensorFlow APIs. Warnings: + - Do not change any numeric assignments. - Changes to this list should only be made if there is a compelling need that can't be satisfied in another way. Such changes @@ -162,7 +164,6 @@ class Code(_Code, metaclass=_CodeEnumTypeWrapper): the most specific error code that applies. For example, prefer OUT_OF_RANGE over FAILED_PRECONDITION if both codes apply. Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION. - """ OK: Code.ValueType # 0 diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi index 908c4f828098..a33728dc47e4 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/histogram_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi index a4166740f884..6e08a2bf99ef 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/rpc_options_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ diff --git a/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi b/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi index 3faf1fb9701b..77e0f5b7bf39 100644 --- a/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi +++ b/stubs/tensorflow/tensorflow/tsl/protobuf/status_pb2.pyi @@ -1,4 +1,5 @@ -"""@generated by mypy-protobuf. Do not edit manually! +""" +@generated by mypy-protobuf. Do not edit manually! isort:skip_file """ From 116ab5974f9d656dcc93e9d008c8ccd0b9511e8b Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 10 Feb 2025 15:38:26 -0500 Subject: [PATCH 14/15] Remove contextlib.suppress usages --- pyproject.toml | 26 ++++++++++++++++++++------ scripts/stubsabot.py | 5 +++-- tests/stubtest_third_party.py | 5 +++-- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index aa19d96c8e7e..8efc647ee51a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,6 @@ select = [ "RSE", # flake8-raise "RUF", # Ruff-specific and unused-noqa "S", # flake8-bandit - "SIM", # flake8-simplify "SLOT", # flake8-slots "TRY", # tryceratops "UP", # pyupgrade @@ -78,11 +77,6 @@ select = [ "W", # pycodestyle Warning # Only include flake8-annotations rules that are autofixable. Otherwise leave this to mypy+pyright "ANN2", - # Don't include TC rules that create a TYPE_CHECKING block or stringifies annotations - "TC004", # Move import `{qualified_name}` out of type-checking block. Import is used for more than type hinting. - "TC005", # Found empty type-checking block - # "TC008", # TODO: Enable when out of preview - "TC010", # Invalid string member in `X | Y`-style union type # Most refurb rules are in preview and can be opinionated, # consider them individually as they come out of preview (last check: 0.8.4) "FURB105", # Unnecessary empty string passed to `print` @@ -117,6 +111,26 @@ select = [ # "PYI061", # TODO: Enable when out of preview "PYI062", # Duplicate literal member `{}` "PYI064", # `Final[Literal[{literal}]]` can be replaced with a bare Final + # flake8-simplify, excluding rules that can reduce performance or readability due to long line formatting + "SIM101", # Multiple `isinstance` calls for `{name}`, merge into a single call + "SIM103", # Return the condition `{condition}` directly + "SIM107", # Don't use return in `try-except` and `finally` + "SIM109", # Use `{replacement}` instead of multiple equality comparisons + "SIM112", # Use capitalized environment variable `{expected}` instead of `{actual}` + "SIM113", # Use `enumerate()` for index variable `{index}` in `for` loop + "SIM114", # Combine `if` branches using logical `or` operator + "SIM115", # Use a context manager for opening files + "SIM118", # Use key `{operator}` dict instead of key `{operator} dict.keys()` + "SIM2", # flake8-simplify conditional ordering rules + "SIM300", # Yoda condition detected + "SIM401", # Use `{contents}` instead of an if block + "SIM910", # Use `{expected}` instead of `{actual}` (dict-get-with-none-default) + "SIM911", # Use `{expected}` instead of `{actual}` (zip-dict-keys-and-values) + # Don't include TC rules that create a TYPE_CHECKING block or stringifies annotations + "TC004", # Move import `{qualified_name}` out of type-checking block. Import is used for more than type hinting. + "TC005", # Found empty type-checking block + # "TC008", # TODO: Enable when out of preview + "TC010", # Invalid string member in `X | Y`-style union type ] extend-safe-fixes = [ "UP036", # Remove unnecessary `sys.version_info` blocks diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index 58cc5262144b..3bfd6a590a03 100755 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -3,7 +3,6 @@ import argparse import asyncio -import contextlib import datetime import enum import functools @@ -334,8 +333,10 @@ async def get_diff_info( # Some packages in typeshed have tag names # that are invalid to be passed to the Version() constructor, # e.g. v.1.4.2 - with contextlib.suppress(packaging.version.InvalidVersion): + try: versions_to_tags[packaging.version.Version(tag_name)] = tag_name + except packaging.version.InvalidVersion: + pass try: new_tag = versions_to_tags[pypi_version] diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index 2b30641b0800..218abfe78832 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -4,7 +4,6 @@ from __future__ import annotations import argparse -import contextlib import os import re import subprocess @@ -406,5 +405,7 @@ def main() -> NoReturn: if __name__ == "__main__": - with contextlib.suppress(KeyboardInterrupt): + try: main() + except KeyboardInterrupt: + pass From a21f9887c7b0e1e8137239622ab0ba8ed3d4dd0f Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 10 Feb 2025 15:38:49 -0500 Subject: [PATCH 15/15] Update rules refused in main and fixed upstream --- lib/ts_utils/paths.py | 3 ++- pyproject.toml | 17 +++++------------ scripts/stubsabot.py | 8 ++++++-- tests/pytype_test.py | 5 ++++- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/ts_utils/paths.py b/lib/ts_utils/paths.py index adec14a57d53..3252c0477bd6 100644 --- a/lib/ts_utils/paths.py +++ b/lib/ts_utils/paths.py @@ -24,7 +24,8 @@ def distribution_path(distribution_name: str) -> Path: def tests_path(distribution_name: str) -> Path: if distribution_name == "stdlib": return STDLIB_PATH / TESTS_DIR - return STUBS_PATH / distribution_name / TESTS_DIR + else: + return STUBS_PATH / distribution_name / TESTS_DIR def test_cases_path(distribution_name: str) -> Path: diff --git a/pyproject.toml b/pyproject.toml index 8efc647ee51a..73a3b6720ac0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,17 +53,12 @@ select = [ "FA", # flake8-future-annotations "FBT", # flake8-boolean-trap "FLY", # flynt - "G", # flake8-logging-format "I", # isort "ISC", # flake8-implicit-str-concat - "LOG", # flake8-logging "N", # pep8-naming - "NPY", # NumPy-specific rules - "PERF", # Perflint "PGH", # pygrep-hooks "PIE", # flake8-pie "PL", # Pylint - "RET", # flake8-return "RSE", # flake8-raise "RUF", # Ruff-specific and unused-noqa "S", # flake8-bandit @@ -200,17 +195,15 @@ ignore = [ "A002", # builtin-argument-shadowing "A004", # builtin-import-shadowing "F403", # `from . import *` used; unable to detect undefined names + "PIE796", # Enum contains duplicate value + "PLC2701", # Private name import from external module # https://github.com/astral-sh/ruff/issues/15294 and https://github.com/astral-sh/ruff/issues/15295 + "S105", # Possible hardcoded password assigned + "S106", # Possible hardcoded password assigned to argument + "S107", # Possible hardcoded password assigned to function default "S3", # Use of insecure ... # Most pep8-naming rules don't apply for third-party stubs like typeshed. # N811 to N814 could apply, but we often use them to disambiguate a name whilst making it look like a more common one "N8", - "PIE796", # Enum contains duplicate value # astral-sh/ruff#15132 - "PLC2701", # Private name import from external module - "PLW1641", # Object does not implement __hash__ method - "S105", # Possible hardcoded password assigned - "S106", # Possible hardcoded password assigned to argument - "S107", # Possible hardcoded password assigned to function default - "S4", # Insecure and vulnerable libraries # Stubs can sometimes re-export entire modules. # Issues with using a star-imported name will be caught by type-checkers. "F405", # may be undefined, or defined from star imports diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index 3bfd6a590a03..a5cb37fec23f 100755 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -133,7 +133,8 @@ def __str__(self) -> str: def new_version(self) -> str: if self.new_version_spec.operator == "==": return str(self.new_version_spec)[2:] - return str(self.new_version_spec) + else: + return str(self.new_version_spec) @dataclass @@ -198,7 +199,10 @@ def all_py_files_in_source_are_in_py_typed_dirs(source: zipfile.ZipFile | tarfil if not all_python_files: return False - return all(any(py_typed_dir in path.parents for py_typed_dir in py_typed_dirs) for path in all_python_files) + for path in all_python_files: + if not any(py_typed_dir in path.parents for py_typed_dir in py_typed_dirs): + return False + return True async def release_contains_py_typed(release_to_download: PypiReleaseDownload, *, session: aiohttp.ClientSession) -> bool: diff --git a/tests/pytype_test.py b/tests/pytype_test.py index e4e4fe167ff8..84b1f7750392 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -228,7 +228,10 @@ def run_all_tests(*, files_to_test: Sequence[str], print_stderr: bool, dry_run: python_version = f"{sys.version_info.major}.{sys.version_info.minor}" print("Testing files with pytype...") for i, f in enumerate(files_to_test): - stderr = None if dry_run else run_pytype(filename=f, python_version=python_version, missing_modules=missing_modules) + if dry_run: + stderr = None + else: + stderr = run_pytype(filename=f, python_version=python_version, missing_modules=missing_modules) if stderr: if print_stderr: print(f"\n{stderr}")