python / python/mypy

Cannot exclude encoder.py from type checking

オープン
#14,698 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Bug Report

To Reproduce
Run command

mypy --strict openapi_server tests

All files in models/, typing_util.py and util.py are excluded but not encoder.py

Directory structure is

openapi_server/
    models/
         ...
    encoder.py
    util.py
    typing_util.py
tests/
    ...
mypy.ini

mypy.ini

[mypy]
exclude = (?x)(  # Exclude takes a regular expression
    ^openapi_server\/models\/*$
    | ^openapi_server\/encoder\.py$
    | ^openapi_server\/util\.py$
    | ^openapi_server\/typing_utils\.py$
  )

[mypy-openapi_server.models.*]
follow_imports = skip

[mypy-connexion.*]
ignore_missing_imports = True

Expected Behavior

All files in models/, typing_util.py, util.py and encoder.py are excluded

Actual Behavior

All files in models/, typing_util.py and util.py are excluded but not encoder.py

If I change the name of the file from encoder.py to encode.py or hello.py and update the regex, the file is successfully excluded.

Your Environment

  • Mypy version used: mypy --version -> mypy 1.0.0 (compiled: yes)
  • Mypy command-line flags: --strict
  • Mypy configuration options from mypy.ini (and other config files):
    mypy.ini
[mypy]
exclude = (?x)(  # Exclude takes a regular expression
    ^openapi_server\/models\/*$
    | ^openapi_server\/encoder\.py$
    | ^openapi_server\/util\.py$
    | ^openapi_server\/typing_utils\.py$
  )

[mypy-openapi_server.models.*]
follow_imports = skip

[mypy-connexion.*]
ignore_missing_imports = True
  • Python version used: Python 3.9.16

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず mypy --strict openapi_server tests で問題を再現し、mypy.iniexclude 式を調べて、encoder.py の扱いを util.pytyping_util.pymodels/ と比較します。設定された除外が openapi_server/encoder.py を一貫して除外し、既存の除外を維持できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。