1010 TYPE_CHECKING ,
1111 Any ,
1212 NewType ,
13- Optional ,
1413 TypeVar ,
1514 Union ,
1615 overload ,
@@ -148,10 +147,10 @@ class Class:
148147 :param z: baz
149148 """
150149
151- def __init__ (self , x : bool , y : int , z : Optional [ str ] = None ) -> None : # noqa: UP007
150+ def __init__ (self , x : bool , y : int , z : str | None = None ) -> None :
152151 pass
153152
154- def a_method (self , x : bool , y : int , z : Optional [ str ] = None ) -> str : # noqa: UP007
153+ def a_method (self , x : bool , y : int , z : str | None = None ) -> str :
155154 """
156155 Method docstring.
157156
@@ -182,7 +181,7 @@ def __magic_custom_method__(self, x: str) -> str: # noqa: PLW3201
182181 """
183182
184183 @classmethod
185- def a_classmethod (cls , x : bool , y : int , z : Optional [ str ] = None ) -> str : # noqa: UP007
184+ def a_classmethod (cls , x : bool , y : int , z : str | None = None ) -> str :
186185 """
187186 Classmethod docstring.
188187
@@ -192,7 +191,7 @@ def a_classmethod(cls, x: bool, y: int, z: Optional[str] = None) -> str: # noqa
192191 """
193192
194193 @staticmethod
195- def a_staticmethod (x : bool , y : int , z : Optional [ str ] = None ) -> str : # noqa: UP007
194+ def a_staticmethod (x : bool , y : int , z : str | None = None ) -> str :
196195 """
197196 Staticmethod docstring.
198197
@@ -270,7 +269,7 @@ def __init__(self, message: str) -> None:
270269 bytes
271270""" ,
272271)
273- def function (x : bool , y : int , z_ : Optional [ str ] = None ) -> str : # noqa: UP007
272+ def function (x : bool , y : int , z_ : str | None = None ) -> str :
274273 """
275274 Function docstring.
276275
@@ -675,7 +674,7 @@ class mod.TestClassAttributeDocs
675674class TestClassAttributeDocs :
676675 """A class"""
677676
678- code : Optional [ CodeType ] # noqa: UP007
677+ code : CodeType | None
679678 """An attribute"""
680679
681680
0 commit comments