| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Change `Any`s to `object`. It's better to use `object` for "unknown" -- `object` is type safe, `Any` is not. To aid in this, change the `is*` functions to TypeGuards, so their check is carried over to the typing. Since pytest already uses dataclasses extensively internally, I removed the lazy import of it, this way can more easily utilize the existing type guard from typeshed.
|
|
||
|
|
||
| def isiterable(obj: Any) -> bool: | ||
| def isiterable(obj: object) -> TypeGuard[collections.abc.Iterable[object]]: |
There was a problem hiding this comment.
This one should take object|Iterable[object]
Sorry, something went wrong.
There was a problem hiding this comment.
Iterable[object] is a subtype of object, so isn't this equivalent to object?
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Change Anys to object. It's better to use object for "unknown" -- object is type safe, Any is not.
To aid in this, change the is* functions to TypeGuards, so their check is carried over to the typing.
Since pytest already uses dataclasses extensively internally, I removed the lazy import of it, this way can more easily utilize the existing type guard from typeshed.