muffin-rest 12.0.1__py3-none-any.whl → 12.0.3__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.
@@ -52,12 +52,12 @@ class MongoRESTHandler(RESTHandler[TVResource]):
52
52
  meta: MongoRESTOptions
53
53
  meta_class: type[MongoRESTOptions] = MongoRESTOptions
54
54
 
55
- async def prepare_collection(self, _: Request) -> MongoChain:
55
+ async def prepare_collection(self, request: Request) -> MongoChain:
56
56
  """Initialize Peeewee QuerySet for a binded to the resource model."""
57
57
  return MongoChain(self.meta.collection)
58
58
 
59
59
  async def paginate(
60
- self, _: Request, *, limit: int = 0, offset: int = 0
60
+ self, request: Request, *, limit: int = 0, offset: int = 0
61
61
  ) -> tuple[motor.AsyncIOMotorCursor, int | None]:
62
62
  """Paginate collection."""
63
63
  if self.meta.aggregate:
@@ -103,7 +103,7 @@ class MongoRESTHandler(RESTHandler[TVResource]):
103
103
  """Initialize marshmallow schema for serialization/deserialization."""
104
104
  return super().get_schema(request, instance=resource, **schema_options)
105
105
 
106
- async def save(self, _: Request, resource: TVResource, *, update=False) -> TVResource:
106
+ async def save(self, request: Request, resource: TVResource, *, update=False) -> TVResource:
107
107
  """Save the given resource."""
108
108
  meta = self.meta
109
109
  collection_id = meta.collection_id
muffin_rest/options.py CHANGED
@@ -12,7 +12,6 @@ class RESTOptions:
12
12
  """Handler Options."""
13
13
 
14
14
  name: str = ""
15
- pk: str = "id"
16
15
  base_property: str = "name"
17
16
 
18
17
  # Pagination
@@ -42,17 +42,17 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
42
42
  @overload
43
43
  async def prepare_collection(
44
44
  self: PWRESTBase[TVAIOModel],
45
- _: Request,
45
+ request: Request,
46
46
  ) -> AIOModelSelect[TVAIOModel]: ...
47
47
 
48
48
  @overload
49
49
  async def prepare_collection(
50
50
  self: PWRESTBase[pw.Model],
51
- _: Request,
51
+ request: Request,
52
52
  ) -> pw.ModelSelect: ...
53
53
 
54
54
  # NOTE: there is not a default sorting for peewee (conflict with muffin-admin)
55
- async def prepare_collection(self, _: Request): # type: ignore[override]
55
+ async def prepare_collection(self, request: Request):
56
56
  """Initialize Peeewee QuerySet for a binded to the resource model."""
57
57
  return self.meta.model.select()
58
58
 
@@ -78,15 +78,15 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
78
78
 
79
79
  @overload
80
80
  async def paginate(
81
- self: PWRESTBase[TVAIOModel], _: Request, *, limit: int = 0, offset: int = 0
81
+ self: PWRESTBase[TVAIOModel], request: Request, *, limit: int = 0, offset: int = 0
82
82
  ) -> tuple[AIOModelSelect[TVAIOModel], int | None]: ...
83
83
 
84
84
  @overload
85
85
  async def paginate(
86
- self: PWRESTBase[pw.Model], _: Request, *, limit: int = 0, offset: int = 0
86
+ self: PWRESTBase[pw.Model], request: Request, *, limit: int = 0, offset: int = 0
87
87
  ) -> tuple[pw.ModelSelect, int | None]: ...
88
88
 
89
- async def paginate(self, _: Request, *, limit: int = 0, offset: int = 0): # type: ignore[override]
89
+ async def paginate(self, request: Request, *, limit: int = 0, offset: int = 0):
90
90
  """Paginate the collection."""
91
91
  if self.meta.limit_total:
92
92
  cqs = cast("pw.ModelSelect", self.collection.order_by())
