Skip to content

Commit

Permalink
Clarify the documentation generation logic for repeat with dtype
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz and coderabbitai[bot] authored Jun 11, 2024
1 parent 5c74333 commit 8bc99d2
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions dargs/dargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,16 +679,13 @@ def gen_doc_body(self, path: list[str] | None = None, **kwargs) -> str:
}
allowed_types = []
allowed_element = []
if list in unsubscripted_dtype:
allowed_types.append("list")
allowed_element.append("element")
elif dict in unsubscripted_dtype:
allowed_types.append("dict")
allowed_element.append("key-value pair")
else:
raise ValueError(
"When `repeat` is True, `dtype` should contain `dict` OR `list`."
)
if list in unsubscripted_dtype or dict in unsubscripted_dtype:
if list in unsubscripted_dtype:
allowed_types.append("list")
allowed_element.append("element")
if dict in unsubscripted_dtype:
allowed_types.append("dict")
allowed_element.append("key-value pair")
body_list.append(
f"This argument takes a {' or '.join(allowed_types)} with "
f"each {' or '.join(allowed_element)} containing the following: \n"
Expand Down

0 comments on commit 8bc99d2

Please sign in to comment.