Get rid of unused code in linters (#154043)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/154043
Approved by: https://github.com/XuehaiPan, https://github.com/Skylion007
This commit is contained in:
Tom Ritchford
2025-05-21 18:01:09 +00:00
committed by PyTorch MergeBot
parent 35ddad284d
commit 9a8c42ff94
9 changed files with 8 additions and 60 deletions

View File

@ -9,16 +9,12 @@ import subprocess
import sys
import time
from enum import Enum
from typing import Any, BinaryIO, NamedTuple
from typing import BinaryIO, NamedTuple
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, Enum):
ERROR = "error"
WARNING = "warning"

View File

@ -10,16 +10,12 @@ import sys
import time
from enum import Enum
from pathlib import Path
from typing import Any, NamedTuple
from typing import NamedTuple
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, Enum):
ERROR = "error"
WARNING = "warning"

View File

@ -13,7 +13,7 @@ import time
from enum import Enum
from pathlib import Path
from sysconfig import get_paths as gp
from typing import Any, NamedTuple
from typing import NamedTuple
# PyTorch directory root
@ -31,7 +31,6 @@ def scm_root() -> str:
PYTORCH_ROOT = scm_root()
IS_WINDOWS: bool = os.name == "nt"
# Returns '/usr/local/include/python<version number>'
@ -39,10 +38,6 @@ def get_python_include_dir() -> str:
return gp()["include"]
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, Enum):
ERROR = "error"
WARNING = "warning"
@ -62,10 +57,6 @@ class LintMessage(NamedTuple):
description: str | None
def as_posix(name: str) -> str:
return name.replace("\\", "/") if IS_WINDOWS else name
# c10/core/DispatchKey.cpp:281:26: error: 'k' used after it was moved [bugprone-use-after-move]
RESULTS_RE: re.Pattern[str] = re.compile(
r"""(?mx)

View File

@ -9,16 +9,12 @@ import subprocess
import sys
import time
from enum import Enum
from typing import Any, NamedTuple
from typing import NamedTuple
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, Enum):
ERROR = "error"
WARNING = "warning"

View File

@ -12,16 +12,12 @@ import subprocess
import sys
import time
from enum import Enum
from typing import Any, NamedTuple
from typing import NamedTuple
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, Enum):
ERROR = "error"
WARNING = "warning"

View File

@ -10,14 +10,7 @@ import sys
import time
from enum import Enum
from pathlib import Path
from typing import Any, NamedTuple
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
from typing import NamedTuple
class LintSeverity(str, Enum):
@ -39,10 +32,6 @@ class LintMessage(NamedTuple):
description: str | None
def as_posix(name: str) -> str:
return name.replace("\\", "/") if IS_WINDOWS else name
# tools/linter/flake8_linter.py:15:13: error: Incompatibl...int") [assignment]
RESULTS_RE: re.Pattern[str] = re.compile(
r"""(?mx)

View File

@ -7,14 +7,7 @@ import logging
import os
import sys
from enum import Enum
from typing import Any, NamedTuple
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
from typing import NamedTuple
class LintSeverity(str, Enum):

View File

@ -11,7 +11,7 @@ import subprocess
import sys
from enum import Enum
from pathlib import Path
from typing import Any, NamedTuple
from typing import NamedTuple
import black
import isort
@ -71,10 +71,6 @@ USE_BLACK_FILELIST = re.compile(
)
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, Enum):
ERROR = "error"
WARNING = "warning"

View File

@ -20,11 +20,6 @@ SYNTAX_ERROR = "E999"
IS_WINDOWS: bool = os.name == "nt"
def eprint(*args: Any, **kwargs: Any) -> None:
"""Print to stderr."""
print(*args, file=sys.stderr, flush=True, **kwargs)
class LintSeverity(str, enum.Enum):
"""Severity of a lint message."""