decalage2 / olefile

olefile is a Python package to parse, read and write Microsoft OLE2 files (also called Structured Storage, Compound File Binary Format or Compound Document File Format), such as Microsoft Office 97-2003 documents, vbaProject.bin in MS Office 2007+ files, Image Composer and FlashPix files, Outlook messages, StickyNotes, several Microscopy file formats, McAfee antivirus quarantine files, etc.
http://www.decalage.info/olefile
Other
231 stars 77 forks source link

Type hints #166

Open radarhere opened 9 months ago

radarhere commented 9 months ago

Hi. In case you were interested in adding type hints in this repository, just letting you know - I recently added type hints for olefile to typeshed - https://github.com/python/typeshed/pull/11416. If you wanted to make use of that, it would give you a good head start on that endeavour.

The stubs package can be seen at https://pypi.org/project/types-olefile/

decalage2 commented 9 months ago

Hi @radarhere, thanks a lot for all this work! What would you suggest to do within olefile?

radarhere commented 9 months ago

The simplest option would be to just

If instead you were interested in being more thorough and running a tool like https://mypy-lang.org/ over the code, then you'd want to update your code with the type arguments, e.g. replacing def build_storage_tree(self): with def build_storage_tree(self) -> None:, as mypy would want you to make other changes within the body of the code.