Skip to content

Commit

Permalink
minor fix on Type_Safe__Base
Browse files Browse the repository at this point in the history
  • Loading branch information
DinisCruz committed Jan 24, 2025
1 parent dbf06c9 commit e855a28
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions osbot_utils/type_safe/Type_Safe__Base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import get_args, Union, Optional, Any, ForwardRef
from osbot_utils.helpers.Obj_Id import Obj_Id
from osbot_utils.type_safe.shared.Type_Safe__Cache import type_safe_cache

EXACT_TYPE_MATCH = (int, float, str, bytes, bool, complex)
Expand Down Expand Up @@ -63,6 +64,8 @@ def is_instance_of_type(self, item, expected_type):
if len(args) != len(item):
raise TypeError(f"Expected tuple of length {len(args)}, but got {len(item)}")
for idx, (elem, elem_type) in enumerate(zip(item, args)):
if elem_type is Obj_Id: # todo: refactor this out, and figure out better way to handle this kind of de-serialisation
elem = elem_type(elem)
try:
self.is_instance_of_type(elem, elem_type)
except TypeError as e:
Expand Down

0 comments on commit e855a28

Please sign in to comment.