From 728a6cae254a3c6ef6f35e6a7f8947b6833ca954 Mon Sep 17 00:00:00 2001 From: virashu Date: Thu, 25 Jul 2024 23:17:45 +0300 Subject: [PATCH] Update stubs --- .gitignore | 2 +- pyproject.toml | 2 +- typings/flask_wtf/_compat.pyi | 4 - typings/flask_wtf/csrf.pyi | 31 +-- typings/flask_wtf/file.pyi | 58 ++++-- typings/flask_wtf/form.pyi | 31 +-- typings/flask_wtf/i18n.pyi | 12 +- typings/flask_wtf/recaptcha/__init__.pyi | 4 +- typings/flask_wtf/recaptcha/fields.pyi | 4 - typings/flask_wtf/recaptcha/validators.pyi | 4 - typings/wtforms/__init__.pyi | 8 - typings/wtforms/csrf/__init__.pyi | 3 - typings/wtforms/fields/__init__.pyi | 12 -- typings/wtforms/fields/choices.pyi | 83 -------- typings/wtforms/fields/core.pyi | 130 ------------- typings/wtforms/fields/datetime.pyi | 139 -------------- typings/wtforms/fields/form.pyi | 41 ---- typings/wtforms/fields/list.pyi | 48 ----- typings/wtforms/fields/numeric.pyi | 139 -------------- typings/wtforms/fields/simple.pyi | 69 ------- typings/wtforms/form.pyi | 81 -------- typings/wtforms/i18n.pyi | 41 ---- typings/wtforms/meta.pyi | 61 ------ typings/wtforms/utils.pyi | 21 --- typings/wtforms/validators.pyi | 210 --------------------- typings/wtforms/widgets/__init__.pyi | 6 - typings/wtforms/widgets/core.pyi | 124 ------------ 27 files changed, 80 insertions(+), 1288 deletions(-) delete mode 100644 typings/wtforms/__init__.pyi delete mode 100644 typings/wtforms/csrf/__init__.pyi delete mode 100644 typings/wtforms/fields/__init__.pyi delete mode 100644 typings/wtforms/fields/choices.pyi delete mode 100644 typings/wtforms/fields/core.pyi delete mode 100644 typings/wtforms/fields/datetime.pyi delete mode 100644 typings/wtforms/fields/form.pyi delete mode 100644 typings/wtforms/fields/list.pyi delete mode 100644 typings/wtforms/fields/numeric.pyi delete mode 100644 typings/wtforms/fields/simple.pyi delete mode 100644 typings/wtforms/form.pyi delete mode 100644 typings/wtforms/i18n.pyi delete mode 100644 typings/wtforms/meta.pyi delete mode 100644 typings/wtforms/utils.pyi delete mode 100644 typings/wtforms/validators.pyi delete mode 100644 typings/wtforms/widgets/__init__.pyi delete mode 100644 typings/wtforms/widgets/core.pyi diff --git a/.gitignore b/.gitignore index c763b7f..21deece 100644 --- a/.gitignore +++ b/.gitignore @@ -157,7 +157,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ runtime/** !runtime/.gitkeep \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8edf16d..fd7fea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,4 +30,4 @@ analyzeUnannotatedFunctions = true reportImplicitOverride = true reportDeprecated = true reportAny = false - +stubPath = "./typings" diff --git a/typings/flask_wtf/_compat.pyi b/typings/flask_wtf/_compat.pyi index 86523ba..c9b9545 100644 --- a/typings/flask_wtf/_compat.pyi +++ b/typings/flask_wtf/_compat.pyi @@ -1,5 +1 @@ -""" -This type stub file was generated by pyright. -""" - class FlaskWTFDeprecationWarning(DeprecationWarning): ... diff --git a/typings/flask_wtf/csrf.pyi b/typings/flask_wtf/csrf.pyi index 2514176..aeb66da 100644 --- a/typings/flask_wtf/csrf.pyi +++ b/typings/flask_wtf/csrf.pyi @@ -1,10 +1,14 @@ +from typing import Any, TypeVar, Union, override +from flask import Blueprint, Flask from werkzeug.exceptions import BadRequest -from wtforms.csrf.core import CSRF +from wtforms import Field +from wtforms.csrf.core import CSRF, CSRFTokenField +from wtforms.form import BaseForm __all__ = ("generate_csrf", "validate_csrf", "CSRFProtect") logger = ... -def generate_csrf(secret_key=..., token_key=...) -> Any: +def generate_csrf(secret_key: str = ..., token_key: str = ...) -> Any: """Generate a CSRF token. The token is cached for a request, so multiple calls to this function will generate the same token. @@ -18,7 +22,9 @@ def generate_csrf(secret_key=..., token_key=...) -> Any: """ ... -def validate_csrf(data, secret_key=..., time_limit=..., token_key=...) -> None: +def validate_csrf( + data: str, secret_key: str = ..., time_limit: int = ..., token_key: str = ... +) -> None: """Check if the given data is a valid CSRF token. This compares the given signed token to the one stored in the session. @@ -39,9 +45,12 @@ def validate_csrf(data, secret_key=..., time_limit=..., token_key=...) -> None: ... class _FlaskFormCSRF(CSRF): - def setup_form(self, form) -> list[tuple[str, UnboundField[Any]]]: ... - def generate_csrf_token(self, csrf_token_field) -> Any: ... - def validate_csrf_token(self, form, field) -> None: ... + @override + def generate_csrf_token(self, csrf_token_field: CSRFTokenField) -> Any: ... + @override + def validate_csrf_token(self, form: BaseForm, field: Field) -> None: ... + +_T = TypeVar("_T", bound=Union[Blueprint, str, Any]) class CSRFProtect: """Enable CSRF protection globally for a Flask app. @@ -58,10 +67,10 @@ class CSRFProtect: See the :ref:`csrf` documentation. """ - def __init__(self, app=...) -> None: ... - def init_app(self, app) -> None: ... + def __init__(self, app: Flask | None = ...) -> None: ... + def init_app(self, app: Flask) -> None: ... def protect(self) -> None: ... - def exempt(self, view) -> Blueprint | str: + def exempt(self, view: _T) -> _T: """Mark a view or blueprint to be excluded from CSRF protection. :: @@ -87,6 +96,6 @@ class CSRFError(BadRequest): :meth:`flask.Flask.errorhandler`. """ - description = ... + description: str -def same_origin(current_uri, compare_uri): ... +def same_origin(current_uri: str, compare_uri: str) -> bool: ... diff --git a/typings/flask_wtf/file.pyi b/typings/flask_wtf/file.pyi index fd87065..334f107 100644 --- a/typings/flask_wtf/file.pyi +++ b/typings/flask_wtf/file.pyi @@ -1,15 +1,31 @@ -""" -This type stub file was generated by pyright. -""" - -from wtforms import FileField as _FileField, MultipleFileField as _MultipleFileField +from _typeshed import Incomplete +from typing import Any, Iterable, TypeAlias, override + +__all__ = ( + "FileField", + "MultipleFileField", + "FileRequired", + "FileAllowed", + "FileSize", + "file_required", + "file_allowed", + "file_size", +) + +from werkzeug.datastructures import FileStorage +from wtforms import ( + Field, + FileField as _FileField, + MultipleFileField as _MultipleFileField, +) +from wtforms.form import BaseForm from wtforms.validators import DataRequired class FileField(_FileField): """Werkzeug-aware subclass of :class:`wtforms.fields.FileField`.""" - def process_formdata(self, valuelist): # -> None: - ... + @override + def process_formdata(self, valuelist: Iterable[FileStorage | Any]) -> None: ... class MultipleFileField(_MultipleFileField): """Werkzeug-aware subclass of :class:`wtforms.fields.MultipleFileField`. @@ -17,8 +33,8 @@ class MultipleFileField(_MultipleFileField): .. versionadded:: 1.2.0 """ - def process_formdata(self, valuelist): # -> None: - ... + @override + def process_formdata(self, valuelist: Iterable[FileStorage | Any]) -> None: ... class FileRequired(DataRequired): """Validates that the uploaded files(s) is a Werkzeug @@ -29,10 +45,10 @@ class FileRequired(DataRequired): You can also use the synonym ``file_required``. """ - def __call__(self, form, field): # -> None: - ... + @override + def __call__(self, form: BaseForm, field: Field) -> None: ... -file_required = FileRequired +file_required: TypeAlias = FileRequired class FileAllowed: """Validates that the uploaded file(s) is allowed by a given list of @@ -45,11 +61,12 @@ class FileAllowed: You can also use the synonym ``file_allowed``. """ - def __init__(self, upload_set, message=...) -> None: ... - def __call__(self, form, field): # -> None: - ... + def __init__( + self, upload_set: Iterable[Incomplete] | Incomplete, message: str | None = None + ) -> None: ... + def __call__(self, form: BaseForm, field: Field) -> None: ... -file_allowed = FileAllowed +file_allowed: TypeAlias = FileAllowed class FileSize: """Validates that the uploaded file(s) is within a minimum and maximum @@ -62,8 +79,9 @@ class FileSize: You can also use the synonym ``file_size``. """ - def __init__(self, max_size, min_size=..., message=...) -> None: ... - def __call__(self, form, field): # -> None: - ... + def __init__( + self, max_size: int, min_size: int = 0, message: str | None = None + ) -> None: ... + def __call__(self, form: BaseForm, field: Field) -> None: ... -file_size = FileSize +file_size: TypeAlias = FileSize diff --git a/typings/flask_wtf/form.pyi b/typings/flask_wtf/form.pyi index e9946b7..9f3d0e5 100644 --- a/typings/flask_wtf/form.pyi +++ b/typings/flask_wtf/form.pyi @@ -2,16 +2,20 @@ This type stub file was generated by pyright. """ -from typing import Callable, Sequence, Any +from typing import Any, Callable, Sequence + +from flask.sessions import SessionMixin from markupsafe import Markup -from werkzeug.datastructures import CombinedMultiDict, ImmutableMultiDict +from werkzeug.datastructures import CombinedMultiDict, ImmutableMultiDict, MultiDict from werkzeug.utils import cached_property from wtforms import Form +from wtforms.form import BaseForm from wtforms.meta import DefaultMeta -from .csrf import _FlaskFormCSRF -SUBMIT_METHODS = ... -_Auto = ... +from .csrf import _FlaskFormCSRF # type: ignore + +SUBMIT_METHODS: set[str] = ... +_Auto: object = ... class FlaskForm(Form): """Flask-specific subclass of WTForms :class:`~wtforms.form.Form`. @@ -23,28 +27,25 @@ class FlaskForm(Form): class Meta(DefaultMeta): csrf_class = _FlaskFormCSRF - csrf_context = ... + csrf_context: SessionMixin = ... @cached_property - def csrf(self): ... + def csrf(self) -> bool: ... # type: ignore @cached_property - def csrf_secret(self): ... + def csrf_secret(self) -> str: ... # type: ignore @cached_property - def csrf_field_name(self): ... + def csrf_field_name(self) -> str: ... # type: ignore @cached_property - def csrf_time_limit(self): ... + def csrf_time_limit(self) -> int: ... # type: ignore def wrap_formdata( - self, form, formdata + self, form: BaseForm, formdata: MultiDict[Any, Any] | None ) -> ( CombinedMultiDict[Any, Any] | ImmutableMultiDict[str, str] | ImmutableMultiDict[Any, Any] | None ): ... - def get_translations( - self, form - ) -> _SupportsGettextAndNgettext | Translations | None: ... - def __init__(self, formdata=..., **kwargs) -> None: ... + def __init__(self, formdata=..., **kwargs: Any) -> None: ... def is_submitted(self) -> bool: """Consider the form submitted if there is an active request and the method is ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. diff --git a/typings/flask_wtf/i18n.pyi b/typings/flask_wtf/i18n.pyi index 53ce70a..45226b5 100644 --- a/typings/flask_wtf/i18n.pyi +++ b/typings/flask_wtf/i18n.pyi @@ -1,13 +1,7 @@ -""" -This type stub file was generated by pyright. -""" - __all__ = ("Translations", "translations") class Translations: - def gettext(self, string): # -> Any: - ... - def ngettext(self, singular, plural, n): # -> Any: - ... + def gettext(self, string: str) -> str: ... + def ngettext(self, singular: str, plural: str, n: int) -> str: ... -translations = ... +translations: Translations diff --git a/typings/flask_wtf/recaptcha/__init__.pyi b/typings/flask_wtf/recaptcha/__init__.pyi index 6e271c1..f097cfa 100644 --- a/typings/flask_wtf/recaptcha/__init__.pyi +++ b/typings/flask_wtf/recaptcha/__init__.pyi @@ -1,6 +1,4 @@ -""" -This type stub file was generated by pyright. -""" +__all__ = ("RecaptchaField", "Recaptcha", "RecaptchaWidget") from .fields import RecaptchaField from .validators import Recaptcha diff --git a/typings/flask_wtf/recaptcha/fields.pyi b/typings/flask_wtf/recaptcha/fields.pyi index 1686c49..297b158 100644 --- a/typings/flask_wtf/recaptcha/fields.pyi +++ b/typings/flask_wtf/recaptcha/fields.pyi @@ -1,7 +1,3 @@ -""" -This type stub file was generated by pyright. -""" - from wtforms.fields import Field __all__ = ["RecaptchaField"] diff --git a/typings/flask_wtf/recaptcha/validators.pyi b/typings/flask_wtf/recaptcha/validators.pyi index c2551e4..283123f 100644 --- a/typings/flask_wtf/recaptcha/validators.pyi +++ b/typings/flask_wtf/recaptcha/validators.pyi @@ -1,7 +1,3 @@ -""" -This type stub file was generated by pyright. -""" - RECAPTCHA_VERIFY_SERVER_DEFAULT = ... RECAPTCHA_ERROR_CODES = ... __all__ = ["Recaptcha"] diff --git a/typings/wtforms/__init__.pyi b/typings/wtforms/__init__.pyi deleted file mode 100644 index b842408..0000000 --- a/typings/wtforms/__init__.pyi +++ /dev/null @@ -1,8 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from wtforms import validators as validators, widgets as widgets -from wtforms.fields import * -from wtforms.form import Form as Form -from wtforms.validators import ValidationError as ValidationError diff --git a/typings/wtforms/csrf/__init__.pyi b/typings/wtforms/csrf/__init__.pyi deleted file mode 100644 index cea7ef9..0000000 --- a/typings/wtforms/csrf/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -""" -This type stub file was generated by pyright. -""" diff --git a/typings/wtforms/fields/__init__.pyi b/typings/wtforms/fields/__init__.pyi deleted file mode 100644 index 4831e59..0000000 --- a/typings/wtforms/fields/__init__.pyi +++ /dev/null @@ -1,12 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from wtforms.fields.choices import * -from wtforms.fields.choices import SelectFieldBase as SelectFieldBase -from wtforms.fields.core import Field as Field, Flags as Flags, Label as Label -from wtforms.fields.datetime import * -from wtforms.fields.form import * -from wtforms.fields.list import * -from wtforms.fields.numeric import * -from wtforms.fields.simple import * diff --git a/typings/wtforms/fields/choices.pyi b/typings/wtforms/fields/choices.pyi deleted file mode 100644 index fc77e8c..0000000 --- a/typings/wtforms/fields/choices.pyi +++ /dev/null @@ -1,83 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Iterable, Iterator, Sequence -from typing import Any -from typing_extensions import Self, TypeAlias -from wtforms.fields.core import Field, _Filter, _FormT, _Validator, _Widget -from wtforms.form import BaseForm -from wtforms.meta import DefaultMeta, _SupportsGettextAndNgettext - -_Choice: TypeAlias = ... -_GroupedChoices: TypeAlias = ... -_FullChoice: TypeAlias = ... -_FullGroupedChoices: TypeAlias = ... -_Option: TypeAlias = ... - -class SelectFieldBase(Field): - option_widget: _Widget[_Option] - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - option_widget: _Widget[_Option] | None = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: object | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - def iter_choices(self) -> Iterator[_FullChoice]: ... - def has_groups(self) -> bool: ... - def iter_groups(self) -> Iterator[_FullGroupedChoices]: ... - def __iter__(self) -> Iterator[_Option]: ... - - class _Option(Field): - checked: bool - ... - -class SelectField(SelectFieldBase): - coerce: Callable[[Any], Any] - choices: list[_Choice] | _GroupedChoices - validate_choice: bool - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - coerce: Callable[[Any], Any] = ..., - choices: Iterable[_Choice] - | _GroupedChoices - | Callable[[], Iterable[_Choice] | _GroupedChoices] - | None = ..., - validate_choice: bool = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: object | None = ..., - widget: _Widget[Self] | None = ..., - option_widget: _Widget[_Option] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - def iter_choices(self) -> Iterator[_FullChoice]: ... - def has_groups(self) -> bool: ... - def iter_groups(self) -> Iterator[_FullGroupedChoices]: ... - -class SelectMultipleField(SelectField): - data: list[Any] | None - ... - -class RadioField(SelectField): ... diff --git a/typings/wtforms/fields/core.pyi b/typings/wtforms/fields/core.pyi deleted file mode 100644 index 9ff69fe..0000000 --- a/typings/wtforms/fields/core.pyi +++ /dev/null @@ -1,130 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from builtins import type as _type -from collections.abc import Iterable, Sequence -from typing import Any, Generic, Protocol, TypeVar, overload -from typing_extensions import Self, TypeAlias -from markupsafe import Markup -from wtforms.form import BaseForm -from wtforms.meta import ( - DefaultMeta, - _MultiDictLikeWithGetlist, - _SupportsGettextAndNgettext, -) - -_FormT = TypeVar("_FormT", bound=BaseForm) -_FieldT = TypeVar("_FieldT", bound=Field) -_FormT_contra = TypeVar("_FormT_contra", bound=BaseForm, contravariant=True) -_FieldT_contra = TypeVar("_FieldT_contra", bound=Field, contravariant=True) -_Filter: TypeAlias = ... - -class _Validator(Protocol[_FormT_contra, _FieldT_contra]): - def __call__(self, form: _FormT_contra, field: _FieldT_contra, /) -> object: ... - -class _Widget(Protocol[_FieldT_contra]): - def __call__(self, field: _FieldT_contra, **kwargs: Any) -> Markup: ... - -class Field: - errors: Sequence[str] - process_errors: Sequence[str] - raw_data: list[Any] | None - object_data: Any - data: Any - validators: Sequence[_Validator[Any, Self]] - widget: _Widget[Self] - do_not_call_in_templates: bool - meta: DefaultMeta - default: Any | None - description: str - render_kw: dict[str, Any] - filters: Sequence[_Filter] - flags: Flags - name: str - short_name: str - id: str - type: str - label: Label - def __new__(cls, *args: Any, **kwargs: Any) -> Self: ... - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: object | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ..., - ) -> None: ... - def __html__(self) -> str: ... - def __call__(self, **kwargs: object) -> Markup: ... - @classmethod - def check_validators( - cls, validators: Iterable[_Validator[_FormT, Self]] | None - ) -> None: ... - def gettext(self, string: str) -> str: ... - def ngettext(self, singular: str, plural: str, n: int) -> str: ... - def validate( - self, - form: BaseForm, - extra_validators: tuple[_Validator[_FormT, Self], ...] | list[Any] = ..., - ) -> bool: ... - def pre_validate(self, form: BaseForm) -> None: ... - def post_validate(self, form: BaseForm, validation_stopped: bool) -> None: ... - def process( - self, - formdata: _MultiDictLikeWithGetlist | None, - data: Any = ..., - extra_filters: Sequence[_Filter] | None = ..., - ) -> None: ... - def process_data(self, value: Any) -> None: ... - def process_formdata(self, valuelist: list[Any]) -> None: ... - def populate_obj(self, obj: object, name: str) -> None: ... - @overload - def __get__( - self, obj: None, owner: _type[object] | None = ... - ) -> UnboundField[Self]: ... - @overload - def __get__(self, obj: object, owner: _type[object] | None = ...) -> Self: ... - -class UnboundField(Generic[_FieldT]): - creation_counter: int - field_class: type[_FieldT] - name: str | None - args: tuple[Any, ...] - kwargs: dict[str, Any] - def __init__( - self, - field_class: type[_FieldT], - *args: object, - name: str | None = ..., - **kwargs: object, - ) -> None: ... - def bind( - self, - form: BaseForm, - name: str, - prefix: str = ..., - translations: _SupportsGettextAndNgettext | None = ..., - **kwargs: object, - ) -> _FieldT: ... - -class Flags: - def __getattr__(self, name: str) -> Any | None: ... - def __setattr__(self, name: str, value: object) -> None: ... - def __delattr__(self, name: str) -> None: ... - def __contains__(self, name: str) -> Any | None: ... - -class Label: - field_id: str - text: str - def __init__(self, field_id: str, text: str) -> None: ... - def __html__(self) -> str: ... - def __call__(self, text: str | None = ..., **kwargs: Any) -> Markup: ... diff --git a/typings/wtforms/fields/datetime.pyi b/typings/wtforms/fields/datetime.pyi deleted file mode 100644 index fbdba1c..0000000 --- a/typings/wtforms/fields/datetime.pyi +++ /dev/null @@ -1,139 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Sequence -from datetime import date, datetime, time -from typing import Any -from typing_extensions import Self -from wtforms.fields.core import Field, _Filter, _FormT, _Validator, _Widget -from wtforms.form import BaseForm -from wtforms.meta import DefaultMeta, _SupportsGettextAndNgettext - -class DateTimeField(Field): - format: list[str] - strptime_format: list[str] - data: datetime | None - default: datetime | Callable[[], datetime] | None - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - format: str | list[str] = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: datetime | Callable[[], datetime] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class DateField(DateTimeField): - data: date | None - default: date | Callable[[], date] | None - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - format: str | list[str] = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: date | Callable[[], date] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class TimeField(DateTimeField): - data: time | None - default: time | Callable[[], time] | None - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - format: str | list[str] = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: time | Callable[[], time] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class MonthField(DateField): - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - format: str | list[str] = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: time | Callable[[], time] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class WeekField(DateField): - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - format: str | list[str] = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: time | Callable[[], time] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class DateTimeLocalField(DateTimeField): - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - format: str | list[str] = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: time | Callable[[], time] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... diff --git a/typings/wtforms/fields/form.pyi b/typings/wtforms/fields/form.pyi deleted file mode 100644 index 3832b5b..0000000 --- a/typings/wtforms/fields/form.pyi +++ /dev/null @@ -1,41 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Iterator, Sequence -from typing import Any, Generic, TypeVar -from wtforms.fields.core import Field, _Widget -from wtforms.form import BaseForm -from wtforms.meta import DefaultMeta, _SupportsGettextAndNgettext - -_BoundFormT = TypeVar("_BoundFormT", bound=BaseForm) - -class FormField(Field, Generic[_BoundFormT]): - form_class: type[_BoundFormT] - form: _BoundFormT - separator: str - def __init__( - self: FormField[_BoundFormT], - form_class: type[_BoundFormT], - label: str | None = ..., - validators: None = ..., - separator: str = ..., - *, - description: str = ..., - id: str | None = ..., - default: object | None = ..., - widget: _Widget[FormField[_BoundFormT]] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - def __iter__(self) -> Iterator[Field]: ... - def __getitem__(self, name: str) -> Field: ... - def __getattr__(self, name: str) -> Field: ... - @property - def data(self) -> dict[str, Any]: ... - @property - def errors(self) -> dict[str | None, Sequence[str]]: ... diff --git a/typings/wtforms/fields/list.pyi b/typings/wtforms/fields/list.pyi deleted file mode 100644 index f7d0f58..0000000 --- a/typings/wtforms/fields/list.pyi +++ /dev/null @@ -1,48 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Iterable, Iterator -from typing import Any, Generic, TypeVar -from wtforms.fields.core import Field, UnboundField, _FormT, _Validator, _Widget -from wtforms.form import BaseForm -from wtforms.meta import DefaultMeta, _SupportsGettextAndNgettext - -_BoundFieldT = TypeVar("_BoundFieldT", bound=Field) - -class FieldList(Field, Generic[_BoundFieldT]): - unbound_field: UnboundField[_BoundFieldT] - min_entries: int - max_entries: int | None - last_index: int - entries: list[_BoundFieldT] - object_data: Iterable[Any] - def __init__( - self: FieldList[_BoundFieldT], - unbound_field: UnboundField[_BoundFieldT] | _BoundFieldT, - label: str | None = ..., - validators: tuple[_Validator[_FormT, _BoundFieldT], ...] - | list[Any] - | None = ..., - min_entries: int = ..., - max_entries: int | None = ..., - separator: str = ..., - default: Iterable[Any] | Callable[[], Iterable[Any]] = ..., - *, - description: str = ..., - id: str | None = ..., - widget: _Widget[FieldList[Any]] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - def append_entry(self, data: Any = ...) -> _BoundFieldT: ... - def pop_entry(self) -> _BoundFieldT: ... - def __iter__(self) -> Iterator[_BoundFieldT]: ... - def __len__(self) -> int: ... - def __getitem__(self, index: int) -> _BoundFieldT: ... - @property - def data(self) -> list[Any]: ... diff --git a/typings/wtforms/fields/numeric.pyi b/typings/wtforms/fields/numeric.pyi deleted file mode 100644 index e863cc5..0000000 --- a/typings/wtforms/fields/numeric.pyi +++ /dev/null @@ -1,139 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Sequence -from decimal import Decimal -from typing import Any, Literal, overload -from typing_extensions import Self -from wtforms.fields.core import Field, _Filter, _FormT, _Validator, _Widget -from wtforms.form import BaseForm -from wtforms.meta import DefaultMeta, _SupportsGettextAndNgettext -from wtforms.utils import UnsetValue - -__all__ = ( - "IntegerField", - "DecimalField", - "FloatField", - "IntegerRangeField", - "DecimalRangeField", -) - -class LocaleAwareNumberField(Field): - use_locale: bool - number_format: Any | None - locale: str - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - use_locale: bool = ..., - number_format: str | Any | None = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: object | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class IntegerField(Field): - data: int | None - default: int | Callable[[], int] | None - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: int | Callable[[], int] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class DecimalField(LocaleAwareNumberField): - data: Decimal | None - default: Decimal | Callable[[], Decimal] | None - places: int | None - rounding: str | None - @overload - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - *, - places: UnsetValue = ..., - rounding: None = ..., - use_locale: Literal[True], - number_format: str | Any | None = ..., - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: Decimal | Callable[[], Decimal] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - @overload - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - places: int | UnsetValue | None = ..., - rounding: str | None = ..., - *, - use_locale: Literal[False] = ..., - number_format: str | Any | None = ..., - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: Decimal | Callable[[], Decimal] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class FloatField(Field): - data: float | None - default: float | Callable[[], float] | None - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: float | Callable[[], float] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class IntegerRangeField(IntegerField): ... -class DecimalRangeField(DecimalField): ... diff --git a/typings/wtforms/fields/simple.pyi b/typings/wtforms/fields/simple.pyi deleted file mode 100644 index 8498a54..0000000 --- a/typings/wtforms/fields/simple.pyi +++ /dev/null @@ -1,69 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Collection, Sequence -from typing import Any -from typing_extensions import Self -from wtforms.fields.core import Field, _Filter, _FormT, _Validator, _Widget -from wtforms.form import BaseForm -from wtforms.meta import DefaultMeta, _SupportsGettextAndNgettext - -class BooleanField(Field): - data: bool - default: bool | Callable[[], bool] | None - false_values: Collection[Any] - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - false_values: Collection[Any] | None = ..., - *, - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: bool | Callable[[], bool] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ... - ) -> None: ... - -class StringField(Field): - data: str | None - default: str | Callable[[], str] | None - def __init__( - self, - label: str | None = ..., - validators: tuple[_Validator[_FormT, Self], ...] | list[Any] | None = ..., - filters: Sequence[_Filter] = ..., - description: str = ..., - id: str | None = ..., - default: str | Callable[[], str] | None = ..., - widget: _Widget[Self] | None = ..., - render_kw: dict[str, Any] | None = ..., - name: str | None = ..., - _form: BaseForm | None = ..., - _prefix: str = ..., - _translations: _SupportsGettextAndNgettext | None = ..., - _meta: DefaultMeta | None = ..., - ) -> None: ... - -class TextAreaField(StringField): ... -class PasswordField(StringField): ... -class FileField(Field): ... - -class MultipleFileField(FileField): - data: list[Any] - ... - -class HiddenField(StringField): ... -class SubmitField(BooleanField): ... -class SearchField(StringField): ... -class TelField(StringField): ... -class URLField(StringField): ... -class EmailField(StringField): ... -class ColorField(StringField): ... diff --git a/typings/wtforms/form.pyi b/typings/wtforms/form.pyi deleted file mode 100644 index 453f94a..0000000 --- a/typings/wtforms/form.pyi +++ /dev/null @@ -1,81 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from _typeshed import SupportsItems -from collections.abc import Iterable, Iterator, Mapping, Sequence -from typing import Any, ClassVar, Protocol, overload -from typing_extensions import TypeAlias -from wtforms.fields.core import Field, UnboundField -from wtforms.meta import DefaultMeta, _MultiDictLike - -_FormErrors: TypeAlias = ... - -class _UnboundFields(Protocol): - @overload - def __get__( - self, obj: None, owner: type[object] | None = ..., / - ) -> list[tuple[str, UnboundField[Any]]] | None: ... - @overload - def __get__( - self, obj: object, owner: type[object] | None = ..., / - ) -> list[tuple[str, UnboundField[Any]]]: ... - -class BaseForm: - meta: DefaultMeta - form_errors: list[str] - _fields: dict[str, Field] - def __init__( - self, - fields: SupportsItems[str, UnboundField[Any]] - | Iterable[tuple[str, UnboundField[Any]]], - prefix: str = ..., - meta: DefaultMeta = ..., - ) -> None: ... - def __iter__(self) -> Iterator[Field]: ... - def __contains__(self, name: str) -> bool: ... - def __getitem__(self, name: str) -> Field: ... - def __setitem__(self, name: str, value: UnboundField[Any]) -> None: ... - def __delitem__(self, name: str) -> None: ... - def populate_obj(self, obj: object) -> None: ... - def process( - self, - formdata: _MultiDictLike | None = ..., - obj: object | None = ..., - data: Mapping[str, Any] | None = ..., - extra_filters: Mapping[str, Sequence[Any]] | None = ..., - **kwargs: object, - ) -> None: ... - def validate( - self, extra_validators: Mapping[str, Sequence[Any]] | None = ... - ) -> bool: ... - @property - def data(self) -> dict[str, Any]: ... - @property - def errors(self) -> _FormErrors: ... - -class FormMeta(type): - def __init__( - cls, name: str, bases: Sequence[type[object]], attrs: Mapping[str, Any] - ) -> None: ... - def __call__(cls, *args: Any, **kwargs: Any) -> Any: ... - def __setattr__(cls, name: str, value: object) -> None: ... - def __delattr__(cls, name: str) -> None: ... - -class Form(BaseForm, metaclass=FormMeta): - Meta: ClassVar[type[Any]] - _unbound_fields: _UnboundFields - def __init__( - self, - formdata: _MultiDictLike | None = ..., - obj: object | None = ..., - prefix: str = ..., - data: Mapping[str, Any] | None = ..., - meta: Mapping[str, Any] | None = ..., - *, - extra_filters: Mapping[str, Sequence[Any]] | None = ..., - **kwargs: object, - ) -> None: ... - def __setitem__(self, name: str, value: None) -> None: ... - def __delitem__(self, name: str) -> None: ... - def __delattr__(self, name: str) -> None: ... diff --git a/typings/wtforms/i18n.pyi b/typings/wtforms/i18n.pyi deleted file mode 100644 index f09ceae..0000000 --- a/typings/wtforms/i18n.pyi +++ /dev/null @@ -1,41 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Iterable -from gettext import GNUTranslations -from typing import Protocol, TypeVar, overload - -_T = TypeVar("_T") - -class _SupportsUgettextAndUngettext(Protocol): - def ugettext(self, string: str, /) -> str: ... - def ungettext(self, singular: str, plural: str, n: int, /) -> str: ... - -def messages_path() -> str: ... -def get_builtin_gnu_translations( - languages: Iterable[str] | None = ..., -) -> GNUTranslations: ... -@overload -def get_translations( - languages: Iterable[str] | None = ..., - getter: Callable[[Iterable[str]], GNUTranslations] = ..., -) -> GNUTranslations: ... -@overload -def get_translations( - languages: Iterable[str] | None = ..., *, getter: Callable[[Iterable[str]], _T] -) -> _T: ... -@overload -def get_translations( - languages: Iterable[str] | None, getter: Callable[[Iterable[str]], _T] -) -> _T: ... - -class DefaultTranslations: - translations: _SupportsUgettextAndUngettext - def __init__(self, translations: _SupportsUgettextAndUngettext) -> None: ... - def gettext(self, string: str) -> str: ... - def ngettext(self, singular: str, plural: str, n: int) -> str: ... - -class DummyTranslations: - def gettext(self, string: str) -> str: ... - def ngettext(self, singular: str, plural: str, n: int) -> str: ... diff --git a/typings/wtforms/meta.pyi b/typings/wtforms/meta.pyi deleted file mode 100644 index 340899e..0000000 --- a/typings/wtforms/meta.pyi +++ /dev/null @@ -1,61 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from _typeshed import SupportsItems -from collections.abc import Collection, Iterator, MutableMapping -from typing import Any, Literal, Protocol, TypeVar, overload -from typing_extensions import TypeAlias -from markupsafe import Markup -from wtforms.fields.core import Field, UnboundField -from wtforms.form import BaseForm - -_FieldT = TypeVar("_FieldT", bound=Field) - -class _SupportsGettextAndNgettext(Protocol): - def gettext(self, string: str, /) -> str: ... - def ngettext(self, singular: str, plural: str, n: int, /) -> str: ... - -class _MultiDictLikeBase(Protocol): - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - def __contains__(self, key: Any, /) -> bool: ... - -class _MultiDictLikeWithGetlist(_MultiDictLikeBase, Protocol): - def getlist(self, key: str, /) -> list[Any]: ... - -class _MultiDictLikeWithGetall(_MultiDictLikeBase, Protocol): - def getall(self, key: str, /) -> list[Any]: ... - -_MultiDictLike: TypeAlias = ... - -class DefaultMeta: - def bind_field( - self, - form: BaseForm, - unbound_field: UnboundField[_FieldT], - options: MutableMapping[str, Any], - ) -> _FieldT: ... - @overload - def wrap_formdata(self, form: BaseForm, formdata: None) -> None: ... - @overload - def wrap_formdata( - self, form: BaseForm, formdata: _MultiDictLike - ) -> _MultiDictLikeWithGetlist: ... - def render_field( - self, field: Field, render_kw: SupportsItems[str, Any] - ) -> Markup: ... - - csrf: bool - csrf_field_name: str - csrf_secret: Any | None - csrf_context: Any | None - csrf_class: type[Any] | None - def build_csrf(self, form: BaseForm) -> Any: ... - - locales: Literal[False] | Collection[str] - cache_translations: bool - translations_cache: dict[str, _SupportsGettextAndNgettext] - def get_translations(self, form: BaseForm) -> _SupportsGettextAndNgettext: ... - def update_values(self, values: SupportsItems[str, Any]) -> None: ... - def __getattr__(self, name: str) -> Any: ... diff --git a/typings/wtforms/utils.pyi b/typings/wtforms/utils.pyi deleted file mode 100644 index f60f5a7..0000000 --- a/typings/wtforms/utils.pyi +++ /dev/null @@ -1,21 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Iterable, Iterator -from typing import Any, Literal -from wtforms.meta import _MultiDictLikeWithGetall - -def clean_datetime_format_for_strptime(formats: Iterable[str]) -> list[str]: ... - -class UnsetValue: - def __bool__(self) -> Literal[False]: ... - -unset_value: UnsetValue - -class WebobInputWrapper: - def __init__(self, multidict: _MultiDictLikeWithGetall) -> None: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - def __contains__(self, name: str) -> bool: ... - def getlist(self, name: str) -> list[Any]: ... diff --git a/typings/wtforms/validators.pyi b/typings/wtforms/validators.pyi deleted file mode 100644 index 8910d1d..0000000 --- a/typings/wtforms/validators.pyi +++ /dev/null @@ -1,210 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from collections.abc import Callable, Collection, Iterable -from decimal import Decimal -from re import Match, Pattern -from typing import Any, TypeVar, overload -from wtforms.fields import Field, StringField -from wtforms.form import BaseForm - -_ValuesT = TypeVar("_ValuesT", bound=Collection[Any], contravariant=True) - -class ValidationError(ValueError): - def __init__(self, message: str = ..., *args: object) -> None: ... - -class StopValidation(Exception): - def __init__(self, message: str = ..., *args: object) -> None: ... - -class EqualTo: - fieldname: str - message: str | None - def __init__(self, fieldname: str, message: str | None = ...) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - -class Length: - min: int - max: int - message: str | None - field_flags: dict[str, Any] - def __init__( - self, min: int = ..., max: int = ..., message: str | None = ... - ) -> None: ... - def __call__(self, form: BaseForm, field: StringField) -> None: ... - -class NumberRange: - min: float | Decimal | None - max: float | Decimal | None - message: str | None - field_flags: dict[str, Any] - def __init__( - self, - min: float | Decimal | None = ..., - max: float | Decimal | None = ..., - message: str | None = ..., - ) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - -class Optional: - string_check: Callable[[str], bool] - field_flags: dict[str, Any] - def __init__(self, strip_whitespace: bool = ...) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - -class DataRequired: - message: str | None - field_flags: dict[str, Any] - def __init__(self, message: str | None = ...) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - -class InputRequired: - message: str | None - field_flags: dict[str, Any] - def __init__(self, message: str | None = ...) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - -class Regexp: - regex: Pattern[str] - message: str | None - def __init__( - self, regex: str | Pattern[str], flags: int = ..., message: str | None = ... - ) -> None: ... - def __call__( - self, form: BaseForm, field: StringField, message: str | None = ... - ) -> Match[str]: ... - -class Email: - message: str | None - granular_message: bool - check_deliverability: bool - allow_smtputf8: bool - allow_empty_local: bool - def __init__( - self, - message: str | None = ..., - granular_message: bool = ..., - check_deliverability: bool = ..., - allow_smtputf8: bool = ..., - allow_empty_local: bool = ..., - ) -> None: ... - def __call__(self, form: BaseForm, field: StringField) -> None: ... - -class IPAddress: - ipv4: bool - ipv6: bool - message: str | None - def __init__( - self, ipv4: bool = ..., ipv6: bool = ..., message: str | None = ... - ) -> None: ... - def __call__(self, form: BaseForm, field: StringField) -> None: ... - @classmethod - def check_ipv4(cls, value: str | None) -> bool: ... - @classmethod - def check_ipv6(cls, value: str | None) -> bool: ... - -class MacAddress(Regexp): - def __init__(self, message: str | None = ...) -> None: ... - def __call__(self, form: BaseForm, field: StringField) -> None: ... - -class URL(Regexp): - validate_hostname: HostnameValidation - def __init__( - self, require_tld: bool = ..., allow_ip: bool = ..., message: str | None = ... - ) -> None: ... - def __call__(self, form: BaseForm, field: StringField) -> None: ... - -class UUID: - message: str | None - def __init__(self, message: str | None = ...) -> None: ... - def __call__(self, form: BaseForm, field: StringField) -> None: ... - -class AnyOf: - values: Collection[Any] - message: str | None - values_formatter: Callable[[Any], str] - @overload - def __init__( - self, - values: Collection[Any], - message: str | None = ..., - values_formatter: None = ..., - ) -> None: ... - @overload - def __init__( - self, - values: _ValuesT, - message: str | None, - values_formatter: Callable[[_ValuesT], str], - ) -> None: ... - @overload - def __init__( - self, - values: _ValuesT, - message: str | None = ..., - *, - values_formatter: Callable[[_ValuesT], str] - ) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - @staticmethod - def default_values_formatter(values: Iterable[object]) -> str: ... - -class NoneOf: - values: Collection[Any] - message: str | None - values_formatter: Callable[[Any], str] - @overload - def __init__( - self, - values: Collection[Any], - message: str | None = ..., - values_formatter: None = ..., - ) -> None: ... - @overload - def __init__( - self, - values: _ValuesT, - message: str | None, - values_formatter: Callable[[_ValuesT], str], - ) -> None: ... - @overload - def __init__( - self, - values: _ValuesT, - message: str | None = ..., - *, - values_formatter: Callable[[_ValuesT], str] - ) -> None: ... - def __call__(self, form: BaseForm, field: Field) -> None: ... - @staticmethod - def default_values_formatter(v: Iterable[object]) -> str: ... - -class HostnameValidation: - hostname_part: Pattern[str] - tld_part: Pattern[str] - require_tld: bool - allow_ip: bool - def __init__(self, require_tld: bool = ..., allow_ip: bool = ...) -> None: ... - def __call__(self, hostname: str) -> bool: ... - -class ReadOnly: - def __call__(self, form: BaseForm, field: Field) -> None: ... - -class Disabled: - def __call__(self, form: BaseForm, field: Field) -> None: ... - -email = Email -equal_to = EqualTo -ip_address = IPAddress -mac_address = MacAddress -length = Length -number_range = NumberRange -optional = Optional -input_required = InputRequired -data_required = DataRequired -regexp = Regexp -url = URL -any_of = AnyOf -none_of = NoneOf -readonly = ReadOnly -disabled = Disabled diff --git a/typings/wtforms/widgets/__init__.pyi b/typings/wtforms/widgets/__init__.pyi deleted file mode 100644 index 982ac65..0000000 --- a/typings/wtforms/widgets/__init__.pyi +++ /dev/null @@ -1,6 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from wtforms.widgets.core import * -from wtforms.widgets.core import Input as Input, html_params as html_params diff --git a/typings/wtforms/widgets/core.pyi b/typings/wtforms/widgets/core.pyi deleted file mode 100644 index 4bc1c09..0000000 --- a/typings/wtforms/widgets/core.pyi +++ /dev/null @@ -1,124 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from decimal import Decimal -from typing import Any, Literal -from markupsafe import Markup -from wtforms.fields import Field, FormField, SelectFieldBase, StringField -from wtforms.fields.choices import _Option - -__all__ = ( - "CheckboxInput", - "ColorInput", - "DateInput", - "DateTimeInput", - "DateTimeLocalInput", - "EmailInput", - "FileInput", - "HiddenInput", - "ListWidget", - "MonthInput", - "NumberInput", - "Option", - "PasswordInput", - "RadioInput", - "RangeInput", - "SearchInput", - "Select", - "SubmitInput", - "TableWidget", - "TextArea", - "TextInput", - "TelInput", - "TimeInput", - "URLInput", - "WeekInput", -) - -def html_params(**kwargs: object) -> str: ... - -class ListWidget: - html_tag: Literal["ul", "ol"] - prefix_label: bool - def __init__( - self, html_tag: Literal["ul", "ol"] = ..., prefix_label: bool = ... - ) -> None: ... - def __call__(self, field: Field, **kwargs: object) -> Markup: ... - -class TableWidget: - with_table_tag: bool - def __init__(self, with_table_tag: bool = ...) -> None: ... - def __call__(self, field: FormField[Any], **kwargs: object) -> Markup: ... - -class Input: - validation_attrs: list[str] - input_type: str - def __init__(self, input_type: str | None = ...) -> None: ... - def __call__(self, field: Field, **kwargs: object) -> Markup: ... - @staticmethod - def html_params(**kwargs: object) -> str: ... - -class TextInput(Input): ... - -class PasswordInput(Input): - hide_value: bool - def __init__(self, hide_value: bool = ...) -> None: ... - -class HiddenInput(Input): - field_flags: dict[str, Any] - ... - -class CheckboxInput(Input): ... -class RadioInput(Input): ... - -class FileInput(Input): - multiple: bool - def __init__(self, multiple: bool = ...) -> None: ... - -class SubmitInput(Input): ... - -class TextArea: - validation_attrs: list[str] - def __call__(self, field: StringField, **kwargs: object) -> Markup: ... - -class Select: - validation_attrs: list[str] - multiple: bool - def __init__(self, multiple: bool = ...) -> None: ... - def __call__(self, field: SelectFieldBase, **kwargs: object) -> Markup: ... - @classmethod - def render_option( - cls, value: object, label: str, selected: bool, **kwargs: object - ) -> Markup: ... - -class Option: - def __call__(self, field: _Option, **kwargs: object) -> Markup: ... - -class SearchInput(Input): ... -class TelInput(Input): ... -class URLInput(Input): ... -class EmailInput(Input): ... -class DateTimeInput(Input): ... -class DateInput(Input): ... -class MonthInput(Input): ... -class WeekInput(Input): ... -class TimeInput(Input): ... -class DateTimeLocalInput(Input): ... - -class NumberInput(Input): - step: Decimal | float | str | None - min: Decimal | float | str | None - max: Decimal | float | str | None - def __init__( - self, - step: Decimal | float | str | None = ..., - min: Decimal | float | str | None = ..., - max: Decimal | float | str | None = ..., - ) -> None: ... - -class RangeInput(Input): - step: Decimal | float | str | None - def __init__(self, step: Decimal | float | str | None = ...) -> None: ... - -class ColorInput(Input): ...