Repository: Avaiga/taipy
File: taipy/gui_core/_adapters.py (Python)

Code before:
                return type(base_val)(val)
            except Exception:
                # forget it
                pass
    return val

def _filter_iterable(list_val: Iterable, operator: t.Callable, val: t.Any):
    if operator is contains:
        types = {type(v) for v in list_val}
        if len(types) == 1:
            typed_val = next(v for v in list_val)
            if isinstance(typed_val, (datetime, date)):
                list_val = [v.isoformat() for v in list_val]
            else:
                val = _adapt_type(typed_val, val)
        return contains(list(list_val), val)
    return next(filter(lambda v: _filter_value(v, operator, val), list_val), None) is not None


def _invoke_action(
    ent: t.Any, col: str, col_type: str, is_dn: bool, action: str, val: t.Any, col_fn: t.Optional[str]
) -> bool:
    if ent is None:
        return False
    if not (col_fn or col).isidentifier():
        _warn(f'Error filtering with "{col_fn or col}": not a valid python identifier.')
        return True
    try:
        if col_type == "any":
            # when a property is not found, return True only if action is not equals
            if not is_dn and not hasattr(ent, "properties") or not ent.properties.get(col_fn or col):
                return action == "!="
        if op := _operators.get(action):
            cur_val = attrgetter(col_fn or col)(ent)
            cur_val = cur_val() if col_fn else cur_val
            if isinstance(cur_val, Iterable):
                return _filter_iterable(cur_val, op, val)
            return _filter_value(cur_val, op, val, _adapt_type)
    except Exception as e:
        if _is_debugging():
            _warn(f"Error filtering with {col} {action} {val} on {ent}.", e)
        return col_type == "any" and action == "!="
    return True


def _get_entity_property(col: str, a_type: t.Type):
    col_parts = col.split("(")  # handle the case where the col is a method (ie get_simple_label())
    col_fn = (
        next(
            (col_parts[0] for i in inspect.getmembers(a_type, predicate=inspect.isfunction) if i[0] == col_parts[0]),
            None,

Review comment (suggestion):
```suggestion
        _warn(f'Error filtering with "{col_fn or col}": not a valid Python identifier.')
```

Code after:
                return type(base_val)(val)
            except Exception:
                # forget it
                pass
    return val

def _filter_iterable(list_val: Iterable, operator: t.Callable, val: t.Any):
    if operator is contains:
        types = {type(v) for v in list_val}
        if len(types) == 1:
            typed_val = next(v for v in list_val)
            if isinstance(typed_val, (datetime, date)):
                list_val = [v.isoformat() for v in list_val]
            else:
                val = _adapt_type(typed_val, val)
        return contains(list(list_val), val)
    return next(filter(lambda v: _filter_value(v, operator, val), list_val), None) is not None


def _invoke_action(
    ent: t.Any, col: str, col_type: str, is_dn: bool, action: str, val: t.Any, col_fn: t.Optional[str]
) -> bool:
    if ent is None:
        return False
    if not (col_fn or col).isidentifier():
        _warn(f'Error filtering with "{col_fn or col}": not a valid Python identifier.')
        return True
    try:
        if col_type == "any":
            # when a property is not found, return True only if action is not equals
            if not is_dn and not hasattr(ent, "properties") or not ent.properties.get(col_fn or col):
                return action == "!="
        if op := _operators.get(action):
            cur_val = attrgetter(col_fn or col)(ent)
            cur_val = cur_val() if col_fn else cur_val
            if isinstance(cur_val, Iterable):
                return _filter_iterable(cur_val, op, val)
            return _filter_value(cur_val, op, val, _adapt_type)
    except Exception as e:
        if _is_debugging():
            _warn(f"Error filtering with {col} {action} {val} on {ent}.", e)
        return col_type == "any" and action == "!="
    return True


def _get_entity_property(col: str, a_type: t.Type):
    col_parts = col.split("(")  # handle the case where the col is a method (ie get_simple_label())
    col_fn = (
        next(
            (col_parts[0] for i in inspect.getmembers(a_type, predicate=inspect.isfunction) if i[0] == col_parts[0]),
            None,