Skip to content

Commit

Permalink
Merge pull request #162 from Bjoern-Rapp/typehint
Browse files Browse the repository at this point in the history
Mindre rettelser til typehint
  • Loading branch information
mortewle authored Oct 13, 2023
2 parents d771d27 + 1743142 commit 106779b
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/sgis/geopandas_tools/bounds.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numbers
from typing import Any, Callable, Iterable
from typing import Any
from collections.abc import Callable, Collection, Mapping

import geopandas as gpd
import numpy as np
Expand Down Expand Up @@ -439,7 +440,7 @@ def bounds_to_points(


def to_bbox(
obj: GeoDataFrame | GeoSeries | Geometry | Iterable | dict,
obj: GeoDataFrame | GeoSeries | Geometry | Collection | Mapping,
) -> tuple[float, float, float, float]:
"""Returns 4-length tuple of bounds if possible, else raises ValueError.
Expand Down
2 changes: 1 addition & 1 deletion src/sgis/geopandas_tools/duplicates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable, Iterable
from collections.abc import Iterable

import networkx as nx
import pandas as pd
Expand Down
5 changes: 3 additions & 2 deletions src/sgis/geopandas_tools/general.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numbers
import warnings
from typing import Any, Iterable
from typing import Any
from collections.abc import Iterable, Hashable

import numpy as np
import pandas as pd
Expand All @@ -22,7 +23,7 @@
from .geometry_types import get_geom_type, make_all_singlepart, to_single_geom_type


def get_common_crs(iterable: Iterable[Any], strict: bool = False) -> pyproj.CRS | None:
def get_common_crs(iterable: Iterable[Hashable], strict: bool = False) -> pyproj.CRS | None:
"""Returns the common not-None crs or raises a ValueError if more than one.
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/sgis/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import inspect
import os
import warnings
from typing import Callable
from collections.abc import Callable

import numpy as np
from geopandas import GeoDataFrame
Expand Down
2 changes: 1 addition & 1 deletion src/sgis/io/write_municipality_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Callable
from collections.abc import Callable

import pandas as pd
from dapla import write_pandas
Expand Down
2 changes: 1 addition & 1 deletion src/sgis/maps/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import warnings
from numbers import Number
from statistics import mean
from typing import Iterable
from collections.abc import Iterable

import branca as bc
import folium
Expand Down
8 changes: 4 additions & 4 deletions src/sgis/parallel/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import itertools
import multiprocessing
from pathlib import Path
from typing import Any, Callable, Iterable, Sized

from typing import Any
from collections.abc import Collection, Callable, Iterable

try:
import dapla as dp
Expand Down Expand Up @@ -73,7 +73,7 @@ def __init__(
def map(
self,
func: Callable,
iterable: Iterable,
iterable: Collection,
kwargs: dict | None = None,
) -> list[Any]:
"""Run functions in parallel with items of an iterable as first arguemnt.
Expand Down Expand Up @@ -151,7 +151,7 @@ def map(
def starmap(
self,
func: Callable,
iterable: Iterable[Iterable[Any]],
iterable: Collection[Iterable[Any]],
kwargs: dict | None = None,
) -> list[Any]:
"""Run functions in parallel where items of the iterable are unpacked.
Expand Down
2 changes: 1 addition & 1 deletion src/sgis/raster/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from copy import copy, deepcopy
from json import loads
from pathlib import Path
from typing import Callable
from collections.abc import Callable

import geopandas as gpd
import matplotlib.pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion src/sgis/raster/zonal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable
from collections.abc import Callable

import geopandas as gpd
import numpy as np
Expand Down

0 comments on commit 106779b

Please sign in to comment.