qmk find
: Fix handling of keys with dots in filter functions (#24393)
This commit is contained in:
parent
ae4ab5ed31
commit
0b3ece1189
2 changed files with 71 additions and 4 deletions
|
@ -74,28 +74,30 @@ class Exists(FilterFunction):
|
|||
func_name = "exists"
|
||||
|
||||
def apply(self, target_info: KeyboardKeymapDesc) -> bool:
|
||||
return self.key in target_info.data
|
||||
return self.key in target_info.dotty
|
||||
|
||||
|
||||
class Absent(FilterFunction):
|
||||
func_name = "absent"
|
||||
|
||||
def apply(self, target_info: KeyboardKeymapDesc) -> bool:
|
||||
return self.key not in target_info.data
|
||||
return self.key not in target_info.dotty
|
||||
|
||||
|
||||
class Length(FilterFunction):
|
||||
func_name = "length"
|
||||
|
||||
def apply(self, target_info: KeyboardKeymapDesc) -> bool:
|
||||
return (self.key in target_info.data and len(target_info.data[self.key]) == int(self.value))
|
||||
info_dotty = target_info.dotty
|
||||
return (self.key in info_dotty and len(info_dotty[self.key]) == int(self.value))
|
||||
|
||||
|
||||
class Contains(FilterFunction):
|
||||
func_name = "contains"
|
||||
|
||||
def apply(self, target_info: KeyboardKeymapDesc) -> bool:
|
||||
return (self.key in target_info.data and self.value in target_info.data[self.key])
|
||||
info_dotty = target_info.dotty
|
||||
return (self.key in info_dotty and self.value in info_dotty[self.key])
|
||||
|
||||
|
||||
def _get_filter_class(func_name: str, key: str, value: str) -> Optional[FilterFunction]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue