Jedutils 0.2.3__tar.gz → 0.2.4__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.
Files changed (31) hide show
  1. {Jedutils-0.2.3 → Jedutils-0.2.4}/Jedutils.egg-info/PKG-INFO +1 -1
  2. {Jedutils-0.2.3 → Jedutils-0.2.4}/Jedutils.egg-info/SOURCES.txt +3 -1
  3. {Jedutils-0.2.3 → Jedutils-0.2.4}/PKG-INFO +1 -1
  4. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/__init__.py +1 -1
  5. Jedutils-0.2.4/jedutils/base62/__init__.py +3 -0
  6. Jedutils-0.2.4/jedutils/tdlib/__init__.py +15 -0
  7. Jedutils-0.2.4/jedutils/tdlib/arithmetic.py +105 -0
  8. Jedutils-0.2.3/jedutils/base62/__init__.py +0 -1
  9. {Jedutils-0.2.3 → Jedutils-0.2.4}/Jedutils.egg-info/dependency_links.txt +0 -0
  10. {Jedutils-0.2.3 → Jedutils-0.2.4}/Jedutils.egg-info/requires.txt +0 -0
  11. {Jedutils-0.2.3 → Jedutils-0.2.4}/Jedutils.egg-info/top_level.txt +0 -0
  12. {Jedutils-0.2.3 → Jedutils-0.2.4}/LICENSE +0 -0
  13. {Jedutils-0.2.3 → Jedutils-0.2.4}/MANIFEST.in +0 -0
  14. {Jedutils-0.2.3 → Jedutils-0.2.4}/README.md +0 -0
  15. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/__init__.py +0 -0
  16. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/_async_redis_pipe.py +0 -0
  17. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/_concurrency_manager.py +0 -0
  18. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/_run_async.py +0 -0
  19. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/_rwlock.py +0 -0
  20. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/network/__init__.py +0 -0
  21. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/asyncio/network/_dl.py +0 -0
  22. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/base62/b62.py +0 -0
  23. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/databases/__init__.py +0 -0
  24. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/databases/_in_memory.py +0 -0
  25. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/math/__init__.py +0 -0
  26. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/math/_number_formatter.py +0 -0
  27. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/strings/__init__.py +0 -0
  28. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/strings/_chunked_text.py +0 -0
  29. {Jedutils-0.2.3 → Jedutils-0.2.4}/jedutils/strings/_random_string.py +0 -0
  30. {Jedutils-0.2.3 → Jedutils-0.2.4}/setup.cfg +0 -0
  31. {Jedutils-0.2.3 → Jedutils-0.2.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Jedutils
3
- Version: 0.2.3
3
+ Version: 0.2.4
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
@@ -23,4 +23,6 @@ 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/_random_string.py
26
+ jedutils/strings/_random_string.py
27
+ jedutils/tdlib/__init__.py
28
+ jedutils/tdlib/arithmetic.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Jedutils
3
- Version: 0.2.3
3
+ Version: 0.2.4
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
@@ -1,3 +1,3 @@
1
- __version__ = "0.2.3"
1
+ __version__ = "0.2.4"
2
2
  __copyright__ = "Copyright (c) 2023-2024 AYMEN Mohammed ~ https://github.com/AYMENJD"
3
3
  __license__ = "MIT License"
@@ -0,0 +1,3 @@
1
+ from .b62 import BASE62_CHARS, b62encode, b62decode
2
+
3
+ __all__ = ["BASE62_CHARS", "b62encode", "b62decode"]
@@ -0,0 +1,15 @@
1
+ from .arithmetic import (
2
+ as_tdlib_message_id,
3
+ as_server_message_id,
4
+ as_server_message_id_unchecked,
5
+ get_supergroup_chat_id,
6
+ get_supergroup_id,
7
+ )
8
+
9
+ __all__ = (
10
+ "as_tdlib_message_id",
11
+ "as_server_message_id",
12
+ "as_server_message_id_unchecked",
13
+ "get_supergroup_chat_id",
14
+ "get_supergroup_id",
15
+ )
@@ -0,0 +1,105 @@
1
+ def as_tdlib_message_id(message_id: int) -> int:
2
+ """
3
+ Convert server message ID to TDLib message ID
4
+
5
+ \Example:
6
+ .. code-block:: python
7
+
8
+ >>> as_tdlib_message_id(12345)
9
+ 12944670720
10
+
11
+ \Parameters:
12
+ message_id (``int``):
13
+ Server message ID
14
+
15
+ \Returns:
16
+ ``int``: TDLib message ID
17
+ """
18
+
19
+ return message_id << 20
20
+
21
+
22
+ def as_server_message_id(message_id: int) -> int:
23
+ """
24
+ Converts TDLib message ID to server message ID
25
+
26
+ \Example:
27
+ .. code-block:: python
28
+
29
+ >>> as_server_message_id(12944670720)
30
+ 12345
31
+
32
+ \Parameters:
33
+ message_id (``int``):
34
+ TDLib message ID
35
+
36
+ \Returns:
37
+ ``int``: The server message ID
38
+ """
39
+
40
+ result = message_id >> 20
41
+ assert as_tdlib_message_id(result) == message_id
42
+ return result
43
+
44
+
45
+ def as_server_message_id_unchecked(message_id: int) -> int:
46
+ """
47
+ Converts TDLib message ID to server message ID
48
+
49
+ \Example:
50
+ >>> as_server_message_id_unchecked(12944670720)
51
+ 12345
52
+ >>> as_server_message_id_unchecked(12944670721) # Invalid ID
53
+ 0
54
+
55
+ \Parameters:
56
+ message_id (``int``):
57
+ TDLib message ID
58
+
59
+ \Returns:
60
+ ``int``:
61
+ The server message ID or 0 if the conversion is invalid
62
+ """
63
+
64
+ result = message_id >> 20
65
+ if as_tdlib_message_id(result) != message_id:
66
+ return 0
67
+ return result
68
+
69
+
70
+ def get_supergroup_chat_id(supergroup_id: int) -> int:
71
+ """
72
+ Convert supergroup_id to chat_id
73
+
74
+ \Example:
75
+ >>> get_supergroup_chat_id(-123456789)
76
+ -1000123456789
77
+
78
+ \Parameters:
79
+ supergroup_id (``int``):
80
+ ID of the supergroup
81
+
82
+ \Returns:
83
+ ``int``: The chat ID of the supergroup
84
+ """
85
+
86
+ return -1000000000000 - (supergroup_id if supergroup_id > 0 else -supergroup_id)
87
+
88
+
89
+ def get_supergroup_id(chat_id: int) -> int:
90
+ """
91
+ Convert chat_id to supergroup_id
92
+
93
+ Example:
94
+ >>> get_supergroup_id(-1000123456789)
95
+ -123456789
96
+
97
+ Parameters:
98
+ chat_id (``int``):
99
+ The chat ID to convert to a supergroup ID
100
+
101
+ Returns:
102
+ ``int``: The supergroup ID
103
+ """
104
+
105
+ return -(-1000000000000 - chat_id)
@@ -1 +0,0 @@
1
- from .b62 import BASE62_CHARS, b62encode, b62decode
File without changes
File without changes
File without changes
File without changes
File without changes