dublib 0.6.2__tar.gz → 0.6.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dublib
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Коллекция модулей от DUB1401.
5
5
  Author-email: DUB1401 <vlad.milosta@outlook.com>
6
6
  License: This is free and unencumbered software released into the public domain.
@@ -3,7 +3,7 @@ requires = ["setuptools", "cython"]
3
3
 
4
4
  [project]
5
5
  name = "dublib"
6
- version = "0.6.2"
6
+ version = "0.6.3"
7
7
  description = "Коллекция модулей от DUB1401."
8
8
  authors = [
9
9
  {name = "DUB1401", email = "vlad.milosta@outlook.com"}
@@ -2,8 +2,12 @@ from .Exceptions.StyledPrinter import DuplicatedStyles
2
2
 
3
3
  import enum
4
4
 
5
+ #==========================================================================================#
6
+ # >>>>> СТИЛИЗАЦИЯ ТЕКСТА <<<<< #
7
+ #==========================================================================================#
8
+
5
9
  class Styles:
6
- """Содержит перечисления декораций и стилей."""
10
+ """Перечисления декораций и стилей."""
7
11
 
8
12
  class Colors(enum.Enum):
9
13
  """Перечисление цветов."""
@@ -32,11 +36,11 @@ class Styles:
32
36
  Upperlined = "53"
33
37
 
34
38
  class StylesGroup:
35
- """Контейнер стилей. Предоставляет возможность комбинировать стили для их однократной инициализации с последующим многократным использования."""
39
+ """Контейнер стилей. Предоставляет возможность комбинировать стили для их однократной инициализации с последующим многократным использованием."""
36
40
 
37
41
  def __init__(self, decorations: list[Styles.Decorations] = list(), text_color: Styles.Colors | None = None, background_color: Styles.Colors | None = None):
38
42
  """
39
- Контейнер стилей. Предоставляет возможность комбинировать стили для их однократной инициализации с последующим многократным использования.
43
+ Контейнер стилей. Предоставляет возможность комбинировать стили для их однократной инициализации с последующим многократным использованием.
40
44
  decorations – список декораций;
41
45
  text_color – цвет текста;
42
46
  background_color – цвет фона.
@@ -50,9 +54,9 @@ class StylesGroup:
50
54
  # Добавить каждый маркер стиля к общей строке.
51
55
  for Decoration in decorations: self.__StylesMarkers += Decoration.value + ";"
52
56
  # Если передан цвет текста, создать соответствующий маркер.
53
- if TextColor != None: self.__StylesMarkers += "3" + TextColor.value + ";"
57
+ if text_color != None: self.__StylesMarkers += "3" + text_color.value + ";"
54
58
  # Если передан цвет фона, создать соответствующий маркер.
55
- if BackgroundColor != None: self.__StylesMarkers += "4" + BackgroundColor.value + ";"
59
+ if background_color != None: self.__StylesMarkers += "4" + background_color.value + ";"
56
60
  # Постановка завершающего символа маркировки.
57
61
  self.__StylesMarkers = self.__StylesMarkers.rstrip(';') + "m"
58
62
 
@@ -61,7 +65,7 @@ class StylesGroup:
61
65
 
62
66
  def StyledPrinter(text: str, styles: StylesGroup | None = None, decorations: list[Styles.Decorations] = list(), text_color: Styles.Colors | None = None, background_color: Styles.Colors | None = None, autoreset: bool = True, end: bool = True):
63
67
  """
64
- Выводит в терминал стилизованный текст.
68
+ Выводит в терминал стилизованный с помощью ANSI-кодов текст.
65
69
  text – стилизуемый текст;
66
70
  styles – контейнер стилей;
67
71
  decorations – список декораций;
@@ -84,7 +88,7 @@ def StyledPrinter(text: str, styles: StylesGroup | None = None, decorations: lis
84
88
 
85
89
  def TextStyler(text: str, styles: StylesGroup | None = None, decorations: list[Styles.Decorations] = list(), text_color: Styles.Colors | None = None, background_color: Styles.Colors | None = None, autoreset: bool = True) -> str:
86
90
  """
87
- Стилизует текст.
91
+ Стилизует текст с помощью ANSI-кодов.
88
92
  text – стилизуемый текст;
89
93
  styles – контейнер стилей;
90
94
  decorations – список декораций;
@@ -678,7 +678,9 @@ class Terminalyzer:
678
678
  if FreeParameters[Index] != None:
679
679
 
680
680
  # Если параметр соответствует типу.
681
- if self.__CheckArgumentsTypes(FreeParameters[Index], ArgumentsDescription[Index]["type"]) == True:
681
+ if self.__CheckArgumentsTypes(FreeParameters[Index], ArgumentsDescription[Index]["type"]):
682
+ # Если значение должно быть числом, провести преобразование.
683
+ if ArgumentsDescription[Index]["type"] == ArgumentsTypes.Number: FreeParameters[Index] = int(FreeParameters[Index])
682
684
  # Сохранение параметра в качестве аргумента.
683
685
  Values.append(FreeParameters[Index])
684
686
 
@@ -848,6 +850,8 @@ class Terminalyzer:
848
850
  IsPositionActivated = True
849
851
  # Проверка типа значения ключа.
850
852
  self.__CheckArgumentsTypes(Keys[KeyName], KeysPositions[PositionIndex]["types"][KeyIndex])
853
+ # Если значение должно быть числом, провести преобразование.
854
+ if KeysPositions[PositionIndex]["types"][KeyIndex] == ArgumentsTypes.Number: Keys[KeyName] = int(Keys[KeyName])
851
855
 
852
856
  # Если для ключа задан слой.
853
857
  if KeysPositions[PositionIndex]["layout-index"] != None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dublib
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Коллекция модулей от DUB1401.
5
5
  Author-email: DUB1401 <vlad.milosta@outlook.com>
6
6
  License: This is free and unencumbered software released into the public domain.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes