| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 | 265 |
| 266 for filename in files: | 266 for filename in files: |
| 267 path = os.path.join(dir, filename) | 267 path = os.path.join(dir, filename) |
| 268 if os.path.isfile(path): | 268 if os.path.isfile(path): |
| 269 result.append(relpath + filename) | 269 result.append(relpath + filename) |
| 270 elif os.path.isdir(path): | 270 elif os.path.isdir(path): |
| 271 do_list(path, relpath + filename + '/') | 271 do_list(path, relpath + filename + '/') |
| 272 do_list(self.get_path(subdir), '') | 272 do_list(self.get_path(subdir), '') |
| 273 return result | 273 return result |
| 274 | 274 |
| 275 def write_to_config(self, section, option, value): | |
| 276 config = self.read_config() | |
| 277 config.set(section, option, value) | |
| 278 config.write(open(self.get_path('settings.ini'), 'w')) | |
|
Vasily Kuznetsov
2018/09/26 10:43:17
You need to close the file here. I don't think con
Tudor Avram
2018/10/04 06:48:10
Done.
| |
| 279 | |
| 275 def get_cache_dir(self): | 280 def get_cache_dir(self): |
| 276 return os.path.join(self._dir, 'cache') | 281 return os.path.join(self._dir, 'cache') |
| 277 | 282 |
| 278 | 283 |
| 279 class MultiSource(Source): | 284 class MultiSource(Source): |
| 280 """A source that combines the contents of multiple other sources.""" | 285 """A source that combines the contents of multiple other sources.""" |
| 281 | 286 |
| 282 def __init__(self, base_sources): | 287 def __init__(self, base_sources): |
| 283 self._bases = base_sources | 288 self._bases = base_sources |
| 284 | 289 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 'resolve_link', | 402 'resolve_link', |
| 398 'read_config', | 403 'read_config', |
| 399 'read_template', | 404 'read_template', |
| 400 'read_locale', | 405 'read_locale', |
| 401 'read_include', | 406 'read_include', |
| 402 'exec_file', | 407 'exec_file', |
| 403 ]: | 408 ]: |
| 404 setattr(source, fname, _memoize(getattr(source, fname))) | 409 setattr(source, fname, _memoize(getattr(source, fname))) |
| 405 | 410 |
| 406 return source | 411 return source |
| OLD | NEW |