Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/boto3/docs/__init__.py: 31%

13 statements  

« 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. 

13import os 

14 

15from botocore.docs import DEPRECATED_SERVICE_NAMES 

16 

17from boto3.docs.service import ServiceDocumenter 

18 

19 

20def generate_docs(root_dir, session): 

21 """Generates the reference documentation for botocore 

22 

23 This will go through every available AWS service and output ReSTructured 

24 text files documenting each service. 

25 

26 :param root_dir: The directory to write the reference files to. Each 

27 service's reference documentation is loacated at 

28 root_dir/reference/services/service-name.rst 

29 

30 :param session: The boto3 session 

31 """ 

32 services_doc_path = os.path.join(root_dir, 'reference', 'services') 

33 if not os.path.exists(services_doc_path): 

34 os.makedirs(services_doc_path) 

35 

36 # Prevents deprecated service names from being generated in docs. 

37 available_services = [ 

38 service 

39 for service in session.get_available_services() 

40 if service not in DEPRECATED_SERVICE_NAMES 

41 ] 

42 

43 for service_name in available_services: 

44 docs = ServiceDocumenter( 

45 service_name, session, services_doc_path 

46 ).document_service() 

47 service_doc_path = os.path.join( 

48 services_doc_path, service_name + '.rst' 

49 ) 

50 with open(service_doc_path, 'wb') as f: 

51 f.write(docs)