fix ruff error + pin ruff ver for now (#1107)

This commit is contained in:
Ryan Morshead 2023-07-15 12:32:24 -06:00 committed by GitHub
parent ff60ae7046
commit 778057d7ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 11 deletions

View file

@ -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",

View file

@ -62,21 +62,21 @@ class ComponentType(Protocol):
"""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__(

View file

@ -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

View file

@ -78,11 +78,11 @@ def use_linked_inputs(
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:
...