@@ -85,7 +85,7 @@ class HH(DD, EE):
8585# Exceptions
8686@attr .s (auto_exc = True )
8787class Error (Exception ):
88- x = attr .ib ()
88+ x : int = attr .ib ()
8989
9090
9191try :
@@ -153,8 +153,8 @@ class Validated:
153153 attr .validators .instance_of (C ), attr .validators .instance_of (D )
154154 ),
155155 )
156- e = attr .ib (validator = attr .validators .matches_re (r"foo" ))
157- f = attr .ib (
156+ e : str = attr .ib (validator = attr .validators .matches_re (r"foo" ))
157+ f : str = attr .ib (
158158 validator = attr .validators .matches_re (r"foo" , flags = 42 , func = re .search )
159159 )
160160
@@ -172,27 +172,27 @@ class Validated:
172172# Custom repr()
173173@attr .s
174174class WithCustomRepr :
175- a = attr .ib (repr = True )
176- b = attr .ib (repr = False )
177- c = attr .ib (repr = lambda value : "c is for cookie" )
178- d = attr .ib (repr = str )
175+ a : int = attr .ib (repr = True )
176+ b : str = attr .ib (repr = False )
177+ c : str = attr .ib (repr = lambda value : "c is for cookie" )
178+ d : bool = attr .ib (repr = str )
179179
180180
181181# Check some of our own types
182182@attr .s (eq = True , order = False )
183183class OrderFlags :
184- a = attr .ib (eq = False , order = False )
185- b = attr .ib (eq = True , order = True )
184+ a : int = attr .ib (eq = False , order = False )
185+ b : int = attr .ib (eq = True , order = True )
186186
187187
188188# on_setattr hooks
189189@attr .s (on_setattr = attr .setters .validate )
190190class ValidatedSetter :
191- a = attr . ib ()
192- b = attr .ib (on_setattr = attr .setters .NO_OP )
193- c = attr .ib (on_setattr = attr .setters .frozen )
194- d = attr .ib (on_setattr = [attr .setters .convert , attr .setters .validate ])
195- d = attr .ib (
191+ a : int
192+ b : str = attr .ib (on_setattr = attr .setters .NO_OP )
193+ c : bool = attr .ib (on_setattr = attr .setters .frozen )
194+ d : int = attr .ib (on_setattr = [attr .setters .convert , attr .setters .validate ])
195+ e : bool = attr .ib (
196196 on_setattr = attr .setters .pipe (
197197 attr .setters .convert , attr .setters .validate
198198 )
0 commit comments