-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Description
Describe the bug
When using .view() to access bin values / variances (as described in #421 (comment)), mypy flags this code with an error in boost-histogram 1.0.0.
An example is below:
test.py:
import boost_histogram as bh
h = bh.Histogram(bh.axis.Variable([0, 10]), storage=bh.storage.Weight())
h.fill([1,2,3])
h.view().value
h.view().varianceOutput from mypy:
test.py:5: error: Item "ndarray" of "Union[ndarray, View]" has no attribute "value" [union-attr]
h.view().value
^
test.py:5: error: Item "View" of "Union[ndarray, View]" has no attribute "value" [union-attr]
h.view().value
^
test.py:6: error: Item "ndarray" of "Union[ndarray, View]" has no attribute "variance" [union-attr]
h.view().variance
^
test.py:6: error: Item "View" of "Union[ndarray, View]" has no attribute "variance" [union-attr]
h.view().variance
^
Found 4 errors in 1 file (checked 1 source file)
This may not be a bug and instead the result of improper usage. In this case, is there another way to access this information directly?
Steps to reproduce
see above, using mypy==0.812, boost-histogram==1.0.0
Metadata
Metadata
Assignees
Labels
No labels