narupatools.override¶
Provides simple decorator for marking methods as overrides.
Functions
Check if the given method or property is marked using the @override annotation. |
|
Mark a method or property as overriding a method in a base class. |
-
narupatools.override.marked_as_override(f: Any) → bool¶ Check if the given method or property is marked using the @override annotation.
This merely checks if the argument has been annotated with @override. It does not actually check if the method or property overrides something in the base class.
-
narupatools.override.override(source_method: Any, /) → Any¶ Mark a method or property as overriding a method in a base class.
This is a decorator that can be applied to methods and properties:
class MyBaseClass: def my_method(): ... class MyClass(MyBaseClass): @override(MyBaseClass.my_method) def my_method(): ...
This does not perform any checks to ensure that there is actually a method to override. This merely annotates the method or property.
To check if a method is overriden, use
marked_as_override.