Skip to content

Commit

Permalink
Fix: 'data' argument 'Layout.prop' does not accept any type
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Oct 28, 2023
1 parent 6f1dc2c commit a651ac1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/fake_bpy_module/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,14 @@ def _get_refined_data_type_fast(
if re.match(r"^Depends on function prototype", dtype_str):
return ModifierDataType("typing.Any")

# [Pattern] `bpy.types.AnyType`
# [Test]
# File: refiner_test.py
# Function: test_get_refined_data_type_for_various_patterns
# Pattern: `bpy.types.AnyType`
if re.match(r"^b`bpy.types.AnyType`$", dtype_str):
return ModifierDataType("typing.Any")

if re.match(r"^(any|Any type.)$", dtype_str):
return ModifierDataType("typing.Any")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,3 +632,13 @@ def test_get_refined_data_type_for_various_patterns(self):
self.assertEqual(dt.type(), 'MODIFIER')
self.assertEqual(dt.modifier_data_type(), "typing.Callable")
self.assertEqual(dt.to_string(), "typing.Callable")

# Pattern: `bpy.types.AnyType`
# Ref: https://github.com/nutti/fake-bpy-module/issues/141
intermidiate_data_type = IntermidiateDataType(
"`bpy.types.AnyType`")
refined_data_type = refiner.get_refined_data_type(
intermidiate_data_type, "module_1", 'FUNC_ARG')
self.assertEqual(refined_data_type.type(), 'MODIFIER')
self.assertEqual(refined_data_type.modifier_data_type(), "typing.Any")
self.assertEqual(refined_data_type.to_string(), "typing.Any")

0 comments on commit a651ac1

Please sign in to comment.