|
1 | | -from __future__ import print_function |
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +from __future__ import print_function, unicode_literals |
2 | 4 | import ruamel.yaml |
3 | 5 | from typing import Any, Dict |
4 | 6 | from collections import Mapping, Sequence |
@@ -70,21 +72,21 @@ def setupCLTMappings(document): # type: (Dict[unicode, Any]) -> None |
70 | 72 |
|
71 | 73 | def shortenType(typeObj): |
72 | 74 | # type: (List[Any]) -> Union[Unicode, List[Any]] |
73 | | - if isinstance(typeObj, (str, unicode)) or not isinstance(typeObj, Sequence): |
| 75 | + if isinstance(typeObj, str) or not isinstance(typeObj, Sequence): |
74 | 76 | return typeObj |
75 | 77 | newType = [] |
76 | 78 | for entry in typeObj: # find arrays that we can shorten and do so |
77 | 79 | if isinstance(entry, Mapping): |
78 | 80 | if (entry['type'] == 'array' and |
79 | | - isinstance(entry['items'], (str, unicode))): |
| 81 | + isinstance(entry['items'], str)): |
80 | 82 | entry = entry['items'] + '[]' |
81 | 83 | newType.extend([entry]) |
82 | 84 | typeObj = newType |
83 | 85 | if len(typeObj) == 2: |
84 | 86 | if 'null' in typeObj: |
85 | 87 | typeCopy = copy.deepcopy(typeObj) |
86 | 88 | typeCopy.remove('null') |
87 | | - if isinstance(typeCopy[0], (str, unicode)): |
| 89 | + if isinstance(typeCopy[0], str): |
88 | 90 | return typeCopy[0] + '?' |
89 | 91 | return typeObj |
90 | 92 |
|
|
0 commit comments