-
-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce flake8-pyi
in pre-commit
checks
#1253
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5d9fc3d
only allow redirect_chain attribute in response when client sets the …
hoefling bde7358
compat for py3.7
hoefling 44b7999
compat for py3.7, fixed
hoefling 1efa5da
address review comments, extract follow flag checks in a separate tes…
hoefling d5157ac
configure flake8-pyi plugin in pre-commit
hoefling cc78575
use pep 604 union types where possible
hoefling f06c8d0
fix Y015
hoefling cf56059
use PEP 585 container types where possible, replace obsolete typing t…
hoefling add6b4c
allow isort to reorder non-top imports
hoefling ba6c37d
finish PEP 585 changes, use PEP 613 where possible
hoefling 34bbd9d
fix remaining flake8-pyi warnings, silence warnings in question
hoefling 4ae7cf9
fix Y023
hoefling 6483d4a
fix Y029
hoefling File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
import threading | ||
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Type, Union | ||
from collections.abc import Callable, Iterable | ||
from typing import Any | ||
|
||
from django.db.models.base import Model | ||
|
||
from .config import AppConfig | ||
|
||
class Apps: | ||
all_models: Dict[str, Dict[str, Type[Model]]] = ... | ||
app_configs: Dict[str, AppConfig] = ... | ||
stored_app_configs: List[Any] = ... | ||
apps_ready: bool = ... | ||
ready_event: threading.Event = ... | ||
loading: bool = ... | ||
_pending_operations: Dict[Tuple[str, str], List] | ||
models_ready: bool = ... | ||
ready: bool = ... | ||
def __init__(self, installed_apps: Optional[Iterable[Union[AppConfig, str]]] = ...) -> None: ... | ||
def populate(self, installed_apps: Iterable[Union[AppConfig, str]] = ...) -> None: ... | ||
all_models: dict[str, dict[str, type[Model]]] | ||
app_configs: dict[str, AppConfig] | ||
stored_app_configs: list[Any] | ||
apps_ready: bool | ||
ready_event: threading.Event | ||
loading: bool | ||
_pending_operations: dict[tuple[str, str], list] | ||
models_ready: bool | ||
ready: bool | ||
def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ...) -> None: ... | ||
def populate(self, installed_apps: Iterable[AppConfig | str] = ...) -> None: ... | ||
def check_apps_ready(self) -> None: ... | ||
def check_models_ready(self) -> None: ... | ||
def get_app_configs(self) -> Iterable[AppConfig]: ... | ||
def get_app_config(self, app_label: str) -> AppConfig: ... | ||
# it's not possible to support it in plugin properly now | ||
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> List[Type[Model]]: ... | ||
def get_model(self, app_label: str, model_name: Optional[str] = ..., require_ready: bool = ...) -> Type[Any]: ... | ||
def register_model(self, app_label: str, model: Type[Model]) -> None: ... | ||
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> list[type[Model]]: ... | ||
def get_model(self, app_label: str, model_name: str | None = ..., require_ready: bool = ...) -> type[Any]: ... | ||
def register_model(self, app_label: str, model: type[Model]) -> None: ... | ||
def is_installed(self, app_name: str) -> bool: ... | ||
def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ... | ||
def get_registered_model(self, app_label: str, model_name: str) -> Type[Model]: ... | ||
def get_swappable_settings_name(self, to_string: str) -> Optional[str]: ... | ||
def get_containing_app_config(self, object_name: str) -> AppConfig | None: ... | ||
def get_registered_model(self, app_label: str, model_name: str) -> type[Model]: ... | ||
def get_swappable_settings_name(self, to_string: str) -> str | None: ... | ||
def set_available_apps(self, available: Iterable[str]) -> None: ... | ||
def unset_available_apps(self) -> None: ... | ||
def set_installed_apps(self, installed: Iterable[str]) -> None: ... | ||
def unset_installed_apps(self) -> None: ... | ||
def clear_cache(self) -> None: ... | ||
def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ... | ||
def do_pending_operations(self, model: Type[Model]) -> None: ... | ||
def do_pending_operations(self, model: type[Model]) -> None: ... | ||
|
||
apps: Apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has stopped flake8 from running on the repo’s Python files, so we need two configurations. Also, please pin the version of flake8-pyi so there are no surprise failures when a new version is released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamchainz the glob includes
.py
files (note the trailing question mark), so theflake8
hook will run on both.py
and.pyi
files. I can introduce a second hook if you want tho 😎There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, missed that! No need for a second hook, I think, unless flake8-pyi rules will be problematic for plain python files.