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
OpenDAS
Torchaudio
Commits
acf1c7b7
Unverified
Commit
acf1c7b7
authored
Sep 28, 2023
by
moto
Committed by
GitHub
Sep 28, 2023
Browse files
Fix logging in dataset download utilities (#3624)
parent
4dc06ceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torchaudio/datasets/utils.py
torchaudio/datasets/utils.py
+4
-4
No files found.
torchaudio/datasets/utils.py
View file @
acf1c7b7
...
@@ -6,19 +6,20 @@ from typing import Any, List, Optional
...
@@ -6,19 +6,20 @@ from typing import Any, List, Optional
import
torchaudio
import
torchaudio
_LG
=
logging
.
getLogger
(
__name__
)
def
_extract_tar
(
from_path
:
str
,
to_path
:
Optional
[
str
]
=
None
,
overwrite
:
bool
=
False
)
->
List
[
str
]:
def
_extract_tar
(
from_path
:
str
,
to_path
:
Optional
[
str
]
=
None
,
overwrite
:
bool
=
False
)
->
List
[
str
]:
if
to_path
is
None
:
if
to_path
is
None
:
to_path
=
os
.
path
.
dirname
(
from_path
)
to_path
=
os
.
path
.
dirname
(
from_path
)
with
tarfile
.
open
(
from_path
,
"r"
)
as
tar
:
with
tarfile
.
open
(
from_path
,
"r"
)
as
tar
:
logging
.
info
(
"Opened tar file {}."
,
from_path
)
files
=
[]
files
=
[]
for
file_
in
tar
:
# type: Any
for
file_
in
tar
:
# type: Any
file_path
=
os
.
path
.
join
(
to_path
,
file_
.
name
)
file_path
=
os
.
path
.
join
(
to_path
,
file_
.
name
)
if
file_
.
isfile
():
if
file_
.
isfile
():
files
.
append
(
file_path
)
files
.
append
(
file_path
)
if
os
.
path
.
exists
(
file_path
):
if
os
.
path
.
exists
(
file_path
):
logging
.
info
(
"
{}
already extracted."
.
format
(
file_path
)
)
_LG
.
info
(
"
%s
already extracted."
,
file_path
)
if
not
overwrite
:
if
not
overwrite
:
continue
continue
tar
.
extract
(
file_
,
to_path
)
tar
.
extract
(
file_
,
to_path
)
...
@@ -30,12 +31,11 @@ def _extract_zip(from_path: str, to_path: Optional[str] = None, overwrite: bool
...
@@ -30,12 +31,11 @@ def _extract_zip(from_path: str, to_path: Optional[str] = None, overwrite: bool
to_path
=
os
.
path
.
dirname
(
from_path
)
to_path
=
os
.
path
.
dirname
(
from_path
)
with
zipfile
.
ZipFile
(
from_path
,
"r"
)
as
zfile
:
with
zipfile
.
ZipFile
(
from_path
,
"r"
)
as
zfile
:
logging
.
info
(
"Opened zip file {}."
,
from_path
)
files
=
zfile
.
namelist
()
files
=
zfile
.
namelist
()
for
file_
in
files
:
for
file_
in
files
:
file_path
=
os
.
path
.
join
(
to_path
,
file_
)
file_path
=
os
.
path
.
join
(
to_path
,
file_
)
if
os
.
path
.
exists
(
file_path
):
if
os
.
path
.
exists
(
file_path
):
logging
.
info
(
"
{}
already extracted."
.
format
(
file_path
)
)
_LG
.
info
(
"
%s
already extracted."
,
file_path
)
if
not
overwrite
:
if
not
overwrite
:
continue
continue
zfile
.
extract
(
file_
,
to_path
)
zfile
.
extract
(
file_
,
to_path
)
...
...
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