Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#769)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 23.12.1 → 24.1.1](psf/black@23.12.1...24.1.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 29, 2024
1 parent 531bdee commit b1c2893
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repos:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/psf/black
rev: "23.12.1"
rev: "24.1.1"
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
3 changes: 1 addition & 2 deletions vehicle-python/src/vehicle_lang/ast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,7 @@ def __init__(self) -> None:
raise TypeError("Cannot instantiate abstract class Declaration")

@abstractmethod
def get_name(self) -> Name:
...
def get_name(self) -> Name: ...


@dataclass(frozen=True)
Expand Down
3 changes: 1 addition & 2 deletions vehicle-python/src/vehicle_lang/ast/_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def decode(
cls_origin: Any,
cls_args: Tuple[Any, ...],
value: JsonValue,
) -> _T:
...
) -> _T: ...


class TaggedObjectDecoder(Decoder[_T]):
Expand Down
3 changes: 1 addition & 2 deletions vehicle-python/src/vehicle_lang/compile/_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class SupportsList(Iterable[_T_co], Protocol[_T_co]):

@runtime_checkable
class Subscriptable(Protocol[_T_co]):
def __getitem__(self, index: int) -> _T_co:
...
def __getitem__(self, index: int) -> _T_co: ...


@runtime_checkable
Expand Down
45 changes: 15 additions & 30 deletions vehicle-python/src/vehicle_lang/compile/_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,43 @@

@runtime_checkable
class SupportsDunderLT(Protocol):
def __lt__(self, other: Self) -> bool:
...
def __lt__(self, other: Self) -> bool: ...


@runtime_checkable
class SupportsDunderGT(Protocol):
def __gt__(self, other: Self) -> bool:
...
def __gt__(self, other: Self) -> bool: ...


@runtime_checkable
class SupportsDunderLE(Protocol):
def __le__(self, other: Self) -> bool:
...
def __le__(self, other: Self) -> bool: ...


@runtime_checkable
class SupportsDunderGE(Protocol):
def __ge__(self, other: Self) -> bool:
...
def __ge__(self, other: Self) -> bool: ...


@runtime_checkable
class SupportsRichComparison(
SupportsDunderLT, SupportsDunderGT, SupportsDunderLE, SupportsDunderGE, Protocol
):
...
): ...


@runtime_checkable
class SupportsAbs(Protocol):
def __abs__(self: Self) -> Self:
...
def __abs__(self: Self) -> Self: ...


@runtime_checkable
class SupportsAdd(Protocol):
def __add__(self: Self, other: Self) -> Self:
...
def __add__(self: Self, other: Self) -> Self: ...


@runtime_checkable
class SupportsMul(Protocol):
def __mul__(self: Self, other: Self) -> Self:
...
def __mul__(self: Self, other: Self) -> Self: ...


@runtime_checkable
Expand All @@ -58,20 +50,17 @@ class SupportsNat(
SupportsMul,
Protocol,
):
def __int__(self: Self) -> int:
...
def __int__(self: Self) -> int: ...


@runtime_checkable
class SupportsNeg(Protocol):
def __neg__(self: Self) -> Self:
...
def __neg__(self: Self) -> Self: ...


@runtime_checkable
class SupportsSub(Protocol):
def __sub__(self: Self, other: Self) -> Self:
...
def __sub__(self: Self, other: Self) -> Self: ...


@runtime_checkable
Expand All @@ -80,20 +69,17 @@ class SupportsInt(
SupportsNeg,
SupportsSub,
Protocol,
):
...
): ...


@runtime_checkable
class SupportsDiv(Protocol):
def __truediv__(self: Self, other: Self) -> Self:
...
def __truediv__(self: Self, other: Self) -> Self: ...


@runtime_checkable
class SupportsPow2(Protocol):
def __pow__(self: Self, other: int) -> Self:
...
def __pow__(self: Self, other: int) -> Self: ...


@runtime_checkable
Expand All @@ -103,5 +89,4 @@ class SupportsRat(
SupportsPow2,
Protocol,
):
def __float__(self: Self) -> float:
...
def __float__(self: Self) -> float: ...
66 changes: 22 additions & 44 deletions vehicle-python/src/vehicle_lang/compile/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def And(self, x: bool, y: bool) -> bool:
return x and y

@abstractmethod
def AtVector(self, vector: SupportsVector[_T], index: int) -> _T:
...
def AtVector(self, vector: SupportsVector[_T], index: int) -> _T: ...

def Bool(self, value: bool) -> bool:
assert isinstance(value, bool), f"Expected bool, found {value}"
Expand Down Expand Up @@ -108,8 +107,7 @@ def FoldList(
@abstractmethod
def FoldVector(
self, function: Callable[[_S, _T], _T], initial: _T, vector: SupportsVector[_S]
) -> _T:
...
) -> _T: ...

