MCPcopy Create free account
hub / github.com/aws/aws-cli / PaginatorDocumenter

Class PaginatorDocumenter

awscli/botocore/docs/paginator.py:23–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class PaginatorDocumenter:
24 def __init__(self, client, service_paginator_model, root_docs_path):
25 self._client = client
26 self._client_class_name = self._client.__class__.__name__
27 self._service_name = self._client.meta.service_model.service_name
28 self._service_paginator_model = service_paginator_model
29 self._root_docs_path = root_docs_path
30 self._USER_GUIDE_LINK = (
31 'https://boto3.amazonaws.com/'
32 'v1/documentation/api/latest/guide/paginators.html'
33 )
34
35 def document_paginators(self, section):
36 """Documents the various paginators for a service
37
38 param section: The section to write to.
39 """
40 section.style.h2('Paginators')
41 self._add_overview(section)
42 section.style.new_line()
43 section.writeln('The available paginators are:')
44 section.style.toctree()
45
46 paginator_names = sorted(
47 self._service_paginator_model._paginator_config
48 )
49
50 # List the available paginators and then document each paginator.
51 for paginator_name in paginator_names:
52 section.style.tocitem(
53 f'{self._service_name}/paginator/{paginator_name}'
54 )
55 # Create a new DocumentStructure for each paginator and add contents.
56 paginator_doc_structure = DocumentStructure(
57 paginator_name, target='html'
58 )
59 self._add_paginator(paginator_doc_structure, paginator_name)
60 # Write paginators in individual/nested files.
61 # Path: <root>/reference/services/<service>/paginator/<paginator_name>.rst
62 paginator_dir_path = os.path.join(
63 self._root_docs_path, self._service_name, 'paginator'
64 )
65 paginator_doc_structure.write_to_file(
66 paginator_dir_path, paginator_name
67 )
68
69 def _add_paginator(self, section, paginator_name):
70 section.add_title_section(paginator_name)
71
72 # Docment the paginator class
73 paginator_section = section.add_new_section(paginator_name)
74 paginator_section.style.start_sphinx_py_class(
75 class_name=f'{self._client_class_name}.Paginator.{paginator_name}'
76 )
77 paginator_section.style.start_codeblock()
78 paginator_section.style.new_line()
79
80 # Document how to instantiate the paginator.

Callers 2

extra_setupMethod · 0.90
paginator_apiMethod · 0.90

Calls

no outgoing calls

Tested by 1

extra_setupMethod · 0.72