MCPcopy
hub / github.com/microsoft/qlib / config

Method config

qlib/utils/serial.py:81–113  ·  view source on GitHub ↗

configure the serializable object Parameters ---------- kwargs may include following keys dump_all : bool will the object dump all object exclude : list What attribute will not be dumped include :

(self, recursive=False, **kwargs)

Source from the content-addressed store, hash-verified

79 return res
80
81 def config(self, recursive=False, **kwargs):
82 """
83 configure the serializable object
84
85 Parameters
86 ----------
87 kwargs may include following keys
88
89 dump_all : bool
90 will the object dump all object
91 exclude : list
92 What attribute will not be dumped
93 include : list
94 What attribute will be dumped
95
96 recursive : bool
97 will the configuration be recursive
98 """
99 keys = {"dump_all", "exclude", "include"}
100 for k, v in kwargs.items():
101 if k in keys:
102 attr_name = f"_{k}"
103 setattr(self, attr_name, v)
104 else:
105 raise KeyError(f"Unknown parameter: {k}")
106
107 if recursive:
108 for obj in self.__dict__.values():
109 # set flag to prevent endless loop
110 self.__dict__[self.FLAG_KEY] = True
111 if isinstance(obj, Serializable) and self.FLAG_KEY not in obj.__dict__:
112 obj.config(recursive=True, **kwargs)
113 del self.__dict__[self.FLAG_KEY]
114
115 def to_pickle(self, path: Union[Path, str], **kwargs):
116 """

Callers 15

to_pickleMethod · 0.95
dump_and_load_datasetMethod · 0.45
_dump_pre_handlerMethod · 0.45
rolling_processMethod · 0.45
fitMethod · 0.45
predictMethod · 0.45
fitMethod · 0.45
predictMethod · 0.45
fitMethod · 0.45
predictMethod · 0.45
fitMethod · 0.45
predictMethod · 0.45

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected