diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d4254c..8489f55 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,6 +17,12 @@ repos: - id: check-added-large-files args: ["--maxkb=5000"] + - repo: https://github.com/ikamensh/flynt + rev: 1.0.1 + hooks: + - id: flynt + args: ["--fail-on-change"] + - repo: https://github.com/psf/black rev: 23.12.1 hooks: @@ -27,12 +33,6 @@ repos: hooks: - id: isort - - repo: https://github.com/ikamensh/flynt - rev: 1.0.1 - hooks: - - id: flynt - args: ["--fail-on-change"] - - repo: https://github.com/PyCQA/docformatter rev: v1.7.5 hooks: diff --git a/climateset/processing/raw/checker.py b/climateset/processing/raw/checker.py index 037bd8c..01df48c 100644 --- a/climateset/processing/raw/checker.py +++ b/climateset/processing/raw/checker.py @@ -287,9 +287,8 @@ def check_variables(self): if actual_var != named_var: self.results["var_ok"] = False LOGGER.warning( - "The following file contains the variable {}, but the variable {} was expected: \n{}".format( - actual_var, named_var, self.input_file - ) + f"The following file contains the variable {actual_var}, but the variable {named_var} " + f"was expected: \n{self.input_file}" ) else: self.results["var_ok"] = True @@ -337,9 +336,8 @@ def check_resolution(self): if actual_spat_res != named_spat_res: self.results["res_ok"] = False LOGGER.warning( - "The following file has the nominal resolution {}, but the resolution {} was expected: \n{}".format( - actual_spat_res, named_spat_res, self.input_file - ) + f"The following file has the nominal resolution {actual_spat_res}, but the resolution " + f"{named_spat_res} was expected: \n{self.input_file}" ) else: self.results["res_ok"] = True @@ -349,9 +347,8 @@ def check_resolution(self): if actual_temp_res != named_temp_res: self.dataset["freq_ok"] = False LOGGER.warning( - "The following file has the temporal frequency {}, but the frequency {} was expected: \n{}".format( - actual_temp_res, named_temp_res, self.input_file - ) + f"The following file has the temporal frequency {actual_temp_res}, but the frequency " + f"{named_temp_res} was expected: \n{self.input_file}" ) else: self.dataset["freq_ok"] = True @@ -377,9 +374,7 @@ def check_units_ok(self): if found_unit != expected_unit: self.results["units_ok"] = False LOGGER.warning( - "The following file has the unit {}, but the unit {} was expected: \n{}".format( - found_unit, expected_unit, self.input_file - ) + f"The following file has the unit {found_unit}, but the unit {expected_unit} was expected: \n{self.input_file}" ) else: self.results["units_ok"] = True diff --git a/noxfile.py b/noxfile.py index 42460cb..888c791 100644 --- a/noxfile.py +++ b/noxfile.py @@ -55,9 +55,9 @@ def docformatter(session): @nox.session() def check(session): paths = get_paths(session) + session.run("poetry", "run", "flynt", *paths["all"], external=True) session.run("poetry", "run", "black", "--check", *paths["all"], external=True) session.run("poetry", "run", "isort", *paths["all"], "--check", external=True) - session.run("poetry", "run", "flynt", *paths["all"], external=True) session.run( "poetry", "run", @@ -74,9 +74,9 @@ def check(session): @nox.session() def fix(session): paths = get_paths(session) + session.run("poetry", "run", "flynt", *paths["all"], external=True) session.run("poetry", "run", "black", *paths["all"], external=True) session.run("poetry", "run", "isort", *paths["all"], external=True) - session.run("poetry", "run", "flynt", *paths["all"], external=True) session.run( "poetry", "run",