From 1e2253f4f2d3992415c97dd0e22648243fd2e016 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 9 Aug 2024 19:58:30 -0600 Subject: [PATCH] Use f-strings consistently --- bmi_topography/bbox.py | 16 ++++------------ bmi_topography/cli.py | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/bmi_topography/bbox.py b/bmi_topography/bbox.py index 39ff3f9..9b7b376 100644 --- a/bmi_topography/bbox.py +++ b/bmi_topography/bbox.py @@ -21,16 +21,12 @@ def __init__(self, lower_left: tuple[float], upper_right: tuple[float]) -> None: if not isinstance(self.lower_left, Iterable) or len(self.lower_left) != 2: raise ValueError( - "lower left coordinate ({}) must have two elements".format( - self.lower_left - ) + f"lower left coordinate ({self.lower_left}) must have two elements" ) if not isinstance(self.upper_right, Iterable) or len(self.upper_right) != 2: raise ValueError( - "upper right coordinate ({}) must have two elements".format( - self.upper_right - ) + f"upper right coordinate ({self.upper_right}) must have two elements" ) if self.south > 90 or self.south < -90: @@ -41,9 +37,7 @@ def __init__(self, lower_left: tuple[float], upper_right: tuple[float]) -> None: if self.south > self.north: raise ValueError( - "south coordinate ({}) must be less than north ({})".format( - self.south, self.north - ) + f"south coordinate ({self.south}) must be less than north ({self.north})" ) if self.west > 180 or self.west < -180: @@ -54,9 +48,7 @@ def __init__(self, lower_left: tuple[float], upper_right: tuple[float]) -> None: if self.west > self.east: raise ValueError( - "west coordinate ({}) must be less than east ({})".format( - self.west, self.east - ) + f"west coordinate ({self.west}) must be less than east ({self.east})" ) @property diff --git a/bmi_topography/cli.py b/bmi_topography/cli.py index ba23961..e6da5e4 100644 --- a/bmi_topography/cli.py +++ b/bmi_topography/cli.py @@ -78,7 +78,7 @@ def main(quiet, dem_type, south, north, west, east, output_format, api_key, no_f path_to_dem = topo.fetch() if not quiet: click.secho( - "File downloaded to {}".format(getattr(topo, "cache_dir")), + f"File downloaded to {getattr(topo, "cache_dir")}", fg="green", err=True, )