queus 0.0.1__tar.gz → 0.0.2__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,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: queus
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Python queue
5
5
  Home-page: https://github.com/Clinton-Abraham
6
6
  Author: Clinton Abraham
7
7
  Author-email: clintonabrahamc@gmail.com
8
- Keywords: queue,queues,telegrams
8
+ Keywords: queue,queues,telegram
9
9
  Classifier: Natural Language :: English
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Operating System :: OS Independent
@@ -31,7 +31,7 @@ Dynamic: requires-python
31
31
  Dynamic: summary
32
32
 
33
33
  <p align="center">
34
- 📦 <a href="https://pypi.org/project/Queue" style="text-decoration:none;">QUEUE</a>
34
+ 📦 <a href="https://pypi.org/project/Queus" style="text-decoration:none;">QUEUE</a>
35
35
  </p>
36
36
 
37
37
  <p align="center">
@@ -45,5 +45,28 @@ Dynamic: summary
45
45
  <summary>Installation</summary>
46
46
 
47
47
  ```bash
48
- pip install queue
48
+ pip install queus
49
49
  ```
50
+ </details>
51
+
52
+ <details>
53
+ <summary>Usage example</summary>
54
+
55
+ ```python
56
+ import asyncio
57
+ from Queue.functions import Queue
58
+ from Queue.functions import Queues
59
+
60
+ async def runtask():
61
+ print("Processing....")
62
+ await asyncio.sleep(10)
63
+
64
+ async def main():
65
+ await Queue.add("task01")
66
+ await Queue.add("task02")
67
+ await Queue.queue("task01", maximum=1)
68
+ await runtask()
69
+
70
+ asyncio.run(main())
71
+ ```
72
+ </details>
@@ -1,8 +1,8 @@
1
1
  appname = 'queus'
2
- version = '0.0.1'
2
+ version = '0.0.2'
3
3
  pythons = '~=3.10'
4
4
  clinton = 'Clinton Abraham'
5
- mention = ['queue', 'queues', 'telegrams']
5
+ mention = ['queue', 'queues', 'telegram']
6
6
  profile = 'https://github.com/Clinton-Abraham'
7
7
 
8
8
  DATA03 = 'Python queue'
@@ -18,4 +18,5 @@ DATA02 = ['Natural Language :: English',
18
18
  'Topic :: Software Development :: Libraries',
19
19
  'Topic :: Software Development :: Localization',
20
20
  'Topic :: Software Development :: User Interfaces',
21
- 'Topic :: Software Development :: Version Control',]
21
+ 'Topic :: Software Development :: Version Control',
22
+ ]
@@ -0,0 +1,3 @@
1
+ from .function02 import QUEUES
2
+ from .function02 import Queues
3
+ from .function01 import Queue
@@ -0,0 +1,46 @@
1
+ import asyncio
2
+ from .function02 import Queues
3
+ from ..exceptions import QueuedAlready
4
+ #================================================================================================
5
+
6
+ class Queue:
7
+
8
+ def __init__(self, **kwargs):
9
+ self.waiting = kwargs.get("wait", 1)
10
+ self.workers = kwargs.get("workers", 1)
11
+ self.maxsize = kwargs.get("maxsize", 100)
12
+ self.storage = kwargs.get("storage", Queues)
13
+
14
+ #================================================================================================
15
+
16
+ async def total(self):
17
+ return len(self.storage)
18
+
19
+ async def remove(self, uid):
20
+ self.storage.remove(uid) if uid in self.storage else 0
21
+
22
+ async def clean(self, uid=None):
23
+ self.storage.remove(uid) if uid else self.storage.clear()
24
+
25
+ async def position(self, uid):
26
+ return self.storage.index(uid) - self.workers + 1 if uid in self.storage else 0
27
+
28
+ async def add(self, uid, priority=-1):
29
+ if uid in self.storage: raise QueuedAlready()
30
+ self.storage.append(uid) if priority == -1 else self.storage.insert(priority, uid)
31
+
32
+ #================================================================================================
33
+
34
+ async def message(self, uid, imog, text, button=None):
35
+ if self.storage.index(uid) >= self.workers:
36
+ try: await imog.edit(text=text, reply_markup=button)
37
+ except Exception: pass
38
+
39
+ #================================================================================================
40
+
41
+ async def queue(self, uid):
42
+ while uid in self.storage:
43
+ if self.storage.index(uid) >= self.workers: await asyncio.sleep(self.waiting)
44
+ else: break
45
+
46
+ #================================================================================================
@@ -0,0 +1,2 @@
1
+ Queues = []
2
+ QUEUES = {}
@@ -0,0 +1 @@
1
+
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- 📦 <a href="https://pypi.org/project/Queue" style="text-decoration:none;">QUEUE</a>
2
+ 📦 <a href="https://pypi.org/project/Queus" style="text-decoration:none;">QUEUE</a>
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -13,5 +13,28 @@
13
13
  <summary>Installation</summary>
