luna-quantum 1.0.0__cp312-cp312-win_amd64.whl → 1.0.1__cp312-cp312-win_amd64.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 luna-quantum might be problematic. Click here for more details.

Files changed (46) hide show
  1. luna_quantum/__init__.py +38 -17
  2. luna_quantum/__init__.pyi +29 -14
  3. luna_quantum/_core.cp312-win_amd64.pyd +0 -0
  4. luna_quantum/_core.pyi +1050 -377
  5. luna_quantum/algorithms/__init__.py +1 -0
  6. luna_quantum/backends/__init__.py +1 -0
  7. luna_quantum/client/rest_client/qpu_token_rest_client.py +7 -3
  8. luna_quantum/client/schemas/circuit.py +5 -6
  9. luna_quantum/client/schemas/create/__init__.py +10 -1
  10. luna_quantum/client/schemas/create/circuit.py +5 -6
  11. luna_quantum/client/schemas/create/qpu_token.py +2 -5
  12. luna_quantum/client/schemas/create/qpu_token_time_quota.py +3 -6
  13. luna_quantum/client/schemas/create/qpu_token_time_quota_update.py +15 -0
  14. luna_quantum/client/schemas/create/solve_job_create.py +1 -1
  15. luna_quantum/client/schemas/qpu_token/qpu_token.py +9 -16
  16. luna_quantum/client/schemas/qpu_token/token_provider.py +3 -6
  17. luna_quantum/errors.py +34 -1
  18. luna_quantum/errors.pyi +88 -26
  19. luna_quantum/solve/domain/solve_job.py +2 -2
  20. luna_quantum/solve/parameters/algorithms/base_params/quantum_annealing_params.py +1 -0
  21. luna_quantum/solve/parameters/algorithms/base_params/scipy_optimizer.py +4 -2
  22. luna_quantum/solve/parameters/algorithms/quantum_annealing/quantum_annealing.py +38 -22
  23. luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/optimizers.py +4 -2
  24. luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa.py +1 -3
  25. luna_quantum/solve/parameters/algorithms/quantum_gate/vqe.py +2 -3
  26. luna_quantum/solve/parameters/algorithms/search_algorithms/dialectic_search.py +0 -16
  27. luna_quantum/solve/parameters/backends/__init__.py +1 -1
  28. luna_quantum/solve/parameters/backends/dwave_qpu.py +4 -2
  29. luna_quantum/solve/parameters/backends/ibm.py +8 -2
  30. luna_quantum/solve/parameters/backends/qctrl.py +4 -3
  31. luna_quantum/solve/use_cases/hamiltonian_cycle.py +2 -2
  32. luna_quantum/solve/usecases/model_get_solution_usecase.py +4 -1
  33. luna_quantum/solve/usecases/solve_job_get_result_usecase.py +1 -3
  34. luna_quantum/transformations.py +18 -0
  35. luna_quantum/transformations.pyi +258 -0
  36. luna_quantum/translator.py +23 -1
  37. luna_quantum/translator.pyi +77 -44
  38. luna_quantum/util/debug_info.py +52 -0
  39. luna_quantum/util/log_utils.py +15 -11
  40. luna_quantum/utils.py +2 -53
  41. luna_quantum/utils.pyi +33 -1
  42. {luna_quantum-1.0.0.dist-info → luna_quantum-1.0.1.dist-info}/METADATA +2 -4
  43. {luna_quantum-1.0.0.dist-info → luna_quantum-1.0.1.dist-info}/RECORD +46 -40
  44. {luna_quantum-1.0.0.dist-info → luna_quantum-1.0.1.dist-info}/WHEEL +1 -1
  45. {luna_quantum-1.0.0.dist-info → luna_quantum-1.0.1.dist-info}/licenses/LICENSE +1 -1
  46. {luna_quantum-1.0.0.dist-info → luna_quantum-1.0.1.dist-info}/licenses/NOTICE +0 -0
@@ -17,8 +17,8 @@ class ZibTranslator:
17
17
 
18
18
  - Convert a Zib-style solution into our solution `Solution`.
19
19
 
