Cannot exclude __init__.py without excluding the entire dir
Offen
Dieses Issue hat noch niemand übernommen.
bug
topic-configuration
topic-usability
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug Report
To Reproduce
$ mkdir foo
$ cd foo
$ mkdir testpkg
$ echo "def f(): pass" > testpkg/__init__.py
$ echo "def g(): pass" > testpkg/foo.py
$ mypy --disallow-untyped-defs --exclude "fo" testpkg # <--- excludes foo.py
testpkg/__init__.py:1: error: Function is missing a return type annotation
testpkg/__init__.py:1: note: Use "-> None" if function does not return a value
Found 1 error in 1 file (checked 1 source file)
$ mypy --disallow-untyped-defs --exclude "init" testpkg # <---- should exclude __init__.py
testpkg/__init__.py:1: error: Function is missing a return type annotation
testpkg/__init__.py:1: note: Use "-> None" if function does not return a value
testpkg/foo.py:1: error: Function is missing a return type annotation
testpkg/foo.py:1: note: Use "-> None" if function does not return a value
Found 2 errors in 2 files (checked 1 source file)
Expected Behavior
__init__.py should be ignored in the last command
Actual Behavior
__init__.py was not ignored in the last command
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: see above
- Mypy configuration options from
mypy.ini(and other config files): none - Python version used: 3.7.3
- Operating system and version: Debian 10
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere die beiden mypy-Befehle mit testpkg/init.py und testpkg/foo.py und vergleiche die Ergebnisse von --exclude "fo" und --exclude "init". Verfolge, wie das Ausschlussmuster auf erkannte Dateien angewendet wird, und füge eine Abdeckung hinzu, die zeigt, dass __init__.py vom letzteren Muster ignoriert wird, während foo.py weiterhin geprüft wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100