pylint
pylint copied to clipboard
False positive no-member on Shapely BaseGeometry
Steps to reproduce
- Use the following MCVE:
"""Shapely no-member false positive MCVE"""
from shapely import wkt
from shapely.geometry import Polygon
POLYGON = Polygon([(0, 0), (0, 1), (1, 1)])
print(POLYGON.exterior.wkt)
print(POLYGON.convex_hull.exterior.wkt)
POLYGON = wkt.loads(POLYGON.wkt)
print(POLYGON.exterior.wkt)
- The script outputs as expected:
$ python shapely_nomember.py
LINEARRING (0 0, 0 1, 1 1, 0 0)
LINEARRING (0 0, 0 1, 1 1, 0 0)
LINEARRING (0 0, 0 1, 1 1, 0 0)
Current behavior
The no-member error is emitted for all but the first exterior attribute:
$ pylint shapely_nomember.py
************* Module shapely_nomember
shapely_nomember.py:7:6: E1101: Instance of 'BaseGeometry' has no 'exterior' member (no-member)
shapely_nomember.py:10:6: E1101: Instance of 'BaseGeometry' has no 'exterior' member (no-member)
I haven't properly checked but this behavior may be seen on other attributes of BaseGeometry
Expected behavior
No error should be emitted.
pylint --version output
pylint 2.2.2 astroid 2.1.0 Python 3.6.6 (default, Jul 20 2018, 09:39:42) [GCC 5.4.0 20160609]
shapely 1.6.4
Thanks for the report!
I've the same issue with
E1101: Instance of 'BaseGeometry' has no 'x' member; maybe 'xy'? (no-member)
Versions:
- shapely: 1.7.0
- python: 3.7.10
- pylint: 2.5.3
- astroid: 2.5
- GCC 9.3.0
I've the same issue with
E1101: Instance of 'BaseGeometry' has no 'exterior' member (no-member)
where I try to access coords of a convex-hull ( which is a Polygon instance ): MultiPoint(points).convex_hull.exterior.coords.
MacOS 12.6.3, M1 Python 3.10.6 pylint 2.17.0 astroid 2.15.0 Shapely 1.8.5.post1