From 798a66e07c0a117e50ff84b570e884e15a868bd3 Mon Sep 17 00:00:00 2001 From: Lars Quentin <lars.quentin@stud.uni-goettingen.de> Date: Tue, 14 Dec 2021 10:33:40 +0100 Subject: [PATCH] :art: Format all imports --- curvepy/bezier_curve.py | 25 ++++++++++++++----------- curvepy/de_caes.py | 3 ++- curvepy/delaunay.py | 11 +++++++---- curvepy/tests/data/data_bezier_curve.py | 3 ++- curvepy/tests/data/data_delaunay.py | 1 - curvepy/tests/data/data_voronoi.py | 2 +- curvepy/tests/test_bezier_curve.py | 4 +++- curvepy/tests/test_de_caes.py | 5 +++-- curvepy/tests/test_delaunay.py | 5 +++-- curvepy/tests/test_types.py | 3 ++- curvepy/tests/test_utilities.py | 7 ++++--- curvepy/tests/test_voronoi.py | 2 +- curvepy/tests/utility.py | 3 ++- curvepy/types.py | 16 +++++++++------- curvepy/utilities.py | 9 +++++---- curvepy/voronoi.py | 7 +++++-- 16 files changed, 63 insertions(+), 43 deletions(-) diff --git a/curvepy/bezier_curve.py b/curvepy/bezier_curve.py index 017830b..b7925ab 100644 --- a/curvepy/bezier_curve.py +++ b/curvepy/bezier_curve.py @@ -1,19 +1,22 @@ from __future__ import annotations # Needed until Py3.10, see PEP 563 -import numpy as np -import sympy as sy -import math -import scipy.special as scs -import matplotlib.pyplot as plt + +import concurrent.futures import itertools as itt +import math +import sys from abc import ABC, abstractmethod -from typing import List, Tuple, Callable, Union -from functools import partial, cached_property -import concurrent.futures +from functools import cached_property, partial from multiprocessing import cpu_count -import sys +from typing import Callable, List, Tuple, Union + +import matplotlib.pyplot as plt +import numpy as np +import scipy.special as scs +import sympy as sy + from curvepy.de_caes import de_caes, subdivision -from curvepy.utilities import prod, check_flat, intersect_lines -from curvepy.types import bernstein_polynomial, MinMaxBox +from curvepy.types import MinMaxBox, bernstein_polynomial +from curvepy.utilities import check_flat, intersect_lines, prod class AbstractBezierCurve(ABC): diff --git a/curvepy/de_caes.py b/curvepy/de_caes.py index a0360f3..a1a6c78 100644 --- a/curvepy/de_caes.py +++ b/curvepy/de_caes.py @@ -1,7 +1,8 @@ import concurrent.futures +from multiprocessing import cpu_count from typing import List, Tuple + import numpy as np -from multiprocessing import cpu_count def de_caes_one_step(m: np.ndarray, t: float = 0.5, interval: Tuple[int, int] = (0, 1), diff --git a/curvepy/delaunay.py b/curvepy/delaunay.py index 50643ad..aa4e8b5 100644 --- a/curvepy/delaunay.py +++ b/curvepy/delaunay.py @@ -1,11 +1,14 @@ from __future__ import annotations # Needed until Py3.10, see PEP 563 -import numpy as np + +from collections import deque from functools import cached_property -from typing import List, NamedTuple, Dict, Deque, Optional +from typing import Deque, Dict, List, NamedTuple, Optional + import matplotlib.pyplot as plt -from collections import deque +import numpy as np -from curvepy.types import TupleTriangle, Edge2D, Point2D, TriangleNode, VoronoiRegions2D +from curvepy.types import (Edge2D, Point2D, TriangleNode, TupleTriangle, + VoronoiRegions2D) class DelaunayTriangulation2D: diff --git a/curvepy/tests/data/data_bezier_curve.py b/curvepy/tests/data/data_bezier_curve.py index b189174..e270367 100644 --- a/curvepy/tests/data/data_bezier_curve.py +++ b/curvepy/tests/data/data_bezier_curve.py @@ -1,6 +1,7 @@ -import numpy as np import random +import numpy as np + BARYCENTRIC_COMBINATIONS = [ ([[-13.630998026599613, 16.423270751071637, 7.804457078365141, 15.143920367449857, -2.067598361984799, 10.219749577770486, -7.436133241663205, -5.52653555687559], diff --git a/curvepy/tests/data/data_delaunay.py b/curvepy/tests/data/data_delaunay.py index e0bfff5..15d0737 100644 --- a/curvepy/tests/data/data_delaunay.py +++ b/curvepy/tests/data/data_delaunay.py @@ -1,6 +1,5 @@ from curvepy.types import TupleTriangle - # Jetbrains Formatter doesn't comply with PEP8, but those data lists are # not well formattable anyways. # Therefore we ignore the following: diff --git a/curvepy/tests/data/data_voronoi.py b/curvepy/tests/data/data_voronoi.py index 9214d33..3a01d33 100644 --- a/curvepy/tests/data/data_voronoi.py +++ b/curvepy/tests/data/data_voronoi.py @@ -1,6 +1,6 @@ -from curvepy.types import TriangleNode from collections import deque +from curvepy.types import TriangleNode DIAMETER = 100 diff --git a/curvepy/tests/test_bezier_curve.py b/curvepy/tests/test_bezier_curve.py index 3e0ef02..814c0ca 100644 --- a/curvepy/tests/test_bezier_curve.py +++ b/curvepy/tests/test_bezier_curve.py @@ -1,5 +1,7 @@ -import pytest import itertools + +import pytest + import curvepy.tests.data.data_bezier_curve as data from curvepy.bezier_curve import * diff --git a/curvepy/tests/test_de_caes.py b/curvepy/tests/test_de_caes.py index 2ac7f4c..097e03c 100644 --- a/curvepy/tests/test_de_caes.py +++ b/curvepy/tests/test_de_caes.py @@ -1,7 +1,8 @@ +import numpy as np import pytest -from curvepy.de_caes import de_caes, parallel_decaes_unblossomed, subdivision + import curvepy.tests.data.data_de_caes as data -import numpy as np +from curvepy.de_caes import de_caes, parallel_decaes_unblossomed, subdivision @pytest.mark.parametrize('m, res, t', data.cases_de_caes) diff --git a/curvepy/tests/test_delaunay.py b/curvepy/tests/test_delaunay.py index c666cd3..e78cfce 100644 --- a/curvepy/tests/test_delaunay.py +++ b/curvepy/tests/test_delaunay.py @@ -1,8 +1,9 @@ +from typing import List, Set + import pytest -from typing import List, Set -from curvepy.delaunay import DelaunayTriangulation2D, TupleTriangle, Point2D import curvepy.tests.data.data_delaunay as data +from curvepy.delaunay import DelaunayTriangulation2D, Point2D, TupleTriangle @pytest.mark.parametrize('xs, expected', data.RANDOMLY_UNIFORMLY_DISTRIBUTED) diff --git a/curvepy/tests/test_types.py b/curvepy/tests/test_types.py index 4a3fb80..6bc44eb 100644 --- a/curvepy/tests/test_types.py +++ b/curvepy/tests/test_types.py @@ -1,7 +1,8 @@ import pytest + import curvepy.tests.data.data_types as data -from curvepy.types import Polygon, PolygonTriangle, bernstein_polynomial_rec from curvepy.bezier_curve import * +from curvepy.types import Polygon, PolygonTriangle, bernstein_polynomial_rec @pytest.mark.parametrize('pts', data.POLYGON_2D) diff --git a/curvepy/tests/test_utilities.py b/curvepy/tests/test_utilities.py index 0b0b6a3..6ccb9ec 100644 --- a/curvepy/tests/test_utilities.py +++ b/curvepy/tests/test_utilities.py @@ -1,8 +1,9 @@ +import numpy as np +import pytest + +import curvepy.tests.data.data_utilities as data from curvepy.tests.utility import arrayize from curvepy.utilities import * -import curvepy.tests.data.data_utilities as data -import pytest -import numpy as np @pytest.mark.parametrize('a,b', data.RANDOM_PAIRS) diff --git a/curvepy/tests/test_voronoi.py b/curvepy/tests/test_voronoi.py index d091d76..0dd71e0 100644 --- a/curvepy/tests/test_voronoi.py +++ b/curvepy/tests/test_voronoi.py @@ -1,7 +1,7 @@ import pytest -from curvepy.delaunay import DelaunayTriangulation2D import curvepy.tests.data.data_voronoi as data +from curvepy.delaunay import DelaunayTriangulation2D @pytest.mark.parametrize('seed, mean, expected', [*zip(data.SEEDS, data.MEANS, data.REGIONS)]) diff --git a/curvepy/tests/utility.py b/curvepy/tests/utility.py index 3be84f8..93eca4c 100644 --- a/curvepy/tests/utility.py +++ b/curvepy/tests/utility.py @@ -1,5 +1,6 @@ -from typing import Iterable from numbers import Number +from typing import Iterable + from curvepy.bezier_curve import * Testcases = Iterable diff --git a/curvepy/types.py b/curvepy/types.py index e2860f2..2cf8357 100644 --- a/curvepy/types.py +++ b/curvepy/types.py @@ -1,16 +1,18 @@ from __future__ import annotations +import math +import sys +from abc import ABC, abstractmethod +from collections.abc import Sequence +from dataclasses import dataclass from enum import Enum +from functools import cached_property, lru_cache, partial +from typing import (Any, Callable, Deque, Dict, List, NamedTuple, Optional, + Tuple, Union) + import numpy as np -import sys import scipy.special as scs -import math -from abc import ABC, abstractmethod -from dataclasses import dataclass -from typing import Any, Dict, Deque, List, NamedTuple, Tuple, Union, Callable, Optional -from functools import cached_property, partial, lru_cache -from collections.abc import Sequence from curvepy.utilities import create_straight_line_function diff --git a/curvepy/utilities.py b/curvepy/utilities.py index ce00018..053e903 100644 --- a/curvepy/utilities.py +++ b/curvepy/utilities.py @@ -1,9 +1,10 @@ -from typing import Any, List, Callable, Tuple, Union, Iterable -from numbers import Number -import numpy as np import functools -import sys import operator +import sys +from numbers import Number +from typing import Any, Callable, Iterable, List, Tuple, Union + +import numpy as np def straight_line_point(a: np.ndarray, b: np.ndarray, t: float = 0.5) -> np.ndarray: diff --git a/curvepy/voronoi.py b/curvepy/voronoi.py index 000a5eb..fc365db 100644 --- a/curvepy/voronoi.py +++ b/curvepy/voronoi.py @@ -1,9 +1,12 @@ from __future__ import annotations # Needed until Py3.10, see PEP 563 + from typing import List, Optional + +import matplotlib.pyplot as plt +import numpy as np + from curvepy.delaunay import DelaunayTriangulation2D from curvepy.types import Point2D, VoronoiRegions2D -import numpy as np -import matplotlib.pyplot as plt class Voronoi: -- GitLab