20
- The conversions are especially required when interacting with external zib solvers/samplers or
21
- libraries that operate on zib-based problem-solving/sampling.
20
+ The conversions are especially required when interacting with external zib
21
+ solvers/samplers or libraries that operate on zib-based problem-solving/sampling.
22
22
 
23
23
  Examples
24
24
  --------
@@ -63,8 +63,8 @@ class ZibTranslator:
63
63
  NoActiveEnvironmentFoundError
64
64
  If no environment is passed to the method or available from the context.
65
65
  SolutionTranslationError
66
- Generally if the solution translation fails. Might be specified by one of the
67
- two following errors.
66
+ Generally if the solution translation fails. Might be specified by one of
67
+ the two following errors.
68
68
  SampleIncorrectLengthError
69
69
  If a solution's sample has a different number of variables than the model
70
70
  environment passed to the translator.
@@ -72,10 +72,13 @@ class ZibTranslator:
72
72
  If the result's variable types are incompatible with the model environment's
73
73
  variable types.
74
74
  """
75
+ ...
75
76
 
76
77
  class Qubo:
77
- """
78
- A wrapper around qubo matrices that holds all relevant metadata, e.g., the model offset.
78
+ """The result of the QuboTranslator.
79
+
80
+ A wrapper around qubo matrices that holds all relevant metadata,
81
+ e.g., the model offset.
79
82
  """
80
83
 
81
84
  @property
@@ -89,6 +92,7 @@ class Qubo:
89
92
  A square NumPy array representing the QUBO matrix derived from
90
93
  the model's objective.
91
94
  """
95
+ ...
92
96
 
93
97
  @property
94
98
  def variable_names(self, /) -> list[str]:
@@ -100,6 +104,7 @@ class Qubo:
100
104
  list[Variable]
101
105
  The variable names in the order they appear in the QUBO.
102
106
  """
107
+ ...
103
108
 
104
109
  @property
105
110
  def name(self, /) -> str:
@@ -111,6 +116,7 @@ class Qubo:
111
116
  str
112
117
  The model name.
113
118
  """
119
+ ...
114
120
 
115
121
  @property
116
122
  def offset(self, /) -> float:
@@ -122,6 +128,7 @@ class Qubo:
122
128
  float
123
129
  The constant offset of the model.
124
130
  """
131
+ ...
125
132
 
126
133
  @property
127
134
  def vtype(self, /) -> Vtype:
@@ -133,6 +140,7 @@ class Qubo:
133
140
  Vtype
134
141
  The variable type.
135
142
  """
143
+ ...
136
144
 
137
145
  class QuboTranslator:
138
146
  """
@@ -148,7 +156,7 @@ class QuboTranslator:
148
156
  Examples
149
157
  --------
150
158
  >>> import numpy as np
151
- >>> from luna_quantum import QuboTranslator, Vtype
159
+ >>> from luna_quantum.translator import QuboTranslator, Vtype
152
160
  >>> q = np.array([[1.0, -1.0], [-1.0, 2.0]])
153
161
 
154
162
  Create a model from a matrix:
@@ -200,6 +208,7 @@ class QuboTranslator:
200
208
  If a list of variable names is provided but contains duplicates or has an
201
209
  incorrect length.
202
210
  """
211
+ ...
203
212
 
204
213
  @staticmethod
205
214
  def from_aq(model: Model) -> Qubo:
@@ -215,9 +224,10 @@ class QuboTranslator:
215
224
  Returns
216
225
  -------
217
226
  Qubo
218
- An object representing a QUBO with information additional to the square NumPy array
219
- representing the QUBO matrix derived from the model's objective. This object also
220
- includes the `variable_ordering` as well as the `offset` of the original model.
227
+ An object representing a QUBO with information additional to the square
228
+ NumPy array representing the QUBO matrix derived from the model's objective.
229
+ This object also includes the `variable_ordering` as well as the `offset`
230
+ of the original model.
221
231
 
222
232
  Raises
223
233
  ------
@@ -234,6 +244,7 @@ class QuboTranslator:
234
244
  If the model contains different vtypes or vtypes other than binary and
235
245
  spin.
236
246
  """
