tokenizers icon indicating copy to clipboard operation
tokenizers copied to clipboard

Include return type annotation in `Encoding` class properties?

Open willfrey opened this issue 4 years ago • 1 comments

It would be tremendously helpful if you could include the return type information as an annotation. The information is already included in the docstring, so would it be possible to generate these with proper annotations?

https://github.com/huggingface/tokenizers/blob/b0ee27847ffefef7de89b9f69ff5244cb0be6428/bindings/python/py_src/tokenizers/init.pyi#L69-L86

Additionally, convention for stub files is to use an ellipse ... instead of pass for empty bodies, but that's just a nit pick :)

Thank you!

willfrey avatar Oct 05 '21 13:10 willfrey

@willfrey Thanks for the info.

Currently we cannot include type annotations because the source also supportssignature(fn) and help(fn) (in notebooks, REPLs) and those don't work properly with type annotations. Also type annotations usually require imports and that would need even more logic (Everything within those files is generated from rust, so the python information is scarce).

There might be way to do everything a bit better for sure though. Just adding information on why it isn't already done.

Narsil avatar Dec 29 '21 09:12 Narsil

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Mar 12 '24 01:03 github-actions[bot]