openzim / python-scraperlib

Collection of Python code to re-use across Python-based scrapers
GNU General Public License v3.0
20 stars 18 forks source link

Be more precise than generic `Callable` in type hints #199

Open benoit74 opened 1 month ago

benoit74 commented 1 month ago

callback argument of zim.creater.Creator.add_item_for is reported by pyright as partially unknown when in strict mode due to the use of generic Callable.

This is a problem in projects setting pyright in strict mode.

The same generic Callable seems to be an issue in other parts of the code.

We should probably fix this with a more precise type hint,

rgaudin commented 1 month ago

Indeed, we should define a signature/interface for it. It's not like it's used in many ways anyway