File tree Expand file tree Collapse file tree 2 files changed +70
-1
lines changed
Expand file tree Collapse file tree 2 files changed +70
-1
lines changed Original file line number Diff line number Diff line change 22
33## [ Unreleased]
44
5- - Fix the ` astimezone() ` and ` replace() ` methods of datetime objects. ([ #188 ] ( https://github.com/sdispater/tomlkit/issues/178 ) )
5+ ### Fixed
6+
7+ - Fix the ` astimezone() ` and ` replace() ` methods of datetime objects. ([ #188 ] ( https://github.com/sdispater/tomlkit/issues/188 ) )
8+ - Add type definitions for ` items() ` function. ([ #190 ] ( https://github.com/sdispater/tomlkit/issues/190 ) )
69
710## [ 0.10.1] - 2022-03-27
811
Original file line number Diff line number Diff line change 1717from typing import Iterator
1818from typing import List
1919from typing import Optional
20+ from typing import Sequence
2021from typing import TypeVar
2122from typing import Union
2223from typing import cast
@@ -58,6 +59,71 @@ class _CustomDict(MutableMapping, dict):
5859 """Adds MutableMapping mixin while pretending to be a builtin dict"""
5960
6061
62+ ItemT = TypeVar ("ItemT" , bound = "Item" )
63+
64+
65+ @overload
66+ def item (value : bool ) -> "Bool" :
67+ ...
68+
69+
70+ @overload
71+ def item (value : int ) -> "Integer" :
72+ ...
73+
74+
75+ @overload
76+ def item (value : float ) -> "Float" :
77+ ...
78+
79+
80+ @overload
81+ def item (value : str ) -> "String" :
82+ ...
83+
84+
85+ @overload
86+ def item (value : datetime ) -> "DateTime" :
87+ ...
88+
89+
90+ @overload
91+ def item (value : date ) -> "Date" :
92+ ...
93+
94+
95+ @overload
96+ def item (value : time ) -> "Time" :
97+ ...
98+
99+
100+ @overload
101+ def item (value : Sequence [dict ]) -> "AoT" :
102+ ...
103+
104+
105+ @overload
106+ def item (value : Sequence ) -> "Array" :
107+ ...
108+
109+
110+ @overload
111+ def item (value : dict , _parent : "Array" = ..., _sort_keys : bool = ...) -> "InlineTable" :
112+ ...
113+
114+
115+ @overload
116+ def item (
117+ value : dict , _parent : Optional ["Item" ] = ..., _sort_keys : bool = ...
118+ ) -> "Table" :
119+ ...
120+
121+
122+ @overload
123+ def item (value : ItemT ) -> ItemT :
124+ ...
125+
126+
61127def item (
62128 value : Any , _parent : Optional ["Item" ] = None , _sort_keys : bool = False
63129) -> "Item" :
You can’t perform that action at this time.
0 commit comments