Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonxslays committed Dec 30, 2023
1 parent 6130093 commit 67b03fb
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions wom/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

from wom import errors
from wom.models import BaseModel
from wom.models import HttpErrorResponse

__all__ = ("Err", "Ok", "Result")

Expand Down Expand Up @@ -185,7 +184,7 @@ def to_dict(self) -> t.Dict[str, t.Any]:
elif isinstance(self._value, list):
if self._value:
if isinstance(self._value[0], BaseModel):
value = [v.to_dict() for v in self._value] # type: ignore
value = [v.to_dict() for v in self._value] # pyright: ignore
elif isinstance(self._value[0], (dict, int, str, bool)):
value = self._value
else:
Expand Down Expand Up @@ -259,19 +258,18 @@ def to_dict(self) -> t.Dict[str, t.Any]:
error = self._error
elif isinstance(self._error, Exception):
error = str(self._error)
elif isinstance(self._value, list):
if self._value:
if isinstance(self._value[0], BaseModel):
error = [e.to_dict() for e in self._value] # type: ignore
elif isinstance(self._value[0], (dict, int, str, bool)):
error = self._value
elif isinstance(self._error, list):
if self._error:
if isinstance(self._error[0], BaseModel):
error = [e.to_dict() for e in self._error] # pyright: ignore
elif isinstance(self._error[0], (dict, int, str, bool)):
error = self._error
else:
raise RuntimeError(
f"Cant convert Result(Err) to dict, please report this: {self._error}"
)
else:
error = []

else:
raise RuntimeError(
f"Cant convert Result(Err) to dict, please report this: {self._error}"
Expand Down

0 comments on commit 67b03fb

Please sign in to comment.