File: loaders.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (33 lines) | stat: -rw-r--r-- 943 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
"""Module for loading various model files along with any `moto-extras`

Heavily leverages the existing botocore loading mechanism, which expects
a particular directory layout and file naming convention:

    <MOTO_ROOT>
      |
      |-- service_name
      |   |-- YYYY-MM-DD (matching API version for service_name)
      |       |-- service-2.moto-extras.json
      |       |-- paginators-1.moto-extras.json

The ``moto-extras`` files represent extra data to be applied to the model
after it is loaded. Data in these files could augment or modify the AWS
service model by supplying additional error shapes or default input
values for use by Moto.
"""

import os

from botocore.loaders import Loader as BotocoreLoader

import moto

moto_root = os.path.dirname(os.path.abspath(moto.__file__))


class Loader(BotocoreLoader):
    BUILTIN_EXTRAS_TYPES = ["moto"]


def create_loader() -> Loader:
    return Loader(extra_search_paths=[moto_root])