Jedutils 0.2.5__tar.gz → 0.2.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.
- {Jedutils-0.2.5 → jedutils-0.2.7}/Jedutils.egg-info/PKG-INFO +16 -6
- {Jedutils-0.2.5 → jedutils-0.2.7}/Jedutils.egg-info/SOURCES.txt +1 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/PKG-INFO +16 -6
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/__init__.py +1 -1
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/_async_redis_pipe.py +11 -9
- jedutils-0.2.7/jedutils/strings/_numerals.py +46 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/Jedutils.egg-info/dependency_links.txt +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/Jedutils.egg-info/requires.txt +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/Jedutils.egg-info/top_level.txt +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/LICENSE +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/MANIFEST.in +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/README.md +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/_concurrency_manager.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/_run_async.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/_rwlock.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/network/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/asyncio/network/_dl.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/base62/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/base62/b62.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/databases/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/databases/_in_memory.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/math/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/math/_number_formatter.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/strings/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/strings/_chunked_text.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/strings/_random_string.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/tdlib/__init__.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/jedutils/tdlib/arithmetic.py +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/setup.cfg +0 -0
- {Jedutils-0.2.5 → jedutils-0.2.7}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: Jedutils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Jedutils is a Python utilities package that provides a collection of useful helper functions.
|
|
5
5
|
Home-page: https://github.com/AYMENJD/jedutils
|
|
6
6
|
Author: AYMEN Mohammed
|
|
@@ -9,10 +9,22 @@ License: MIT
|
|
|
9
9
|
Project-URL: Source, https://github.com/AYMENJD/jedutils
|
|
10
10
|
Project-URL: Tracker, https://github.com/AYMENJD/jedutils/issues
|
|
11
11
|
Keywords: utilities,tools,library,helper,functions,development
|
|
12
|
-
Platform: UNKNOWN
|
|
13
12
|
Description-Content-Type: text/markdown
|
|
14
|
-
Provides-Extra: all
|
|
15
13
|
License-File: LICENSE
|
|
14
|
+
Provides-Extra: all
|
|
15
|
+
Requires-Dist: redis; extra == "all"
|
|
16
|
+
Requires-Dist: aiohttp; extra == "all"
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: keywords
|
|
23
|
+
Dynamic: license
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: project-url
|
|
26
|
+
Dynamic: provides-extra
|
|
27
|
+
Dynamic: summary
|
|
16
28
|
|
|
17
29
|
# Jedutils [](https://pypi.org/project/jedutils) [](https://pepy.tech/project/jedutils)
|
|
18
30
|
|
|
@@ -38,5 +50,3 @@ Contributions to Jedutils are welcome! If you have an idea for a new utility or
|
|
|
38
50
|
## License
|
|
39
51
|
|
|
40
52
|
Jedutils is licensed under the MIT License. See the `LICENSE` file for details.
|
|
41
|
-
|
|
42
|
-
|
|
@@ -23,6 +23,7 @@ jedutils/math/__init__.py
|
|
|
23
23
|
jedutils/math/_number_formatter.py
|
|
24
24
|
jedutils/strings/__init__.py
|
|
25
25
|
jedutils/strings/_chunked_text.py
|
|
26
|
+
jedutils/strings/_numerals.py
|
|
26
27
|
jedutils/strings/_random_string.py
|
|
27
28
|
jedutils/tdlib/__init__.py
|
|
28
29
|
jedutils/tdlib/arithmetic.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: Jedutils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Jedutils is a Python utilities package that provides a collection of useful helper functions.
|
|
5
5
|
Home-page: https://github.com/AYMENJD/jedutils
|
|
6
6
|
Author: AYMEN Mohammed
|
|
@@ -9,10 +9,22 @@ License: MIT
|
|
|
9
9
|
Project-URL: Source, https://github.com/AYMENJD/jedutils
|
|
10
10
|
Project-URL: Tracker, https://github.com/AYMENJD/jedutils/issues
|
|
11
11
|
Keywords: utilities,tools,library,helper,functions,development
|
|
12
|
-
Platform: UNKNOWN
|
|
13
12
|
Description-Content-Type: text/markdown
|
|
14
|
-
Provides-Extra: all
|
|
15
13
|
License-File: LICENSE
|
|
14
|
+
Provides-Extra: all
|
|
15
|
+
Requires-Dist: redis; extra == "all"
|
|
16
|
+
Requires-Dist: aiohttp; extra == "all"
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: keywords
|
|
23
|
+
Dynamic: license
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: project-url
|
|
26
|
+
Dynamic: provides-extra
|
|
27
|
+
Dynamic: summary
|
|
16
28
|
|
|
17
29
|
# Jedutils [](https://pypi.org/project/jedutils) [](https://pepy.tech/project/jedutils)
|
|
18
30
|
|
|
@@ -38,5 +50,3 @@ Contributions to Jedutils are welcome! If you have an idea for a new utility or
|
|
|
38
50
|
## License
|
|
39
51
|
|
|
40
52
|
Jedutils is licensed under the MIT License. See the `LICENSE` file for details.
|
|
41
|
-
|
|
42
|
-
|
|
@@ -21,6 +21,8 @@ class AsyncRedisPipe:
|
|
|
21
21
|
>>> redis_calls = [pipe.get("key") for i in range(100000)]
|
|
22
22
|
>>> await asyncio.gather(*redis_calls) # 100K Concurrent redis calls
|
|
23
23
|
|
|
24
|
+
Disclaimer:
|
|
25
|
+
This class is intended to be used with basic redis commands, other non redis commands (a.k.a client side commands) are not supported (eg. `redis.lock`) and such call can have unexpected behavior.
|
|
24
26
|
"""
|
|
25
27
|
|
|
26
28
|
def __init__(
|
|
@@ -94,15 +96,19 @@ class AsyncRedisPipe:
|
|
|
94
96
|
if self.debug:
|
|
95
97
|
self.logger.debug(f"Executing command: {data[1]}")
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
try:
|
|
100
|
+
getattr(pipe, data[1])(*data[2], **data[3])
|
|
101
|
+
except Exception as e:
|
|
102
|
+
data[0].set_exception(e)
|
|
103
|
+
continue
|
|
104
|
+
|
|
98
105
|
futures.append(data[0])
|
|
99
106
|
count += 1
|
|
100
107
|
|
|
101
108
|
self.__loop.create_task(self.__handle_pipe_line(futures, pipe))
|
|
102
109
|
|
|
103
110
|
async def __handle_pipe_line(self, futures: list, pipe):
|
|
104
|
-
|
|
105
|
-
for x, result in enumerate(results):
|
|
111
|
+
for x, result in enumerate((await pipe.execute(False))):
|
|
106
112
|
if self.debug:
|
|
107
113
|
self.logger.debug(f"Result: {result}")
|
|
108
114
|
|
|
@@ -112,13 +118,9 @@ class AsyncRedisPipe:
|
|
|
112
118
|
futures[x].set_result(result)
|
|
113
119
|
|
|
114
120
|
def __getattr__(self, name):
|
|
115
|
-
|
|
116
|
-
name = "del"
|
|
117
|
-
|
|
118
|
-
def wrapper(*args):
|
|
121
|
+
def wrapper(*args, **kwargs):
|
|
119
122
|
fut = asyncio.Future()
|
|
120
|
-
|
|
121
|
-
self.__queue.put_nowait((fut, args))
|
|
123
|
+
self.__queue.put_nowait((fut, name, args, kwargs))
|
|
122
124
|
return fut
|
|
123
125
|
|
|
124
126
|
return wrapper
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
arabic_indic_digits = str.maketrans(
|
|
2
|
+
"0123456789", "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669"
|
|
3
|
+
)
|
|
4
|
+
english_digits = str.maketrans(
|
|
5
|
+
"\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669", "0123456789"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def to_arabic_nums(string: str):
|
|
10
|
+
"""
|
|
11
|
+
Convert a string with english numerals to Arabic numerals
|
|
12
|
+
|
|
13
|
+
Example:
|
|
14
|
+
.. code-block:: python
|
|
15
|
+
>>> to_arabic_nums("1234")
|
|
16
|
+
'١٢٣٤'
|
|
17
|
+
|
|
18
|
+
Parameters:
|
|
19
|
+
string (``str`` || ``int``):
|
|
20
|
+
The string or integer containing English numerals to convert to Arabic numerals
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
``str``: The string with digits converted to Arabic numerals
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
return str(string).translate(arabic_indic_digits)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def to_english_nums(string: str):
|
|
30
|
+
"""
|
|
31
|
+
Convert a string with Arabic numerals to English numerals
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
.. code-block:: python
|
|
35
|
+
>>> to_english_nums("١٢٣٤")
|
|
36
|
+
'1234'
|
|
37
|
+
|
|
38
|
+
Parameters:
|
|
39
|
+
string (``str`` || ``int``):
|
|
40
|
+
The string or integer containing Arabic numerals to convert to English numerals
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
``str``: The string with Arabic numerals converted to English numerals
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
return str(string).translate(english_digits)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|