11import json
22from pathlib import Path
33from typing import (
4- AbstractSet ,
54 Any ,
65 Dict ,
76 Final ,
8- Iterator ,
97 List ,
10- Mapping ,
118 Optional ,
129 Sequence ,
1310 Tuple ,
1411 Union ,
15- ValuesView ,
1612 overload ,
1713)
1814
@@ -22,61 +18,10 @@ except ImportError:
2218 from typing_extensions import Literal # type: ignore
2319
2420Primitives = Union [int , float , str , bool ]
25- SimValue = Optional [Union [ 'Object' , 'Array' , Primitives ] ]
21+ SimValue = Optional [Primitives ]
2622UnboxedValue = Optional [Union [Primitives , Dict [str , Any ], List [Any ]]]
2723
2824
29- class Object (Mapping [str , SimValue ]):
30- def __getitem__ (self , key : str ) -> SimValue :
31- ...
32-
33- def __iter__ (self ) -> Iterator [str ]:
34- ...
35-
36- def __len__ (self ) -> int :
37- ...
38-
39- def as_dict (self ) -> Dict [str , UnboxedValue ]:
40- ...
41-
42- def at_pointer (self , key : str ) -> SimValue :
43- ...
44-
45- def keys (self ) -> AbstractSet [str ]:
46- ...
47-
48- def values (self ) -> ValuesView [SimValue ]:
49- ...
50-
51- def items (self ) -> AbstractSet [Tuple [str , SimValue ]]:
52- ...
53-
54- @property
55- def mini (self ) -> str :
56- ...
57-
58-
59- class Array (Sequence [SimValue ]):
60- def __len__ (self ) -> int :
61- ...
62-
63- def __getitem__ (self , idx : Union [int , slice ]) -> 'Array' :
64- ...
65-
66- def as_list (self ) -> List [Optional [Union [Primitives , dict , list ]]]:
67- ...
68-
69- def as_buffer (self , * , of_type : Literal ['d' , 'i' , 'u' ]) -> bytes :
70- ...
71-
72- def at_pointer (self , key : str ) -> SimValue :
73- ...
74-
75- @property
76- def mini (self ) -> str :
77- ...
78-
79-
8025class Parser :
8126 def __init__ (self , max_capacity : int = ...) -> None :
8227 ...
@@ -98,32 +43,28 @@ class Parser:
9843 @overload
9944 def load (
10045 self ,
101- path : Union [str , Path ],
102- recursive : Literal [False ] = ...,
46+ path : Union [str , Path ]
10347 ) -> SimValue :
10448 ...
10549
10650 @overload
10751 def load (
10852 self ,
109- path : Union [str , Path ],
110- recursive : Literal [True ],
53+ path : Union [str , Path ]
11154 ) -> UnboxedValue :
11255 ...
11356
11457 @overload
11558 def parse (
11659 self ,
117- data : Union [str , bytes , bytearray , memoryview ],
118- recursive : Literal [False ] = ...,
60+ data : Union [str , bytes , bytearray , memoryview ]
11961 ) -> SimValue :
12062 ...
12163
12264 @overload
12365 def parse (
12466 self ,
125- data : Union [str , bytes , bytearray , memoryview ],
126- recursive : Literal [True ],
67+ data : Union [str , bytes , bytearray , memoryview ]
12768 ) -> UnboxedValue :
12869 ...
12970
0 commit comments