Skip to content

Commit

Permalink
Merge pull request #42 from david-lev/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
david-lev authored Mar 8, 2024
2 parents 70bc4f3 + 56a6bfa commit f2bbb1b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.3.0
hooks:
- id: ruff
- id: ruff-format
11 changes: 6 additions & 5 deletions pywa/filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Usefully filters to use in your handlers."""

from __future__ import annotations

__all__ = [
Expand Down Expand Up @@ -909,9 +910,9 @@ def failed_with(
)


message_status: _MessageStatusFilterT | type[
message_status: _MessageStatusFilterT | type[_MessageStatusFilters] = (
_MessageStatusFilters
] = _MessageStatusFilters
)


class _TemplateStatusFilters(_BaseUpdateFilters):
Expand Down Expand Up @@ -963,6 +964,6 @@ def on_rejection_reason(
return lambda _, s: s.reason in reasons


template_status: (
_TemplateStatusFilterT | type[_TemplateStatusFilters]
) = _TemplateStatusFilters
template_status: _TemplateStatusFilterT | type[_TemplateStatusFilters] = (
_TemplateStatusFilters
)
6 changes: 2 additions & 4 deletions pywa/types/base_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@ class BaseUserUpdate(BaseUpdate, abc.ABC):

@property
@abc.abstractmethod
def metadata(self) -> Metadata:
...
def metadata(self) -> Metadata: ...

@property
@abc.abstractmethod
def from_user(self) -> User:
...
def from_user(self) -> User: ...

@property
def sender(self) -> str:
Expand Down
10 changes: 5 additions & 5 deletions pywa/types/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,14 +591,14 @@ class FlowButton:
title: str
flow_id: str | int
flow_token: str
flow_action_type: Literal[
FlowActionType.NAVIGATE, FlowActionType.DATA_EXCHANGE
] | None = None
flow_action_type: (
Literal[FlowActionType.NAVIGATE, FlowActionType.DATA_EXCHANGE] | None
) = None
flow_action_screen: str | None = None
flow_action_payload: dict[str, Any] | None = None
flow_message_version: int | float | str | Literal[
flow_message_version: int | float | str | Literal[utils.Version.FLOW_MSG] = (
utils.Version.FLOW_MSG
] = utils.Version.FLOW_MSG
)
mode: Literal[FlowStatus.PUBLISHED, FlowStatus.DRAFT] = FlowStatus.PUBLISHED

def __post_init__(self):
Expand Down
42 changes: 19 additions & 23 deletions pywa/types/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,15 @@ class ScreenData:
"""

key: str
example: str | int | float | bool | dict | DataSource | Iterable[
str | int | float | bool | dict | DataSource
]
example: (
str
| int
| float
| bool
| dict
| DataSource
| Iterable[str | int | float | bool | dict | DataSource]
)

@property
def data_key(self) -> str:
Expand Down Expand Up @@ -999,13 +1005,11 @@ class Component(abc.ABC):

@property
@abc.abstractmethod
def type(self) -> ComponentType:
...
def type(self) -> ComponentType: ...

@property
@abc.abstractmethod
def visible(self) -> bool | str | None:
...
def visible(self) -> bool | str | None: ...


class ComponentType(utils.StrEnum):
Expand Down Expand Up @@ -1144,28 +1148,23 @@ class FormComponent(Component, abc.ABC):

@property
@abc.abstractmethod
def name(self) -> str:
...
def name(self) -> str: ...

@property
@abc.abstractmethod
def label(self) -> str | DataKey:
...
def label(self) -> str | DataKey: ...

@property
@abc.abstractmethod
def required(self) -> bool | str | DataKey | None:
...
def required(self) -> bool | str | DataKey | None: ...

@property
@abc.abstractmethod
def enabled(self) -> bool | str | DataKey | None:
...
def enabled(self) -> bool | str | DataKey | None: ...

@property
@abc.abstractmethod
def init_value(self) -> bool | str | DataKey | None:
...
def init_value(self) -> bool | str | DataKey | None: ...

@property
def form_ref(self) -> str:
Expand Down Expand Up @@ -1205,8 +1204,7 @@ class TextComponent(Component, abc.ABC):

@property
@abc.abstractmethod
def text(self) -> str | DataKey:
...
def text(self) -> str | DataKey: ...


class FontWeight(utils.StrEnum):
Expand Down Expand Up @@ -1348,13 +1346,11 @@ class TextEntryComponent(FormComponent, abc.ABC):

@property
@abc.abstractmethod
def helper_text(self) -> str | DataKey | None:
...
def helper_text(self) -> str | DataKey | None: ...

@property
@abc.abstractmethod
def error_message(self) -> str | DataKey | None:
...
def error_message(self) -> str | DataKey | None: ...


class InputType(utils.StrEnum):
Expand Down
9 changes: 3 additions & 6 deletions pywa/types/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ class BaseMedia(abc.ABC, utils.FromDict):

@property
@abc.abstractmethod
def id(self) -> str:
...
def id(self) -> str: ...

@property
@abc.abstractmethod
def sha256(self) -> str:
...
def sha256(self) -> str: ...

@property
@abc.abstractmethod
def mime_type(self) -> str:
...
def mime_type(self) -> str: ...

def get_media_url(self) -> str:
"""Gets the URL of the media. (expires after 5 minutes)"""
Expand Down
15 changes: 5 additions & 10 deletions pywa/types/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,26 +192,22 @@ class Language(utils.StrEnum):
class NewTemplateComponentABC(abc.ABC):
@property
@abc.abstractmethod
def type(self) -> ComponentType:
...
def type(self) -> ComponentType: ...


class NewTemplateHeaderABC(NewTemplateComponentABC, abc.ABC):
@property
@abc.abstractmethod
def format(self) -> HeaderFormatType:
...
def format(self) -> HeaderFormatType: ...


class NewButtonABC(abc.ABC):
@property
@abc.abstractmethod
def type(self) -> ButtonType:
...
def type(self) -> ButtonType: ...

@abc.abstractmethod
def to_dict(self, placeholder: tuple[str, str] = None) -> dict[str, str | None]:
...
def to_dict(self, placeholder: tuple[str, str] = None) -> dict[str, str | None]: ...


@dataclasses.dataclass(slots=True)
Expand Down Expand Up @@ -919,8 +915,7 @@ class ParamType(utils.StrEnum):
class ComponentABC(abc.ABC):
@property
@abc.abstractmethod
def type(self) -> ParamType:
...
def type(self) -> ParamType: ...


@dataclasses.dataclass(slots=True)
Expand Down
9 changes: 3 additions & 6 deletions pywa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,13 @@ def from_dict(cls, data: dict, **kwargs):


class FastAPI(Protocol):
def get(self, path: str) -> Callable:
...
def get(self, path: str) -> Callable: ...

def post(self, path: str) -> Callable:
...
def post(self, path: str) -> Callable: ...


class Flask(Protocol):
def route(self, rule: str, **options: Any) -> Callable:
...
def route(self, rule: str, **options: Any) -> Callable: ...


FlowRequestDecryptor: TypeAlias = (
Expand Down

0 comments on commit f2bbb1b

Please sign in to comment.