Skip to content

Commit de916f7

Browse files
author
Guillaume Latour
committed
feat: add maps feature + ruff format
1 parent d0447aa commit de916f7

File tree

11 files changed

+189
-116
lines changed

11 files changed

+189
-116
lines changed

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ dependencies = [
1313
'pandas',
1414
'pyarrow',
1515
'tabulate',
16-
'geojson'
16+
'geojson',
1717
]
1818
description = "API client allowing to interact with the tomtom REST services."
1919
maintainers = [
20-
{ name = "Guillaume Latour", email = "[email protected]" }
20+
{ name = "Guillaume Latour", email = "[email protected]" },
2121
]
2222
name = "tomtom_api"
2323
readme = "readme.md"
2424
requires-python = ">=3.8"
25-
version = "2023.5.24"
25+
version = "2024.6.27"
2626

2727
[project.urls]
2828
repository = "https://stash.macq.eu/projects/RDDS/repos/tomtom-api"
2929

3030
[project.optional-dependencies]
31-
dev = ['autopep8', 'pytest', 'pdoc']
31+
dev = ['ruff', 'pytest']
3232
pyproj = ['pyproj']
3333

3434
[project.scripts]

src/tomtom_api/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def client():
4343
@click.option('-t', '--job-type', type=click.Choice(['routeanalysis', 'areaanalysis', 'trafficdensity']), multiple=True,
4444
help="The type of jobs.")
4545
@click.option('-s', '--state', type=click.Choice([n.name for n in TomtomJobState]), multiple=True,
46-
help=f"The current state of jobs.")
46+
help="The current state of jobs.")
4747
def list_all_job_info(
4848
base_url: Optional[str] = None,
4949
version: Optional[int] = None,

src/tomtom_api/client.py

Lines changed: 176 additions & 98 deletions
Large diffs are not rendered by default.

src/tomtom_api/priority_queue/cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import click
55

6-
from tomtom_api import config
76
from tomtom_api.priority_queue.lib import (pretty_print_queue,
87
priority_queue_add_job,
98
priority_queue_clean_folder,
@@ -12,7 +11,6 @@
1211
priority_queue_update_job)
1312
from tomtom_api.priority_queue.models.daemon import PriorityQueueDaemon
1413
from tomtom_api.priority_queue.models.database import PriorityQueueDB
15-
from tomtom_api.priority_queue.models.queue import QueueItem
1614
from tomtom_api.priority_queue.models.status import QueueItemStatus
1715
from tomtom_api.traffic_stats.models.jobs.route import TomtomRouteJob
1816

src/tomtom_api/priority_queue/models/daemon.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from tomtom_api.priority_queue.models.queue import QueueItem
1010
from tomtom_api.priority_queue.models.status import QueueItemStatus
1111
from tomtom_api.traffic_stats import N_CONCURRENT_JOB_IN_PROGRESS
12-
from tomtom_api.traffic_stats.models.status import (TomtomJobState,
13-
TomtomReportType)
12+
from tomtom_api.traffic_stats.models.status import (TomtomJobState)
1413
from tomtom_api.utils.daemon import Daemon
1514

1615
DAEMON_LOG_FILE = config.path.home / 'daemon.log'

src/tomtom_api/priority_queue/models/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def get_filtered_items(
149149
uid, name, priority, status = uid or [], name or [], priority or [], status or []
150150

151151
# uid filter
152-
uid_filter_str = '' if len(uid) < 1 else f'(uid in @uid)'
152+
uid_filter_str = '' if len(uid) < 1 else '(uid in @uid)'
153153

154154
# name filter
155155
name_filters = [f'name.str.contains("{n}")' for n in name]

src/tomtom_api/traffic_stats/models/geospatial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(
182182
raise TooManyViaPointsException(f'The TomtomRoad {self.name} has too many via points.')
183183

184184
if self.length() > MAX_ROAD_LENGTH:
185-
raise RoadTooLongException(f'The road length is greater than the maximum allowed.')
185+
raise RoadTooLongException('The road length is greater than the maximum allowed.')
186186

187187
@classmethod
188188
def from_dict(cls, dict_object: Dict[str, Any], ignore_consecutive_points: bool = False) -> TomtomRoad:
@@ -316,7 +316,7 @@ def __init__(
316316
self.geometry = geometry
317317

318318
if self.area() > MAX_ROAD_LENGTH:
319-
raise RoadTooLongException(f'The road length is greater than the maximum allowed.')
319+
raise RoadTooLongException('The road length is greater than the maximum allowed.')
320320

321321
@classmethod
322322
def from_dict(cls, dict_object: Dict[str, Any]) -> TomtomNetwork:

src/tomtom_api/traffic_stats/models/jobs/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
from typing import Any, Dict, List, Literal, Optional
55

6-
from tomtom_api.traffic_stats import MAX_DATE_RANGE_COUNT, MAX_TIME_SETS_COUNT
6+
from tomtom_api.traffic_stats import MAX_TIME_SETS_COUNT
77
from tomtom_api.traffic_stats.models.time import TomtomDateRange, TomtomTimeSet
88

99

src/tomtom_api/traffic_stats/models/jobs/route.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from __future__ import annotations
22

3-
import json
43
from typing import Any, Dict, List, Literal, Optional
54

6-
from tomtom_api.traffic_stats import (MAX_DATE_RANGE_COUNT, MAX_ROAD_COUNT,
7-
MAX_TIME_SETS_COUNT)
5+
from tomtom_api.traffic_stats import (MAX_DATE_RANGE_COUNT, MAX_ROAD_COUNT)
86
from tomtom_api.traffic_stats.models.geospatial import TomtomRoad
97
from tomtom_api.traffic_stats.models.jobs.base import TomtomJob
108
from tomtom_api.traffic_stats.models.time import TomtomDateRange, TomtomTimeSet

src/tomtom_api/traffic_stats/models/time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(
6464
if e < s:
6565
raise ValueError(f'The start date ({self.start}) is after the end date ({self.end})')
6666
if (e - s).days > MAX_DATE_RANGE_LENGTH:
67-
raise ValueError(f'The given date range is greater than the maximum allowed.')
67+
raise ValueError('The given date range is greater than the maximum allowed.')
6868

6969
self.exclusions = None if exclusions is None else [date_as_str(d, date_fmt) for d in exclusions]
7070
self.excluded_days_of_week = None if excluded_days_of_week is None else dow(excluded_days_of_week)

0 commit comments

Comments
 (0)