# Path: schema_salad/exceptions.py
# class ValidationException(SchemaSaladException):
#     """Indicates error with document against the provided schema."""
# 
# Path: schema_salad/utils.py
# def add_dictlist(di, key, val):  # type: (Dict[Any, Any], Any, Any) -> None
# def aslist(thing):  # type: (Any) -> MutableSequence[Any]
# def flatten(thing, ltypes=(list, tuple)):
# def onWindows():
# def convert_to_dict(j4):  # type: (Any) -> Any
# def json_dump(
#     obj,  # type: Any
#     fp,  # type: IO[str]
#     **kwargs  # type: Any
# ):  # type: (...) -> None
# def json_dumps(
#     obj,  # type: Any
#     **kwargs  # type: Any
# ):  # type: (...) -> str
# def stdout() -> BufferedWriter:
#     def construct_yaml_timestamp(self: Any, node: Any, values: Any = None) -> Any:
# def yaml_no_ts() -> YAML:
# class _RoundTripNoTimeStampConstructor(RoundTripConstructor):


import logging
import os
import re
import sys
import urllib
import requests
from typing import List, Optional
from .exceptions import ValidationException
from .utils import CacheType
    def check_exists(self, url: str) -> bool:
        if url in self.cache:
            return True

        split = urllib.parse.urlsplit(url)
        scheme, path = split.scheme, split.path

        if scheme in ["http", "https"]:
            if self.session is None:
                raise ValidationException(f"Can't check {scheme} URL, session is None")
            try:
                resp = self.session.head(url, allow_redirects=True)
                resp.raise_for_status()
            except Exception:
                return False
            self.cache[url] = True
            return True
        if scheme == "file":
            return os.path.exists(urllib.request.url2pathname(str(path)))
        if scheme == "mailto":
            return True
        raise ValidationException(f"Unsupported scheme '{scheme}' in url: {url}")

    def urljoin(self, base_url: str, url: str) -> str:
        if url.startswith("_:"):
            return url

        basesplit = urllib.parse.urlsplit(base_url)
        split = urllib.parse.urlsplit(url)
        if basesplit.scheme and basesplit.scheme != "file" and split.scheme == "file":

# Path: schema_salad/exceptions.py
# class ValidationException(SchemaSaladException):
#     """Indicates error with document against the provided schema."""
# 
# Path: schema_salad/utils.py
# def add_dictlist(di, key, val):  # type: (Dict[Any, Any], Any, Any) -> None
# def aslist(thing):  # type: (Any) -> MutableSequence[Any]
# def flatten(thing, ltypes=(list, tuple)):
# def onWindows():
# def convert_to_dict(j4):  # type: (Any) -> Any
# def json_dump(
#     obj,  # type: Any
#     fp,  # type: IO[str]
#     **kwargs  # type: Any
# ):  # type: (...) -> None
# def json_dumps(
#     obj,  # type: Any
#     **kwargs  # type: Any
# ):  # type: (...) -> str
# def stdout() -> BufferedWriter:
#     def construct_yaml_timestamp(self: Any, node: Any, values: Any = None) -> Any:
# def yaml_no_ts() -> YAML:
# class _RoundTripNoTimeStampConstructor(RoundTripConstructor):


# Path: schema_salad/fetcher.py
import logging
import os
import re
import sys
import urllib
import requests
from typing import List, Optional
from .exceptions import ValidationException
from .utils import CacheType

    def check_exists(self, url: str) -> bool:
        if url in self.cache:
            return True

        split = urllib.parse.urlsplit(url)
        scheme, path = split.scheme, split.path

        if scheme in ["http", "https"]:
            if self.session is None:
                raise ValidationException(f"Can't check {scheme} URL, session is None")
            try:
                resp = self.session.head(url, allow_redirects=True)
                resp.raise_for_status()
            except Exception:
                return False
            self.cache[url] = True
            return True
        if scheme == "file":
            return os.path.exists(urllib.request.url2pathname(str(path)))
        if scheme == "mailto":
            return True
        raise ValidationException(f"Unsupported scheme '{scheme}' in url: {url}")

    def urljoin(self, base_url: str, url: str) -> str:
        if url.startswith("_:"):
            return url

        basesplit = urllib.parse.urlsplit(base_url)
        split = urllib.parse.urlsplit(url)
        if basesplit.scheme and basesplit.scheme != "file" and split.scheme == "file":

            raise ValidationException(