Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: Type annotations for all functions/methods (#854)
This PR uses 4 ways to disable checks by mypy: * 74x `typing.cast`: Has no effect on the running code, just on mypy * 161x `typing.Any`: If we tell mypy that a parameter / variable can have any possible type, mypy cannot check anything. * 82x `# type: ignore` * 36x `assert foo is not None`: This can have an effect in running code and should only be used if mypy fails to understand that foo is guaranteed not to be None Those are especially necessary for `.getObject()` calls. If possible, they should be removed. `cast` is preferrable over `# type: ignore` as it gives more information. `assert` should only be used in rare cases. Uncertainties: * `ByteStringObject` vs `TextStringObject`, e.g. for `_authenticateUserPassword` and the functions in `_security` * `ContentStream`: I have no clue what type the stream argument should have Details: * utils.ConvertFunctionsToVirtualList -> _VirtualList * Typeguard was used to verify that the annotated types are correct. There are still some cases where Typeguard fails, but the reason might be that Typeguard does not consider inheritance. * BUG: Potential None attribute access in _reader.getDestinationPageNumber * BUG: _security._alg33_1 : Adding str and bytes argument * STY: Fix typo 'test_get_destination_age_number' * BUG: Field.additionalActions was missing a return statement
- Loading branch information