corelp 1.0.33__tar.gz → 1.0.34__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 (49) hide show
  1. {corelp-1.0.33 → corelp-1.0.34}/PKG-INFO +1 -1
  2. {corelp-1.0.33 → corelp-1.0.34}/pyproject.toml +1 -1
  3. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/main_LP/main.py +1 -1
  4. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/print_LP/print.py +10 -6
  5. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/user_inputs_LP/test_user_inputs.py +2 -1
  6. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/user_inputs_LP/user_inputs.py +24 -23
  7. {corelp-1.0.33 → corelp-1.0.34}/README.md +0 -0
  8. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/__init__.py +0 -0
  9. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/icon_pythonLP.png +0 -0
  10. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/Path_LP/Path.py +0 -0
  11. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/Path_LP/__init__.py +0 -0
  12. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/Path_LP/test_Path.py +0 -0
  13. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/Section_LP/Section.py +0 -0
  14. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/Section_LP/__init__.py +0 -0
  15. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/Section_LP/test_Section.py +0 -0
  16. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/__init__.py +0 -0
  17. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/debug_LP/__init__.py +0 -0
  18. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/debug_LP/debug.py +0 -0
  19. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/debug_LP/test_debug.py +0 -0
  20. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/folder_LP/__init__.py +0 -0
  21. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/folder_LP/folder.py +0 -0
  22. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/folder_LP/test_folder.py +0 -0
  23. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/getmodule_LP/__init__.py +0 -0
  24. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/getmodule_LP/getmodule.py +0 -0
  25. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/kwargsself_LP/__init__.py +0 -0
  26. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/kwargsself_LP/kwargsself.py +0 -0
  27. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/kwargsself_LP/test_kwargsself.py +0 -0
  28. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/main_LP/__init__.py +0 -0
  29. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/main_LP/test_main.py +0 -0
  30. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/print_LP/__init__.py +0 -0
  31. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/print_LP/test_print.py +0 -0
  32. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/prop_LP/__init__.py +0 -0
  33. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/prop_LP/prop.py +0 -0
  34. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/prop_LP/test_prop.py +0 -0
  35. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/rfrom_LP/__init__.py +0 -0
  36. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/rfrom_LP/rfrom.py +0 -0
  37. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/rfrom_LP/test_rfrom.py +0 -0
  38. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/selfkwargs_LP/__init__.py +0 -0
  39. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/selfkwargs_LP/selfkwargs.py +0 -0
  40. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/selfkwargs_LP/test_selfkwargs.py +0 -0
  41. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/test_LP/__init__.py +0 -0
  42. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/test_LP/test.py +0 -0
  43. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/test_LP/test_test.py +0 -0
  44. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules/user_inputs_LP/__init__.py +0 -0
  45. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/modules.json +0 -0
  46. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/py.typed +0 -0
  47. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/pythonLP.png:Zone.Identifier +0 -0
  48. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/scripts/__init__.py +0 -0
  49. {corelp-1.0.33 → corelp-1.0.34}/src/corelp/scripts.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: corelp
3
- Version: 1.0.33
3
+ Version: 1.0.34
4
4
  Summary: A library that gathers core functions for python programming.
5
5
  Requires-Dist: joblib
6
6
  Requires-Dist: rich
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "corelp"
3
- version = "1.0.33"
3
+ version = "1.0.34"
4
4
  description = "A library that gathers core functions for python programming."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -25,7 +25,7 @@ import types
25
25
 
26
26
 
27
27
  # %% Function
28
- def main() :
28
+ def main(*, import_path:str=None, export_path:str=None, new:bool=True, bulk=None, overnight:bool=False, run_name:str=None) :
29
29
  '''
30
30
  This function can decorate the main function of a script.
31
31
  User inputs parameters shoud be put in the beginning of the main file, and the decorated function will recognize them.
@@ -52,8 +52,8 @@ class Print() :
52
52
 
53
53
  Parameters
54
54
  ----------
55
- string : object
56
- The object to print. Its :meth:`__str__` representation is used.
55
+ *strings : tuple
56
+ The objects to print. Its :meth:`__str__` representation is used.
57
57
  verbose : bool, optional
58
58
  If ``True`` (default), printing is performed.
59
59
  If ``False``, printing is skipped unless overridden.
@@ -135,14 +135,17 @@ class Print() :
135
135
  """
136
136
 
137
137
  # Main function
138
- def __call__(self, string, verbose=None, *, return_string=False, file=None, mode='a', end='\n', **kwargs) :
138
+ def __call__(self, *strings, verbose=None, return_string=False, file=None, mode='a', end='\n', **kwargs) :
139
+
139
140
  # Muting
140
141
  verbose = verbose if verbose is not None else self.verbose
141
142
  if not verbose :
142
143
  return None
143
144
 
145
+ # Formatting string
146
+ string = ", ".join([str(string) for string in strings]) + end
147
+
144
148
  # Printing markdown
145
- string = str(string) + end
146
149
  self.print(Markdown(string), **kwargs)
147
150
 
148
151
  # Writting to file
@@ -170,7 +173,7 @@ class Print() :
170
173
  def log(self) :
171
174
  return self.console.log
172
175
  pyprint = pyprint # python print
173
- richprint = richprint # rich print
176
+ richprint = richprint # rich prints
174
177
 
175
178
 
176
179
 
@@ -281,7 +284,8 @@ class Print() :
281
284
  AvgLoopTimeColumn(),
282
285
  TimeRemainingColumn(),
283
286
  EndTimeColumn(),
284
- transient=False
287
+ transient=False,
288
+ console=self.console
285
289
  )
286
290
 
287
291
  _bars : dict = field(default=None, repr=False)
@@ -34,7 +34,8 @@ def test_user_inputs() :
34
34
  raise ValueError(f'{inputs} should be dict(a=1)')
35
35
  user_inputs() #init
36
36
  b = 2
37
- if user_inputs() != {'b': 2} :
37
+ inputs = user_inputs()
38
+ if inputs != {'b': 2} :
38
39
  raise ValueError(f'{inputs} should be dict(b=2)')
39
40
 
40
41
 
@@ -19,18 +19,14 @@ import inspect
19
19
 
20
20
  # %% Function
21
21
 
22
- def user_inputs() :
22
+ def user_inputs(reset=False) :
23
23
  r"""
24
- Return a dictionary of variables defined by the user in the interactive
25
- environment.
24
+ Return a dictionary of variables defined by the user in the interactive environment.
26
25
 
27
- This function is intended for use inside other functions via
28
- ``function(**user_inputs())``.
29
- **It should not be used to store its return value**, e.g. **do not do**::
30
-
31
- variable = user_inputs()
32
-
33
- Instead, call it directly when needed.
26
+ Parameters
27
+ ----------
28
+ reset : bool
29
+ True to set as first call.
34
30
 
35
31
  Returns
36
32
  -------
@@ -40,30 +36,35 @@ def user_inputs() :
40
36
  Examples
41
37
  --------
42
38
  >>> from corelp import user_inputs
43
- >>> user_inputs() # First call (initializes and clears import-related variables)
44
- {}
39
+ >>> user_inputs(True) # First call (initializes and clears import-related variables)
40
+ None
45
41
  >>> a = 1 # User defines a variable
46
42
  >>> user_inputs() # Now returns: {'a': 1}
47
43
  {'a': 1}
48
44
  """
49
-
50
45
  frame = inspect.currentframe().f_back
51
46
  ns = {**frame.f_globals, **frame.f_locals}
52
47
 
53
48
  # ---- Filter user variables (ignore internals starting with "_") ----
54
- ns = {k: v for k, v in ns.items() if not k.startswith("_")}
49
+ ns = {key: value for key, value in ns.items() if not key.startswith("_")}
50
+
51
+ # Validate status
52
+ if reset :
53
+ user_inputs.cache = None
54
+
55
+ # Case when user_inputs is on top : cache = None
56
+ if user_inputs.cache is None :
57
+ user_inputs.cache = ns
58
+ return
55
59
 
56
- # ---- Return only new or updated variables ----
57
- updated = {
58
- k: v
59
- for k, v in ns.items()
60
- if k not in user_inputs.cache or user_inputs.cache[k] is not v
61
- }
60
+ # Case when user_inputs is at bottom : cache = dict
61
+ else :
62
+ updated = { key: value for key, value in ns.items() if key not in user_inputs.cache or user_inputs.cache[key] is not value}
63
+ user_inputs.cache = None
64
+ return updated
62
65
 
63
- user_inputs.cache.update(updated)
64
- return updated
66
+ user_inputs.cache = None
65
67
 
66
- user_inputs.cache = {}
67
68
 
68
69
 
69
70
  # %% Test function run
File without changes
File without changes
File without changes
File without changes
File without changes