| 947 | return state |
| 948 | |
| 949 | def __setitem__(self, key, value): |
| 950 | if key != "_box_config" and self._box_config["frozen_box"] and self._box_config["__created"]: |
| 951 | raise BoxError("Box is frozen") |
| 952 | if self.__process_dotted_key(key): |
| 953 | first_item, children = _parse_box_dots(self, key) |
| 954 | first_item = self.__dots_int_key(first_item) |
| 955 | if first_item in self.keys(): |
| 956 | child = self[first_item] |
| 957 | if isinstance(child, Box): |
| 958 | children = child.__dots_int_key(children) |
| 959 | if hasattr(child, "__setitem__"): |
| 960 | return child.__setitem__(children, value) |
| 961 | elif self._box_config["default_box"]: |
| 962 | self._flush_pending_parent() |
| 963 | if children.startswith("["): |
| 964 | super().__setitem__(first_item, box.BoxList(**self.__box_config(extra_namespace=first_item))) |
| 965 | else: |
| 966 | super().__setitem__( |
| 967 | first_item, self._box_config["box_class"](**self.__box_config(extra_namespace=first_item)) |
| 968 | ) |
| 969 | return self[first_item].__setitem__(children, value) |
| 970 | else: |
| 971 | raise BoxKeyError(f"'{self.__class__}' object has no attribute {first_item}") |
| 972 | value = self.__recast(key, value) |
| 973 | if key not in self.keys() and self.__camel_destructive(): |
| 974 | if isinstance(key, str): |
| 975 | key = _camel_killer(key) |
| 976 | if self._box_config["conversion_box"] and self._box_config["box_duplicates"] != "ignore": |
| 977 | self._conversion_checks(key) |
| 978 | self.__convert_and_store(key, value) |
| 979 | |
| 980 | def __setattr__(self, key, value): |
| 981 | if key == "_box_config": |