Skip to content

Commit

Permalink
TYPE: Explicit optional & other fixes (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Nov 12, 2022
1 parent 8cfb95b commit 07bf470
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
18 changes: 9 additions & 9 deletions pyproj/crs/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class CRS:
"""

def __init__(self, projparams: Any = None, **kwargs) -> None:
def __init__(self, projparams: Optional[Any] = None, **kwargs) -> None:
"""
Initialize a CRS class instance with:
- PROJ string
Expand Down Expand Up @@ -751,9 +751,9 @@ def to_cf(
@staticmethod
def from_cf(
in_cf: dict,
ellipsoidal_cs: Any = None,
cartesian_cs: Any = None,
vertical_cs: Any = None,
ellipsoidal_cs: Optional[Any] = None,
cartesian_cs: Optional[Any] = None,
vertical_cs: Optional[Any] = None,
) -> "CRS":
"""
.. versionadded:: 2.2.0
Expand Down Expand Up @@ -1772,7 +1772,7 @@ def __init__(
self,
name: str = "undefined",
datum: Any = "urn:ogc:def:datum:EPSG::6326",
ellipsoidal_cs: Any = None,
ellipsoidal_cs: Optional[Any] = None,
) -> None:
"""
Parameters
Expand Down Expand Up @@ -1816,7 +1816,7 @@ def __init__(
self,
base_crs: Any,
conversion: Any,
ellipsoidal_cs: Any = None,
ellipsoidal_cs: Optional[Any] = None,
name: str = "undefined",
) -> None:
"""
Expand Down Expand Up @@ -1918,8 +1918,8 @@ def __init__(
self,
conversion: Any,
name: str = "undefined",
cartesian_cs: Any = None,
geodetic_crs: Any = None,
cartesian_cs: Optional[Any] = None,
geodetic_crs: Optional[Any] = None,
) -> None:
"""
Parameters
Expand Down Expand Up @@ -1970,7 +1970,7 @@ def __init__(
self,
name: str,
datum: Any,
vertical_cs: Any = None,
vertical_cs: Optional[Any] = None,
geoid_model: Optional[str] = None,
) -> None:
"""
Expand Down
22 changes: 11 additions & 11 deletions pyproj/geod.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
pj_ellps = get_ellps_map()


def _params_from_ellps_map(ellps):
def _params_from_ellps_map(ellps: str) -> Tuple[float, float, float, float, bool]:
"""
Build Geodesic parameters from PROJ ellips map
Parameter
---------
ellps: str
The name of the ellips in the map.
The name of the ellipse in the map.
Returns
-------
Expand All @@ -59,7 +59,7 @@ def _params_from_ellps_map(ellps):
return semi_major_axis, semi_minor_axis, flattening, eccentricity_squared, sphere


def _params_from_kwargs(kwargs):
def _params_from_kwargs(kwargs: Dict) -> Tuple[float, float, float, float]:
"""
Build Geodesic parameters from input kwargs:
Expand All @@ -75,8 +75,8 @@ def _params_from_kwargs(kwargs):
Parameter
---------
ellps: str
The name of the ellips in the map.
kwargs: dict
The input kwargs for an ellipse.
Returns
-------
Expand Down Expand Up @@ -484,9 +484,9 @@ def inv_intermediate(
terminus_idx: int = 1,
radians: bool = False,
flags: GeodIntermediateFlag = GeodIntermediateFlag.DEFAULT,
out_lons: Any = None,
out_lats: Any = None,
out_azis: Any = None,
out_lons: Optional[Any] = None,
out_lats: Optional[Any] = None,
out_azis: Optional[Any] = None,
) -> GeodIntermediateReturn:
"""
.. versionadded:: 3.1.0
Expand Down Expand Up @@ -631,9 +631,9 @@ def fwd_intermediate(
terminus_idx: int = 1,
radians: bool = False,
flags: GeodIntermediateFlag = GeodIntermediateFlag.DEFAULT,
out_lons: Any = None,
out_lats: Any = None,
out_azis: Any = None,
out_lons: Optional[Any] = None,
out_lats: Optional[Any] = None,
out_azis: Optional[Any] = None,
) -> GeodIntermediateReturn:
"""
.. versionadded:: 3.1.0
Expand Down
2 changes: 1 addition & 1 deletion pyproj/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Proj(Transformer):
"""

def __init__(
self, projparams: Any = None, preserve_units: bool = True, **kwargs
self, projparams: Optional[Any] = None, preserve_units: bool = True, **kwargs
) -> None:
"""
A Proj class instance is initialized with proj map projection
Expand Down
4 changes: 2 additions & 2 deletions pyproj/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ def get_transform_grid_list(
source_id: Optional[str] = None,
area_of_use: Optional[str] = None,
filename: Optional[str] = None,
bbox: BBox = None,
bbox: Optional[BBox] = None,
spatial_test: str = "intersects",
include_world_coverage: bool = True,
include_already_downloaded: bool = False,
target_directory: str = None,
target_directory: Optional[str] = None,
) -> Tuple:
"""
Get a list of transform grids that can be downloaded.
Expand Down
4 changes: 2 additions & 2 deletions pyproj/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,8 +1158,8 @@ def transform( # pylint: disable=invalid-name
p2: Any,
x: Any,
y: Any,
z: Any = None,
tt: Any = None,
z: Optional[Any] = None,
tt: Optional[Any] = None,
radians: bool = False,
errcheck: bool = False,
always_xy: bool = False,
Expand Down

0 comments on commit 07bf470

Please sign in to comment.