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