File: integration.py

package info (click to toggle)
asdf-astropy 0.3.0%2Bgithub-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 556 kB
  • sloc: python: 3,703; makefile: 109
file content (47 lines) | stat: -rw-r--r-- 1,224 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys

from asdf.resource import DirectoryResourceMapping

if sys.version_info < (3, 9):
    import importlib_resources
else:
    import importlib.resources as importlib_resources


def get_resource_mappings():
    """
    Get the resource mapping instances for the astropy schemas
    and manifests.  This method is registered with the
    asdf.resource_mappings entry point.

    Returns
    -------
    list of collections.abc.Mapping
    """
    from . import resources

    resources_root = importlib_resources.files(resources)

    return [
        DirectoryResourceMapping(resources_root / "schemas", "http://astropy.org/schemas/astropy/", recursive=True),
        DirectoryResourceMapping(resources_root / "manifests", "asdf://astropy.org/astropy/manifests/"),
    ]


def get_extensions():
    """
    Get the extension instances for the various astropy
    extensions.  This method is registered with the
    asdf.extensions entry point.

    Returns
    -------
    list of asdf.extension.Extension
    """
    from . import extensions

    return (
        [extensions.ASTROPY_EXTENSION, extensions.COORDINATES_EXTENSION]
        + extensions.TRANSFORM_EXTENSIONS
        + extensions.CORE_EXTENSIONS
    )