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
7c046c5c
Unverified
Commit
7c046c5c
authored
Jul 08, 2022
by
Sylvain Gugger
Committed by
GitHub
Jul 08, 2022
Browse files
Update localized READMES when template is filled. (#18062)
parent
94ca7d2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
utils/check_copies.py
utils/check_copies.py
+6
-0
No files found.
utils/check_copies.py
View file @
7c046c5c
...
...
@@ -133,6 +133,7 @@ def find_code_in_transformers(object_name):
_re_copy_warning
=
re
.
compile
(
r
"^(\s*)#\s*Copied from\s+transformers\.(\S+\.\S+)\s*($|\S.*$)"
)
_re_replace_pattern
=
re
.
compile
(
r
"^\s*(\S+)->(\S+)(\s+.*|$)"
)
_re_fill_pattern
=
re
.
compile
(
r
"<FILL\s+[^>]*>"
)
def
get_indent
(
code
):
...
...
@@ -346,6 +347,11 @@ def convert_to_localized_md(model_list, localized_model_list, format_str):
# Add an anchor white space behind a model description string for regex.
# If metadata cannot be captured, the English version will be directly copied.
localized_model_index
[
title
]
=
_re_capture_meta
.
sub
(
_rep
,
model
+
" "
)
elif
_re_fill_pattern
.
search
(
localized_model_index
[
title
])
is
not
None
:
update
=
_re_capture_meta
.
sub
(
_rep
,
model
+
" "
)
if
update
!=
localized_model_index
[
title
]:
readmes_match
=
False
localized_model_index
[
title
]
=
update
else
:
# Synchronize link
localized_model_index
[
title
]
=
_re_capture_title_link
.
sub
(
...
...
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