if you need them.
'''
+_MODULE_PRELUDE = '''
+import sys
+if sys.version_info < (3, 8):
+ from typing import Any
+ from typing_extensions import TypedDict
+else:
+ from typing import Any, TypedDict
+'''
+
_TYPE_MAP = {
# Map the API's JavaScript-based type names to Python annotations.
# Some of these may disappear after Arvados issue #19795 is fixed.
discovery_document = json.load(discovery_file)
print(
to_docstring(_MODULE_PYDOC, indent=0),
- '''from typing import Any, TypedDict''',
- sep='\n\n', end='\n\n', file=args.out_file,
+ _MODULE_PRELUDE,
+ sep='\n', file=args.out_file,
)
schemas = sorted(discovery_document['schemas'].items())
'pycurl >=7.19.5.1, <7.45.0',
'ruamel.yaml >=0.15.54, <0.17.22',
'setuptools>=40.3.0',
+ 'typing_extensions; python_version<"3.8"',
'ws4py >=0.4.2',
'protobuf<4.0.0dev',
'pyparsing<3',