MCPcopy Create free account
hub / github.com/streamlit/streamlit / __getattr__

Method __getattr__

lib/streamlit/runtime/secrets.py:558–572  ·  view source on GitHub ↗

Return the value with the given key. If no such key exists, raise an AttributeError. Thread-safe.

(self, key: str)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

_parseMethod · 0.95
AttrDictClass · 0.85

Tested by

no test coverage detected