Fixed some type annotations and reformatted some pydocs.