-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ChiRun and nonyaml functionality. Needs testing.
- Loading branch information
Showing
6 changed files
with
78 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
Email: [email protected] | ||
Description: | ||
""" | ||
from shutil import rmtree | ||
from shutil import rmtree, copy | ||
from pathlib import Path | ||
from copy import deepcopy | ||
from .chi_param import ChiParam | ||
|
@@ -33,14 +33,14 @@ def __init__(self, node_path: Path, | |
opts : _type_, optional | ||
parser options, by default None | ||
params : _type_, optional | ||
_description_, by default None | ||
_description_ TODO, by default None | ||
Raises | ||
------ | ||
TypeError | ||
_description_ | ||
_description_ TODO | ||
RuntimeError | ||
_description_ | ||
_description_ TODO | ||
""" | ||
if isinstance(node_path, Path): | ||
self._node_path = node_path | ||
|
@@ -78,8 +78,7 @@ def make_node_dir(self, node_path: Path, overwrite: bool = False) -> None: | |
return | ||
|
||
self._chi_dict.write_out_yaml_files(node_path) | ||
# TODO initialize nonyaml files and test | ||
# self.make_nonyaml_files(self._path) | ||
self.make_nonyaml_files(node_path, self._opts.overwrite) | ||
# self.make_analysis_dir(self._path) | ||
# self.make_misc_dir(self._path) | ||
# if len(self._chi_params): | ||
|
@@ -88,6 +87,21 @@ def make_node_dir(self, node_path: Path, overwrite: bool = False) -> None: | |
|
||
self._chi_dict.write_out_yaml_files(node_path) | ||
|
||
def make_nonyaml_files(self, dir_path: Path, overwrite: bool = False) -> None: | ||
for nyf in self._opts.non_yaml: | ||
if nyf.exists(): | ||
new_nyf = dir_path / nyf.name | ||
if new_nyf.exists(): | ||
if overwrite: | ||
new_nyf.unlink() | ||
else: | ||
raise RuntimeError( | ||
f"Non-yaml file {new_nyf} already exists. Use the overwrite flag to overwrite.") | ||
copy(nyf, new_nyf) | ||
else: | ||
raise RuntimeError( | ||
f"Non-yaml file {nyf} does not exist.") | ||
|
||
def make_data_dir(self, path: Path, overwrite: bool = False) -> None: | ||
self._data_dir = path / "data" | ||
return self.create_dir(self._data_dir, overwrite) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters