corelp 1.0.33__tar.gz → 1.0.35__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 (50) hide show
  1. {corelp-1.0.33 → corelp-1.0.35}/PKG-INFO +1 -1
  2. {corelp-1.0.33 → corelp-1.0.35}/pyproject.toml +1 -1
  3. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/print_LP/print.py +10 -6
  4. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/user_inputs_LP/test_user_inputs.py +2 -1
  5. corelp-1.0.35/src/corelp/modules/user_inputs_LP/user_inputs.py +87 -0
  6. corelp-1.0.33/src/corelp/modules/user_inputs_LP/user_inputs.py +0 -72
  7. {corelp-1.0.33 → corelp-1.0.35}/README.md +0 -0
  8. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/__init__.py +0 -0
  9. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/icon_pythonLP.png +0 -0
  10. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/Path_LP/Path.py +0 -0
  11. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/Path_LP/__init__.py +0 -0
  12. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/Path_LP/test_Path.py +0 -0
  13. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/Section_LP/Section.py +0 -0
  14. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/Section_LP/__init__.py +0 -0
  15. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/Section_LP/test_Section.py +0 -0
  16. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/__init__.py +0 -0
  17. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/debug_LP/__init__.py +0 -0
  18. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/debug_LP/debug.py +0 -0
  19. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/debug_LP/test_debug.py +0 -0
  20. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/folder_LP/__init__.py +0 -0
  21. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/folder_LP/folder.py +0 -0
  22. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/folder_LP/test_folder.py +0 -0
  23. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/getmodule_LP/__init__.py +0 -0
  24. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/getmodule_LP/getmodule.py +0 -0
  25. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/kwargsself_LP/__init__.py +0 -0
  26. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/kwargsself_LP/kwargsself.py +0 -0
  27. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/kwargsself_LP/test_kwargsself.py +0 -0
  28. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/main_LP/__init__.py +0 -0
  29. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/main_LP/main.py +0 -0
  30. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/main_LP/test_main.py +0 -0
  31. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/print_LP/__init__.py +0 -0
  32. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/print_LP/test_print.py +0 -0
  33. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/prop_LP/__init__.py +0 -0
  34. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/prop_LP/prop.py +0 -0
  35. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/prop_LP/test_prop.py +0 -0
  36. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/rfrom_LP/__init__.py +0 -0
  37. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/rfrom_LP/rfrom.py +0 -0
  38. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/rfrom_LP/test_rfrom.py +0 -0
  39. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/selfkwargs_LP/__init__.py +0 -0
  40. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/selfkwargs_LP/selfkwargs.py +0 -0
  41. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/selfkwargs_LP/test_selfkwargs.py +0 -0
  42. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/test_LP/__init__.py +0 -0
  43. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/test_LP/test.py +0 -0
  44. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/test_LP/test_test.py +0 -0
  45. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules/user_inputs_LP/__init__.py +0 -0
  46. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/modules.json +0 -0
  47. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/py.typed +0 -0
  48. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/pythonLP.png:Zone.Identifier +0 -0
  49. {corelp-1.0.33 → corelp-1.0.35}/src/corelp/scripts/__init__.py +0 -0
  50. {corelp-1.0.33 → corelp-1.0.35}/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.35
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.35"
4
4
  description = "A library that gathers core functions for python programming."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -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
 
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Date : 2025-11-30
4
+ # Author : Lancelot PINCET
5
+ # GitHub : https://github.com/LancelotPincet
6
+ # Library : coreLP
7
+ # Module : user_inputs
8
+
9
+ """
10
+ Gets last user inputs dictionnary from global variables.
11
+ """
12
+
13
+
14
+
15
+ # %% Libraries
16
+ import inspect
17
+
18
+
19
+
20
+ # %% Function
21
+
22
+ def user_inputs(reset=False) :
23
+ r"""
24
+ Return a dictionary of variables defined by the user in the interactive environment.
25
+
26
+ Parameters
27
+ ----------
28
+ reset : bool or str
29
+ True to set as first call, String value to define a group of parameters
30
+
31
+ Returns
32
+ -------
33
+ dict
34
+ A dictionary containing the user's currently defined variables.
35
+
36
+ Examples
37
+ --------
38
+ >>> from corelp import user_inputs
39
+ >>> user_inputs(True) # First call (initializes and clears import-related variables)
40
+ None
41
+ >>> a = 1 # User defines a variable
42
+ >>> user_inputs() # Now returns: {'a': 1}
43
+ {'a': 1}
44
+ """
45
+ frame = inspect.currentframe().f_back
46
+ ns = {**frame.f_globals, **frame.f_locals}
47
+
48
+ # ---- Filter user variables (ignore internals starting with "_") ----
49
+ ns = {key: value for key, value in ns.items() if not key.startswith("_")}
50
+
51
+ # Validate status
52
+ if reset :
53
+ user_inputs.current_group = reset if isinstance(reset, str) else None
54
+ user_inputs.cache = None
55
+
56
+ # Case when user_inputs is on top : cache = None
57
+ if user_inputs.cache is None :
58
+ user_inputs.cache = ns
59
+ return
60
+
61
+ # Case when user_inputs is at bottom : cache = dict
62
+ else :
63
+ updated = { key: value for key, value in ns.items() if key not in user_inputs.cache or user_inputs.cache[key] is not value}
64
+ values = {key: value for key, value in updated.items() if not key.endswith('_')}
65
+ comments = {key: value for key, value in updated.items() if key.endswith('_')}
66
+
67
+ # Group values
68
+ if user_inputs.current_group is not None :
69
+ user_inputs.groups_values[user_inputs.current_group] = values
70
+ user_inputs.groups_comments[user_inputs.current_group] = comments
71
+
72
+ # End
73
+ user_inputs.current_group = None
74
+ user_inputs.cache = None
75
+ return values
76
+
77
+ user_inputs.cache = None
78
+ user_inputs.current_group = None
79
+ user_inputs.groups_values = {}
80
+ user_inputs.groups_comments = {}
81
+
82
+
83
+
84
+ # %% Test function run
85
+ if __name__ == "__main__":
86
+ from corelp import test
87
+ test(__file__)
@@ -1,72 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Date : 2025-11-30
4
- # Author : Lancelot PINCET
5
- # GitHub : https://github.com/LancelotPincet
6
- # Library : coreLP
7
- # Module : user_inputs
8
-
9
- """
10
- Gets last user inputs dictionnary from global variables.
11
- """
12
-
13
-
14
-
15
- # %% Libraries
16
- import inspect
17
-
18
-
19
-
20
- # %% Function
21
-
22
- def user_inputs() :
23
- r"""
24
- Return a dictionary of variables defined by the user in the interactive
25
- environment.
26
-
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.
34
-
35
- Returns
36
- -------
37
- dict
38
- A dictionary containing the user's currently defined variables.
39
-
40
- Examples
41
- --------
42
- >>> from corelp import user_inputs
43
- >>> user_inputs() # First call (initializes and clears import-related variables)
44
- {}
45
- >>> a = 1 # User defines a variable
46
- >>> user_inputs() # Now returns: {'a': 1}
47
- {'a': 1}
48
- """
49
-
50
- frame = inspect.currentframe().f_back
51
- ns = {**frame.f_globals, **frame.f_locals}
52
-
53
- # ---- Filter user variables (ignore internals starting with "_") ----
54
- ns = {k: v for k, v in ns.items() if not k.startswith("_")}
55
-
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
- }
62
-
63
- user_inputs.cache.update(updated)
64
- return updated
65
-
66
- user_inputs.cache = {}
67
-
68
-
69
- # %% Test function run
70
- if __name__ == "__main__":
71
- from corelp import test
72
- test(__file__)
File without changes
File without changes
File without changes
File without changes
File without changes