mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-23 20:31:32 +08:00
Add test to import all modules to check validity of stubs (#56)
* add import_all.test builder * fix errors * fix typechecking errors * fix migrations typechecking
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
from typing import Any, Dict, Iterator, List, Tuple, Union
|
||||
from typing import Any, Iterator, List, Mapping, Optional, Tuple
|
||||
|
||||
from django.template.base import Template
|
||||
|
||||
class BaseEngine:
|
||||
name: Any = ...
|
||||
dirs: Any = ...
|
||||
app_dirs: Any = ...
|
||||
def __init__(self, params: Dict[str, Union[List[str], bool, str]]) -> None: ...
|
||||
name: str = ...
|
||||
dirs: List[str] = ...
|
||||
app_dirs: bool = ...
|
||||
def __init__(self, params: Mapping[str, Any]) -> None: ...
|
||||
@property
|
||||
def app_dirname(self) -> Optional[str]: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Optional[Template]: ...
|
||||
@property
|
||||
def app_dirname(self) -> None: ...
|
||||
def from_string(self, template_code: Any) -> Template: ...
|
||||
def get_template(self, template_name: Any) -> None: ...
|
||||
def template_dirs(self) -> Tuple[str]: ...
|
||||
def iter_template_filenames(self, template_name: str) -> Iterator[str]: ...
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
from typing import Any, Dict, Iterator, Optional, List
|
||||
|
||||
from django.template.base import Template as Template
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
from typing import Any, Dict, Iterator, Optional
|
||||
|
||||
from django.template.engine import Engine
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
|
||||
from .base import BaseEngine
|
||||
|
||||
class DjangoTemplates(BaseEngine):
|
||||
app_dirs: bool
|
||||
dirs: List[str]
|
||||
name: str
|
||||
app_dirname: str = ...
|
||||
engine: Engine = ...
|
||||
def __init__(self, params: Dict[str, Any]) -> None: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ...
|
||||
|
||||
def copy_exception(exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...) -> TemplateDoesNotExist: ...
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
import string
|
||||
from typing import Any, Dict, List, Optional, Union, Tuple
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
from .base import BaseEngine
|
||||
|
||||
class TemplateStrings(BaseEngine):
|
||||
app_dirs: bool
|
||||
dirs: List[Any]
|
||||
name: str
|
||||
template_dirs: Tuple[str]
|
||||
app_dirname: str = ...
|
||||
def __init__(self, params: Dict[str, Union[Dict[Any, Any], List[Any], bool, str]]) -> None: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
|
||||
class Template(string.Template):
|
||||
template: str
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
from typing import Callable, Dict, List, Optional, Tuple, Any
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from django.template.base import Template as Template
|
||||
from django.template.exceptions import TemplateSyntaxError
|
||||
|
||||
from .base import BaseEngine
|
||||
|
||||
class Jinja2(BaseEngine):
|
||||
app_dirs: bool
|
||||
dirs: List[str]
|
||||
name: str
|
||||
template_context_processors: List[Callable]
|
||||
template_dirs: Tuple[str]
|
||||
app_dirname: str = ...
|
||||
context_processors: List[str] = ...
|
||||
def __init__(self, params: Dict[str, Any]) -> None: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
@property
|
||||
def template_context_processors(self) -> List[Callable]: ...
|
||||
|
||||
class Origin:
|
||||
name: str = ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from enum import Enum
|
||||
from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Type, Union
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.context import Context as Context
|
||||
@@ -126,12 +126,12 @@ filter_re: Any
|
||||
|
||||
class FilterExpression:
|
||||
token: str = ...
|
||||
filters: List[Tuple[Callable, List[Tuple[bool, Union[Variable, SafeText]]]]] = ...
|
||||
var: Union[Variable, SafeText] = ...
|
||||
filters: List[Any] = ...
|
||||
var: Any = ...
|
||||
def __init__(self, token: str, parser: Parser) -> None: ...
|
||||
def resolve(self, context: Union[Dict[str, Dict[str, str]], Context], ignore_failures: bool = ...) -> Any: ...
|
||||
def resolve(self, context: Mapping[str, Any], ignore_failures: bool = ...) -> Any: ...
|
||||
@staticmethod
|
||||
def args_check(name: str, func: Callable, provided: List[Tuple[bool, Union[Variable, SafeText]]]) -> bool: ...
|
||||
def args_check(name: str, func: Callable, provided: List[Tuple[bool, Any]]) -> bool: ...
|
||||
|
||||
class Variable:
|
||||
var: Union[Dict[Any, Any], str] = ...
|
||||
@@ -152,27 +152,21 @@ class Node:
|
||||
def __iter__(self) -> None: ...
|
||||
def get_nodes_by_type(self, nodetype: Type[Node]) -> List[Node]: ...
|
||||
|
||||
class NodeList(list):
|
||||
class NodeList(List[Node]):
|
||||
contains_nontext: bool = ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
def get_nodes_by_type(self, nodetype: Type[Node]) -> List[Node]: ...
|
||||
|
||||
class TextNode(Node):
|
||||
origin: Origin
|
||||
token: Token
|
||||
s: str = ...
|
||||
def __init__(self, s: str) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
def render_value_in_context(value: Any, context: Context) -> str: ...
|
||||
|
||||
class VariableNode(Node):
|
||||
origin: Origin
|
||||
token: Token
|
||||
filter_expression: FilterExpression = ...
|
||||
def __init__(self, filter_expression: FilterExpression) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
kwarg_re: Any
|
||||
|
||||
def token_kwargs(bits: List[str], parser: Parser, support_legacy: bool = ...) -> Dict[str, FilterExpression]: ...
|
||||
def token_kwargs(bits: Sequence[str], parser: Parser, support_legacy: bool = ...) -> Dict[str, FilterExpression]: ...
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from django.template import Engine
|
||||
|
||||
from .filesystem import Loader as FilesystemLoader
|
||||
|
||||
class Loader(FilesystemLoader):
|
||||
dirs: None
|
||||
engine: Engine
|
||||
def get_dirs(self) -> Tuple: ...
|
||||
class Loader(FilesystemLoader): ...
|
||||
|
||||
@@ -4,9 +4,9 @@ from django.template.base import Origin, Template
|
||||
from django.template.engine import Engine
|
||||
|
||||
class Loader:
|
||||
engine: Any = ...
|
||||
engine: Engine = ...
|
||||
get_template_cache: Dict[str, Any] = ...
|
||||
def __init__(self, engine: Engine) -> None: ...
|
||||
def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ...
|
||||
def get_template_sources(self, template_name: Any) -> None: ...
|
||||
def get_template_sources(self, template_name: str) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing import Any, Dict, List, Optional, Sequence
|
||||
|
||||
from django.template.base import Origin, Template
|
||||
from django.template.base import Origin
|
||||
from django.template.engine import Engine
|
||||
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
class Loader(BaseLoader):
|
||||
engine: Engine
|
||||
template_cache: Dict[Any, Any] = ...
|
||||
get_template_cache: Dict[str, django.template.exceptions.TemplateDoesNotExist] = ...
|
||||
loaders: List[django.template.loaders.base.Loader] = ...
|
||||
def __init__(self, engine: Engine, loaders: Union[List[Tuple[str, Dict[str, str]]], List[str]]) -> None: ...
|
||||
template_cache: Dict[str, Any] = ...
|
||||
loaders: List[BaseLoader] = ...
|
||||
def __init__(self, engine: Engine, loaders: Sequence[Any]) -> None: ...
|
||||
def get_contents(self, origin: Origin) -> str: ...
|
||||
def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ...
|
||||
def get_template_sources(self, template_name: str) -> None: ...
|
||||
def cache_key(self, template_name: str, skip: Optional[List[Origin]] = ...) -> str: ...
|
||||
def generate_hash(self, values: List[str]) -> str: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterator, List, Optional, Union
|
||||
from typing import Any, List, Optional, Union
|
||||
|
||||
from django.template.base import Origin
|
||||
from django.template.engine import Engine
|
||||
@@ -6,9 +6,7 @@ from django.template.engine import Engine
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
class Loader(BaseLoader):
|
||||
engine: Engine
|
||||
dirs: Optional[List[str]] = ...
|
||||
def __init__(self, engine: Engine, dirs: Optional[List[str]] = ...) -> None: ...
|
||||
def get_dirs(self) -> Union[List[bytes], List[str]]: ...
|
||||
def get_contents(self, origin: Origin) -> Any: ...
|
||||
def get_template_sources(self, template_name: Union[bytes, str]) -> Iterator[Origin]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, Iterator
|
||||
from typing import Dict
|
||||
|
||||
from django.template.base import Origin
|
||||
from django.template.engine import Engine
|
||||
@@ -6,8 +6,6 @@ from django.template.engine import Engine
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
class Loader(BaseLoader):
|
||||
engine: Engine
|
||||
templates_dict: Dict[str, str] = ...
|
||||
def __init__(self, engine: Engine, templates_dict: Dict[str, str]) -> None: ...
|
||||
def get_contents(self, origin: Origin) -> str: ...
|
||||
def get_template_sources(self, template_name: str) -> Iterator[Origin]: ...
|
||||
|
||||
Reference in New Issue
Block a user