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 8
8
9
9
from pydantic import validator
10
10
from .util import Model , _generating_documentation
11
+ import yaml
11
12
12
13
13
14
class ParamData (Model ):
@@ -577,3 +578,13 @@ def validate_functions(cls, value):
577
578
if v is None :
578
579
value [k ] = FunctionData ()
579
580
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):
586
586
587
587
self ._add_addl_data_file (fname )
588
588
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
-
598
589
def on_build_gen (
599
590
self , cxx_gen_dir , missing_reporter : Optional [MissingReporter ] = None
600
591
):
@@ -637,7 +628,7 @@ def on_build_gen(
637
628
datapath = join (self .setup_root , normpath (self .cfg .generation_data ))
638
629
per_header = isdir (datapath )
639
630
if not per_header :
640
- data = self . _load_generation_data (datapath )
631
+ data = AutowrapConfigYaml . from_file (datapath )
641
632
else :
642
633
data = AutowrapConfigYaml ()
643
634
@@ -694,7 +685,7 @@ def on_build_gen(
694
685
print ("WARNING: could not find" , data_fname )
695
686
data = AutowrapConfigYaml ()
696
687
else :
697
- data = self . _load_generation_data (data_fname )
688
+ data = AutowrapConfigYaml . from_file (data_fname )
698
689
699
690
# split instantiation of each template to separate cpp files to reduce
700
691
# compiler memory for really obscene objects
You can’t perform that action at this time.
0 commit comments