@@ -88,8 +88,8 @@ def change_directory() -> Optional[Path]:
8888 if config .args .problem :
8989 # TODO #102: replace cast with typed Namespace field
9090 problem_dir = cast (Path , config .args .problem ).absolute ()
91- elif is_problem_directory (Path () .cwd ()):
92- problem_dir = Path () .cwd ().absolute ()
91+ elif is_problem_directory (Path .cwd ()):
92+ problem_dir = Path .cwd ().absolute ()
9393 if problem_dir is not None :
9494 config .level = "problem"
9595 os .chdir (problem_dir .parent )
@@ -101,7 +101,7 @@ def change_directory() -> Optional[Path]:
101101# or check the existence of problem.yaml and sort by shortname.
102102def get_problems (problem_dir : Optional [Path ]) -> tuple [list [Problem ], Path ]:
103103 # We create one tmpdir per contest.
104- h = hashlib .sha256 (bytes (Path () .cwd ())).hexdigest ()[- 6 :]
104+ h = hashlib .sha256 (bytes (Path .cwd ())).hexdigest ()[- 6 :]
105105 tmpdir = Path (tempfile .gettempdir ()) / ("bapctools_" + h )
106106 tmpdir .mkdir (parents = True , exist_ok = True )
107107
@@ -1022,7 +1022,7 @@ def read_personal_config(problem_dir: Optional[Path]) -> dict[str, Any]:
10221022 config_files = []
10231023 if problem_dir :
10241024 config_files .append (problem_dir / ".bapctools.yaml" )
1025- config_files .append (Path () .cwd () / ".bapctools.yaml" )
1025+ config_files .append (Path .cwd () / ".bapctools.yaml" )
10261026 if home_config :
10271027 config_files .append (home_config / "bapctools" / "config.yaml" )
10281028
@@ -1047,10 +1047,10 @@ def run_parsed_arguments(args: argparse.Namespace, personal_config: bool = True)
10471047 missing_args = config .set_default_args ()
10481048
10491049 # cd to contest directory
1050- call_cwd = Path () .cwd ().absolute ()
1050+ call_cwd = Path .cwd ().absolute ()
10511051 problem_dir = change_directory ()
10521052 level = config .level
1053- contest_name = Path () .cwd ().name
1053+ contest_name = Path .cwd ().name
10541054
10551055 if personal_config :
10561056 personal_args = read_personal_config (problem_dir )
@@ -1443,7 +1443,7 @@ def test(args: list[str]) -> None:
14431443
14441444 # Make sure to cd back to the original directory before returning.
14451445 # Needed to stay in the same directory in tests.
1446- original_directory = Path () .cwd ()
1446+ original_directory = Path .cwd ()
14471447 config .n_warn = 0
14481448 config .n_error = 0
14491449 contest ._contest_yaml = None
0 commit comments