pygenutils 16.2.2__tar.gz → 16.2.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.
Files changed (47) hide show
  1. {pygenutils-16.2.2/pygenutils.egg-info → pygenutils-16.2.3}/PKG-INFO +3 -3
  2. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/__init__.py +1 -1
  3. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/strings/text_formatters.py +4 -2
  4. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/countdown.py +17 -7
  5. {pygenutils-16.2.2 → pygenutils-16.2.3/pygenutils.egg-info}/PKG-INFO +3 -3
  6. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils.egg-info/requires.txt +2 -2
  7. {pygenutils-16.2.2 → pygenutils-16.2.3}/pyproject.toml +3 -3
  8. {pygenutils-16.2.2 → pygenutils-16.2.3}/LICENSE +0 -0
  9. {pygenutils-16.2.2 → pygenutils-16.2.3}/MANIFEST.in +0 -0
  10. {pygenutils-16.2.2 → pygenutils-16.2.3}/README.md +0 -0
  11. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/arrays_and_lists/__init__.py +0 -0
  12. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/arrays_and_lists/conversions.py +0 -0
  13. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/arrays_and_lists/data_manipulation.py +0 -0
  14. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/arrays_and_lists/maths.py +0 -0
  15. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/arrays_and_lists/patterns.py +0 -0
  16. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/audio_and_video/__init__.py +0 -0
  17. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/audio_and_video/audio_and_video_manipulation.py +0 -0
  18. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/audio_and_video/merge_audio_and_video.py +0 -0
  19. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/audio_and_video/merge_audio_or_video.py +0 -0
  20. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/audio_and_video/trim_media.py +0 -0
  21. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/dictionaries/__init__.py +0 -0
  22. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/dictionaries/dict_handler.py +0 -0
  23. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/dictionaries/dict_operators.py +0 -0
  24. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/number_bases/__init__.py +0 -0
  25. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/number_bases/base_converters.py +0 -0
  26. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/number_bases/binary_operations.py +0 -0
  27. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/number_bases/bitwise_operators.py +0 -0
  28. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/number_bases/mathematical_utils.py +0 -0
  29. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/operative_systems/__init__.py +0 -0
  30. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/operative_systems/os_operations.py +0 -0
  31. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/sets_and_intervals/__init__.py +0 -0
  32. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/sets_and_intervals/interval_handler.py +0 -0
  33. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/sets_and_intervals/sets_handler.py +0 -0
  34. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/strings/__init__.py +0 -0
  35. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/strings/string_handler.py +0 -0
  36. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/__init__.py +0 -0
  37. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/calendar_utils.py +0 -0
  38. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/date_and_time_maths.py +0 -0
  39. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/date_and_time_utils.py +0 -0
  40. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/program_snippet_exec_timers.py +0 -0
  41. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/time_formatters.py +0 -0
  42. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils/time_handling/time_utils.py +0 -0
  43. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils.egg-info/SOURCES.txt +0 -0
  44. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils.egg-info/dependency_links.txt +0 -0
  45. {pygenutils-16.2.2 → pygenutils-16.2.3}/pygenutils.egg-info/top_level.txt +0 -0
  46. {pygenutils-16.2.2 → pygenutils-16.2.3}/setup.cfg +0 -0
  47. {pygenutils-16.2.2 → pygenutils-16.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygenutils
3
- Version: 16.2.2
3
+ Version: 16.2.3
4
4
  Summary: A comprehensive Python utility library for general-purpose and specialised tasks
5
5
  Author-email: Jon Ander Gabantxo <jagabantxo@gmail.com>
6
6
  License: MIT License
@@ -45,8 +45,8 @@ License-File: LICENSE
45
45
  Requires-Dist: more_itertools>=10.0.0
46
46
  Requires-Dist: numpy<2.0.0,>=1.21.0
47
47
  Requires-Dist: pandas<2.0.0,>=1.3.0
48
- Requires-Dist: filewise>=3.11.0
49
- Requires-Dist: paramlib>=3.4.3
48
+ Requires-Dist: filewise>=3.11.6
49
+ Requires-Dist: paramlib>=3.4.10
50
50
  Provides-Extra: xarray
51
51
  Requires-Dist: xarray>=2024.2.0; extra == "xarray"
52
52
  Provides-Extra: arrow
@@ -3,7 +3,7 @@
3
3
 
4
4
  # pygenutils/__init__.py
5
5
 
6
- __version__ = "16.2.2"
6
+ __version__ = "16.2.3"
7
7
 
8
8
  # Define what should be available when using 'from pygenutils import *'
9
9
  __all__ = [
@@ -99,7 +99,7 @@ def format_string(string2format, arg_obj):
99
99
  raise SyntaxError(SYNTAX_ERROR_STR)
100
100
 
101
101
 
102
- def print_format_string(string2format, arg_obj, end="\n"):
102
+ def print_format_string(string2format, arg_obj, end="\n", flush=False):
103
103
  """
104
104
  Format and print a string using Python's format method.
105
105
 
@@ -111,6 +111,8 @@ def print_format_string(string2format, arg_obj, end="\n"):
111
111
  The object used to fill in the placeholders in string2format.
112
112
  end : str, optional
113
113
  String appended after the last value, default is "\n".
114
+ flush : bool, optional
115
+ Whether to forcibly flush the stream.
114
116
 
115
117
  Raises
116
118
  ------
@@ -123,7 +125,7 @@ def print_format_string(string2format, arg_obj, end="\n"):
123
125
  except Exception as e:
124
126
  raise Exception(f"An error occurred: {e}") from e
125
127
  else:
126
- print(formatted_string, end=end)
128
+ print(formatted_string, end=end, flush=flush)
127
129
 
128
130
 
129
131
  # %-strings (percent-strings) #
@@ -12,7 +12,7 @@ from time import sleep
12
12
  # Import project modules #
13
13
  #------------------------#
14
14
 
15
- from pygenutils.strings.text_formatters import print_format_string
15
+ from pygenutils.strings.text_formatters import format_string
16
16
  from pygenutils.time_handling.time_formatters import parse_dt_string
17
17
 
18
18
  #------------------#
@@ -56,10 +56,10 @@ def return_dt_string_parts(datetime_str, dt_fmt_str):
56
56
  except ValueError:
57
57
  raise ValueError("Non-numeric values encountered in the datetime string.")
58
58
  else:
59
- dt_obj = parse_dt_string(time_str, dt_fmt_str, end="\r", flush=True)
59
+ dt_obj = parse_dt_string(time_str, dt_fmt_str)
60
60
  return days, dt_obj
61
61
  else:
62
- dt_obj = parse_dt_string(datetime_str, dt_fmt_str, end="\r", flush=True)
62
+ dt_obj = parse_dt_string(datetime_str, dt_fmt_str)
63
63
  return 0, dt_obj # No days component, default to 0.
64
64
 
65
65
 
@@ -79,7 +79,7 @@ def __countdown(time_str, dt_fmt_str):
79
79
 
80
80
  Functionality
81
81
  -------------
82
- - Displays the remaining time in the format "D days H hours M mins S secs".
82
+ - Displays the remaining time in the format "D days H:M:S" or "H:M:S".
83
83
  - Updates every second using `time.sleep(1)`.
84
84
  - Decrements the time until it reaches zero, at which point it prints "Time up!".
85
85
 
@@ -89,15 +89,25 @@ def __countdown(time_str, dt_fmt_str):
89
89
  If the user manually interrupts the countdown (Ctrl+C).
90
90
  """
91
91
  days, dt_obj = return_dt_string_parts(time_str, dt_fmt_str)
92
+
93
+ # Calculate maximum width to prevent leftover characters
94
+ max_width = 20 # Sufficient for most countdown formats
95
+
92
96
  while days > 0 or (dt_obj.hour, dt_obj.minute, dt_obj.second) != (0, 0, 0):
93
97
  # Calculate the time components
94
98
  hours, minutes, seconds = dt_obj.hour, dt_obj.minute, dt_obj.second
99
+
95
100
  if days > 0:
96
101
  DT_ARGS_DAY = [days, hours, minutes, seconds]
97
- print_format_string(TIME_STR_PARTS_FMTS[0], DT_ARGS_DAY)
102
+ time_display = format_string(TIME_STR_PARTS_FMTS[0], *DT_ARGS_DAY)
98
103
  else:
99
104
  DT_ARGS_NODAY = [hours, minutes, seconds]
100
- print_format_string(TIME_STR_PARTS_FMTS[1], DT_ARGS_NODAY)
105
+ time_display = format_string(TIME_STR_PARTS_FMTS[1], *DT_ARGS_NODAY)
106
+
107
+ # Rellenar la cadena de visualización para limpiar caracteres sobrantes
108
+ # Pad the display string to clear any leftover characters
109
+ padded_display = time_display.ljust(max_width)
110
+ print(padded_display, end="\r", flush=True)
101
111
 
102
112
  # Simulate time passing
103
113
  sleep(1)
@@ -109,7 +119,7 @@ def __countdown(time_str, dt_fmt_str):
109
119
  if ((hours, minutes, seconds) == (0,0,0) and days > 0):
110
120
  days -= 1
111
121
 
112
- print("Time up!")
122
+ print("\nTime up!")
113
123
 
114
124
  #-------------------------#
115
125
  # Countdown functionality #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygenutils
3
- Version: 16.2.2
3
+ Version: 16.2.3
4
4
  Summary: A comprehensive Python utility library for general-purpose and specialised tasks
5
5
  Author-email: Jon Ander Gabantxo <jagabantxo@gmail.com>
6
6
  License: MIT License
@@ -45,8 +45,8 @@ License-File: LICENSE
45
45
  Requires-Dist: more_itertools>=10.0.0
46
46
  Requires-Dist: numpy<2.0.0,>=1.21.0
47
47
  Requires-Dist: pandas<2.0.0,>=1.3.0
48
- Requires-Dist: filewise>=3.11.0
49
- Requires-Dist: paramlib>=3.4.3
48
+ Requires-Dist: filewise>=3.11.6
49
+ Requires-Dist: paramlib>=3.4.10
50
50
  Provides-Extra: xarray
51
51
  Requires-Dist: xarray>=2024.2.0; extra == "xarray"
52
52
  Provides-Extra: arrow
@@ -1,8 +1,8 @@
1
1
  more_itertools>=10.0.0
2
2
  numpy<2.0.0,>=1.21.0
3
3
  pandas<2.0.0,>=1.3.0
4
- filewise>=3.11.0
5
- paramlib>=3.4.3
4
+ filewise>=3.11.6
5
+ paramlib>=3.4.10
6
6
 
7
7
  [arrow]
8
8
  arrow>=1.2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pygenutils"
7
- version = "16.2.2"
7
+ version = "16.2.3"
8
8
  license = {file = "LICENSE"}
9
9
  description = "A comprehensive Python utility library for general-purpose and specialised tasks"
10
10
  keywords = ["utilities", "python", "general-purpose", "file handling", "string processing"]
@@ -29,8 +29,8 @@ dependencies = [
29
29
  "more_itertools>=10.0.0",
30
30
  "numpy>=1.21.0,<2.0.0",
31
31
  "pandas>=1.3.0,<2.0.0",
32
- "filewise>=3.11.0",
33
- "paramlib>=3.4.3",
32
+ "filewise>=3.11.6",
33
+ "paramlib>=3.4.10",
34
34
  ]
35
35
 
36
36
  [project.optional-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes