ModelFlowIb 2.60__tar.gz → 2.62__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.
- {modelflowib-2.60 → modelflowib-2.62}/ModelFlowIb.egg-info/PKG-INFO +1 -1
- {modelflowib-2.60 → modelflowib-2.62}/PKG-INFO +1 -1
- {modelflowib-2.60 → modelflowib-2.62}/modelclass.py +65 -41
- {modelflowib-2.60 → modelflowib-2.62}/modeldashsidebar.py +3 -3
- {modelflowib-2.60 → modelflowib-2.62}/modelreport.py +4 -3
- {modelflowib-2.60 → modelflowib-2.62}/pyproject.toml +1 -1
- {modelflowib-2.60 → modelflowib-2.62}/ModelFlowIb.egg-info/SOURCES.txt +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/ModelFlowIb.egg-info/dependency_links.txt +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/ModelFlowIb.egg-info/requires.txt +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/ModelFlowIb.egg-info/top_level.txt +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelBLfunk.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_Excel.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_cvx.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_doable.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_dynare.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_financial_stability.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_ifrs9.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_latex.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_latex_class.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/model_run_numba.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelclass2.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeldash.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeldashboot.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeldekom.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeldiff.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeldisplay.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelfeedback.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelgrab.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelgrabwf2.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelhelp.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelinvert.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeljupyter.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeljupytermagic.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelmacrograb.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelmanipulation.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelmf.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelnet.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelnewton.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelnormalize.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelpattern.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelpatternrev.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelsandbox.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelsandbox_Mixin.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeltodo.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeluserfunk.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modeluserfunk_old.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelvis.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelwidget.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelwidget_input.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/modelwidget_shinypy.py +0 -0
- {modelflowib-2.60 → modelflowib-2.62}/setup.cfg +0 -0
|
@@ -2074,6 +2074,8 @@ class Model_help_Mixin():
|
|
|
2074
2074
|
repo_name: str = 'wb-repos',
|
|
2075
2075
|
branch: str = 'main',
|
|
2076
2076
|
destination = './wb-repos',
|
|
2077
|
+
subfolder = '',
|
|
2078
|
+
|
|
2077
2079
|
go = True,
|
|
2078
2080
|
colab=False,
|
|
2079
2081
|
silent=True,
|
|
@@ -2106,12 +2108,21 @@ class Model_help_Mixin():
|
|
|
2106
2108
|
Copy files from src to dst if they do not already exist in dst.
|
|
2107
2109
|
src and dst are Path objects or strings representing the source and destination directories.
|
|
2108
2110
|
"""
|
|
2111
|
+
# src_path = Path(src) / subfolder
|
|
2109
2112
|
src_path = Path(src)
|
|
2113
|
+
|
|
2110
2114
|
dst_path = Path(dst)
|
|
2111
|
-
|
|
2115
|
+
# print(f'Source {src_path.resolve()=}')
|
|
2116
|
+
|
|
2112
2117
|
for item in src_path.glob('**/*'): # **/* means all files and directories recursively
|
|
2118
|
+
# print(f'{item=}')
|
|
2113
2119
|
if item.is_file(): # Only proceed if it's a file
|
|
2114
2120
|
relative_path = item.relative_to(src_path)
|
|
2121
|
+
# print(f'{relative_path.parts=}')
|
|
2122
|
+
if subfolder:
|
|
2123
|
+
# print(f'{relative_path.parts[1]} = {subfolder}')
|
|
2124
|
+
if relative_path.parts[1] != subfolder :
|
|
2125
|
+
continue
|
|
2115
2126
|
relative_path_parts_except_first = relative_path.parts[1:]
|
|
2116
2127
|
relative_path_except_first = Path(*relative_path_parts_except_first)
|
|
2117
2128
|
destination_file = dst_path / relative_path_except_first
|
|
@@ -2153,7 +2164,7 @@ class Model_help_Mixin():
|
|
|
2153
2164
|
return f"An error occurred: {e}"
|
|
2154
2165
|
|
|
2155
2166
|
|
|
2156
|
-
new_location =Path(destination)
|
|
2167
|
+
new_location =Path(destination)
|
|
2157
2168
|
|
|
2158
2169
|
# if reset:
|
|
2159
2170
|
# if new_location.exists() and new_location.is_dir():
|
|
@@ -2162,6 +2173,9 @@ class Model_help_Mixin():
|
|
|
2162
2173
|
|
|
2163
2174
|
|
|
2164
2175
|
copy_new_files_only(extract_to,new_location)
|
|
2176
|
+
if not silent:
|
|
2177
|
+
print(f'Start in : {new_location/subfolder}')
|
|
2178
|
+
print(f'Models copied to: {new_location.resolve()}')
|
|
2165
2179
|
shutil.rmtree(extract_to)
|
|
2166
2180
|
if go:
|
|
2167
2181
|
if colab:
|
|
@@ -2169,22 +2183,66 @@ class Model_help_Mixin():
|
|
|
2169
2183
|
colab=colab,
|
|
2170
2184
|
owner = owner,
|
|
2171
2185
|
repo_name = repo_name,
|
|
2172
|
-
branch = branch,
|
|
2186
|
+
branch = branch, skipdir=2 if subfolder else 1
|
|
2173
2187
|
|
|
2174
2188
|
)
|
|
2175
2189
|
else:
|
|
2176
|
-
model.display_toc_github('**Avaiable notebooks**',folder=new_location,
|
|
2190
|
+
model.display_toc_github('**Avaiable notebooks**',folder=new_location,
|
|
2191
|
+
colab=False, skipdir=2 if subfolder else 1,
|
|
2192
|
+
|
|
2193
|
+
)
|
|
2177
2194
|
|
|
2178
2195
|
|
|
2179
2196
|
return
|
|
2197
|
+
|
|
2198
|
+
@staticmethod
|
|
2199
|
+
def Worldbank_Models(owner: str = "worldbank",
|
|
2200
|
+
repo_name: str = 'MFMod-ModelFlow',
|
|
2201
|
+
branch: str = 'main',
|
|
2202
|
+
destination = './WorldbankModels',
|
|
2203
|
+
subfolder = 'models',
|
|
2204
|
+
go = True,
|
|
2205
|
+
silent=True,
|
|
2206
|
+
replace = False ,
|
|
2207
|
+
):
|
|
2208
|
+
"""
|
|
2209
|
+
Download an entire GitHub repository and extract it to a specified location.
|
|
2180
2210
|
|
|
2211
|
+
Parameters:
|
|
2212
|
+
owner: The owner of the GitHub repository.
|
|
2213
|
+
repo_name: The name of the repository.
|
|
2214
|
+
branch: The branch to download.
|
|
2215
|
+
destination: The local path where the repository should be extracted.
|
|
2216
|
+
go: display toc of notebooks
|
|
2217
|
+
silent: keep silent
|
|
2218
|
+
|
|
2219
|
+
Returns:
|
|
2220
|
+
A message indicating whether the download was successful or not.
|
|
2221
|
+
"""
|
|
2222
|
+
|
|
2223
|
+
return model.download_github_repo(owner = owner,
|
|
2224
|
+
repo_name = repo_name,
|
|
2225
|
+
branch = branch,
|
|
2226
|
+
destination = destination ,
|
|
2227
|
+
subfolder = subfolder,
|
|
2228
|
+
go = go ,
|
|
2229
|
+
silent=silent,
|
|
2230
|
+
replace = replace,
|
|
2231
|
+
colab=model.is_running_in_colab()
|
|
2232
|
+
)
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2181
2238
|
@staticmethod
|
|
2182
2239
|
def display_toc_github(text='**Jupyter notebooks**',folder='.',all=False,nocwd=False,
|
|
2183
2240
|
colab=True,
|
|
2184
2241
|
owner: str = "IbHansen",
|
|
2185
2242
|
repo_name: str = 'wb-repos',
|
|
2186
2243
|
branch: str = 'main',
|
|
2187
|
-
destination = './wb-repos',
|
|
2244
|
+
destination = './wb-repos',
|
|
2245
|
+
skipdir = 1,
|
|
2188
2246
|
|
|
2189
2247
|
):
|
|
2190
2248
|
'''In a jupyter notebook this function displays a clickable table of content of all
|
|
@@ -2213,7 +2271,7 @@ class Model_help_Mixin():
|
|
|
2213
2271
|
blanks = ''.join(
|
|
2214
2272
|
[' ']*len(dir.parts))
|
|
2215
2273
|
if len(dir.parts):
|
|
2216
|
-
thisdir = Path(*dir.parts[
|
|
2274
|
+
thisdir = Path(*dir.parts[skipdir:])
|
|
2217
2275
|
display(HTML(f'{blanks}<b>{str(thisdir)}</b>'))
|
|
2218
2276
|
else:
|
|
2219
2277
|
display(
|
|
@@ -2236,41 +2294,7 @@ class Model_help_Mixin():
|
|
|
2236
2294
|
|
|
2237
2295
|
|
|
2238
2296
|
|
|
2239
|
-
|
|
2240
|
-
def Worldbank_Models(owner: str = "worldbank",
|
|
2241
|
-
repo_name: str = 'MFMod-ModelFlow',
|
|
2242
|
-
branch: str = 'main',
|
|
2243
|
-
destination = './WorldbankModels',
|
|
2244
|
-
go = True,
|
|
2245
|
-
silent=True,
|
|
2246
|
-
replace = False ,
|
|
2247
|
-
):
|
|
2248
|
-
"""
|
|
2249
|
-
Download an entire GitHub repository and extract it to a specified location.
|
|
2250
|
-
|
|
2251
|
-
Parameters:
|
|
2252
|
-
owner: The owner of the GitHub repository.
|
|
2253
|
-
repo_name: The name of the repository.
|
|
2254
|
-
branch: The branch to download.
|
|
2255
|
-
destination: The local path where the repository should be extracted.
|
|
2256
|
-
go: display toc of notebooks
|
|
2257
|
-
silent: keep silent
|
|
2258
|
-
|
|
2259
|
-
Returns:
|
|
2260
|
-
A message indicating whether the download was successful or not.
|
|
2261
|
-
"""
|
|
2262
|
-
|
|
2263
|
-
return model.download_github_repo(owner = owner,
|
|
2264
|
-
repo_name = repo_name,
|
|
2265
|
-
branch = branch,
|
|
2266
|
-
destination = destination ,
|
|
2267
|
-
go = go ,
|
|
2268
|
-
silent=silent,
|
|
2269
|
-
replace = replace,
|
|
2270
|
-
colab=model.is_running_in_colab()
|
|
2271
|
-
)
|
|
2272
|
-
|
|
2273
|
-
|
|
2297
|
+
|
|
2274
2298
|
|
|
2275
2299
|
|
|
2276
2300
|
@staticmethod
|
|
@@ -123,14 +123,14 @@ def app_run(app,jupyter=False,debug=False,port=5000,inline=False):
|
|
|
123
123
|
# print(f'{jupyter=} {inline=}')
|
|
124
124
|
if jupyter:
|
|
125
125
|
if inline:
|
|
126
|
-
xx = app.
|
|
126
|
+
xx = app.run(debug=debug,port=port,mode='inline')
|
|
127
127
|
else:
|
|
128
128
|
if first_call or 1:
|
|
129
129
|
Timer(1, open_browser).start()
|
|
130
130
|
first_call = False
|
|
131
131
|
# print('ko')
|
|
132
132
|
|
|
133
|
-
xx =app.
|
|
133
|
+
xx =app.run(debug=debug,port=port,jupyter_mode='external')
|
|
134
134
|
# print('gris')
|
|
135
135
|
|
|
136
136
|
# print(f'{xx=}')
|
|
@@ -138,7 +138,7 @@ def app_run(app,jupyter=False,debug=False,port=5000,inline=False):
|
|
|
138
138
|
else:
|
|
139
139
|
Timer(1, open_browser).start()
|
|
140
140
|
|
|
141
|
-
xx = app.
|
|
141
|
+
xx = app.run(debug=debug,port=port,mode="external")
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
|
|
@@ -556,8 +556,9 @@ class DisplayDef:
|
|
|
556
556
|
try:
|
|
557
557
|
repo = LatexRepo(self.latex ,name=self.name)
|
|
558
558
|
return repo.pdf(pdfopen,show,width,height,typesetter)
|
|
559
|
-
except:
|
|
560
|
-
|
|
559
|
+
except Exception as e:
|
|
560
|
+
print(f"⚠️ Warning: PDF generation failed: {e}")
|
|
561
|
+
return None
|
|
561
562
|
|
|
562
563
|
def __add__(self, other):
|
|
563
564
|
"""
|
|
@@ -795,7 +796,7 @@ class LatexRepo:
|
|
|
795
796
|
if xx0.returncode:
|
|
796
797
|
wb.open(latex_dir.absolute(), new=1)
|
|
797
798
|
|
|
798
|
-
raise Exception(f'Error creating PDF file, {xx0.returncode}
|
|
799
|
+
raise Exception(f'Error creating PDF file, {xx0.returncode},\n is latex installed?. If so look in the latex file, {latex_file}')
|
|
799
800
|
|
|
800
801
|
if pdfopen:
|
|
801
802
|
fileurl = f'file://{pdf_file.resolve()}'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|