14
14
 
15
15
  ```bash
16
- pip install queue
16
+ pip install queus
17
17
  ```
18
+ </details>
19
+
20
+ <details>
21
+ <summary>Usage example</summary>
22
+
23
+ ```python
24
+ import asyncio
25
+ from Queue.functions import Queue
26
+ from Queue.functions import Queues
27
+
28
+ async def runtask():
29
+ print("Processing....")
30
+ await asyncio.sleep(10)
31
+
32
+ async def main():
33
+ await Queue.add("task01")
34
+ await Queue.add("task02")
35
+ await Queue.queue("task01", maximum=1)
36
+ await runtask()
37
+
38
+ asyncio.run(main())
39
+ ```
40
+ </details>
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: queus
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Python queue
5
5
  Home-page: https://github.com/Clinton-Abraham
6
6
  Author: Clinton Abraham
7
7
  Author-email: clintonabrahamc@gmail.com
8
- Keywords: queue,queues,telegrams
8
+ Keywords: queue,queues,telegram
9
9
  Classifier: Natural Language :: English
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Operating System :: OS Independent
@@ -31,7 +31,7 @@ Dynamic: requires-python
31
31
  Dynamic: summary
32
32
 
33
33
  <p align="center">
34
- 📦 <a href="https://pypi.org/project/Queue" style="text-decoration:none;">QUEUE</a>
34
+ 📦 <a href="https://pypi.org/project/Queus" style="text-decoration:none;">QUEUE</a>
35
35
  </p>
36
36
 
37
37
  <p align="center">
@@ -45,5 +45,28 @@ Dynamic: summary
45
45
  <summary>Installation</summary>
46
46
 
47
47
  ```bash
48
- pip install queue
48
+ pip install queus
49
49
  ```
50
+ </details>
51
+
52
+ <details>
53
+ <summary>Usage example</summary>
54
+
55
+ ```python
56
+ import asyncio
57
+ from Queue.functions import Queue
58
+ from Queue.functions import Queues
59
+
60
+ async def runtask():
61
+ print("Processing....")
62
+ await asyncio.sleep(10)
63
+
64
+ async def main():
65
+ await Queue.add("task01")
66
+ await Queue.add("task02")
67
+ await Queue.queue("task01", maximum=1)
68
+ await runtask()
69
+
70
+ asyncio.run(main())
71
+ ```
72
+ </details>
@@ -5,6 +5,9 @@ Queue/exceptions/__init__.py
5
5
  Queue/exceptions/exceptions.py
6
6
  Queue/functions/__init__.py
7
7
  Queue/functions/function01.py
8
+ Queue/functions/function02.py
9
+ Queue/scripts/__init__.py
10
+ Queue/scripts/script01.py
8
11
  queus.egg-info/PKG-INFO
9
12
  queus.egg-info/SOURCES.txt
10
13
  queus.egg-info/dependency_links.txt
@@ -1,2 +0,0 @@
1
- from .function01 import Queues
2
- from .function01 import Queue
@@ -1,39 +0,0 @@
1
- import asyncio
2
- from ..exceptions import QueuedAlready
3
- #======================================================================================
4
-
5
- Queues = []
6
-
7
- class Queue:
8
-
9
- async def add(uid, storage=Queues):
10
- if uid not in storage:
11
- storage.append(uid)
12
- else:
13
- raise QueuedAlready("ALREADY ADDED TO QUEUE")
14
-
15
- #======================================================================================
16
-
17
- async def delete(uid, storage=Queues):
18
- storage.remove(uid) if uid in storage else 0
19
-
20
- async def position(uid, storage=Queues):
21
- return storage.index(uid) if uid in storage else 0
22
-
23
- #======================================================================================
24
-
25
- async def queue(uid, wait=1, maximum=1, storage=Queues):
26
- while uid in storage:
27
- if storage.index(uid) + 1 > maximum:
28
- await asyncio.sleep(wait)
29
- else:
30
- break
31
-
32
- #======================================================================================
33
-
34
- async def message(imog, text, button=None, maximum=1, storage=Queues):
35
- if maximum < len(storage):
36
- try: await imog.edit(text=text, reply_markup=button)
37
- except Exception: pass
38
-
39
- #======================================================================================
File without changes
File without changes