Skip to content

Commit d146cd6

Browse files
pylint
1 parent 0d52ae0 commit d146cd6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

causal_testing/json_front/json_class.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ def check_file_exists(output_path: Path, overwrite: bool):
239239
:param output_path: File path for the output file of the JSON Frontend
240240
:param overwrite: bool that if true, the current file can be overwritten
241241
"""
242-
if overwrite:
243-
file = open(output_path, "w", encoding="utf-8")
244-
file.close()
245-
elif output_path.is_file():
246-
raise FileExistsError(f"Chosen file output ({output_path}) already exists")
242+
if output_path.is_file():
243+
if overwrite:
244+
output_path.unlink()
245+
else:
246+
raise FileExistsError(f"Chosen file output ({output_path}) already exists")
247247

248248
@staticmethod
249249
def get_args(test_args=None) -> argparse.Namespace:

0 commit comments

Comments
 (0)