Skip to content

Commit 9394b98

Browse files
committed
fix lints
1 parent 2a858bd commit 9394b98

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

neps/plot/tensorboard_eval.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class tblogger: # noqa: N801
3939
@classmethod
4040
def initiate_internal_configurations(
4141
cls,
42-
root_directory: Path | None = None,
43-
pipeline_directory: Path | None = None,
44-
previous_pipeline_directory: Path | None = None,
42+
root_directory: Path | str | None = None,
43+
pipeline_directory: Path | str | None = None,
44+
previous_pipeline_directory: Path | str | None = None,
4545
) -> None:
4646
"""Initialize internal directories and configuration for TensorBoard logging.
4747
@@ -71,6 +71,26 @@ def initiate_internal_configurations(
7171
if trial.metadata.previous_trial_location
7272
else None
7373
)
74+
else:
75+
# Convert str paths to Path objects
76+
root_directory = (
77+
Path(root_directory)
78+
if isinstance(root_directory, str)
79+
else root_directory
80+
)
81+
pipeline_directory = (
82+
Path(pipeline_directory)
83+
if isinstance(pipeline_directory, str)
84+
else pipeline_directory
85+
)
86+
previous_pipeline_directory = (
87+
Path(previous_pipeline_directory)
88+
if isinstance(previous_pipeline_directory, str)
89+
else previous_pipeline_directory
90+
)
91+
92+
if previous_pipeline_directory and not previous_pipeline_directory.exists():
93+
previous_pipeline_directory = None
7494

7595
register_notify_trial_end("NEPS_TBLOGGER", cls.end_of_config)
7696

0 commit comments

Comments
 (0)