EN: The Adapter makes the Adaptee's interface compatible with the Target's interface via composition. RU: Адаптер делает интерфейс Адаптируемого класса совместимым с целевым интерфейсом благодаря агрегации.
| 40 | |
| 41 | |
| 42 | class Adapter(Target): |
| 43 | """ |
| 44 | EN: The Adapter makes the Adaptee's interface compatible with the Target's |
| 45 | interface via composition. |
| 46 | |
| 47 | RU: Адаптер делает интерфейс Адаптируемого класса совместимым с целевым |
| 48 | интерфейсом благодаря агрегации. |
| 49 | """ |
| 50 | |
| 51 | def __init__(self, adaptee: Adaptee) -> None: |
| 52 | self.adaptee = adaptee |
| 53 | |
| 54 | def request(self) -> str: |
| 55 | return f"Adapter: (TRANSLATED) {self.adaptee.specific_request()[::-1]}" |
| 56 | |
| 57 | |
| 58 | def client_code(target: Target) -> None: |