From bc943875119113e9cdae73d09c528f157d20b290 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Fri, 6 Aug 2021 00:17:53 +0200 Subject: [PATCH 1/2] str is not array --- PythonAPI/pycocotools/coco.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonAPI/pycocotools/coco.py b/PythonAPI/pycocotools/coco.py index e4182c74..df304aae 100644 --- a/PythonAPI/pycocotools/coco.py +++ b/PythonAPI/pycocotools/coco.py @@ -64,7 +64,7 @@ def _isArrayLike(obj): - return hasattr(obj, '__iter__') and hasattr(obj, '__len__') + return hasattr(obj, '__iter__') and hasattr(obj, '__len__') and not isinstance(obj, str) class COCO: @@ -438,4 +438,4 @@ def annToMask(self, ann): """ rle = self.annToRLE(ann) m = maskUtils.decode(rle) - return m \ No newline at end of file + return m From c30a7638998545ce5829555b2b398bd4cc79cd21 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Fri, 6 Aug 2021 00:21:01 +0200 Subject: [PATCH 2/2] docs --- PythonAPI/pycocotools/coco.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PythonAPI/pycocotools/coco.py b/PythonAPI/pycocotools/coco.py index df304aae..4d1190ac 100644 --- a/PythonAPI/pycocotools/coco.py +++ b/PythonAPI/pycocotools/coco.py @@ -64,6 +64,7 @@ def _isArrayLike(obj): + """Check if an object is array like (set, tuple, list, etc.).""" return hasattr(obj, '__iter__') and hasattr(obj, '__len__') and not isinstance(obj, str)