From aa7307a8f294a6bf2f85b2df4ad20bca86d14add Mon Sep 17 00:00:00 2001 From: anna-charlotte Date: Tue, 21 Mar 2023 13:47:50 +0100 Subject: [PATCH 1/5] fix: disable unresolved attr detection for da in pycharm Signed-off-by: anna-charlotte --- docarray/array/abstract_array.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docarray/array/abstract_array.py b/docarray/array/abstract_array.py index 4469dc5d6ff..7c32ce0813c 100644 --- a/docarray/array/abstract_array.py +++ b/docarray/array/abstract_array.py @@ -99,6 +99,9 @@ def __getitem__(self: T, item: IndexIterType) -> T: def __getitem__(self, item: Union[int, IndexIterType]) -> Union[T_doc, T]: ... + def __getattr__(self, item) -> Any: + return super().__getattribute__(item) + @abstractmethod def _get_data_column( self: T, From 060d6cb133dde337011241cbe2bd0348f69cc3cc Mon Sep 17 00:00:00 2001 From: anna-charlotte Date: Tue, 21 Mar 2023 15:08:06 +0100 Subject: [PATCH 2/5] fix: add docstring Signed-off-by: anna-charlotte --- docarray/array/abstract_array.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docarray/array/abstract_array.py b/docarray/array/abstract_array.py index 7c32ce0813c..b181cf2190c 100644 --- a/docarray/array/abstract_array.py +++ b/docarray/array/abstract_array.py @@ -99,8 +99,12 @@ def __getitem__(self: T, item: IndexIterType) -> T: def __getitem__(self, item: Union[int, IndexIterType]) -> Union[T_doc, T]: ... - def __getattr__(self, item) -> Any: - return super().__getattribute__(item) + def __getattr__(self, item: str): + # This is defined here only for the purpose to disable PyCharm's complaints + # about not detected properties: https://youtrack.jetbrains.com/issue/PY-47991 + # Since the properties getter is set in _property_generator in __class_getitem__ + # this implementation of getattr should never be called. + pass @abstractmethod def _get_data_column( From 2d5cd78e853e8fe71dc5cc83b06f73fef1c8203b Mon Sep 17 00:00:00 2001 From: anna-charlotte Date: Tue, 21 Mar 2023 15:21:29 +0100 Subject: [PATCH 3/5] fix: call super instead of pass Signed-off-by: anna-charlotte --- docarray/array/abstract_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docarray/array/abstract_array.py b/docarray/array/abstract_array.py index b181cf2190c..c8692616959 100644 --- a/docarray/array/abstract_array.py +++ b/docarray/array/abstract_array.py @@ -104,7 +104,7 @@ def __getattr__(self, item: str): # about not detected properties: https://youtrack.jetbrains.com/issue/PY-47991 # Since the properties getter is set in _property_generator in __class_getitem__ # this implementation of getattr should never be called. - pass + return super().__getattribute__(item) @abstractmethod def _get_data_column( From 28149934fbba90a2c4081850690e7e8db4bb9fea Mon Sep 17 00:00:00 2001 From: anna-charlotte Date: Tue, 21 Mar 2023 15:36:26 +0100 Subject: [PATCH 4/5] fix: getattr Signed-off-by: anna-charlotte --- docarray/array/abstract_array.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docarray/array/abstract_array.py b/docarray/array/abstract_array.py index c8692616959..89689c48a39 100644 --- a/docarray/array/abstract_array.py +++ b/docarray/array/abstract_array.py @@ -100,11 +100,9 @@ def __getitem__(self, item: Union[int, IndexIterType]) -> Union[T_doc, T]: ... def __getattr__(self, item: str): - # This is defined here only for the purpose to disable PyCharm's complaints + # Needs to be explicitly defined here for the purpose to disable PyCharm's complaints # about not detected properties: https://youtrack.jetbrains.com/issue/PY-47991 - # Since the properties getter is set in _property_generator in __class_getitem__ - # this implementation of getattr should never be called. - return super().__getattribute__(item) + return super().__getattr__(item) @abstractmethod def _get_data_column( From b67435eb93eeaeb7d5013bb5c6893978e66e12fc Mon Sep 17 00:00:00 2001 From: anna-charlotte Date: Tue, 21 Mar 2023 15:43:51 +0100 Subject: [PATCH 5/5] fix: getattribute Signed-off-by: anna-charlotte --- docarray/array/abstract_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docarray/array/abstract_array.py b/docarray/array/abstract_array.py index 89689c48a39..fcfc3194764 100644 --- a/docarray/array/abstract_array.py +++ b/docarray/array/abstract_array.py @@ -102,7 +102,7 @@ def __getitem__(self, item: Union[int, IndexIterType]) -> Union[T_doc, T]: def __getattr__(self, item: str): # Needs to be explicitly defined here for the purpose to disable PyCharm's complaints # about not detected properties: https://youtrack.jetbrains.com/issue/PY-47991 - return super().__getattr__(item) + return super().__getattribute__(item) @abstractmethod def _get_data_column(