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

REF: run pyupgrade with Python 3.9+ #1270

Merged
merged 1 commit into from
Apr 11, 2023
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
13 changes: 7 additions & 6 deletions pyproj/_crs.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable, List, NamedTuple, Optional, Tuple, Union
from collections.abc import Iterable
from typing import Any, NamedTuple, Optional, Union

from pyproj.crs.enums import CoordinateOperationType
from pyproj.enums import ProjVersion, WktVersion
Expand All @@ -23,7 +24,7 @@ class AreaOfUse:
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
@property
def bounds(self) -> Tuple[float, float, float, float]: ...
def bounds(self) -> tuple[float, float, float, float]: ...

class Base:
name: str
Expand Down Expand Up @@ -115,7 +116,7 @@ class CoordinateSystem(_CRSParts):
def from_json_dict(coordinate_system_dict: dict) -> "CoordinateSystem": ...
@staticmethod
def from_json(coordinate_system_json_str: str) -> "CoordinateSystem": ...
def to_cf(self, rotated_pole: bool = False) -> List[dict]: ...
def to_cf(self, rotated_pole: bool = False) -> list[dict]: ...

class Param:
name: str
Expand Down Expand Up @@ -158,7 +159,7 @@ class CoordinateOperation(_CRSParts):
@property
def towgs84(self) -> Iterable[float]: ...
@property
def operations(self) -> Tuple["CoordinateOperation"]: ...
def operations(self) -> tuple["CoordinateOperation"]: ...
def __init__(self) -> None: ...
def __repr__(self) -> str: ...
@staticmethod
Expand Down Expand Up @@ -199,7 +200,7 @@ class _CRS(Base):
@property
def area_of_use(self) -> Optional[AreaOfUse]: ...
@property
def axis_info(self) -> List[Axis]: ...
def axis_info(self) -> list[Axis]: ...
@property
def prime_meridian(self) -> Optional[PrimeMeridian]: ...
@property
Expand All @@ -225,7 +226,7 @@ class _CRS(Base):
): ...
def list_authority(
self, auth_name: Optional[str] = None, min_confidence: int = 70
) -> List[AuthorityMatchInfo]: ...
) -> list[AuthorityMatchInfo]: ...
def to_3d(self, name: Optional[str] = None) -> "_CRS": ...
def to_2d(self, name: Optional[str] = None) -> "_CRS": ...
@property
Expand Down
16 changes: 8 additions & 8 deletions pyproj/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ cdef class CoordinateSystem(_CRSParts):

Returns
-------
List[dict]:
list[dict]:
CF-1.8 version of the CoordinateSystem.
"""
axis_list = self.to_json_dict()["axis"]
Expand Down Expand Up @@ -2155,7 +2155,7 @@ cdef class CoordinateOperation(_CRSParts):
"""
Returns
-------
List[Param]:
list[Param]:
The coordinate operation parameters.
"""
if self._params is not None:
Expand All @@ -2182,7 +2182,7 @@ cdef class CoordinateOperation(_CRSParts):
"""
Returns
-------
List[Grid]:
list[Grid]:
The coordinate operation grids.
"""
if self._grids is not None:
Expand Down Expand Up @@ -2243,7 +2243,7 @@ cdef class CoordinateOperation(_CRSParts):
"""
Returns
-------
List[float]:
list[float]:
A list of 3 or 7 towgs84 values if they exist.

"""
Expand Down Expand Up @@ -2273,7 +2273,7 @@ cdef class CoordinateOperation(_CRSParts):

Returns
-------
Tuple[CoordinateOperation]:
tuple[CoordinateOperation]:
The operations in a concatenated operation.

"""
Expand Down Expand Up @@ -2411,7 +2411,7 @@ cdef class _CRS(Base):

Returns
-------
List[Axis]:
list[Axis]:
The list of axis information.
"""
axis_info_list = []
Expand Down Expand Up @@ -2643,7 +2643,7 @@ cdef class _CRS(Base):

Returns
-------
List[_CRS]
list[_CRS]
"""
if self._sub_crs_list is not None:
return self._sub_crs_list
Expand Down Expand Up @@ -2856,7 +2856,7 @@ cdef class _CRS(Base):