247
+ ...
237
248
 
238
249
  class QctrlTranslator:
239
250
  """
@@ -242,8 +253,8 @@ class QctrlTranslator:
242
253
  `QctrlTranslator` provides methods to:
243
254
  - Convert a Qctrl-style solution into our solution `Solution`.
244
255
 
245
- The conversions are especially required when interacting with external qctrl solvers/samplers or
246
- libraries that operate on qctrl-based problem-solving/sampling.
256
+ The conversions are especially required when interacting with external qctrl
257
+ solvers/samplers or libraries that operate on qctrl-based problem-solving/sampling.
247
258
 
248
259
  Examples
249
260
  --------
@@ -291,8 +302,8 @@ class QctrlTranslator:
291
302
  NoActiveEnvironmentFoundError
292
303
  If no environment is passed to the method or available from the context.
293
304
  SolutionTranslationError
294
- Generally if the solution translation fails. Might be specified by one of the
295
- two following errors.
305
+ Generally if the solution translation fails. Might be specified by one of
306
+ the two following errors.
296
307
  SampleIncorrectLengthError
297
308
  If a solution's sample has a different number of variables than the model
298
309
  environment passed to the translator.
@@ -300,11 +311,13 @@ class QctrlTranslator:
300
311
  If the result's variable types are incompatible with the model environment's
301
312
  variable types.
302
313
  """
314
+ ...
303
315
 
304
316
  class NumpyTranslator:
305
- """
306
- Utility class for converting between a result consisting of numpy arrays and our solution
307
- format.
317
+ """Translate between numpy arrays and our solution format.
318
+
319
+ Utility class for converting between a result consisting of numpy arrays and our
320
+ solution format.
308
321
 
309
322
  `NumpyTranslator` provides methods to:
310
323
  - Convert a numpy-array result into our solution `Solution`.
@@ -340,8 +353,9 @@ class NumpyTranslator:
340
353
  *,
341
354
  env: Environment | None = ...,
342
355
  ) -> Solution:
343
- """
344
- Convert an IBM solution to our solution format.
356
+ """Convert a solution in the format of numpy arrays to our solution format.
357
+
358
+ Note that the optimization sense is always assumed to be minimization.
345
359
 
346
360
  Parameters
347
361
  ----------
@@ -359,8 +373,8 @@ class NumpyTranslator:
359
373
  NoActiveEnvironmentFoundError
360
374
  If no environment is passed to the method or available from the context.
361
375
  SolutionTranslationError
362
- Generally if the solution translation fails. Might be specified by one of the
363
- two following errors.
376
+ Generally if the solution translation fails. Might be specified by one of
377
+ the two following errors.
364
378
  SampleIncorrectLengthError
365
379
  If a solution's sample has a different number of variables than the model
366
380
  environment passed to the translator.
@@ -368,6 +382,7 @@ class NumpyTranslator:
368
382
  If the result's variable types are incompatible with the model environment's
369
383
  variable types.
370
384
  """
385
+ ...
371
386
 
372
387
  class LpTranslator:
373
388
  """
@@ -383,7 +398,7 @@ class LpTranslator:
383
398
  Examples
384
399
  --------
385
400
  >>> from pathlib import Path
386
- >>> from luna_quantum import LpTranslator
401
+ >>> from luna_quantum.translator import LpTranslator
387
402
  >>> lp_filepath = Path("path/to/the/lp_file")
388
403
 
389
404
  >>> model = LpTranslator.to_aq(lp_filepath)
@@ -398,7 +413,9 @@ class LpTranslator:
398
413
  def to_aq(file: Path) -> Model: ...
399
414
  @overload
400
415
  @staticmethod
401
- def to_aq(file: str) -> Model:
416
+ def to_aq(file: str) -> Model: ...
417
+ @staticmethod
418
+ def to_aq(file: str | Path) -> Model:
402
419
  """
403
420
  Convert an LP file into a symbolic `Model`.
404
421
 
@@ -422,13 +439,16 @@ class LpTranslator:
422
439
  TranslationError
423
440
  If the translation fails for a different reason.
424
441
  """
