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

Class Adapter

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

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

Source from the content-addressed store, hash-verified

40
41
42class 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
58def client_code(target: Target) -> None:

Callers 1

main.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected