We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ea1653 commit 9b58487Copy full SHA for 9b58487
1 file changed
harp/schema.py
@@ -14,7 +14,10 @@ def _read_common_registers() -> Registers:
14
def read_schema(
15
file: Union[str, PathLike, TextIO], include_common_registers: bool = True
16
) -> Model:
17
- if isinstance(file, TextIO):
+ if isinstance(file, (str, PathLike)):
18
+ with open(file) as fileIO:
19
+ return read_schema(fileIO)
20
+ else:
21
schema = parse_yaml_raw_as(Model, file.read())
22
if not "WhoAmI" in schema.registers and include_common_registers:
23
common = _read_common_registers()
@@ -24,6 +27,3 @@ def read_schema(
24
27
if schema.groupMasks is not None and common.groupMasks is not None:
25
28
schema.groupMasks = dict(common.groupMasks, **schema.groupMasks)
26
29
return schema
- else:
- with open(file) as fileIO:
- return read_schema(fileIO, include_common_registers)
0 commit comments