MCPcopy Create free account
hub / github.com/NVlabs/sage / get_variable

Method get_variable

IsaacLab/docker/utils/state_file.py:78–101  ·  view source on GitHub ↗

Get a variable from the configuration object. Note: Since we use the ConfigParser class, the section names are case-sensitive but the keys are not. Args: key: The key of the variable to be loaded. section: The section of the configuration object

(self, key: str, section: str | None = None)

Source from the content-addressed store, hash-verified

76 self.loaded_cfg.set(section, key, value)
77
78 def get_variable(self, key: str, section: str | None = None) -> Any:
79 """Get a variable from the configuration object.
80
81 Note:
82 Since we use the ConfigParser class, the section names are case-sensitive but the keys are not.
83
84 Args:
85 key: The key of the variable to be loaded.
86 section: The section of the configuration object to read the variable from.
87 Defaults to None, in which case the default section is used.
88
89 Returns:
90 The value of the variable. It is None if the key does not exist.
91
92 Raises:
93 configparser.Error: If no section is specified and the default section is None.
94 """
95 # resolve the section
96 if section is None:
97 if self.namespace is None:
98 raise configparser.Error("No section specified. Please specify a section or set StateFile.namespace.")
99 section = self.namespace
100
101 return self.loaded_cfg.get(section, key, fallback=None)
102
103 def delete_variable(self, key: str, section: str | None = None):
104 """Delete a variable from the configuration object.

Callers 4

configure_x11Function · 0.80
x11_checkFunction · 0.80
x11_cleanupFunction · 0.80
x11_refreshFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected