stouputils 1.2.1__tar.gz → 1.2.2__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 (24) hide show
  1. {stouputils-1.2.1 → stouputils-1.2.2}/PKG-INFO +1 -1
  2. {stouputils-1.2.1 → stouputils-1.2.2}/pyproject.toml +1 -1
  3. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/print.py +27 -8
  4. {stouputils-1.2.1 → stouputils-1.2.2}/.gitignore +0 -0
  5. {stouputils-1.2.1 → stouputils-1.2.2}/LICENSE +0 -0
  6. {stouputils-1.2.1 → stouputils-1.2.2}/README.md +0 -0
  7. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/__init__.py +0 -0
  8. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/all_doctests.py +0 -0
  9. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/applications/__init__.py +0 -0
  10. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/applications/automatic_docs.py +0 -0
  11. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/archive.py +0 -0
  12. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/backup.py +0 -0
  13. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/collections.py +0 -0
  14. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/continuous_delivery/__init__.py +0 -0
  15. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/continuous_delivery/cd_utils.py +0 -0
  16. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/continuous_delivery/github.py +0 -0
  17. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/continuous_delivery/pypi.py +0 -0
  18. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/continuous_delivery/pyproject.py +0 -0
  19. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/ctx.py +0 -0
  20. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/decorators.py +0 -0
  21. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/dont_look/zip_file_override.py +0 -0
  22. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/io.py +0 -0
  23. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/parallel.py +0 -0
  24. {stouputils-1.2.1 → stouputils-1.2.2}/stouputils/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stouputils
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more.
5
5
  Project-URL: Homepage, https://github.com/Stoupy51/stouputils
6
6
  Project-URL: Issues, https://github.com/Stoupy51/stouputils/issues
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
 
6
6
  [project]
7
7
  name = "stouputils"
