Skip to content

Commit

Permalink
confusionmatrix.py: Improve the type annotation for __init__'s arra…
Browse files Browse the repository at this point in the history
…y argument and it is not `Optional`.

PiperOrigin-RevId: 658910558
  • Loading branch information
schwehr authored and Google Earth Engine Authors committed Aug 2, 2024
1 parent 52f9806 commit 41be2f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/ee/confusionmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from ee import ee_list
from ee import ee_number

_ArrayType = Union['ee_array.Array', computedobject.ComputedObject]
_ConfusionMatrixType = Union['ConfusionMatrix', computedobject.ComputedObject]
_ListType = Union[List[Any], Tuple[Any, Any], computedobject.ComputedObject]
_NumberType = Union[float, 'ee_number.Number', computedobject.ComputedObject]
Expand All @@ -34,7 +33,11 @@ class ConfusionMatrix(computedobject.ComputedObject):

def __init__(
self,
array: Optional[Union[_ArrayType, _ConfusionMatrixType]],
array: Union[
ee_array.Array,
ConfusionMatrix,
computedobject.ComputedObject,
],
order: Optional[_ListType] = None,
):
"""Creates a ConfusionMatrix wrapper.
Expand All @@ -44,6 +47,8 @@ def __init__(
Args:
array: A square, 2D array of integers, representing the confusion matrix.
Note that unlike the ee.Array constructor, this argument cannot take a
list.
order: The row and column size and order, for non-contiguous or non-zero
based matrices.
"""
Expand Down

0 comments on commit 41be2f8

Please sign in to comment.