mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-14 16:32:16 +02:00
refine code
This commit is contained in:
parent
1edff983f0
commit
31eb3fe0ee
5 changed files with 20 additions and 17 deletions
|
|
@ -23,10 +23,10 @@ class YamlModel(BaseModel):
|
|||
return yaml.safe_load(file)
|
||||
|
||||
@classmethod
|
||||
def model_validate_yaml(cls, file_path: Path) -> "YamlModel":
|
||||
def from_yaml_file(cls, file_path: Path) -> "YamlModel":
|
||||
return cls(**cls.read_yaml(file_path))
|
||||
|
||||
def model_dump_yaml(self, file_path: Path) -> None:
|
||||
def to_yaml_file(self, file_path: Path) -> None:
|
||||
with open(file_path, "w") as file:
|
||||
yaml.dump(self.model_dump(), file)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue