u-toolkit 0.1.0__py3-none-any.whl → 0.1.2__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.
- u_toolkit/decorators.py +2 -1
- u_toolkit/fastapi/cbv.py +11 -6
- u_toolkit/signature.py +3 -4
- {u_toolkit-0.1.0.dist-info → u_toolkit-0.1.2.dist-info}/METADATA +2 -1
- {u_toolkit-0.1.0.dist-info → u_toolkit-0.1.2.dist-info}/RECORD +7 -7
- {u_toolkit-0.1.0.dist-info → u_toolkit-0.1.2.dist-info}/WHEEL +0 -0
- {u_toolkit-0.1.0.dist-info → u_toolkit-0.1.2.dist-info}/entry_points.txt +0 -0
u_toolkit/decorators.py
CHANGED
@@ -27,7 +27,8 @@ class DefineMethodDecorator(Generic[_T, _FnT]):
|
|
27
27
|
self.register_method(DefineMethodParams(owner_class, name, self.fn))
|
28
28
|
|
29
29
|
def __get__(self, instance: _T, owner_class: type[_T]):
|
30
|
-
|
30
|
+
parameters = list_parameters(self.fn)[1:]
|
31
|
+
update_parameters(self.fn, *parameters)
|
31
32
|
|
32
33
|
@wraps(self.fn)
|
33
34
|
def wrapper(*args, **kwargs):
|
u_toolkit/fastapi/cbv.py
CHANGED
@@ -296,26 +296,31 @@ class CBV:
|
|
296
296
|
)
|
297
297
|
for name, dep in iter_dependencies(cls)
|
298
298
|
]
|
299
|
+
|
299
300
|
update_parameters(collect_cls_dependencies, *parameters)
|
300
301
|
|
301
302
|
def decorator(method: Callable):
|
302
|
-
|
303
|
-
|
303
|
+
method_name = method.__name__
|
304
|
+
|
305
|
+
cls_fn = getattr(cls, method_name)
|
306
|
+
sign_cls_fn = partial(cls_fn)
|
307
|
+
update_wrapper(sign_cls_fn, cls_fn)
|
304
308
|
|
305
309
|
parameters, *_ = with_parameter(
|
306
|
-
|
310
|
+
sign_cls_fn,
|
307
311
|
name=collect_cls_dependencies.__name__,
|
308
312
|
default=Depends(collect_cls_dependencies),
|
309
313
|
)
|
310
|
-
update_parameters(sign_fn, *parameters)
|
311
314
|
|
312
|
-
|
315
|
+
update_parameters(sign_cls_fn, *(parameters[1:]))
|
316
|
+
|
317
|
+
@wraps(sign_cls_fn)
|
313
318
|
def wrapper(*args, **kwargs):
|
314
319
|
instance = self._build_cls(cls)
|
315
320
|
dependencies = kwargs.pop(collect_cls_dependencies.__name__)
|
316
321
|
for dep_name, dep_value in dependencies.items():
|
317
322
|
setattr(instance, dep_name, dep_value)
|
318
|
-
fn = getattr(instance,
|
323
|
+
fn = getattr(instance, method_name)
|
319
324
|
return fn(*args, **kwargs)
|
320
325
|
|
321
326
|
return wrapper
|
u_toolkit/signature.py
CHANGED
@@ -57,13 +57,12 @@ def update_signature(
|
|
57
57
|
return_annotation: type | None = None,
|
58
58
|
):
|
59
59
|
signature = inspect.signature(fn)
|
60
|
-
kwargs = {}
|
61
60
|
if parameters:
|
62
|
-
|
61
|
+
signature = signature.replace(parameters=parameters)
|
63
62
|
if return_annotation:
|
64
|
-
|
63
|
+
signature = signature.replace(return_annotation=return_annotation)
|
65
64
|
|
66
|
-
fn
|
65
|
+
setattr(fn, "__signature__", signature)
|
67
66
|
|
68
67
|
|
69
68
|
def update_parameters(fn: Callable, *parameters: inspect.Parameter):
|
@@ -1,10 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: u-toolkit
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.2
|
4
4
|
Summary: Add your description here
|
5
5
|
Requires-Python: >=3.11
|
6
6
|
Requires-Dist: pydantic>=2.11.3
|
7
7
|
Provides-Extra: fastapi
|
8
|
+
Requires-Dist: fastapi>=0.115.12; extra == 'fastapi'
|
8
9
|
Requires-Dist: pydantic-settings>=2.9.1; extra == 'fastapi'
|
9
10
|
Provides-Extra: sqlalchemy
|
10
11
|
Requires-Dist: sqlalchemy>=2.0.40; extra == 'sqlalchemy'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
u_toolkit/__init__.py,sha256=7f_bFg1UERA4gyh3HjCAjOZo2cBUgElpwgX5x-Xk2WA,238
|
2
2
|
u_toolkit/alias_generators.py,sha256=KmPL1ViGJjptONffZUAX4ENvkldrwDylm_Ly5RYE8b4,963
|
3
3
|
u_toolkit/datetime.py,sha256=GOG0xa6yKeqvFXJkImK5Pt7wsPXnHMlNKju8deniGJ4,644
|
4
|
-
u_toolkit/decorators.py,sha256=
|
4
|
+
u_toolkit/decorators.py,sha256=NVQPvl8nByo11IRVtAi_kRRjhGvuHPlEme4dYTGZU0s,1261
|
5
5
|
u_toolkit/enum.py,sha256=2yWmK8V1q0P5S3ltBED-TF2H09BmRbsBuqu3Th3G1NE,862
|
6
6
|
u_toolkit/function.py,sha256=GAE6TIm5jpemUiNUPjzk7pIHrxwSSX7sHl1V5E735dE,252
|
7
7
|
u_toolkit/helpers.py,sha256=K3FCz93K1nT4o7gWKVpMKy3k3BnirTPCSb8F8EFUrWk,112
|
@@ -9,9 +9,9 @@ u_toolkit/logger.py,sha256=NOmdR24QfSuo1EMnetyFioa8pA8OYceYTlQ4qiQcBdE,209
|
|
9
9
|
u_toolkit/merge.py,sha256=kHrloud-nPti5j48zkdvaiy4mIJYqOVguixAjWC46kE,924
|
10
10
|
u_toolkit/object.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
u_toolkit/path.py,sha256=IkyIHcU9hKBCOZfF30FrKf4CfL-MH91fjeYF9EY7eos,128
|
12
|
-
u_toolkit/signature.py,sha256=
|
12
|
+
u_toolkit/signature.py,sha256=wXyGFgb_E68xevYWx7gIy9P5lVZmHUebpf2EGI_fCnw,2167
|
13
13
|
u_toolkit/fastapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
u_toolkit/fastapi/cbv.py,sha256=
|
14
|
+
u_toolkit/fastapi/cbv.py,sha256=M-4J7zcEzAsPLxGEYl6fVGnS9NGapddlfjF_ewNiYaM,10055
|
15
15
|
u_toolkit/fastapi/config.py,sha256=kGpokR9XXr1KxMA1GVKYkCdKwqIQAIwOJ-v6sGbqzAQ,267
|
16
16
|
u_toolkit/fastapi/exception.py,sha256=5E4wAJYwp0RJ4SEBVkchOgrgfwCgniQ8Mtg1O5sWUXE,3288
|
17
17
|
u_toolkit/fastapi/helpers.py,sha256=BCMMLxa1c6BMA_rKq-hCi0iyEjrR3Z5rPMeTvgaVJB0,447
|
@@ -30,7 +30,7 @@ u_toolkit/sqlalchemy/type_vars.py,sha256=m2VeV41CBIK_1QX3w2kgz-n556sILAGZ-Kaz3TD
|
|
30
30
|
u_toolkit/sqlalchemy/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
u_toolkit/sqlalchemy/orm/fields.py,sha256=3zoYil23I6YLtc_59aHDt9w5l1NBTkePT9AfXI3DMiY,593
|
32
32
|
u_toolkit/sqlalchemy/orm/models.py,sha256=V8vf4ps3phAmwxyaFYK7pw8Igz7h097o4QBjKB0gwC8,705
|
33
|
-
u_toolkit-0.1.
|
34
|
-
u_toolkit-0.1.
|
35
|
-
u_toolkit-0.1.
|
36
|
-
u_toolkit-0.1.
|
33
|
+
u_toolkit-0.1.2.dist-info/METADATA,sha256=16nsc--BhN024hNXzvlR6hCS9Zoebtu2ziv1Ytcfua4,365
|
34
|
+
u_toolkit-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
35
|
+
u_toolkit-0.1.2.dist-info/entry_points.txt,sha256=hTfAYCd5vvRiqgnJk2eBsoRIiIVB9pK8WZm3Q3jjKFU,45
|
36
|
+
u_toolkit-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|