Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 15, 2024
1 parent 1cbbfdf commit 6ccff0c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 42 deletions.
68 changes: 28 additions & 40 deletions rustshed/option_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def __class_getitem__(cls, item: Any) -> type[ResultShortcutError[E_co]]:
return cls


class OptionShortcutError(Exception):
...
class OptionShortcutError(Exception): ...


class _BaseOption(ABC, Generic[T_co]):
Expand Down Expand Up @@ -342,16 +341,13 @@ def xor(self, optb: Option[T_co]) -> Option[T_co]:
return self if optb.is_null() else Null

@overload
def zip(self, other: NullType) -> NullType:
... # pragma: no cover
def zip(self, other: NullType) -> NullType: ... # pragma: no cover

@overload
def zip(self, other: Some[U]) -> Some[tuple[T_co, U]]:
... # pragma: no cover
def zip(self, other: Some[U]) -> Some[tuple[T_co, U]]: ... # pragma: no cover

@overload
def zip(self, other: Option[U]) -> Option[tuple[T_co, U]]:
... # pragma: no cover
def zip(self, other: Option[U]) -> Option[tuple[T_co, U]]: ... # pragma: no cover

def zip(self, other: Option[U]) -> Option[tuple[T_co, U]]:
match other:
Expand All @@ -361,16 +357,19 @@ def zip(self, other: Option[U]) -> Option[tuple[T_co, U]]:
return Null

@overload
def zip_with(self, other: NullType, f: Callable[[T_co, Any], Any]) -> NullType:
... # pragma: no cover
def zip_with(
self, other: NullType, f: Callable[[T_co, Any], Any]
) -> NullType: ... # pragma: no cover

@overload
def zip_with(self, other: Some[U], f: Callable[[T_co, U], R]) -> Some[R]:
... # pragma: no cover
def zip_with(
self, other: Some[U], f: Callable[[T_co, U], R]
) -> Some[R]: ... # pragma: no cover

@overload
def zip_with(self, other: Option[U], f: Callable[[T_co, U], R]) -> Option[R]:
... # pragma: no cover
def zip_with(
self, other: Option[U], f: Callable[[T_co, U], R]
) -> Option[R]: ... # pragma: no cover

def zip_with(self, other: Option[U], f: Callable[[T_co, U], R]) -> Option[R]:
match other:
Expand All @@ -387,16 +386,15 @@ def unzip(self: _BaseOption[tuple[U, R]]) -> tuple[Option[U], Option[R]]:
return Null, Null

@overload
def transpose(self: Some[Ok[T]]) -> Ok[Some[T]]:
... # pragma: no cover
def transpose(self: Some[Ok[T]]) -> Ok[Some[T]]: ... # pragma: no cover

@overload
def transpose(self: Some[Err[E]]) -> Err[E]:
... # pragma: no cover
def transpose(self: Some[Err[E]]) -> Err[E]: ... # pragma: no cover

@overload
def transpose(self: Option[Result[T, E]]) -> Result[Option[T], E]:
... # pragma: no cover
def transpose(
self: Option[Result[T, E]]
) -> Result[Option[T], E]: ... # pragma: no cover

def transpose(self: Option[Result[T, E]]) -> Result[Option[T], E]:
match self:
Expand All @@ -409,16 +407,13 @@ def transpose(self: Option[Result[T, E]]) -> Result[Option[T], E]:
raise RuntimeError

@overload
def flatten(self: Some[NullType]) -> NullType:
... # pragma: no cover
def flatten(self: Some[NullType]) -> NullType: ... # pragma: no cover

@overload
def flatten(self: Some[Some[U]]) -> Some[U]:
... # pragma: no cover
def flatten(self: Some[Some[U]]) -> Some[U]: ... # pragma: no cover

@overload
def flatten(self: Some[Option[U]]) -> Option[U]:
... # pragma: no cover
def flatten(self: Some[Option[U]]) -> Option[U]: ... # pragma: no cover

def flatten(self: Some[NullType | Some[U]]) -> NullType | Some[U]:
match self:
Expand Down Expand Up @@ -495,16 +490,13 @@ def or_else(self, f: Callable[[], Option[T_co]]) -> Option[T_co]:
return f()

@overload
def xor(self, optb: NullType) -> NullType:
... # pragma: no cover
def xor(self, optb: NullType) -> NullType: ... # pragma: no cover

@overload
def xor(self, optb: Some[T_co]) -> Some[T_co]:
... # pragma: no cover
def xor(self, optb: Some[T_co]) -> Some[T_co]: ... # pragma: no cover

@overload
def xor(self, optb: Option[T_co]) -> Option[T_co]:
... # pragma: no cover
def xor(self, optb: Option[T_co]) -> Option[T_co]: ... # pragma: no cover

def xor(self, optb: Option[T_co]) -> Option[T_co]:
return self if optb.is_null() else optb
Expand Down Expand Up @@ -754,8 +746,7 @@ def transpose(self: _BaseResult[_BaseOption[T], E]) -> Option[Result[T, E]]:

@property
@abstractmethod
def Q(self) -> T_co:
... # pragma: no cover
def Q(self) -> T_co: ... # pragma: no cover


@dataclass(frozen=True, slots=True)
Expand Down Expand Up @@ -836,16 +827,13 @@ def contains_err(self, f: Any) -> bool:
return False

@overload
def transpose(self: Ok[Some[T]]) -> Some[Ok[T]]:
... # pragma: no cover
def transpose(self: Ok[Some[T]]) -> Some[Ok[T]]: ... # pragma: no cover

@overload
def transpose(self: Ok[NullType]) -> NullType:
... # pragma: no cover
def transpose(self: Ok[NullType]) -> NullType: ... # pragma: no cover

@overload
def transpose(self: Ok[Option[T]]) -> Option[Ok[T]]:
... # pragma: no cover
def transpose(self: Ok[Option[T]]) -> Option[Ok[T]]: ... # pragma: no cover

def transpose(self: Ok[Option[T]]) -> Option[Ok[T]]:
match self:
Expand Down
3 changes: 1 addition & 2 deletions rustshed/panic.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
class Panic(RuntimeError):
... # pragma: no cover
class Panic(RuntimeError): ... # pragma: no cover

0 comments on commit 6ccff0c

Please sign in to comment.