8
- version = "1.2.1"
8
+ version = "1.2.2"
9
9
  description = "Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more."
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.10"
@@ -83,15 +83,23 @@ def info(*values: Any, color: str = GREEN, text: str = "INFO ", prefix: str = ""
83
83
  print(remove_colors(message), *(remove_colors(str(v)) for v in values), file=log_file, **print_kwargs)
84
84
 
85
85
  def debug(*values: Any, **print_kwargs: Any) -> None:
86
- """ Print a debug message looking like "[DEBUG HH:MM:SS] message" """
86
+ """ Print a debug message looking like "[DEBUG HH:MM:SS] message" in blue by default. """
87
87
  if "text" not in print_kwargs:
88
88
  print_kwargs["text"] = "DEBUG"
89
89
  if "color" not in print_kwargs:
90
90
  print_kwargs["color"] = BLUE
91
91
  info(*values, **print_kwargs)
92
92
 
93
+ def alt_debug(*values: Any, **print_kwargs: Any) -> None:
94
+ """ Print a debug message looking like "[DEBUG HH:MM:SS] message" in cyan by default. """
95
+ if "text" not in print_kwargs:
96
+ print_kwargs["text"] = "DEBUG"
97
+ if "color" not in print_kwargs:
98
+ print_kwargs["color"] = CYAN
99
+ info(*values, **print_kwargs)
100
+
93
101
  def suggestion(*values: Any, **print_kwargs: Any) -> None:
94
- """ Print a suggestion message looking like "[SUGGESTION HH:MM:SS] message" """
102
+ """ Print a suggestion message looking like "[SUGGESTION HH:MM:SS] message" in cyan by default. """
95
103
  if "text" not in print_kwargs:
96
104
  print_kwargs["text"] = "SUGGESTION"
97
105
  if "color" not in print_kwargs:
@@ -99,7 +107,7 @@ def suggestion(*values: Any, **print_kwargs: Any) -> None:
99
107
  info(*values, **print_kwargs)
100
108
 
101
109
  def progress(*values: Any, **print_kwargs: Any) -> None:
102
- """ Print a progress message looking like "[PROGRESS HH:MM:SS] message" """
110
+ """ Print a progress message looking like "[PROGRESS HH:MM:SS] message" in magenta by default. """
103
111
  if "text" not in print_kwargs:
104
112
  print_kwargs["text"] = "PROGRESS"
105
113
  if "color" not in print_kwargs:
@@ -107,7 +115,7 @@ def progress(*values: Any, **print_kwargs: Any) -> None:
107
115
  info(*values, **print_kwargs)
108
116
 
109
117
  def warning(*values: Any, **print_kwargs: Any) -> None:
110
- """ Print a warning message looking like "[WARNING HH:MM:SS] message" in sys.stderr """
118
+ """ Print a warning message looking like "[WARNING HH:MM:SS] message" in yellow by default and in sys.stderr. """
111
119
  if "file" not in print_kwargs:
112
120
  print_kwargs["file"] = sys.stderr
113
121
  if "text" not in print_kwargs:
@@ -117,7 +125,7 @@ def warning(*values: Any, **print_kwargs: Any) -> None:
117
125
  info(*values, **print_kwargs)
118
126
 
119
127
  def error(*values: Any, exit: bool = True, **print_kwargs: Any) -> None:
120
- """ Print an error message (in sys.stderr) and optionally ask the user to continue or stop the program
128
+ """ Print an error message (in sys.stderr and in red by default) and optionally ask the user to continue or stop the program.
121
129
 
122
130
  Args:
123
131
  values (Any): Values to print (like the print function)
@@ -144,7 +152,7 @@ def error(*values: Any, exit: bool = True, **print_kwargs: Any) -> None:
144
152
  print(file=file)
145
153
  sys.exit(1)
146
154
 
147
- def whatisit(*values: Any, print_function: Callable[..., None] = debug, max_length: int = 250, **print_kwargs: Any) -> None:
155
+ def whatisit(*values: Any, print_function: Callable[..., None] = debug, max_length: int = 250, color: str = CYAN, **print_kwargs: Any) -> None:
148
156
  """ Print the type of each value and the value itself, with its id and length/shape.
149
157
 
150
158
  The output format is: "type, <id id_number>: (length/shape) value"
@@ -153,10 +161,13 @@ def whatisit(*values: Any, print_function: Callable[..., None] = debug, max_leng
153
161
  values (Any): Values to print
154
162
  print_function (Callable): Function to use to print the values (default: debug())
155
163
  max_length (int): Maximum length of the value string to print (default: 250)
164
+ color (str): Color of the message (default: CYAN)
156
165
  print_kwargs (dict): Keyword arguments to pass to the print function
157
166
  """
158
167
  def _internal(value: Any) -> str:
159
168
  """ Get the string representation of the value, with length or shape instead of length if shape is available """
169
+
170
+ # Get the length or shape of the value
160
171
  length: str = ""
161
172
  try:
162
173
  length = f"(length: {len(value)}) "
@@ -166,14 +177,22 @@ def whatisit(*values: Any, print_function: Callable[..., None] = debug, max_leng
166
177
  length = f"(shape: {value.shape}) "
167
178
  except (AttributeError, TypeError):
168
179
  pass
180
+
181
+ # Get the string representation of the value
169
182
  value_str: str = str(value)
170
183
  if len(value_str) > max_length:
171
184
  value_str = value_str[:max_length] + "..."
172
185
  if "\n" in value_str:
173
- length = "\n" + length # Add a newline before the length if there is a newline in the value.
186
+ value_str = "\n" + value_str # Add a newline before the value if there is a newline in it.
187
+
188
+ # Return the formatted string
174
189
  return f"{type(value)}, <id {id(value)}>: {length}{value_str}"
175
190
 
176
- # Print
191
+ # Add the color to the message
192
+ if "color" not in print_kwargs:
193
+ print_kwargs["color"] = color
194
+
195
+ # Print the values
177
196
  if len(values) > 1:
178
197
  print_function("(What is it?)", **print_kwargs)
179
198
  for value in values:
File without changes
File without changes
File without changes
File without changes
File without changes