diff --git a/parcels/fieldset.py b/parcels/fieldset.py index 3f02cad20..94c1beae1 100644 --- a/parcels/fieldset.py +++ b/parcels/fieldset.py @@ -1309,7 +1309,7 @@ def from_modulefile(cls, filename, modulename="create_fieldset", **kwargs): """ # check if filename exists if not os.path.exists(filename): - raise IOError(f"FieldSet module file {filename} does not exist") + raise OSError(f"FieldSet module file {filename} does not exist") # Importing the source file directly (following https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly) spec = importlib.util.spec_from_file_location(modulename, filename) @@ -1318,10 +1318,10 @@ def from_modulefile(cls, filename, modulename="create_fieldset", **kwargs): spec.loader.exec_module(fieldset_module) if not hasattr(fieldset_module, modulename): - raise IOError(f"{filename} does not contain a {modulename} function") + raise OSError(f"{filename} does not contain a {modulename} function") fieldset = getattr(fieldset_module, modulename)(**kwargs) if not isinstance(fieldset, FieldSet): - raise IOError(f"Module {filename}.{modulename} does not return a FieldSet object") + raise OSError(f"Module {filename}.{modulename} does not return a FieldSet object") return fieldset def get_fields(self): diff --git a/parcels/particleset.py b/parcels/particleset.py index c4007cf20..c1b958cc1 100644 --- a/parcels/particleset.py +++ b/parcels/particleset.py @@ -155,7 +155,7 @@ def ArrayClass_init(self, *args, **kwargs): lon = np.empty(shape=0) if lon is None else convert_to_flat_array(lon) lat = np.empty(shape=0) if lat is None else convert_to_flat_array(lat) - if isinstance(pid_orig, (type(None), type(False))): + if isinstance(pid_orig, (type(None), bool)): pid_orig = np.arange(lon.size) if depth is None: diff --git a/parcels/tools/exampledata_utils.py b/parcels/tools/exampledata_utils.py index 07e59e3a8..a57b2b4c3 100644 --- a/parcels/tools/exampledata_utils.py +++ b/parcels/tools/exampledata_utils.py @@ -1,7 +1,6 @@ import os from datetime import datetime, timedelta from pathlib import Path -from typing import List from urllib.request import urlretrieve import platformdirs @@ -96,7 +95,7 @@ def get_data_home(data_home=None): return data_home -def list_example_datasets() -> List[str]: +def list_example_datasets() -> list[str]: """List the available example datasets. Use :func:`download_example_dataset` to download one of the datasets. diff --git a/pyproject.toml b/pyproject.toml index d42401fbe..64f1927a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ select = [ "F", # pyflakes "I", # isort "B", # Bugbear - # "UP", # pyupgrade + "UP", # pyupgrade "LOG", # logging "ICN", # import conventions "G", # logging-format