mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-23 20:15:57 +08:00
Fix: Remove empty selector in filter
This commit is contained in:
@@ -25,7 +25,7 @@ class Filter:
|
|||||||
self.filter = [self.parse_filter(f) for f in self.filter_raw]
|
self.filter = [self.parse_filter(f) for f in self.filter_raw]
|
||||||
|
|
||||||
def is_preset(self, filter):
|
def is_preset(self, filter):
|
||||||
return filter in self.preset
|
return len(filter) and filter in self.preset
|
||||||
|
|
||||||
def apply(self, objs, func=None):
|
def apply(self, objs, func=None):
|
||||||
"""
|
"""
|
||||||
@@ -96,7 +96,7 @@ class Filter:
|
|||||||
if result and len(string) and result.span()[1]:
|
if result and len(string) and result.span()[1]:
|
||||||
return [result.group(index + 1) for index, attr in enumerate(self.attr)]
|
return [result.group(index + 1) for index, attr in enumerate(self.attr)]
|
||||||
else:
|
else:
|
||||||
logger.warning(f'Invalid filter: {string}')
|
logger.warning(f'Invalid filter: "{string}". This selector does not match the regex, nor a preset.')
|
||||||
# Invalid filter will be ignored.
|
# Invalid filter will be ignored.
|
||||||
# Return strange things and make it impossible to match
|
# Return strange things and make it impossible to match
|
||||||
return ['1nVa1d'] + [None] * (len(self.attr) - 1)
|
return ['1nVa1d'] + [None] * (len(self.attr) - 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user