cadwyn 3.6.3__py3-none-any.whl → 3.6.5__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.

Potentially problematic release.


This version of cadwyn might be problematic. Click here for more details.

cadwyn/routing.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import functools
2
2
  import inspect
3
3
  import re
4
+ import types
4
5
  import typing
5
6
  import warnings
6
7
  from collections import defaultdict
@@ -541,20 +542,20 @@ def _modify_callable(
541
542
  modify_annotations: Callable[[dict[str, Any]], dict[str, Any]] = lambda a: a,
542
543
  modify_defaults: Callable[[tuple[Any, ...]], tuple[Any, ...]] = lambda a: a,
543
544
  ):
544
- annotation_modifying_decorator = _copy_function(call)
545
+ annotation_modifying_wrapper = _copy_function(call)
545
546
  old_params = inspect.signature(call).parameters
546
- callable_annotations = annotation_modifying_decorator.__annotations__
547
+ callable_annotations = annotation_modifying_wrapper.__annotations__
547
548
 
548
- annotation_modifying_decorator.__annotations__ = modify_annotations(callable_annotations)
549
- annotation_modifying_decorator.__defaults__ = modify_defaults(
549
+ annotation_modifying_wrapper.__annotations__ = modify_annotations(callable_annotations)
550
+ annotation_modifying_wrapper.__defaults__ = modify_defaults(
550
551
  tuple(p.default for p in old_params.values() if p.default is not inspect.Signature.empty),
551
552
  )
552
- annotation_modifying_decorator.__signature__ = _generate_signature(
553
- annotation_modifying_decorator,
553
+ annotation_modifying_wrapper.__signature__ = _generate_signature(
554
+ annotation_modifying_wrapper,
554
555
  old_params,
555
556
  )
556
557
 
557
- return annotation_modifying_decorator
558
+ return annotation_modifying_wrapper
558
559
 
559
560
 
560
561
  def _remake_endpoint_dependencies(route: fastapi.routing.APIRoute):
@@ -718,10 +719,13 @@ def _copy_function(function: _T) -> _T:
718
719
  while hasattr(function, "__alt_wrapped__"):
719
720
  function = function.__alt_wrapped__
720
721
 
722
+ if not isinstance(function, types.FunctionType):
723
+ # This means that the callable is actually an instance of a regular class
724
+ function = function.__call__
721
725
  if inspect.iscoroutinefunction(function):
722
726
 
723
727
  @functools.wraps(function)
724
- async def annotation_modifying_decorator( # pyright: ignore[reportRedeclaration]
728
+ async def annotation_modifying_wrapper( # pyright: ignore[reportRedeclaration]
725
729
  *args: Any,
726
730
  **kwargs: Any,
727
731
  ) -> Any:
@@ -730,16 +734,16 @@ def _copy_function(function: _T) -> _T:
730
734
  else:
731
735
 
732
736
  @functools.wraps(function)
733
- def annotation_modifying_decorator(
737
+ def annotation_modifying_wrapper(
734
738
  *args: Any,
735
739
  **kwargs: Any,
736
740
  ) -> Any:
737
741
  return function(*args, **kwargs)
738
742
 
739
743
  # Otherwise it will have the same signature as __wrapped__ due to how inspect module works
740
- annotation_modifying_decorator.__alt_wrapped__ = ( # pyright: ignore[reportAttributeAccessIssue]
741
- annotation_modifying_decorator.__wrapped__
744
+ annotation_modifying_wrapper.__alt_wrapped__ = ( # pyright: ignore[reportAttributeAccessIssue]
745
+ annotation_modifying_wrapper.__wrapped__
742
746
  )
743
- del annotation_modifying_decorator.__wrapped__
747
+ del annotation_modifying_wrapper.__wrapped__
744
748
 
745
- return cast(_T, annotation_modifying_decorator)
749
+ return cast(_T, annotation_modifying_wrapper)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cadwyn
3
- Version: 3.6.3
3
+ Version: 3.6.5
4
4
  Summary: Production-ready community-driven modern Stripe-like API versioning in FastAPI
5
5
  Home-page: https://github.com/zmievsa/cadwyn
6
6
  License: MIT
@@ -19,7 +19,7 @@ cadwyn/codegen/_plugins/module_migrations.py,sha256=TeWJk4Iu4SRQ9K2iI3v3sCs1110j
19
19
  cadwyn/exceptions.py,sha256=JUHFjxWl2XlnweVnSpq3mWFUNU0ocyXBBleMMQyCyBk,1442
20
20
  cadwyn/main.py,sha256=kt2Vn7TIA4ZnD_xrgz57TOjUk-4zVP8SV8nuTZBEaaU,218
21
21
  cadwyn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- cadwyn/routing.py,sha256=njVzrVOruO-WFI74f3JIfATivSiz1C5EJuWjjZyaseI,34937
22
+ cadwyn/routing.py,sha256=0Smp4_s-FuwlqpzWA8FFP0ae-8V4vTMMZS4Mch2Ewlo,35096
23
23
  cadwyn/structure/__init__.py,sha256=BjFPlQYCw8ds_4zxdCi2LimarUGqSzyTNmOdT-FkGms,661
24
24
  cadwyn/structure/common.py,sha256=6Z4nI97XPWTCinn6np73m-rLPyYNrz2fWXKJlqjsiaQ,269
25
25
  cadwyn/structure/data.py,sha256=u5-pJ48BRnPSt2JbH6AefHGddTEE5z7YBnyv0iGw3dQ,6133
@@ -28,8 +28,8 @@ cadwyn/structure/enums.py,sha256=iMokxA2QYJ61SzyB-Pmuq3y7KL7-e6TsnjLVUaVZQnw,954
28
28
  cadwyn/structure/modules.py,sha256=1FK-lLm-zOTXEvn-QtyBH38aDRht5PDQiZrOPCsBlM4,1268
29
29
  cadwyn/structure/schemas.py,sha256=5hExJEdvEFPK4Cv8G_Gh6E6ltiNMyId_UjGIJz3jz0o,8802
30
30
  cadwyn/structure/versions.py,sha256=6M_saZPlzEQ0LNRQywhtrw-YPdjT0P18EEPTRg1dR8Y,32785
31
- cadwyn-3.6.3.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
32
- cadwyn-3.6.3.dist-info/METADATA,sha256=LTK9NhKXXRgov6iHuhcDnl6dvfuyIjWyPnWRL9TZ8jE,4104
33
- cadwyn-3.6.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
34
- cadwyn-3.6.3.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
35
- cadwyn-3.6.3.dist-info/RECORD,,
31
+ cadwyn-3.6.5.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
32
+ cadwyn-3.6.5.dist-info/METADATA,sha256=-1U_tdBpTozcSPrB3Ppn-UXQkp9YLTacWcM6Khi8Ja0,4104
33
+ cadwyn-3.6.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
34
+ cadwyn-3.6.5.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
35
+ cadwyn-3.6.5.dist-info/RECORD,,
File without changes