MCPcopy Create free account
hub / github.com/ipython/traitlets / get

Method get

traitlets/config/manager.py:55–66  ·  view source on GitHub ↗

Retrieve the config data for the specified section. Returns the data as a dictionary, or an empty dictionary if the file doesn't exist.

(self, section_name: str)

Source from the content-addressed store, hash-verified

53 return os.path.join(self.config_dir, section_name + ".json")
54
55 def get(self, section_name: str) -> Any:
56 """Retrieve the config data for the specified section.
57
58 Returns the data as a dictionary, or an empty dictionary if the file
59 doesn't exist.
60 """
61 filename = self.file_name(section_name)
62 if os.path.isfile(filename):
63 with open(filename, encoding="utf-8") as f:
64 return json.load(f)
65 else:
66 return {}
67
68 def set(self, section_name: str, data: Any) -> None:
69 """Store the given config data."""

Callers 1

updateMethod · 0.95

Calls 1

file_nameMethod · 0.95

Tested by

no test coverage detected