| 964 | return self._name + key |
| 965 | |
| 966 | def _parse_config(self, config): |
| 967 | cfg = {} |
| 968 | for key, value in config.items(): |
| 969 | # If the value is a plain str, we will use the value |
| 970 | # If the value is a dict, we will extract the name of an environment |
| 971 | # variable stored under 'env' and optionally a default, stored under |
| 972 | # 'default'. |
| 973 | # (This is useful if the database relocates to a different host |
| 974 | # during the lifetime of the LSH object) |
| 975 | if isinstance(value, dict): |
| 976 | if 'env' in value: |
| 977 | value = os.getenv(value['env'], value.get('default', None)) |
| 978 | cfg[key] = value |
| 979 | return cfg |
| 980 | |
| 981 | def __getstate__(self): |
| 982 | state = self.__dict__.copy() |