Skip to content

Commit

Permalink
Fast evaluation if keyword doesn't contain '__'
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Wayper <paulway@redhat.com>
  • Loading branch information
PaulWay committed Nov 22, 2022
1 parent cc375d9 commit 9863bc4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion insights/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,9 @@ def key_match(row, key, value):
my_row[my_key.replace(' ', '_').replace('-', '_')] = val
setattr(row, KEYS_TRANSLATED, True)
matcher_fn = matchers['default']
if '__' in key:
if '__' not in key:
return key in my_row and my_row[key] == value # Faster
else:
key, matcher = key.split('__', 1)
if matcher not in matchers:
# put key back the way we found it, matcher fn unchanged
Expand Down

0 comments on commit 9863bc4

Please sign in to comment.