Skip to content

Commit

Permalink
stable generating of reverse packet_fields map.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiri Hemzal authored and Johan Bloemberg committed May 7, 2019
1 parent 46759ce commit 6b659cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rflink/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def packet_events(packet: dict) -> Generator:
... }))
>>> assert {'id': 'newkaku_000001_01', 'command': 'on'} in y
"""
field_abbrev = {v: k for k, v in PACKET_FIELDS.items()}
field_abbrev = {v: k for k, v in sorted(PACKET_FIELDS.items(), key=lambda x: (x[1], x[0]), reverse=True)}

packet_id = serialize_packet_id(packet)
events = {f: v for f, v in packet.items() if f in field_abbrev}
Expand Down

0 comments on commit 6b659cc

Please sign in to comment.