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

Function client_code

src/Proxy/Conceptual/main.py:89–109  ·  view source on GitHub ↗

EN: The client code is supposed to work with all objects (both subjects and proxies) via the Subject interface in order to support both real subjects and proxies. In real life, however, clients mostly work with their real subjects directly. In this case, to implement the pattern mor

(subject: Subject)

Source from the content-addressed store, hash-verified

87
88
89def client_code(subject: Subject) -> None:
90 """
91 EN: The client code is supposed to work with all objects (both subjects and
92 proxies) via the Subject interface in order to support both real subjects
93 and proxies. In real life, however, clients mostly work with their real
94 subjects directly. In this case, to implement the pattern more easily, you
95 can extend your proxy from the real subject's class.
96
97 RU: Клиентский код должен работать со всеми объектами (как с реальными, так
98 и заместителями) через интерфейс Субъекта, чтобы поддерживать как реальные
99 субъекты, так и заместителей. В реальной жизни, однако, клиенты в основном
100 работают с реальными субъектами напрямую. В этом случае, для более простой
101 реализации паттерна, можно расширить заместителя из класса реального
102 субъекта.
103 """
104
105 # ...
106
107 subject.request()
108
109 # ...
110
111
112if __name__ == "__main__":

Callers 1

main.pyFile · 0.70

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected