Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __add__(self, other):
if self._s is not None:
raise ValueError('Key combo is already terminated')
if isinstance(other, KeyCombo):
combo = KeyCombo(*[*self.modifiers, *other.modifiers])
if other._s:
combo = combo + other._s
return combo
if isinstance(other, KeyModifier):
self.modifiers.append(other)
elif isinstance(other, Key) or isinstance(other, str):
self._s = str(other)
return self
else:
raise TypeError(f"unsupported operand type(s) for +: '{self.__class__.__name__}' and '{type(other)}'")
def __add__(self, other):
if isinstance(other, KeyModifier):
return KeyCombo(self, other)
elif isinstance(other, KeyCombo):
return other + self
return self.symbol + str(other)
def __add__(self, other):
if isinstance(other, KeyModifier):
return KeyCombo(self, other)
elif isinstance(other, KeyCombo):
return other + self
return self.symbol + str(other)