Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Add isinstance checks to improve linting #1444

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pyart/aux_io/sinarame_h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,7 @@ def write_sinarame_cfradial(path):
radar._DeflateLevel = 5

# cfrad.TIME1_to_TIME2_NAME_VCP_RANGE.nc
cffile = "cfrad.{time1}.0000_to_{time2}.0000" "_{b1}_{est}_{ran}".format(
time1=time1, time2=time2, b1=bs[0], est=bs[1], ran=bs[2]
)
cffile = f"cfrad.{time1}.0000_to_{time2}.0000" f"_{bs[0]}_{bs[1]}_{bs[2]}"

print(f"Writing to {path_user}{cffile}.nc")
write_cfradial(
Expand Down
2 changes: 1 addition & 1 deletion pyart/graph/radardisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ def plot_labels(self, labels, locations, symbols="r+", text_color="k", ax=None):
"""
ax = common.parse_ax(ax)

if type(symbols) is str:
if isinstance(symbols, str):
symbols = [symbols] * len(labels)
if len(labels) != len(locations):
raise ValueError("length of labels and locations must match")
Expand Down
6 changes: 3 additions & 3 deletions pyart/io/cfradial.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def read_cfradial(
exclude_fields=None,
include_fields=None,
delay_field_loading=False,
**kwargs
**kwargs,
):
"""
Read a Cfradial 1.4 netCDF file.
Expand Down Expand Up @@ -921,12 +921,12 @@ def _calculate_scale_and_offset(dic, dtype, minimum=None, maximum=None):
if maximum < minimum:
raise ValueError(
"Error calculating variable scaling: "
"maximum: {:f} is smaller than minimum: {:f}".format(maximum, minimum)
f"maximum: {maximum:f} is smaller than minimum: {minimum:f}"
)
elif maximum == minimum:
warnings.warn(
"While calculating variable scaling: "
"maximum: {:f} is equal to minimum: {:f}".format(maximum, minimum)
f"maximum: {maximum:f} is equal to minimum: {minimum:f}"
)
maximum = minimum + 1

Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_cfradial.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def attribute_equal(class1, class2, key, allow_str_case_diff=True):

assert type(a1) == type(a2)

if type(a1) is str and allow_str_case_diff:
if isinstance(a1, str) and allow_str_case_diff:
assert a1.upper() == a2.upper()
else:
assert a1 == a2
Expand Down
Loading