# Path: alembic/util/compat.py
# class EncodedIO(io.TextIOWrapper):
#     def close(self) -> None:
# def importlib_metadata_get(group: str) -> Tuple[EntryPoint, ...]:
# def formatannotation_fwdref(annotation, base_module=None):
# 
# Path: alembic/util/compat.py
# class EncodedIO(io.TextIOWrapper):
#     def close(self) -> None:
# def importlib_metadata_get(group: str) -> Tuple[EntryPoint, ...]:
# def formatannotation_fwdref(annotation, base_module=None):


import collections
import textwrap
import uuid
import warnings
from collections.abc import Iterable
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import overload
from typing import Sequence
from typing import Tuple
from typing import TypeVar
from typing import Union
from sqlalchemy.util import asbool  # noqa
from sqlalchemy.util import immutabledict  # noqa
from sqlalchemy.util import memoized_property  # noqa
from sqlalchemy.util import to_list  # noqa
from sqlalchemy.util import unique_list  # noqa
from .compat import inspect_getfullargspec
from .compat import string_types
            targets = obj.__mro__
        else:
            targets = type(obj).__mro__

        for spcls in targets:
            if qualifier != "default" and (spcls, qualifier) in self._registry:
                return self._fn_or_list(self._registry[(spcls, qualifier)])
            elif (spcls, "default") in self._registry:
                return self._fn_or_list(self._registry[(spcls, "default")])
        else:
            raise ValueError("no dispatch function for object: %s" % obj)

    def _fn_or_list(
        self, fn_or_list: Union[List[Callable], Callable]
    ) -> Callable:
        if self.uselist:

            def go(*arg, **kw):
                for fn in fn_or_list:
                    fn(*arg, **kw)

            return go
        else:
            return fn_or_list  # type: ignore

    def branch(self) -> "Dispatcher":
        """Return a copy of this dispatcher that is independently
        writable."""

        d = Dispatcher()

# Path: alembic/util/compat.py
# class EncodedIO(io.TextIOWrapper):
#     def close(self) -> None:
# def importlib_metadata_get(group: str) -> Tuple[EntryPoint, ...]:
# def formatannotation_fwdref(annotation, base_module=None):
# 
# Path: alembic/util/compat.py
# class EncodedIO(io.TextIOWrapper):
#     def close(self) -> None:
# def importlib_metadata_get(group: str) -> Tuple[EntryPoint, ...]:
# def formatannotation_fwdref(annotation, base_module=None):


# Path: alembic/util/langhelpers.py
import collections
import textwrap
import uuid
import warnings
from collections.abc import Iterable
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import overload
from typing import Sequence
from typing import Tuple
from typing import TypeVar
from typing import Union
from sqlalchemy.util import asbool  # noqa
from sqlalchemy.util import immutabledict  # noqa
from sqlalchemy.util import memoized_property  # noqa
from sqlalchemy.util import to_list  # noqa
from sqlalchemy.util import unique_list  # noqa
from .compat import inspect_getfullargspec
from .compat import string_types

            targets = obj.__mro__
        else:
            targets = type(obj).__mro__

        for spcls in targets:
            if qualifier != "default" and (spcls, qualifier) in self._registry:
                return self._fn_or_list(self._registry[(spcls, qualifier)])
            elif (spcls, "default") in self._registry:
                return self._fn_or_list(self._registry[(spcls, "default")])
        else:
            raise ValueError("no dispatch function for object: %s" % obj)

    def _fn_or_list(
        self, fn_or_list: Union[List[Callable], Callable]
    ) -> Callable:
        if self.uselist:

            def go(*arg, **kw):
                for fn in fn_or_list:
                    fn(*arg, **kw)

            return go
        else:
            return fn_or_list  # type: ignore

    def branch(self) -> "Dispatcher":
        """Return a copy of this dispatcher that is independently
        writable."""

        d = Dispatcher()

        if self.uselist: