Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
b256516a
Unverified
Commit
b256516a
authored
Mar 28, 2024
by
Arthur
Committed by
GitHub
Mar 28, 2024
Browse files
[`make fix-copies`] update and help (#29924)
* add some help * style
parent
d9dc993f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
utils/check_copies.py
utils/check_copies.py
+10
-1
No files found.
utils/check_copies.py
View file @
b256516a
...
...
@@ -309,7 +309,16 @@ def split_code_into_blocks(
"""
splits
=
[]
# `indent - 4` is the indent level of the target class/func header
target_block_name
=
re
.
search
(
rf
"^
{
' '
*
(
indent
-
4
)
}
((class|def)\s+\S+)(\(|\:)"
,
lines
[
start_index
]).
groups
()[
0
]
try
:
target_block_name
=
re
.
search
(
rf
"^
{
' '
*
(
indent
-
4
)
}
((class|def)\s+\S+)(\(|\:)"
,
lines
[
start_index
]
).
groups
()[
0
]
except
ValueError
:
raise
ValueError
(
f
"Tried to split a class or function. It did not work. Error comes from line
{
start_index
}
: ```
\n
"
+
""
.
join
(
lines
[
start_index
:
end_index
])
+
"```
\n
"
)
# from now on, the `block` means inner blocks unless explicitly specified
indent_str
=
" "
*
indent
...
...
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