MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / __init__

Method __init__

bleachbit/Options.py:133–159  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

131 """Store and retrieve user preferences"""
132
133 def __init__(self):
134 self.purged = False
135 self.config = bleachbit.RawConfigParser()
136 self.config.optionxform = str # make keys case sensitive for hashpath purging
137 self.config.BOOLEAN_STATES['t'] = True
138 self.config.BOOLEAN_STATES['f'] = False
139 self.overrides = {}
140 self.old_version = None # Store previous version in memory
141 self._dirty = False
142 self._closed = False
143 self._flush_generation = 0
144 self._flush_lock = threading.RLock()
145 self._flush_timer = None
146 self._atexit_close = self.close
147 atexit.register(self._atexit_close)
148 self.restore()
149
150 old_option = 'system.free_disk_space'
151 try:
152 if self.config.has_section("tree") and self.config.has_option('tree', old_option):
153 logger.debug(
154 "Migrating legacy option '%s' to 'system.empty_space'", old_option)
155 self.config.set('tree', 'system.empty_space', 'true')
156 self.config.remove_option('tree', old_option)
157 self.__schedule_flush()
158 except Exception:
159 logger.exception("Error migrating legacy option '%s'", old_option)
160
161 def __cancel_flush_timer(self):
162 """Invalidate and stop any pending delayed flush timer."""

Callers

nothing calls this directly

Calls 4

restoreMethod · 0.95
__schedule_flushMethod · 0.95
has_optionMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected