pylint output (not-callable) when use spatial.cKDTree

Created on 23 Jul 2017  路  2Comments  路  Source: PyCQA/pylint

Steps to reproduce

  1. conda install scipy (python 3.6)
  2. import scipy.spatial as spatial
    spatial.cKDTree
  3. run pylint using configure file for google code style

Current behavior

E: 58,17: spatial.cKDTree is not callable (not-callable)

Expected behavior

spatial.cKDTree run well in my project, I want to know why Pylint gives error.
For me, spatial.cKDTree is callable in ipython, Pylint should not be seeing this as error.

pylint --version output

pylint 1.7.2,
astroid 1.5.3
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]

Most helpful comment

  1. conda create -y -n pylint_test python=3.6 scipy pylint
  2. using configure file in "https://gist.github.com/rpunkfu/3cd6f8b8b23e27adedbd"
  3. my test python file:

pylint_test_scipy.py

def nearest_ckdtree(self, cities):
    """
    we have m (n, 2) cities and we need to find time series of temperature from
    reanalysis/station obsevations whose coordinates are grids (n, 2)

    Args:
        cities: m cities of (lat, lon in each row)

    Returns:
        lists whose length is same as cities, each element of (indexes, dist) is the index of
        nearest point and the distance between the city and the point.
    """
    import scipy.spatial as spatial

    # points: n points of (lat, lon in each row)
    points = []
    for ix in self.lons:
        for iy in self.lats:
            points.append([iy, ix])
    mytree = spatial.cKDTree(points)
    dist, indexes = mytree.query(cities)

    return dist, indexes"
  1. running pylint --rcfile pylint.conf pylint_test_scipy.py gives

*** Module pylint_test_scipy
E: 20,17: spatial.cKDTree is not callable (not-callable)

All 2 comments

Can you provide a short reproducing example? I can't reproduce this bug with the example you gave. Also I tried instantiating the class and Pylint didn't complain at all.

  1. conda create -y -n pylint_test python=3.6 scipy pylint
  2. using configure file in "https://gist.github.com/rpunkfu/3cd6f8b8b23e27adedbd"
  3. my test python file:

pylint_test_scipy.py

def nearest_ckdtree(self, cities):
    """
    we have m (n, 2) cities and we need to find time series of temperature from
    reanalysis/station obsevations whose coordinates are grids (n, 2)

    Args:
        cities: m cities of (lat, lon in each row)

    Returns:
        lists whose length is same as cities, each element of (indexes, dist) is the index of
        nearest point and the distance between the city and the point.
    """
    import scipy.spatial as spatial

    # points: n points of (lat, lon in each row)
    points = []
    for ix in self.lons:
        for iy in self.lats:
            points.append([iy, ix])
    mytree = spatial.cKDTree(points)
    dist, indexes = mytree.query(cities)

    return dist, indexes"
  1. running pylint --rcfile pylint.conf pylint_test_scipy.py gives

*** Module pylint_test_scipy
E: 20,17: spatial.cKDTree is not callable (not-callable)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sambarluc picture sambarluc  路  3Comments

DGalt picture DGalt  路  3Comments

glmdgrielson picture glmdgrielson  路  3Comments

TBoshoven picture TBoshoven  路  3Comments

pylint-bot picture pylint-bot  路  3Comments