Skip to content

Commit

Permalink
fix: pre-commit.ci
Browse files Browse the repository at this point in the history
Signed-off-by: Barış Zeren <[email protected]>
  • Loading branch information
StepTurtle committed Oct 30, 2024
1 parent 6af5e19 commit 5ae8394
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@
__version__ = importlib_metadata.version(__package__ or __name__)
except importlib_metadata.PackageNotFoundError:
__version__ = "development"

import autoware_lanelet2_divider.data_preperation.data_preperation as data_preparation
from autoware_lanelet2_divider.debug import Debug
from autoware_lanelet2_divider.debug import DebugMessageType
import autoware_lanelet2_divider.osmium_tool.osmium_tool as osmium_tool
import autoware_lanelet2_divider.xml_tool.xml_tool as xml_tool

from .autoware_lanelet2_divider import AutowareLanlet2Divider
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import sys
import time
from typing import List

from autoware_lanelet2_divider.debug import Debug
from autoware_lanelet2_divider.debug import DebugMessageType
Expand All @@ -18,7 +17,7 @@

def create_grid_layer(grid_edge_size, layer_grids, mgrs_grid) -> None:
"""
Creates a grid layer of polygons in the specified GDAL layer.
Create a grid layer of polygons in the specified GDAL layer.
Parameters:
grid_edge_size (float): The size of each grid cell.
Expand Down Expand Up @@ -68,7 +67,7 @@ def create_grid_layer(grid_edge_size, layer_grids, mgrs_grid) -> None:

def generate_lanelet2_layer(mgrs_grid, lanelet2_map_path, lanelet2_whole_mls, layer_lanelet2_whole):
"""
Generates a Lanelet2 layer from the given Lanelet2 map path and adds it to the specified GDAL layer.
Generate a Lanelet2 layer from the given Lanelet2 map path and adds it to the specified GDAL layer.
Parameters:
mgrs_grid (str): The MGRS grid string used for location projection.
Expand Down Expand Up @@ -102,7 +101,7 @@ def generate_lanelet2_layer(mgrs_grid, lanelet2_map_path, lanelet2_whole_mls, la

def generate_yaml_dict(layer_filtered_grids, grid_edge_size, mgrs_grid) -> dict:
"""
Generates a YAML-compatible dictionary from the filtered grid layer.
Generate a YAML-compatible dictionary from the filtered grid layer.
Parameters:
layer_filtered_grids (ogr.Feature): The layer containing filtered grid features.
Expand Down Expand Up @@ -137,7 +136,7 @@ def generate_yaml_dict(layer_filtered_grids, grid_edge_size, mgrs_grid) -> dict:

def generate_config_json(layer_filtered_grids, extract_dir) -> str:
"""
Generates a configuration JSON string for Osmium Extract from the filtered grid layer.
Generate a configuration JSON string for Osmium Extract from the filtered grid layer.
Parameters:
layer_filtered_grids (ogr.Feature): The layer containing filtered grid features.
Expand Down Expand Up @@ -178,7 +177,7 @@ def data_preparation(
mgrs_grid: str, grid_edge_size: int, lanelet2_map_path: str, extract_dir: str
) -> list[str]:
"""
Prepares the data by creating grid layers, generating Lanelet2 layers, and producing metadata files.
Prepare the data by creating grid layers, generating Lanelet2 layers, and producing metadata files.
Parameters:
mgrs_grid (str): The MGRS grid string used for location projection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Debug:
@classmethod
def log(cls, message, message_type=DebugMessageType.INFO):
"""
Logs a message to the console with a timestamp and message type.
Log a message to the console with a timestamp and message type.
Parameters:
message (str): The message to log.
Expand All @@ -52,7 +52,7 @@ def log(cls, message, message_type=DebugMessageType.INFO):
@classmethod
def get_log(cls, message, message_type=DebugMessageType.INFO):
"""
Returns a formatted log message string without printing it.
Return a formatted log message string without printing it.
Parameters:
message (str): The message to format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def extract_osm_file(
args: str = "-v -s complete_ways -S types=any",
) -> bool:
"""
Extracts a specified .osm file using the osmium tool, with given arguments and configurations.
Extract a specified .osm file using the osmium tool, with given arguments and configurations.
Parameters:
input_osm_file_path (str): Path to the input .osm file.
Expand Down Expand Up @@ -85,7 +85,8 @@ def extract_osm_file(

def sort_osm_file(input_osm_file_path: str) -> str:
"""
Sorts a specified .osm file using the osmium tool to handle out-of-order Way or Relation IDs.
Sort a specified .osm file using the osmium tool to handle out-of-order Way or Relation IDs.
It stores the sorted .osm file in the same directory as the input file with "_sorted.osm" appended to the filename.
Parameters:
Expand All @@ -96,7 +97,7 @@ def sort_osm_file(input_osm_file_path: str) -> str:
"""
sorted_osm_file_path = input_osm_file_path.replace(".osm", "_sorted.osm")
command = f"osmium sort {input_osm_file_path} -o {sorted_osm_file_path}"
result = subprocess.run(
subprocess.run(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def select_tags(root, node_list, way_list, relation_list) -> None:
"""
Populates lists for 'node', 'way', and 'relation' XML elements found in the given root element.
Populate lists for 'node', 'way', and 'relation' XML elements found in the given root element.
Parameters:
root (ElementTree): The root XML element to parse.
Expand All @@ -33,7 +33,7 @@ def select_tags(root, node_list, way_list, relation_list) -> None:

def complete_missing_elements(input_osm_file_path: str, input_extracted_osm_folder: str) -> bool:
"""
Completes missing elements (nodes, ways, relations) in the divided OSM files by checking against the whole map.
Complete missing elements (nodes, ways, relations) in the divided OSM files by checking against the whole map.
Parameters:
input_osm_file_path (str): Path to the whole map OSM file.
Expand Down Expand Up @@ -71,7 +71,7 @@ def complete_missing_elements(input_osm_file_path: str, input_extracted_osm_fold
select_tags(divided_map_root, divided_node_list, divided_way_list, divided_relation_list)

for relation in divided_relation_list:
for r in [member for member in relation.iter("member")]:
for r in relation.iter("member"):
if r.attrib["type"] == "way":
if r.attrib["ref"] not in [way.attrib["id"] for way in divided_way_list]:
for way in way_list:
Expand Down Expand Up @@ -117,7 +117,7 @@ def complete_missing_elements(input_osm_file_path: str, input_extracted_osm_fold

def complete_missing_version_tag(input_osm_file_path: str):
"""
Adds missing version attributes to the root and its child elements in an OSM file, if needed.
Add missing version attributes to the root and its child elements in an OSM file, if needed.
Parameters:
input_osm_file_path (str): Path to the OSM file to update with version tags.
Expand Down

0 comments on commit 5ae8394

Please sign in to comment.