442
+ ...
425
443
 
426
444
  @overload
427
445
  @staticmethod
428
446
  def from_aq(model: Model) -> str: ...
429
447
  @overload
430
448
  @staticmethod
431
- def from_aq(model: Model, *, filepath: Path) -> None:
449
+ def from_aq(model: Model, *, filepath: Path) -> None: ...
450
+ @staticmethod
451
+ def from_aq(model: Model, *, filepath: Path | None = ...) -> None:
432
452
  """
433
453
  Convert a symbolic model to an LP file representation.
434
454
 
@@ -449,16 +469,16 @@ class LpTranslator:
449
469
  TranslationError
450
470
  If the translation fails for some reason.
451
471
  """
472
+ ...
452
473
 
453
474
  class IbmTranslator:
454
- """
455
- Utility class for converting between an IBM solution and our solution format.
475
+ """Utility class for converting between an IBM solution and our solution format.
456
476
 
457
477
  `IbmTranslator` provides methods to:
458
478
  - Convert an IBM-style solution into our solution `Solution`.
459
479
 
460
- The conversions are especially required when interacting with external ibm solvers/samplers or
461
- libraries that operate on ibm-based problem-solving/sampling.
480
+ The conversions are especially required when interacting with external ibm
481
+ solvers/samplers oe libraries that operate on ibm-based problem-solving/sampling.
462
482
 
463
483
  Examples
464
484
  --------
@@ -524,8 +544,8 @@ class IbmTranslator:
524
544
  NoActiveEnvironmentFoundError
525
545
  If no environment is passed to the method or available from the context.
526
546
  SolutionTranslationError
527
- Generally if the solution translation fails. Might be specified by one of the
528
- two following errors.
547
+ Generally if the solution translation fails. Might be specified by one of
548
+ the two following errors.
529
549
  SampleIncorrectLengthError
530
550
  If a solution's sample has a different number of variables than the model
531
551
  environment passed to the translator.
@@ -533,16 +553,17 @@ class IbmTranslator:
533
553
  If the result's variable types are incompatible with the model environment's
534
554
  variable types.
535
555
  """
556
+ ...
536
557
 
537
558
  class DwaveTranslator:
538
- """
539
- Utility class for converting between a DWAVE solution and our solution format.
559
+ """Utility class for converting between a DWAVE solution and our solution format.
540
560
 
541
561
  `DWaveSolutionTranslator` provides methods to:
542
562
  - Convert a dimod-style solution into our solution `Solution`.
543
563
 
544
564
  The conversions are especially required when interacting with external dwave/dimod
545
- solvers/samplers or libraries that operate on dwave/dimod-based problem-solving/sampling.
565
+ solvers/samplers or libraries that operate on dwave/dimod-based problem-solving/
566
+ sampling.
546
567
 
547
568
  Examples
548
569
  --------
@@ -590,8 +611,8 @@ class DwaveTranslator:
590
611
  NoActiveEnvironmentFoundError
591
612
  If no environment is passed to the method or available from the context.
592
613
  SolutionTranslationError
593
- Generally if the solution translation fails. Might be specified by one of the
594
- two following errors.
614
+ Generally if the solution translation fails. Might be specified by one of
615
+ the two following errors.
595
616
  SampleIncorrectLengthError
596
617
  If a solution's sample has a different number of variables than the model
597
618
  environment passed to the translator.
@@ -599,9 +620,11 @@ class DwaveTranslator:
599
620
  If the result's variable types are incompatible with the model environment's
600
621
  variable types.
601
622
  """
623
+ ...
602
624
 
603
625
  class CqmTranslator:
604
- """
626
+ """CQM to AQM translator.
627
+
605
628
  Utility class for converting between dimod.BinaryQuadraticModel (CQM) and symbolic
606
629
  models.
607
630
 
@@ -616,7 +639,7 @@ class CqmTranslator:
616
639
  --------
617
640
  >>> import dimod
618
641
  >>> import numpy as np
619
- >>> from luna_quantum import CqmTranslator, Vtype
642
+ >>> from luna_quantum.translator import CqmTranslator, Vtype
620
643
  >>> bqm = dimod.generators.gnm_random_bqm(5, 10, "BINARY")
621
644
 
622
645
  Create a model from a matrix:
@@ -650,6 +673,8 @@ class CqmTranslator:
650
673
  TranslationError
651
674
  If the translation fails for some reason.
652
675
  """
676
+ ...
677
+
653
678
  @staticmethod
654
679
  def from_aq(model: Model) -> ConstrainedQuadraticModel:
655
680
  """
@@ -671,9 +696,11 @@ class CqmTranslator:
671
696
  TranslationError
672
697
  If the translation fails for some reason.
673
698
  """
699
+ ...
674
700
 
675
701
  class BqmTranslator:
676
- """
702
+ """BQM to AQM translator.
703
+
677
704
  Utility class for converting between dimod.BinaryQuadraticModel (BQM) and symbolic
678
705
  models.
679
706
 
@@ -688,7 +715,7 @@ class BqmTranslator:
688
715
  --------
689
716
  >>> import dimod
690
717
  >>> import numpy as np
691
- >>> from luna_quantum import BqmTranslator, Vtype
718
+ >>> from luna_quantum.translator import BqmTranslator, Vtype
692
719
  >>> bqm = dimod.generators.gnm_random_bqm(5, 10, "BINARY")
693
720
 
694
721
  Create a model from a matrix:
@@ -705,7 +732,9 @@ class BqmTranslator:
705
732
  def to_aq(bqm: BinaryQuadraticModel) -> Model: ...
706
733
  @overload
707
734
  @staticmethod
708
- def to_aq(bqm: BinaryQuadraticModel, *, name: str) -> Model:
735
+ def to_aq(bqm: BinaryQuadraticModel, *, name: str) -> Model: ...
736
+ @staticmethod
737
+ def to_aq(bqm: BinaryQuadraticModel, *, name: str | None = ...) -> Model:
709
738
  """
710
739
  Convert a BQM into a symbolic `Model`.
711
740
 
@@ -721,6 +750,8 @@ class BqmTranslator:
721
750
  Model
722
751
  A symbolic model representing the given BQM.
723
752
  """
753
+ ...
754
+
724
755
  @staticmethod
725
756
  def from_aq(model: Model) -> BinaryQuadraticModel:
726
757
  """
@@ -752,6 +783,7 @@ class BqmTranslator:
752
783
  If the model contains different vtypes or vtypes other than binary and
753
784
  spin.
754
785
  """
786
+ ...
755
787
 
756
788
  class AwsTranslator:
757
789
  """
@@ -760,8 +792,8 @@ class AwsTranslator:
760
792
  `AwsTranslator` provides methods to:
761
793
  - Convert an AWS-style result into our solution `Solution`.
762
794
 
763
- The conversions are especially required when interacting with external aws solvers/samplers or
764
- libraries that operate on aws-based problem-solving/sampling.
795
+ The conversions are especially required when interacting with external aws
796
+ solvers/samplers or libraries that operate on aws-based problem-solving/sampling.
765
797
 
766
798
  Examples
767
799
  --------
@@ -808,8 +840,8 @@ class AwsTranslator:
808
840
  NoActiveEnvironmentFoundError
809
841
  If no environment is passed to the method or available from the context.
810
842
  SolutionTranslationError
811
- Generally if the solution translation fails. Might be specified by one of the
812
- two following errors.
843
+ Generally if the solution translation fails. Might be specified by one of
844
+ the two following errors.
813
845
  SampleIncorrectLengthError
814
846
  If a solution's sample has a different number of variables than the model
815
847
  environment passed to the translator.
@@ -817,6 +849,7 @@ class AwsTranslator:
817
849
  If the result's variable types are incompatible with the model environment's
818
850
  variable types.
