strawberry-graphql 0.289.1__py3-none-any.whl → 0.289.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.
@@ -1,4 +1,5 @@
1
1
  import importlib
2
+ import importlib.util
2
3
  import inspect
3
4
  import sys
4
5
  import warnings
@@ -60,12 +61,19 @@ class LazyType(Generic[TypeName, Module]):
60
61
 
61
62
  def resolve_type(self) -> type[Any]:
62
63
  module = importlib.import_module(self.module, self.package)
64
+
65
+ # Resolve full module name for __main__ comparison
66
+ if self.package:
67
+ full_module_name = importlib.util.resolve_name(self.module, self.package)
68
+ else:
69
+ full_module_name = self.module
70
+
63
71
  main_module = sys.modules.get("__main__", None)
64
72
  if main_module:
65
73
  # If lazy type points to the main module, use it instead of the imported
66
74
  # module. Otherwise duplication checks during schema-conversion might fail.
67
75
  # Refer to: https://github.com/strawberry-graphql/strawberry/issues/2397
68
- if main_module.__spec__ and main_module.__spec__.name == self.module:
76
+ if main_module.__spec__ and main_module.__spec__.name == full_module_name:
69
77
  module = main_module
70
78
  elif hasattr(main_module, "__file__") and hasattr(module, "__file__"):
71
79
  main_file = main_module.__file__
@@ -78,6 +86,7 @@ class LazyType(Generic[TypeName, Module]):
78
86
  # path contains `strawberry.exe`
79
87
  is_samefile = False
80
88
  module = main_module if is_samefile else module
89
+
81
90
  return module.__dict__[self.type_name]
82
91
 
83
92
  # this empty call method allows LazyTypes to be used in generic types
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: strawberry-graphql
3
- Version: 0.289.1
3
+ Version: 0.289.2
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -219,7 +219,7 @@ strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
219
219
  strawberry/types/fields/resolver.py,sha256=sWG4nO8XpsvELna0uLU-rwKzUGiMgwHPzg8N7xRXqe4,16239
220
220
  strawberry/types/graphql.py,sha256=gXKzawwKiow7hvoJhq5ApNJOMUCnKmvTiHaKY5CK1Lw,867
221
221
  strawberry/types/info.py,sha256=1MTarr040KSsPPdrVx8sDHtKudEfH0LRgQ4adk_1FKA,4698
222
- strawberry/types/lazy_type.py,sha256=GYy4PnKtZ48ywW-_A-6Ul8sbHRlB0Tc39ui5DMIja4U,5077
222
+ strawberry/types/lazy_type.py,sha256=Zwt_etpUp1bBfDNgWk3aamK6UUlnQGYmR8VDNYM-PoQ,5334
223
223
  strawberry/types/maybe.py,sha256=ZBNHGDMuVcorpErPAMjJku4W3I2ygPf_3ZLw-N2O_UU,1610
224
224
  strawberry/types/mutation.py,sha256=vcrKt1VpcS6SLl1WKfcR-NTAqfQ12LpzjwgT5Bx-U3Q,11549
225
225
  strawberry/types/nodes.py,sha256=bM88j05rMIQ5OTS4RqKeU3kjo38MM-hA3Hrmh3IreV0,5121
@@ -240,8 +240,8 @@ strawberry/utils/logging.py,sha256=Dnivjd0ZhK_lAvjvuyCDkEWDhuURBoK9d3Kt_mIqbRg,7
240
240
  strawberry/utils/operation.py,sha256=Qs3ttbuC415xEVqmJ6YsWQpJNUo8CZJq9AoMB-yV65w,1215
241
241
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
242
242
  strawberry/utils/typing.py,sha256=eE9NeMfASeXRstbjLnQFfOPymcSX8xwg3FGw_HCp95E,11828
243
- strawberry_graphql-0.289.1.dist-info/METADATA,sha256=bbupgRYRkCQ5q4LdqolspO2jFu9Xy8bCoX2qwvg8RjM,7627
244
- strawberry_graphql-0.289.1.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
245
- strawberry_graphql-0.289.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
246
- strawberry_graphql-0.289.1.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
247
- strawberry_graphql-0.289.1.dist-info/RECORD,,
243
+ strawberry_graphql-0.289.2.dist-info/METADATA,sha256=9wP0VKP6xd2wp6nJUSbKhuyLX7r23Ssj0rulSnjWcbo,7627
244
+ strawberry_graphql-0.289.2.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
245
+ strawberry_graphql-0.289.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
246
+ strawberry_graphql-0.289.2.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
247
+ strawberry_graphql-0.289.2.dist-info/RECORD,,