MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //proc/thread-self/root/lib/python3.12/site-packages/jsonschema_specifications/_core.py
"""
Load all the JSON Schema specification's official schemas.
"""

import json

try:
    from importlib.resources import files
except ImportError:
    from importlib_resources import files  # type: ignore

from referencing import Resource


def _schemas():
    """
    All schemas we ship.
    """
    # importlib.resources.abc.Traversal doesn't have nice ways to do this that
    # I'm aware of...
    #
    # It can't recurse arbitrarily, e.g. no ``.glob()``.
    #
    # So this takes some liberties given the real layout of what we ship
    # (only 2 levels of nesting, no directories within the second level).

    for version in files(__package__).joinpath("schemas").iterdir():
        for child in version.iterdir():
            children = [child] if child.is_file() else child.iterdir()
            for path in children:
                contents = json.loads(path.read_text(encoding="utf-8"))
                yield Resource.from_contents(contents)