From 8e5992dc40fb04736289462e4dcacdb1cf16f2ef Mon Sep 17 00:00:00 2001 From: mgrover1 Date: Mon, 29 Apr 2024 08:08:36 -0500 Subject: [PATCH 1/2] FIX: Fix linting errors causing errors in CI --- examples/plotting/plot_rhi_cfradial.py | 2 +- examples/plotting/plot_rhi_cfradial_singlescan.py | 2 +- pyart/aux_io/gamic_hdf5.py | 4 ++-- pyart/aux_io/odim_h5.py | 4 ++-- pyart/aux_io/radx_grid.py | 2 +- pyart/aux_io/sinarame_h5.py | 2 +- pyart/core/grid.py | 2 +- pyart/core/radar.py | 4 ++-- pyart/correct/unwrap.py | 6 +++--- pyart/graph/common.py | 2 +- pyart/graph/radardisplay.py | 12 ++++++------ pyart/graph/radardisplay_airborne.py | 4 ++-- pyart/io/cfradial.py | 4 ++-- pyart/io/common.py | 2 +- pyart/io/mdv_grid.py | 6 +++--- pyart/io/mdv_radar.py | 4 ++-- pyart/io/nexrad_cdm.py | 4 ++-- pyart/io/uf_write.py | 2 +- pyart/map/gates_to_grid.py | 4 ++-- pyart/map/grid_mapper.py | 8 ++++---- pyart/xradar/accessor.py | 4 ++-- tests/io/test_auto_read.py | 2 +- tests/io/test_cfradial.py | 10 +++++----- tests/io/test_chl.py | 8 ++++---- tests/io/test_mdv_radar.py | 12 ++++++------ tests/io/test_nexrad_archive_msg1.py | 6 +++--- tests/io/test_nexrad_archive_msg31.py | 8 ++++---- tests/io/test_nexrad_cdm.py | 8 ++++---- tests/io/test_rsl.py | 12 ++++++------ tests/io/test_sigmet.py | 12 ++++++------ tests/test_debug_info.py | 2 +- 31 files changed, 82 insertions(+), 82 deletions(-) diff --git a/examples/plotting/plot_rhi_cfradial.py b/examples/plotting/plot_rhi_cfradial.py index db6b365dd3..5878a28706 100755 --- a/examples/plotting/plot_rhi_cfradial.py +++ b/examples/plotting/plot_rhi_cfradial.py @@ -34,7 +34,7 @@ for snum in radar.sweep_number["data"]: fixed_angle = radar.fixed_angle["data"][snum] - title = "HSRHI Az=%.3f" % (fixed_angle) + title = f"HSRHI Az={fixed_angle:.3f}" ax = fig.add_subplot(nplots, 1, snum + 1) display.plot( "reflectivity_horizontal", diff --git a/examples/plotting/plot_rhi_cfradial_singlescan.py b/examples/plotting/plot_rhi_cfradial_singlescan.py index fcf9ea7c4e..088b74d2c3 100755 --- a/examples/plotting/plot_rhi_cfradial_singlescan.py +++ b/examples/plotting/plot_rhi_cfradial_singlescan.py @@ -29,7 +29,7 @@ # nplots = radar.nsweeps fixed_angle = radar.fixed_angle["data"][0] -title = "HSRHI Az=%.3f" % (fixed_angle) +title = f"HSRHI Az={fixed_angle:.3f}" ax = fig.add_subplot(1, 1, 1) display.plot( "reflectivity_horizontal", diff --git a/pyart/aux_io/gamic_hdf5.py b/pyart/aux_io/gamic_hdf5.py index a504bc70a7..75bee60e69 100644 --- a/pyart/aux_io/gamic_hdf5.py +++ b/pyart/aux_io/gamic_hdf5.py @@ -38,7 +38,7 @@ def read_gamic( valid_range_from_file=True, units_from_file=True, pulse_width=None, - **kwargs + **kwargs, ): """ Read a GAMIC hdf5 file. @@ -167,7 +167,7 @@ def read_gamic( if not gfile.is_file_single_scan_type(): raise NotImplementedError("Mixed scan_type volume.") if scan_type not in ["ppi", "rhi"]: - message = "Unknown scan type: %s, reading as RHI scans." % (scan_type) + message = f"Unknown scan type: {scan_type}, reading as RHI scans." warnings.warn(message) scan_type = "rhi" diff --git a/pyart/aux_io/odim_h5.py b/pyart/aux_io/odim_h5.py index 92c3a047aa..abaf0f4c3a 100644 --- a/pyart/aux_io/odim_h5.py +++ b/pyart/aux_io/odim_h5.py @@ -48,7 +48,7 @@ def read_odim_h5( include_fields=None, include_datasets=None, exclude_datasets=None, - **kwargs + **kwargs, ): """ Read a ODIM_H5 file. @@ -130,7 +130,7 @@ def read_odim_h5( with h5py.File(filename, "r") as hfile: odim_object = _to_str(hfile["what"].attrs["object"]) if odim_object not in ["PVOL", "SCAN", "ELEV", "AZIM"]: - raise NotImplementedError("object: %s not implemented." % (odim_object)) + raise NotImplementedError(f"object: {odim_object} not implemented.") # determine the number of sweeps by the number of groups which # begin with dataset diff --git a/pyart/aux_io/radx_grid.py b/pyart/aux_io/radx_grid.py index a1adbd9c1c..b9c4df2e95 100644 --- a/pyart/aux_io/radx_grid.py +++ b/pyart/aux_io/radx_grid.py @@ -161,7 +161,7 @@ def read_radx_grid(filename, exclude_fields=None, **kwargs): field_dic["data"].shape = field_shape fields[field] = field_dic else: - warnings.warn("Field %s skipped due to incorrect shape" % (field)) + warnings.warn(f"Field {field} skipped due to incorrect shape") # radar_ variables if "radar_latitude" in dset.variables: diff --git a/pyart/aux_io/sinarame_h5.py b/pyart/aux_io/sinarame_h5.py index 4088293e96..8d5e0f2741 100644 --- a/pyart/aux_io/sinarame_h5.py +++ b/pyart/aux_io/sinarame_h5.py @@ -128,7 +128,7 @@ def read_sinarame_h5( hfile = h5py.File(filename, "r") SINARAME_object = _to_str(hfile["what"].attrs["object"]) if SINARAME_object not in ["PVOL", "SCAN", "ELEV", "AZIM"]: - raise NotImplementedError("object: %s not implemented." % (SINARAME_object)) + raise NotImplementedError(f"object: {SINARAME_object} not implemented.") # determine the number of sweeps by the number of groups which # begin with dataset diff --git a/pyart/core/grid.py b/pyart/core/grid.py index 22dfe1fb0b..7d36dbc622 100644 --- a/pyart/core/grid.py +++ b/pyart/core/grid.py @@ -389,7 +389,7 @@ def add_field(self, field_name, field_dict, replace_existing=False): if "data" not in field_dict: raise KeyError('Field dictionary must contain a "data" key') if field_name in self.fields and replace_existing is False: - raise ValueError("A field named %s already exists" % (field_name)) + raise ValueError(f"A field named {field_name} already exists") if field_dict["data"].shape != (self.nz, self.ny, self.nx): raise ValueError("Field has invalid shape") diff --git a/pyart/core/radar.py b/pyart/core/radar.py index 85a0398e9a..94126eda6c 100644 --- a/pyart/core/radar.py +++ b/pyart/core/radar.py @@ -792,7 +792,7 @@ def add_field(self, field_name, dic, replace_existing=False): """ # check that the field dictionary to add is valid if field_name in self.fields and replace_existing is False: - err = "A field with name: %s already exists" % (field_name) + err = f"A field with name: {field_name} already exists" raise ValueError(err) if "data" not in dic: raise KeyError("dic must contain a 'data' key") @@ -892,7 +892,7 @@ def add_field_like( """ if existing_field_name not in self.fields: - err = "field %s does not exist in object" % (existing_field_name) + err = f"field {existing_field_name} does not exist in object" raise ValueError(err) dic = {} for k, v in self.fields[existing_field_name].items(): diff --git a/pyart/correct/unwrap.py b/pyart/correct/unwrap.py index fdb0e04f04..8516af000e 100644 --- a/pyart/correct/unwrap.py +++ b/pyart/correct/unwrap.py @@ -30,7 +30,7 @@ def dealias_unwrap_phase( vel_field=None, corr_vel_field=None, skip_checks=False, - **kwargs + **kwargs, ): """ Dealias Doppler velocities using multi-dimensional phase unwrapping @@ -270,7 +270,7 @@ def _is_radar_sweep_aligned(radar, diff=0.1): elif radar.scan_type == "rhi": angles = radar.elevation["data"] else: - raise ValueError("invalid scan_type: %s" % (radar.scan_type)) + raise ValueError(f"invalid scan_type: {radar.scan_type}") starts = radar.sweep_start_ray_index["data"] ends = radar.sweep_end_ray_index["data"] ref_angles = angles[starts[0] : ends[0] + 1] @@ -302,6 +302,6 @@ def _is_sweep_sequential(radar, sweep_number): # equivalent variable to an angle. angles = radar.time["data"] else: - raise ValueError("invalid scan_type: %s" % (radar.scan_type)) + raise ValueError(f"invalid scan_type: {radar.scan_type}") rolled_angles = np.roll(angles, -np.argmin(angles)) return np.all(np.diff(rolled_angles) >= 0) diff --git a/pyart/graph/common.py b/pyart/graph/common.py index d4329c0b4b..803fdb8ec1 100644 --- a/pyart/graph/common.py +++ b/pyart/graph/common.py @@ -474,7 +474,7 @@ def generate_az_rhi_title(radar, field, azimuth): """ time_str = generate_radar_time_begin(radar).isoformat() + "Z" l1 = f"{generate_radar_name(radar)} {time_str} " - l2 = "Azimuth: %.1f deg" % azimuth + l2 = f"Azimuth: {azimuth:.1f} deg" field_name = generate_field_name(radar, field) return l1 + "\n" + l2 + "\n" + field_name diff --git a/pyart/graph/radardisplay.py b/pyart/graph/radardisplay.py index d34233752f..d4e3aea0f2 100644 --- a/pyart/graph/radardisplay.py +++ b/pyart/graph/radardisplay.py @@ -138,7 +138,7 @@ def plot(self, field, sweep=0, **kwargs): elif self.scan_type == "vpt": self.plot_vpt(field, **kwargs) else: - raise ValueError("unknown scan_type % s" % (self.scan_type)) + raise ValueError(f"unknown scan_type {self.scan_type: }") return def plot_ray( @@ -255,7 +255,7 @@ def plot_ppi( raster=False, title_datetime_format=None, title_use_sweep_time=True, - **kwargs + **kwargs, ): """ Plot a PPI. @@ -426,7 +426,7 @@ def plot_rhi( raster=False, title_datetime_format=None, title_use_sweep_time=True, - **kwargs + **kwargs, ): """ Plot a RHI. @@ -609,7 +609,7 @@ def plot_vpt( ticks=None, ticklabs=None, raster=False, - **kwargs + **kwargs, ): """ Plot a VPT scan. @@ -791,7 +791,7 @@ def plot_azimuth_to_rhi( ticks=None, ticklabs=None, raster=False, - **kwargs + **kwargs, ): """ Plot pseudo-RHI scan by extracting the vertical field associated @@ -1280,7 +1280,7 @@ def plot_colorbar( fig=None, ticks=None, ticklabs=None, - **kwargs + **kwargs, ): """ Plot a colorbar. diff --git a/pyart/graph/radardisplay_airborne.py b/pyart/graph/radardisplay_airborne.py index 445ed86f10..5d4b712281 100644 --- a/pyart/graph/radardisplay_airborne.py +++ b/pyart/graph/radardisplay_airborne.py @@ -117,7 +117,7 @@ def plot(self, field, sweep=0, **kwargs): elif self.scan_type == "vpt": self.plot_sweep_grid(field, sweep, **kwargs) else: - raise ValueError("unknown scan_type % s" % (self.scan_type)) + raise ValueError(f"unknown scan_type {self.scan_type: }") return def plot_sweep_grid( @@ -146,7 +146,7 @@ def plot_sweep_grid( raster=False, ticks=None, ticklabs=None, - **kwargs + **kwargs, ): """ Plot a sweep as a grid. diff --git a/pyart/io/cfradial.py b/pyart/io/cfradial.py index 3d1c4f2706..c8eb5d49c6 100644 --- a/pyart/io/cfradial.py +++ b/pyart/io/cfradial.py @@ -650,7 +650,7 @@ def write_cfradial( # Do not try to write instrument parameter whose dimensions are # not known, rather issue a warning and skip the parameter message = ( - "Unknown instrument parameter: %s, " % (k) + "not written to file." + f"Unknown instrument parameter: {k}, " + "not written to file." ) warnings.warn(message) @@ -812,7 +812,7 @@ def _create_ncvar(dic, dataset, name, dimensions): # create array from list, etc. data = dic["data"] if isinstance(data, np.ndarray) is not True: - warnings.warn("Warning, converting non-array to array:%s" % name) + warnings.warn(f"Warning, converting non-array to array:{name}") data = np.array(data) # convert string/unicode arrays to character arrays diff --git a/pyart/io/common.py b/pyart/io/common.py index 7976812475..e5780a2c4b 100644 --- a/pyart/io/common.py +++ b/pyart/io/common.py @@ -93,7 +93,7 @@ def _test_arguments(dic): if dic: import warnings - warnings.warn("Unexpected arguments: %s" % dic.keys()) + warnings.warn(f"Unexpected arguments: {dic.keys()}") def make_time_unit_str(dtobj): diff --git a/pyart/io/mdv_grid.py b/pyart/io/mdv_grid.py index 0c0ad54c70..ebcedf3bb8 100644 --- a/pyart/io/mdv_grid.py +++ b/pyart/io/mdv_grid.py @@ -160,9 +160,9 @@ def write_grid_mdv(filename, grid, mdv_field_names=None, field_write_order=None) d["data_element_nbytes"] = 4 else: raise TypeError( - "Unsuported encoding %s, encoding must be " + f"Unsuported encoding {dtype}, encoding must be " "uint8, uint16 or float32 as specfied by " - "the '_Write_as_dtype key" % dtype + "the '_Write_as_dtype key" ) d["compression_type"] = 3 # zlib @@ -233,7 +233,7 @@ def read_grid_mdv( file_field_names=False, exclude_fields=None, delay_field_loading=False, - **kwargs + **kwargs, ): """ Read a MDV file to a Grid Object. diff --git a/pyart/io/mdv_radar.py b/pyart/io/mdv_radar.py index 3ab28bf8a6..152ce621cb 100644 --- a/pyart/io/mdv_radar.py +++ b/pyart/io/mdv_radar.py @@ -21,7 +21,7 @@ def read_mdv( exclude_fields=None, include_fields=None, delay_field_loading=False, - **kwargs + **kwargs, ): """ Read a MDV file. @@ -96,7 +96,7 @@ def read_mdv( scan_type = mdvfile.projection if scan_type not in ["ppi", "rhi"]: - raise NotImplementedError("No support for scan_type %s." % scan_type) + raise NotImplementedError(f"No support for scan_type {scan_type}.") # time time = filemetadata("time") diff --git a/pyart/io/nexrad_cdm.py b/pyart/io/nexrad_cdm.py index 1fe64b114e..e6265f21d6 100644 --- a/pyart/io/nexrad_cdm.py +++ b/pyart/io/nexrad_cdm.py @@ -23,7 +23,7 @@ def read_nexrad_cdm( exclude_fields=None, include_fields=None, station=None, - **kwargs + **kwargs, ): """ Read a Common Data Model (CDM) NEXRAD Level 2 file. @@ -99,7 +99,7 @@ def read_nexrad_cdm( dattrs = dataset.ncattrs() dvars = dataset.variables if "cdm_data_type" not in dattrs or dataset.cdm_data_type != "RADIAL": - raise OSError("%s is not a valid CDM NetCDF file" % (filename)) + raise OSError(f"{filename} is not a valid CDM NetCDF file") # determine the scan information scan_info = _scan_info(dvars) diff --git a/pyart/io/uf_write.py b/pyart/io/uf_write.py index d9cbd94ddd..6d18a81687 100644 --- a/pyart/io/uf_write.py +++ b/pyart/io/uf_write.py @@ -389,7 +389,7 @@ def make_mandatory_header(self, ray_num): sweep_mode_number = UF_SWEEP_MODES[self.radar.scan_type] else: warnings.warn( - "Unknown scan_type: %s, defaulting to PPI" % (self.radar.scan_type) + f"Unknown scan_type: {self.radar.scan_type}, defaulting to PPI" ) sweep_mode_number = UF_SWEEP_MODES["ppi"] header["sweep_mode"] = sweep_mode_number diff --git a/pyart/map/gates_to_grid.py b/pyart/map/gates_to_grid.py index 6b4f59ed51..bcc470d55a 100644 --- a/pyart/map/gates_to_grid.py +++ b/pyart/map/gates_to_grid.py @@ -40,7 +40,7 @@ def map_gates_to_grid( nb=1.0, bsp=1.0, dist_factor=(1.0, 1.0, 1.0), - **kwargs + **kwargs, ): """ Map gates from one or more radars to a Cartesian grid. @@ -343,5 +343,5 @@ def _parse_roi_func( elif roi_func == "dist_beam": roi_func = DistBeamRoI(h_factor, nb, bsp, min_radius, offsets) else: - raise ValueError("unknown roi_func: %s" % roi_func) + raise ValueError(f"unknown roi_func: {roi_func}") return roi_func diff --git a/pyart/map/grid_mapper.py b/pyart/map/grid_mapper.py index 5ccb75ac07..7f24687dd4 100644 --- a/pyart/map/grid_mapper.py +++ b/pyart/map/grid_mapper.py @@ -26,7 +26,7 @@ def grid_from_radars( grid_limits, gridding_algo="map_gates_to_grid", copy_field_dtypes=True, - **kwargs + **kwargs, ): """ Map one or more radars to a Cartesian grid returning a Grid object. @@ -296,7 +296,7 @@ def map_to_grid( h_factor=(1.0, 1.0, 1.0), nb=1.0, bsp=1.0, - **kwargs + **kwargs, ): """ Map one or more radars to a Cartesian grid. @@ -469,7 +469,7 @@ def map_to_grid( if weighting_function.upper() not in ["CRESSMAN", "BARNES2", "BARNES", "NEAREST"]: raise ValueError("unknown weighting_function") if algorithm not in ["kd_tree"]: - raise ValueError("unknown algorithm: %s" % algorithm) + raise ValueError(f"unknown algorithm: {algorithm}") badval = get_fillvalue() # parse the grid_projection @@ -655,7 +655,7 @@ def map_to_grid( elif roi_func == "dist_beam": roi_func = _gen_roi_func_dist_beam(h_factor, nb, bsp, min_radius, offsets) else: - raise ValueError("unknown roi_func: %s" % roi_func) + raise ValueError(f"unknown roi_func: {roi_func}") # create array to hold interpolated grid data and roi if requested grid_data = np.ma.empty((nz, ny, nx, nfields), dtype=np.float64) diff --git a/pyart/xradar/accessor.py b/pyart/xradar/accessor.py index 7e96d47173..8a374c88ac 100644 --- a/pyart/xradar/accessor.py +++ b/pyart/xradar/accessor.py @@ -191,7 +191,7 @@ def add_field(self, field_name, dic, replace_existing=False): """ # check that the field dictionary to add is valid if field_name in self.fields and replace_existing is False: - err = "A field with name: %s already exists" % (field_name) + err = f"A field with name: {field_name} already exists" raise ValueError(err) if "data" not in dic: raise KeyError("dic must contain a 'data' key") @@ -431,7 +431,7 @@ def add_field(self, field_name, dic, replace_existing=False): """ # check that the field dictionary to add is valid if field_name in self.fields and replace_existing is False: - err = "A field with name: %s already exists" % (field_name) + err = f"A field with name: {field_name} already exists" raise ValueError(err) if "data" not in dic: raise KeyError("dic must contain a 'data' key") diff --git a/tests/io/test_auto_read.py b/tests/io/test_auto_read.py index 5d456f85fb..f8f9ffd780 100644 --- a/tests/io/test_auto_read.py +++ b/tests/io/test_auto_read.py @@ -95,7 +95,7 @@ def test_autoread_raises(): @pytest.mark.parametrize("i", headers) def test_determine_filetype(i): string, filetype = i - check_filetype.description = "determine filetype: %s" % (filetype) + check_filetype.description = f"determine filetype: {filetype}" check_filetype(string, filetype) diff --git a/tests/io/test_cfradial.py b/tests/io/test_cfradial.py index 68b0fa01bc..443100bf5b 100644 --- a/tests/io/test_cfradial.py +++ b/tests/io/test_cfradial.py @@ -179,7 +179,7 @@ def test_antenna_transition(): ) def test_instument_parameters(keys): # instrument_parameter sub-convention - description = "instrument_parameters: %s" % keys + description = f"instrument_parameters: {keys}" check_instrument_parameter.description = description check_instrument_parameter(keys) @@ -217,7 +217,7 @@ def test_nsweeps(): ], ) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -237,7 +237,7 @@ def check_field_dic(field): ], ) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -253,7 +253,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) @@ -271,7 +271,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/io/test_chl.py b/tests/io/test_chl.py index b534e358cd..462f20c87b 100644 --- a/tests/io/test_chl.py +++ b/tests/io/test_chl.py @@ -214,7 +214,7 @@ def test_nsweeps(): @pytest.mark.parametrize("field", fields) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -232,7 +232,7 @@ def check_field_dic(field): @pytest.mark.parametrize("field", fields) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -243,7 +243,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field", fields) def test_field_types(field): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, MaskedArray) @@ -270,7 +270,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/io/test_mdv_radar.py b/tests/io/test_mdv_radar.py index f7508d0de9..5872fd9578 100644 --- a/tests/io/test_mdv_radar.py +++ b/tests/io/test_mdv_radar.py @@ -165,7 +165,7 @@ def test_antenna_transition(): ) def test_instument_parameters(keys): # instrument_parameter sub-convention - description = "instrument_parameters: %s" % keys + description = f"instrument_parameters: {keys}" check_instrument_parameter.description = description check_instrument_parameter(keys) @@ -180,7 +180,7 @@ def check_instrument_parameter(param): @pytest.mark.parametrize("keys", ["radar_beam_width_h", "radar_beam_width_v"]) def test_radar_parameters(keys): # radar_parameter sub-convention - description = "radar_parameters: %s" % keys + description = f"radar_parameters: {keys}" check_radar_parameter.description = description check_radar_parameter(keys) @@ -223,7 +223,7 @@ def test_nsweeps(): ], ) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -243,7 +243,7 @@ def check_field_dic(field): ], ) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -259,7 +259,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) @@ -275,7 +275,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/io/test_nexrad_archive_msg1.py b/tests/io/test_nexrad_archive_msg1.py index 941654bfd7..f3fc3597ce 100644 --- a/tests/io/test_nexrad_archive_msg1.py +++ b/tests/io/test_nexrad_archive_msg1.py @@ -212,7 +212,7 @@ def test_nsweeps(): @pytest.mark.parametrize("field", FIELDS) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -227,7 +227,7 @@ def check_field_dic(field): @pytest.mark.parametrize("field", FIELDS) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -245,7 +245,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) diff --git a/tests/io/test_nexrad_archive_msg31.py b/tests/io/test_nexrad_archive_msg31.py index a00364e6ad..ecec97ad1c 100644 --- a/tests/io/test_nexrad_archive_msg31.py +++ b/tests/io/test_nexrad_archive_msg31.py @@ -210,7 +210,7 @@ def test_nsweeps(): @pytest.mark.parametrize("field", fields) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -225,7 +225,7 @@ def check_field_dic(field): @pytest.mark.parametrize("field", fields) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -246,7 +246,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) @@ -269,7 +269,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/io/test_nexrad_cdm.py b/tests/io/test_nexrad_cdm.py index bfaccac27e..0f83a76d01 100644 --- a/tests/io/test_nexrad_cdm.py +++ b/tests/io/test_nexrad_cdm.py @@ -207,7 +207,7 @@ def test_nsweeps(): @pytest.mark.parametrize("field", fields) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -222,7 +222,7 @@ def check_field_dic(field): @pytest.mark.parametrize("field", fields) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -243,7 +243,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) @@ -266,7 +266,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/io/test_rsl.py b/tests/io/test_rsl.py index 7dfaa4c9f7..6c8c8d675b 100644 --- a/tests/io/test_rsl.py +++ b/tests/io/test_rsl.py @@ -224,7 +224,7 @@ def test_antenna_transition(): @pytest.mark.parametrize("keys", keys) def test_instument_parameters(keys): # instrument_parameter sub-convention - description = "instrument_parameters: %s" % keys + description = f"instrument_parameters: {keys}" check_instrument_parameter.description = description check_instrument_parameter(keys) @@ -242,7 +242,7 @@ def check_instrument_parameter(param): @pytest.mark.parametrize("keys", ["radar_beam_width_h", "radar_beam_width_v"]) def test_radar_parameters(keys): # instrument_parameter sub-convention - description = "radar_parameters: %s" % keys + description = f"radar_parameters: {keys}" check_radar_parameter.description = description check_radar_parameter(keys) @@ -300,7 +300,7 @@ def test_nsweeps(): ], ) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -326,7 +326,7 @@ def check_field_dic(field): ], ) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -345,7 +345,7 @@ def check_field_shape(field): ) @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) @@ -366,7 +366,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/io/test_sigmet.py b/tests/io/test_sigmet.py index 3495439126..05fa7801ee 100644 --- a/tests/io/test_sigmet.py +++ b/tests/io/test_sigmet.py @@ -166,7 +166,7 @@ def test_antenna_transition(): @pytest.mark.parametrize("keys", keys) def test_instument_parameters(keys): # instrument_parameter sub-convention - description = "instrument_parameters: %s" % keys + description = f"instrument_parameters: {keys}" check_instrument_parameter.description = description check_instrument_parameter(keys) @@ -185,7 +185,7 @@ def test_prt_mode_dtype(): @pytest.mark.parametrize("keys", ["radar_beam_width_h", "radar_beam_width_v"]) def test_radar_parameters(keys): # radar_parameter sub-convention - description = "radar_parameters: %s" % keys + description = f"radar_parameters: {keys}" check_radar_parameter.description = description check_radar_parameter(keys) @@ -228,7 +228,7 @@ def test_nsweeps(): ], ) def test_field_dics(field): - description = "field : %s, dictionary" % field + description = f"field : {field}, dictionary" check_field_dic.description = description check_field_dic(field) @@ -248,7 +248,7 @@ def check_field_dic(field): ], ) def test_field_shapes(field): - description = "field : %s, shape" % field + description = f"field : {field}, shape" check_field_shape.description = description check_field_shape(field) @@ -264,7 +264,7 @@ def check_field_shape(field): @pytest.mark.parametrize("field, field_type", fields.items(), ids=list(fields.keys())) def test_field_types(field, field_type): - description = "field : %s, type" % field + description = f"field : {field}, type" check_field_type.description = description check_field_type(field, field_type) @@ -282,7 +282,7 @@ def check_field_type(field, field_type): def test_field_first_points(field, field_value): # these values can be found using: # [round(radar.fields[f]['data'][0,0]) for f in radar.fields] - description = "field : %s, first point" % field + description = f"field : {field}, first point" check_field_first_point.description = description check_field_first_point(field, field_value) diff --git a/tests/test_debug_info.py b/tests/test_debug_info.py index 19693548bf..b7dad94944 100644 --- a/tests/test_debug_info.py +++ b/tests/test_debug_info.py @@ -32,7 +32,7 @@ def __init__(self, modules): def find_module(self, fullname): if fullname in self.modules: - raise ImportError("Debug import failure for %s" % fullname) + raise ImportError(f"Debug import failure for {fullname}") def test_debug_info_all_disabled(): From b5becf04ce59c09ed500f195399b3a83392ba67c Mon Sep 17 00:00:00 2001 From: mgrover1 Date: Mon, 29 Apr 2024 08:11:10 -0500 Subject: [PATCH 2/2] ADD: Add pin for ruff version in ci --- continuous_integration/environment-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/continuous_integration/environment-ci.yml b/continuous_integration/environment-ci.yml index 6155f8a6b6..ada69987ba 100644 --- a/continuous_integration/environment-ci.yml +++ b/continuous_integration/environment-ci.yml @@ -24,7 +24,7 @@ dependencies: - cftime - setuptools - shapely - - ruff + - ruff==0.4.2 - mda-xdrlib - xradar - pip