(self)
| 1939 | |
| 1940 | |
| 1941 | def _patch_dict(self): |
| 1942 | values = self.values |
| 1943 | if isinstance(self.in_dict, str): |
| 1944 | self.in_dict = pkgutil.resolve_name(self.in_dict) |
| 1945 | in_dict = self.in_dict |
| 1946 | clear = self.clear |
| 1947 | |
| 1948 | try: |
| 1949 | original = in_dict.copy() |
| 1950 | except AttributeError: |
| 1951 | # dict like object with no copy method |
| 1952 | # must support iteration over keys |
| 1953 | original = {} |
| 1954 | for key in in_dict: |
| 1955 | original[key] = in_dict[key] |
| 1956 | self._original = original |
| 1957 | |
| 1958 | if clear: |
| 1959 | _clear_dict(in_dict) |
| 1960 | |
| 1961 | try: |
| 1962 | in_dict.update(values) |
| 1963 | except AttributeError: |
| 1964 | # dict like object with no update method |
| 1965 | for key in values: |
| 1966 | in_dict[key] = values[key] |
| 1967 | |
| 1968 | |
| 1969 | def _unpatch_dict(self): |
no test coverage detected