Skip to content

Commit

Permalink
Add return types in extract
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcth committed May 12, 2024
1 parent 5518cc9 commit c15313e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lantmateriet/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import glob
import logging
from pathlib import Path
from typing import Union
from typing import Optional, Union

import fiona
import geopandas as gpd
import pandas as pd
import shapely
from lantmateriet.config import Config50, config_50
Expand All @@ -31,7 +32,7 @@
config = Config50()


def save_sweden_base(target_path, processed_geo_objects):
def save_sweden_base(target_path, processed_geo_objects) -> None:
"""Save sweden base from all dissolved ground."""
df_sverige = (
pd.concat([item for item in processed_geo_objects])
Expand All @@ -46,7 +47,9 @@ def save_sweden_base(target_path, processed_geo_objects):
)


def parallel_process(geo_object, target_path, output_name):
def parallel_process(
geo_object, target_path, output_name
) -> Optional[gpd.GeoDataFrame]:
"""Parallel process."""
if geo_object.df is not None:
geo_object.process()
Expand All @@ -58,7 +61,7 @@ def parallel_process(geo_object, target_path, output_name):
return None


def extract_geojson(target_path: str, file: str, layer: str):
def extract_geojson(target_path: str, file: str, layer: str) -> None:
"""Extract and save geojson files."""
logger.info(f"Working on {file} - {layer}")
field = "objekttyp"
Expand All @@ -85,7 +88,7 @@ def extract_geojson(target_path: str, file: str, layer: str):
logger.info(f"Saved {file} - {layer}")


def extract(source_path: str, target_path):
def extract(source_path: str, target_path) -> None:
"""Run extraction of gkpg to geojson.
Args:
Expand Down

0 comments on commit c15313e

Please sign in to comment.