Skip to content

Commit

Permalink
Ruff linter: E721 Do not compare types, use isinstance()
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Jun 23, 2024
1 parent 9f9d8fd commit ab5e77b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gribapi/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GribInternalError(Exception):
def __init__(self, value):
# Call the base class constructor with the parameters it needs
Exception.__init__(self, value)
if type(value) is int:
if isinstance(value, int):
self.msg = ffi.string(lib.grib_get_error_message(value)).decode(ENC)
else:
self.msg = value
Expand Down
4 changes: 2 additions & 2 deletions tests/test_eccodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def test_codes_set_samples_path():

def test_api_version():
vs = eccodes.codes_get_api_version()
assert type(vs) is str
assert isinstance(vs, str)
assert len(vs) > 0
assert vs == eccodes.codes_get_api_version(str)
vi = eccodes.codes_get_api_version(int)
assert type(vi) is int
assert isinstance(vi, int)
assert vi > 20000
print(vi)

Expand Down

0 comments on commit ab5e77b

Please sign in to comment.