Closed LinasKo closed 2 months ago
Testing checklist:
@LinasKo I added my first initial very small change into toml file about reduce mypy error and make sure it does proper mypy check I got them from by using mypy --install-types
and added into toml as "optional" so it won't install unless type poetry install --with typechcek
so I didn't want to burden anyone to install type check libraries in development.
I removed our "isort" original and params of isort and doing all via ruff and remove extra isort from pre-commit too.
Hi @onuralpszr ,
I've had a look at this, and I'd like you to remove your commits for now.
The PR is mostly focused on annotators typing, and is already past the limits of how much should be contained in a single PR.
I see the isort is immediately active, yet if some of the changes need a separate install, it'd likely sit idle as dead code until an indeterminate time in the future, which I don't want.
@LinasKo I backup my changes and I will move to another PR so we can merge mypy/isort formatting changes. Is that for work for you ?
Yep, happy with that!
@SkalskiP, I've addressed the requests, except for classproperty
error message. I think we should keep it as it matches the error raised by property
. https://github.com/roboflow/supervision/pull/1448#discussion_r1731121297
Description
MyPy was showing many issues in the
keypoints/annotators.py
andannotators/core.py
, so I cleaned it all up.Where the issues branched into other files, I likewise mopped it up. Here's a Loom. I strongly suggest reviewing one commit at-a-time.
Lastly, there are a few minuscule miscellaneous fixes.
Fixes:
np.array
tonp.ndarray
.Color.X
andColorPalette.X
in red, as it would see it as having typeclassproperty
. Changed it so it correctly seesColor
andColorPalette
.Optional[dtype]
if and only if they can beNone
.ImageType
wouldn't be seen asnp.ndarray
, as we type-annotate it asImageType
. I added assertions, which are the easiest way to tell mypy which one it is.sv.
.sv.KeyPoints
holds things of shape(N, 2)
, where it's actually(N, M, 2)
.Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Tested locally. Colab: https://colab.research.google.com/drive/1UjRYth4NUfAsvQiz5-CfyRJ9zbXxj2i-?usp=sharing
Any specific deployment considerations
Many docstrings affected in a small way - have a quick look at type signatures, etc.
Docs