k3priorityqueue 0.1.5__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.5
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
@@ -39,7 +38,6 @@ Dynamic: license-file
39
38
  # k3priorityqueue
40
39
 
41
40
  [![Action-CI](https://github.com/pykit3/k3priorityqueue/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3priorityqueue/actions/workflows/python-package.yml)
42
- [![Build Status](https://travis-ci.com/pykit3/k3priorityqueue.svg?branch=master)](https://travis-ci.com/pykit3/k3priorityqueue)
43
41
  [![Documentation Status](https://readthedocs.org/projects/k3priorityqueue/badge/?version=stable)](https://k3priorityqueue.readthedocs.io/en/stable/?badge=stable)
44
42
  [![Package](https://img.shields.io/pypi/pyversions/k3priorityqueue)](https://pypi.org/project/k3priorityqueue)
45
43
 
@@ -62,12 +60,16 @@ producers = (
62
60
  (1, 1, [1] * 10),
63
61
  (2, 2, [2] * 10),
64
62
  (3, 3, [3] * 10),
63
+
65
64
  )
65
+
66
66
  pq = k3priorityqueue.PriorityQueue()
67
+
67
68
  for pid, prio, itr in producers:
68
69
  pq.add_producer(pid, prio, itr)
69
70
 
70
71
  count = {}
72
+
71
73
  for _ in range(12):
72
74
  val = pq.get()
73
75
  count[val] = count.get(val, 0) + 1
@@ -80,6 +82,7 @@ while True:
80
82
  val = pq.get()
81
83
  except k3priorityqueue.Empty as e:
82
84
  break
85
+
83
86
  count[val] = count.get(val, 0) + 1
84
87
  print(val)
85
88
 
@@ -87,7 +90,6 @@ print('consumed all: counts:', repr(count))
87
90
 
88
91
 
89
92
 
90
-
91
93
  # Install
92
94
 
93
95
  ```
@@ -97,7 +99,6 @@ pip install k3priorityqueue
97
99
  # Synopsis
98
100
 
99
101
  ```python
100
-
101
102
  import k3priorityqueue
102
103
 
103
104
  producers = (
@@ -116,17 +117,17 @@ for _ in range(12):
116
117
  count[val] = count.get(val, 0) + 1
117
118
  print(val)
118
119
 
119
- print('respect priority ratio: counts:', repr(count))
120
+ print("respect priority ratio: counts:", repr(count))
120
121
 
121
122
  while True:
122
123
  try:
123
124
  val = pq.get()
124
- except k3priorityqueue.Empty as e:
125
+ except k3priorityqueue.Empty:
125
126
  break
126
127
  count[val] = count.get(val, 0) + 1
127
128
  print(val)
128
129
 
129
- print('consumed all: counts:', repr(count))
130
+ print("consumed all: counts:", repr(count))
130
131
  ```
131
132
 
132
133
  # Author
@@ -1,7 +1,6 @@
1
1
  # k3priorityqueue
2
2
 
3
3
  [![Action-CI](https://github.com/pykit3/k3priorityqueue/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3priorityqueue/actions/workflows/python-package.yml)
4
- [![Build Status](https://travis-ci.com/pykit3/k3priorityqueue.svg?branch=master)](https://travis-ci.com/pykit3/k3priorityqueue)
5
4
  [![Documentation Status](https://readthedocs.org/projects/k3priorityqueue/badge/?version=stable)](https://k3priorityqueue.readthedocs.io/en/stable/?badge=stable)
6
5
  [![Package](https://img.shields.io/pypi/pyversions/k3priorityqueue)](https://pypi.org/project/k3priorityqueue)
7
6
 
@@ -24,12 +23,16 @@ producers = (
24
23
  (1, 1, [1] * 10),
25
24
  (2, 2, [2] * 10),
26
25
  (3, 3, [3] * 10),
26
+
27
27
  )
28
+
28
29
  pq = k3priorityqueue.PriorityQueue()
30
+
29
31
  for pid, prio, itr in producers:
30
32
  pq.add_producer(pid, prio, itr)
31
33
 
32
34
  count = {}
35
+
33
36
  for _ in range(12):
34
37
  val = pq.get()
35
38
  count[val] = count.get(val, 0) + 1
@@ -42,6 +45,7 @@ while True:
42
45
  val = pq.get()
43
46
  except k3priorityqueue.Empty as e:
44
47
  break
48
+
45
49
  count[val] = count.get(val, 0) + 1
46
50
  print(val)
47
51
 
@@ -49,7 +53,6 @@ print('consumed all: counts:', repr(count))
49
53
 
50
54
 
51
55
 
52
-
53
56
  # Install
54
57
 
55
58
  ```
@@ -59,7 +62,6 @@ pip install k3priorityqueue
59
62
  # Synopsis
60
63
 
61
64
  ```python
62
-
63
65
  import k3priorityqueue
64
66
 
65
67
  producers = (
@@ -78,17 +80,17 @@ for _ in range(12):
78
80
  count[val] = count.get(val, 0) + 1
79
81
  print(val)
80
82
 
81
- print('respect priority ratio: counts:', repr(count))
83
+ print("respect priority ratio: counts:", repr(count))
82
84
 
83
85
  while True:
84
86
  try:
85
87
  val = pq.get()
86
- except k3priorityqueue.Empty as e:
88
+ except k3priorityqueue.Empty:
87
89
  break
88
90
  count[val] = count.get(val, 0) + 1
89
91
  print(val)
90
92
 
91
- print('consumed all: counts:', repr(count))
93
+ print("consumed all: counts:", repr(count))
92
94
  ```
93
95
 
94
96
  # Author
@@ -1,22 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3priorityqueue
3
- Version: 0.1.5
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
@@ -39,7 +38,6 @@ Dynamic: license-file
39
38
  # k3priorityqueue
40
39
 
41
40
  [![Action-CI](https://github.com/pykit3/k3priorityqueue/actions/workflows/python-package.yml/badge.svg)](https://github.com/pykit3/k3priorityqueue/actions/workflows/python-package.yml)
42
- [![Build Status](https://travis-ci.com/pykit3/k3priorityqueue.svg?branch=master)](https://travis-ci.com/pykit3/k3priorityqueue)
43
41
  [![Documentation Status](https://readthedocs.org/projects/k3priorityqueue/badge/?version=stable)](https://k3priorityqueue.readthedocs.io/en/stable/?badge=stable)
44
42
  [![Package](https://img.shields.io/pypi/pyversions/k3priorityqueue)](https://pypi.org/project/k3priorityqueue)
45
43
 
@@ -62,12 +60,16 @@ producers = (
62
60
  (1, 1, [1] * 10),
63
61
  (2, 2, [2] * 10),
64
62
  (3, 3, [3] * 10),
63
+
65
64
  )
65
+
66
66
  pq = k3priorityqueue.PriorityQueue()
67
+
67
68
  for pid, prio, itr in producers:
68
69
  pq.add_producer(pid, prio, itr)
69
70
 
70
71
  count = {}
72
+
71
73
  for _ in range(12):
72
74
  val = pq.get()
73
75
  count[val] = count.get(val, 0) + 1
@@ -80,6 +82,7 @@ while True:
80
82
  val = pq.get()
81
83
  except k3priorityqueue.Empty as e:
82
84
  break
85
+
83
86
  count[val] = count.get(val, 0) + 1
84
87
  print(val)
85
88
 
@@ -87,7 +90,6 @@ print('consumed all: counts:', repr(count))
87
90
 
88
91
 
89
92
 
90
-
91
93
  # Install
92
94
 
93
95
  ```
@@ -97,7 +99,6 @@ pip install k3priorityqueue
97
99
  # Synopsis
98
100
 
99
101
  ```python
100
-
101
102
  import k3priorityqueue
102
103
 
103
104
  producers = (
@@ -116,17 +117,17 @@ for _ in range(12):
116
117
  count[val] = count.get(val, 0) + 1
117
118
  print(val)
118
119
 
119
- print('respect priority ratio: counts:', repr(count))
120
+ print("respect priority ratio: counts:", repr(count))
120
121
 
121
122
  while True:
122
123
  try:
123
124
  val = pq.get()
124
- except k3priorityqueue.Empty as e:
125
+ except k3priorityqueue.Empty:
125
126
  break
126
127
  count[val] = count.get(val, 0) + 1
127
128
  print(val)
128
129
 
129
- print('consumed all: counts:', repr(count))
130
+ print("consumed all: counts:", repr(count))
130
131
  ```
131
132
 
132
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.5"
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
  ]