Jedutils 0.2.5__tar.gz → 0.2.6__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.6}/Jedutils.egg-info/PKG-INFO +1 -1
- {Jedutils-0.2.5 → Jedutils-0.2.6}/Jedutils.egg-info/SOURCES.txt +1 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/PKG-INFO +1 -1
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/__init__.py +1 -1
- Jedutils-0.2.6/jedutils/strings/_numerals.py +46 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/Jedutils.egg-info/dependency_links.txt +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/Jedutils.egg-info/requires.txt +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/Jedutils.egg-info/top_level.txt +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/LICENSE +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/MANIFEST.in +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/README.md +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/_async_redis_pipe.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/_concurrency_manager.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/_run_async.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/_rwlock.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/network/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/asyncio/network/_dl.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/base62/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/base62/b62.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/databases/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/databases/_in_memory.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/math/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/math/_number_formatter.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/strings/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/strings/_chunked_text.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/strings/_random_string.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/tdlib/__init__.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/jedutils/tdlib/arithmetic.py +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/setup.cfg +0 -0
- {Jedutils-0.2.5 → Jedutils-0.2.6}/setup.py +0 -0
|
@@ -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
|
|
@@ -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
|
|
File without changes
|