quantum-loop 0.2.2__py3-none-any.whl → 0.2.4__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 quantum-loop might be problematic. Click here for more details.

ql/loop.py CHANGED
@@ -27,11 +27,11 @@ class QuantumLoop:
27
27
 
28
28
  Examples:
29
29
  >>> from ql import QuantumLoop
30
- >>> def task(item):
31
- ... return item * item
32
- >>> data = range(10)
30
+ >>> def task(num: int) -> int | None:
31
+ ... return num * num if num % 2 == 0 else None
32
+ >>> data = range(1, 10)
33
33
  >>> QuantumLoop(task, data).run()
34
- [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
34
+ [4, 16, 36, 64]
35
35
 
36
36
  Args:
37
37
  task: Function with a task algorithm.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantum-loop
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: A set of tools for quantum calculations.
5
5
  Project-URL: Homepage, https://github.com/kebasyaty/quantum-loop
6
6
  Project-URL: Repository, https://github.com/kebasyaty/quantum-loop
@@ -31,7 +31,7 @@ Description-Content-Type: text/markdown
31
31
  <p align="center">
32
32
  <a href="https://github.com/kebasyaty/quantum-loop">
33
33
  <img
34
- height="90"
34
+ height="80"
35
35
  alt="Logo"
36
36
  src="https://raw.githubusercontent.com/kebasyaty/quantum-loop/main/assets/logo.svg">
37
37
  </a>
@@ -94,12 +94,9 @@ uv add quantum-loop
94
94
  ## Usage
95
95
 
96
96
  ```python
97
- from ql import QuantumLoop, count_qubits
97
+ """Count qubits."""
98
98
 
99
-
100
- def task(num: int) -> int | None:
101
- """Quantum."""
102
- return num * num if num % 2 == 0 else None
99
+ from ql import count_qubits
103
100
 
104
101
 
105
102
  def main() -> None:
@@ -107,6 +104,23 @@ def main() -> None:
107
104
  num = count_qubits()
108
105
  print(num) # => 16
109
106
 
107
+
108
+ if __name__ == "__main__":
109
+ main()
110
+ ```
111
+
112
+ ```python
113
+ """QuantumLoop - LoopMode.PROCESS_POOL ."""
114
+
115
+ from ql import QuantumLoop
116
+
117
+
118
+ def task(num: int) -> int | None:
119
+ """Quantum."""
120
+ return num * num if num % 2 == 0 else None
121
+
122
+
123
+ def main() -> None:
110
124
  # Separation of the cycle into quantum algorithms for
111
125
  # multiprocessing data processing.
112
126
  data = range(1, 10)
@@ -114,6 +128,39 @@ def main() -> None:
114
128
  print(results) # => [4, 16, 36, 64]
115
129
 
116
130
 
131
+ if __name__ == "__main__":
132
+ main()
133
+ ```
134
+
135
+ ```python
136
+ """QuantumLoop - LoopMode.THREAD_POOL ."""
137
+
138
+ from pathlib import Path
139
+ from ql import LoopMode, QuantumLoop
140
+
141
+
142
+ def task(path: str) -> str:
143
+ """Quantum."""
144
+ with Path(path).open("r", encoding="utf-8") as f:
145
+ return f.readline().strip()
146
+
147
+
148
+ def main() -> None:
149
+ # Separation of the cycle into quantum algorithms for
150
+ # multiprocessing data processing.
151
+ data = [
152
+ "assets/files/file_1.txt",
153
+ "assets/files/file_2.txt",
154
+ "assets/files/file_3.txt",
155
+ ]
156
+ results = QuantumLoop(
157
+ task,
158
+ data,
159
+ mode=LoopMode.THREAD_POOL,
160
+ ).run()
161
+ print(results) # => ["Hello World 1", "Hello World 2", "Hello World 3"]
162
+
163
+
117
164
  if __name__ == "__main__":
118
165
  main()
119
166
  ```
@@ -0,0 +1,8 @@
1
+ ql/__init__.py,sha256=NLJqDzx9z_phVVusAGUxDyKJhW35_1Ex0PoiZbvStsQ,607
2
+ ql/loop.py,sha256=93zLjIp2_ao7AcQYtYKcpNd5wtaNEs46KoPy4obP0ZY,3802
3
+ ql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ ql/utils.py,sha256=7q9hj1Z3Yqmo2t4EpXDu5aQ8AaRpS984TsjHbiNaeCA,868
5
+ quantum_loop-0.2.4.dist-info/METADATA,sha256=wHmYfUFneQPoO-CYbfI3q7qic8D4HylTgzMxEnOd0j4,6856
6
+ quantum_loop-0.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ quantum_loop-0.2.4.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
8
+ quantum_loop-0.2.4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- ql/__init__.py,sha256=NLJqDzx9z_phVVusAGUxDyKJhW35_1Ex0PoiZbvStsQ,607
2
- ql/loop.py,sha256=4gU1lv_YbDfB3Ed03gzmFIhwOKlOwCCsw0zCfTUE4bI,3778
3
- ql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- ql/utils.py,sha256=7q9hj1Z3Yqmo2t4EpXDu5aQ8AaRpS984TsjHbiNaeCA,868
5
- quantum_loop-0.2.2.dist-info/METADATA,sha256=VjBC02si27KKEXmuTpLTzfXppY2j6lMWcFBGP0Cx44o,5990
6
- quantum_loop-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- quantum_loop-0.2.2.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
8
- quantum_loop-0.2.2.dist-info/RECORD,,