Use double quotes

This commit is contained in:
Alexander Hess 2026-11-28 03:08:55 +01:00
commit ea8f1a13e3
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
8 changed files with 2464 additions and 2466 deletions

View file

@ -15,7 +15,7 @@ class AddressFactory(alchemy.SQLAlchemyModelFactory):
class Meta:
model = db.Address
sqlalchemy_get_or_create = ('id',)
sqlalchemy_get_or_create = ("id",)
id = factory.Sequence(lambda num: num)
created_at = factory.LazyFunction(utils.early_in_the_morning)
@ -28,13 +28,13 @@ class AddressFactory(alchemy.SQLAlchemyModelFactory):
# Mimic a Google Maps Place ID with just random characters.
place_id = factory.LazyFunction(
lambda: ''.join(random.choice(string.ascii_lowercase) for _ in range(20)),
lambda: "".join(random.choice(string.ascii_lowercase) for _ in range(20)),
)
# Place the addresses somewhere in downtown Paris.
latitude = factory.Faker('coordinate', center=48.855, radius=0.01)
longitude = factory.Faker('coordinate', center=2.34, radius=0.03)
latitude = factory.Faker("coordinate", center=48.855, radius=0.01)
longitude = factory.Faker("coordinate", center=2.34, radius=0.03)
# city -> set by the `make_address` fixture as there is only one `city`
city_name = 'Paris'
city_name = "Paris"
zip_code = factory.LazyFunction(lambda: random.randint(75001, 75020))
street = factory.Faker('street_address', locale='fr_FR')
street = factory.Faker("street_address", locale="fr_FR")

View file

@ -12,11 +12,11 @@ class CourierFactory(alchemy.SQLAlchemyModelFactory):
class Meta:
model = db.Courier
sqlalchemy_get_or_create = ('id',)
sqlalchemy_get_or_create = ("id",)
id = factory.Sequence(lambda num: num)
created_at = factory.LazyFunction(utils.early_in_the_morning)
vehicle = 'bicycle'
vehicle = "bicycle"
historic_speed = 7.89
capacity = 100
pay_per_hour = 750

View file

@ -11,6 +11,6 @@ class CustomerFactory(alchemy.SQLAlchemyModelFactory):
class Meta:
model = db.Customer
sqlalchemy_get_or_create = ('id',)
sqlalchemy_get_or_create = ("id",)
id = factory.Sequence(lambda num: num)

View file

@ -26,7 +26,7 @@ class AdHocOrderFactory(alchemy.SQLAlchemyModelFactory):
class Meta:
model = db.Order
sqlalchemy_get_or_create = ('id',)
sqlalchemy_get_or_create = ("id",)
class Params:
"""Define flags that overwrite some attributes.

View file

@ -17,7 +17,7 @@ class ReplayedOrderFactory(alchemy.SQLAlchemyModelFactory):
class Meta:
model = db.ReplayedOrder
sqlalchemy_get_or_create = ('simulation_id', 'order_id')
sqlalchemy_get_or_create = ("simulation_id", "order_id")
# Generic columns
# simulation -> set by the `make_replay_order` fixture for better control

View file

@ -16,7 +16,7 @@ class RestaurantFactory(alchemy.SQLAlchemyModelFactory):
class Meta:
model = db.Restaurant
sqlalchemy_get_or_create = ('id',)
sqlalchemy_get_or_create = ("id",)
id = factory.Sequence(lambda num: num)
created_at = factory.LazyFunction(utils.early_in_the_morning)

View file

@ -130,7 +130,7 @@ def make_replay_order(make_order, simulation):
"""
if scheduled:
if order and order.ad_hoc is False:
raise RuntimeError('`order` must be scheduled')
raise RuntimeError("`order` must be scheduled")
elif order is None:
order = make_order(scheduled=True)
elif order is None:

View file

@ -9,16 +9,16 @@ from velofy import db
def city_data():
"""The data for the one and only `City` object as a `dict`."""
return {
'id': 1,
'name': 'Paris',
'kml': "<?xml version='1.0' encoding='UTF-8'?> ...",
'center_latitude': 48.856614,
'center_longitude': 2.3522219,
'northeast_latitude': 48.9021449,
'northeast_longitude': 2.4699208,
'southwest_latitude': 48.815573,
'southwest_longitude': 2.225193,
'initial_zoom': 12,
"id": 1,
"name": "Paris",
"kml": "<?xml version='1.0' encoding='UTF-8'?> ...",
"center_latitude": 48.856614,
"center_longitude": 2.3522219,
"northeast_latitude": 48.9021449,
"northeast_longitude": 2.4699208,
"southwest_latitude": 48.815573,
"southwest_longitude": 2.225193,
"initial_zoom": 12,
}
@ -86,10 +86,10 @@ def pixel(grid):
def simulation_data(city):
"""The data for the one and only `ReplaySimulation` object as a `dict`."""
return {
'id': 1,
'city': city,
'strategy': 'best_possible_routing',
'run': 0,
"id": 1,
"city": city,
"strategy": "best_possible_routing",
"run": 0,
}