type fixes

This commit is contained in:
Will McGugan
2022-01-02 16:27:10 +00:00
parent 911d9024cc
commit d803ccdcd2
4 changed files with 7 additions and 31 deletions

14
poetry.lock generated
View File

@@ -583,14 +583,6 @@ category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "typing-extensions"
version = "3.10.0.0"
description = "Backported and Experimental Type Hints for Python 3.5+"
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "typing-extensions"
version = "3.10.0.2"
@@ -645,8 +637,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes
[metadata]
lock-version = "1.1"
python-versions = "^3.7"
content-hash = "2a8542d8f61658fe89457004c793928d3248fe4ede4ec2444b97b2188be11f60"
content-hash = "d9fa84daf9d3ae9839ebb6e846b73749c4c7737bdcf1160257e3b6ecf7086160"
[metadata.files]
astunparse = [
@@ -1003,9 +994,6 @@ typed-ast = [
{file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"},
]
typing-extensions = [
{file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"},
{file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"},
{file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"},
{file = "typing_extensions-3.10.0.2-py2-none-any.whl", hash = "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7"},
{file = "typing_extensions-3.10.0.2-py3-none-any.whl", hash = "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"},
{file = "typing_extensions-3.10.0.2.tar.gz", hash = "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e"},

View File

@@ -64,8 +64,8 @@ class SimpleAnimation(Animation):
if isinstance(self.start_value, Animatable):
assert isinstance(
self.end_value, Animatable, "end_value must be animatable"
)
self.end_value, Animatable
), "end_value must be animatable"
value = self.start_value.blend(self.end_value, eased_factor)
else:
assert isinstance(
@@ -115,7 +115,7 @@ class BoundAnimator:
class Animator:
def __init__(self, target: MessageTarget, frames_per_second: int = 60) -> None:
self._animations: dict[tuple[object, str], SimpleAnimation] = {}
self._animations: dict[tuple[object, str], Animation] = {}
self.target = target
self._timer = Timer(
target,
@@ -154,7 +154,7 @@ class Animator:
easing_function = EASING[easing] if isinstance(easing, str) else easing
animation: Animation | None = None
animation: Animation
if hasattr(obj, "__textual_animation__"):
animation = getattr(obj, "__textual_animation__")(
attribute,
@@ -164,9 +164,7 @@ class Animator:
speed=speed,
easing=easing_function,
)
if animation is None:
else:
start_value = getattr(obj, attribute)
if start_value == value:

View File

@@ -110,13 +110,3 @@ class XTermParser(Parser[events.Event]):
on_token(events.Key(self.sender, key=key))
else:
on_token(events.Key(self.sender, key=character))
if __name__ == "__main__":
parser = XTermParser()
import os
import sys
for token in parser.feed(sys.stdin.read(20)):
print(token)

View File

@@ -290,7 +290,7 @@ class Layout(ABC):
@classmethod
def _assemble_chops(
cls, chops: list[dict[int, list[Segment] | None]]
) -> Iterable[list[Segment]]:
) -> Iterable[Iterable[Segment]]:
from_iterable = chain.from_iterable
for bucket in chops: