(
self,
dataclass_types: Optional[Union[DataClassType, Iterable[DataClassType]]] = None,
**kwargs,
)
| 160 | """ |
| 161 | |
| 162 | def __init__( |
| 163 | self, |
| 164 | dataclass_types: Optional[Union[DataClassType, Iterable[DataClassType]]] = None, |
| 165 | **kwargs, |
| 166 | ): |
| 167 | # Make sure dataclass_types is an iterable |
| 168 | if dataclass_types is None: |
| 169 | dataclass_types = [] |
| 170 | elif not isinstance(dataclass_types, Iterable): |
| 171 | dataclass_types = [dataclass_types] |
| 172 | |
| 173 | # Check that none of the dataclasses have the "config" field |
| 174 | for dataclass_type in dataclass_types: |
| 175 | if "config" in dataclass_type.__dataclass_fields__: |
| 176 | raise ValueError( |
| 177 | f"Dataclass {dataclass_type.__name__} has a field named 'config'. This field is reserved for the " |
| 178 | f"config file path and should not be used in the dataclass." |
| 179 | ) |
| 180 | |
| 181 | super().__init__(dataclass_types=dataclass_types, **kwargs) |
| 182 | |
| 183 | def parse_args_and_config( |
| 184 | self, |
nothing calls this directly
no outgoing calls
no test coverage detected