|
1 | | -from collections import Mapping, Sequence |
| 1 | +from collections import Mapping |
2 | 2 | from warnings import warn |
3 | 3 |
|
4 | 4 | from six import with_metaclass |
5 | 5 |
|
6 | | -from valid8 import validate |
7 | | - |
8 | 6 | try: # python 3+ |
9 | 7 | from inspect import signature |
10 | 8 | except ImportError: |
|
21 | 19 | pass |
22 | 20 |
|
23 | 21 | from autoclass.autoprops_ import DuplicateOverrideError |
24 | | -from autoclass.utils import is_attr_selected, method_already_there, possibly_replace_with_property_name |
| 22 | +from autoclass.utils import is_attr_selected, method_already_there, possibly_replace_with_property_name, \ |
| 23 | + validate_include_exclude |
25 | 24 | from autoclass.utils import get_constructor |
26 | 25 | from autoclass.utils import _check_known_decorators |
27 | 26 |
|
@@ -123,11 +122,8 @@ def _execute_autodict_on_class(object_type, # type: Type[T] |
123 | 122 | hidden |
124 | 123 | :return: |
125 | 124 | """ |
126 | | - |
127 | | - if include is not None and exclude is not None: |
128 | | - raise ValueError('Only one of \'include\' or \'exclude\' argument should be provided.') |
129 | | - validate('include', include, instance_of=[str, Sequence], enforce_not_none=False) |
130 | | - validate('exclude', exclude, instance_of=[str, Sequence], enforce_not_none=False) |
| 125 | + # 0. first check parameters |
| 126 | + validate_include_exclude(include, exclude) |
131 | 127 |
|
132 | 128 | # if issubclass(object_type, Mapping): |
133 | 129 | # raise ValueError('@autodict can not be set on classes that are already subclasses of Mapping, and therefore ' |
|
0 commit comments