fix black lint (#1193)
This commit is contained in:
parent
3a3ad3f706
commit
21011917ac
14 changed files with 43 additions and 67 deletions
|
@ -24,9 +24,9 @@ def Grid():
|
|||
"style": {
|
||||
"height": "30px",
|
||||
"width": "30px",
|
||||
"background_color": "black"
|
||||
if index in selected_indices
|
||||
else "white",
|
||||
"background_color": (
|
||||
"black" if index in selected_indices else "white"
|
||||
),
|
||||
"outline": "1px solid grey",
|
||||
"cursor": "pointer",
|
||||
},
|
||||
|
|
|
@ -21,9 +21,9 @@ def Grid():
|
|||
"style": {
|
||||
"height": "30px",
|
||||
"width": "30px",
|
||||
"background_color": "black"
|
||||
if index in selected_indices
|
||||
else "white",
|
||||
"background_color": (
|
||||
"black" if index in selected_indices else "white"
|
||||
),
|
||||
"outline": "1px solid grey",
|
||||
"cursor": "pointer",
|
||||
},
|
||||
|
|
|
@ -12,10 +12,10 @@ detached = true
|
|||
dependencies = [
|
||||
"invoke",
|
||||
# lint
|
||||
"black",
|
||||
"ruff==0.0.278", # Ruff is moving really fast, so pinning for now.
|
||||
"black==24.1.1", # Pin lint tools we don't control to avoid breaking changes
|
||||
"ruff==0.0.278", # Pin lint tools we don't control to avoid breaking changes
|
||||
"toml",
|
||||
"flake8",
|
||||
"flake8==7.0.0", # Pin lint tools we don't control to avoid breaking changes
|
||||
"flake8-pyproject",
|
||||
"reactpy-flake8 >=0.7",
|
||||
# types
|
||||
|
|
|
@ -13,8 +13,7 @@ T = TypeVar("T")
|
|||
|
||||
|
||||
class EffectFunc(Protocol):
|
||||
async def __call__(self, stop: Event) -> None:
|
||||
...
|
||||
async def __call__(self, stop: Event) -> None: ...
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -15,8 +15,7 @@ def event(
|
|||
*,
|
||||
stop_propagation: bool = ...,
|
||||
prevent_default: bool = ...,
|
||||
) -> EventHandler:
|
||||
...
|
||||
) -> EventHandler: ...
|
||||
|
||||
|
||||
@overload
|
||||
|
@ -25,8 +24,7 @@ def event(
|
|||
*,
|
||||
stop_propagation: bool = ...,
|
||||
prevent_default: bool = ...,
|
||||
) -> Callable[[Callable[..., Any]], EventHandler]:
|
||||
...
|
||||
) -> Callable[[Callable[..., Any]], EventHandler]: ...
|
||||
|
||||
|
||||
def event(
|
||||
|
|
|
@ -42,13 +42,11 @@ _Type = TypeVar("_Type")
|
|||
|
||||
|
||||
@overload
|
||||
def use_state(initial_value: Callable[[], _Type]) -> State[_Type]:
|
||||
...
|
||||
def use_state(initial_value: Callable[[], _Type]) -> State[_Type]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def use_state(initial_value: _Type) -> State[_Type]:
|
||||
...
|
||||
def use_state(initial_value: _Type) -> State[_Type]: ...
|
||||
|
||||
|
||||
def use_state(initial_value: _Type | Callable[[], _Type]) -> State[_Type]:
|
||||
|
@ -105,16 +103,14 @@ _EffectApplyFunc: TypeAlias = "_SyncEffectFunc | _AsyncEffectFunc"
|
|||
def use_effect(
|
||||
function: None = None,
|
||||
dependencies: Sequence[Any] | ellipsis | None = ...,
|
||||
) -> Callable[[_EffectApplyFunc], None]:
|
||||
...
|
||||
) -> Callable[[_EffectApplyFunc], None]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def use_effect(
|
||||
function: _EffectApplyFunc,
|
||||
dependencies: Sequence[Any] | ellipsis | None = ...,
|
||||
) -> None:
|
||||
...
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def use_effect(
|
||||
|
@ -313,16 +309,14 @@ _CallbackFunc = TypeVar("_CallbackFunc", bound=Callable[..., Any])
|
|||
def use_callback(
|
||||
function: None = None,
|
||||
dependencies: Sequence[Any] | ellipsis | None = ...,
|
||||
) -> Callable[[_CallbackFunc], _CallbackFunc]:
|
||||
...
|
||||
) -> Callable[[_CallbackFunc], _CallbackFunc]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def use_callback(
|
||||
function: _CallbackFunc,
|
||||
dependencies: Sequence[Any] | ellipsis | None = ...,
|
||||
) -> _CallbackFunc:
|
||||
...
|
||||
) -> _CallbackFunc: ...
|
||||
|
||||
|
||||
def use_callback(
|
||||
|
@ -358,24 +352,21 @@ def use_callback(
|
|||
class _LambdaCaller(Protocol):
|
||||
"""MyPy doesn't know how to deal with TypeVars only used in function return"""
|
||||
|
||||
def __call__(self, func: Callable[[], _Type]) -> _Type:
|
||||
...
|
||||
def __call__(self, func: Callable[[], _Type]) -> _Type: ...
|
||||
|
||||
|
||||
@overload
|
||||
def use_memo(
|
||||
function: None = None,
|
||||
dependencies: Sequence[Any] | ellipsis | None = ...,
|
||||
) -> _LambdaCaller:
|
||||
...
|
||||
) -> _LambdaCaller: ...
|
||||
|
||||
|
||||
@overload
|
||||
def use_memo(
|
||||
function: Callable[[], _Type],
|
||||
dependencies: Sequence[Any] | ellipsis | None = ...,
|
||||
) -> _Type:
|
||||
...
|
||||
) -> _Type: ...
|
||||
|
||||
|
||||
def use_memo(
|
||||
|
|
|
@ -159,8 +159,7 @@ EventHandlerDict: TypeAlias = "dict[str, EventHandlerType]"
|
|||
class EventHandlerFunc(Protocol):
|
||||
"""A coroutine which can handle event data"""
|
||||
|
||||
async def __call__(self, data: Sequence[Any]) -> None:
|
||||
...
|
||||
async def __call__(self, data: Sequence[Any]) -> None: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
|
@ -192,18 +191,17 @@ class VdomDictConstructor(Protocol):
|
|||
"""Standard function for constructing a :class:`VdomDict`"""
|
||||
|
||||
@overload
|
||||
def __call__(self, attributes: VdomAttributes, *children: VdomChildren) -> VdomDict:
|
||||
...
|
||||
def __call__(
|
||||
self, attributes: VdomAttributes, *children: VdomChildren
|
||||
) -> VdomDict: ...
|
||||
|
||||
@overload
|
||||
def __call__(self, *children: VdomChildren) -> VdomDict:
|
||||
...
|
||||
def __call__(self, *children: VdomChildren) -> VdomDict: ...
|
||||
|
||||
@overload
|
||||
def __call__(
|
||||
self, *attributes_and_children: VdomAttributes | VdomChildren
|
||||
) -> VdomDict:
|
||||
...
|
||||
) -> VdomDict: ...
|
||||
|
||||
|
||||
class LayoutUpdateMessage(TypedDict):
|
||||
|
@ -236,8 +234,7 @@ class Context(Protocol[_Type]):
|
|||
*children: Any,
|
||||
value: _Type = ...,
|
||||
key: Key | None = ...,
|
||||
) -> ContextProviderType[_Type]:
|
||||
...
|
||||
) -> ContextProviderType[_Type]: ...
|
||||
|
||||
|
||||
class ContextProviderType(ComponentType, Protocol[_Type]):
|
||||
|
|
|
@ -125,13 +125,11 @@ def is_vdom(value: Any) -> bool:
|
|||
|
||||
|
||||
@overload
|
||||
def vdom(tag: str, *children: VdomChildren) -> VdomDict:
|
||||
...
|
||||
def vdom(tag: str, *children: VdomChildren) -> VdomDict: ...
|
||||
|
||||
|
||||
@overload
|
||||
def vdom(tag: str, attributes: VdomAttributes, *children: VdomChildren) -> VdomDict:
|
||||
...
|
||||
def vdom(tag: str, attributes: VdomAttributes, *children: VdomChildren) -> VdomDict: ...
|
||||
|
||||
|
||||
def vdom(
|
||||
|
@ -345,8 +343,7 @@ class _CustomVdomDictConstructor(Protocol):
|
|||
children: Sequence[VdomChild],
|
||||
key: Key | None,
|
||||
event_handlers: EventHandlerDict,
|
||||
) -> VdomDict:
|
||||
...
|
||||
) -> VdomDict: ...
|
||||
|
||||
|
||||
class _EllipsisRepr:
|
||||
|
|
|
@ -314,8 +314,7 @@ def export(
|
|||
export_names: str,
|
||||
fallback: Any | None = ...,
|
||||
allow_children: bool = ...,
|
||||
) -> VdomDictConstructor:
|
||||
...
|
||||
) -> VdomDictConstructor: ...
|
||||
|
||||
|
||||
@overload
|
||||
|
@ -324,8 +323,7 @@ def export(
|
|||
export_names: list[str] | tuple[str, ...],
|
||||
fallback: Any | None = ...,
|
||||
allow_children: bool = ...,
|
||||
) -> list[VdomDictConstructor]:
|
||||
...
|
||||
) -> list[VdomDictConstructor]: ...
|
||||
|
||||
|
||||
def export(
|
||||
|
|
|
@ -82,8 +82,7 @@ _CastTo_co = TypeVar("_CastTo_co", covariant=True)
|
|||
|
||||
|
||||
class _CastFunc(Protocol[_CastTo_co]):
|
||||
def __call__(self, value: str) -> _CastTo_co:
|
||||
...
|
||||
def __call__(self, value: str) -> _CastTo_co: ...
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
|
@ -106,9 +106,9 @@ def test_rewrite_camel_case_props_declarations_no_files():
|
|||
None,
|
||||
),
|
||||
],
|
||||
ids=lambda item: " ".join(map(str.strip, item.split()))
|
||||
if isinstance(item, str)
|
||||
else item,
|
||||
ids=lambda item: (
|
||||
" ".join(map(str.strip, item.split())) if isinstance(item, str) else item
|
||||
),
|
||||
)
|
||||
def test_generate_rewrite(source, expected):
|
||||
actual = generate_rewrite(Path("test.py"), dedent(source).strip())
|
||||
|
|
|
@ -225,9 +225,9 @@ def test_rewrite_key_declarations_no_files():
|
|||
None,
|
||||
),
|
||||
],
|
||||
ids=lambda item: " ".join(map(str.strip, item.split()))
|
||||
if isinstance(item, str)
|
||||
else item,
|
||||
ids=lambda item: (
|
||||
" ".join(map(str.strip, item.split())) if isinstance(item, str) else item
|
||||
),
|
||||
)
|
||||
def test_generate_rewrite(source, expected):
|
||||
actual = generate_rewrite(Path("test.py"), dedent(source).strip())
|
||||
|
|
|
@ -48,8 +48,7 @@ def no_logged_errors():
|
|||
|
||||
def test_layout_repr():
|
||||
@reactpy.component
|
||||
def MyComponent():
|
||||
...
|
||||
def MyComponent(): ...
|
||||
|
||||
my_component = MyComponent()
|
||||
layout = reactpy.Layout(my_component)
|
||||
|
@ -65,8 +64,7 @@ def test_layout_expects_abstract_component():
|
|||
|
||||
async def test_layout_cannot_be_used_outside_context_manager(caplog):
|
||||
@reactpy.component
|
||||
def Component():
|
||||
...
|
||||
def Component(): ...
|
||||
|
||||
component = Component()
|
||||
layout = reactpy.Layout(component)
|
||||
|
|
3
tasks.py
3
tasks.py
|
@ -28,8 +28,7 @@ if TYPE_CHECKING:
|
|||
class ReleasePrepFunc(Protocol):
|
||||
def __call__(
|
||||
self, context: Context, package: PackageInfo
|
||||
) -> Callable[[bool], None]:
|
||||
...
|
||||
) -> Callable[[bool], None]: ...
|
||||
|
||||
LanguageName: TypeAlias = "Literal['py', 'js']"
|
||||
|
||||
|
|
Loading…
Reference in a new issue