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
968ae57c
Unverified
Commit
968ae57c
authored
Oct 15, 2021
by
Sylvain Gugger
Committed by
GitHub
Oct 15, 2021
Browse files
Don't duplicate the elements in dir (#14023)
parent
84ad6af4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
src/transformers/file_utils.py
src/transformers/file_utils.py
+7
-1
No files found.
src/transformers/file_utils.py
View file @
968ae57c
...
@@ -2123,7 +2123,13 @@ class _LazyModule(ModuleType):
...
@@ -2123,7 +2123,13 @@ class _LazyModule(ModuleType):
# Needed for autocompletion in an IDE
# Needed for autocompletion in an IDE
def
__dir__
(
self
):
def
__dir__
(
self
):
return
super
().
__dir__
()
+
self
.
__all__
result
=
super
().
__dir__
()
# The elements of self.__all__ that are submodules may or may not be in the dir already, depending on whether
# they have been accessed or not. So we only add the elements of self.__all__ that are not already in the dir.
for
attr
in
self
.
__all__
:
if
attr
not
in
result
:
result
.
append
(
attr
)
return
result
def
__getattr__
(
self
,
name
:
str
)
->
Any
:
def
__getattr__
(
self
,
name
:
str
)
->
Any
:
if
name
in
self
.
_objects
:
if
name
in
self
.
_objects
:
...
...
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