819
851
  """
852
+ ...
820
853
 
821
854
  __all__ = [
822
855
  "AwsTranslator",
@@ -0,0 +1,52 @@
1
+ import platform
2
+ import sys
3
+ from logging import Logger
4
+
5
+ from rich import box
6
+ from rich.table import Table
7
+
8
+ from luna_quantum._core import __aq_model_version__, __luna_quantum_version__
9
+ from luna_quantum.util.log_utils import Logging
10
+
11
+ _logger: Logger = Logging.get_logger(__name__)
12
+ _pkg_list: list[str] = ["numpy", "pydantic"]
13
+
14
+
15
+ def debug_info() -> None:
16
+ """Print debug information."""
17
+ python_version = (
18
+ f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
19
+ )
20
+ os_info = f"{platform.system()} {platform.release()}"
21
+
22
+ # Get additional system information
23
+ architecture = platform.machine()
24
+ python_implementation = platform.python_implementation()
25
+
26
+ table = Table(
27
+ title="Luna Debug Information",
28
+ title_justify="left",
29
+ caption="System and environment details for troubleshooting",
30
+ box=box.MARKDOWN,
31
+ )
32
+ table.add_column("Property", style="cyan", no_wrap=True)
33
+ table.add_column("Version", style="green", no_wrap=True)
34
+
35
+ # Add rows to the table
36
+ table.add_row("Luna Quantum", f"{__luna_quantum_version__}")
37
+ table.add_row("AqModel", f"{__aq_model_version__}")
38
+ table.add_row("Python", f"{python_version}")
39
+ table.add_row("Python Implementation", f"{python_implementation}")
40
+ table.add_row("Operating System", f"{os_info}")
41
+ table.add_row("Architecture", f"{architecture}")
42
+
43
+ for package in _pkg_list:
44
+ try:
45
+ module = __import__(package)
46
+ version = getattr(module, "__version__", "pkg found, version unknown")
47
+ table.add_row(package, version)
48
+ except ImportError:
49
+ table.add_row(package, "pkg not found")
50
+
51
+ # Print the table to console
52
+ Logging.get_console().print(table)
@@ -56,6 +56,20 @@ class Logging:
56
56
  """
57
57
  return Logging._log_level
58
58
 
59
+ @staticmethod
60
+ def get_console() -> Console:
61
+ """Return a Rich console instance for use in logging."""
62
+ custom_theme = Theme(
63
+ {
64
+ "logging.level.debug": "bright_blue",
65
+ "logging.level.info": "bright_green",
66
+ "logging.level.warning": "bold bright_yellow",
67
+ "logging.level.error": "bold bright_red",
68
+ "logging.level.critical": "bold bright_magenta",
69
+ }
70
+ )
71
+ return Console(theme=custom_theme)
72
+
59
73
  @staticmethod
60
74
  def get_logger(name: str) -> logging.Logger:
