From 57eb9829bb1a8f09799c88dd17111befcd506216 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 7 Apr 2020 09:47:50 -0400 Subject: [PATCH] bt2: _EventConst.__getitem__(): use a single temporary variable Signed-off-by: Philippe Proulx Change-Id: I241565ca7414952cd667d2912235231ef15ad314 Reviewed-on: https://review.lttng.org/c/babeltrace/+/3351 Tested-by: jenkins --- src/bindings/python/bt2/bt2/event.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bindings/python/bt2/bt2/event.py b/src/bindings/python/bt2/bt2/event.py index 6a6c1185..e18f12cf 100644 --- a/src/bindings/python/bt2/bt2/event.py +++ b/src/bindings/python/bt2/bt2/event.py @@ -108,26 +108,26 @@ class _EventConst(object._UniqueObject): def __getitem__(self, key): utils._check_str(key) - payload_field = self.payload_field + root_field = self.payload_field - if payload_field is not None and key in payload_field: - return payload_field[key] + if root_field is not None and key in root_field: + return root_field[key] - specific_context_field = self.specific_context_field + root_field = self.specific_context_field - if specific_context_field is not None and key in specific_context_field: - return specific_context_field[key] + if root_field is not None and key in root_field: + return root_field[key] - common_context_field = self.common_context_field + root_field = self.common_context_field - if common_context_field is not None and key in common_context_field: - return common_context_field[key] + if root_field is not None and key in root_field: + return root_field[key] if self.packet: - packet_context_field = self.packet.context_field + root_field = self.packet.context_field - if packet_context_field is not None and key in packet_context_field: - return packet_context_field[key] + if root_field is not None and key in root_field: + return root_field[key] raise KeyError(key) -- 2.34.1