apexdevkit 1.5.13__tar.gz → 1.5.15__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 (34) hide show
  1. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/PKG-INFO +1 -1
  2. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/annotation/deprecate.py +3 -1
  3. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/builder.py +1 -1
  4. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/dependable.py +1 -1
  5. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/router.py +8 -5
  6. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/schema.py +4 -2
  7. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/service.py +4 -2
  8. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/repository/in_memory.py +1 -1
  9. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/repository/interface.py +1 -1
  10. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/testing/rest.py +12 -0
  11. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/pyproject.toml +1 -1
  12. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/LICENSE +0 -0
  13. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/README.md +0 -0
  14. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/__init__.py +0 -0
  15. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/annotation/__init__.py +0 -0
  16. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/error.py +0 -0
  17. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/__init__.py +0 -0
  18. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/docs.py +0 -0
  19. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/fastapi/response.py +0 -0
  20. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/formatter.py +0 -0
  21. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/http/__init__.py +0 -0
  22. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/http/fake.py +0 -0
  23. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/http/fluent.py +0 -0
  24. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/http/httpx.py +0 -0
  25. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/http/json.py +0 -0
  26. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/http/url.py +0 -0
  27. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/py.typed +0 -0
  28. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/repository/__init__.py +0 -0
  29. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/repository/base.py +0 -0
  30. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/repository/connector.py +0 -0
  31. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/repository/database.py +0 -0
  32. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/testing/__init__.py +0 -0
  33. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/testing/database.py +0 -0
  34. {apexdevkit-1.5.13 → apexdevkit-1.5.15}/apexdevkit/testing/fake.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apexdevkit
3
- Version: 1.5.13
3
+ Version: 1.5.15
4
4
  Summary: Apex Development Tools for python.
5
5
  Author: Apex Dev
6
6
  Author-email: dev@apex.ge
@@ -26,7 +26,9 @@ def deprecated(warning: str) -> Callable[[F], F]:
26
26
  elif inspect.isclass(obj):
27
27
  return cast(F, _deprecate_class(obj, warning))
28
28
  else:
29
- raise TypeError(f"Unsupported type for deprecation: {type(obj)}")
29
+ raise TypeError(
30
+ f"Unsupported type for deprecation: {type(obj)}"
31
+ ) # pragma: no cover
30
32
 
31
33
  return decorator
32
34
 
@@ -26,7 +26,7 @@ class FastApiBuilder:
26
26
 
27
27
  return self
28
28
 
29
- def with_dependency(self, **values: Any) -> Self:
29
+ def with_dependency(self, **values: Any) -> Self: # pragma: no cover
30
30
  for key, value in values.items():
31
31
  setattr(self.app.state, key, value)
32
32
 
@@ -4,7 +4,7 @@ from fastapi import Depends
4
4
  from fastapi.requests import Request
5
5
 
6
6
 
7
- def inject(dependency: str) -> Any:
7
+ def inject(dependency: str) -> Any: # pragma: no cover
8
8
  def get(request: Request) -> Any:
9
9
  return getattr(request.app.state, dependency)
10
10
 
@@ -6,6 +6,7 @@ from typing import Annotated, Any, Callable, Iterable, Self, TypeVar
6
6
  from fastapi import APIRouter, Depends, Path
7
7
  from fastapi.responses import JSONResponse
8
8
 
9
+ from apexdevkit.annotation import deprecated
9
10
  from apexdevkit.error import DoesNotExistError, ExistsError, ForbiddenError
10
11
  from apexdevkit.fastapi.schema import DataclassFields, RestfulSchema, SchemaFields
11
12
  from apexdevkit.fastapi.service import RawCollection, RawItem, RestfulService
@@ -95,12 +96,12 @@ class RestfulServiceBuilder(ABC):
95
96
  return self
96
97
 
97
98
  @abstractmethod
98
- def build(self) -> RestfulService:
99
+ def build(self) -> RestfulService: # pragma: no cover
99
100
  pass
100
101
 
101
102
 
102
103
  @dataclass
103
- class PreBuiltRestfulService(RestfulServiceBuilder):
104
+ class PreBuiltRestfulService(RestfulServiceBuilder): # pragma: no cover
104
105
  service: RestfulService
105
106
 
106
107
  def build(self) -> RestfulService:
@@ -123,7 +124,7 @@ class RestfulRouter:
123
124
 
124
125
  parent: str = field(init=False, default="")
125
126
 
126
- def __post_init__(self) -> None:
127
+ def __post_init__(self) -> None: # pragma: no cover
127
128
  if self.service:
128
129
  self.infra = PreBuiltRestfulService(self.service)
129
130
 
@@ -147,7 +148,8 @@ class RestfulRouter:
147
148
  def item_path(self) -> str:
148
149
  return "/{" + self.id_alias + "}"
149
150
 
150
- def with_dataclass(self, value: Any) -> Self:
151
+ @deprecated("Use with_name and with_fields instead")
152
+ def with_dataclass(self, value: Any) -> Self: # pragma: no cover
151
153
  return self.with_name(RestfulName(value.__name__.lower())).with_fields(
152
154
  DataclassFields(value)
153
155
  )
