pylint icon indicating copy to clipboard operation
pylint copied to clipboard

False positive no-member on Shapely BaseGeometry

Open gcolombeau opened this issue 7 years ago • 3 comments

Steps to reproduce

  1. 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)
  1. 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

gcolombeau avatar Nov 30 '18 09:11 gcolombeau

Thanks for the report!

PCManticore avatar Dec 04 '18 07:12 PCManticore

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

ltshb avatar May 11 '21 05:05 ltshb

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

manuel-koch avatar Mar 13 '23 09:03 manuel-koch