This commit is contained in:
2020-09-01 17:56:18 +08:00
parent e71e8d95d0
commit 14d4247112
11 changed files with 563 additions and 7 deletions

View File

@@ -2,7 +2,7 @@ import inspect
from omegaconf.dictconfig import DictConfig
from omegaconf import OmegaConf
from types import ModuleType
import warnings
class _Registry:
def __init__(self, name):
@@ -51,6 +51,12 @@ class _Registry:
else:
raise TypeError(f'cfg must be a dict or a str, but got {type(cfg)}')
for k in args:
assert isinstance(k, str)
if k.startswith("_"):
warnings.warn(f"got param start with `_`: {k}, will remove it")
args.pop(k)
if not (isinstance(default_args, dict) or default_args is None):
raise TypeError('default_args must be a dict or None, '
f'but got {type(default_args)}')