strawberry-graphql 0.274.1__py3-none-any.whl → 0.274.3__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.
@@ -7,7 +7,6 @@ from multiprocessing import Pool, cpu_count
7
7
  from typing import TYPE_CHECKING, Any, Union
8
8
 
9
9
  from libcst.codemod._cli import ExecutionConfig, ExecutionResult, _execute_transform
10
- from libcst.codemod._dummy_pool import DummyPool
11
10
  from rich.progress import Progress
12
11
 
13
12
  from ._fake_progress import FakeProgress
@@ -18,7 +17,6 @@ if TYPE_CHECKING:
18
17
  from libcst.codemod import Codemod
19
18
 
20
19
  ProgressType = Union[type[Progress], type[FakeProgress]]
21
- PoolType = Union[type[Pool], type[DummyPool]] # type: ignore
22
20
 
23
21
 
24
22
  def _get_libcst_version() -> tuple[int, int, int]:
@@ -37,29 +35,21 @@ def _execute_transform_wrap(
37
35
  ) -> ExecutionResult:
38
36
  additional_kwargs: dict[str, Any] = {}
39
37
 
40
- if _get_libcst_version() >= (1, 4, 0):
38
+ libcst_version = _get_libcst_version()
39
+
40
+ if (1, 4, 0) <= libcst_version < (1, 8, 0):
41
41
  additional_kwargs["scratch"] = {}
42
42
 
43
+ if libcst_version >= (1, 8, 0):
44
+ additional_kwargs["original_scratch"] = {}
45
+ additional_kwargs["codemod_args"] = {}
46
+ additional_kwargs["repo_manager"] = None
47
+
43
48
  # TODO: maybe capture warnings?
44
49
  with open(os.devnull, "w") as null, contextlib.redirect_stderr(null): # noqa: PTH123
45
50
  return _execute_transform(**job, **additional_kwargs)
46
51
 
47
52
 
48
- def _get_progress_and_pool(
49
- total_files: int, jobs: int
50
- ) -> tuple[PoolType, ProgressType]:
51
- poll_impl: PoolType = Pool # type: ignore
52
- progress_impl: ProgressType = Progress
53
-
54
- if total_files == 1 or jobs == 1:
55
- poll_impl = DummyPool
56
-
57
- if total_files == 1:
58
- progress_impl = FakeProgress
59
-
60
- return poll_impl, progress_impl
61
-
62
-
63
53
  def run_codemod(
64
54
  codemod: Codemod,
65
55
  files: Sequence[str],
@@ -70,8 +60,6 @@ def run_codemod(
70
60
 
71
61
  config = ExecutionConfig()
72
62
 
73
- pool_impl, progress_impl = _get_progress_and_pool(total, jobs)
74
-
75
63
  tasks = [
76
64
  {
77
65
  "transformer": codemod,
@@ -81,7 +69,7 @@ def run_codemod(
81
69
  for filename in files
82
70
  ]
83
71
 
84
- with pool_impl(processes=jobs) as p, progress_impl() as progress: # type: ignore
72
+ with Pool(processes=jobs) as p, Progress() as progress:
85
73
  task_id = progress.add_task("[cyan]Updating...", total=len(tasks))
86
74
 
87
75
  for result in p.imap_unordered(
@@ -412,6 +412,7 @@ class Schema(BaseSchema):
412
412
  context_value: Optional[Any] = None,
413
413
  root_value: Optional[Any] = None,
414
414
  operation_name: Optional[str] = None,
415
+ operation_extensions: Optional[dict[str, Any]] = None,
415
416
  ) -> ExecutionContext:
416
417
  return ExecutionContext(
417
418
  query=query,
@@ -421,6 +422,7 @@ class Schema(BaseSchema):
421
422
  root_value=root_value,
422
423
  variables=variable_values,
423
424
  provided_operation_name=operation_name,
425
+ operation_extensions=operation_extensions,
424
426
  )
425
427
 
426
428
  @lru_cache
@@ -554,6 +556,7 @@ class Schema(BaseSchema):
554
556
  context_value=context_value,
555
557
  root_value=root_value,
556
558
  operation_name=operation_name,
559
+ operation_extensions=operation_extensions,
557
560
  )
558
561
  extensions = self.get_extensions()
559
562
  # TODO (#3571): remove this when we implement execution context as parameter.
@@ -646,6 +649,7 @@ class Schema(BaseSchema):
646
649
  context_value=context_value,
647
650
  root_value=root_value,
648
651
  operation_name=operation_name,
652
+ operation_extensions=operation_extensions,
649
653
  )
650
654
  extensions = self._sync_extensions
651
655
  # TODO (#3571): remove this when we implement execution context as parameter.
@@ -52,6 +52,8 @@ class ExecutionContext:
52
52
  result: Optional[GraphQLExecutionResult] = None
53
53
  extensions_results: dict[str, Any] = dataclasses.field(default_factory=dict)
54
54
 
55
+ operation_extensions: Optional[dict[str, Any]] = None
56
+
55
57
  def __post_init__(self, provided_operation_name: str | None) -> None:
56
58
  self._provided_operation_name = provided_operation_name
57
59
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.274.1
3
+ Version: 0.274.3
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -37,9 +37,9 @@ Requires-Dist: channels (>=3.0.5) ; extra == "channels"
37
37
  Requires-Dist: fastapi (>=0.65.2) ; extra == "fastapi"
38
38
  Requires-Dist: flask (>=1.1) ; extra == "flask"
39
39
  Requires-Dist: graphql-core (>=3.2.0,<3.4.0)
40
- Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "cli"
41
- Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "debug"
42
- Requires-Dist: libcst (>=0.4.7,<1.8.0) ; extra == "debug-server"
40
+ Requires-Dist: libcst ; extra == "cli"
41
+ Requires-Dist: libcst ; extra == "debug"
42
+ Requires-Dist: libcst ; extra == "debug-server"
43
43
  Requires-Dist: litestar (>=2) ; (python_version ~= "3.10") and (extra == "litestar")
44
44
  Requires-Dist: opentelemetry-api (<2) ; extra == "opentelemetry"
45
45
  Requires-Dist: opentelemetry-sdk (<2) ; extra == "opentelemetry"
@@ -26,7 +26,7 @@ strawberry/cli/commands/schema_codegen.py,sha256=G6eV08a51sjVxCm3jn75oPn9hC8YarK
26
26
  strawberry/cli/commands/server.py,sha256=qj5wn22HvyJDzwnWzduIWRnS912XvD7GRhPGJkbLaz4,2217
27
27
  strawberry/cli/commands/upgrade/__init__.py,sha256=nY_Cj4yOj3CVdzEPWMAgof-dIr804sEJ-cCVOfI6UWo,2480
28
28
  strawberry/cli/commands/upgrade/_fake_progress.py,sha256=fefLgJwTXe4kG9RntdEJdzkPPRBK_pZqnmMH-pxD85Y,484
29
- strawberry/cli/commands/upgrade/_run_codemod.py,sha256=5xGGaqQZZagiKGyO3mrM1jKaVeTBojW8ktAlpEI4Dfw,2497
29
+ strawberry/cli/commands/upgrade/_run_codemod.py,sha256=LZd5D1PP65bwVZjBvPPVrZ9t-bfvrafZ__HPBrW2WYA,2168
30
30
  strawberry/cli/constants.py,sha256=GhhDZOl9lN4glq50OI1oSbPSGqQXEarZ6r_Grq8pcpI,138
31
31
  strawberry/cli/debug_server.py,sha256=mKxJZf_-SbWWusoFMzT8-E5qTshIx3IuciG6xlC21kI,999
32
32
  strawberry/cli/utils/__init__.py,sha256=5h6QMXbY4zbWVGg8xpsKlgWSEsNgn1fcjbRrJjgzdEc,987
@@ -170,7 +170,7 @@ strawberry/schema/compat.py,sha256=xNpOEDfi-MODpplMGaKuKeQIVcr-tcAaKaU3TlBc1Zs,1
170
170
  strawberry/schema/config.py,sha256=6d2MPrAgq97-7aze555dRcB3yw-aeUexYMP3KVN22c0,1024
171
171
  strawberry/schema/exceptions.py,sha256=8gsMxxFDynMvRkUDuVL9Wwxk_zsmo6QoJ2l4NPxd64M,1137
172
172
  strawberry/schema/name_converter.py,sha256=xFOXEgqldFkxXRkIQvsJN1dPkWbEUaIrTYNOMYSEVwQ,6945
173
- strawberry/schema/schema.py,sha256=dnmSxoNdlrT02mca32Crtl0F55eweIqE-VOC77kuGjE,37723
173
+ strawberry/schema/schema.py,sha256=-dVGJfOAyq-w2lpEbzCaiRNPMH68nirv-Q6gZ4aW0UU,37951
174
174
  strawberry/schema/schema_converter.py,sha256=vxFghA8c4vPLx0XM07gjIbWqMWUnaognzmsuCWTSkTk,39112
175
175
  strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
176
176
  strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
@@ -203,7 +203,7 @@ strawberry/types/auto.py,sha256=WZ2cQAI8nREUigBzpzFqIKGjJ_C2VqpAPNe8vPjTciM,3007
203
203
  strawberry/types/base.py,sha256=Bfa-5Wen8qR7m6tlSMRRGlGE-chRGMHjQMopfNdbbrk,15197
204
204
  strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
205
205
  strawberry/types/enum.py,sha256=IcCz0FLswJtDC_bU8aG1cjreawcqHywAzzVRBZUSAqs,6229
206
- strawberry/types/execution.py,sha256=m27VlmvaRLQsMnWWymxMMPOlaf0lUge4ZXea_OsoH2k,3761
206
+ strawberry/types/execution.py,sha256=kW5rgkWP98oysJWNc_fcxyO1PZ36NJpPTPZpZP2ZXYk,3820
207
207
  strawberry/types/field.py,sha256=vxb7JvkHfRmDCYsjhDmVnO2lMbtSOteQm3jQUeSFu6g,21605
208
208
  strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
209
209
  strawberry/types/fields/resolver.py,sha256=b6lxfw6AMOUFWm7vs7a9KzNkpR8b_S110DoIosrrWDQ,14679
@@ -232,8 +232,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
232
232
  strawberry/utils/operation.py,sha256=ZgVOw3K2jQuLjNOYUHauF7itJD0QDNoPw9PBi0IYf6k,1234
233
233
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
234
234
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
235
- strawberry_graphql-0.274.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
236
- strawberry_graphql-0.274.1.dist-info/METADATA,sha256=dlqg7FwnCWKp0jQHBq0qi2IiZJALsgpEIed6YMuhneg,7444
237
- strawberry_graphql-0.274.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
238
- strawberry_graphql-0.274.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
239
- strawberry_graphql-0.274.1.dist-info/RECORD,,
235
+ strawberry_graphql-0.274.3.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
236
+ strawberry_graphql-0.274.3.dist-info/METADATA,sha256=MKO1coLJGJVdouLUvLOLladnxYZbB4SITr4gBdsoTM0,7393
237
+ strawberry_graphql-0.274.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
238
+ strawberry_graphql-0.274.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
239
+ strawberry_graphql-0.274.3.dist-info/RECORD,,