diff options
-rw-r--r-- | scripts/qc.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qc.py b/scripts/qc.py index de01bb7..2057cd6 100644 --- a/scripts/qc.py +++ b/scripts/qc.py @@ -2,10 +2,9 @@ import os import sys import argparse +import mimetypes from typing import Union, Callable -import magic - from quality_control.utils import make_progress_calculator from quality_control.errors import InvalidValue, DuplicateHeading from quality_control.parsing import ( @@ -15,9 +14,10 @@ from quality_control.parsing import ( collect_errors) -def is_file_mime(filepath, mimetype): +def is_file_mime(filepath:str, mimetype:str) -> bool: """Check that `filepath` has a mimetype of `mimetype` or `text/plain`""" - return magic.from_file(filepath, mime=True) in ("text/plain", mimetype) + the_type = mimetypes.guess_type(filepath)[0] + return the_type in ("text/plain", mimetype) def cli_argument_parser(): """Create the parser for the CLI arguments""" |