# Path: praatio/utilities/constants.py
# INTERVAL_TIER: Final = "IntervalTier"
# POINT_TIER: Final = "TextTier"
# MIN_INTERVAL_LENGTH: Final = 0.00000001  # Arbitrary threshold
#     LONG_TEXTGRID: Final = "long_textgrid"
#     SHORT_TEXTGRID: Final = "short_textgrid"
#     JSON: Final = "json"
#     POINT: Final = "PointProcess"
#     PITCH: Final = "PitchTier"
#     DURATION: Final = "DurationTier"
#     STRICT: Final = "strict"
#     LAX: Final = "lax"
#     TRUNCATED: Final = "truncated"
#     SILENCE: Final = "silence"
#     WARNING: Final = "warning"
#     ERROR: Final = "error"
#     REPLACE: Final = "replace"
#     MERGE: Final = "merge"
#     ERROR: Final = "error"
#     STRETCH: Final = "stretch"
#     SPLIT: Final = "split"
#     NO_CHANGE: Final = "no_change"
#     ERROR: Final = "error"
#     TRUNCATE: Final = "truncate"
#     CATEGORICAL: Final = "categorical"
#     ERROR: Final = "error"
#     ERROR: Final = "error"
#     RENAME: Final = "rename"
# class Interval(namedtuple("Interval", ["start", "end", "label"])):
# class Point(namedtuple("Point", ["time", "label"])):
# class TextgridFormats:
# class DataPointTypes:
# class CropCollision:
# class ErrorReportingMode:
# class IntervalCollision:
# class WhitespaceCollision:
# class EraseCollision:
# class DuplicateNames:
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __eq__(self, other):
#     def __ne__(self, other):
# 
# Path: praatio/utilities/errors.py
# class PraatioException(Exception):
# class SafeZipException(PraatioException):
# class FileNotFound(PraatioException):
# class ParsingError(PraatioException):
# class ArgumentError(PraatioException):
# class UnexpectedError(PraatioException):
# class WrongOption(PraatioException):
# class TextgridException(PraatioException):
# class DuplicateTierName(TextgridException):
# class OutOfBounds(TextgridException):
# class CollisionError(TextgridException):
# class TimelessTextgridTierException(TextgridException):
# class TextgridStateAutoModified(TextgridException):
# class TextgridStateError(TextgridException):
# class TierNameExistsError(TextgridException):
# class IncompatibleTierError(TextgridException):
# class PraatExecutionFailed(PraatioException):
# class EndOfAudioData(PraatioException):
# class FindZeroCrossingError(PraatioException):
# class NormalizationException(PraatioException):
#     def __init__(self, fullPath: str):
#     def __str__(self):
#     def __init__(self, argumentName: str, givenValue: str, availableOptions: List[str]):
#     def __str__(self):
#     def __str__(self):
#     def __init__(self, tier):
#     def __str__(self):
#     def __init__(self, cmdList: List[str]):
#     def __str__(self):
#     def __init__(self, startTime: float, endTime: float):
#     def __str__(self):
#     def __str__(self):
# 
# Path: praatio/utilities/utils.py
# def reportNoop(_exception: Type[BaseException], _text: str) -> None:
# def reportException(exception: Type[BaseException], text: str) -> NoReturn:
# def reportWarning(_exception: Type[BaseException], text: str) -> None:
# def getErrorReporter(reportingMode: Literal["silence", "warning", "error"]):
# def checkIsUndershoot(time: float, referenceTime: float, errorReporter) -> bool:
# def checkIsOvershoot(time: float, referenceTime: float, errorReporter) -> bool:
# def validateOption(variableName, value, optionClass):
# def intervalOverlapCheck(
#     interval: Interval,
#     cmprInterval: Interval,
#     percentThreshold: float = 0,
#     timeThreshold: float = 0,
#     boundaryInclusive: bool = False,
# ) -> bool:
# def getIntervalsInInterval(
#     start: float,
#     end: float,
#     intervals: List[Interval],
#     mode: Literal["strict", "lax", "truncated"],
# ) -> List[Interval]:
# def escapeQuotes(text: str) -> str:
# def strToIntOrFloat(inputStr: str) -> float:
# def getValueAtTime(
#     timestamp: float,
#     sortedDataTupleList: List[Tuple[Any, ...]],
#     fuzzyMatching: bool = False,
#     startI: int = 0,
# ) -> Tuple[Tuple[Any, ...], int]:
# def getValuesInInterval(dataTupleList: List, start: float, end: float) -> List:
# def sign(x: float) -> int:
# def invertIntervalList(
#     inputList: List[Tuple[float, float]], minValue: float = None, maxValue: float = None
# ) -> List[Tuple[float, float]]:
# def makeDir(path: str) -> None:
# def findAll(txt: str, subStr: str) -> List[int]:
# def runPraatScript(
#     praatEXE: str, scriptFN: str, argList: List[Any], cwd: str = None
# ) -> None:
# def safeZip(listOfLists: List[list], enforceLength: bool) -> Iterator[Any]:
# def getWavDuration(wavFN: str) -> float:


