File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 4
4
import tempfile
5
5
import uuid
6
6
from pathlib import Path
7
- from types import MappingProxyType
7
+ from typing import Any
8
8
9
9
from geophires_x_client .common import _get_logger
10
10
from hip_ra import HIP_RA
11
11
12
12
13
13
class HipRaInputParameters :
14
14
15
- def __init__ (self , file_path_or_params_dict : str | MappingProxyType ):
15
+ def __init__ (self , file_path_or_params_dict : Any ):
16
16
if isinstance (file_path_or_params_dict , dict ):
17
17
tmp_file_path = Path (tempfile .gettempdir (), f'hip-ra-params_{ uuid .uuid1 ()} .txt' )
18
18
with open (tmp_file_path , 'w' ) as f :
19
19
f .writelines (
20
20
[', ' .join ([str (p ) for p in param_item ]) + '\n ' for param_item in file_path_or_params_dict .items ()]
21
21
)
22
22
file_path_or_params_dict = str (tmp_file_path )
23
+ elif not isinstance (file_path_or_params_dict , (str , Path )):
24
+ raise ValueError ('Provide either file path as string or parameters as dict' )
23
25
24
26
self ._input_file_path = Path (file_path_or_params_dict )
25
27
self ._output_file_path = Path (
Original file line number Diff line number Diff line change @@ -445,6 +445,9 @@ def test_hip_ra_input_parameters_init(self):
445
445
input_file_contents ,
446
446
)
447
447
448
+ with self .assertRaises (ValueError ):
449
+ HipRaInputParameters (1 )
450
+
448
451
def _new_hip_ra_test_instance (self , enable_hip_ra_logging_config = False , pre_re_stash_runner = None ) -> HIP_RA_X :
449
452
stash_cwd = Path .cwd ()
450
453
stash_sys_argv = sys .argv
You can’t perform that action at this time.
0 commit comments