@@ -60,7 +60,9 @@ def doc_only_run(self):
6060 docstring = list (node .findall (condition = desc_content ))
6161
6262 if not docstring :
63- logger .warning (f"The docstring for { self .arguments [0 ]} cannot be found." )
63+ logger .warning (
64+ f"The docstring for { self .arguments [0 ]} cannot be found."
65+ )
6466 return []
6567
6668 return docstring
@@ -187,14 +189,19 @@ def sub_if_not_none(pattern, repl, *strings):
187189def sig_alternative (doc , signature , return_annotation ):
188190 """Find an alternative signature defined in the docstring
189191
190- If there is not exactly one signature set using :sig=...:, then no changes
191- occur.
192+ If there is no signature specified using :sig=...:, then no changes occur.
193+ If multiple different signatures are specified using :sig=...:, then the
194+ signature is set to (*args, **kwargs). Otherwise, the signature is set to
195+ the unique signature specified using :sig=...:.
192196 """
193197 if not doc :
194198 return signature , return_annotation
199+
195200 m = set (re .findall (custom_signature_re , doc ))
196- if len (m ) != 1 :
201+ if len (m ) == 0 :
197202 return signature , return_annotation
203+ if len (m ) > 1 :
204+ return "(*args, **kwargs)" , ""
198205
199206 _ , _ , _ , _ , args , return_annotation = m .pop ()
200207 new_sig = f"({ args } )"
0 commit comments