Update autoreload to Django 3.2 (#775)

* Update autoreload stub to Django 3.2

* Fix some subclass return types

* types for watchmanreloader attributes

* Don't reference an redundant attribute in WatchmanReloader
This commit is contained in:
Chris Beaven
2021-12-15 19:06:32 +13:00
committed by GitHub
parent 059471101c
commit daf6c659f0

View File

@@ -1,66 +1,71 @@
import os
import threading import threading
import types import types
from pathlib import Path from pathlib import Path
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple, Union from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Set, Tuple, Union
from django.apps.registry import Apps from django.apps.registry import Apps
from django.dispatch import Signal
USE_INOTIFY: bool _PathCompatible = Union[os.PathLike, str, bytes]
fd: Any
RUN_RELOADER: bool
FILE_MODIFIED: int
I18N_MODIFIED: int
def gen_filenames(only_new: bool = ...) -> List[str]: ... autoreload_started: Signal
def clean_files(filelist: List[Optional[str]]) -> List[str]: ... file_changed: Signal
def reset_translations() -> None: ... DJANGO_AUTORELOAD_ENV: str
def inotify_code_changed(): ...
def code_changed(): ... def is_django_module(module: types.ModuleType): ...
def check_errors(fn: Callable) -> Callable: ... def is_django_path(path): ...
def check_errors(fn): ...
def raise_last_exception() -> None: ... def raise_last_exception() -> None: ...
def ensure_echo_on() -> None: ... def ensure_echo_on() -> None: ...
def reloader_thread() -> None: ...
def restart_with_reloader() -> int: ...
def python_reloader(main_func: Any, args: Any, kwargs: Any) -> None: ...
def main(main_func: Any, args: Optional[Any] = ..., kwargs: Optional[Any] = ...) -> None: ...
def iter_all_python_module_files() -> Set[Path]: ... def iter_all_python_module_files() -> Set[Path]: ...
def iter_modules_and_files( def iter_modules_and_files(
modules: Iterable[types.ModuleType], extra_files: Iterable[Union[str, Path]] modules: Iterable[types.ModuleType], extra_files: Iterable[_PathCompatible]
) -> Set[Path]: ... ) -> Set[Path]: ...
def common_roots(paths: Iterable[Path]) -> Iterator[Path]: ... def common_roots(paths: Iterable[_PathCompatible]) -> Iterator[Path]: ...
def sys_path_directories() -> Iterator[Path]: ... def sys_path_directories() -> Iterator[Path]: ...
def get_child_arguments(): ...
def trigger_reload(filename) -> None: ...
def restart_with_reloader() -> int: ...
class BaseReloader: class BaseReloader:
extra_files: Set[Path] extra_files: Set[Path]
directory_globs: Dict[Path, Set[str]] directory_globs: Dict[Path, Set[str]]
def __init__(self) -> None: ... def __init__(self) -> None: ...
def watch_dir(self, path: Union[str, Path], glob: str) -> None: ... def watch_dir(self, path: _PathCompatible, glob: str) -> None: ...
def watch_file(self, path: Union[str, Path]) -> None: ... def watch_file(self, path: _PathCompatible) -> None: ...
def watched_files(self, include_globs: bool = ...) -> Iterator[Path]: ... def watched_files(self, include_globs: bool = ...) -> Iterator[Path]: ...
def wait_for_apps_ready(self, app_reg: Apps, django_main_thread: threading.Thread) -> bool: ... def wait_for_apps_ready(self, app_reg: Apps, django_main_thread: threading.Thread) -> bool: ...
def run(self, django_main_thread: threading.Thread) -> None: ... def run(self, django_main_thread: threading.Thread) -> None: ...
def run_loop(self) -> None: ... def run_loop(self) -> None: ...
def tick(self) -> Iterator[None]: ... def tick(self) -> Iterator[None]: ...
@classmethod @classmethod
def check_availability(cls) -> bool: ... def check_availability(cls) -> Optional[bool]: ...
def notify_file_changed(self, path: Union[str, Path]) -> None: ... def notify_file_changed(self, path: _PathCompatible) -> None: ...
@property @property
def should_stop(self) -> bool: ... def should_stop(self) -> bool: ...
def stop(self) -> None: ... def stop(self) -> None: ...
class StatReloader(BaseReloader): class StatReloader(BaseReloader):
SLEEP_TIME: int = ... SLEEP_TIME: int
def snapshot_files(self) -> Iterator[Tuple[Path, int]]: ... def snapshot_files(self) -> Iterator[Tuple[Path, int]]: ...
@classmethod
def check_availability(cls) -> bool: ...
class WatchmanUnavailable(RuntimeError): ... class WatchmanUnavailable(RuntimeError): ...
class WatchmanReloader(BaseReloader): class WatchmanReloader(BaseReloader):
processed_request: threading.Event
client_timeout: int
def __init__(self) -> None: ...
@property @property
def client(self) -> Any: ... def client(self) -> Any: ...
def watched_roots(self, watched_files: Iterable[Path]) -> Set[Path]: ... def watched_roots(self, watched_files: Iterable[Path]) -> Set[Path]: ...
def update_watches(self) -> None: ... def update_watches(self) -> None: ...
def request_processed(self, **kwargs: Any) -> None: ... def request_processed(self, **kwargs: Any) -> None: ...
def check_server_status(self, inner_ex: Optional[BaseException] = ...) -> bool: ... def check_server_status(self, inner_ex: Optional[BaseException] = ...) -> bool: ...
@classmethod
def check_availability(cls) -> None: ...
def get_reloader() -> BaseReloader: ... def get_reloader() -> BaseReloader: ...
def start_django(reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any) -> None: ... def start_django(reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any) -> None: ...