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

Type hints for AreaOfUse.bounds method are probably wrong #1012

Closed
Kirill888 opened this issue Jan 11, 2022 · 1 comment · Fixed by #1013
Closed

Type hints for AreaOfUse.bounds method are probably wrong #1012

Kirill888 opened this issue Jan 11, 2022 · 1 comment · Fixed by #1013
Labels

Comments

@Kirill888
Copy link
Contributor

Code Sample, a copy-pastable example if possible

# save as  proj_mypy_test.py
# then run mypy proj_mypy_test.py
import pyproj.crs
aou = pyproj.crs.CRS("epsg:4326").area_of_use
assert aou is not None
x1, y1, x2, y2 = aou.bounds
print(f"X:[{x1}, {x2}]  Y: [{y1}, {y2}]")

Problem description

Running code above is fine, but checking with mypy produces following errors:

proj_mypy_test.py:4: error: Need more than 1 value to unpack (4 expected)
proj_mypy_test.py:5: error: Cannot determine type of "x1"
proj_mypy_test.py:5: error: Cannot determine type of "x2"
proj_mypy_test.py:5: error: Cannot determine type of "y1"
proj_mypy_test.py:5: error: Cannot determine type of "y2"
Found 5 errors in 1 file (checked 1 source file)

Expected Output

no mypy errors is expected in that case and types of bounds should be determined to be as float.

Problem Diagnostic

pyproj/pyproj/_crs.pyi

Lines 25 to 26 in 76c3836

@property
def bounds(self) -> tuple[float]: ...

I think code above should be

    @property
    def bounds(self) -> Tuple[float, float, float, float]: ...

Environment Information

Installation method

  • conda

Conda environment information (if you installed with conda):


