|
31 | 31 | import jsonschema |
32 | 32 |
|
33 | 33 | import objdictgen |
| 34 | + |
34 | 35 | # Accessed by node.py, so we need to import node as module to avoid circular references |
35 | 36 | from objdictgen import maps |
36 | 37 | from objdictgen import node as nodelib |
37 | 38 | from objdictgen.maps import OD, ODMapping, ODMappingList |
38 | | -from objdictgen.typing import (TDiffNodes, TIndexEntry, TODJson, TODObj, |
39 | | - TODObjJson, TODSubObj, TODSubObjJson, TODValue, |
40 | | - TParamEntry, TPath, TProfileMenu) |
41 | | -from objdictgen.utils import (copy_in_order, exc_amend, maybe_number, |
42 | | - str_to_int, strip_brackets) |
| 39 | +from objdictgen.typing import ( |
| 40 | + TDiffNodes, |
| 41 | + TIndexEntry, |
| 42 | + TODJson, |
| 43 | + TODObj, |
| 44 | + TODObjJson, |
| 45 | + TODSubObj, |
| 46 | + TODSubObjJson, |
| 47 | + TODValue, |
| 48 | + TParamEntry, |
| 49 | + TPath, |
| 50 | + TProfileMenu, |
| 51 | +) |
| 52 | +from objdictgen.utils import copy_in_order, exc_amend, maybe_number, str_to_int, strip_brackets |
43 | 53 |
|
44 | 54 | T = TypeVar('T') |
45 | 55 | M = TypeVar('M', bound=Mapping) |
@@ -352,10 +362,10 @@ def generate_jsonc(node: Node, compact=False, sort=False, internal=False, |
352 | 362 |
|
353 | 363 | if jsonc: |
354 | 364 | # In jsonc the field is converted to "<field>, // <comment>" |
355 | | - repl = lambda m: m[1].replace('\\"', '"') + m[3] + m[2] |
| 365 | + repl = lambda m: m[1].replace('\\"', '"') + m[3] + m[2] # noqa: E731 |
356 | 366 | else: |
357 | 367 | # In json the field is converted to "<field>," |
358 | | - repl = lambda m: m[1].replace('\\"', '"') + m[3] |
| 368 | + repl = lambda m: m[1].replace('\\"', '"') + m[3] # noqa: E731 |
359 | 369 |
|
360 | 370 | # Convert the special @@ fields to jsonc comments |
361 | 371 | # Syntax: "@@<field>, // <comment>@@" |
@@ -396,7 +406,7 @@ def generate_node(contents: str|TODJson, validate: bool = True) -> Node: |
396 | 406 | # validate_fromdict() is better at giving useful errors |
397 | 407 | # than the json validator. However the type checking of the json |
398 | 408 | # validator is better. |
399 | | - global SCHEMA # pylint: disable=global-statement |
| 409 | + global SCHEMA |
400 | 410 | if not SCHEMA: |
401 | 411 | with open(objdictgen.JSON_SCHEMA, 'r', encoding="utf-8") as f: |
402 | 412 | SCHEMA = json.loads(remove_jsonc(f.read())) |
|
0 commit comments