Skip to content

Conversation

@ClementPinard
Copy link
Contributor

👋 Hello there

Could not figure out why my type checker (pyright for that matter) was failing in my own code.

It turns out that some typings in pycocotools are wrong.

Namely :

COCOeval.eval is an entirely different dict from _EvaluationResult, as it can be seen here : https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L411

As such, I renamed the original _EvaluationResult into _ImageEvaluationResult and defined a new typed dict with the original name. Note that we could keep the original typed dict as is and create a new typed dict named something like _AccumulatedEvaluationResult, I don't have a preference.

I also could see that Params.areaRng is not a list, it's a list of list, as it can be seen here : https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L509

Note that it's actually either an int or a float. not sure if I should put int | float or simply float in that case.

* Add additional typeddict for self.eval which is NOT the same as self.evalImgs elements
* Correct Params.areaRng which is in fact a list of pairs
@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Could you also change the return type of evaluateImg() to the new name?

@ClementPinard
Copy link
Contributor Author

Ah yes you're right, sorry for missing that.

thanks for the review !

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit 557554f into python:main Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants