Skip to content

Commit 56b91c8

Browse files
committed
Removed unused option from directory builder
1 parent 20fbd4f commit 56b91c8

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

pcpostprocess/directory_builder.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,27 @@ def get_git_revision_hash():
1010
Get the hash for the git commit currently being used.
1111
1212
@return The most recent commit hash or a suitable message
13-
1413
"""
15-
1614
return __commit_id__
1715

1816

1917
def get_build_type():
20-
if "dev" in __version__:
21-
return "Develop"
22-
else:
23-
return "Release"
18+
return 'Develop' if 'dev' in __version__ else 'Release'
2419

2520

26-
def setup_output_directory(dirname: str = None, subdir_name: str = None):
21+
def setup_output_directory(dirname: str):
2722
"""
2823
Create an output directory if one doesn't already exist. Place an info
2924
file in this directory which lists the date/time created, the version of
3025
pcpostprocess, the command-line arguments provided, and the most recent git
3126
commit. The two parameters allow for a user specified top-level directory and
3227
a script-defined name for a subdirectory.
3328
34-
@param Optional directory name
35-
@param Optional subdirectory name
29+
@param Directory name
3630
3731
@return The path to the created file directory (String)
3832
"""
39-
40-
if dirname is None:
41-
if subdir_name:
42-
dirname = os.path.join("output", f"{subdir_name}")
43-
else:
44-
dirname = os.path.join("output", "output")
45-
46-
if subdir_name is not None:
47-
dirname = os.path.join(dirname, subdir_name)
48-
if not os.path.exists(dirname):
49-
os.makedirs(dirname)
33+
os.makedirs(dirname, exist_ok=True)
5034

5135
with open(os.path.join(dirname, "pcpostprocess_info.txt"), "w") as description_fout:
5236
git_hash = get_git_revision_hash()

pcpostprocess/tests/test_directory_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_directory_builder(self):
2727
if store_output: # pragma: no cover
2828
d = 'test_output'
2929
path = directory_builder.setup_output_directory(
30-
d, 'directory_builder')
30+
os.path.join(d, 'directory_builder'))
3131

3232
# Check that git commit is written
3333
info_dict = read_info_dict(

0 commit comments

Comments
 (0)