|
22 | 22 | from vtr import paths
|
23 | 23 |
|
24 | 24 |
|
25 |
| -# The run directory name passed by set_global_run_dir is the run directory name to parse. If it is None, |
26 |
| -# the latest run directory will be parsed. |
27 |
| -global_run_dir_name = None |
| 25 | +class RunDir: |
| 26 | + """ |
| 27 | + A class for representing a run directory. |
| 28 | + """ |
| 29 | + # The run directory name passed by set_global_run_dir |
| 30 | + # is the run directory name to parse. |
| 31 | + # If it is None, the latest run directory will be parsed. |
| 32 | + g_run_dir_name = None |
| 33 | + |
| 34 | + |
| 35 | + |
28 | 36 |
|
29 | 37 |
|
30 | 38 | class RawDefaultHelpFormatter(
|
@@ -230,12 +238,11 @@ def run_system_command(
|
230 | 238 | # pylint: enable=too-many-arguments, too-many-instance-attributes, too-few-public-methods, too-many-locals
|
231 | 239 |
|
232 | 240 |
|
233 |
| -def set_global_run_dir(run_dir_name): |
| 241 | +def set_global_run_dir(current_run_dir_name): |
234 | 242 | """
|
235 | 243 | Set the global run directory name.
|
236 | 244 | """
|
237 |
| - global global_run_dir_name |
238 |
| - global_run_dir_name = run_dir_name |
| 245 | + RunDir.g_run_dir_name = current_run_dir_name |
239 | 246 |
|
240 | 247 |
|
241 | 248 | def check_cmd(command):
|
@@ -576,9 +583,8 @@ def get_latest_run_dir_name(base_dir):
|
576 | 583 | """
|
577 | 584 | Returns the highest run number of all run directories with in base_dir
|
578 | 585 | """
|
579 |
| - global global_run_dir_name |
580 |
| - if global_run_dir_name is not None: |
581 |
| - return global_run_dir_name |
| 586 | + if RunDir.g_run_dir_name is not None: |
| 587 | + return RunDir.g_run_dir_name |
582 | 588 | else:
|
583 | 589 | run_number = 1
|
584 | 590 | run_dir = Path(base_dir) / run_dir_name(run_number)
|
|
0 commit comments