We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 055fb1c commit 5d22d43Copy full SHA for 5d22d43
1 file changed
harp/schema.py
@@ -0,0 +1,11 @@
1
+from os import PathLike
2
+from typing import TextIO, Union
3
+from harp.model import Model
4
+from pydantic_yaml import parse_yaml_raw_as
5
+
6
+def read_schema(file: Union[str, PathLike, TextIO]) -> Model:
7
+ try:
8
+ with open(file) as fileIO:
9
+ return read_schema(fileIO)
10
+ except TypeError:
11
+ return parse_yaml_raw_as(Model, file.read())
0 commit comments