61
75
  """Get a logger with the specified name and set up a RichHandler for it.
@@ -77,18 +91,8 @@ class Logging:
77
91
  if logger.hasHandlers():
78
92
  return logger
79
93
 
80
- custom_theme = Theme(
81
- {
82
- "logging.level.debug": "bright_blue",
83
- "logging.level.info": "bright_green",
84
- "logging.level.warning": "bold bright_yellow",
85
- "logging.level.error": "bold bright_red",
86
- "logging.level.critical": "bold bright_magenta",
87
- }
88
- )
89
- console = Console(theme=custom_theme)
90
94
  handler = RichHandler(
91
- console=console,
95
+ console=Logging.get_console(),
92
96
  rich_tracebacks=True,
93
97
  show_time=True,
94
98
  show_level=True,
luna_quantum/utils.py CHANGED
@@ -1,54 +1,3 @@
1
- from collections.abc import Iterable
1
+ """Utility module containing convenience functions."""
2
2
 
3
- from ._core import Expression, Variable
4
-
5
-
6
- def quicksum(
7
- iterable: Iterable[Expression | Variable | int | float],
8
- /,
9
- start: Expression | None = None,
10
- ) -> Expression:
11
- """
12
- Create an Expression based on an iterable of Expression, Variable, int or float elements.
13
- Note that either the `iterable` must contain at least one `Expression` or `Variable` or
14
- the start parameter is set.
15
-
16
- Parameters
17
- ----------
18
- iterable : Iterable[Expression | Variable | int | float]
19
- The iterable of elements to sum up.
20
- start : Expression | None, optional
21
- The starting value for the summation.
22
-
23
- Returns
24
- -------
25
- Expression
26
- The expression created based on the sum of the iterable elements.
27
-
28
- Raises
29
- ------
30
- TypeError
31
- If the `iterable` does not contain any Expression or Variable.
32
- If the `start` is not of type Expression.
33
- """
34
- items = list(iterable)
35
- if start is None:
36
- for item in items:
37
- if isinstance(item, Expression) or isinstance(item, Variable):
38
- start = Expression(env=item._environment) # type: ignore
39
- break
40
-
41
- if start is None:
42
- raise TypeError(
43
- "iterable must contain at least one Expression or Variable,or 'start' needs to be set."
44
- )
45
-
46
- if not isinstance(start, Expression):
47
- raise TypeError("start must be of type `Expression`")
48
-
49
- _start: Expression = start
50
-
51
- for item in items:
52
- _start += item
53
-
54
- return _start
3
+ from ._core.utils import * # type: ignore[reportMissingImports] # noqa: F403
luna_quantum/utils.pyi CHANGED
@@ -1,8 +1,38 @@
1
- from collections.abc import Iterable
1
+ from collections.abc import Generator, Iterable
2
2
  from typing import overload
3
3
 
4
4
  from aqmodels import Expression, Variable
5
5
 
6
+ @overload
7
+ def quicksum(iterable: Generator[Expression], /) -> Expression: ...
8
+ @overload
9
+ def quicksum(iterable: Generator[Variable], /) -> Expression: ...
10
+ @overload
11
+ def quicksum(iterable: Generator[int], /) -> Expression: ...
12
+ @overload
13
+ def quicksum(iterable: Generator[float], /) -> Expression: ...
14
+ @overload
15
+ def quicksum(
16
+ iterable: Generator[Expression], /, start: Expression | None = None
17
+ ) -> Expression: ...
18
+ @overload
19
+ def quicksum(
20
+ iterable: Generator[Variable], /, start: Expression | None = None
21
+ ) -> Expression: ...
22
+ @overload
23
+ def quicksum(
24
+ iterable: Generator[int], /, start: Expression | None = None
25
+ ) -> Expression: ...
26
+ @overload
27
+ def quicksum(
28
+ iterable: Generator[float], /, start: Expression | None = None
29
+ ) -> Expression: ...
30
+ @overload
31
+ def quicksum(
32
+ iterable: Generator[Expression | Variable | float | int],
33
+ /,
34
+ start: Expression | None = None,
35
+ ) -> Expression: ...
6
36
  @overload
7
37
  def quicksum(iterable: Iterable[Expression], /) -> Expression: ...
8
38
  @overload
@@ -33,3 +63,5 @@ def quicksum(
33
63
  /,
34
64
  start: Expression | None = None,
35
65
  ) -> Expression: ...
66
+
67
+ __all__ = ["quicksum"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: luna-quantum
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: License :: OSI Approved :: Apache Software License
6
6
  Classifier: Operating System :: OS Independent
@@ -10,15 +10,13 @@ Requires-Dist: numpy>=1
10
10
  Requires-Dist: pydantic[email]>=2.11.3,<3
11
11
  Requires-Dist: python-dateutil>=2.9.0,<3
12
12
  Requires-Dist: rich>=14.0.0
13
- Requires-Dist: networkx>=3.4.2,<4 ; extra == 'examples'
14
- Provides-Extra: examples
15
13
  License-File: LICENSE
16
14
  License-File: NOTICE
17
15
  Summary: Python SDK for Aqarios' Luna Platform
18
16
  Keywords: aqarios,luna,quantum computing,quantum optimization,optimization,sdk
19
17
  Author-email: Aqarios <pypi@aqarios.com>
20
18
  License: Apache-2.0
21
- Requires-Python: >=3.11.0, <4
19
+ Requires-Python: >=3.11.0, <3.14
22
20
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
23
21
  Project-URL: Homepage, https://aqarios.com/
24
22
  Project-URL: Documentation, https://docs.aqarios.com/