Skip to content

Commit

Permalink
chore: pydantic 2
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixAbrahamsson committed Feb 21, 2024
1 parent 70d1cbd commit 5361ba5
Show file tree
Hide file tree
Showing 4 changed files with 1,261 additions and 1,002 deletions.
7 changes: 2 additions & 5 deletions fast_s3/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ class Status(str, Enum):
error = "error"


class File(BaseModel):
class File(BaseModel, arbitrary_types_allowed=True):
buffer: io.BytesIO
future: TransferFuture
path: Union[str, Path]
status: Status = Status.pending
exception: Optional[Exception] = None

class Config:
arbitrary_types_allowed = True

def with_status(self, status: Status, exception: Optional[Exception] = None):
attributes = self.dict()
attributes = dict(self)
attributes.update(status=status, exception=exception)
return File(**attributes)
5 changes: 1 addition & 4 deletions fast_s3/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ class Status(str, Enum):
error = "error"


class Result(BaseModel):
class Result(BaseModel, arbitrary_types_allowed=True):
status: Status
exception: Optional[Exception] = None

class Config:
arbitrary_types_allowed = True


class Uploader:
def __init__(
Expand Down
Loading

0 comments on commit 5361ba5

Please sign in to comment.