Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/boto3/docs/base.py: 29%
31 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
1# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"). You
4# may not use this file except in compliance with the License. A copy of
5# the License is located at
6#
7# https://aws.amazon.com/apache2.0/
8#
9# or in the "license" file accompanying this file. This file is
10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11# ANY KIND, either express or implied. See the License for the specific
12# language governing permissions and limitations under the License.
13from botocore.compat import OrderedDict
16class BaseDocumenter:
17 def __init__(self, resource):
18 self._resource = resource
19 self._client = self._resource.meta.client
20 self._resource_model = self._resource.meta.resource_model
21 self._service_model = self._client.meta.service_model
22 self._resource_name = self._resource.meta.resource_model.name
23 self._service_name = self._service_model.service_name
24 self._service_docs_name = self._client.__class__.__name__
25 self.member_map = OrderedDict()
26 self.represents_service_resource = (
27 self._service_name == self._resource_name
28 )
29 self._resource_class_name = self._resource_name
30 if self._resource_name == self._service_name:
31 self._resource_class_name = 'ServiceResource'
33 @property
34 def class_name(self):
35 return f'{self._service_docs_name}.{self._resource_name}'
38class NestedDocumenter(BaseDocumenter):
39 def __init__(self, resource, root_docs_path):
40 super().__init__(resource)
41 self._root_docs_path = root_docs_path
42 self._resource_sub_path = self._resource_name.lower()
43 if self._resource_name == self._service_name:
44 self._resource_sub_path = 'service-resource'
46 @property
47 def class_name(self):
48 resource_class_name = self._resource_name
49 if self._resource_name == self._service_name:
50 resource_class_name = 'ServiceResource'
51 return f'{self._service_docs_name}.{resource_class_name}'