Skip to content

Commit 4f466ca

Browse files
committed
up
1 parent b41afb1 commit 4f466ca

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.lintrunner.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,26 @@ command = [
371371
'--',
372372
'@{{PATHSFILE}}',
373373
]
374+
375+
[[linter]]
376+
code = 'TORCH_AO_IMPORT'
377+
include_patterns = ['**/*.py']
378+
exclude_patterns = [
379+
'third-party/**',
380+
]
381+
command = [
382+
'python3',
383+
'-m',
384+
'lintrunner_adapters',
385+
'run',
386+
'grep_linter',
387+
'--pattern=\\bfrom torch.ao.quantization(\\.[a-zA-Z0-9_]+)*\\b',
388+
'--linter-name=TorchAOImport',
389+
'--error-name=Prohibited torch.ao.quantization import',
390+
"""--error-description=\
391+
Imports from torch.ao.quantization are not allowed. \
392+
Please import from torchao.quantization.pt2e instead.\
393+
""",
394+
'--',
395+
'@{{PATHSFILE}}',
396+
]

.mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,6 @@ ignore_missing_imports = True
9797

9898
[mypy-zstd]
9999
ignore_missing_imports = True
100+
101+
[mypy-torchao.*]
102+
follow_untyped_imports = True

0 commit comments

Comments
 (0)