@@ -167,7 +169,8 @@ class RestfulRouter:
167
169
 
168
170
  return self
169
171
 
170
- def with_service(self, value: RestfulService) -> Self:
172
+ @deprecated("Use with_infra instead")
173
+ def with_service(self, value: RestfulService) -> Self: # pragma: no cover
171
174
  self.infra = PreBuiltRestfulService(value)
172
175
 
173
176
  return self
@@ -5,6 +5,7 @@ from typing import Any, Callable, Iterable, List
5
5
 
6
6
  from pydantic import BaseModel, create_model
7
7
 
8
+ from apexdevkit.annotation import deprecated
8
9
  from apexdevkit.http import JsonDict
9
10
  from apexdevkit.testing import RestfulName
10
11
 
@@ -20,12 +21,13 @@ class SchemaFields(ABC):
20
21
  return self.readable().drop("id")
21
22
 
22
23
  @abstractmethod
23
- def readable(self) -> JsonDict:
24
+ def readable(self) -> JsonDict: # pragma: no cover
24
25
  pass
25
26
 
26
27
 
28
+ @deprecated("Use custom schema fields instead")
27
29
  @dataclass
28
- class DataclassFields(SchemaFields):
30
+ class DataclassFields(SchemaFields): # pragma: no cover
29
31
  source: Any
30
32
 
31
33
  def readable(self) -> JsonDict:
@@ -2,6 +2,7 @@ from abc import ABC
2
2
  from dataclasses import dataclass, field
3
3
  from typing import Any, Dict, Generic, Iterable, Self, TypeVar
4
4
 
5
+ from apexdevkit.annotation import deprecated
5
6
  from apexdevkit.formatter import DataclassFormatter, Formatter
6
7
  from apexdevkit.repository.interface import Repository
7
8
 
@@ -17,7 +18,7 @@ class _RawItemWithId(Dict[str, Any]):
17
18
  RawCollectionWithId = Iterable[_RawItemWithId]
18
19
 
19
20
 
20
- class RestfulService(ABC):
21
+ class RestfulService(ABC): # pragma: no cover
21
22
  def create_one(self, item: RawItem) -> RawItem:
22
23
  raise NotImplementedError(self.create_one.__name__)
23
24
 
@@ -49,6 +50,7 @@ class RestfulRepositoryBuilder(Generic[ItemT]):
49
50
  formatter: Formatter[ItemT] | None = field(init=False, default=None)
50
51
  repository: Repository[Any, ItemT] = field(init=False)
51
52
 
53
+ @deprecated("Pass formatter instead")
52
54
  def with_resource(self, resource: type[ItemT]) -> Self:
53
55
  self.resource = resource
54
56
 
@@ -66,7 +68,7 @@ class RestfulRepositoryBuilder(Generic[ItemT]):
66
68
 
67
69
  def build(self) -> RestfulService:
68
70
  if not self.formatter and self.resource:
69
- self.formatter = DataclassFormatter(self.resource)
71
+ self.with_formatter(DataclassFormatter(self.resource))
70
72
 
71
73
  assert self.formatter, "Must provide either resource or formatter"
72
74
 
@@ -6,7 +6,7 @@ from apexdevkit.error import Criteria, DoesNotExistError, ExistsError
6
6
  from apexdevkit.formatter import DataclassFormatter, Formatter
7
7
 
8
8
 
9
- class _Item(Protocol):
9
+ class _Item(Protocol): # pragma: no cover
10
10
  @property
11
11
  def id(self) -> Any:
12
12
  pass
@@ -4,7 +4,7 @@ ItemT = TypeVar("ItemT")
4
4
  IdT = TypeVar("IdT", contravariant=True)
5
5
 
6
6
 
7
- class Repository(Protocol[IdT, ItemT]):
7
+ class Repository(Protocol[IdT, ItemT]): # pragma: no cover
8
8
  def create(self, item: ItemT) -> ItemT:
9
9
  pass
10
10
 
@@ -79,6 +79,18 @@ def as_plural(singular: str) -> str:
79
79
  if singular.endswith("y"):
80
80
  return singular[:-1] + "ies"
81
81
 
82
+ if singular.endswith("ch") or singular.endswith("sh") or singular.endswith("ss"):
83
+ return singular[:-2] + "es"
84
+
85
+ if singular.endswith("s") or singular.endswith("z") or singular.endswith("x"):
86
+ return singular[:-1] + "es"
87
+
88
+ if singular.endswith("fe"):
89
+ return singular[:-2] + "ves"
90
+
91
+ if singular.endswith("f"):
92
+ return singular[:-1] + "ves"
93
+
82
94
  return singular + "s"
83
95
 
84
96
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "apexdevkit"
3
- version = "1.5.13"
3
+ version = "1.5.15"
4
4
  description = "Apex Development Tools for python."
5
5
  authors = ["Apex Dev <dev@apex.ge>"]
6
6
  readme = "README.md"
File without changes
File without changes