Skip to content

Commit

Permalink
fixes #1005: Missing attribute code results in AttributeError (#1006)
Browse files Browse the repository at this point in the history
* fix #1005: Missing attribute `code` results in AttributeError

To prevent unconditional acess, this change checks if the `code` attribute actually exists
and falls back to the key description.

---------

Co-authored-by: xs5871 <[email protected]>
  • Loading branch information
halfdane and xs5871 authored Jul 19, 2024
1 parent 9912bca commit d6cbb8c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions kmk/modules/combos.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ def __init__(
self._match_coord = match_coord

def __repr__(self):
if self._match_coord:
return f'{self.__class__.__name__}({list(self.match)})'
else:
return f'{self.__class__.__name__}({[k.code for k in self.match]})'
return f'{self.__class__.__name__}({list(self.match)})'

def matches(self, key: Key, int_coord: int):
raise NotImplementedError
Expand Down

0 comments on commit d6cbb8c

Please sign in to comment.