muffin-rest 10.1.0__py3-none-any.whl → 11.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,15 +43,13 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
43
43
  async def prepare_collection(
44
44
  self: PWRESTBase[TVAIOModel],
45
45
  _: Request,
46
- ) -> AIOModelSelect[TVAIOModel]:
47
- ...
46
+ ) -> AIOModelSelect[TVAIOModel]: ...
48
47
 
49
48
  @overload
50
49
  async def prepare_collection(
51
50
  self: PWRESTBase[pw.Model],
52
51
  _: Request,
53
- ) -> pw.ModelSelect:
54
- ...
52
+ ) -> pw.ModelSelect: ...
55
53
 
56
54
  # NOTE: there is not a default sorting for peewee (conflict with muffin-admin)
57
55
  async def prepare_collection(self, _: Request):
@@ -81,14 +79,12 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
81
79
  @overload
82
80
  async def paginate(
83
81
  self: PWRESTBase[TVAIOModel], _: Request, *, limit: int = 0, offset: int = 0
84
- ) -> tuple[AIOModelSelect[TVAIOModel], int | None]:
85
- ...
82
+ ) -> tuple[AIOModelSelect[TVAIOModel], int | None]: ...
86
83
 
87
84
  @overload
88
85
  async def paginate(
89
86
  self: PWRESTBase[pw.Model], _: Request, *, limit: int = 0, offset: int = 0
90
- ) -> tuple[pw.ModelSelect, int | None]:
91
- ...
87
+ ) -> tuple[pw.ModelSelect, int | None]: ...
92
88
 
93
89
  async def paginate(self, _: Request, *, limit: int = 0, offset: int = 0):
94
90
  """Paginate the collection."""
@@ -136,9 +132,7 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
136
132
  return
137
133
 
138
134
  model_pk = cast(pw.Field, meta.model_pk)
139
- resources = await meta.manager.fetchall(
140
- self.collection.where(model_pk << data),
141
- )
135
+ resources = await meta.manager.fetchall(self.collection.where(model_pk << data)) # type: ignore[]
142
136
 
143
137
  if not resources:
144
138
  raise APIError.NOT_FOUND()
@@ -151,7 +145,9 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
151
145
  for res in resources:
152
146
  await meta.manager.delete_instance(res, recursive=meta.delete_recursive)
153
147
 
154
- async def delete(self, request: Request, resource: Optional[TVModel] = None):
148
+ return resource.get_id() if resource else [r.get_id() for r in resources]
149
+
150
+ async def delete(self, request: Request, resource: Optional[TVModel] = None): # type: ignore[override]
155
151
  return await self.remove(request, resource)
156
152
 
157
153
  def get_schema(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: muffin-rest
3
- Version: 10.1.0
3
+ Version: 11.0.0
4
4
  Summary: The package provides enhanced support for writing REST APIs with Muffin framework
5
5
  License: MIT
6
6
  Keywords: rest,api,muffin,asgi,asyncio,trio
@@ -15,7 +15,7 @@ muffin_rest/openapi.py,sha256=0QU7qrfBjGl0vl378SJC5boZZI2ogddl45fS9WL4Axw,8751
15
15
  muffin_rest/options.py,sha256=38y7AasyAghXNffxX-3xgqLbWDQ1RxAhg77ze7c0Mu0,2232
16
16
  muffin_rest/peewee/__init__.py,sha256=94DSj_ftT6fbPksHlBv40AH2HWaiZommUFOMN2jd9a4,129
17
17
  muffin_rest/peewee/filters.py,sha256=p813eJqyTkAhmS3C1P8rWFWb9Tl33OtADjgLctqKnns,2475
18
- muffin_rest/peewee/handler.py,sha256=Tk20ChTGkhzSF0K1-TFruPfXJyHfJE_fDKcQqGQeoAU,5297
18
+ muffin_rest/peewee/handler.py,sha256=otADwlTnNkook7fNo26yNKtpTV_0OBGKT2IY0QzfdSA,5361
19
19
  muffin_rest/peewee/openapi.py,sha256=lDnLnoXi33p0YeFVwRgaVrndyrG2XL93RH-BzbxinOY,1105
20
20
  muffin_rest/peewee/options.py,sha256=TimJtErC9e8B7BRiEkHiBZd71_bZbYr-FE2PIlQvfH0,1455
21
21
  muffin_rest/peewee/schemas.py,sha256=w6jBziUp40mOOjkz_4RCXuY0x5ZDIe9Ob25k1FnZSfc,469
@@ -33,7 +33,7 @@ muffin_rest/sqlalchemy/types.py,sha256=Exm-zAQCtPAwXvYcCTtPRqSa-wTEWRcH_v2YSsJkB
33
33
  muffin_rest/swagger.html,sha256=2uGLu_KpkYf925KnDKHBJmV9pm6OHn5C3BWScESsUS8,1736
34
34
  muffin_rest/types.py,sha256=m27-g6BI7qdSWGym4fWALBJa2ZpWR0_m0nlrDx7iTCo,566
35
35
  muffin_rest/utils.py,sha256=c08E4HJ4SLYC-91GKPEbsyKTZ4sZbTN4qDqJbNg_HTE,2076
36
- muffin_rest-10.1.0.dist-info/LICENSE,sha256=xHPkOZhjyKBMOwXpWn9IB_BVLjrrMxv2M9slKkHj2hM,1082
37
- muffin_rest-10.1.0.dist-info/METADATA,sha256=eZeEf9-ojFMBHyyQLX1tkRurpNj1NMufQda6B1d6I7o,4147
38
- muffin_rest-10.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
39
- muffin_rest-10.1.0.dist-info/RECORD,,
36
+ muffin_rest-11.0.0.dist-info/LICENSE,sha256=xHPkOZhjyKBMOwXpWn9IB_BVLjrrMxv2M9slKkHj2hM,1082
37
+ muffin_rest-11.0.0.dist-info/METADATA,sha256=SNFRlceJDr6y9Hghj_a8GGlHz3Bmg-uwjUkzjDMmVAo,4147
38
+ muffin_rest-11.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
39
+ muffin_rest-11.0.0.dist-info/RECORD,,