MCPcopy Create free account
hub / github.com/RefactoringGuru/design-patterns-python / Adapter

Class Adapter

src/Adapter/Conceptual/class/main.py:42–52  ·  view source on GitHub ↗

EN: The Adapter makes the Adaptee's interface compatible with the Target's interface via multiple inheritance. RU: Адаптер делает интерфейс Адаптируемого класса совместимым с целевым интерфейсом благодаря множественному наследованию.

Source from the content-addressed store, hash-verified

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

Callers 1

main.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected