Use basedpyright refactor

This commit is contained in:
marc
2025-03-22 23:06:34 +01:00
parent ac54453b7f
commit 2f7c7c2429
41 changed files with 480 additions and 381 deletions

View File

@@ -1,10 +1,9 @@
from __future__ import annotations
import dataclasses
import datetime
import enum
from abc import abstractmethod
from typing import Generic, Optional, Protocol, TypeVar
from typing import Generic, Protocol, TypeVar
class Comparable(Protocol):
@@ -30,12 +29,12 @@ T = TypeVar("T", bound=Comparable)
@dataclasses.dataclass
class Range(Generic[T]):
gt: Optional[T] = None
gte: Optional[T] = None
lt: Optional[T] = None
lte: Optional[T] = None
gt: T | None = None
gte: T | None = None
lt: T | None = None
lte: T | None = None
def lower_bound(self) -> Optional[tuple[T, bool]]:
def lower_bound(self) -> tuple[T, bool] | None:
if self.gt is None and self.gte is None:
return None
elif self.gt is not None and self.gte is not None:
@@ -47,7 +46,7 @@ class Range(Generic[T]):
elif self.gte is not None:
return self.gte, True
def upper_bound(self) -> Optional[tuple[T, bool]]:
def upper_bound(self) -> tuple[T, bool] | None:
if self.lt is None and self.lte is None:
return None
elif self.lt is not None and self.lte is not None: