From 41be2f84a1e9d745578bce359dd546fcfb282350 Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Fri, 2 Aug 2024 14:41:51 -0700 Subject: [PATCH] confusionmatrix.py: Improve the type annotation for `__init__`'s array argument and it is not `Optional`. PiperOrigin-RevId: 658910558 --- python/ee/confusionmatrix.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/ee/confusionmatrix.py b/python/ee/confusionmatrix.py index a5a4471cf..dc62fd57a 100644 --- a/python/ee/confusionmatrix.py +++ b/python/ee/confusionmatrix.py @@ -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] @@ -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. @@ -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. """