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
MMCV
Commits
02ceae83
Commit
02ceae83
authored
Aug 28, 2018
by
Kai Chen
Browse files
add symlink method
parent
2f49db9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
mmcv/__init__.py
mmcv/__init__.py
+1
-1
mmcv/utils/path.py
mmcv/utils/path.py
+9
-0
No files found.
mmcv/__init__.py
View file @
02ceae83
...
@@ -5,4 +5,4 @@ from .opencv_info import *
...
@@ -5,4 +5,4 @@ from .opencv_info import *
from
.image
import
*
from
.image
import
*
from
.video
import
*
from
.video
import
*
from
.visualization
import
*
from
.visualization
import
*
from
.version
import
*
from
.version
import
__version__
mmcv/utils/path.py
View file @
02ceae83
...
@@ -33,6 +33,9 @@ def check_file_exist(filename, msg_tmpl='file "{}" does not exist'):
...
@@ -33,6 +33,9 @@ def check_file_exist(filename, msg_tmpl='file "{}" does not exist'):
def
mkdir_or_exist
(
dir_name
,
mode
=
0o777
):
def
mkdir_or_exist
(
dir_name
,
mode
=
0o777
):
if
dir_name
==
''
:
return
dir_name
=
osp
.
expanduser
(
dir_name
)
if
six
.
PY3
:
if
six
.
PY3
:
os
.
makedirs
(
dir_name
,
mode
=
mode
,
exist_ok
=
True
)
os
.
makedirs
(
dir_name
,
mode
=
mode
,
exist_ok
=
True
)
else
:
else
:
...
@@ -40,6 +43,12 @@ def mkdir_or_exist(dir_name, mode=0o777):
...
@@ -40,6 +43,12 @@ def mkdir_or_exist(dir_name, mode=0o777):
os
.
makedirs
(
dir_name
,
mode
=
0o777
)
os
.
makedirs
(
dir_name
,
mode
=
0o777
)
def
symlink
(
src
,
dst
,
overwrite
=
True
,
**
kwargs
):
if
os
.
path
.
lexists
(
dst
)
and
overwrite
:
os
.
remove
(
dst
)
os
.
symlink
(
src
,
dst
,
**
kwargs
)
def
_scandir_py35
(
dir_path
,
suffix
=
None
):
def
_scandir_py35
(
dir_path
,
suffix
=
None
):
for
entry
in
os
.
scandir
(
dir_path
):
for
entry
in
os
.
scandir
(
dir_path
):
if
not
entry
.
is_file
():
if
not
entry
.
is_file
():
...
...
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