github / github/codeql

Python: LGTM.com - false positive 'Call to a non-callable of builtin-class module.'

Đang mở
#4,228 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
false-positive Python
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**Description of the false positive**
When using `dask.delayed` we get a false positive 'Call to a non-callable of builtin-class module.'
The [query description](https://lgtm.com/rules/7860087/), states:
> The callable(object) builtin function determines if an object is callable or not.

So here is a minimal example using `callable` on the objects in question.

```python
In [1]: import dask

In [2]: obj1 = dask.delayed(lambda x: x*2)

In [3]: type(obj1)
Out[3]: dask.delayed.DelayedLeaf

In [4]: callable(obj1)
Out[4]: True

In [5]: obj2 = dask.delayed(lambda x: x*2)(1)

In [6]: type(obj2)
Out[6]: dask.delayed.Delayed

In [7]: callable(obj2)
Out[7]: True

In [8]: obj2.compute()
Out[8]: 2
```

**URL to the alert on the project page on LGTM.com**

https://lgtm.com/projects/g/glotaran/pyglotaran/snapshot/f6f2e68064ae770c5c31535660f5428bbc015fbd/files/glotaran/analysis/residual_calculation.py?sort=name&dir=ASC&mode=heatmap#x790ea2e7893621f4:1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.