From 343c82287d7680a11821a3a4230a41dd06cc4093 Mon Sep 17 00:00:00 2001 From: nutti Date: Sun, 24 Sep 2023 17:41:21 +0900 Subject: [PATCH] Fix: No return value of mathutils's freeze functions --- src/fake_bpy_module/analyzer.py | 17 ++++++++++------- src/fake_bpy_module/common.py | 7 +++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/fake_bpy_module/analyzer.py b/src/fake_bpy_module/analyzer.py index 03be0c15a..a92910bf8 100644 --- a/src/fake_bpy_module/analyzer.py +++ b/src/fake_bpy_module/analyzer.py @@ -431,14 +431,17 @@ def _parse_rtype(file: IO[Any], level: 'RstLevel') -> str: info["parameters"].append(param_info) - if return_ is not None and return_type is not None: - return_info = ReturnInfo() - if return_ is not None: - return_info.set_description(self._cleanup_string(return_)) + if return_ is not None: + if return_ == "An instance of this object.": + return_type = "Same type with self class" if return_type is not None: - return_info.set_data_type(IntermidiateDataType( - self._cleanup_string(return_type))) - info["return"] = return_info + return_info = ReturnInfo() + if return_ is not None: + return_info.set_description(self._cleanup_string(return_)) + if return_type is not None: + return_info.set_data_type(IntermidiateDataType( + self._cleanup_string(return_type))) + info["return"] = return_info return info diff --git a/src/fake_bpy_module/common.py b/src/fake_bpy_module/common.py index b67f4a495..25fb10f51 100644 --- a/src/fake_bpy_module/common.py +++ b/src/fake_bpy_module/common.py @@ -1344,6 +1344,13 @@ def _get_refined_data_type_fast( if re.match(r"^\s*$", dtype_str): return ModifierDataType("typing.Any") + if dtype_str == "Same type with self class": + s = self._parse_custom_data_type( + module_name, uniq_full_names, uniq_module_names, module_name) + print(f"@@@@@ {s}") + if s: + return CustomDataType(s) + if re.match(r"^(type|object|function)$", dtype_str): return ModifierDataType("typing.Any")