Code Quality: mypy check failed
まだ誰も着手していません。
評価
調査の方向性
poe types を実行して、49 件の mypy エラーを再現します。まず、src/betterproto/enum.py、src/betterproto/_version.py、src/betterproto/__init__.py、src/betterproto/plugin/models.py、src/betterproto/plugin/parser.py に報告された箇所を確認します。型チェックがエラーなしで通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
mypy check failed
Reproduction Steps
Run
poe types
Expected Results
It should pass.
Actual Results
Got
-> % poe types
Poe => mypy src --ignore-missing-imports
src/betterproto/enum.py:36: error: Invalid base class [misc]
src/betterproto/enum.py:43: error: Need type annotation for "value_map" (hint: "value_map: Dict[<type>, <type>] = ...") [var-annotated]
src/betterproto/enum.py:44: error: Need type annotation for "member_map" (hint: "member_map: Dict[<type>, <type>] = ...") [var-annotated]
src/betterproto/enum.py:63: error: Need type annotation for "cls" [var-annotated]
src/betterproto/enum.py:123: error: "object" has no attribute "name" [attr-defined]
src/betterproto/enum.py:126: error: Invalid base class [misc]
src/betterproto/enum.py:177: error: Unexpected keyword argument "name" for "__new__" of "object" [call-arg]
.venv/lib/python3.7/site-packages/mypy/typeshed/stdlib/builtins.pyi:90: note: "__new__" of "object" defined here
src/betterproto/enum.py:177: error: Unexpected keyword argument "value" for "__new__" of "object" [call-arg]
.venv/lib/python3.7/site-packages/mypy/typeshed/stdlib/builtins.pyi:90: note: "__new__" of "object" defined here
src/betterproto/_version.py:2: error: Module "importlib" has no attribute "metadata" [attr-defined]
src/betterproto/__init__.py:201: error: Argument "default" to "field" has incompatible type "Optional[Any]"; expected "Field[Any]" [arg-type]
src/betterproto/__init__.py:547: error: Missing return statement [return]
src/betterproto/__init__.py:663: error: Argument 1 to "fields" has incompatible type "Type[Message]"; expected "Union[DataclassInstance, Type[DataclassInstance]]" [arg-type]
src/betterproto/__init__.py:894: error: The erased type of self "Type[betterproto.Message]" is not a supertype of its class "betterproto.Message" [misc]
src/betterproto/__init__.py:1606: error: Name "from_dict" already defined on line 1587 [no-redef]
src/betterproto/plugin/models.py:195: error: Incompatible types in assignment (expression has type "Union[Message, OutputTemplate]", variable has type "ProtoContentBase") [assignment]
src/betterproto/plugin/models.py:202: error: Incompatible types in assignment (expression has type "Union[Message, OutputTemplate]", variable has type "ProtoContentBase") [assignment]
src/betterproto/plugin/models.py:278: error: "str" has no attribute "name" [attr-defined]
src/betterproto/plugin/models.py:295: error: Incompatible types in assignment (expression has type "Union[MessageCompiler, OutputTemplate]", base class "ProtoContentBase" defined the type as "Union[Message, OutputTemplate]") [assignment]
src/betterproto/plugin/models.py:296: error: Incompatible types in assignment (expression has type "object", variable has type "DescriptorProto") [assignment]
src/betterproto/plugin/models.py:297: error: Incompatible types in assignment (expression has type "object", variable has type "List[int]") [assignment]
src/betterproto/plugin/models.py:324: error: "MessageCompiler" has no attribute "repeated" [attr-defined]
src/betterproto/plugin/models.py:396: error: Incompatible types in assignment (expression has type "object", variable has type "MessageCompiler") [assignment]
src/betterproto/plugin/models.py:397: error: Incompatible types in assignment (expression has type "FieldDescriptorProto", base class "MessageCompiler" defined the type as "DescriptorProto") [assignment]
src/betterproto/plugin/models.py:484: error: Argument 2 to "is_map" has incompatible type "MessageCompiler"; expected "DescriptorProto" [arg-type]
src/betterproto/plugin/models.py:500: error: Item "None" of "Optional[str]" has no attribute "lower" [union-attr]
src/betterproto/plugin/models.py:610: error: Incompatible types in assignment (expression has type "object", variable has type "Type[Any]") [assignment]
src/betterproto/plugin/models.py:611: error: Incompatible types in assignment (expression has type "object", variable has type "Type[Any]") [assignment]
src/betterproto/plugin/models.py:612: error: Incompatible types in assignment (expression has type "object", variable has type "str") [assignment]
src/betterproto/plugin/models.py:613: error: Incompatible types in assignment (expression has type "object", variable has type "str") [assignment]
src/betterproto/plugin/models.py:624: error: Incompatible types in assignment (expression has type "str", variable has type "Type[Any]") [assignment]
src/betterproto/plugin/models.py:629: error: Incompatible types in assignment (expression has type "str", variable has type "Type[Any]") [assignment]
src/betterproto/plugin/models.py:636: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
src/betterproto/plugin/models.py:637: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str") [assignment]
src/betterproto/plugin/models.py:661: error: Incompatible types in assignment (expression has type "EnumDescriptorProto", base class "MessageCompiler" defined the type as "DescriptorProto") [assignment]
src/betterproto/plugin/models.py:662: error: Incompatible types in assignment (expression has type "object", variable has type "List[EnumEntry]") [assignment]
src/betterproto/plugin/models.py:699: error: Incompatible types in assignment (expression has type "object", variable has type "OutputTemplate") [assignment]
src/betterproto/plugin/models.py:700: error: Incompatible types in assignment (expression has type "object", variable has type "DescriptorProto") [assignment]
src/betterproto/plugin/models.py:701: error: Incompatible types in assignment (expression has type "object", variable has type "List[int]") [assignment]
src/betterproto/plugin/models.py:721: error: Incompatible types in assignment (expression has type "ServiceCompiler", base class "ProtoContentBase" defined the type as "Union[Message, OutputTemplate]") [assignment]
src/betterproto/plugin/models.py:723: error: Incompatible types in assignment (expression has type "object", variable has type "List[int]") [assignment]
src/betterproto/plugin/parser.py:58: error: "Message" has no attribute "name" [attr-defined]
src/betterproto/plugin/parser.py:59: error: Incompatible types in "yield" (actual type "Tuple[Message, List[int]]", expected type "Tuple[Union[EnumDescriptorProto, DescriptorProto], List[int]]") [misc]
src/betterproto/plugin/parser.py:86: error: Argument 1 to "append" of "list" has incompatible type "FileDescriptorProto"; expected "str" [arg-type]
src/betterproto/plugin/parser.py:106: error: Argument 1 to "traverse" has incompatible type "str"; expected "FileDescriptorProto" [arg-type]
src/betterproto/plugin/parser.py:108: error: Argument "source_file" to "read_protobuf_type" has incompatible type "str"; expected "FileDescriptorProto" [arg-type]
src/betterproto/plugin/parser.py:109: error: Argument "item" to "read_protobuf_type" has incompatible type "Union[EnumDescriptorProto, DescriptorProto]"; expected "DescriptorProto" [arg-type]
src/betterproto/plugin/parser.py:117: error: "str" has no attribute "service" [attr-defined]
src/betterproto/plugin/parser.py:149: error: Incompatible types in assignment (expression has type "Path", variable has type "str") [assignment]
src/betterproto/plugin/parser.py:216: error: Argument "proto_obj" to "ServiceCompiler" has incompatible type "ServiceDescriptorProto"; expected "DescriptorProto" [arg-type]
Found 49 errors in 5 files (checked 24 source files)
System Information
libprotoc 25.1
Python 3.7.17
Checklist
- I have searched the issues for duplicates.
- I have shown the entire traceback, if possible.
- I have verified this issue occurs on the latest prelease of betterproto which can be installed using
pip install -U --pre betterproto, if possible.
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 235
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
danielgtaylor/python-betterproto のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
bug investigation needed
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
-
bug investigation needed
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
bug investigation needed
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
danielgtaylor/python-betterproto#676 · コメント 3 件 ·
danielgtaylor/python-betterproto の issue をすべて見る
似ている issue
-
follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
Download helper still uses huggingface_hub arguments removed in 1.0: USE_SYMLINKS is silently ignored and every download ends with a WinError 3 line対応中かも @li-lizhe が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
IPv6 node addresses produce an invalid request URL対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
typesense/typesense-python#154 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
elastic/elasticsearch-py#3592 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
developmentseed/titiler-cmr#250 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信