Skip to content

Commit

Permalink
Isort fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arnasbr committed Apr 30, 2024
1 parent 8983277 commit 3cb7d95
Show file tree
Hide file tree
Showing 40 changed files with 179 additions and 346 deletions.
2 changes: 1 addition & 1 deletion benchmarks/common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import random
from typing import List

from traveltimepy import Location, Coordinates
from traveltimepy import Coordinates, Location


def generate_float(value: float, radius: float) -> float:
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/time_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime

from benchmarks.common import generate_locations
from traveltimepy import TravelTimeSdk, Driving
from traveltimepy import Driving, TravelTimeSdk


async def generate_matrix(size: int):
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/time_filter_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time

from benchmarks.common import generate_locations
from traveltimepy import TravelTimeSdk, Transportation
from traveltimepy import Transportation, TravelTimeSdk


async def generate_matrix(size: int):
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/time_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime

from benchmarks.common import generate_coordinates
from traveltimepy import TravelTimeSdk, Driving
from traveltimepy import Driving, TravelTimeSdk


async def generate_isochrones(size: int):
Expand Down
3 changes: 2 additions & 1 deletion tests/distance_map_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from datetime import datetime

import pytest

from traveltimepy import Coordinates, Driving, LevelOfDetail, TravelTimeSdk


Expand Down
1 change: 1 addition & 0 deletions tests/geocoding_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from traveltimepy import TravelTimeSdk


Expand Down
3 changes: 2 additions & 1 deletion tests/postcodes_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from datetime import datetime

import pytest

from traveltimepy import Coordinates, PublicTransport, TravelTimeSdk


Expand Down
4 changes: 2 additions & 2 deletions tests/routes_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from datetime import datetime
from typing import List

import pytest
from datetime import datetime

from traveltimepy import PublicTransport, Driving, Location, Coordinates
from traveltimepy import Coordinates, Driving, Location, PublicTransport
from traveltimepy.dto.common import SnapPenalty
from traveltimepy.sdk import TravelTimeSdk

Expand Down
2 changes: 1 addition & 1 deletion tests/supported_locations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from traveltimepy import Location, Coordinates, TravelTimeSdk
from traveltimepy import Coordinates, Location, TravelTimeSdk


@pytest.mark.asyncio
Expand Down
6 changes: 2 additions & 4 deletions tests/time_filter_proto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

from traveltimepy import Coordinates
from traveltimepy.dto.common import PropertyProto
from traveltimepy.dto.requests.time_filter_proto import (
ProtoTransportation,
ProtoCountry,
)
from traveltimepy.dto.requests.time_filter_proto import (ProtoCountry,
ProtoTransportation)
from traveltimepy.sdk import TravelTimeSdk


Expand Down
3 changes: 2 additions & 1 deletion tests/time_filter_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from datetime import datetime

import pytest

from traveltimepy import PublicTransport, TravelTimeSdk


Expand Down
6 changes: 4 additions & 2 deletions tests/time_map_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import pytest
from datetime import datetime

from traveltimepy import Coordinates, Driving, LevelOfDetail, Range, TravelTimeSdk
import pytest

from traveltimepy import (Coordinates, Driving, LevelOfDetail, Range,
TravelTimeSdk)


@pytest.mark.asyncio
Expand Down
19 changes: 5 additions & 14 deletions tests/wkt_parsing_test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import pytest # noqa

from traveltimepy import Coordinates
from traveltimepy.wkt import (
parse_wkt,
PointModel,
LineStringModel,
PolygonModel,
MultiPointModel,
MultiLineStringModel,
MultiPolygonModel,
)
from traveltimepy.wkt.error import (
InvalidWKTStringError,
NullGeometryError,
InvalidGeometryTypeError,
)
from traveltimepy.wkt import (LineStringModel, MultiLineStringModel,
MultiPointModel, MultiPolygonModel, PointModel,
PolygonModel, parse_wkt)
from traveltimepy.wkt.error import (InvalidGeometryTypeError,
InvalidWKTStringError, NullGeometryError)

point_wkt = "POINT (0 0)"
line_wkt = "LINESTRING(0 0, 1 1, 2 2)"
Expand Down
11 changes: 3 additions & 8 deletions tests/wkt_pretty_print_test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import pytest # noqa

from traveltimepy import Coordinates
from traveltimepy.wkt import (
PointModel,
LineStringModel,
PolygonModel,
MultiPointModel,
MultiLineStringModel,
MultiPolygonModel,
)
from traveltimepy.wkt import (LineStringModel, MultiLineStringModel,
MultiPointModel, MultiPolygonModel, PointModel,
PolygonModel)

# Updated mock data for LineStringModel with two distinct points
mock_point1 = PointModel(coordinates=Coordinates(lat=10, lng=20))
Expand Down
36 changes: 10 additions & 26 deletions traveltimepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
"""Python sdk for working with traveltime api"""

from traveltimepy.dto.transportation import (
PublicTransport,
Driving,
Ferry,
Walking,
Cycling,
DrivingTrain,
CyclingPublicTransport,
)
from traveltimepy.dto.requests.time_filter_proto import (
ProtoTransportation,
ProtoCountry,
)
from traveltimepy.dto.common import (
Coordinates,
Location,
Property,
PropertyProto,
FullRange,
Range,
Rectangle,
LevelOfDetail,
)

from traveltimepy.sdk import TravelTimeSdk
from traveltimepy.dto.requests.time_filter_fast import Transportation
from traveltimepy.dto.common import (Coordinates, FullRange, LevelOfDetail,
Location, Property, PropertyProto, Range,
Rectangle)
from traveltimepy.dto.requests.postcodes_zones import ZonesProperty
from traveltimepy.dto.requests.time_filter_fast import Transportation
from traveltimepy.dto.requests.time_filter_proto import (ProtoCountry,
ProtoTransportation)
from traveltimepy.dto.transportation import (Cycling, CyclingPublicTransport,
Driving, DrivingTrain, Ferry,
PublicTransport, Walking)
from traveltimepy.sdk import TravelTimeSdk
from traveltimepy.version import __version__

