@@ -143,22 +143,30 @@ def should_include_device(device):
143
143
]
144
144
145
145
# OS filtering
146
- if INCLUDE_OS and INCLUDE_OS != "" :
147
- os_patterns = [p .strip () for p in INCLUDE_OS .split ("," )]
146
+ if INCLUDE_OS and INCLUDE_OS .strip () != "" :
147
+ os_patterns = [p .strip () for p in INCLUDE_OS .split ("," ) if p .strip ()]
148
+ if not os_patterns : # Skip if no valid patterns after cleaning
149
+ return True
148
150
if not any (fnmatch .fnmatch (device ["os" ], pattern ) for pattern in os_patterns ):
149
151
return False
150
- elif EXCLUDE_OS and EXCLUDE_OS != "" :
151
- os_patterns = [p .strip () for p in EXCLUDE_OS .split ("," )]
152
+ elif EXCLUDE_OS and EXCLUDE_OS .strip () != "" :
153
+ os_patterns = [p .strip () for p in EXCLUDE_OS .split ("," ) if p .strip ()]
154
+ if not os_patterns : # Skip if no valid patterns after cleaning
155
+ return True
152
156
if any (fnmatch .fnmatch (device ["os" ], pattern ) for pattern in os_patterns ):
153
157
return False
154
158
155
159
# Identifier filtering
156
- if INCLUDE_IDENTIFIER and INCLUDE_IDENTIFIER != "" :
157
- identifier_patterns = [p .strip ().lower () for p in INCLUDE_IDENTIFIER .split ("," )]
160
+ if INCLUDE_IDENTIFIER and INCLUDE_IDENTIFIER .strip () != "" :
161
+ identifier_patterns = [p .strip ().lower () for p in INCLUDE_IDENTIFIER .split ("," ) if p .strip ()]
162
+ if not identifier_patterns : # Skip if no valid patterns after cleaning
163
+ return True
158
164
if not any (any (fnmatch .fnmatch (identifier , pattern ) for pattern in identifier_patterns ) for identifier in identifiers ):
159
165
return False
160
- elif EXCLUDE_IDENTIFIER and EXCLUDE_IDENTIFIER != "" :
161
- identifier_patterns = [p .strip ().lower () for p in EXCLUDE_IDENTIFIER .split ("," )]
166
+ elif EXCLUDE_IDENTIFIER and EXCLUDE_IDENTIFIER .strip () != "" :
167
+ identifier_patterns = [p .strip ().lower () for p in EXCLUDE_IDENTIFIER .split ("," ) if p .strip ()]
168
+ if not identifier_patterns : # Skip if no valid patterns after cleaning
169
+ return True
162
170
if any (any (fnmatch .fnmatch (identifier , pattern ) for pattern in identifier_patterns ) for identifier in identifiers ):
163
171
return False
164
172
0 commit comments