From 25046f9ac8537d04cd5d19fa81dd6bb48675609d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 04:56:05 +0000 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.1...v1.11.0) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Charles Guo --- .pre-commit-config.yaml | 2 +- py_proto/proto_import.py | 18 ++++++++++-------- py_proto/proto_syntax.py | 8 ++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af79ff62..e804b53f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: - id: buildifier - id: buildifier-lint - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.1 + rev: v1.11.0 hooks: - id: mypy additional_dependencies: [types-requests==2.31.0.20240218] diff --git a/py_proto/proto_import.py b/py_proto/proto_import.py index 3990d43f..7fb86e87 100644 --- a/py_proto/proto_import.py +++ b/py_proto/proto_import.py @@ -1,4 +1,4 @@ -from typing import Optional +from typing import Any, Iterator, Optional from py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff from py_proto.proto_string_literal import ProtoStringLiteral @@ -26,19 +26,21 @@ def __eq__(self, other) -> bool: and (hasattr(other, "public") and self.public == other.public) ) + def __iter__(self) -> Iterator: + return iter( + { + "path": self.path.serialize(), + "weak": self.weak, + "public": self.public, + } + ) + def __str__(self) -> str: return f"" def __repr__(self) -> str: return str(self) - def __dict__(self): - return { - "path": self.path.serialize(), - "weak": self.weak, - "public": self.public, - } - def normalize(self) -> "ProtoImport": return self diff --git a/py_proto/proto_syntax.py b/py_proto/proto_syntax.py index dd1d7f00..1e823ce5 100644 --- a/py_proto/proto_syntax.py +++ b/py_proto/proto_syntax.py @@ -1,5 +1,5 @@ from enum import Enum -from typing import Optional +from typing import Any, Iterator, Optional from py_proto.proto_node import ParsedProtoNode, ProtoNode, ProtoNodeDiff from py_proto.proto_string_literal import ProtoStringLiteral @@ -23,15 +23,15 @@ def __init__(self, syntax: ProtoStringLiteral, *args, **kwargs): def __eq__(self, other) -> bool: return self.syntax == other.syntax + def __iter__(self) -> Iterator: + return iter({"syntax": self.syntax.serialize()}) + def __str__(self) -> str: return f"" def __repr__(self) -> str: return str(self) - def __dict__(self): - return {"syntax": self.syntax.serialize()} - def normalize(self) -> "ProtoSyntax": return self