Skip to content

Commit

Permalink
Fix some f-string and make flynt run before black
Browse files Browse the repository at this point in the history
  • Loading branch information
f-PLT committed Nov 1, 2024
1 parent f1fed49 commit 8097ac2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
19 changes: 7 additions & 12 deletions climateset/processing/raw/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 8097ac2

Please sign in to comment.