File tree Expand file tree Collapse file tree 13 files changed +70
-31
lines changed
Expand file tree Collapse file tree 13 files changed +70
-31
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ exclude_lines =
99 @(abc\.)?abstractmethod
1010 if __name__ == .__main__.:
1111 raise NotImplemented
12+ if TYPE_CHECKING:
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ lint.select = [
104104 " PTH" , # flake8-use-pathlib
105105 " RUF" , # ruff-specific rules
106106 " SIM" , # flake8-simplify
107+ " TC" , # flake8-type-checking (performance improvements)
107108 " TRY" , # tryceratops
108109 " UP" , # pyupgrade
109110 " W" , # pycodestyle warning
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- from collections .abc import Iterable
6- from numbers import Number
5+ from typing import TYPE_CHECKING
76
87from ._utils import _validate_2d
98from .interval import Interval
109
10+ if TYPE_CHECKING :
11+ from collections .abc import Iterable
12+ from numbers import Number
13+
1114
1215class BoundingBox :
1316 """
Original file line number Diff line number Diff line change 44
55import argparse
66import sys
7- from collections . abc import Sequence
7+ from typing import TYPE_CHECKING
88
99from . import __version__
1010from .data .loader import DataLoader
1111from .morpher import DataMorpher
1212from .shapes .factory import ShapeFactory
1313
14+ if TYPE_CHECKING :
15+ from collections .abc import Sequence
16+
1417ARG_DEFAULTS = {
1518 'output_dir' : 'morphed_data' ,
1619 'decimals' : 2 ,
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55from numbers import Number
6+ from typing import TYPE_CHECKING
67
78import matplotlib .pyplot as plt
8- import pandas as pd
9- from matplotlib .axes import Axes
109
1110from ..bounds .bounding_box import BoundingBox
1211from ..bounds .interval import Interval
1312from ..plotting .style import plot_with_custom_style
1413
14+ if TYPE_CHECKING :
15+ import pandas as pd
16+ from matplotlib .axes import Axes
17+
1518
1619class Dataset :
1720 """
Original file line number Diff line number Diff line change 44
55from importlib .resources import files
66from itertools import zip_longest
7- from numbers import Number
87from pathlib import Path
9- from typing import ClassVar
8+ from typing import TYPE_CHECKING , ClassVar
109
1110import matplotlib .pyplot as plt
1211import numpy as np
1312import pandas as pd
14- from matplotlib .axes import Axes
1513
1614from .. import MAIN_DIR
1715from ..plotting .style import plot_with_custom_style
1816from .dataset import Dataset
1917
18+ if TYPE_CHECKING :
19+ from numbers import Number
20+
21+ from matplotlib .axes import Axes
22+
2023
2124class DataLoader :
2225 """
Original file line number Diff line number Diff line change 55from functools import partial
66from numbers import Number
77from pathlib import Path
8+ from typing import TYPE_CHECKING
89
910import numpy as np
10- import pandas as pd
1111import tqdm
1212
13- from .bounds .bounding_box import BoundingBox
14- from .data .dataset import Dataset
1513from .data .stats import get_values
1614from .plotting .animation import (
1715 ease_in_out_quadratic ,
2220 stitch_gif_animation ,
2321)
2422from .plotting .static import plot
25- from .shapes .bases .shape import Shape
23+
24+ if TYPE_CHECKING :
25+ import pandas as pd
26+
27+ from .bounds .bounding_box import BoundingBox
28+ from .data .dataset import Dataset
29+ from .shapes .bases .shape import Shape
2630
2731
2832class DataMorpher :
Original file line number Diff line number Diff line change 55import math
66from functools import wraps
77from pathlib import Path
8- from typing import Callable
8+ from typing import TYPE_CHECKING , Callable
99
1010from PIL import Image
1111
12- from ..shapes .bases .shape import Shape
12+ if TYPE_CHECKING :
13+ from ..shapes .bases .shape import Shape
1314
1415
1516def stitch_gif_animation (
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- from collections .abc import Iterable
65from functools import partial
7- from numbers import Number
86from pathlib import Path
9- from typing import Any
7+ from typing import TYPE_CHECKING , Any
108
119import matplotlib .pyplot as plt
1210import numpy as np
13- import pandas as pd
14- from matplotlib .axes import Axes
1511from matplotlib .ticker import EngFormatter
1612
1713from ..data .stats import get_values
1814from .style import plot_with_custom_style
1915
16+ if TYPE_CHECKING :
17+ from collections .abc import Iterable
18+ from numbers import Number
19+
20+ import pandas as pd
21+ from matplotlib .axes import Axes
22+
2023
2124@plot_with_custom_style
2225def plot (
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- from collections .abc import Iterable
6- from numbers import Number
5+ from typing import TYPE_CHECKING
76
87import matplotlib .pyplot as plt
98import numpy as np
10- from matplotlib .axes import Axes
119
1210from ...plotting .style import plot_with_custom_style
1311from .shape import Shape
1412
13+ if TYPE_CHECKING :
14+ from collections .abc import Iterable
15+ from numbers import Number
16+
17+ from matplotlib .axes import Axes
18+
1519
1620class LineCollection (Shape ):
1721 """
You can’t perform that action at this time.
0 commit comments