Unverified Commit ac52bb37 authored by Tan SU's avatar Tan SU Committed by GitHub
Browse files

[fix] config ignore imported modules and functions (#1802)

* [fix] config ignore modules and functions

* add unitest
parent 42062ede
...@@ -7,6 +7,7 @@ import platform ...@@ -7,6 +7,7 @@ import platform
import shutil import shutil
import sys import sys
import tempfile import tempfile
import types
import uuid import uuid
import warnings import warnings
from argparse import Action, ArgumentParser from argparse import Action, ArgumentParser
...@@ -209,6 +210,8 @@ class Config: ...@@ -209,6 +210,8 @@ class Config:
name: value name: value
for name, value in mod.__dict__.items() for name, value in mod.__dict__.items()
if not name.startswith('__') if not name.startswith('__')
and not isinstance(value, types.ModuleType)
and not isinstance(value, types.FunctionType)
} }
# delete imported module # delete imported module
del sys.modules[temp_module_name] del sys.modules[temp_module_name]
......
# Copyright (c) OpenMMLab. All rights reserved. # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
def func(x):
return x
_base_ = ['./l1.py', './l2.yaml', './l3.json', './l4.py'] _base_ = ['./l1.py', './l2.yaml', './l3.json', './l4.py']
item3 = False item3 = False
item4 = 'test' item4 = 'test'
# Copyright (c) OpenMMLab. All rights reserved. # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
def func(x):
return x
test_item1 = [1, 2] test_item1 = [1, 2]
bool_item2 = True bool_item2 = True
str_item3 = 'test' str_item3 = 'test'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment