commit-maker 0.2.1__py3-none-any.whl → 0.3.0__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.
@@ -0,0 +1,59 @@
1
+ # Функции для цветного вывода/ввода
2
+
3
+
4
+ # Deprecated
5
+ def bold(text: str) -> str:
6
+ """Возвращает жирный текст
7
+
8
+ Args:
9
+ text (str): Текст
10
+
11
+ Returns:
12
+ str: Жирный текст
13
+ """
14
+ bold_start = "\033[1m"
15
+ bold_end = "\033[0m"
16
+ return f"{bold_start}{text}{bold_end}"
17
+
18
+
19
+ def colored(
20
+ string: str,
21
+ color: str,
22
+ text_bold: bool = True,
23
+ ) -> str:
24
+ """Функция для 'окраски' строк для красивого вывода
25
+
26
+ Args:
27
+ string (str): Строка, которую нужно покрасить
28
+ color (str): Цвет покраски ['red', 'yellow', 'green', 'magenta',\
29
+ 'blue', 'cyan', 'reset']
30
+ text_bold (bool, optional): Жирный текст или нет. Defaults to True.
31
+
32
+ Returns:
33
+ str: Покрашенная строка
34
+
35
+ Example:
36
+ `print(colored(string='Success!', color='green'))` # Выводит 'Success!'
37
+ зеленого цвета
38
+ """
39
+ COLOR_RED = "\033[31m"
40
+ COLOR_GREEN = "\033[32m"
41
+ COLOR_YELLOW = "\033[33m"
42
+ COLOR_BLUE = "\033[94m"
43
+ COLOR_MAGENTA = "\033[95m"
44
+ COLOR_CYAN = "\033[96m"
45
+ COLOR_RESET = "\033[0m"
46
+ COLORS_DICT = {
47
+ "red": COLOR_RED,
48
+ "green": COLOR_GREEN,
49
+ "yellow": COLOR_YELLOW,
50
+ "blue": COLOR_BLUE,
51
+ "magenta": COLOR_MAGENTA,
52
+ "cyan": COLOR_CYAN,
53
+ "reset": COLOR_RESET,
54
+ }
55
+ return (
56
+ bold(f"{COLORS_DICT[color]}{string}{COLORS_DICT['reset']}")
57
+ if text_bold
58
+ else f"{COLORS_DICT[color]}{string}{COLORS_DICT['reset']}"
59
+ )
@@ -0,0 +1,6 @@
1
+ # Кастомный класс промпта
2
+ import rich.prompt
3
+
4
+
5
+ class CustomIntPrompt(rich.prompt.IntPrompt):
6
+ validate_error_message = "[red]Введите число![/red]"
@@ -0,0 +1,6 @@
1
+ import re
2
+
3
+
4
+ def cut_think(message: str) -> str:
5
+ clean = re.sub(r"\s*<think>.*?</think>\s*", "", message, flags=re.DOTALL)
6
+ return clean