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
83bcd113
Unverified
Commit
83bcd113
authored
May 14, 2020
by
Jerry Jiarui XU
Committed by
GitHub
May 14, 2020
Browse files
Add yapf for Config.pretty_text (#281)
* add yapf for pretty text * add yapf style
parent
a805cd9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
mmcv/utils/config.py
mmcv/utils/config.py
+7
-0
requirements.txt
requirements.txt
+1
-0
setup.cfg
setup.cfg
+1
-1
No files found.
mmcv/utils/config.py
View file @
83bcd113
...
@@ -8,6 +8,7 @@ from collections import abc
...
@@ -8,6 +8,7 @@ from collections import abc
from
importlib
import
import_module
from
importlib
import
import_module
from
addict
import
Dict
from
addict
import
Dict
from
yapf.yapflib.yapf_api
import
FormatCode
from
.path
import
check_file_exist
from
.path
import
check_file_exist
...
@@ -262,6 +263,12 @@ class Config(object):
...
@@ -262,6 +263,12 @@ class Config(object):
cfg_dict
=
self
.
_cfg_dict
.
to_dict
()
cfg_dict
=
self
.
_cfg_dict
.
to_dict
()
text
=
_format_dict
(
cfg_dict
,
outest_level
=
True
)
text
=
_format_dict
(
cfg_dict
,
outest_level
=
True
)
# copied from setup.cfg
yapf_style
=
dict
(
based_on_style
=
'pep8'
,
blank_line_before_nested_class_or_def
=
True
,
split_before_expression_after_opening_paren
=
True
)
text
,
_
=
FormatCode
(
text
,
style_config
=
yapf_style
,
verify
=
True
)
return
text
return
text
...
...
requirements.txt
View file @
83bcd113
addict
addict
numpy
numpy
pyyaml
pyyaml
yapf
setup.cfg
View file @
83bcd113
...
@@ -17,6 +17,6 @@ line_length = 79
...
@@ -17,6 +17,6 @@ line_length = 79
multi_line_output = 0
multi_line_output = 0
known_standard_library = pkg_resources,setuptools
known_standard_library = pkg_resources,setuptools
known_first_party = mmcv
known_first_party = mmcv
known_third_party = Cython,addict,cv2,numpy,pytest,resnet_cifar,torch,torchvision,yaml
known_third_party = Cython,addict,cv2,numpy,pytest,resnet_cifar,torch,torchvision,yaml
,yapf
no_lines_before = STDLIB,LOCALFOLDER
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY
default_section = THIRDPARTY
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