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

Method parse_content

tools/ng/config.py:96–115  ·  view source on GitHub ↗

Parse configuration content. Args: content: File content Returns: Dictionary of configuration options

(self, content: str)

Source from the content-addressed store, hash-verified

94 return self.parse_content(content)
95
96 def parse_content(self, content: str) -> Dict[str, ConfigOption]:
97 """
98 Parse configuration content.
99
100 Args:
101 content: File content
102
103 Returns:
104 Dictionary of configuration options
105 """
106 # Remove comments
107 content = self.RE_COMMENT.sub('', content)
108 content = self.RE_LINE_COMMENT.sub('', content)
109
110 # Parse line by line
111 lines = content.split('\n')
112 for i, line in enumerate(lines):
113 self._parse_line(line, i + 1)
114
115 return self.options
116
117 def _parse_line(self, line: str, line_number: int) -> None:
118 """Parse a single line."""

Callers 1

parse_fileMethod · 0.95

Calls 1

_parse_lineMethod · 0.95

Tested by

no test coverage detected