k3priorityqueue 0.1.6__tar.gz → 0.1.8__tar.gz

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,22 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3priorityqueue
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Priority queue with weighted producer support
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pykit3/k3priorityqueue
8
8
  Project-URL: Documentation, https://k3priorityqueue.readthedocs.io
9
9
  Keywords: queue,priority-queue,producer,weighted
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: k3heap
@@ -61,12 +61,16 @@ producers = (
61
61
  (1, 1, [1] * 10),
62
62
  (2, 2, [2] * 10),
63
63
  (3, 3, [3] * 10),
64
+
64
65
  )
66
+
65
67
  pq = k3priorityqueue.PriorityQueue()
68
+
66
69
  for pid, prio, itr in producers:
67
70
  pq.add_producer(pid, prio, itr)
68
71
 
69
72
  count = {}
73
+
70
74
  for _ in range(12):
71
75
  val = pq.get()
72
76
  count[val] = count.get(val, 0) + 1
@@ -79,6 +83,7 @@ while True:
79
83
  val = pq.get()
80
84
  except k3priorityqueue.Empty as e:
81
85
  break
86
+
82
87
  count[val] = count.get(val, 0) + 1
83
88
  print(val)
84
89
 
@@ -86,7 +91,6 @@ print('consumed all: counts:', repr(count))
86
91
 
87
92
 
88
93
 
89
-
90
94
  # Install
91
95
 
92
96
  ```
@@ -96,7 +100,6 @@ pip install k3priorityqueue
96
100
  # Synopsis
97
101
 
98
102
  ```python
99
-
100
103
  import k3priorityqueue
101
104
 
102
105
  producers = (
@@ -115,17 +118,17 @@ for _ in range(12):
115
118
  count[val] = count.get(val, 0) + 1
116
119
  print(val)
117
120
 
118
- print('respect priority ratio: counts:', repr(count))
121
+ print("respect priority ratio: counts:", repr(count))
119
122
 
120
123
  while True:
121
124
  try:
122
125
  val = pq.get()
123
- except k3priorityqueue.Empty as e:
126
+ except k3priorityqueue.Empty:
124
127
  break
125
128
  count[val] = count.get(val, 0) + 1
126
129
  print(val)
127
130
 
128
- print('consumed all: counts:', repr(count))
131
+ print("consumed all: counts:", repr(count))
129
132
  ```
130
133
 
131
134
  # Author
@@ -23,12 +23,16 @@ producers = (
23
23
  (1, 1, [1] * 10),
24
24
  (2, 2, [2] * 10),
25
25
  (3, 3, [3] * 10),
26
+
26
27
  )
28
+
27
29
  pq = k3priorityqueue.PriorityQueue()
30
+
28
31
  for pid, prio, itr in producers:
29
32
  pq.add_producer(pid, prio, itr)
30
33
 
31
34
  count = {}
35
+
32
36
  for _ in range(12):
33
37
  val = pq.get()
34
38
  count[val] = count.get(val, 0) + 1
@@ -41,6 +45,7 @@ while True:
41
45
  val = pq.get()
42
46
  except k3priorityqueue.Empty as e:
43
47
  break
48
+
44
49
  count[val] = count.get(val, 0) + 1
45
50
  print(val)
46
51
 
@@ -48,7 +53,6 @@ print('consumed all: counts:', repr(count))
48
53
 
49
54
 
50
55
 
51
-
52
56
  # Install
53
57
 
54
58
  ```
@@ -58,7 +62,6 @@ pip install k3priorityqueue
58
62
  # Synopsis
59
63
 
60
64
  ```python
61
-
62
65
  import k3priorityqueue
63
66
 
64
67
  producers = (
@@ -77,17 +80,17 @@ for _ in range(12):
77
80
  count[val] = count.get(val, 0) + 1
78
81
  print(val)
79
82
 
80
- print('respect priority ratio: counts:', repr(count))
83
+ print("respect priority ratio: counts:", repr(count))
81
84
 
82
85
  while True:
83
86
  try:
84
87
  val = pq.get()
85
- except k3priorityqueue.Empty as e:
88
+ except k3priorityqueue.Empty:
86
89
  break
87
90
  count[val] = count.get(val, 0) + 1
88
91
  print(val)
89
92
 
90
- print('consumed all: counts:', repr(count))
93
+ print("consumed all: counts:", repr(count))
91
94
  ```
92
95
 
93
96
  # Author
@@ -1,22 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3priorityqueue
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Priority queue with weighted producer support
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pykit3/k3priorityqueue
8
8
  Project-URL: Documentation, https://k3priorityqueue.readthedocs.io
9
9
  Keywords: queue,priority-queue,producer,weighted
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: k3heap
@@ -61,12 +61,16 @@ producers = (
61
61
  (1, 1, [1] * 10),
62
62
  (2, 2, [2] * 10),
63
63
  (3, 3, [3] * 10),
64
+
64
65
  )
66
+
65
67
  pq = k3priorityqueue.PriorityQueue()
68
+
66
69
  for pid, prio, itr in producers:
67
70
  pq.add_producer(pid, prio, itr)
68
71
 
69
72
  count = {}
73
+
70
74
  for _ in range(12):
71
75
  val = pq.get()
72
76
  count[val] = count.get(val, 0) + 1
@@ -79,6 +83,7 @@ while True:
79
83
  val = pq.get()
80
84
  except k3priorityqueue.Empty as e:
81
85
  break
86
+
82
87
  count[val] = count.get(val, 0) + 1
83
88
  print(val)
84
89
 
@@ -86,7 +91,6 @@ print('consumed all: counts:', repr(count))
86
91
 
87
92
 
88
93
 
89
-
90
94
  # Install
91
95
 
92
96
  ```
@@ -96,7 +100,6 @@ pip install k3priorityqueue
96
100
  # Synopsis
97
101
 
98
102
  ```python
99
-
100
103
  import k3priorityqueue
101
104
 
102
105
  producers = (
@@ -115,17 +118,17 @@ for _ in range(12):
115
118
  count[val] = count.get(val, 0) + 1
116
119
  print(val)
117
120
 
118
- print('respect priority ratio: counts:', repr(count))
121
+ print("respect priority ratio: counts:", repr(count))
119
122
 
120
123
  while True:
121
124
  try:
122
125
  val = pq.get()
123
- except k3priorityqueue.Empty as e:
126
+ except k3priorityqueue.Empty:
124
127
  break
125
128
  count[val] = count.get(val, 0) + 1
126
129
  print(val)
127
130
 
128
- print('consumed all: counts:', repr(count))
131
+ print("consumed all: counts:", repr(count))
129
132
  ```
130
133
 
131
134
  # Author
@@ -8,7 +8,7 @@ default_priority = 10.0
8
8
  Empty = queue.Empty
9
9
 
10
10
 
11
- class Producer(object):
11
+ class Producer:
12
12
  """
13
13
  An internal class which tracks consumption state.
14
14
  It provides with a `get()` method to retrieve and item from it.
@@ -65,17 +65,13 @@ class Producer(object):
65
65
  self.cmp_key = (self.consumed, self.item_cost)
66
66
 
67
67
  def __str__(self):
68
- return "[{producer_id}={priority} c={consumed}]".format(
69
- producer_id=self.producer_id,
70
- priority=self.priority,
71
- consumed=self.consumed,
72
- )
68
+ return f"[{self.producer_id}={self.priority} c={self.consumed}]"
73
69
 
74
70
  def __lt__(self, b):
75
71
  return self.cmp_key < b.cmp_key
76
72
 
77
73
 
78
- class PriorityQueue(object):
74
+ class PriorityQueue:
79
75
  """
80
76
  A queue managing several `Producer` instances.
81
77
  It produces items by `Producer.priority`.
@@ -1,14 +1,14 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0"]
2
+ requires = ["setuptools>=77.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "k3priorityqueue"
7
- version = "0.1.6"
7
+ version = "0.1.8"
8
8
  description = "Priority queue with weighted producer support"
9
9
  readme = "README.md"
10
- license = {text = "MIT"}
11
- requires-python = ">=3.9"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
12
  authors = [
13
13
  { name = "Zhang Yanpo", email = "drdr.xp@gmail.com" }
14
14
  ]
@@ -17,12 +17,12 @@ classifiers = [
17
17
  "Development Status :: 4 - Beta",
18
18
  "Intended Audience :: Developers",
19
19
  "Topic :: Software Development :: Libraries",
20
- "License :: OSI Approved :: MIT License",
21
20
  "Programming Language :: Python :: 3",
22
- "Programming Language :: Python :: 3.9",
23
21
  "Programming Language :: Python :: 3.10",
24
22
  "Programming Language :: Python :: 3.11",
25
23
  "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
26
  ]
27
27
  dependencies = [
28
28
  "k3heap",
@@ -1,10 +1,11 @@
1
1
  import random
2
2
  import unittest
3
3
 
4
- import k3priorityqueue
5
4
  import k3thread
6
5
  import k3ut
7
6
 
7
+ import k3priorityqueue
8
+
8
9
  dd = k3ut.dd
9
10
 
10
11
 
File without changes
@@ -48,14 +48,14 @@ __version__ = version("k3priorityqueue")
48
48
 
49
49
  from .priorityqueue import (
50
50
  Empty,
51
- Producer,
52
51
  PriorityQueue,
52
+ Producer,
53
53
  default_priority,
54
54
  )
55
55
 
56
56
  __all__ = [
57
57
  "Empty",
58
- "Producer",
59
58
  "PriorityQueue",
59
+ "Producer",
60
60
  "default_priority",
61
61
  ]