also exclude bytes in is_iterable_but_str

This commit is contained in:
Jouramie
2024-03-06 08:55:01 -05:00
committed by jouramie
parent 38f9ee5673
commit cf087d2ee2

View File

@@ -970,7 +970,7 @@ class RepeatableChain:
def is_iterable_but_str(obj: object) -> TypeGuard[typing.Iterable[typing.Any]]:
""" but not a `str` (because technically, `str` is `Iterable[str]`) """
if isinstance(obj, str):
""" but not a `str` nor `bytes` (because technically, `str` and `bytes` are `Iterable[str | bytes]`) """
if isinstance(obj, (str, bytes)):
return False
return isinstance(obj, typing.Iterable)