__all__ = [
Expand Down
4 changes: 2 additions & 2 deletions traveltimepy/dto/common.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from datetime import datetime, time
from enum import Enum
from typing import List, Union, Optional
from typing import List, Optional, Union

from pydantic import field_validator
from typing_extensions import Literal
from pydantic.main import BaseModel
from typing_extensions import Literal


class Coordinates(BaseModel):
Expand Down
17 changes: 4 additions & 13 deletions traveltimepy/dto/requests/distance_map.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
import typing
from datetime import datetime

from typing import List, Optional

from pydantic.main import BaseModel

from traveltimepy import (
Coordinates,
PublicTransport,
Driving,
Ferry,
Walking,
Cycling,
DrivingTrain,
CyclingPublicTransport,
LevelOfDetail,
)
from traveltimepy import (Coordinates, Cycling, CyclingPublicTransport,
Driving, DrivingTrain, Ferry, LevelOfDetail,
PublicTransport, Walking)
from traveltimepy.dto.common import SnapPenalty
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.time_map import TimeMapResponse
from traveltimepy.itertools import split, flatten
from traveltimepy.itertools import flatten, split


class DepartureSearch(BaseModel):
Expand Down
18 changes: 6 additions & 12 deletions traveltimepy/dto/requests/postcodes.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
from datetime import datetime
from typing import List, Union, Optional
from typing import List, Optional, Union

from pydantic import BaseModel

from traveltimepy.dto.common import Coordinates, Property, FullRange
from traveltimepy.dto.common import Coordinates, FullRange, Property
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.postcodes import PostcodesResponse
from traveltimepy.itertools import split, flatten
from traveltimepy.dto.transportation import (
PublicTransport,
Driving,
Ferry,
Walking,
Cycling,
DrivingTrain,
CyclingPublicTransport,
)
from traveltimepy.dto.transportation import (Cycling, CyclingPublicTransport,
Driving, DrivingTrain, Ferry,
PublicTransport, Walking)
from traveltimepy.itertools import flatten, split


class ArrivalSearch(BaseModel):
Expand Down
22 changes: 7 additions & 15 deletions traveltimepy/dto/requests/postcodes_zones.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
from datetime import datetime
from enum import Enum
from typing import List, Union, Optional
from typing import List, Optional, Union

from pydantic import BaseModel

from traveltimepy.dto.common import Coordinates, FullRange
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.zones import (
PostcodesDistrictsResponse,
PostcodesSectorsResponse,
)
from traveltimepy.itertools import split, flatten
from traveltimepy.dto.transportation import (
PublicTransport,
Driving,
Ferry,
Walking,
Cycling,
DrivingTrain,
CyclingPublicTransport,
)
from traveltimepy.dto.responses.zones import (PostcodesDistrictsResponse,
PostcodesSectorsResponse)
from traveltimepy.dto.transportation import (Cycling, CyclingPublicTransport,
Driving, DrivingTrain, Ferry,
PublicTransport, Walking)
from traveltimepy.itertools import flatten, split


class ZonesProperty(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion traveltimepy/dto/requests/request.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import List, TypeVar, Generic
from typing import Generic, List, TypeVar

from pydantic import BaseModel

Expand Down
16 changes: 5 additions & 11 deletions traveltimepy/dto/requests/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@

from pydantic.main import BaseModel

from traveltimepy.dto.common import Location, Property, FullRange, SnapPenalty
from traveltimepy.dto.transportation import (
PublicTransport,
Driving,
Ferry,
Walking,
Cycling,
DrivingTrain,
CyclingPublicTransport,
)
from traveltimepy.dto.common import FullRange, Location, Property, SnapPenalty
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.routes import RoutesResponse
from traveltimepy.itertools import split, flatten
from traveltimepy.dto.transportation import (Cycling, CyclingPublicTransport,
Driving, DrivingTrain, Ferry,
PublicTransport, Walking)
from traveltimepy.itertools import flatten, split


class ArrivalSearch(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion traveltimepy/dto/requests/supported_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from traveltimepy.dto.common import Location
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.supported_locations import SupportedLocationsResponse
from traveltimepy.dto.responses.supported_locations import \
SupportedLocationsResponse
from traveltimepy.itertools import flatten


Expand Down
16 changes: 5 additions & 11 deletions traveltimepy/dto/requests/time_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@

from pydantic.main import BaseModel

from traveltimepy.dto.common import Location, FullRange, Property, SnapPenalty
from traveltimepy.dto.common import FullRange, Location, Property, SnapPenalty
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.time_filter import TimeFilterResponse
from traveltimepy.itertools import split, flatten
from traveltimepy.dto.transportation import (
PublicTransport,
Driving,
Ferry,
Walking,
Cycling,
DrivingTrain,
CyclingPublicTransport,
)
from traveltimepy.dto.transportation import (Cycling, CyclingPublicTransport,
Driving, DrivingTrain, Ferry,
PublicTransport, Walking)
from traveltimepy.itertools import flatten, split


class ArrivalSearch(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions traveltimepy/dto/requests/time_filter_fast.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import List, Optional
from typing_extensions import Literal

from pydantic import BaseModel
from typing_extensions import Literal

from traveltimepy.dto.common import Location, Property, SnapPenalty
from traveltimepy.dto.requests.request import TravelTimeRequest
from traveltimepy.dto.responses.time_filter_fast import TimeFilterFastResponse
from traveltimepy.itertools import split, flatten
from traveltimepy.itertools import flatten, split


class Transportation(BaseModel):
Expand Down
Loading

0 comments on commit 3cb7d95

Please sign in to comment.