Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from abc import ABC, abstractmethod
- class IField(ABC):
- """
- Filter field abstract class
- """
- name: str
- @abstractmethod
- def val(self, event: Event) -> Any:
- """ Abastract value obtainer """
- class Pipe(IField):
- """
- Basic field pipe class
- """
- def __init__(self, field: F):
- self.field = field
- self.name = field.name
- def val(self, event: Event):
- raise NotImplementedError("Cannot use Pipe superclass")
- """
- >>>>>>> COOL HERE:
- IDE marks next class with a warning if val() method is not implemented, although it's formally implemented by Pipe.
- But if I change Pipe's .val() body from raise NotImplementedError to smth like return 1, warning disappears.
- So IDE treats method's body raise NotImplementedError(...) as enough to satisfy interface's requirements for current
- class, but not enough to satisfy them in child classes. It looks wise and well-thought.
- """
- class Int(Pipe):
- """
- ....................
- """
Advertisement
Add Comment
Please, Sign In to add comment