Describe the bug
Some functions in the Python API have documentation that they return something or None if the something doesn't exist, but the type hints don't reflect that. As a concrete example, the documentation for lief.PE.Binary.get_section says:
Return the Section object from the given name or None if not not found
but the type signature for this method is
def get_section(self, section_name: str) -> Section: ...
which implies that it never returns None.
Expected behavior
Any function (or attribute) that can return (or be) None, should be so annotated, e.g.
def get_section(self, section_name: str) -> Section | None: ...
Environment (please complete the following information):
- System and Version : Ubuntu 22.04
- Target format (PE, ELF, Mach-O): PE
- LIEF commit version: cbf06a5
Additional context
These are the spots I've run into this so far:
lief.PE.Binary.get_export
lief.PE.Binary.get_section
Describe the bug
Some functions in the Python API have documentation that they return something or
Noneif the something doesn't exist, but the type hints don't reflect that. As a concrete example, the documentation forlief.PE.Binary.get_sectionsays:but the type signature for this method is
which implies that it never returns
None.Expected behavior
Any function (or attribute) that can return (or be)
None, should be so annotated, e.g.Environment (please complete the following information):
Additional context
These are the spots I've run into this so far:
lief.PE.Binary.get_exportlief.PE.Binary.get_section