Environment (conda list):
$ conda list proj
# packages in environment at /home/kirill/.local/conda/envs/odc-geo:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
affine                    2.3.0                      py_0    conda-forge
astroid                   2.9.2            py38h578d9bd_0    conda-forge
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
autoflake                 1.4                pyhd8ed1ab_1    conda-forge
autopep8                  1.6.0              pyhd8ed1ab_1    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
black                     21.12b0            pyhd8ed1ab_0    conda-forge
blosc                     1.21.0               h9c3ff4c_0    conda-forge
boost-cpp                 1.74.0               h359cf19_5    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
cachetools                5.0.0              pyhd8ed1ab_0    conda-forge
cairo                     1.16.0            ha00ac49_1009    conda-forge
certifi                   2021.10.8        py38h578d9bd_1    conda-forge
cfitsio                   4.0.0                h9a35b8e_0    conda-forge
click                     8.0.3            py38h578d9bd_1    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
com2ann                   0.3.0                    pypi_0    pypi
coverage                  6.2              py38h497a2fe_0    conda-forge
curl                      7.81.0               h494985f_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
debugpy                   1.5.1            py38h709712a_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
expat                     2.4.2                h9c3ff4c_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
freexl                    1.0.6                h7f98852_0    conda-forge
geos                      3.10.1               h9c3ff4c_1    conda-forge
geotiff                   1.7.0                h6593c0a_6    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
giflib                    5.2.1                h36c2ea0_2    conda-forge
hdf4                      4.2.15               h10796ff_3    conda-forge
hdf5                      1.12.1          nompi_h7f166f4_103    conda-forge
hypothesis                6.35.0             pyhd8ed1ab_0    conda-forge
icu                       69.1                 h9c3ff4c_0    conda-forge
importlib-metadata        4.10.0           py38h578d9bd_0    conda-forge
importlib_metadata        4.10.0               hd8ed1ab_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipykernel                 6.6.1            py38he5a9106_0    conda-forge
ipython                   7.31.0           py38h578d9bd_0    conda-forge
isort                     5.10.1             pyhd8ed1ab_0    conda-forge
jbig                      2.1               h7f98852_2003    conda-forge
jedi                      0.18.1           py38h578d9bd_0    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
json-c                    0.15                 h98cffda_0    conda-forge
jupyter_client            7.1.0              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.1            py38h578d9bd_1    conda-forge
kealib                    1.4.14               h87e4c3c_3    conda-forge
krb5                      1.19.2               h48eae69_3    conda-forge
lazy-object-proxy         1.7.1            py38h497a2fe_0    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lerc                      3.0                  h9c3ff4c_0    conda-forge
libblas                   3.9.0           12_linux64_openblas    conda-forge
libcblas                  3.9.0           12_linux64_openblas    conda-forge
libcst                    0.3.23           py38h578d9bd_0    conda-forge
libcurl                   7.81.0               h494985f_0    conda-forge
libdap4                   3.20.6               hd7c4107_2    conda-forge
libdeflate                1.8                  h7f98852_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libgdal                   3.4.1                h4f01073_0    conda-forge
libgfortran-ng            11.2.0              h69a702a_11    conda-forge
libgfortran5              11.2.0              h5c6108e_11    conda-forge
libglib                   2.70.2               h174f98d_1    conda-forge
libgomp                   11.2.0              h1d223b6_11    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libkml                    1.3.0             h238a007_1014    conda-forge
liblapack                 3.9.0           12_linux64_openblas    conda-forge
libnetcdf                 4.8.1           nompi_hb3fd0d9_101    conda-forge
libnghttp2                1.43.0               ha19adfc_1    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.18          pthreads_h8fe5266_0    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     14.1                 h676c864_1    conda-forge
librttopo                 1.1.0                h30b5eef_8    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libspatialite             5.0.1               hd55babb_13    conda-forge
libssh2                   1.10.0               ha35d2d1_2    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
libtiff                   4.3.0                h6f004c6_2    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libwebp-base              1.2.1                h7f98852_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxml2                   2.9.12               h885dcf4_1    conda-forge
libzip                    1.8.0                h1c5bbd1_1    conda-forge
libzlib                   1.2.11            h36c2ea0_1013    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
mock                      4.0.3            py38h578d9bd_2    conda-forge
mypy                      0.931            py38h497a2fe_1    conda-forge
mypy_extensions           0.4.3            py38h578d9bd_4    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.74                 hb5efdd6_0    conda-forge
numpy                     1.22.0           py38h6ae9a64_0    conda-forge
odc-geo                   0.1.0                     dev_0    <develop>
openjpeg                  2.4.0                hb52868f_1    conda-forge
openssl                   3.0.0                h7f98852_2    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandas                    1.3.5            py38h43a58ef_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       20.3.4             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
platformdirs              2.3.0              pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0            py38h578d9bd_2    conda-forge
poppler                   21.11.0              ha39eefc_0    conda-forge
poppler-data              0.4.11               hd8ed1ab_0    conda-forge
postgresql                14.1                 hce44dc1_1    conda-forge
proj                      8.2.1                h277dcde_0    conda-forge
prompt-toolkit            3.0.24             pyha770c72_0    conda-forge
psutil                    5.9.0            py38h497a2fe_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
py                        1.11.0             pyh6c4a22f_0    conda-forge
pycodestyle               2.8.0              pyhd8ed1ab_0    conda-forge
pyflakes                  2.4.0              pyhd8ed1ab_0    conda-forge
pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
pylint                    2.12.2             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.6              pyhd8ed1ab_0    conda-forge
pyproj                    3.3.0            py38h5383654_1    conda-forge
pytest                    6.2.5            py38h578d9bd_2    conda-forge
pytest-cov                3.0.0              pyhd8ed1ab_0    conda-forge
pytest-timeout            2.0.2              pyhd8ed1ab_0    conda-forge
python                    3.8.12          hf930737_2_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytz                      2021.3             pyhd8ed1ab_0    conda-forge
pyupgrade                 2.31.0             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0              py38h497a2fe_3    conda-forge
pyzmq                     22.3.0           py38h2035c66_1    conda-forge
rasterio                  1.2.10           py38hc13c803_4    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
setuptools                60.5.0           py38h578d9bd_0    conda-forge
shapely                   1.8.0            py38h800f7b8_4    conda-forge
shed                      0.7.0                    pypi_0    pypi
six                       1.16.0             pyh6c4a22f_0    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.37.0               h9cd32fc_0    conda-forge
tiledb                    2.5.3                hf3d3071_0    conda-forge
tk                        8.6.11               h27826a3_1    conda-forge
tokenize-rt               4.2.1              pyhd8ed1ab_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.2              pyhd8ed1ab_0    conda-forge
toolz                     0.11.2             pyhd8ed1ab_0    conda-forge
tornado                   6.1              py38h497a2fe_2    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
typed-ast                 1.5.1            py38h497a2fe_0    conda-forge
types-cachetools          4.2.8                    pypi_0    pypi
types-certifi             2021.10.8.1              pypi_0    pypi
typing-extensions         4.0.1                hd8ed1ab_0    conda-forge
typing_extensions         4.0.1              pyha770c72_0    conda-forge
typing_inspect            0.7.1              pyh6c4a22f_0    conda-forge
tzcode                    2021e                h7f98852_0    conda-forge
tzdata                    2021e                he74cb21_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
wrapt                     1.13.3           py38h497a2fe_1    conda-forge
xarray                    0.20.2             pyhd8ed1ab_0    conda-forge
xerces-c                  3.2.3                h8ce2273_4    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.7.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h36c2ea0_1013    conda-forge
zstd                      1.5.1                ha95c52a_0    conda-forge

Details about conda and system ( conda info ):
$ conda info
     active environment : odc-geo
    active env location : /home/kirill/.local/conda/envs/odc-geo
            shell level : 1
       user config file : /home/kirill/.condarc
 populated config files : /home/kirill/.condarc
          conda version : 4.11.0
    conda-build version : 3.21.7
         python version : 3.8.10.final.0
       virtual packages : __linux=5.11.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/kirill/.local/conda  (writable)
      conda av data dir : /home/kirill/.local/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/kirill/.local/conda/pkgs
                          /home/kirill/.conda/pkgs
       envs directories : /home/kirill/.local/conda/envs
                          /home/kirill/.conda/envs
               platform : linux-64
             user-agent : conda/4.11.0 requests/2.27.1 CPython/3.8.10 Linux/5.11.0-44-generic ubuntu/20.04.3 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
@Kirill888 Kirill888 added the bug label Jan 11, 2022
@snowman2
Copy link
Member

You are indeed correct. Feel free to submit a PR with the fix.

Kirill888 added a commit to Kirill888/pyproj that referenced this issue Jan 11, 2022
@snowman2 snowman2 added this to To do in 3.3.1 Release via automation Jan 11, 2022
@snowman2 snowman2 moved this from To do to Done in 3.3.1 Release Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants