Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
14345135
Unverified
Commit
14345135
authored
Jan 11, 2024
by
Matt
Committed by
GitHub
Jan 11, 2024
Browse files
Fix docstring checker issues with PIL enums (#28450)
parent
19e83d17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
utils/check_docstrings.py
utils/check_docstrings.py
+4
-0
No files found.
utils/check_docstrings.py
View file @
14345135
...
...
@@ -933,6 +933,10 @@ def replace_default_in_arg_description(description: str, default: Any) -> str:
except
Exception
:
# Otherwise there is a math operator so we add a code block.
str_default
=
f
"`
{
current_default
}
`"
elif
isinstance
(
default
,
enum
.
Enum
)
and
default
.
name
==
current_default
.
split
(
"."
)[
-
1
]:
# When the default is an Enum (this is often the case for PIL.Image.Resampling), and the docstring
# matches the enum name, keep the existing docstring rather than clobbering it with the enum value.
str_default
=
f
"`
{
current_default
}
`"
if
str_default
is
None
:
str_default
=
stringify_default
(
default
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment