Added some type hints for function parameters#85
Added some type hints for function parameters#85Robolightning wants to merge 1 commit intotiagocoutinho:masterfrom
Conversation
linuxpy/video/util.py
Outdated
| def v4l2_fourcc(a, b, c, d): | ||
| import typing | ||
|
|
||
| CharType: typing.TypeAlias = typing.Union[str, bytes] |
There was a problem hiding this comment.
You can also use str | bytes instead of typing.Union[str, bytes], it's up to you.
There was a problem hiding this comment.
I'd prefer if you change to str | bytes. I try to avoid using typing as much as I can since python standard library plans to phase out typing module
linuxpy/io.py
Outdated
| bytes, | ||
| os.PathLike[str], | ||
| os.PathLike[bytes] | ||
| ] |
There was a problem hiding this comment.
Again here can't it be str | bytes | os.PathLike[str] ...
linuxpy/io.py
Outdated
| binary: bool = True, | ||
| blocking: bool = False, | ||
| close_on_exec: bool = True | ||
| ) -> typing.Union[io.FileIO, io.TextIOWrapper]: |
There was a problem hiding this comment.
Here too io.FileIO | io.TextIOWrapper?
There was a problem hiding this comment.
Can too. On my project, it's common to use Union instead of | for type annotations, so I wrote it like this. + ensures compatibility with older versions of Python
tiagocoutinho
left a comment
There was a problem hiding this comment.
Thanks for the improvements
I made some comments
41f1b97 to
ee40917
Compare
Fixed. Ready |
ee40917 to
7339ed5
Compare
Added some type hints to functions to fix static analyzer warnings