Returns
-------
List[AuthorityMatchInfo]:
list[AuthorityMatchInfo]:
List of authority matches for the CRS.
"""
# get list of possible matching projections
Expand Down
10 changes: 5 additions & 5 deletions pyproj/_geod.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, NamedTuple, Tuple, Type
from typing import Any, NamedTuple

geodesic_version_str: str

Expand All @@ -20,7 +20,7 @@ class Geod:
def __init__(
self, a: float, f: float, sphere: bool, b: float, es: float
) -> None: ...
def __reduce__(self) -> Tuple[Type["Geod"], str]: ...
def __reduce__(self) -> tuple[type["Geod"], str]: ...
def __repr__(self) -> str: ...
def _fwd(
self,
Expand All @@ -39,7 +39,7 @@ class Geod:
dist: float,
radians: bool = False,
return_back_azimuth: bool = True,
) -> Tuple[float, float, float]: ...
) -> tuple[float, float, float]: ...
def _inv(
self,
lons1: Any,
Expand All @@ -57,7 +57,7 @@ class Geod:
lats2: float,
radians: bool = False,
return_back_azimuth: bool = False,
) -> Tuple[float, float, float]: ...
) -> tuple[float, float, float]: ...
def _inv_or_fwd_intermediate(
self,
lon1: float,
Expand All @@ -78,6 +78,6 @@ class Geod:
def _line_length(self, lons: Any, lats: Any, radians: bool = False) -> float: ...
def _polygon_area_perimeter(
self, lons: Any, lats: Any, radians: bool = False
) -> Tuple[float, float]: ...
) -> tuple[float, float]: ...

def reverse_azimuth(azi: Any, radians: bool = False) -> None: ...
10 changes: 5 additions & 5 deletions pyproj/_transformer.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import numbers
from array import array
from typing import Any, List, NamedTuple, Optional, Tuple, Union
from typing import Any, NamedTuple, Optional, Union

from pyproj._crs import _CRS, AreaOfUse, Base, CoordinateOperation
from pyproj.enums import ProjVersion, TransformDirection

proj_version_str: str
PROJ_VERSION: Tuple[int, int, int]
PROJ_VERSION: tuple[int, int, int]

class AreaOfInterest(NamedTuple):
west_lon_degree: float
Expand All @@ -30,7 +30,7 @@ class Factors(NamedTuple):

class _TransformerGroup:
_transformers: Any
_unavailable_operations: List[CoordinateOperation]
_unavailable_operations: list[CoordinateOperation]
_best_available: bool
def __init__(
self,
Expand Down Expand Up @@ -66,7 +66,7 @@ class _Transformer(Base):
@property
def target_crs(self) -> Optional[_CRS]: ...
@property
def operations(self) -> Union[Tuple[CoordinateOperation], None]: ...
def operations(self) -> Union[tuple[CoordinateOperation], None]: ...
def get_last_used_operation(self) -> _Transformer: ...
@property
def is_network_enabled(self) -> bool: ...
Expand Down Expand Up @@ -129,7 +129,7 @@ class _Transformer(Base):
radians: bool = False,
errcheck: bool = False,
direction: Union[TransformDirection, str] = TransformDirection.FORWARD,
) -> Tuple[float, float, float, float]: ...
) -> tuple[float, float, float, float]: ...
def _get_factors(
self, longitude: Any, latitude: Any, radians: bool, errcheck: bool
) -> Factors: ...
26 changes: 13 additions & 13 deletions pyproj/_transformer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,29 @@ See PROJ :c:type:`PJ_FACTORS` documentation.

Parameters
----------
meridional_scale: List[float]
meridional_scale: list[float]
Meridional scale at coordinate.
parallel_scale: List[float]
parallel_scale: list[float]
Parallel scale at coordinate.
areal_scale: List[float]
areal_scale: list[float]
Areal scale factor at coordinate.
angular_distortion: List[float]
angular_distortion: list[float]
Angular distortion at coordinate.
meridian_parallel_angle: List[float]
meridian_parallel_angle: list[float]
Meridian/parallel angle at coordinate.
meridian_convergence: List[float]
meridian_convergence: list[float]
Meridian convergence at coordinate. Sometimes also described as *grid declination*.
tissot_semimajor: List[float]
tissot_semimajor: list[float]
Maximum scale factor.
tissot_semiminor: List[float]
tissot_semiminor: list[float]
Minimum scale factor.
dx_dlam: List[float]
dx_dlam: list[float]
Partial derivative of coordinate.
dx_dphi: List[float]
dx_dphi: list[float]
Partial derivative of coordinate.
dy_dlam: List[float]
dy_dlam: list[float]
Partial derivative of coordinate.
dy_dphi: List[float]
dy_dphi: list[float]
Partial derivative of coordinate.
"""

Expand Down Expand Up @@ -458,7 +458,7 @@ cdef class _Transformer(Base):

Returns
-------
Tuple[CoordinateOperation]:
tuple[CoordinateOperation]:
The operations in a concatenated operation.
"""
if self._operations is not None:
Expand Down
6 changes: 3 additions & 3 deletions pyproj/aoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This module contains the structures related to areas of interest.
"""
from dataclasses import dataclass
from typing import NamedTuple, Optional, Tuple, Union
from typing import NamedTuple, Optional, Union

from pyproj.utils import is_null

Expand Down Expand Up @@ -56,13 +56,13 @@ class AreaOfUse(NamedTuple):
name: Optional[str] = None

@property
def bounds(self) -> Tuple[float, float, float, float]:
def bounds(self) -> tuple[float, float, float, float]:
"""
The bounds of the area of use.

Returns
-------
Tuple[float, float, float, float]
tuple[float, float, float, float]
west, south, east, and north bounds.
"""
return self.west, self.south, self.east, self.north
Expand Down
Loading