Import geopy.distance as geo_distance everywhere
This commit is contained in:
parent
d660f0cc4e
commit
07660ecff9
3 changed files with 5 additions and 4 deletions
|
|
@ -545,6 +545,7 @@ banned-from = [
|
||||||
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
|
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
|
||||||
|
|
||||||
"collections.abc" = "cabc"
|
"collections.abc" = "cabc"
|
||||||
|
"geopy.distance" = "geo_distance"
|
||||||
"googlemaps" = "gm"
|
"googlemaps" = "gm"
|
||||||
"sqlalchemy" = "sa"
|
"sqlalchemy" = "sa"
|
||||||
"sqlalchemy.dialects.postgresql" = "psql"
|
"sqlalchemy.dialects.postgresql" = "psql"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import random
|
||||||
|
|
||||||
import factory
|
import factory
|
||||||
from factory import alchemy
|
from factory import alchemy
|
||||||
from geopy import distance
|
from geopy import distance as geo_distance
|
||||||
|
|
||||||
from tests import config as test_config
|
from tests import config as test_config
|
||||||
from tests.db.fake_data.factories import utils
|
from tests.db.fake_data.factories import utils
|
||||||
|
|
@ -204,7 +204,7 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
|
||||||
# Statistical attributes -> calculate realistic stats
|
# Statistical attributes -> calculate realistic stats
|
||||||
logged_delivery_distance = factory.LazyAttribute(
|
logged_delivery_distance = factory.LazyAttribute(
|
||||||
lambda obj: (
|
lambda obj: (
|
||||||
distance.great_circle(
|
geo_distance.great_circle(
|
||||||
(obj.pickup_address.latitude, obj.pickup_address.longitude),
|
(obj.pickup_address.latitude, obj.pickup_address.longitude),
|
||||||
(obj.delivery_address.latitude, obj.delivery_address.longitude),
|
(obj.delivery_address.latitude, obj.delivery_address.longitude),
|
||||||
).meters
|
).meters
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import json
|
||||||
import googlemaps as gm
|
import googlemaps as gm
|
||||||
import pytest
|
import pytest
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from geopy import distance
|
from geopy import distance as geo_distance
|
||||||
from sqlalchemy import exc as sa_exc
|
from sqlalchemy import exc as sa_exc
|
||||||
|
|
||||||
from velofy import db
|
from velofy import db
|
||||||
|
|
@ -21,7 +21,7 @@ def another_address(make_address):
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def path(address, another_address, make_address):
|
def path(address, another_address, make_address):
|
||||||
"""A `Path` from `address` to `another_address`."""
|
"""A `Path` from `address` to `another_address`."""
|
||||||
air_distance = distance.great_circle(
|
air_distance = geo_distance.great_circle(
|
||||||
address.location.lat_lng,
|
address.location.lat_lng,
|
||||||
another_address.location.lat_lng,
|
another_address.location.lat_lng,
|
||||||
).meters
|
).meters
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue