Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mypy_drf_plugin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def _get_currently_defined_serializers(self) -> dict[str, int]:
"serializer_bases", {fullnames.BASE_SERIALIZER_FULLNAME: 1}
)
return serializer_bases
else:
return {}
return {}

def get_base_class_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None:
if fullname in self._get_currently_defined_serializers():
Expand Down
15 changes: 14 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,30 @@ select = [
"B", # bugbear
"E", # pycodestyle
"F", # pyflakes
"FURB", # refurb
"INP", # flake8-tidy-imports
"W", # pycodestyle
"I", # isort
"ISC001", # Implicitly concatenated string literals on one line
"ISC002", # Implicitly concatenated string literals over multiple lines
"UP", # pyupgrade
"TID251", # Disallowed imports (flake8-tidy-imports.banned-api)
"PYI", # flake8-pyi
"RUF100", # Equivalent to flake8-noqa NQA103
"PGH004", # Equivalent to flake8-noqa NQA104
"PGH003", # Disallowed blanket `type: ignore` annotations.
"RET504", # Unnecessary assignment to {name} before return statement
"RET505", # Unnecessary {branch} after return statement
"RET506", # Unnecessary {branch} after raise statement
"RET507", # Unnecessary {branch} after continue statement
"RET508", # Unnecessary {branch} after break statement
"RUF", # Ruff specific rules
"TC", # flake8-type-checking
]
ignore = [
"PYI021", # We have a few meaningful docstrings for stubs only constructs/utilities.
"PYI041", # This might not be obvious that `float | int` is mostly equivalent to `float` typing wise | int | str
]
ignore = ["PYI021", "PYI024", "PYI041", "PYI043"]

[tool.ruff.lint.per-file-ignores]
"*.pyi" = [
Expand Down
26 changes: 13 additions & 13 deletions rest_framework-stubs/compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ LONG_SEPARATORS: tuple[str, str]
INDENT_SEPARATORS: tuple[str, str]

__all__ = [
"INDENT_SEPARATORS",
"LONG_SEPARATORS",
"SHORT_SEPARATORS",
"CodeBlockPreprocessor",
"Preprocessor",
"QuerySet",
"apply_markdown",
"coreapi",
"coreschema",
"requests",
"postgres_fields",
"QuerySet",
"uritemplate",
"yaml",
"inflection",
"pygments",
"markdown",
"apply_markdown",
"Preprocessor",
"CodeBlockPreprocessor",
"md_filter_add_syntax_highlight",
"postgres_fields",
"pygments",
"pygments_css",
"pygments_highlight",
"md_filter_add_syntax_highlight",
"requests",
"unicode_http_header",
"SHORT_SEPARATORS",
"LONG_SEPARATORS",
"INDENT_SEPARATORS",
"uritemplate",
"yaml",
]