Example #1
0
 def _add_attributes(self, section):
     service_model = self._resource.meta.client.meta.service_model
     attributes = {}
     if self._resource.meta.resource_model.shape:
         shape = service_model.shape_for(
             self._resource.meta.resource_model.shape)
         attributes = self._resource.meta.resource_model.get_attributes(
             shape)
     section = section.add_new_section('attributes')
     attribute_list = []
     if attributes:
         add_resource_type_overview(
             section=section,
             resource_type='Attributes',
             description=(
                 'Attributes provide access'
                 ' to the properties of a resource. Attributes are lazy-'
                 'loaded the first time one is accessed via the'
                 ' :py:meth:`load` method.'),
             intro_link='identifiers_attributes_intro')
         self.member_map['attributes'] = attribute_list
     for attr_name in sorted(attributes):
         _, attr_shape = attributes[attr_name]
         attribute_section = section.add_new_section(attr_name)
         attribute_list.append(attr_name)
         document_attribute(
             section=attribute_section,
             service_name=self._service_name,
             resource_name=self._resource_name,
             attr_name=attr_name,
             event_emitter=self._resource.meta.client.meta.events,
             attr_model=attr_shape
         )
Example #2
0
 def _add_attributes(self, section):
     service_model = self._resource.meta.client.meta.service_model
     attributes = {}
     if self._resource.meta.resource_model.shape:
         shape = service_model.shape_for(
             self._resource.meta.resource_model.shape)
         attributes = self._resource.meta.resource_model.get_attributes(
             shape)
     section = section.add_new_section('attributes')
     attribute_list = []
     if attributes:
         add_resource_type_overview(
             section=section,
             resource_type='Attributes',
             description=(
                 'Attributes provide access'
                 ' to the properties of a resource. Attributes are lazy-'
                 'loaded the first time one is accessed via the'
                 ' :py:meth:`load` method.'),
             intro_link='identifiers_attributes_intro')
         self.member_map['attributes'] = attribute_list
     for attr_name in sorted(attributes):
         _, attr_shape = attributes[attr_name]
         attribute_section = section.add_new_section(attr_name)
         attribute_list.append(attr_name)
         document_attribute(section=attribute_section,
                            attr_name=attr_name,
                            attr_model=attr_shape)
Example #3
0
 def test_document_attr_scalar(self):
     shape_model = self.service_model.shape_for('ResourceShape')
     attr_name = 'StringAttr'
     document_attribute(
         self.doc_structure, self.service_name, self.resource_name,
         attr_name, self.event_emitter, shape_model.members[attr_name])
     self.assert_contains_lines_in_order([
         '.. py:attribute:: StringAttr',
         '  - *(string) --* Documents a string attribute'
     ])
Example #4
0
 def test_document_attr_scalar(self):
     shape_model = self.service_model.shape_for('ResourceShape')
     attr_name = 'StringAttr'
     document_attribute(self.doc_structure, self.service_name,
                        self.resource_name, attr_name, self.event_emitter,
                        shape_model.members[attr_name])
     self.assert_contains_lines_in_order([
         '.. py:attribute:: StringAttr',
         '  - *(string) --* Documents a string attribute'
     ])
Example #5
0
 def test_document_attr_structure(self):
     shape_model = self.service_model.shape_for('ResourceShape')
     attr_name = 'NestedAttr'
     document_attribute(
         self.doc_structure, self.service_name, self.resource_name,
         attr_name, self.event_emitter, shape_model.members[attr_name])
     self.assert_contains_lines_in_order([
         '.. py:attribute:: NestedAttr',
         '  - *(dict) --* Documents a nested attribute',
         ('    - **NestedStrAttr** *(string) --* Documents a nested '
          'string attribute')
     ])
Example #6
0
 def test_document_attr_structure(self):
     shape_model = self.service_model.shape_for('ResourceShape')
     attr_name = 'NestedAttr'
     document_attribute(self.doc_structure, self.service_name,
                        self.resource_name, attr_name, self.event_emitter,
                        shape_model.members[attr_name])
     self.assert_contains_lines_in_order([
         '.. py:attribute:: NestedAttr',
         '  - *(dict) --* Documents a nested attribute',
         ('    - **NestedStrAttr** *(string) --* Documents a nested '
          'string attribute')
     ])
Example #7
0
 def _write_docstring(self, *args, **kwargs):
     document_attribute(*args, **kwargs)
Example #8
0
 def _write_docstring(self, *args, **kwargs):
     document_attribute(*args, **kwargs)