@@ -75,9 +75,7 @@ def create_forecast(self, tstring: str, **kwargs) -> None:
75
75
"""Creates a forecast based on the model's logic."""
76
76
pass
77
77
78
- def get_source (
79
- self , zenodo_id : int = None , giturl : str = None , ** kwargs
80
- ) -> None :
78
+ def get_source (self , zenodo_id : int = None , giturl : str = None , ** kwargs ) -> None :
81
79
"""
82
80
Search, download or clone the model source in the filesystem, zenodo.
83
81
@@ -108,14 +106,16 @@ def get_source(
108
106
elif giturl :
109
107
log .info (f"Retrieving model { self .name } from git url: " f"{ giturl } " )
110
108
try :
111
- from_git (giturl , self .registry .dir if self .registry .fmt else self .registry ("path" ), ** kwargs )
109
+ from_git (
110
+ giturl ,
111
+ self .registry .dir if self .registry .fmt else self .registry ("path" ),
112
+ ** kwargs ,
113
+ )
112
114
except (git .NoSuchPathError , git .CommandError ) as msg :
113
115
raise git .NoSuchPathError (f"git url was not found { msg } " )
114
116
else :
115
117
raise FileNotFoundError ("Model has no path or identified" )
116
118
117
-
118
-
119
119
if not os .path .exists (self .registry .dir ) or not os .path .exists (self .registry ("path" )):
120
120
raise FileNotFoundError (
121
121
f"Directory '{ self .registry .dir } ' or file { self .registry } ' do not exist. "
@@ -165,7 +165,7 @@ def iter_attr(val):
165
165
]
166
166
167
167
dict_walk = {i : j for i , j in list_walk }
168
- dict_walk [' path' ] = dict_walk .pop (' registry' )
168
+ dict_walk [" path" ] = dict_walk .pop (" registry" )
169
169
170
170
return {self .name : iter_attr (dict_walk )}
171
171
@@ -223,17 +223,14 @@ def stage(self, timewindows: Sequence[Sequence[datetime]] = None) -> None:
223
223
224
224
"""
225
225
226
- if self .force_stage or not self .registry .fileexists (' path' ):
226
+ if self .force_stage or not self .registry .fileexists (" path" ):
227
227
os .makedirs (self .registry .dir , exist_ok = True )
228
228
self .get_source (self .zenodo_id , self .giturl , branch = self .repo_hash )
229
229
230
230
if self .store_db :
231
231
self .init_db ()
232
232
233
- self .registry .build_tree (
234
- timewindows = timewindows ,
235
- model_class = self .__class__ .__name__
236
- )
233
+ self .registry .build_tree (timewindows = timewindows , model_class = self .__class__ .__name__ )
237
234
238
235
def init_db (self , dbpath : str = "" , force : bool = False ) -> None :
239
236
"""
@@ -377,7 +374,6 @@ def __init__(
377
374
378
375
self .registry = ForecastRegistry (kwargs .get ("workdir" , os .getcwd ()), model_path )
379
376
self .build = kwargs .get ("build" , None )
380
- self .run_prefix = ""
381
377
382
378
if self .func :
383
379
self .environment = EnvironmentFactory .get_env (
@@ -393,7 +389,7 @@ def stage(self, timewindows=None) -> None:
393
389
- Initialize database
394
390
- Run model quality assurance (unit tests, runnable from floatcsep)
395
391
"""
396
- if self .force_stage or not self .registry .fileexists (' path' ):
392
+ if self .force_stage or not self .registry .fileexists (" path" ):
397
393
os .makedirs (self .registry .dir , exist_ok = True )
398
394
self .get_source (self .zenodo_id , self .giturl , branch = self .repo_hash )
399
395
@@ -494,6 +490,7 @@ def replace_arg(arg, val, fp):
494
490
replace_arg ("end_date" , end .isoformat (), filepath )
495
491
for i , j in kwargs .items ():
496
492
replace_arg (i , j , filepath )
493
+
497
494
elif fmt == ".json" :
498
495
with open (filepath , "r" ) as file_ :
499
496
args = json .load (file_ )
0 commit comments