MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _parse_value

Method _parse_value

tools/ng/config.py:147–168  ·  view source on GitHub ↗

Parse configuration value. Returns: Tuple of (parsed_value, ConfigType)

(self, value: str)

Source from the content-addressed store, hash-verified

145 return
146
147 def _parse_value(self, value: str) -> tuple:
148 """
149 Parse configuration value.
150
151 Returns:
152 Tuple of (parsed_value, ConfigType)
153 """
154 if not value or value == '1':
155 return (True, ConfigType.BOOLEAN)
156
157 # Try integer
158 try:
159 return (int(value, 0), ConfigType.INTEGER) # Support hex/octal
160 except ValueError:
161 pass
162
163 # Try string (remove quotes)
164 if value.startswith('"') and value.endswith('"'):
165 return (value[1:-1], ConfigType.STRING)
166
167 # Default to string
168 return (value, ConfigType.STRING)
169
170
171class ConfigManager:

Callers 1

_parse_lineMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected