Skip to content

Commit

Permalink
Issue #197 chore: import cleanup in feature branch
Browse files Browse the repository at this point in the history
using `darker -v -i -r master openeo_driver tests`
  • Loading branch information
soxofaan committed Aug 4, 2023
1 parent 9054351 commit 869e6e5
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 38 deletions.
14 changes: 7 additions & 7 deletions openeo_driver/datacube.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import abc
import inspect
import io
import logging
import zipfile
from pathlib import Path
from typing import List, Union, Optional, Dict, Any, Tuple, Sequence
import io
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union

import geopandas as gpd
import numpy
import openeo.udf
import pandas
import pyproj
import requests
import shapely.geometry
import shapely.geometry.base
import shapely.ops
import xarray
from pyproj import CRS
import requests

from openeo.metadata import CollectionMetadata
from openeo.util import ensure_dir, str_truncate
import openeo.udf
from openeo_driver.datastructs import SarBackscatterArgs, ResolutionMergeArgs, StacAsset
from pyproj import CRS

from openeo_driver.datastructs import ResolutionMergeArgs, SarBackscatterArgs, StacAsset
from openeo_driver.errors import FeatureUnsupportedException, InternalException
from openeo_driver.util.geometry import GeometryBufferer, validate_geojson_coordinates
from openeo_driver.util.ioformats import IOFORMATS
Expand Down
8 changes: 4 additions & 4 deletions openeo_driver/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import warnings
from collections import namedtuple
from pathlib import Path
from typing import Callable, Dict, List, Tuple, Optional, Any, Union, Collection
from typing import Any, Callable, Collection, Dict, List, Optional, Tuple, Union

from openeo_driver.errors import (
ProcessUnsupportedException,
ProcessParameterRequiredException,
ProcessParameterInvalidException,
ProcessParameterRequiredException,
ProcessUnsupportedException,
)
from openeo_driver.specs import SPECS_ROOT
from openeo_driver.util.geometry import validate_geojson_basic
from openeo_driver.utils import read_json, EvalEnv
from openeo_driver.utils import EvalEnv, read_json


class ProcessParameter:
Expand Down
14 changes: 6 additions & 8 deletions openeo_driver/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,21 @@
import re
import urllib.request
from pathlib import Path
from typing import Any, Callable, Dict, Optional, Pattern, Tuple, Union, Collection
from typing import Any, Callable, Collection, Dict, Optional, Pattern, Tuple, Union
from unittest import mock

import openeo
import openeo.processes
import pytest
import shapely.geometry.base
import shapely.wkt
from flask import Response
from flask.testing import FlaskClient
from openeo.capabilities import ComparableVersion
from werkzeug.datastructures import Headers

import openeo
import openeo.processes
from openeo.capabilities import ComparableVersion
from openeo_driver.users.auth import HttpAuthHandler
from openeo_driver.util.geometry import (
as_geojson_feature,
as_geojson_feature_collection,
)
from openeo_driver.util.geometry import as_geojson_feature, as_geojson_feature_collection
from openeo_driver.utils import generate_unique_id

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


def caplog_with_custom_formatter(caplog: pytest.LogCaptureFixture, format: Union[str, logging.Formatter]):
"""
Context manager to set a custom formatter on the caplog fixture.
Expand Down
2 changes: 1 addition & 1 deletion openeo_driver/util/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import re
from pathlib import Path
from typing import Union, Tuple, Optional, List, Mapping, Sequence, Any, Collection
from typing import Any, Collection, List, Mapping, Optional, Sequence, Tuple, Union

import pyproj
import shapely.geometry
Expand Down
3 changes: 2 additions & 1 deletion tests/test_delayed_vector.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import re

import pytest
from pyproj import CRS

from openeo_driver.delayed_vector import DelayedVector
from openeo_driver.errors import OpenEOApiException

from .data import get_path
from pyproj import CRS


def test_feature_collection_bounds():
Expand Down
7 changes: 3 additions & 4 deletions tests/test_testing.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import logging
import re
import subprocess

import numpy
import sys
import textwrap
import urllib.error
import urllib.request

import flask
import numpy
import pytest
import requests

from openeo_driver.testing import (
ApiTester,
ApproxGeoJSONByBounds,
DictSubSet,
IgnoreOrder,
IsNan,
ListSubSet,
RegexMatcher,
UrllibMocker,
approxify,
caplog_with_custom_formatter,
ephemeral_fileserver,
preprocess_check_and_replace,
ApproxGeoJSONByBounds,
IsNan,
)


Expand Down
6 changes: 3 additions & 3 deletions tests/test_vectorcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import pyproj
import pytest
import xarray
from shapely.geometry import Polygon, MultiPolygon, Point
from shapely.geometry import MultiPolygon, Point, Polygon

from openeo_driver.errors import OpenEOApiException
from openeo_driver.datacube import DriverVectorCube
from openeo_driver.testing import DictSubSet, ApproxGeometry, IsNan
from openeo_driver.errors import OpenEOApiException
from openeo_driver.testing import ApproxGeometry, DictSubSet, IsNan
from openeo_driver.util.geometry import as_geojson_feature_collection
from openeo_driver.utils import EvalEnv

Expand Down
2 changes: 1 addition & 1 deletion tests/test_views_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
TEST_USER,
TEST_USER_BEARER_TOKEN,
ApiTester,
ApproxGeoJSONByBounds,
DictSubSet,
RegexMatcher,
ephemeral_fileserver,
generate_unique_test_process_id,
preprocess_check_and_replace,
preprocess_regex_check_and_replace,
ApproxGeoJSONByBounds,
)
from openeo_driver.util.geometry import as_geojson_feature, as_geojson_feature_collection
from openeo_driver.util.ioformats import IOFORMATS
Expand Down
16 changes: 7 additions & 9 deletions tests/util/test_geometry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import contextlib
from typing import Union, List

import math
from typing import List, Union

import pyproj
import pytest
Expand All @@ -12,20 +11,19 @@
from shapely.geos import WKTWriter

from openeo_driver.util.geometry import (
geojson_to_multipolygon,
reproject_bounding_box,
spatial_extent_union,
BoundingBox,
BoundingBoxException,
CrsRequired,
GeometryBufferer,
as_geojson_feature,
as_geojson_feature_collection,
geojson_to_multipolygon,
reproject_bounding_box,
reproject_geometry,
BoundingBox,
BoundingBoxException,
CrsRequired,
spatial_extent_union,
validate_geojson_basic,
)


from ..data import get_path

EARTH_CIRCUMFERENCE_KM = 40075.017
Expand Down

0 comments on commit 869e6e5

Please sign in to comment.