Skip to content

Commit

Permalink
Move AugurError from utils to new file errors.py
Browse files Browse the repository at this point in the history
This reduces complexity and chance of circular imports in utils.
  • Loading branch information
victorlin committed May 24, 2022
1 parent 1bc0dde commit 3ddbd46
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion augur/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from textwrap import dedent
from types import SimpleNamespace

from .errors import AugurError
from .io import print_err
from .utils import AugurError, first_line
from .utils import first_line

recursion_limit = os.environ.get("AUGUR_RECURSION_LIMIT")
if recursion_limit:
Expand Down
2 changes: 2 additions & 0 deletions augur/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class AugurError(Exception):
pass
3 changes: 2 additions & 1 deletion augur/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
from typing import Collection

from .dates import numeric_date, numeric_date_type, SUPPORTED_DATE_HELP_TEXT, is_date_ambiguous, get_numerical_dates
from .errors import AugurError
from .index import index_sequences, index_vcf
from .io import open_file, read_metadata, read_sequences, write_sequences
from .utils import AugurError, is_vcf as filename_is_vcf, read_vcf, read_strains, run_shell_command, shquote
from .utils import is_vcf as filename_is_vcf, read_vcf, read_strains, run_shell_command, shquote

comment_char = '#'

Expand Down
2 changes: 1 addition & 1 deletion augur/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from .io import open_file, read_sequences, write_sequences
from .dates import get_numerical_date_from_value
from .utils import AugurError
from .errors import AugurError

forbidden_characters = str.maketrans(
{' ': None,
Expand Down
2 changes: 1 addition & 1 deletion augur/util_support/node_data_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from augur.__version__ import __version__
from augur.__version__ import is_augur_version_compatible
from augur.utils import AugurError
from augur.errors import AugurError
from augur.validate import validate_json, ValidateError, load_json_schema


Expand Down
4 changes: 0 additions & 4 deletions augur/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
from augur.io import open_file


class AugurError(Exception):
pass


def is_vcf(filename):
"""Convenience method to check if a file is a vcf file.
Expand Down
2 changes: 1 addition & 1 deletion tests/util_support/test_node_data_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json

from augur.__version__ import __version__
from augur.utils import AugurError
from augur.errors import AugurError
from augur.util_support.node_data_file import NodeDataFile

import pytest
Expand Down

0 comments on commit 3ddbd46

Please sign in to comment.