Skip to content

Commit d5fd1b8

Browse files
committed
PEP 621 & 660 migration
1 parent c1724c6 commit d5fd1b8

File tree

319 files changed

+7711
-52964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+7711
-52964
lines changed

.pre-commit-config-zh-cn.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@ repos:
44
rev: v4.0.0
55
hooks:
66
- id: validate_manifest
7-
- repo: https://github.com/PyCQA/flake8
8-
rev: 7.1.1
9-
hooks:
10-
- id: flake8
11-
- repo: https://gitee.com/openmmlab/mirrors-isort
12-
rev: 5.11.5
13-
hooks:
14-
- id: isort
15-
- repo: https://gitee.com/openmmlab/mirrors-yapf
16-
rev: v0.32.0
17-
hooks:
18-
- id: yapf
197
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
208
rev: v5.0.0
219
hooks:

docs/en/conf.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@
1515

1616
import pytorch_sphinx_theme
1717

18-
sys.path.insert(0, os.path.abspath('../..'))
18+
19+
sys.path.insert(0, os.path.abspath("../.."))
1920

2021
# -- Project information -----------------------------------------------------
2122

22-
project = 'mmengine'
23-
copyright = '2022, mmengine contributors'
24-
author = 'mmengine contributors'
23+
project = "mmengine"
24+
copyright = "2022, mmengine contributors"
25+
author = "mmengine contributors"
2526

26-
version_file = '../../mmengine/version.py'
27+
version_file = "../../mmengine/version.py"
2728
with open(version_file) as f:
28-
exec(compile(f.read(), version_file, 'exec'))
29-
__version__ = locals()['__version__']
29+
exec(compile(f.read(), version_file, "exec"))
30+
__version__ = locals()["__version__"]
3031
# The short X.Y version
3132
version = __version__
3233
# The full version, including alpha/beta/rc tags
@@ -49,52 +50,49 @@
4950
'sphinx.ext.autodoc.typehints',
5051
'sphinx_tabs.tabs',
5152
] # yapf: disable
52-
autodoc_typehints = 'description'
53+
autodoc_typehints = "description"
5354
myst_heading_anchors = 4
54-
myst_enable_extensions = ['colon_fence']
55+
myst_enable_extensions = ["colon_fence"]
5556

5657
# Configuration for intersphinx
5758
intersphinx_mapping = {
58-
'python': ('https://docs.python.org/3', None),
59-
'numpy': ('https://numpy.org/doc/stable', None),
60-
'torch': ('https://pytorch.org/docs/stable/', None),
61-
'mmcv': ('https://mmcv.readthedocs.io/en/2.x/', None),
59+
"python": ("https://docs.python.org/3", None),
60+
"numpy": ("https://numpy.org/doc/stable", None),
61+
"torch": ("https://pytorch.org/docs/stable/", None),
62+
"mmcv": ("https://mmcv.readthedocs.io/en/2.x/", None),
6263
}
6364

6465
# Add any paths that contain templates here, relative to this directory.
65-
templates_path = ['_templates']
66+
templates_path = ["_templates"]
6667

6768
# List of patterns, relative to source directory, that match files and
6869
# directories to ignore when looking for source files.
6970
# This pattern also affects html_static_path and html_extra_path.
70-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
71+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7172

7273
# -- Options for HTML output -------------------------------------------------
7374

7475
# The theme to use for HTML and HTML Help pages. See the documentation for
7576
# a list of builtin themes.
7677
#
77-
html_theme = 'pytorch_sphinx_theme'
78+
html_theme = "pytorch_sphinx_theme"
7879
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
7980

8081
html_theme_options = {
81-
'menu': [
82-
{
83-
'name': 'GitHub',
84-
'url': 'https://github.com/open-mmlab/mmengine'
85-
},
82+
"menu": [
83+
{"name": "GitHub", "url": "https://github.com/open-mmlab/mmengine"},
8684
],
8785
# Specify the language of shared menu
88-
'menu_lang': 'en',
86+
"menu_lang": "en",
8987
}
9088

9189
# Add any paths that contain custom static files (such as style sheets) here,
9290
# relative to this directory. They are copied after the builtin static files,
9391
# so a file named "default.css" will overwrite the builtin "default.css".
94-
html_static_path = ['_static']
95-
html_css_files = ['css/readthedocs.css']
92+
html_static_path = ["_static"]
93+
html_css_files = ["css/readthedocs.css"]
9694

9795
# -- Extension configuration -------------------------------------------------
9896
# Ignore >>> when copying code
99-
copybutton_prompt_text = r'>>> |\.\.\. '
97+
copybutton_prompt_text = r">>> |\.\.\. "
10098
copybutton_prompt_is_regexp = True
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001)
1+
optimizer = dict(type="SGD", lr=0.1, momentum=0.9, weight_decay=0.0001)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_base_ = [
2-
'mmdet::_base_/schedules/schedule_1x.py',
3-
'mmdet::_base_/datasets/coco_instance.py',
4-
'mmdet::_base_/default_runtime.py',
5-
'mmdet::_base_/models/faster-rcnn_r50_fpn.py',
2+
"mmdet::_base_/schedules/schedule_1x.py",
3+
"mmdet::_base_/datasets/coco_instance.py",
4+
"mmdet::_base_/default_runtime.py",
5+
"mmdet::_base_/models/faster-rcnn_r50_fpn.py",
66
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
custom_imports = dict(imports=['my_module'], allow_failed_imports=False)
2-
optimizer = dict(type='CustomOptim')
1+
custom_imports = dict(imports=["my_module"], allow_failed_imports=False)
2+
optimizer = dict(type="CustomOptim")

docs/resources/config/demo_train.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44

55

66
def parse_args():
7-
parser = argparse.ArgumentParser(description='Train a model')
8-
parser.add_argument('config', help='train config file path')
7+
parser = argparse.ArgumentParser(description="Train a model")
8+
parser.add_argument("config", help="train config file path")
99
parser.add_argument(
10-
'--cfg-options',
11-
nargs='+',
10+
"--cfg-options",
11+
nargs="+",
1212
action=DictAction,
13-
help='override some settings in the used config, the key-value pair '
14-
'in xxx=yyy format will be merged into config file. If the value to '
13+
help="override some settings in the used config, the key-value pair "
14+
"in xxx=yyy format will be merged into config file. If the value to "
1515
'be overwritten is a list, it should be like key="[a,b]" or key=a,b '
1616
'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" '
17-
'Note that the quotation marks are necessary and that no white space '
18-
'is allowed.')
17+
"Note that the quotation marks are necessary and that no white space "
18+
"is allowed.",
19+
)
1920

2021
args = parser.parse_args()
2122
return args
@@ -29,5 +30,5 @@ def main():
2930
print(cfg)
3031

3132

32-
if __name__ == '__main__':
33+
if __name__ == "__main__":
3334
main()

docs/resources/config/example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
model = dict(type='CustomModel', in_channels=[1, 2, 3])
2-
optimizer = dict(type='SGD', lr=0.01)
1+
model = dict(type="CustomModel", in_channels=[1, 2, 3])
2+
optimizer = dict(type="SGD", lr=0.01)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
test_int = 1
22
test_list = [1, 2, 3]
3-
test_dict = dict(key1='value1', key2=0.1)
3+
test_dict = dict(key1="value1", key2=0.1)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
1+
optimizer = dict(type="SGD", lr=0.02, momentum=0.9, weight_decay=0.0001)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
work_dir = './work_dir/{{fileBasenameNoExtension}}'
1+
work_dir = "./work_dir/{{fileBasenameNoExtension}}"

0 commit comments

Comments
 (0)