corelp 1.0.32__py3-none-any.whl → 1.0.34__py3-none-any.whl
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.
- corelp/modules/Section_LP/Section.py +1 -1
- corelp/modules/main_LP/main.py +1 -1
- corelp/modules/print_LP/print.py +10 -6
- corelp/modules/user_inputs_LP/test_user_inputs.py +2 -1
- corelp/modules/user_inputs_LP/user_inputs.py +25 -33
- {corelp-1.0.32.dist-info → corelp-1.0.34.dist-info}/METADATA +1 -3
- {corelp-1.0.32.dist-info → corelp-1.0.34.dist-info}/RECORD +8 -8
- {corelp-1.0.32.dist-info → corelp-1.0.34.dist-info}/WHEEL +0 -0
|
@@ -14,7 +14,7 @@ This class defines decorator instances allowing to create section functions.
|
|
|
14
14
|
|
|
15
15
|
# %% Libraries
|
|
16
16
|
from corelp import print, folder, selfkwargs, kwargsself
|
|
17
|
-
from dataclasses import dataclass
|
|
17
|
+
from dataclasses import dataclass
|
|
18
18
|
import pickle
|
|
19
19
|
import joblib
|
|
20
20
|
from pathlib import Path
|
corelp/modules/main_LP/main.py
CHANGED
|
@@ -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.
|
corelp/modules/print_LP/print.py
CHANGED
|
@@ -52,8 +52,8 @@ class Print() :
|
|
|
52
52
|
|
|
53
53
|
Parameters
|
|
54
54
|
----------
|
|
55
|
-
|
|
56
|
-
The
|
|
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,
|
|
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
|
|
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)
|
|
@@ -14,25 +14,19 @@ Gets last user inputs dictionnary from global variables.
|
|
|
14
14
|
|
|
15
15
|
# %% Libraries
|
|
16
16
|
import inspect
|
|
17
|
-
from IPython import get_ipython
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
# %% Function
|
|
22
|
-
_user_inputs = {} # User inputs cache
|
|
23
21
|
|
|
24
|
-
def user_inputs() :
|
|
22
|
+
def user_inputs(reset=False) :
|
|
25
23
|
r"""
|
|
26
|
-
Return a dictionary of variables defined by the user in the interactive
|
|
27
|
-
environment.
|
|
24
|
+
Return a dictionary of variables defined by the user in the interactive environment.
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
variable = user_inputs()
|
|
34
|
-
|
|
35
|
-
Instead, call it directly when needed.
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
reset : bool
|
|
29
|
+
True to set as first call.
|
|
36
30
|
|
|
37
31
|
Returns
|
|
38
32
|
-------
|
|
@@ -42,36 +36,34 @@ def user_inputs() :
|
|
|
42
36
|
Examples
|
|
43
37
|
--------
|
|
44
38
|
>>> from corelp import user_inputs
|
|
45
|
-
>>> user_inputs() # First call (initializes and clears import-related variables)
|
|
46
|
-
|
|
39
|
+
>>> user_inputs(True) # First call (initializes and clears import-related variables)
|
|
40
|
+
None
|
|
47
41
|
>>> a = 1 # User defines a variable
|
|
48
42
|
>>> user_inputs() # Now returns: {'a': 1}
|
|
49
43
|
{'a': 1}
|
|
50
44
|
"""
|
|
45
|
+
frame = inspect.currentframe().f_back
|
|
46
|
+
ns = {**frame.f_globals, **frame.f_locals}
|
|
51
47
|
|
|
52
|
-
# ----
|
|
53
|
-
|
|
48
|
+
# ---- Filter user variables (ignore internals starting with "_") ----
|
|
49
|
+
ns = {key: value for key, value in ns.items() if not key.startswith("_")}
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
else:
|
|
59
|
-
# Running in normal Python script
|
|
60
|
-
frame = inspect.currentframe().f_back
|
|
61
|
-
ns = {**frame.f_globals, **frame.f_locals}
|
|
51
|
+
# Validate status
|
|
52
|
+
if reset :
|
|
53
|
+
user_inputs.cache = None
|
|
62
54
|
|
|
63
|
-
#
|
|
64
|
-
|
|
55
|
+
# Case when user_inputs is on top : cache = None
|
|
56
|
+
if user_inputs.cache is None :
|
|
57
|
+
user_inputs.cache = ns
|
|
58
|
+
return
|
|
65
59
|
|
|
66
|
-
#
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
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
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
return updated
|
|
66
|
+
user_inputs.cache = None
|
|
75
67
|
|
|
76
68
|
|
|
77
69
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: corelp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.34
|
|
4
4
|
Summary: A library that gathers core functions for python programming.
|
|
5
|
-
Requires-Dist: ipython
|
|
6
|
-
Requires-Dist: ipywidgets
|
|
7
5
|
Requires-Dist: joblib
|
|
8
6
|
Requires-Dist: rich
|
|
9
7
|
Requires-Python: >=3.12
|
|
@@ -3,7 +3,7 @@ corelp/icon_pythonLP.png,sha256=pg386kYEKGspDDRbRF0alOmHXPEm0geMoYIPaxEfQ_o,3805
|
|
|
3
3
|
corelp/modules/Path_LP/Path.py,sha256=wfvO1DuewIUSEA9_g66O5nCEp95Pr5XM-yxaOOEimTs,2418
|
|
4
4
|
corelp/modules/Path_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
corelp/modules/Path_LP/test_Path.py,sha256=8VSn9VVbhc3EDxXpxQV18rnAq_T2a1uuoRFKdmsqX-I,715
|
|
6
|
-
corelp/modules/Section_LP/Section.py,sha256=
|
|
6
|
+
corelp/modules/Section_LP/Section.py,sha256=LQwy3rb4XP3aq3mLtZRBg2AeTYX4bosnYJbIsCpbYIs,6060
|
|
7
7
|
corelp/modules/Section_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
corelp/modules/Section_LP/test_Section.py,sha256=zcrIbJueMDT90t0_M-RD40IWpkx4OT7Q52tE6HzbfIo,812
|
|
9
9
|
corelp/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -19,10 +19,10 @@ corelp/modules/kwargsself_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
19
19
|
corelp/modules/kwargsself_LP/kwargsself.py,sha256=24HVn1G7ALdhQFSLT0U2dVjVzop6c2s-nr7DrMK53iw,1865
|
|
20
20
|
corelp/modules/kwargsself_LP/test_kwargsself.py,sha256=BaqGu0bqFuFemiYUEDMviFfegTb0aF6lmeFm3KJa8sw,1241
|
|
21
21
|
corelp/modules/main_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
corelp/modules/main_LP/main.py,sha256=
|
|
22
|
+
corelp/modules/main_LP/main.py,sha256=KHMcpptT2WV1THzFvjjyesbnY5oq0-4eC1_ewufoWug,10281
|
|
23
23
|
corelp/modules/main_LP/test_main.py,sha256=mxL645pZdkJ8J5MFdj0K-z8xRCGKQ0zw1NvmW3iPGB4,1741
|
|
24
24
|
corelp/modules/print_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
corelp/modules/print_LP/print.py,sha256=
|
|
25
|
+
corelp/modules/print_LP/print.py,sha256=qPCqLpY2PdGLQaWmZKv9oh-MnvmpNYAplPeOcizO0uU,8662
|
|
26
26
|
corelp/modules/print_LP/test_print.py,sha256=uMmCrnyIVSlZg_ZEOk2mr5zDlEpTN2KMq4jFu5p6n4I,2292
|
|
27
27
|
corelp/modules/prop_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
corelp/modules/prop_LP/prop.py,sha256=lfsENmjg65mpXxt9V9n3Nn__wHgNJA61l8_UXBKn1lc,3999
|
|
@@ -37,13 +37,13 @@ corelp/modules/test_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
37
37
|
corelp/modules/test_LP/test.py,sha256=KwAeIZWQ7pZX85J50q6qfB4HuJUgREu1ieB_byPqI2g,1361
|
|
38
38
|
corelp/modules/test_LP/test_test.py,sha256=sXI6G4OBnWXSqrfMy9QdabkYIvcD80EmnNcnQiXxcRI,605
|
|
39
39
|
corelp/modules/user_inputs_LP/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
corelp/modules/user_inputs_LP/test_user_inputs.py,sha256
|
|
41
|
-
corelp/modules/user_inputs_LP/user_inputs.py,sha256=
|
|
40
|
+
corelp/modules/user_inputs_LP/test_user_inputs.py,sha256=-6YzBomJxIZSfnfbJPvnfgon3K5RTC3WQKNT4enpVH0,947
|
|
41
|
+
corelp/modules/user_inputs_LP/user_inputs.py,sha256=5VHik_6hY0rhJDWDYn5kTxFkprG1JYPMAUGNPSb4lK4,1779
|
|
42
42
|
corelp/modules.json,sha256=ZQ8BMU8X2u71wfVj_AufwOoJUPdaxU_AHn7Ohbkp-Pc,3122
|
|
43
43
|
corelp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
44
|
corelp/pythonLP.png:Zone.Identifier,sha256=uVLSTPcBvE56fSHhroXGEYJOgFeaiYNsDLSbGTRGzP4,25
|
|
45
45
|
corelp/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
corelp/scripts.json,sha256=RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o,2
|
|
47
|
-
corelp-1.0.
|
|
48
|
-
corelp-1.0.
|
|
49
|
-
corelp-1.0.
|
|
47
|
+
corelp-1.0.34.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
48
|
+
corelp-1.0.34.dist-info/METADATA,sha256=4a4JVrRulRRApDoRKaQUB5NoneBNkgOuMpyCltkSMek,1698
|
|
49
|
+
corelp-1.0.34.dist-info/RECORD,,
|
|
File without changes
|