tui-utilities 1.0.26__tar.gz → 1.0.28__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.

Potentially problematic release.


This version of tui-utilities might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.0.26
3
+ Version: 1.0.28
4
4
  Summary: Personal-use console utilities library
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tui_utilities"
3
- version = "1.0.26"
3
+ version = "1.0.28"
4
4
  description = "Personal-use console utilities library"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -153,7 +153,7 @@ def input(
153
153
  def clear_console(): os.system("cls" if os.name == "nt" else "clear")
154
154
 
155
155
  def wait_for_key(
156
- text = "\nPulse cualquier tecla para continuar...",
156
+ text = "Pulse cualquier tecla para continuar...",
157
157
  color = "#ffffff",
158
158
  bold = False,
159
159
  italic = False,
@@ -168,7 +168,7 @@ def wait_for_key(
168
168
  left_padding = None
169
169
  ):
170
170
  print(
171
- text,
171
+ f"\n{text}",
172
172
  color = color,
173
173
  bold = bold,
174
174
  italic = italic,
@@ -12,12 +12,12 @@ def _choose_option(
12
12
  for key, option in options.items(): print([(f"{key}:", {"bold": True}), (f" {option}", {})])
13
13
  selection = input(f"\n{selection_text}", bold = True).upper()
14
14
  while selection not in options:
15
- print(f"\n{error}\n", color = "#ff0000")
15
+ print(f"\n{error}", color = "#ff0000")
16
16
  selection = input(f"\n{selection_text}", bold = True).upper()
17
17
  return selection
18
18
 
19
19
  def menu(
20
- options_list,
20
+ options,
21
21
  title,
22
22
  title_color = "#ffffff",
23
23
  title_bold = True,
@@ -69,16 +69,16 @@ def menu(
69
69
  bottom_padding = separator_bottom_padding,
70
70
  left_padding = separator_left_padding
71
71
  )
72
- options = {}
72
+ options_dictionary = {}
73
73
  key = 1
74
- for option in options_list:
74
+ for option in options:
75
75
  match option:
76
- case "Atrás": options["A"] = option
77
- case "Salir": options["S"] = option
76
+ case "Atrás": options_dictionary["A"] = option
77
+ case "Salir": options_dictionary["S"] = option
78
78
  case _:
79
- options[str(key)] = option
79
+ options_dictionary[str(key)] = option
80
80
  key += 1
81
- return _choose_option(options, message, selection_text, error)
81
+ return _choose_option(options_dictionary, message, selection_text, error)
82
82
 
83
83
  def confirm_exit(
84
84
  message = "¿Está seguro de querer salir?",
@@ -61,19 +61,19 @@ def _build_email_pattern():
61
61
  def check_if_empty(list, message = "La lista está vacía"):
62
62
  if not list:
63
63
  clear_console()
64
- print(message, color = "#ff0000")
64
+ print(f"\n{message}", color = "#ff0000")
65
65
  wait_for_key()
66
66
  return True
67
67
  return False
68
68
 
69
69
  def validate_string(
70
70
  message = "Ingrese un texto: ",
71
- error = "El texto no puede estar vacío, intente nuevamente"
71
+ blank_error = "El texto no puede estar vacío, intente nuevamente"
72
72
  ):
73
73
  while True:
74
74
  string = input(text = message, bold = True)
75
75
  if string: return string
76
- print(f"\n{error}\n", color = "#ff0000")
76
+ print(f"\n{blank_error}", color = "#ff0000")
77
77
 
78
78
  def validate_integer(
79
79
  message = "Ingrese un número: ",
@@ -84,12 +84,12 @@ def validate_integer(
84
84
  while True:
85
85
  integer = input(text = message, bold = True)
86
86
  if not integer:
87
- print(f"\n{blank_error}\n", color = "#ff0000")
87
+ print(f"\n{blank_error}", color = "#ff0000")
88
88
  continue
89
89
  if pattern.match(integer):
90
90
  unformatted_integer = integer.replace(".", "")
91
91
  return int(unformatted_integer)
92
- else: print(f"\n{invalid_error}\n", color = "#ff0000")
92
+ print(f"\n{invalid_error}", color = "#ff0000")
93
93
 
94
94
  def validate_double(
95
95
  message = "Ingrese un número: ",
@@ -100,12 +100,12 @@ def validate_double(
100
100
  while True:
101
101
  double = input(text = message, bold = True)
102
102
  if not double:
103
- print(f"\n{blank_error}\n", color = "#ff0000")
103
+ print(f"\n{blank_error}", color = "#ff0000")
104
104
  continue
105
105
  if pattern.match(double):
106
106
  unformatted_double = double.replace(".", "").replace(",", ".")
107
107
  return float(unformatted_double)
108
- else: print(f"\n{invalid_error}\n", color = "#ff0000")
108
+ print(f"\n{invalid_error}", color = "#ff0000")
109
109
 
110
110
  def validate_date(
111
111
  message = "Ingrese una fecha: ",
@@ -116,13 +116,13 @@ def validate_date(
116
116
  while True:
117
117
  date_string = input(text = message, bold = True)
118
118
  if not date_string:
119
- print(f"\n{blank_error}\n", color = "#ff0000")
119
+ print(f"\n{blank_error}", color = "#ff0000")
120
120
  continue
121
121
  if pattern.match(date_string):
122
122
  date_part, time_part = date_string.split(" - ")
123
123
  date_part = date_part.replace(".", "")
124
124
  return datetime.strptime(f"{date_part} - {time_part}", "%d/%m/%Y - %H:%M")
125
- else: print(f"\n{invalid_error}\n", color = "#ff0000")
125
+ print(f"\n{invalid_error}", color = "#ff0000")
126
126
 
127
127
  def validate_id(
128
128
  message = "Ingrese un número de D.N.I.: ",
@@ -133,10 +133,10 @@ def validate_id(
133
133
  while True:
134
134
  id = input(text = message, bold = True)
135
135
  if not id:
136
- print(f"\n{blank_error}\n", color = "#ff0000")
136
+ print(f"\n{blank_error}", color = "#ff0000")
137
137
  continue
138
138
  if pattern.match(id): return id
139
- else: print(f"\n{invalid_error}\n", color = "#ff0000")
139
+ print(f"\n{invalid_error}", color = "#ff0000")
140
140
 
141
141
  def validate_cellphone_number(
142
142
  message = "Ingrese un número telefónico: ",
@@ -147,10 +147,10 @@ def validate_cellphone_number(
147
147
  while True:
148
148
  cellphone_number = input(text = message, bold = True)
149
149
  if not cellphone_number:
150
- print(f"\n{blank_error}\n", color = "#ff0000")
150
+ print(f"\n{blank_error}", color = "#ff0000")
151
151
  continue
152
152
  if pattern.match(cellphone_number): return cellphone_number
153
- else: print(f"\n{invalid_error}\n", color = "#ff0000")
153
+ print(f"\n{invalid_error}", color = "#ff0000")
154
154
 
155
155
  def validate_email(
156
156
  message = "Ingrese el correo electrónico: ",
@@ -161,7 +161,7 @@ def validate_email(
161
161
  while True:
162
162
  email = input(text = message, bold = True)
163
163
  if not email:
164
- print(f"\n{blank_error}\n", color = "#ff0000")
164
+ print(f"\n{blank_error}", color = "#ff0000")
165
165
  continue
166
166
  if pattern.match(email): return email
167
- print(f"\n{invalid_error}\n", color = "#ff0000")
167
+ print(f"\n{invalid_error}", color = "#ff0000")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tui_utilities
3
- Version: 1.0.26
3
+ Version: 1.0.28
4
4
  Summary: Personal-use console utilities library
5
5
  Author-email: Guido Iván Gross <grossguidoivan@gmail.com>
6
6
  License: MIT
File without changes
File without changes