Skip to content

Commit 53e9063

Browse files
committed
Issue #197 chore: import cleanup in feature branch
using `darker -v -i -r master openeo_driver tests`
1 parent a7b7b92 commit 53e9063

9 files changed

+34
-38
lines changed

openeo_driver/datacube.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import abc
22
import inspect
3+
import io
34
import logging
45
import zipfile
56
from pathlib import Path
6-
from typing import List, Union, Optional, Dict, Any, Tuple, Sequence
7-
import io
7+
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
88

99
import geopandas as gpd
1010
import numpy
11+
import openeo.udf
1112
import pandas
1213
import pyproj
14+
import requests
1315
import shapely.geometry
1416
import shapely.geometry.base
1517
import shapely.ops
1618
import xarray
17-
from pyproj import CRS
18-
import requests
19-
2019
from openeo.metadata import CollectionMetadata
2120
from openeo.util import ensure_dir, str_truncate
22-
import openeo.udf
23-
from openeo_driver.datastructs import SarBackscatterArgs, ResolutionMergeArgs, StacAsset
21+
from pyproj import CRS
22+
23+
from openeo_driver.datastructs import ResolutionMergeArgs, SarBackscatterArgs, StacAsset
2424
from openeo_driver.errors import FeatureUnsupportedException, InternalException
2525
from openeo_driver.util.geometry import GeometryBufferer, validate_geojson_coordinates
2626
from openeo_driver.util.ioformats import IOFORMATS

openeo_driver/processes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import warnings
44
from collections import namedtuple
55
from pathlib import Path
6-
from typing import Callable, Dict, List, Tuple, Optional, Any, Union, Collection
6+
from typing import Any, Callable, Collection, Dict, List, Optional, Tuple, Union
77

88
from openeo_driver.errors import (
9-
ProcessUnsupportedException,
10-
ProcessParameterRequiredException,
119
ProcessParameterInvalidException,
10+
ProcessParameterRequiredException,
11+
ProcessUnsupportedException,
1212
)
1313
from openeo_driver.specs import SPECS_ROOT
1414
from openeo_driver.util.geometry import validate_geojson_basic
15-
from openeo_driver.utils import read_json, EvalEnv
15+
from openeo_driver.utils import EvalEnv, read_json
1616

1717

1818
class ProcessParameter:

openeo_driver/testing.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,21 @@
1111
import re
1212
import urllib.request
1313
from pathlib import Path
14-
from typing import Any, Callable, Dict, Optional, Pattern, Tuple, Union, Collection
14+
from typing import Any, Callable, Collection, Dict, Optional, Pattern, Tuple, Union
1515
from unittest import mock
1616

17+
import openeo
18+
import openeo.processes
1719
import pytest
1820
import shapely.geometry.base
1921
import shapely.wkt
2022
from flask import Response
2123
from flask.testing import FlaskClient
24+
from openeo.capabilities import ComparableVersion
2225
from werkzeug.datastructures import Headers
2326

24-
import openeo
25-
import openeo.processes
26-
from openeo.capabilities import ComparableVersion
2727
from openeo_driver.users.auth import HttpAuthHandler
28-
from openeo_driver.util.geometry import (
29-
as_geojson_feature,
30-
as_geojson_feature_collection,
31-
)
28+
from openeo_driver.util.geometry import as_geojson_feature, as_geojson_feature_collection
3229
from openeo_driver.utils import generate_unique_id
3330

3431
_log = logging.getLogger(__name__)
@@ -587,6 +584,7 @@ def __repr__(self):
587584
msg += "\n" + "\n".join(f" # {i}" for i in self.actual_info)
588585
return msg
589586

587+
590588
def caplog_with_custom_formatter(caplog: pytest.LogCaptureFixture, format: Union[str, logging.Formatter]):
591589
"""
592590
Context manager to set a custom formatter on the caplog fixture.

openeo_driver/util/geometry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
import re
55
from pathlib import Path
6-
from typing import Union, Tuple, Optional, List, Mapping, Sequence, Any, Collection
6+
from typing import Any, Collection, List, Mapping, Optional, Sequence, Tuple, Union
77

88
import pyproj
99
import shapely.geometry

tests/test_delayed_vector.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import re
22

33
import pytest
4+
from pyproj import CRS
45

56
from openeo_driver.delayed_vector import DelayedVector
67
from openeo_driver.errors import OpenEOApiException
8+
79
from .data import get_path
8-
from pyproj import CRS
910

1011

1112
def test_feature_collection_bounds():

tests/test_testing.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
import logging
22
import re
33
import subprocess
4-
5-
import numpy
64
import sys
75
import textwrap
86
import urllib.error
97
import urllib.request
108

119
import flask
10+
import numpy
1211
import pytest
1312
import requests
1413

1514
from openeo_driver.testing import (
1615
ApiTester,
16+
ApproxGeoJSONByBounds,
1717
DictSubSet,
1818
IgnoreOrder,
19+
IsNan,
1920
ListSubSet,
2021
RegexMatcher,
2122
UrllibMocker,
2223
approxify,
2324
caplog_with_custom_formatter,
2425
ephemeral_fileserver,
2526
preprocess_check_and_replace,
26-
ApproxGeoJSONByBounds,
27-
IsNan,
2827
)
2928

3029

tests/test_vectorcube.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import pyproj
77
import pytest
88
import xarray
9-
from shapely.geometry import Polygon, MultiPolygon, Point
9+
from shapely.geometry import MultiPolygon, Point, Polygon
1010

11-
from openeo_driver.errors import OpenEOApiException
1211
from openeo_driver.datacube import DriverVectorCube
13-
from openeo_driver.testing import DictSubSet, ApproxGeometry, IsNan
12+
from openeo_driver.errors import OpenEOApiException
13+
from openeo_driver.testing import ApproxGeometry, DictSubSet, IsNan
1414
from openeo_driver.util.geometry import as_geojson_feature_collection
1515
from openeo_driver.utils import EvalEnv
1616

tests/test_views_execute.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
TEST_USER,
2828
TEST_USER_BEARER_TOKEN,
2929
ApiTester,
30+
ApproxGeoJSONByBounds,
3031
DictSubSet,
3132
RegexMatcher,
3233
ephemeral_fileserver,
3334
generate_unique_test_process_id,
3435
preprocess_check_and_replace,
3536
preprocess_regex_check_and_replace,
36-
ApproxGeoJSONByBounds,
3737
)
3838
from openeo_driver.util.geometry import as_geojson_feature, as_geojson_feature_collection
3939
from openeo_driver.util.ioformats import IOFORMATS

tests/util/test_geometry.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import contextlib
2-
from typing import Union, List
3-
42
import math
3+
from typing import List, Union
54

65
import pyproj
76
import pytest
@@ -12,20 +11,19 @@
1211
from shapely.geos import WKTWriter
1312

1413
from openeo_driver.util.geometry import (
15-
geojson_to_multipolygon,
16-
reproject_bounding_box,
17-
spatial_extent_union,
14+
BoundingBox,
15+
BoundingBoxException,
16+
CrsRequired,
1817
GeometryBufferer,
1918
as_geojson_feature,
2019
as_geojson_feature_collection,
20+
geojson_to_multipolygon,
21+
reproject_bounding_box,
2122
reproject_geometry,
22-
BoundingBox,
23-
BoundingBoxException,
24-
CrsRequired,
23+
spatial_extent_union,
2524
validate_geojson_basic,
2625
)
2726

28-
2927
from ..data import get_path
3028

3129
EARTH_CIRCUMFERENCE_KM = 40075.017

0 commit comments

Comments
 (0)