@@ -100,7 +100,7 @@ class SARESTOptions(RESTOptions):
100
100
  "unknown": self.schema_unknown,
101
101
  "table": self.table,
102
102
  "include_fk": True,
103
- "dump_only": (self.pk,),
103
+ "dump_only": (self.table_pk.name,),
104
104
  },
105
105
  **self.schema_meta,
106
106
  ),
@@ -114,13 +114,13 @@ class SARESTHandler(RESTHandler[TVResource]):
114
114
  meta_class: type[SARESTOptions] = SARESTOptions
115
115
  collection: sa.sql.Select
116
116
 
117
- async def prepare_collection(self, _: Request) -> sa.sql.Select:
117
+ async def prepare_collection(self, request: Request) -> sa.sql.Select:
118
118
  """Initialize Peeewee QuerySet for a binded to the resource model."""
119
119
  return self.meta.table.select()
120
120
 
121
121
  async def paginate(
122
122
  self,
123
- _: Request,
123
+ request: Request,
124
124
  *,
125
125
  limit: int = 0,
126
126
  offset: int = 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: muffin-rest
3
- Version: 12.0.1
3
+ Version: 12.0.3
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
@@ -5,17 +5,17 @@ muffin_rest/filters.py,sha256=nWlwDLuId-mmP3tgZjp1joYCVx0k9ekV42fPIMMKphM,5920
5
5
  muffin_rest/handler.py,sha256=qpG4ioIagdYqGFOrlT7pBx-0czgS2ZI3AvqKXz9EzcA,10762
6
6
  muffin_rest/limits.py,sha256=Fnlu4Wj3B-BzpahLK-rDbd1GEd7CEQ3zxyOD0vee7GE,2007
7
7
  muffin_rest/marshmallow.py,sha256=-MyMKiaMTfiWw4y-4adpfoQd05HV1vEKqSXJh8eD3xg,548
8
- muffin_rest/mongo/__init__.py,sha256=oPfTF_cG4LD1TDm-RoyxhSS1pVDXConCKQf9rz2QlZM,4644
8
+ muffin_rest/mongo/__init__.py,sha256=xKwIJtDhQFZBmLUWZrZox9ootK3S4UVy0EZ14oF0L20,4662
9
9
  muffin_rest/mongo/filters.py,sha256=yIxIDVqMn6SoDgVhCqiTxYetw0hoaf_3jIvX2Vnizok,964
10
10
  muffin_rest/mongo/schema.py,sha256=y4OEPQnlV_COTIIQ3cKmpqDpD2r18eAWn0rijQldWm0,1205
11
11
  muffin_rest/mongo/sorting.py,sha256=iJBnaFwE7g_JMwpGpQkoqSqbQK9XULx1K3skiRRgLgY,870
12
12
  muffin_rest/mongo/types.py,sha256=jaODScgwwYbzHis3DY4bPzU1ahiMJMSwquH5_Thi-Gg,200
13
13
  muffin_rest/mongo/utils.py,sha256=jirD2Hxk28Wadpq_F08t40dYBygq6W1_0cD3261kCgo,3949
14
14
  muffin_rest/openapi.py,sha256=VrkyZr_T0ykAQsvkFQ_yarZ-Zs55AmAGf4aNLsUdjGA,8715
15
- muffin_rest/options.py,sha256=VO1d7nzKSxPw9QidNiyNSfMDX46ZCK0a-iFbJyzNXEE,2227
15
+ muffin_rest/options.py,sha256=Mzv0mq6YylL6cNtad9JhEhkmA4RgmDsu-On2hn5VEiw,2208
16
16
  muffin_rest/peewee/__init__.py,sha256=94DSj_ftT6fbPksHlBv40AH2HWaiZommUFOMN2jd9a4,129
17
17
  muffin_rest/peewee/filters.py,sha256=8CqleDEn4vVQvBLXEaGOjM2N7sY117EQ4GThPhlDPE8,2494
18
- muffin_rest/peewee/handler.py,sha256=qu-ma1zhMGvzVbqpBEdSkify2UbffT58SLjWUoT_1ws,5418
18
+ muffin_rest/peewee/handler.py,sha256=MhRYQokaEt-NIrMdFiJLcZwp4h0A5LKCwHOb36vm5m0,5402
19
19
  muffin_rest/peewee/openapi.py,sha256=ktgsmB9wFNvcTbTaDkMQFLdQxk3osDFW5LkUSFVjcQo,1093
20
20
  muffin_rest/peewee/options.py,sha256=TimJtErC9e8B7BRiEkHiBZd71_bZbYr-FE2PIlQvfH0,1455
21
21
  muffin_rest/peewee/schemas.py,sha256=hQG2UKR7gEMsz0n75L3tvkVzUX3baXMJ94emgIc1Scw,439
@@ -26,14 +26,14 @@ muffin_rest/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  muffin_rest/redoc.html,sha256=GtuHIMvTuSi8Ro6bgI-G8VB94AljMyfjcZseqtBmGCY,559
27
27
  muffin_rest/schemas.py,sha256=BW3dF82C6Q6STs4tZjej1x8Ii1rI3EZUJZR4mNNKmu4,875
28
28
  muffin_rest/sorting.py,sha256=nu4SGW5uxLETJIywE-1UTCCya9QAvYWcq-P8dPWQixI,2822
29
- muffin_rest/sqlalchemy/__init__.py,sha256=pZt_3t8I4uU8WssrksdEn8LXS0ytKT4NHioTpFqKDiw,6312
29
+ muffin_rest/sqlalchemy/__init__.py,sha256=GMtnX3C5H9okEYjkaTHXd6Wna8F1Y6YAr1upT-cFOiM,6335
30
30
  muffin_rest/sqlalchemy/filters.py,sha256=Lf1nPOQjDT7Nv1HAwowfWYTHWCrIMpw-4aWwoaNVlVU,2475
31
31
  muffin_rest/sqlalchemy/sorting.py,sha256=qmzP18ongriCGs2Ok_OllEybqWgppU-Kakg0JL1DM_M,1690
32
32
  muffin_rest/sqlalchemy/types.py,sha256=Exm-zAQCtPAwXvYcCTtPRqSa-wTEWRcH_v2YSsJkB6s,198
33
33
  muffin_rest/swagger.html,sha256=2uGLu_KpkYf925KnDKHBJmV9pm6OHn5C3BWScESsUS8,1736
34
34
  muffin_rest/types.py,sha256=5NY9gPTIptv6U2Qab2xMXlS_jZuTuR0bquFFwWRURcA,510
35
35
  muffin_rest/utils.py,sha256=c08E4HJ4SLYC-91GKPEbsyKTZ4sZbTN4qDqJbNg_HTE,2076
36
- muffin_rest-12.0.1.dist-info/LICENSE,sha256=xHPkOZhjyKBMOwXpWn9IB_BVLjrrMxv2M9slKkHj2hM,1082
37
- muffin_rest-12.0.1.dist-info/METADATA,sha256=dXgMCxDzBPevm7z9iHGm7okdhQCIRX-R8RGCHUwdjWo,4912
38
- muffin_rest-12.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
39
- muffin_rest-12.0.1.dist-info/RECORD,,
36
+ muffin_rest-12.0.3.dist-info/LICENSE,sha256=xHPkOZhjyKBMOwXpWn9IB_BVLjrrMxv2M9slKkHj2hM,1082
37
+ muffin_rest-12.0.3.dist-info/METADATA,sha256=T3T6CJgnSSKsPNuRdmtGt5rOxG1X88KXopVorg7SldQ,4912
38
+ muffin_rest-12.0.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
39
+ muffin_rest-12.0.3.dist-info/RECORD,,