Lines Matching refs:self
34 def __init__(self, active, name, value='', section=None): argument
35 self.active = active
36 self.name = name
37 self.value = value
38 self.section = section
57 def __init__(self): argument
58 self.settings = {}
60 def __contains__(self, name): argument
66 return name in self.settings and self.settings[name].active
68 def all(self, *names): argument
70 return all(self.__contains__(name) for name in names)
72 def any(self, *names): argument
74 return any(self.__contains__(name) for name in names)
76 def known(self, name): argument
78 return name in self.settings
80 def __getitem__(self, name): argument
85 return self.settings[name].value
87 def get(self, name, default=None): argument
95 if name in self.settings:
96 return self.settings[name].value
100 def __setitem__(self, name, value): argument
105 self.settings[name].value = value
107 def set(self, name, value=None): argument
114 if name in self.settings:
116 self.settings[name].value = value
117 self.settings[name].active = True
119 self.settings[name] = Setting(True, name, value=value)
121 def unset(self, name): argument
126 if name not in self.settings:
128 self.settings[name].active = False
130 def adapt(self, adapter): argument
140 for setting in self.settings.values():
144 def change_matching(self, regexs, enable): argument
149 for setting in self.settings.values():
365 def __init__(self, filename=None): argument
368 for candidate in self.default_path:
374 self.default_path)
376 self.filename = filename
377 self.current_section = 'header'
379 self.templates = [self._parse_line(line) for line in file]
380 self.current_section = None
382 def set(self, name, value=None): argument
383 if name not in self.settings:
384 self.templates.append((name, '', '#define ' + name + ' '))
398 def _parse_line(self, line): argument
401 m = re.match(self._config_line_regexp, line)
405 self.current_section = m.group('section')
415 self.settings[name] = Setting(active, name, value,
416 self.current_section)
419 def _format_template(self, name, indent, middle): argument
425 setting = self.settings[name]
443 def write_to_stream(self, output): argument
445 for template in self.templates:
449 line = self._format_template(*template)
452 def write(self, filename=None): argument
458 filename = self.filename
460 self.write_to_stream(output)