muffin-rest 12.0.1__tar.gz → 12.0.3__tar.gz

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.
Files changed (39) hide show
  1. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/PKG-INFO +1 -1
  2. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/mongo/__init__.py +3 -3
  3. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/options.py +0 -1
  4. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/handler.py +6 -6
  5. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/sqlalchemy/__init__.py +3 -3
  6. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/pyproject.toml +1 -1
  7. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/LICENSE +0 -0
  8. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/README.md +0 -0
  9. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/__init__.py +0 -0
  10. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/api.py +0 -0
  11. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/errors.py +0 -0
  12. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/filters.py +0 -0
  13. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/handler.py +0 -0
  14. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/limits.py +0 -0
  15. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/marshmallow.py +0 -0
  16. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/mongo/filters.py +0 -0
  17. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/mongo/schema.py +0 -0
  18. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/mongo/sorting.py +0 -0
  19. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/mongo/types.py +0 -0
  20. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/mongo/utils.py +0 -0
  21. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/openapi.py +0 -0
  22. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/__init__.py +0 -0
  23. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/filters.py +0 -0
  24. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/openapi.py +0 -0
  25. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/options.py +0 -0
  26. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/schemas.py +0 -0
  27. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/sorting.py +0 -0
  28. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/types.py +0 -0
  29. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/peewee/utils.py +0 -0
  30. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/py.typed +0 -0
  31. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/redoc.html +0 -0
  32. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/schemas.py +0 -0
  33. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/sorting.py +0 -0
  34. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/sqlalchemy/filters.py +0 -0
  35. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/sqlalchemy/sorting.py +0 -0
  36. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/sqlalchemy/types.py +0 -0
  37. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/swagger.html +0 -0
  38. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/types.py +0 -0
  39. {muffin_rest-12.0.1 → muffin_rest-12.0.3}/muffin_rest/utils.py +0 -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
@@ -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
@@ -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
  [tool.poetry]
2
2
  name = "muffin-rest"
3
- version = "12.0.1"
3
+ version = "12.0.3"
4
4
  description = "The package provides enhanced support for writing REST APIs with Muffin framework"
5
5
  readme = "README.md"
6
6
  homepage = "https://github.com/klen/muffin-rest"
File without changes
File without changes