k3priorityqueue 0.1.6__tar.gz → 0.1.7__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,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3priorityqueue
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
+ Requires-Python: >=3.10
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
22
21
  Requires-Dist: k3heap
@@ -61,12 +60,16 @@ producers = (
61
60
  (1, 1, [1] * 10),
62
61
  (2, 2, [2] * 10),
63
62
  (3, 3, [3] * 10),
63
+
64
64
  )
65
+
65
66
  pq = k3priorityqueue.PriorityQueue()
67
+
66
68
  for pid, prio, itr in producers:
67
69
  pq.add_producer(pid, prio, itr)
68
70
 
69
71
  count = {}
72
+
70
73
  for _ in range(12):
71
74
  val = pq.get()
72
75
  count[val] = count.get(val, 0) + 1
@@ -79,6 +82,7 @@ while True:
79
82
  val = pq.get()
80
83
  except k3priorityqueue.Empty as e:
81
84
  break
85
+
82
86
  count[val] = count.get(val, 0) + 1
83
87
  print(val)
84
88
 
@@ -86,7 +90,6 @@ print('consumed all: counts:', repr(count))
86
90
 
87
91
 
88
92
 
89
-
90
93
  # Install
91
94
 
92
95
  ```
@@ -96,7 +99,6 @@ pip install k3priorityqueue
96
99
  # Synopsis
97
100
 
98
101
  ```python
99
-
100
102
  import k3priorityqueue
101
103
 
102
104
  producers = (
@@ -115,17 +117,17 @@ for _ in range(12):
115
117
  count[val] = count.get(val, 0) + 1
116
118
  print(val)
117
119
 
118
- print('respect priority ratio: counts:', repr(count))
120
+ print("respect priority ratio: counts:", repr(count))
119
121
 
120
122
  while True:
121
123
  try:
122
124
  val = pq.get()
123
- except k3priorityqueue.Empty as e:
125
+ except k3priorityqueue.Empty:
124
126
  break
125
127
  count[val] = count.get(val, 0) + 1
126
128
  print(val)
127
129
 
128
- print('consumed all: counts:', repr(count))
130
+ print("consumed all: counts:", repr(count))
129
131
  ```
130
132
 
131
133
  # 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,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3priorityqueue
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
+ Requires-Python: >=3.10
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
22
21
  Requires-Dist: k3heap
@@ -61,12 +60,16 @@ producers = (
61
60
  (1, 1, [1] * 10),
62
61
  (2, 2, [2] * 10),
63
62
  (3, 3, [3] * 10),
63
+
64
64
  )
65
+
65
66
  pq = k3priorityqueue.PriorityQueue()
67
+
66
68
  for pid, prio, itr in producers:
67
69
  pq.add_producer(pid, prio, itr)
68
70
 
69
71
  count = {}
72
+
70
73
  for _ in range(12):
71
74
  val = pq.get()
72
75
  count[val] = count.get(val, 0) + 1
@@ -79,6 +82,7 @@ while True:
79
82
  val = pq.get()
80
83
  except k3priorityqueue.Empty as e:
81
84
  break
85
+
82
86
  count[val] = count.get(val, 0) + 1
83
87
  print(val)
84
88
 
@@ -86,7 +90,6 @@ print('consumed all: counts:', repr(count))
86
90
 
87
91
 
88
92
 
89
-
90
93
  # Install
91
94
 
92
95
  ```
@@ -96,7 +99,6 @@ pip install k3priorityqueue
96
99
  # Synopsis
97
100
 
98
101
  ```python
99
-
100
102
  import k3priorityqueue
101
103
 
102
104
  producers = (
@@ -115,17 +117,17 @@ for _ in range(12):
115
117
  count[val] = count.get(val, 0) + 1
116
118
  print(val)
117
119
 
118
- print('respect priority ratio: counts:', repr(count))
120
+ print("respect priority ratio: counts:", repr(count))
119
121
 
120
122
  while True:
121
123
  try:
122
124
  val = pq.get()
123
- except k3priorityqueue.Empty as e:
125
+ except k3priorityqueue.Empty:
124
126
  break
125
127
  count[val] = count.get(val, 0) + 1
126
128
  print(val)
127
129
 
128
- print('consumed all: counts:', repr(count))
130
+ print("consumed all: counts:", repr(count))
129
131
  ```
130
132
 
131
133
  # 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.7"
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,11 @@ 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",
26
25
  ]
27
26
  dependencies = [
28
27
  "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
  ]