mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-14 07:47:09 +08:00
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:
@@ -1,66 +1,71 @@
|
||||
import os
|
||||
import threading
|
||||
import types
|
||||
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.dispatch import Signal
|
||||
|
||||
USE_INOTIFY: bool
|
||||
fd: Any
|
||||
RUN_RELOADER: bool
|
||||
FILE_MODIFIED: int
|
||||
I18N_MODIFIED: int
|
||||
_PathCompatible = Union[os.PathLike, str, bytes]
|
||||
|
||||
def gen_filenames(only_new: bool = ...) -> List[str]: ...
|
||||
def clean_files(filelist: List[Optional[str]]) -> List[str]: ...
|
||||
def reset_translations() -> None: ...
|
||||
def inotify_code_changed(): ...
|
||||
def code_changed(): ...
|
||||
def check_errors(fn: Callable) -> Callable: ...
|
||||
autoreload_started: Signal
|
||||
file_changed: Signal
|
||||
DJANGO_AUTORELOAD_ENV: str
|
||||
|
||||
def is_django_module(module: types.ModuleType): ...
|
||||
def is_django_path(path): ...
|
||||
def check_errors(fn): ...
|
||||
def raise_last_exception() -> 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_modules_and_files(
|
||||
modules: Iterable[types.ModuleType], extra_files: Iterable[Union[str, Path]]
|
||||
modules: Iterable[types.ModuleType], extra_files: Iterable[_PathCompatible]
|
||||
) -> 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 get_child_arguments(): ...
|
||||
def trigger_reload(filename) -> None: ...
|
||||
def restart_with_reloader() -> int: ...
|
||||
|
||||
class BaseReloader:
|
||||
extra_files: Set[Path]
|
||||
directory_globs: Dict[Path, Set[str]]
|
||||
def __init__(self) -> None: ...
|
||||
def watch_dir(self, path: Union[str, Path], glob: str) -> None: ...
|
||||
def watch_file(self, path: Union[str, Path]) -> None: ...
|
||||
def watch_dir(self, path: _PathCompatible, glob: str) -> None: ...
|
||||
def watch_file(self, path: _PathCompatible) -> None: ...
|
||||
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 run(self, django_main_thread: threading.Thread) -> None: ...
|
||||
def run_loop(self) -> None: ...
|
||||
def tick(self) -> Iterator[None]: ...
|
||||
@classmethod
|
||||
def check_availability(cls) -> bool: ...
|
||||
def notify_file_changed(self, path: Union[str, Path]) -> None: ...
|
||||
def check_availability(cls) -> Optional[bool]: ...
|
||||
def notify_file_changed(self, path: _PathCompatible) -> None: ...
|
||||
@property
|
||||
def should_stop(self) -> bool: ...
|
||||
def stop(self) -> None: ...
|
||||
|
||||
class StatReloader(BaseReloader):
|
||||
SLEEP_TIME: int = ...
|
||||
SLEEP_TIME: int
|
||||
def snapshot_files(self) -> Iterator[Tuple[Path, int]]: ...
|
||||
@classmethod
|
||||
def check_availability(cls) -> bool: ...
|
||||
|
||||
class WatchmanUnavailable(RuntimeError): ...
|
||||
|
||||
class WatchmanReloader(BaseReloader):
|
||||
processed_request: threading.Event
|
||||
client_timeout: int
|
||||
def __init__(self) -> None: ...
|
||||
@property
|
||||
def client(self) -> Any: ...
|
||||
def watched_roots(self, watched_files: Iterable[Path]) -> Set[Path]: ...
|
||||
def update_watches(self) -> None: ...
|
||||
def request_processed(self, **kwargs: Any) -> None: ...
|
||||
def check_server_status(self, inner_ex: Optional[BaseException] = ...) -> bool: ...
|
||||
@classmethod
|
||||
def check_availability(cls) -> None: ...
|
||||
|
||||
def get_reloader() -> BaseReloader: ...
|
||||
def start_django(reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user