Skip to content

Commit f59f4a1

Browse files
committed
refactor(models): remove many arguments in from_dict and move list serialization to from_response
1 parent 009bcad commit f59f4a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pygitguardian/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class FromDictMixin:
7171
SCHEMA: ClassVar[Schema]
7272

7373
@classmethod
74-
def from_dict(cls, dct: Dict[str, Any], many: Optional[bool] = None) -> Self:
75-
return cast(Self, cls.SCHEMA.load(dct, many=many))
74+
def from_dict(cls, dct: Dict[str, Any]) -> Self:
75+
return cast(Self, cls.SCHEMA.load(dct))
7676

7777

7878
class BaseSchema(Schema):
@@ -1174,7 +1174,7 @@ def from_response(
11741174
cls, response: "requests.Response", data_type: Type[PaginatedData]
11751175
) -> "CursorPaginatedResponse[PaginatedData]":
11761176
data = cast(
1177-
List[PaginatedData], data_type.from_dict(response.json(), many=True)
1177+
List[PaginatedData], [data_type.from_dict(obj) for obj in response.json()]
11781178
)
11791179
paginated_response = cls(status_code=response.status_code, data=data)
11801180

0 commit comments

Comments
 (0)