Skip to content

Commit

Permalink
refactor: Use Path.cwd instead of os.path.curdir
Browse files Browse the repository at this point in the history
  • Loading branch information
lsetiawan committed Jan 23, 2024
1 parent 0e7858c commit 97bc22b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/caustics/sims/state_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from collections import OrderedDict
from typing import Any, Dict, Optional
from pathlib import Path
import os

from torch import Tensor
import torch
Expand Down Expand Up @@ -185,7 +184,7 @@ def save(self, file_path: Optional[str] = None) -> str:
The final path of the saved file
"""
if not file_path:
file_path = Path(os.path.curdir) / self.__st_file
file_path = Path.cwd() / self.__st_file
elif isinstance(file_path, str):
file_path = Path(file_path)

Expand Down
3 changes: 1 addition & 2 deletions tests/sims/test_state_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path
from tempfile import TemporaryDirectory
import os
import sys

import pytest
Expand Down Expand Up @@ -138,7 +137,7 @@ def test_st_file_string(self, simple_state_dict):

def test_save(self, simple_state_dict):
# Check for default save path
expected_fpath = Path(os.path.curdir) / simple_state_dict._StateDict__st_file
expected_fpath = Path.cwd() / simple_state_dict._StateDict__st_file
default_fpath = simple_state_dict.save()

assert Path(default_fpath).exists()
Expand Down

0 comments on commit 97bc22b

Please sign in to comment.