Return the value with the given key. If no such key exists, raise an AttributeError. Thread-safe.
(self, key: str)
| 556 | self.file_change_listener.send() |
| 557 | |
| 558 | def __getattr__(self, key: str) -> Any: |
| 559 | """Return the value with the given key. If no such key |
| 560 | exists, raise an AttributeError. |
| 561 | |
| 562 | Thread-safe. |
| 563 | """ |
| 564 | try: |
| 565 | value = self._parse()[key] |
| 566 | if not isinstance(value, Mapping): |
| 567 | return value |
| 568 | return AttrDict(value) |
| 569 | # We add FileNotFoundError since __getattr__ is expected to only raise |
| 570 | # AttributeError and mocking utilities expect that contract. |
| 571 | except (KeyError, FileNotFoundError): |
| 572 | raise AttributeError(_missing_attr_error_message(key)) |
| 573 | |
| 574 | def __getitem__(self, key: str) -> Any: |
| 575 | """Return the value with the given key. If no such key |
nothing calls this directly
no test coverage detected