Due to the way pickling works in python 3, we need to make sure the box config is created as early as possible.
(
cls,
*args: Any,
default_box: bool = False,
default_box_attr: Any = NO_DEFAULT,
default_box_none_transform: bool = True,
default_box_create_on_get: bool = True,
frozen_box: bool = False,
camel_killer_box: bool = False,
conversion_box: bool = True,
modify_tuples_box: bool = False,
box_safe_prefix: str = "x",
box_duplicates: str = "ignore",
box_intact_types: tuple | list = (),
box_recast: dict | None = None,
box_dots: bool = False,
box_dots_exclude: str | None = None,
box_class: dict | type[Box] | None = None,
box_namespace: tuple[str, ...] | Literal[False] = (),
**kwargs: Any,
)
| 191 | ] + [attr for attr in dir({}) if not attr.startswith("_")] |
| 192 | |
| 193 | def __new__( |
| 194 | cls, |
| 195 | *args: Any, |
| 196 | default_box: bool = False, |
| 197 | default_box_attr: Any = NO_DEFAULT, |
| 198 | default_box_none_transform: bool = True, |
| 199 | default_box_create_on_get: bool = True, |
| 200 | frozen_box: bool = False, |
| 201 | camel_killer_box: bool = False, |
| 202 | conversion_box: bool = True, |
| 203 | modify_tuples_box: bool = False, |
| 204 | box_safe_prefix: str = "x", |
| 205 | box_duplicates: str = "ignore", |
| 206 | box_intact_types: tuple | list = (), |
| 207 | box_recast: dict | None = None, |
| 208 | box_dots: bool = False, |
| 209 | box_dots_exclude: str | None = None, |
| 210 | box_class: dict | type[Box] | None = None, |
| 211 | box_namespace: tuple[str, ...] | Literal[False] = (), |
| 212 | **kwargs: Any, |
| 213 | ): |
| 214 | """ |
| 215 | Due to the way pickling works in python 3, we need to make sure |
| 216 | the box config is created as early as possible. |
| 217 | """ |
| 218 | obj = super().__new__(cls, *args, **kwargs) |
| 219 | obj._box_config = _get_box_config() |
| 220 | obj._box_config.update( |
| 221 | { |
| 222 | "default_box": default_box, |
| 223 | "default_box_attr": cls.__class__ if default_box_attr is NO_DEFAULT else default_box_attr, |
| 224 | "default_box_none_transform": default_box_none_transform, |
| 225 | "default_box_create_on_get": default_box_create_on_get, |
| 226 | "conversion_box": conversion_box, |
| 227 | "box_safe_prefix": box_safe_prefix, |
| 228 | "frozen_box": frozen_box, |
| 229 | "camel_killer_box": camel_killer_box, |
| 230 | "modify_tuples_box": modify_tuples_box, |
| 231 | "box_duplicates": box_duplicates, |
| 232 | "box_intact_types": tuple(box_intact_types), |
| 233 | "box_recast": box_recast, |
| 234 | "box_dots": box_dots, |
| 235 | "box_dots_exclude": re.compile(box_dots_exclude) if box_dots_exclude else None, |
| 236 | "box_class": box_class if box_class is not None else Box, |
| 237 | "box_namespace": box_namespace, |
| 238 | } |
| 239 | ) |
| 240 | return obj |
| 241 | |
| 242 | def __init__( |
| 243 | self, |
nothing calls this directly
no test coverage detected