pygenutils 16.3.0__tar.gz → 16.3.1__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.3.0/pygenutils.egg-info → pygenutils-16.3.1}/PKG-INFO +1 -1
  2. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/__init__.py +1 -1
  3. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/number_bases/mathematical_utils.py +10 -10
  4. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/program_snippet_exec_timers.py +11 -11
  5. {pygenutils-16.3.0 → pygenutils-16.3.1/pygenutils.egg-info}/PKG-INFO +1 -1
  6. {pygenutils-16.3.0 → pygenutils-16.3.1}/pyproject.toml +1 -1
  7. {pygenutils-16.3.0 → pygenutils-16.3.1}/LICENSE +0 -0
  8. {pygenutils-16.3.0 → pygenutils-16.3.1}/MANIFEST.in +0 -0
  9. {pygenutils-16.3.0 → pygenutils-16.3.1}/README.md +0 -0
  10. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/arrays_and_lists/__init__.py +0 -0
  11. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/arrays_and_lists/conversions.py +0 -0
  12. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/arrays_and_lists/data_manipulation.py +0 -0
  13. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/arrays_and_lists/maths.py +0 -0
  14. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/arrays_and_lists/patterns.py +0 -0
  15. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/audio_and_video/__init__.py +0 -0
  16. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/audio_and_video/audio_and_video_manipulation.py +0 -0
  17. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/audio_and_video/merge_audio_and_video.py +0 -0
  18. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/audio_and_video/merge_audio_or_video.py +0 -0
  19. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/audio_and_video/trim_media.py +0 -0
  20. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/dictionaries/__init__.py +0 -0
  21. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/dictionaries/dict_handler.py +0 -0
  22. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/dictionaries/dict_operators.py +0 -0
  23. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/number_bases/__init__.py +0 -0
  24. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/number_bases/base_converters.py +0 -0
  25. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/number_bases/binary_operations.py +0 -0
  26. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/number_bases/bitwise_operators.py +0 -0
  27. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/operative_systems/__init__.py +0 -0
  28. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/operative_systems/os_operations.py +0 -0
  29. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/sets_and_intervals/__init__.py +0 -0
  30. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/sets_and_intervals/interval_handler.py +0 -0
  31. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/sets_and_intervals/sets_handler.py +0 -0
  32. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/strings/__init__.py +0 -0
  33. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/strings/string_handler.py +0 -0
  34. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/strings/text_formatters.py +0 -0
  35. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/__init__.py +0 -0
  36. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/calendar_utils.py +0 -0
  37. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/countdown.py +0 -0
  38. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/date_and_time_maths.py +0 -0
  39. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/date_and_time_utils.py +0 -0
  40. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/time_formatters.py +0 -0
  41. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils/time_handling/time_utils.py +0 -0
  42. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils.egg-info/SOURCES.txt +0 -0
  43. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils.egg-info/dependency_links.txt +0 -0
  44. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils.egg-info/requires.txt +0 -0
  45. {pygenutils-16.3.0 → pygenutils-16.3.1}/pygenutils.egg-info/top_level.txt +0 -0
  46. {pygenutils-16.3.0 → pygenutils-16.3.1}/setup.cfg +0 -0
  47. {pygenutils-16.3.0 → pygenutils-16.3.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygenutils
3
- Version: 16.3.0
3
+ Version: 16.3.1
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
@@ -3,7 +3,7 @@
3
3
 
4
4
  # pygenutils/__init__.py
5
5
 
6
- __version__ = "16.3.0"
6
+ __version__ = "16.3.1"
7
7
 
8
8
  # Define what should be available when using 'from pygenutils import *'
9
9
  __all__ = [
@@ -6,11 +6,11 @@ from math import factorial
6
6
  # Define functions #
7
7
  #------------------#
8
8
 
9
- def adapted_factorial(num, decimals):
9
+ def adapted_factorial(num, significant_digits):
10
10
  """
11
11
  Calculate the factorial of a number with precise formatting control.
12
12
 
13
- For standard-sized results, formats the output using the specified decimal precision.
13
+ For standard-sized results, formats the output using the specified precision.
14
14
  For extremely large factorials that would cause an OverflowError during formatting,
15
15
  converts the result to scientific notation with appropriate rounding.
16
16
 
@@ -18,7 +18,7 @@ def adapted_factorial(num, decimals):
18
18
  ----------
19
19
  num : int | float
20
20
  The number for which to calculate the factorial
21
- decimals : int
21
+ significant_digits : int
22
22
  The number of significant digits to include in the result
23
23
 
24
24
  Returns
@@ -40,17 +40,17 @@ def adapted_factorial(num, decimals):
40
40
  result = factorial(num)
41
41
 
42
42
  try:
43
- result = f"{result:.{decimals}g}"
43
+ result = f"{result:.{significant_digits}g}"
44
44
  except OverflowError:
45
- # Convert to string and round to the desired decimal places
45
+ # Convert to string and round to the desired significant digits
46
46
  result_str = str(result)
47
- # Take into account the number next to the roundoff number
48
- if int(result_str[decimals]) >= 5:
49
- prev_num = int(result_str[decimals-1]) + 1
47
+ # Take into account the number next to the significant digits position
48
+ if int(result_str[significant_digits]) >= 5:
49
+ prev_num = int(result_str[significant_digits-1]) + 1
50
50
  else:
51
- prev_num = int(result_str[decimals-1])
51
+ prev_num = int(result_str[significant_digits-1])
52
52
  # Convert to float
53
- result_adapted = f"{result_str[0]}.{result_str[1:decimals-1]}{prev_num}e+{len(result_str)-1}"
53
+ result_adapted = f"{result_str[0]}.{result_str[1:significant_digits-1]}{prev_num}e+{len(result_str)-1}"
54
54
  else:
55
55
  result_adapted = result
56
56
 
@@ -135,18 +135,18 @@ def program_exec_timer(mode, module="time", frac_precision=3):
135
135
  def snippet_exec_timer(snippet_str,
136
136
  repeats=None,
137
137
  trials=int(1e4),
138
- roundoff=None,
138
+ decimal_places=None,
139
139
  format_time_str=False,
140
140
  return_best_time=False):
141
141
 
142
- # Roundoff validation #
143
- #-#-#-#-#-#-#-#-#-#-#-#
142
+ # Decimal places validation #
143
+ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#
144
144
 
145
145
  param_keys = get_caller_args()
146
- roundoff_arg_pos = find_substring_index(param_keys, "roundoff")
146
+ decimal_places_arg_pos = find_substring_index(param_keys, "decimal_places")
147
147
 
148
- if not isinstance(roundoff, int):
149
- raise TypeError(format_string(TYPE_ERROR_TEMPLATE, f'{param_keys[roundoff_arg_pos]}'))
148
+ if not isinstance(decimal_places, int):
149
+ raise TypeError(format_string(TYPE_ERROR_TEMPLATE, f'{param_keys[decimal_places_arg_pos]}'))
150
150
 
151
151
  # Set keyword argument dictionary for float time parsing #
152
152
  #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
@@ -154,7 +154,7 @@ def snippet_exec_timer(snippet_str,
154
154
  float_time_parsing_kwargs = dict(
155
155
  module="str",
156
156
  origin="arbitrary",
157
- frac_precision=roundoff
157
+ frac_precision=decimal_places
158
158
  )
159
159
 
160
160
  # Execution time in the specified number of trials with no repeats #
@@ -170,8 +170,8 @@ def snippet_exec_timer(snippet_str,
170
170
  exec_time_norep = timeit.repeat(snippet_str, repeat=1, number=10000)[0]
171
171
  """
172
172
 
173
- if roundoff is not None:
174
- exec_time_norep = np_round(exec_time_norep, roundoff)
173
+ if decimal_places is not None:
174
+ exec_time_norep = np_round(exec_time_norep, decimal_places)
175
175
 
176
176
  if not format_time_str:
177
177
  time_unit_str = SEC_TIME_UNIT_STR
@@ -192,8 +192,8 @@ def snippet_exec_timer(snippet_str,
192
192
  number=trials,
193
193
  globals=globals())
194
194
 
195
- if roundoff is not None:
196
- exec_time_rep = np_round(exec_time_rep, roundoff)
195
+ if decimal_places is not None:
196
+ exec_time_rep = np_round(exec_time_rep, decimal_places)
197
197
 
198
198
  # Compute best time
199
199
  best_time = min(exec_time_rep)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygenutils
3
- Version: 16.3.0
3
+ Version: 16.3.1
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pygenutils"
7
- version = "16.3.0"
7
+ version = "16.3.1"
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"]
File without changes
File without changes
File without changes
File without changes
File without changes