Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICV-mmengine_basecode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Schiffel
ICV-mmengine_basecode
Commits
38b22d9e
Unverified
Commit
38b22d9e
authored
2 years ago
by
jbwang1997
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Enhance] Enhance error report when a module has been registered in registery. (#264)
* Update * Add unittest
parent
172b9ded
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mmengine/registry/registry.py
+3
-2
3 additions, 2 deletions
mmengine/registry/registry.py
tests/test_registry/test_registry.py
+2
-1
2 additions, 1 deletion
tests/test_registry/test_registry.py
with
5 additions
and
3 deletions
mmengine/registry/registry.py
+
3
−
2
View file @
38b22d9e
...
...
@@ -480,8 +480,9 @@ class Registry:
module_name
=
[
module_name
]
for
name
in
module_name
:
if
not
force
and
name
in
self
.
_module_dict
:
raise
KeyError
(
f
'
{
name
}
is already registered
'
f
'
in
{
self
.
name
}
'
)
existed_module
=
self
.
module_dict
[
name
]
raise
KeyError
(
f
'
{
name
}
is already registered in
{
self
.
name
}
'
f
'
at
{
existed_module
.
__module__
}
'
)
self
.
_module_dict
[
name
]
=
module_class
def
register_module
(
...
...
This diff is collapsed.
Click to expand it.
tests/test_registry/test_registry.py
+
2
−
1
View file @
38b22d9e
...
...
@@ -115,7 +115,8 @@ class TestRegistry:
# force=False
with
pytest
.
raises
(
KeyError
,
match
=
'
BritishShorthair is already registered in cat
'
):
match
=
'
BritishShorthair is already registered in cat
'
'
at test_registry
'
):
@CATS.register_module
()
class
BritishShorthair
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment