(k, v)
| 846 | try: |
| 847 | |
| 848 | def convert_and_set(k, v): |
| 849 | intact_type = self._box_config["box_intact_types"] and isinstance( |
| 850 | v, self._box_config["box_intact_types"] |
| 851 | ) |
| 852 | if isinstance(v, dict) and not intact_type: |
| 853 | # Box objects must be created in case they are already |
| 854 | # in the `converted` box_config set |
| 855 | v = self._box_config["box_class"](v, **self.__box_config(extra_namespace=k)) |
| 856 | if k in self and isinstance(self[k], dict): |
| 857 | self[k].merge_update(v, box_merge_lists=merge_type, _force_unfrozen=force_unfrozen) |
| 858 | return |
| 859 | if isinstance(v, list) and not intact_type: |
| 860 | v = box.BoxList(v, **self.__box_config(extra_namespace=k)) |
| 861 | if merge_type == "extend" and k in self and isinstance(self[k], list): |
| 862 | self[k].extend(v) |
| 863 | return |
| 864 | if merge_type == "unique" and k in self and isinstance(self[k], list): |
| 865 | for item in v: |
| 866 | if item not in self[k]: |
| 867 | self[k].append(item) |
| 868 | return |
| 869 | self.__setitem__(k, v) |
| 870 | |
| 871 | if (len(args) + int(bool(kwargs))) > 1: |
| 872 | raise BoxTypeError(f"merge_update expected at most 1 argument, got {len(args) + int(bool(kwargs))}") |
nothing calls this directly
no test coverage detected