diff --git a/WDL/Error.py b/WDL/Error.py index e45b0cf5..091efae7 100644 --- a/WDL/Error.py +++ b/WDL/Error.py @@ -1,12 +1,43 @@ # pyre-strict -from typing import List, Optional, Union, Iterable, TypeVar, Generator, Callable, Any, Dict +from typing import ( + List, + Optional, + Union, + Iterable, + TypeVar, + Generator, + Callable, + Any, + Dict, + NamedTuple, +) from functools import total_ordering from contextlib import contextmanager -from ._error_util import SourcePosition from . import Type +class SourcePosition( + NamedTuple( + "SourcePosition", + [ + ("uri", str), + ("abspath", str), + ("line", int), + ("column", int), + ("end_line", int), + ("end_column", int), + ], + ) +): + """ + Source position attached to AST nodes and exceptions; NamedTuple of ``uri`` the filename/URI + passed to :func:`WDL.load` or a WDL import statement, which may be relative; ``abspath`` the + absolute filename/URI; and one-based int positions ``line`` ``end_line`` ``column`` + ``end_column`` + """ + + class SyntaxError(Exception): """Failure to lex/parse a WDL document""" diff --git a/WDL/_error_util.py b/WDL/_error_util.py deleted file mode 100644 index d8e7b32f..00000000 --- a/WDL/_error_util.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import NamedTuple - - -class SourcePosition( - NamedTuple( - "SourcePosition", - [ - ("uri", str), - ("abspath", str), - ("line", int), - ("column", int), - ("end_line", int), - ("end_column", int), - ], - ) -): - """ - Source position attached to AST nodes and exceptions; NamedTuple of ``uri`` the filename/URI - passed to :func:`WDL.load` or a WDL import statement, which may be relative; ``abspath`` the - absolute filename/URI; and one-based int positions ``line`` ``end_line`` ``column`` - ``end_column`` - """