Skip to content

Commit f28b634

Browse files
committed
simplify init code
1 parent 9f2608c commit f28b634

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

elasticsearch/client/__init__.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ def __init__(self, hosts=None, transport_class=Transport, **kwargs):
173173

174174
# namespaced clients for compatibility with API names
175175
# use weakref to make GC's work a little easier
176-
self.indices = IndicesClient(weakref.proxy(self))
177-
self.ingest = IngestClient(weakref.proxy(self))
178-
self.cluster = ClusterClient(weakref.proxy(self))
179-
self.cat = CatClient(weakref.proxy(self))
180-
self.nodes = NodesClient(weakref.proxy(self))
181-
self.snapshot = SnapshotClient(weakref.proxy(self))
182-
self.tasks = TasksClient(weakref.proxy(self))
176+
client = weakref.proxy(self)
177+
self.indices = IndicesClient(client)
178+
self.ingest = IngestClient(client)
179+
self.cluster = ClusterClient(client)
180+
self.cat = CatClient(client)
181+
self.nodes = NodesClient(client)
182+
self.snapshot = SnapshotClient(client)
183+
self.tasks = TasksClient(client)
183184

184185
def __repr__(self):
185186
try:

0 commit comments

Comments
 (0)