Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Update dependency ruff to v0.3.2 #542

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/cities/belgium/antwerpen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Antwerpen."""

import datetime

import pymysql
Expand Down Expand Up @@ -31,6 +32,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with ODPAntwerpen() as client:
locations = await client.disabled_parkings(limit=self.limit)
Expand All @@ -47,6 +49,7 @@ def correct_orientation(self, orientation_type: str) -> str:
Returns:
-------
str: The corrected orientation name.

"""
if orientation_type == "Dwars":
return "Haaks"
Expand All @@ -60,6 +63,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/belgium/brussel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Brussel."""

import datetime

import pymysql
Expand Down Expand Up @@ -30,6 +31,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with ODPBrussel() as client:
locations = await client.disabled_parkings(limit=self.limit)
Expand All @@ -42,6 +44,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/belgium/liege.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Liege."""

import datetime

import pymysql
Expand Down Expand Up @@ -31,6 +32,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with ODPLiege() as client:
locations = await client.disabled_parkings(limit=self.limit)
Expand All @@ -43,6 +45,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/belgium/namur.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Namur."""

import datetime

import pymysql
Expand Down Expand Up @@ -30,6 +31,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with ODPNamur() as client:
locations = await client.parking_spaces(limit=self.limit, parking_type=3)
Expand All @@ -42,6 +44,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/germany/dresden.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Dresden."""

import datetime

import pymysql
Expand Down Expand Up @@ -30,6 +31,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with ODPDresden() as client:
locations = await client.disabled_parkings(limit=self.limit)
Expand All @@ -42,6 +44,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/germany/dusseldorf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Dusseldorf."""

import datetime

import pymysql
Expand Down Expand Up @@ -29,6 +30,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with ODPDusseldorf() as client:
locations = await client.disabled_parkings()
Expand All @@ -41,6 +43,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/germany/hamburg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Hamburg."""

import datetime

import pymysql
Expand Down Expand Up @@ -29,6 +30,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with UDPHamburg() as client:
locations = await client.disabled_parkings(limit=1000)
Expand All @@ -41,6 +43,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/germany/koeln.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Hamburg."""

import datetime

import pymysql
Expand Down Expand Up @@ -29,6 +30,7 @@ async def async_get_locations(self) -> list:
Returns
-------
list: A list of parking locations.

"""
async with StadtKoeln() as client:
locations = await client.disabled_parkings()
Expand All @@ -41,6 +43,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
12 changes: 9 additions & 3 deletions app/cities/netherlands/amersfoort.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Amersfoort."""

import datetime
import json
import os
Expand Down Expand Up @@ -38,10 +39,14 @@ async def async_get_locations(self) -> json:
Returns
-------
List of objects from all parking lots.

"""
async with aiohttp.ClientSession() as client, client.get(
f'{os.getenv("CKAN_SOURCE")}/dataset/280abd40-bd4a-4d76-9537-2c2bae526296/resource/417f3e35-4a5b-47c6-a23f-cbf92938c9e5/download/amersfoort-gehandicaptenparkeerplaatsen.json',
) as resp:
async with (
aiohttp.ClientSession() as client,
client.get(
f'{os.getenv("CKAN_SOURCE")}/dataset/280abd40-bd4a-4d76-9537-2c2bae526296/resource/417f3e35-4a5b-47c6-a23f-cbf92938c9e5/download/amersfoort-gehandicaptenparkeerplaatsen.json',
) as resp,
):
print(f"{self.name} - data has been retrieved")
return json.loads(await resp.text())

Expand All @@ -51,6 +56,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
4 changes: 4 additions & 0 deletions app/cities/netherlands/amsterdam.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Amsterdam."""

import datetime

import pymysql
Expand Down Expand Up @@ -31,6 +32,7 @@ async def async_get_locations(self) -> list:
Returns
-------
List of objects from all parking lots.

"""
async with ODPAmsterdam() as client:
locations = await client.locations(limit=self.limit, parking_type="E6a")
Expand All @@ -47,6 +49,7 @@ def correct_orientation(self, orientation_type: str) -> str:
Returns:
-------
str: The corrected orientation name.

"""
if orientation_type == "Vissengraat":
return "Visgraat"
Expand All @@ -58,6 +61,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/netherlands/arnhem.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Arnhem."""

import datetime

import pymysql
Expand Down Expand Up @@ -31,6 +32,7 @@ async def async_get_locations(self) -> list:
Returns
-------
List of objects from all parking lots.

"""
async with ODPArnhem() as client:
locations = await client.locations(
Expand All @@ -46,6 +48,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
13 changes: 10 additions & 3 deletions app/cities/netherlands/den_haag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Den Haag."""

import datetime
import json
import os
Expand Down Expand Up @@ -32,10 +33,14 @@ async def async_get_locations(self) -> list:
Returns
-------
List of objects from all parking lots.

"""
async with aiohttp.ClientSession() as client, client.get(
f'{os.getenv("CKAN_SOURCE")}/api/3/action/datastore_search?resource_id=6dd4aa05-31bf-4b98-b8d5-2560b6cb9740&limit={self.limit}',
) as resp:
async with (
aiohttp.ClientSession() as client,
client.get(
f'{os.getenv("CKAN_SOURCE")}/api/3/action/datastore_search?resource_id=6dd4aa05-31bf-4b98-b8d5-2560b6cb9740&limit={self.limit}',
) as resp,
):
print(f"{self.name} - data has been retrieved")
return json.loads(await resp.text())

Expand All @@ -49,6 +54,7 @@ def number(self, value: str) -> int:
Returns:
-------
int: The converted value.

"""
if value is None:
return 1
Expand All @@ -60,6 +66,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set (str): The data to upload.

"""
count: int = 0
try:
Expand Down
3 changes: 3 additions & 0 deletions app/cities/netherlands/eindhoven.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Eindhoven."""

import datetime

import pymysql
Expand Down Expand Up @@ -30,6 +31,7 @@ async def async_get_locations(self) -> list:
Returns
-------
List of objects from all parking lots.

"""
async with ODPEindhoven() as client:
locations = await client.locations(limit=self.limit, parking_type=3)
Expand All @@ -42,6 +44,7 @@ def upload_data(self, data_set: list) -> None:
Args:
----
data_set: The data set to upload.

"""
count: int = 0
try:
Expand Down
1 change: 1 addition & 0 deletions app/cities/netherlands/groningen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Groningen."""

import datetime
import json
import os
Expand Down
1 change: 1 addition & 0 deletions app/cities/netherlands/zoetermeer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage the location data of Zoetermeer."""

import datetime
import json
import os
Expand Down
2 changes: 2 additions & 0 deletions app/database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Setup database connection."""

import os
from pathlib import Path

Expand Down Expand Up @@ -33,6 +34,7 @@ def truncate(city_name: str) -> None:
Args:
----
city_name: The name of the city, it's case sensitive!

"""
try:
sql = "DELETE FROM `parking_cities` WHERE `municipality`=%s"
Expand Down
2 changes: 2 additions & 0 deletions app/helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def centroid(vertexes: list) -> tuple:
Returns:
-------
Point: The centroid of the polygon.

"""
_x_list = [vertex[0] for vertex in vertexes]
_y_list = [vertex[1] for vertex in vertexes]
Expand All @@ -32,6 +33,7 @@ def get_unique_number(lat: float, lon: float) -> int:
Returns:
-------
int: The unique number.

"""
try:
lat_int = int(lat * 1e7)
Expand Down
Loading