telegrinder 0.1.dev159__py3-none-any.whl → 0.1.dev161__py3-none-any.whl
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.
Potentially problematic release.
This version of telegrinder might be problematic. Click here for more details.
- telegrinder/__init__.py +4 -2
- telegrinder/api/__init__.py +0 -0
- telegrinder/api/abc.py +5 -0
- telegrinder/api/api.py +4 -4
- telegrinder/api/error.py +0 -0
- telegrinder/api/response.py +0 -0
- telegrinder/bot/__init__.py +0 -0
- telegrinder/bot/bot.py +0 -0
- telegrinder/bot/cute_types/__init__.py +0 -0
- telegrinder/bot/cute_types/base.py +0 -0
- telegrinder/bot/cute_types/callback_query.py +81 -85
- telegrinder/bot/cute_types/inline_query.py +36 -9
- telegrinder/bot/cute_types/message.py +524 -568
- telegrinder/bot/cute_types/update.py +0 -0
- telegrinder/bot/cute_types/utils.py +201 -453
- telegrinder/bot/dispatch/__init__.py +0 -0
- telegrinder/bot/dispatch/abc.py +0 -0
- telegrinder/bot/dispatch/composition.py +0 -0
- telegrinder/bot/dispatch/context.py +0 -0
- telegrinder/bot/dispatch/dispatch.py +0 -0
- telegrinder/bot/dispatch/handler/__init__.py +0 -0
- telegrinder/bot/dispatch/handler/abc.py +0 -0
- telegrinder/bot/dispatch/handler/func.py +1 -1
- telegrinder/bot/dispatch/handler/message_reply.py +0 -0
- telegrinder/bot/dispatch/middleware/__init__.py +0 -0
- telegrinder/bot/dispatch/middleware/abc.py +0 -0
- telegrinder/bot/dispatch/process.py +0 -0
- telegrinder/bot/dispatch/return_manager/__init__.py +0 -0
- telegrinder/bot/dispatch/return_manager/abc.py +0 -0
- telegrinder/bot/dispatch/return_manager/callback_query.py +0 -0
- telegrinder/bot/dispatch/return_manager/inline_query.py +0 -0
- telegrinder/bot/dispatch/return_manager/message.py +0 -0
- telegrinder/bot/dispatch/view/__init__.py +0 -0
- telegrinder/bot/dispatch/view/abc.py +20 -16
- telegrinder/bot/dispatch/view/box.py +0 -0
- telegrinder/bot/dispatch/view/callback_query.py +0 -0
- telegrinder/bot/dispatch/view/inline_query.py +0 -0
- telegrinder/bot/dispatch/view/message.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/__init__.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/machine.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/middleware.py +0 -0
- telegrinder/bot/dispatch/waiter_machine/short_state.py +0 -0
- telegrinder/bot/polling/__init__.py +0 -0
- telegrinder/bot/polling/abc.py +0 -0
- telegrinder/bot/polling/polling.py +7 -11
- telegrinder/bot/rules/__init__.py +0 -0
- telegrinder/bot/rules/abc.py +1 -1
- telegrinder/bot/rules/adapter/__init__.py +0 -0
- telegrinder/bot/rules/adapter/abc.py +0 -0
- telegrinder/bot/rules/adapter/errors.py +0 -0
- telegrinder/bot/rules/adapter/event.py +0 -0
- telegrinder/bot/rules/adapter/raw_update.py +0 -0
- telegrinder/bot/rules/callback_data.py +3 -11
- telegrinder/bot/rules/command.py +0 -0
- telegrinder/bot/rules/enum_text.py +0 -0
- telegrinder/bot/rules/func.py +0 -0
- telegrinder/bot/rules/fuzzy.py +0 -0
- telegrinder/bot/rules/inline.py +2 -1
- telegrinder/bot/rules/integer.py +0 -0
- telegrinder/bot/rules/is_from.py +0 -0
- telegrinder/bot/rules/markup.py +3 -1
- telegrinder/bot/rules/mention.py +0 -0
- telegrinder/bot/rules/message_entities.py +3 -1
- telegrinder/bot/rules/regex.py +1 -1
- telegrinder/bot/rules/rule_enum.py +0 -0
- telegrinder/bot/rules/start.py +0 -0
- telegrinder/bot/rules/text.py +0 -0
- telegrinder/bot/scenario/__init__.py +2 -2
- telegrinder/bot/scenario/abc.py +0 -0
- telegrinder/bot/scenario/checkbox.py +9 -13
- telegrinder/bot/scenario/choice.py +2 -2
- telegrinder/client/__init__.py +0 -0
- telegrinder/client/abc.py +0 -0
- telegrinder/client/aiohttp.py +0 -0
- telegrinder/model.py +35 -36
- telegrinder/modules.py +21 -11
- telegrinder/msgspec_json.py +0 -0
- telegrinder/msgspec_utils.py +2 -2
- telegrinder/node/__init__.py +0 -0
- telegrinder/node/attachment.py +0 -0
- telegrinder/node/base.py +0 -0
- telegrinder/node/composer.py +0 -0
- telegrinder/node/container.py +0 -0
- telegrinder/node/message.py +0 -0
- telegrinder/node/rule.py +0 -0
- telegrinder/node/source.py +0 -0
- telegrinder/node/text.py +0 -0
- telegrinder/node/tools/__init__.py +0 -0
- telegrinder/node/tools/generator.py +0 -0
- telegrinder/node/update.py +0 -0
- telegrinder/rules.py +0 -0
- telegrinder/tools/__init__.py +2 -3
- telegrinder/tools/buttons.py +0 -0
- telegrinder/tools/error_handler/__init__.py +2 -0
- telegrinder/tools/error_handler/abc.py +5 -1
- telegrinder/tools/error_handler/error.py +10 -0
- telegrinder/tools/error_handler/error_handler.py +100 -81
- telegrinder/tools/formatting/__init__.py +0 -0
- telegrinder/tools/formatting/html.py +0 -0
- telegrinder/tools/formatting/links.py +0 -0
- telegrinder/tools/formatting/spec_html_formats.py +0 -0
- telegrinder/tools/global_context/__init__.py +0 -0
- telegrinder/tools/global_context/abc.py +0 -0
- telegrinder/tools/global_context/global_context.py +65 -67
- telegrinder/tools/global_context/telegrinder_ctx.py +0 -0
- telegrinder/tools/i18n/__init__.py +0 -0
- telegrinder/tools/i18n/base.py +0 -0
- telegrinder/tools/i18n/middleware/__init__.py +0 -0
- telegrinder/tools/i18n/middleware/base.py +0 -0
- telegrinder/tools/i18n/simple.py +0 -0
- telegrinder/tools/kb_set/__init__.py +0 -0
- telegrinder/tools/kb_set/base.py +0 -0
- telegrinder/tools/kb_set/yaml.py +3 -3
- telegrinder/tools/keyboard.py +17 -26
- telegrinder/tools/loop_wrapper/__init__.py +0 -0
- telegrinder/tools/loop_wrapper/abc.py +0 -0
- telegrinder/tools/loop_wrapper/loop_wrapper.py +0 -0
- telegrinder/tools/magic.py +1 -1
- telegrinder/tools/parse_mode.py +0 -0
- telegrinder/types/__init__.py +0 -0
- telegrinder/types/enums.py +2 -0
- telegrinder/types/methods.py +477 -526
- telegrinder/types/objects.py +209 -97
- {telegrinder-0.1.dev159.dist-info → telegrinder-0.1.dev161.dist-info}/LICENSE +0 -0
- {telegrinder-0.1.dev159.dist-info → telegrinder-0.1.dev161.dist-info}/METADATA +9 -8
- {telegrinder-0.1.dev159.dist-info → telegrinder-0.1.dev161.dist-info}/RECORD +38 -37
- {telegrinder-0.1.dev159.dist-info → telegrinder-0.1.dev161.dist-info}/WHEEL +1 -1
telegrinder/tools/kb_set/yaml.py
CHANGED
|
@@ -8,7 +8,7 @@ from telegrinder.tools.keyboard import InlineKeyboard, Keyboard
|
|
|
8
8
|
|
|
9
9
|
from .base import KeyboardSetBase, KeyboardSetError
|
|
10
10
|
|
|
11
|
-
PathLike = str | os.PathLike[str]
|
|
11
|
+
PathLike: typing.TypeAlias = str | os.PathLike[str]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class KeyboardSetYAML(KeyboardSetBase):
|
|
@@ -27,7 +27,7 @@ class KeyboardSetYAML(KeyboardSetBase):
|
|
|
27
27
|
encoding="UTF-8",
|
|
28
28
|
),
|
|
29
29
|
yaml.Loader,
|
|
30
|
-
)
|
|
30
|
+
)
|
|
31
31
|
for name, hint in typing.get_type_hints(cls).items():
|
|
32
32
|
g = re.match(r"(?:kb_|keyboard_)(.+)", name.lower())
|
|
33
33
|
if not g:
|
|
@@ -47,7 +47,7 @@ class KeyboardSetYAML(KeyboardSetBase):
|
|
|
47
47
|
"Keyboard should be dict with field buttons which must be a list, "
|
|
48
48
|
"check documentation."
|
|
49
49
|
)
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
buttons = kb_config.pop("buttons")
|
|
52
52
|
new_keyboard: Keyboard | InlineKeyboard = hint(**kb_config)
|
|
53
53
|
for button in buttons:
|
telegrinder/tools/keyboard.py
CHANGED
|
@@ -14,15 +14,8 @@ from telegrinder.types.objects import (
|
|
|
14
14
|
|
|
15
15
|
from .buttons import Button, ButtonT, InlineButton, RowButtons
|
|
16
16
|
|
|
17
|
-
DictStrAny = dict[str, typing.Any]
|
|
18
|
-
AnyMarkup = InlineKeyboardMarkup | ReplyKeyboardMarkup
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def keyboard_remove(*, selective: bool | None = None) -> ReplyKeyboardRemove:
|
|
22
|
-
return ReplyKeyboardRemove(
|
|
23
|
-
remove_keyboard=True,
|
|
24
|
-
selective=Nothing() if selective is None else Some(selective),
|
|
25
|
-
)
|
|
17
|
+
DictStrAny: typing.TypeAlias = dict[str, typing.Any]
|
|
18
|
+
AnyMarkup: typing.TypeAlias = InlineKeyboardMarkup | ReplyKeyboardMarkup
|
|
26
19
|
|
|
27
20
|
|
|
28
21
|
@dataclasses.dataclass
|
|
@@ -31,12 +24,12 @@ class KeyboardModel:
|
|
|
31
24
|
one_time_keyboard: bool | Option[bool]
|
|
32
25
|
selective: bool | Option[bool]
|
|
33
26
|
is_persistent: bool | Option[bool]
|
|
34
|
-
keyboard: list[list[
|
|
27
|
+
keyboard: list[list[DictStrAny]]
|
|
35
28
|
|
|
36
29
|
|
|
37
30
|
class ABCMarkup(ABC, typing.Generic[ButtonT]):
|
|
38
31
|
BUTTON: type[ButtonT]
|
|
39
|
-
keyboard: list[list[
|
|
32
|
+
keyboard: list[list[DictStrAny]]
|
|
40
33
|
|
|
41
34
|
@abstractmethod
|
|
42
35
|
def dict(self) -> DictStrAny:
|
|
@@ -70,7 +63,7 @@ class ABCMarkup(ABC, typing.Generic[ButtonT]):
|
|
|
70
63
|
self.keyboard.append([])
|
|
71
64
|
return self
|
|
72
65
|
|
|
73
|
-
def format(self, **format_data:
|
|
66
|
+
def format(self, **format_data: str) -> typing.Self:
|
|
74
67
|
copy_keyboard = self.__class__()
|
|
75
68
|
for row in self.keyboard:
|
|
76
69
|
for button in row:
|
|
@@ -85,22 +78,21 @@ class ABCMarkup(ABC, typing.Generic[ButtonT]):
|
|
|
85
78
|
return self
|
|
86
79
|
|
|
87
80
|
|
|
81
|
+
@dataclasses.dataclass(kw_only=True)
|
|
88
82
|
class Keyboard(ABCMarkup[Button], KeyboardModel):
|
|
89
83
|
BUTTON = Button
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
self.selective = selective
|
|
103
|
-
self.is_persistent = is_persistent
|
|
85
|
+
keyboard: list[list[DictStrAny]] = dataclasses.field(
|
|
86
|
+
default_factory=lambda: [[]],
|
|
87
|
+
init=False,
|
|
88
|
+
)
|
|
89
|
+
resize_keyboard: bool = dataclasses.field(default=True)
|
|
90
|
+
one_time_keyboard: bool = dataclasses.field(default=False)
|
|
91
|
+
selective: bool = dataclasses.field(default=False)
|
|
92
|
+
is_persistent: bool = dataclasses.field(default=False)
|
|
93
|
+
|
|
94
|
+
def get_empty_markup(self, *, selective: bool = False) -> ReplyKeyboardRemove:
|
|
95
|
+
return ReplyKeyboardRemove(remove_keyboard=True, selective=selective) # type: ignore
|
|
104
96
|
|
|
105
97
|
def dict(self) -> DictStrAny:
|
|
106
98
|
self.keyboard = [row for row in self.keyboard if row]
|
|
@@ -133,5 +125,4 @@ __all__ = (
|
|
|
133
125
|
"InlineKeyboard",
|
|
134
126
|
"Keyboard",
|
|
135
127
|
"KeyboardModel",
|
|
136
|
-
"keyboard_remove",
|
|
137
128
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
telegrinder/tools/magic.py
CHANGED
telegrinder/tools/parse_mode.py
CHANGED
|
File without changes
|
telegrinder/types/__init__.py
CHANGED
|
File without changes
|