pyppin.base¶
Basic language extensions.
Modules
Caching decorators for functions and methods |
|
A way to simplify writing Python decorators and improve their syntax. |
|
A function to import a Python file from its pathname. |
|
An instance method decorator to make initializers execute once, on demand. |
|
Make it easy to look up subclasses of an abstract class by name. |
Functions
|
Assert that a value is not None, to make mypy happy. |
- pyppin.base.assert_not_none(val: Optional[_T]) _T [source]¶
Assert that a value is not None, to make mypy happy.
This is useful when a function technically returns an Optional[Foo], but you know for other reasons that it’s never None. Wrapping the result in this assertion makes that statement explicit and thus makes mypy happy as well when you use its result as a Foo.