Skip to content

Commit 2c2d9e5

Browse files
committed
Used kwargs for ResultSummary constructor
1 parent 11338b6 commit 2c2d9e5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

neo4j/v1/session.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,7 @@ def on_footer(self, metadata):
138138
""" Called on receipt of the result footer.
139139
"""
140140
self.complete = True
141-
self.summary = ResultSummary(self.statement, self.parameters,
142-
metadata.get("type"), metadata.get("stats"),
143-
metadata.get("plan"), metadata.get("profile"),
144-
metadata.get("notifications", []))
141+
self.summary = ResultSummary(self.statement, self.parameters, **metadata)
145142
if self.bench_test:
146143
self.bench_test.end_recv = perf_counter()
147144

@@ -195,18 +192,18 @@ class ResultSummary(object):
195192
#: Unlike failures or errors, notifications do not affect the execution of a statement.
196193
notifications = None
197194

198-
def __init__(self, statement, parameters, statement_type, statistics, plan, profile, notifications):
195+
def __init__(self, statement, parameters, **metadata):
199196
self.statement = statement
200197
self.parameters = parameters
201-
self.statement_type = statement_type
202-
self.statistics = StatementStatistics(statistics or {})
203-
if plan is not None:
204-
self.plan = make_plan(plan)
205-
if profile is not None:
206-
self.profile = make_plan(profile)
198+
self.statement_type = metadata.get("type")
199+
self.statistics = StatementStatistics(metadata.get("stats", {}))
200+
if "plan" in metadata:
201+
self.plan = make_plan(metadata["plan"])
202+
if "profile" in metadata:
203+
self.profile = make_plan(metadata["profile"])
207204
self.plan = self.profile
208205
self.notifications = []
209-
for notification in notifications:
206+
for notification in metadata.get("notifications", []):
210207
position = notification.get("position")
211208
if position is not None:
212209
position = Position(position["offset"], position["line"], position["column"])

0 commit comments

Comments
 (0)