pytype
pytype copied to clipboard
False-positive name-error when using `@dataclass` decorator
Software versions
Python 3.11.3 pytype 2023.12.08
Testcase
from dataclasses import dataclass
class VocabLoader:
def __init__(self):
find_vocab_file_path()
@dataclass
class ModelPlus:
vocab: VocabLoader
def find_vocab_file_path():
pass
Description
$ pytype-single repr.py
File "repr.py", line 5, in __init__: Name 'find_vocab_file_path' is not defined [name-error]
Called from (traceback):
line 7, in current file
For more details, see https://google.github.io/pytype/errors.html#name-error