Skip to content

Commit 3095345

Browse files
committed
Modify header so that warning is a comment, not a doc
The docstring appears in generated documentation and autocomplete, and the warning isn't helpful in those contexts.
1 parent 8081739 commit 3095345

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

generator/generate.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@
1616
logging.basicConfig(level=log_level)
1717
logger = logging.getLogger('generate')
1818

19-
SHARED_HEADER = '''DO NOT EDIT THIS FILE
19+
SHARED_HEADER = '''# DO NOT EDIT THIS FILE!
20+
#
21+
# This file is generated from the CDP specification. If you need to make
22+
# changes, edit the generator and regenerate all of the modules.'''
2023

21-
This file is generated from the CDP specification. If you need to make changes,
22-
edit the generator and regenerate all of the modules.'''
23-
24-
INIT_HEADER = '''\'\'\'
25-
{}
26-
\'\'\'
24+
INIT_HEADER = '''{}
2725
2826
'''.format(SHARED_HEADER)
2927

30-
MODULE_HEADER = '''\'\'\'
31-
{}
28+
MODULE_HEADER = '''{}
3229
33-
Domain: {{}}
34-
Experimental: {{}}
30+
\'\'\'
31+
CDP {{}} Domain{{}}
3532
\'\'\'
3633
3734
from cdp.util import event_class, T_JSON_DICT
@@ -730,7 +727,8 @@ def from_json(cls, domain: dict):
730727

731728
def generate_code(self) -> str:
732729
''' Generate the Python module code for a given CDP domain. '''
733-
code = MODULE_HEADER.format(self.domain, self.experimental)
730+
exp = ' (experimental)' if self.experimental else ''
731+
code = MODULE_HEADER.format(self.domain, exp)
734732
import_code = self.generate_imports()
735733
if import_code:
736734
code += import_code

0 commit comments

Comments
 (0)