@@ -135,6 +135,10 @@ def is_positional_only_related(self) -> bool:
135
135
# TODO: This is hacky, use error codes or something more resilient
136
136
return "leading double underscore" in self .message
137
137
138
+ def is_keyword_only_related (self ) -> bool :
139
+ """Whether or not the error is for something being (or not being) keyword-only."""
140
+ return "is not keyword-only" in self .message
141
+
138
142
def get_description (self , concise : bool = False ) -> str :
139
143
"""Returns a description of the error.
140
144
@@ -1864,6 +1868,7 @@ class _Arguments:
1864
1868
concise : bool
1865
1869
ignore_missing_stub : bool
1866
1870
ignore_positional_only : bool
1871
+ ignore_keyword_only : bool
1867
1872
allowlist : list [str ]
1868
1873
generate_allowlist : bool
1869
1874
ignore_unused_allowlist : bool
@@ -1940,6 +1945,8 @@ def set_strict_flags() -> None: # not needed yet
1940
1945
continue
1941
1946
if args .ignore_positional_only and error .is_positional_only_related ():
1942
1947
continue
1948
+ if args .ignore_keyword_only and error .is_keyword_only_related ():
1949
+ continue
1943
1950
if error .object_desc in allowlist :
1944
1951
allowlist [error .object_desc ] = True
1945
1952
continue
@@ -2017,6 +2024,11 @@ def parse_options(args: list[str]) -> _Arguments:
2017
2024
action = "store_true" ,
2018
2025
help = "Ignore errors for whether an argument should or shouldn't be positional-only" ,
2019
2026
)
2027
+ parser .add_argument (
2028
+ "--ignore-keyword-only" ,
2029
+ action = "store_true" ,
2030
+ help = "Ignore errors for whether an argument should or shouldn't be keyword-only" ,
2031
+ )
2020
2032
parser .add_argument (
2021
2033
"--allowlist" ,
2022
2034
"--whitelist" ,
0 commit comments