|
13 | 13 |
|
14 | 14 | OPENMINDS_VERSION = "latest" |
15 | 15 |
|
16 | | -name_map = { |
17 | | - "scope": "model_scope", # this is because 'scope' is already a keyword |
18 | | - # we could rename the 'scope' keyword to 'stage' |
19 | | - # but we would have the same problem, as there is |
20 | | - # a property named 'stage' |
21 | | - # Suggested resolution: rename the property "scope" in openMINDS to "hasScope" |
22 | | -} |
23 | 16 |
|
24 | 17 | global_aliases = { |
25 | 18 | "short_name": "alias", |
26 | 19 | "full_name": "name", |
27 | 20 | "has_versions": "versions", |
28 | 21 | "has_entity": "entities", |
29 | | - "hashes": "hash" |
| 22 | + "hashes": "hash", |
| 23 | + "scope": "model_scope" |
30 | 24 | } |
31 | 25 |
|
32 | 26 |
|
|
235 | 229 | } |
236 | 230 |
|
237 | 231 | def generate_python_name(json_name): |
238 | | - if json_name in name_map: |
239 | | - python_name = name_map[json_name] |
240 | | - else: |
241 | | - python_name = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", json_name.strip()) |
242 | | - python_name = re.sub("([a-z0-9])([A-Z])", r"\1_\2", python_name).lower() |
243 | | - replacements = [ |
244 | | - ("-", "_"), (".", "_"), ("+", "plus"), ("#", "sharp"), (",", "comma"), ("(", ""), (")", "") |
245 | | - ] |
246 | | - for before, after in replacements: |
247 | | - python_name = python_name.replace(before, after) |
248 | | - if python_name[0] in number_names: # Python variables can't start with a number |
249 | | - python_name = number_names[python_name[0]] + python_name[1:] |
250 | | - if not python_name.isidentifier(): |
251 | | - raise NameError(f"Cannot generate a valid Python name from '{json_name}'") |
| 232 | + python_name = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", json_name.strip()) |
| 233 | + python_name = re.sub("([a-z0-9])([A-Z])", r"\1_\2", python_name).lower() |
| 234 | + replacements = [ |
| 235 | + ("-", "_"), (".", "_"), ("+", "plus"), ("#", "sharp"), (",", "comma"), ("(", ""), (")", "") |
| 236 | + ] |
| 237 | + for before, after in replacements: |
| 238 | + python_name = python_name.replace(before, after) |
| 239 | + if python_name[0] in number_names: # Python variables can't start with a number |
| 240 | + python_name = number_names[python_name[0]] + python_name[1:] |
| 241 | + if not python_name.isidentifier(): |
| 242 | + raise NameError(f"Cannot generate a valid Python name from '{json_name}'") |
252 | 243 | return python_name |
253 | 244 |
|
254 | 245 |
|
@@ -665,7 +656,7 @@ def get_type(prop): |
665 | 656 | else: |
666 | 657 | base_class = "KGObject" |
667 | 658 | default_space = get_default_space(module_name, class_name) |
668 | | - standard_init_properties = "id=id, space=space, scope=scope, " |
| 659 | + standard_init_properties = "id=id, space=space, release_status=release_status, " |
669 | 660 | properties = [] |
670 | 661 | plurals_special_cases = { |
671 | 662 | # because this is a single item (PropertyValueList), but that item contains a list |
|
0 commit comments