diff --git a/examples/01_icetray/01_convert_i3_files.py b/examples/01_icetray/01_convert_i3_files.py index 9f0795cb1..a457ceaa5 100644 --- a/examples/01_icetray/01_convert_i3_files.py +++ b/examples/01_icetray/01_convert_i3_files.py @@ -1,6 +1,5 @@ """Example of converting I3-files to SQLite and Parquet.""" -import os from glob import glob from graphnet.constants import EXAMPLE_OUTPUT_DIR, TEST_DATA_DIR diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 33e598867..6bc9e9572 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -1,7 +1,7 @@ """Contains `DataConverter`.""" from typing import List, Union, OrderedDict, Dict, Tuple, Any, Optional, Type -from abc import abstractmethod, ABC +from abc import ABC from tqdm import tqdm import numpy as np diff --git a/src/graphnet/data/dataset/parquet/parquet_dataset.py b/src/graphnet/data/dataset/parquet/parquet_dataset.py index 84e938c44..3561c591a 100644 --- a/src/graphnet/data/dataset/parquet/parquet_dataset.py +++ b/src/graphnet/data/dataset/parquet/parquet_dataset.py @@ -1,18 +1,10 @@ """Base :py:class:`Dataset` class(es) used in GraphNeT.""" -from copy import deepcopy -from abc import ABC, abstractmethod from typing import ( - cast, - Any, - Callable, Dict, List, Optional, - Tuple, Union, - Iterable, - Type, ) import numpy as np @@ -21,7 +13,6 @@ from torch_geometric.data import Data import polars as pol from polars.series.series import Series -from polars.exceptions import InvalidOperationError from glob import glob from bisect import bisect_right from collections import OrderedDict diff --git a/src/graphnet/data/parquet/deprecated_methods.py b/src/graphnet/data/parquet/deprecated_methods.py index 423e1aa00..ae2593813 100644 --- a/src/graphnet/data/parquet/deprecated_methods.py +++ b/src/graphnet/data/parquet/deprecated_methods.py @@ -2,7 +2,7 @@ This code will be removed in GraphNeT 2.0. """ -from typing import List, Union, Type +from typing import List, Union from graphnet.data.extractors.icecube import I3Extractor from graphnet.data.extractors.icecube.utilities.i3_filters import ( diff --git a/src/graphnet/data/pre_configured/dataconverters.py b/src/graphnet/data/pre_configured/dataconverters.py index 714f8a831..1194da3c2 100644 --- a/src/graphnet/data/pre_configured/dataconverters.py +++ b/src/graphnet/data/pre_configured/dataconverters.py @@ -1,6 +1,6 @@ """Pre-configured combinations of writers and readers.""" -from typing import List, Union, Type +from typing import List, Union from graphnet.data import DataConverter from graphnet.data.readers import I3Reader, ParquetReader diff --git a/src/graphnet/data/readers/i3reader.py b/src/graphnet/data/readers/i3reader.py index 2d4a6dbe3..a2d1d0c83 100644 --- a/src/graphnet/data/readers/i3reader.py +++ b/src/graphnet/data/readers/i3reader.py @@ -1,6 +1,6 @@ """Module containing different I3Reader.""" -from typing import List, Union, OrderedDict, Type +from typing import List, Union, OrderedDict from graphnet.utilities.imports import has_icecube_package from graphnet.data.extractors.icecube.utilities.i3_filters import ( diff --git a/src/graphnet/data/writers/parquet_writer.py b/src/graphnet/data/writers/parquet_writer.py index 1c20f942d..ce4085430 100644 --- a/src/graphnet/data/writers/parquet_writer.py +++ b/src/graphnet/data/writers/parquet_writer.py @@ -1,7 +1,7 @@ """DataConverter for the Parquet backend.""" import os -from typing import List, Optional, Dict, Any +from typing import List, Dict, Any import pandas as pd import polars as pol diff --git a/src/graphnet/deployment/icecube/cleaning_module.py b/src/graphnet/deployment/icecube/cleaning_module.py index 0a2417331..27e5f2260 100644 --- a/src/graphnet/deployment/icecube/cleaning_module.py +++ b/src/graphnet/deployment/icecube/cleaning_module.py @@ -2,7 +2,7 @@ Contains functionality for writing model predictions to i3 files. """ -from typing import List, Union, Optional, TYPE_CHECKING, Dict, Any, Tuple +from typing import List, Union, TYPE_CHECKING, Dict, Any, Tuple import numpy as np diff --git a/src/graphnet/models/easy_model.py b/src/graphnet/models/easy_model.py index d26d88fa0..440f3f3ac 100644 --- a/src/graphnet/models/easy_model.py +++ b/src/graphnet/models/easy_model.py @@ -16,7 +16,6 @@ from pytorch_lightning.loggers import Logger as LightningLogger from graphnet.training.callbacks import ProgressBar -from graphnet.models.graphs import GraphDefinition from graphnet.models.model import Model from graphnet.models.task import StandardLearnedTask diff --git a/src/graphnet/models/gnn/RNN_tito.py b/src/graphnet/models/gnn/RNN_tito.py index 75f3a04fc..8b9157c58 100644 --- a/src/graphnet/models/gnn/RNN_tito.py +++ b/src/graphnet/models/gnn/RNN_tito.py @@ -1,9 +1,8 @@ """RNN_DynEdge model implementation.""" -from typing import List, Optional, Tuple, Union +from typing import List, Optional, Tuple import torch from graphnet.models.gnn.gnn import GNN -from graphnet.models.gnn.dynedge import DynEdge from graphnet.models.gnn.dynedge_kaggle_tito import DynEdgeTITO from graphnet.models.rnn.node_rnn import Node_RNN diff --git a/src/graphnet/models/gnn/dynedge.py b/src/graphnet/models/gnn/dynedge.py index ad65c9b35..a80ce82ce 100644 --- a/src/graphnet/models/gnn/dynedge.py +++ b/src/graphnet/models/gnn/dynedge.py @@ -1,5 +1,5 @@ """Implementation of the DynEdge GNN model architecture.""" -from typing import List, Optional, Callable, Tuple, Union +from typing import List, Optional, Tuple, Union import torch from torch import Tensor, LongTensor diff --git a/src/graphnet/models/gnn/dynedge_jinst.py b/src/graphnet/models/gnn/dynedge_jinst.py index 23c630fa9..0054e3056 100644 --- a/src/graphnet/models/gnn/dynedge_jinst.py +++ b/src/graphnet/models/gnn/dynedge_jinst.py @@ -2,7 +2,6 @@ Author: Rasmus Oersoe """ -from typing import Optional import torch from torch import Tensor diff --git a/src/graphnet/models/gnn/dynedge_kaggle_tito.py b/src/graphnet/models/gnn/dynedge_kaggle_tito.py index 12490e808..88d4c8811 100644 --- a/src/graphnet/models/gnn/dynedge_kaggle_tito.py +++ b/src/graphnet/models/gnn/dynedge_kaggle_tito.py @@ -8,7 +8,7 @@ Solution by TITO. """ -from typing import List, Tuple, Optional, Union +from typing import List, Tuple, Optional import torch from torch import Tensor, LongTensor diff --git a/src/graphnet/models/graphs/edges/edges.py b/src/graphnet/models/graphs/edges/edges.py index ad3cf3c46..584cf7ad9 100644 --- a/src/graphnet/models/graphs/edges/edges.py +++ b/src/graphnet/models/graphs/edges/edges.py @@ -1,7 +1,7 @@ """Class(es) for building/connecting graphs.""" from typing import List -from abc import abstractmethod, ABC +from abc import abstractmethod import torch from torch_geometric.nn import knn_graph, radius_graph diff --git a/src/graphnet/models/graphs/graphs.py b/src/graphnet/models/graphs/graphs.py index 0289b943d..d73b2c961 100644 --- a/src/graphnet/models/graphs/graphs.py +++ b/src/graphnet/models/graphs/graphs.py @@ -6,7 +6,7 @@ from .graph_definition import GraphDefinition from graphnet.models.detector import Detector -from graphnet.models.graphs.edges import EdgeDefinition, KNNEdges +from graphnet.models.graphs.edges import KNNEdges from graphnet.models.graphs.nodes import NodeDefinition, NodesAsPulses diff --git a/src/graphnet/models/graphs/utils.py b/src/graphnet/models/graphs/utils.py index e64b04afe..9dd21ee60 100644 --- a/src/graphnet/models/graphs/utils.py +++ b/src/graphnet/models/graphs/utils.py @@ -1,6 +1,6 @@ """Utility functions for construction of graphs.""" -from typing import List, Tuple, Optional, Dict, Union +from typing import List, Tuple import os import numpy as np import pandas as pd diff --git a/src/graphnet/models/task/classification.py b/src/graphnet/models/task/classification.py index 0bf7da815..8e308eacf 100644 --- a/src/graphnet/models/task/classification.py +++ b/src/graphnet/models/task/classification.py @@ -1,7 +1,5 @@ """Classification-specific `Model` class(es).""" -from typing import Any - import torch from torch import Tensor diff --git a/src/graphnet/utilities/filesys.py b/src/graphnet/utilities/filesys.py index 9b73d0886..fe1a7d5f8 100644 --- a/src/graphnet/utilities/filesys.py +++ b/src/graphnet/utilities/filesys.py @@ -2,7 +2,7 @@ from pathlib import Path import re -from typing import List, Optional, Tuple, Union, cast +from typing import List, Optional, Tuple, Union def is_gcd_file(filename: str) -> bool: diff --git a/tests/models/test_coarsening.py b/tests/models/test_coarsening.py index 3f5889da6..6a001bde9 100644 --- a/tests/models/test_coarsening.py +++ b/tests/models/test_coarsening.py @@ -3,7 +3,6 @@ import torch from torch_geometric.data import Data, Batch -from graphnet.models.components.pool import group_by from graphnet.models.coarsening import AttributeCoarsening diff --git a/tests/models/test_minkowski.py b/tests/models/test_minkowski.py index af66196cf..98fed817c 100644 --- a/tests/models/test_minkowski.py +++ b/tests/models/test_minkowski.py @@ -3,7 +3,7 @@ import torch from torch_geometric.data.data import Data -from graphnet.models.graphs.edges import KNNEdges, MinkowskiKNNEdges +from graphnet.models.graphs.edges import MinkowskiKNNEdges from graphnet.models.graphs.edges.minkowski import ( compute_minkowski_distance_mat, )