File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 88
99from pydantic import validator
1010from .util import Model , _generating_documentation
11+ import yaml
1112
1213
1314class ParamData (Model ):
@@ -577,3 +578,13 @@ def validate_functions(cls, value):
577578 if v is None :
578579 value [k ] = FunctionData ()
579580 return value
581+
582+ @classmethod
583+ def from_file (cls , fname ) -> "AutowrapConfigYaml" :
584+ with open (fname ) as fp :
585+ data = yaml .safe_load (fp )
586+
587+ if data is None :
588+ data = {}
589+
590+ return cls (** data )
Original file line number Diff line number Diff line change @@ -586,15 +586,6 @@ def get_type_casters(casters):
586586
587587 self ._add_addl_data_file (fname )
588588
589- def _load_generation_data (self , datafile ):
590- with open (datafile ) as fp :
591- data = yaml .safe_load (fp )
592-
593- if data is None :
594- data = {}
595-
596- return AutowrapConfigYaml (** data )
597-
598589 def on_build_gen (
599590 self , cxx_gen_dir , missing_reporter : Optional [MissingReporter ] = None
600591 ):
@@ -637,7 +628,7 @@ def on_build_gen(
637628 datapath = join (self .setup_root , normpath (self .cfg .generation_data ))
638629 per_header = isdir (datapath )
639630 if not per_header :
640- data = self . _load_generation_data (datapath )
631+ data = AutowrapConfigYaml . from_file (datapath )
641632 else :
642633 data = AutowrapConfigYaml ()
643634
@@ -694,7 +685,7 @@ def on_build_gen(
694685 print ("WARNING: could not find" , data_fname )
695686 data = AutowrapConfigYaml ()
696687 else :
697- data = self . _load_generation_data (data_fname )
688+ data = AutowrapConfigYaml . from_file (data_fname )
698689
699690 # split instantiation of each template to separate cpp files to reduce
700691 # compiler memory for really obscene objects
You can’t perform that action at this time.
0 commit comments