import re
import copy
import math
from typing import (
    List,
    Optional,
    Type,
    TypeVar,
    Union,
)
from abc import ABC, abstractmethod
from typing_extensions import Literal
from praatio.utilities import constants
from praatio.utilities import errors
from praatio.utilities import utils
"""
The abstract class used by all textgrid tiers
"""




T = TypeVar("T", bound="TextgridTier")


class TextgridTier(ABC):

    tierType: str
    entryType: Union[Type[constants.Point], Type[constants.Interval]]

    def __init__(
        self,
        name: str,
        entryList: List,
        minT: float,
        maxT: float,
        errorMode: Literal["silence", "warning", "error"] = "warning",
    ):
        "A container that stores and operates over interval and point tiers"

# Path: praatio/utilities/constants.py
# INTERVAL_TIER: Final = "IntervalTier"
# POINT_TIER: Final = "TextTier"
# MIN_INTERVAL_LENGTH: Final = 0.00000001  # Arbitrary threshold
#     LONG_TEXTGRID: Final = "long_textgrid"
#     SHORT_TEXTGRID: Final = "short_textgrid"
#     JSON: Final = "json"
#     POINT: Final = "PointProcess"
#     PITCH: Final = "PitchTier"
#     DURATION: Final = "DurationTier"
#     STRICT: Final = "strict"
#     LAX: Final = "lax"
#     TRUNCATED: Final = "truncated"
#     SILENCE: Final = "silence"
#     WARNING: Final = "warning"
#     ERROR: Final = "error"
#     REPLACE: Final = "replace"
#     MERGE: Final = "merge"
#     ERROR: Final = "error"
#     STRETCH: Final = "stretch"
#     SPLIT: Final = "split"
#     NO_CHANGE: Final = "no_change"
#     ERROR: Final = "error"
#     TRUNCATE: Final = "truncate"
#     CATEGORICAL: Final = "categorical"
#     ERROR: Final = "error"
#     ERROR: Final = "error"
#     RENAME: Final = "rename"
# class Interval(namedtuple("Interval", ["start", "end", "label"])):
# class Point(namedtuple("Point", ["time", "label"])):
# class TextgridFormats:
# class DataPointTypes:
# class CropCollision:
# class ErrorReportingMode:
# class IntervalCollision:
# class WhitespaceCollision:
# class EraseCollision:
# class DuplicateNames:
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __eq__(self, other):
#     def __ne__(self, other):
# 
# Path: praatio/utilities/errors.py
# class PraatioException(Exception):
# class SafeZipException(PraatioException):
# class FileNotFound(PraatioException):
# class ParsingError(PraatioException):
# class ArgumentError(PraatioException):
# class UnexpectedError(PraatioException):
# class WrongOption(PraatioException):
# class TextgridException(PraatioException):
# class DuplicateTierName(TextgridException):
# class OutOfBounds(TextgridException):
# class CollisionError(TextgridException):
# class TimelessTextgridTierException(TextgridException):
# class TextgridStateAutoModified(TextgridException):
# class TextgridStateError(TextgridException):
# class TierNameExistsError(TextgridException):
# class IncompatibleTierError(TextgridException):
# class PraatExecutionFailed(PraatioException):
# class EndOfAudioData(PraatioException):
# class FindZeroCrossingError(PraatioException):
# class NormalizationException(PraatioException):
#     def __init__(self, fullPath: str):
#     def __str__(self):
#     def __init__(self, argumentName: str, givenValue: str, availableOptions: List[str]):
#     def __str__(self):
#     def __str__(self):
#     def __init__(self, tier):
#     def __str__(self):
#     def __init__(self, cmdList: List[str]):
#     def __str__(self):
#     def __init__(self, startTime: float, endTime: float):
#     def __str__(self):
#     def __str__(self):
# 
# Path: praatio/utilities/utils.py
# def reportNoop(_exception: Type[BaseException], _text: str) -> None:
# def reportException(exception: Type[BaseException], text: str) -> NoReturn:
# def reportWarning(_exception: Type[BaseException], text: str) -> None:
# def getErrorReporter(reportingMode: Literal["silence", "warning", "error"]):
# def checkIsUndershoot(time: float, referenceTime: float, errorReporter) -> bool:
# def checkIsOvershoot(time: float, referenceTime: float, errorReporter) -> bool:
# def validateOption(variableName, value, optionClass):
# def intervalOverlapCheck(
#     interval: Interval,
#     cmprInterval: Interval,
#     percentThreshold: float = 0,
#     timeThreshold: float = 0,
#     boundaryInclusive: bool = False,
# ) -> bool:
# def getIntervalsInInterval(
#     start: float,
#     end: float,
#     intervals: List[Interval],
#     mode: Literal["strict", "lax", "truncated"],
# ) -> List[Interval]:
# def escapeQuotes(text: str) -> str:
# def strToIntOrFloat(inputStr: str) -> float:
# def getValueAtTime(
#     timestamp: float,
#     sortedDataTupleList: List[Tuple[Any, ...]],
#     fuzzyMatching: bool = False,
#     startI: int = 0,
# ) -> Tuple[Tuple[Any, ...], int]:
# def getValuesInInterval(dataTupleList: List, start: float, end: float) -> List:
# def sign(x: float) -> int:
# def invertIntervalList(
#     inputList: List[Tuple[float, float]], minValue: float = None, maxValue: float = None
# ) -> List[Tuple[float, float]]:
# def makeDir(path: str) -> None:
# def findAll(txt: str, subStr: str) -> List[int]:
# def runPraatScript(
#     praatEXE: str, scriptFN: str, argList: List[Any], cwd: str = None
# ) -> None:
# def safeZip(listOfLists: List[list], enforceLength: bool) -> Iterator[Any]:
# def getWavDuration(wavFN: str) -> float:


# Path: praatio/data_classes/textgrid_tier.py
import re
import copy
import math
from typing import (
    List,
    Optional,
    Type,
    TypeVar,
    Union,
)
from abc import ABC, abstractmethod
from typing_extensions import Literal
from praatio.utilities import constants
from praatio.utilities import errors
from praatio.utilities import utils

"""
The abstract class used by all textgrid tiers
"""




T = TypeVar("T", bound="TextgridTier")


class TextgridTier(ABC):

    tierType: str
    entryType: Union[Type[constants.Point], Type[constants.Interval]]

    def __init__(
        self,
        name: str,
        entryList: List,
        minT: float,
        maxT: float,
        errorMode: Literal["silence", "warning", "error"] = "warning",
    ):
        "A container that stores and operates over interval and point tiers"

        utils.validateOption("errorMode", errorMode, constants.ErrorReportingMode)