python / python/mypy

Cannot exclude encoder.py from type checking

Aperta
#14,698 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con mypy --strict openapi_server tests e analizza l’espressione exclude in mypy.ini, confrontando la gestione di encoder.py con quella di util.py, typing_util.py e models/. Il lavoro è completato quando l’esclusione configurata omette sistematicamente openapi_server/encoder.py preservando le esclusioni esistenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.