def Forall(
self, name: str, context: Dict[str, Any], predicate: Callable[[_T], bool]
Expand Down Expand Up @@ -171,8 +169,7 @@ def Indices(self, upto: int) -> SupportsVector[int]:
return self.Vector(*range(0, upto))

@abstractmethod
def Int(self, value: SupportsInt) -> _SupportsInt:
...
def Int(self, value: SupportsInt) -> _SupportsInt: ...

def LeIndex(self, x: int, y: int) -> bool:
assert isinstance(x, int), f"Expected int, found {x}"
Expand Down Expand Up @@ -224,8 +221,7 @@ def MapList(
@abstractmethod
def MapVector(
self, function: Callable[[_S], _T], vector: SupportsVector[_S]
) -> SupportsVector[_T]:
...
) -> SupportsVector[_T]: ...

def MaxRat(self, x: _SupportsRat, y: _SupportsRat) -> _SupportsRat:
assert isinstance(x, _numeric.SupportsRat), f"Expected Rat, found {x}"
Expand Down Expand Up @@ -253,8 +249,7 @@ def MulRat(self, x: _SupportsRat, y: _SupportsRat) -> _SupportsRat:
return x * y

@abstractmethod
def Nat(self, value: SupportsInt) -> _SupportsNat:
...
def Nat(self, value: SupportsInt) -> _SupportsNat: ...

def NeIndex(self, x: int, y: int) -> bool:
return self.Not(self.EqIndex(x, y))
Expand Down Expand Up @@ -307,8 +302,7 @@ def PowRat(self, x: _SupportsRat, y: _SupportsInt) -> _SupportsRat:
return x ** y.__int__()

@abstractmethod
def Rat(self, value: SupportsFloat) -> _SupportsRat:
...
def Rat(self, value: SupportsFloat) -> _SupportsRat: ...

def SubInt(self, x: _SupportsInt, y: _SupportsInt) -> _SupportsInt:
assert isinstance(x, _numeric.SupportsInt), f"Expected Int, found {x}"
Expand All @@ -324,17 +318,15 @@ def Unit(self) -> Tuple[()]:
return ()

@abstractmethod
def Vector(self, *values: _T) -> SupportsVector[_T]:
...
def Vector(self, *values: _T) -> SupportsVector[_T]: ...

@abstractmethod
def ZipWithVector(
self,
function: Callable[[_S, _T], _U],
vector1: SupportsVector[_S],
vector2: SupportsVector[_T],
) -> SupportsVector[_U]:
...
) -> SupportsVector[_U]: ...


AnyBuiltins: TypeAlias = ABCBuiltins[Any, Any, Any]
Expand All @@ -351,16 +343,13 @@ def ZipWithVector(

class Translation(Generic[_Program, _Declaration, _Expression], metaclass=ABCMeta):
@abstractmethod
def translate_program(self, program: vcl.Program) -> _Program:
...
def translate_program(self, program: vcl.Program) -> _Program: ...

@abstractmethod
def translate_declaration(self, declaration: vcl.Declaration) -> _Declaration:
...
def translate_declaration(self, declaration: vcl.Declaration) -> _Declaration: ...

@abstractmethod
def translate_expression(self, expression: vcl.Expression) -> _Expression:
...
def translate_expression(self, expression: vcl.Expression) -> _Expression: ...


class ABCTranslation(Translation[_Program, _Declaration, _Expression]):
Expand All @@ -371,8 +360,7 @@ def translate_program(self, program: vcl.Program) -> _Program:
raise NotImplementedError(type(program).__name__)

@abstractmethod
def translate_Main(self, program: vcl.Main) -> _Program:
...
def translate_Main(self, program: vcl.Main) -> _Program: ...

@override
def translate_declaration(self, declaration: vcl.Declaration) -> _Declaration:
Expand All @@ -383,12 +371,10 @@ def translate_declaration(self, declaration: vcl.Declaration) -> _Declaration:
raise NotImplementedError(type(declaration).__name__)

@abstractmethod
def translate_DefFunction(self, declaration: vcl.DefFunction) -> _Declaration:
...
def translate_DefFunction(self, declaration: vcl.DefFunction) -> _Declaration: ...

@abstractmethod
def translate_DefPostulate(self, declaration: vcl.DefPostulate) -> _Declaration:
...
def translate_DefPostulate(self, declaration: vcl.DefPostulate) -> _Declaration: ...

@override
def translate_expression(self, expression: vcl.Expression) -> _Expression:
Expand All @@ -413,24 +399,19 @@ def translate_expression(self, expression: vcl.Expression) -> _Expression:
raise NotImplementedError(type(expression).__name__)

@abstractmethod
def translate_App(self, expression: vcl.App) -> _Expression:
...
def translate_App(self, expression: vcl.App) -> _Expression: ...

@abstractmethod
def translate_BoundVar(self, expression: vcl.BoundVar) -> _Expression:
...
def translate_BoundVar(self, expression: vcl.BoundVar) -> _Expression: ...

@abstractmethod
def translate_Builtin(self, expression: vcl.Builtin) -> _Expression:
...
def translate_Builtin(self, expression: vcl.Builtin) -> _Expression: ...

@abstractmethod
def translate_FreeVar(self, expression: vcl.FreeVar) -> _Expression:
...
def translate_FreeVar(self, expression: vcl.FreeVar) -> _Expression: ...

@abstractmethod
def translate_Lam(self, expression: vcl.Lam) -> _Expression:
...
def translate_Lam(self, expression: vcl.Lam) -> _Expression: ...

def translate_Let(self, expression: vcl.Let) -> _Expression:
return self.translate_expression(
Expand All @@ -446,13 +427,10 @@ def translate_Let(self, expression: vcl.Let) -> _Expression:
)

@abstractmethod
def translate_PartialApp(self, expression: vcl.PartialApp) -> _Expression:
...
def translate_PartialApp(self, expression: vcl.PartialApp) -> _Expression: ...

@abstractmethod
def translate_Pi(self, expression: vcl.Pi) -> _Expression:
...
def translate_Pi(self, expression: vcl.Pi) -> _Expression: ...

@abstractmethod
def translate_Universe(self, expression: vcl.Universe) -> _Expression:
...
def translate_Universe(self, expression: vcl.Universe) -> _Expression: ...
3 changes: 1 addition & 2 deletions vehicle-python/src/vehicle_lang/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class Target(Protocol):
"""

@property
def _vehicle_option_name(self) -> str:
...
def _vehicle_option_name(self) -> str: ...


class Explicit(Enum):
Expand Down

0 comments on commit b1c2893

Please sign in to comment.