44
55import re
66from contextlib import suppress
7- from typing import TYPE_CHECKING
7+ from typing import TYPE_CHECKING , TypedDict
8+ from warnings import warn
89
910from griffe ._internal .docstrings .models import (
1011 DocstringAttribute ,
@@ -851,7 +852,30 @@ def _is_empty_line(line: str) -> bool:
851852 DocstringSectionKind .receives : _read_receives_section ,
852853}
853854
854- _sentinel = object ()
855+
856+ class GoogleOptions (TypedDict , total = False ):
857+ """Options for parsing Google-style docstrings."""
858+
859+ ignore_init_summary : bool
860+ """Whether to ignore the summary in `__init__` methods' docstrings."""
861+ trim_doctest_flags : bool
862+ """Whether to remove doctest flags from Python example blocks."""
863+ returns_multiple_items : bool
864+ """Whether to parse multiple items in `Yields` and `Returns` sections."""
865+ returns_named_value : bool
866+ """Whether to parse `Yields` and `Returns` section items as name and description, rather than type and description."""
867+ returns_type_in_property_summary : bool
868+ """Whether to parse the return type of properties at the beginning of their summary."""
869+ receives_multiple_items : bool
870+ """Whether to parse multiple items in `Receives` sections."""
871+ receives_named_value : bool
872+ """Whether to parse `Receives` section items as name and description, rather than type and description."""
873+ warn_unknown_params : bool
874+ """Whether to warn about unknown parameters."""
875+ warn_missing_types : bool
876+ """Whether to warn about missing types/annotations for parameters, return values, etc."""
877+ warnings : bool
878+ """Whether to issue warnings for parsing issues."""
855879
856880
857881def parse_google (
@@ -867,6 +891,7 @@ def parse_google(
867891 warn_unknown_params : bool = True ,
868892 warn_missing_types : bool = True ,
869893 warnings : bool = True ,
894+ # YORE: Bump 2: Remove line.
870895 ** options : Any ,
871896) -> list [DocstringSection ]:
872897 """Parse a Google-style docstring.
@@ -895,7 +920,7 @@ def parse_google(
895920 warn_unknown_params: Warn about documented parameters not appearing in the signature.
896921 warn_missing_types: Warn about missing types/annotations for parameters, return values, etc.
897922 warnings: Whether to log warnings at all.
898- **options: Additional parsing options .
923+ **options: Swallowing keyword arguments for backward-compatibility .
899924
900925 Returns:
901926 A list of docstring sections.
@@ -906,6 +931,10 @@ def parse_google(
906931 in_code_block = False
907932 lines = docstring .lines
908933
934+ # YORE: Bump 2: Remove block.
935+ if options :
936+ warn ("Passing additional options is deprecated, these options are ignored." , DeprecationWarning , stacklevel = 2 )
937+
909938 options = {
910939 "ignore_init_summary" : ignore_init_summary ,
911940 "trim_doctest_flags" : trim_doctest_flags ,
@@ -917,7 +946,6 @@ def parse_google(
917946 "warn_unknown_params" : warn_unknown_params ,
918947 "warn_missing_types" : warn_missing_types ,
919948 "warnings" : warnings ,
920- ** options ,
921949 }
922950
923951 ignore_summary = (
0 commit comments