Skip to content

Commit fab7da7

Browse files
committed
Try and validate MAC codes when code is alphabetical characters.
1 parent 233dccb commit fab7da7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pyard/ard.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#
2424
import functools
2525
import re
26+
import sqlite3
2627
import sys
2728
from typing import Iterable, List
2829

@@ -472,7 +473,11 @@ def is_mac(self, allele: str) -> bool:
472473
"""
473474
if ":" in allele:
474475
code = allele.split(":")[1]
475-
return db.is_valid_mac_code(self.db_connection, code)
476+
try:
477+
if code.isalpha():
478+
return db.is_valid_mac_code(self.db_connection, code)
479+
except sqlite3.OperationalError as e:
480+
print("Error: ", e)
476481
return False
477482

478483
def is_v2(self, allele: str) -> bool:

0 commit comments

Comments
 (0)