@@ -123,8 +123,8 @@ def _read_block_items(docstring: Docstring, *, offset: int, **options: Any) -> _
123123 docstring_warning (
124124 docstring ,
125125 new_offset ,
126- f"Confusing indentation for continuation line { new_offset + 1 } in docstring, "
127- f"should be { indent } * 2 = { indent * 2 } spaces, not { cont_indent } " ,
126+ f"Confusing indentation for continuation line { new_offset + 1 } in docstring, "
127+ f"should be { indent } * 2 = { indent * 2 } spaces, not { cont_indent } " ,
128128 )
129129
130130 elif line .startswith (indent * " " ):
@@ -201,8 +201,7 @@ def _read_parameters(
201201 if " " in name_with_type :
202202 name , annotation = name_with_type .split (" " , 1 )
203203 annotation = annotation .strip ("()" )
204- if annotation .endswith (", optional" ):
205- annotation = annotation [:- 10 ]
204+ annotation = annotation .removesuffix (", optional" )
206205 # try to compile the annotation to transform it into an expression
207206 annotation = parse_docstring_annotation (annotation , docstring )
208207 else :
@@ -280,8 +279,7 @@ def _read_attributes_section(
280279 if " " in name_with_type :
281280 name , annotation = name_with_type .split (" " , 1 )
282281 annotation = annotation .strip ("()" )
283- if annotation .endswith (", optional" ):
284- annotation = annotation [:- 10 ]
282+ annotation = annotation .removesuffix (", optional" )
285283 # try to compile the annotation to transform it into an expression
286284 annotation = parse_docstring_annotation (annotation , docstring )
287285 else :
0 commit comments