Skip to content

fix ruff error + pin ruff ver for now #1107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"invoke",
# lint
"black",
"ruff",
"ruff==0.0.278", # Ruff is moving really fast, so pinning for now.
"toml",
"flake8",
"flake8-pyproject",
Expand Down
12 changes: 6 additions & 6 deletions src/py/reactpy/reactpy/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ def render(self) -> VdomDict | ComponentType | str | None:
"""Render the component's view model."""


_Render = TypeVar("_Render", covariant=True)
_Event = TypeVar("_Event", contravariant=True)
_Render_co = TypeVar("_Render_co", covariant=True)
_Event_contra = TypeVar("_Event_contra", contravariant=True)


@runtime_checkable
class LayoutType(Protocol[_Render, _Event]):
class LayoutType(Protocol[_Render_co, _Event_contra]):
"""Renders and delivers, updates to views and events to handlers, respectively"""

async def render(self) -> _Render:
async def render(self) -> _Render_co:
"""Render an update to a view"""

async def deliver(self, event: _Event) -> None:
async def deliver(self, event: _Event_contra) -> None:
"""Relay an event to its respective handler"""

async def __aenter__(self) -> LayoutType[_Render, _Event]:
async def __aenter__(self) -> LayoutType[_Render_co, _Event_contra]:
"""Prepare the layout for its first render"""

async def __aexit__(
Expand Down
1 change: 0 additions & 1 deletion src/py/reactpy/reactpy/testing/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def clear_reactpy_web_modules_dir() -> None:

_P = ParamSpec("_P")
_R = TypeVar("_R")
_RC = TypeVar("_RC", covariant=True)


_DEFAULT_POLL_DELAY = 0.1
Expand Down
6 changes: 3 additions & 3 deletions src/py/reactpy/reactpy/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def sync_inputs(event: dict[str, Any]) -> None:
return inputs


_CastTo = TypeVar("_CastTo", covariant=True)
_CastTo_co = TypeVar("_CastTo_co", covariant=True)


class _CastFunc(Protocol[_CastTo]):
def __call__(self, value: str) -> _CastTo:
class _CastFunc(Protocol[_CastTo_co]):
def __call__(self, value: str) -> _CastTo_co:
...


Expand Down