From 4db07ddbd49fc957ec28b287625bdd72a0f4359e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 10 Feb 2022 16:27:19 -0300 Subject: [PATCH] Switch basic Award detection to a regex for speed --- biostools/analyzers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/biostools/analyzers.py b/biostools/analyzers.py index 55dfb98..b5238da 100644 --- a/biostools/analyzers.py +++ b/biostools/analyzers.py @@ -824,6 +824,7 @@ class AwardAnalyzer(Analyzer): def __init__(self, *args, **kwargs): super().__init__('Award', *args, **kwargs) + self._award_pattern = re.compile(b'''Award (?:Software Inc\\.|Decompression Bios)''') self._early_modular_prefix_pattern = re.compile('''(.+) Modular BIOS ''') self._gigabyte_bif_pattern = re.compile(b'''\$BIF[\\x00-\\xFF]{5}([\\x20-\\x7E]+)\\x00.([\\x20-\\x7E]+)\\x00''') self._gigabyte_eval_pattern = re.compile('''\([a-zA-Z0-9]{1,8}\) EVALUATION ROM - NOT FOR SALE$''') @@ -840,7 +841,7 @@ class AwardAnalyzer(Analyzer): ]) def can_handle(self, file_data, header_data): - if b'Award Software Inc.' not in file_data and b'Award Decompression Bios' not in file_data: + if not self._award_pattern.search(file_data): return False # Skip Windows 95 INF updates and Award VBIOS.