@@ -65,7 +65,9 @@ def item(value: str, _parent: Item | None = ..., _sort_keys: bool = ...) -> Stri
6565
6666
6767@overload
68- def item (value : datetime , _parent : Item | None = ..., _sort_keys : bool = ...) -> DateTime : ... # type: ignore[overload-overlap]
68+ def item (
69+ value : datetime , _parent : Item | None = ..., _sort_keys : bool = ...
70+ ) -> DateTime : ... # type: ignore[overload-overlap]
6971
7072
7173@overload
@@ -89,11 +91,15 @@ def item(
8991
9092
9193@overload
92- def item (value : dict [str , Any ], _parent : Array = ..., _sort_keys : bool = ...) -> InlineTable : ...
94+ def item (
95+ value : dict [str , Any ], _parent : Array = ..., _sort_keys : bool = ...
96+ ) -> InlineTable : ...
9397
9498
9599@overload
96- def item (value : dict [str , Any ], _parent : Item | None = ..., _sort_keys : bool = ...) -> Table : ...
100+ def item (
101+ value : dict [str , Any ], _parent : Item | None = ..., _sort_keys : bool = ...
102+ ) -> Table : ...
97103
98104
99105@overload
@@ -714,7 +720,9 @@ def __pos__(self) -> Integer:
714720 return self ._new (int .__pos__ (self ))
715721
716722 def __pow__ (self , other : int , mod : int | None = None ) -> Integer : # type: ignore[override]
717- result = int .__pow__ (self , other ) if mod is None else int .__pow__ (self , other , mod )
723+ result = (
724+ int .__pow__ (self , other ) if mod is None else int .__pow__ (self , other , mod )
725+ )
718726 return self ._new (result )
719727
720728 def __radd__ (self , other : object ) -> Integer :
@@ -763,7 +771,9 @@ def __round__(self, ndigits: int = 0) -> Integer: # type: ignore[override]
763771 return self ._new (int .__round__ (self , ndigits ))
764772
765773 def __rpow__ (self , other : int , mod : int | None = None ) -> Integer : # type: ignore[misc]
766- result = int .__rpow__ (self , other ) if mod is None else int .__rpow__ (self , other , mod )
774+ result = (
775+ int .__rpow__ (self , other ) if mod is None else int .__rpow__ (self , other , mod )
776+ )
767777 return self ._new (result )
768778
769779 def __rrshift__ (self , other : object ) -> Integer :
@@ -1162,7 +1172,9 @@ def _new(self, result: datetime) -> DateTime:
11621172 raw ,
11631173 )
11641174
1165- def _getstate (self , protocol : int = 3 ) -> tuple [int , int , int , int , int , int , int , tzinfo | None , Trivia , str ]:
1175+ def _getstate (
1176+ self , protocol : int = 3
1177+ ) -> tuple [int , int , int , int , int , int , int , tzinfo | None , Trivia , str ]:
11661178 return (
11671179 self .year ,
11681180 self .month ,
@@ -1182,7 +1194,14 @@ class Date(Item, date):
11821194 A date literal.
11831195 """
11841196
1185- def __new__ (cls , year : int , month : int , day : int , trivia : Trivia | None = None , raw : str = "" ) -> Date :
1197+ def __new__ (
1198+ cls ,
1199+ year : int ,
1200+ month : int ,
1201+ day : int ,
1202+ trivia : Trivia | None = None ,
1203+ raw : str = "" ,
1204+ ) -> Date :
11861205 return date .__new__ (cls , year , month , day )
11871206
11881207 def __init__ (
@@ -1311,7 +1330,9 @@ def _new(self, result: time) -> Time:
13111330 raw ,
13121331 )
13131332
1314- def _getstate (self , protocol : int = 3 ) -> tuple [int , int , int , int , tzinfo | None , Trivia , str ]:
1333+ def _getstate (
1334+ self , protocol : int = 3
1335+ ) -> tuple [int , int , int , int , tzinfo | None , Trivia , str ]:
13151336 return (
13161337 self .hour ,
13171338 self .minute ,
@@ -1339,7 +1360,11 @@ def __init__(
13391360 self .comment = comment
13401361
13411362 def __iter__ (self ) -> Iterator [Item ]:
1342- return (x for x in (self .indent , self .value , self .comma , self .comment ) if x is not None )
1363+ return (
1364+ x
1365+ for x in (self .indent , self .value , self .comma , self .comment )
1366+ if x is not None
1367+ )
13431368
13441369 def __repr__ (self ) -> str :
13451370 return repr (tuple (self ))
@@ -1594,10 +1619,7 @@ def insert(self, pos: int, value: Any) -> None: # type: ignore[override]
15941619 # The last item is a pure whitespace(\n ), insert before it
15951620 idx -= 1
15961621 _indent = self ._value [idx ].indent
1597- if (
1598- _indent is not None
1599- and "\n " in _indent .s
1600- ):
1622+ if _indent is not None and "\n " in _indent .s :
16011623 default_indent = "\n "
16021624 indent : Whitespace | None = None
16031625 comma : Whitespace | None = Whitespace ("," ) if pos < length else None
@@ -1741,7 +1763,9 @@ def add(self: AT, key: Comment | Whitespace) -> AT: ...
17411763 @overload
17421764 def add (self : AT , key : Key | str , value : Any = ...) -> AT : ...
17431765
1744- def add (self : AT , key : Key | str | Comment | Whitespace , value : Any | None = None ) -> AT :
1766+ def add (
1767+ self : AT , key : Key | str | Comment | Whitespace , value : Any | None = None
1768+ ) -> AT :
17451769 if value is None :
17461770 if not isinstance (key , (Comment , Whitespace )):
17471771 msg = "Non comment/whitespace items must have an associated key"
@@ -1772,7 +1796,8 @@ def setdefault(self, key: Key | str, default: Any) -> Any: # type: ignore[overr
17721796 super ().setdefault (key , default )
17731797 return self [key ]
17741798
1775- def __str__ (self ) -> str : return str (self .value )
1799+ def __str__ (self ) -> str :
1800+ return str (self .value )
17761801
17771802 def copy (self : AT ) -> AT :
17781803 return copy .copy (self )
@@ -1956,7 +1981,9 @@ def invalidate_display_name(self) -> None:
19561981 if hasattr (child , "invalidate_display_name" ):
19571982 child .invalidate_display_name ()
19581983
1959- def _getstate (self , protocol : int = 3 ) -> tuple [container .Container , Trivia , bool , bool | None , str | None , str | None ]:
1984+ def _getstate (
1985+ self , protocol : int = 3
1986+ ) -> tuple [container .Container , Trivia , bool , bool | None , str | None , str | None ]:
19601987 return (
19611988 self ._value ,
19621989 self ._trivia ,
@@ -2090,7 +2117,9 @@ class String(str, Item): # type: ignore[misc]
20902117 A string literal.
20912118 """
20922119
2093- def __new__ (cls , t : StringType , value : str , original : str , trivia : Trivia ) -> String :
2120+ def __new__ (
2121+ cls , t : StringType , value : str , original : str , trivia : Trivia
2122+ ) -> String :
20942123 return super ().__new__ (cls , value )
20952124
20962125 def __init__ (self , t : StringType , _ : str , original : str , trivia : Trivia ) -> None :
@@ -2130,7 +2159,9 @@ def _getstate(self, protocol: int = 3) -> tuple[StringType, str, str, Trivia]:
21302159 return self ._t , str (self ), self ._original , self ._trivia
21312160
21322161 @classmethod
2133- def from_raw (cls , value : str , type_ : StringType = StringType .SLB , escape : bool = True ) -> String :
2162+ def from_raw (
2163+ cls , value : str , type_ : StringType = StringType .SLB , escape : bool = True
2164+ ) -> String :
21342165 value = decode (value )
21352166
21362167 invalid = type_ .invalid_sequences
0 commit comments