Skip to content

Commit 9140aff

Browse files
committed
🐛 Fix python based search
1 parent 02bb93e commit 9140aff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

octoprint_file_check/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ def _search_through_file(self, path, pattern, incl_comments=False, regex=False):
337337
"implementation: {}".format(result.stderr.text.strip())
338338
)
339339

340-
return self._search_through_file_python(
341-
path, sanitized, compiled, incl_comments=incl_comments
342-
)
340+
return self._search_through_file_python(path, compiled)
343341

344342
except Exception:
345343
self._logger.exception(
@@ -349,10 +347,10 @@ def _search_through_file(self, path, pattern, incl_comments=False, regex=False):
349347

350348
return False
351349

352-
def _search_through_file_python(self, path, term, compiled, incl_comments=False):
350+
def _search_through_file_python(self, path, compiled):
353351
with open(path, encoding="utf8", errors="replace") as f:
354352
for line in f:
355-
if term in line and (incl_comments or compiled.match(line)):
353+
if compiled.search(line):
356354
return True
357355
return False
358356

0 commit comments

Comments
 (0)