| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 def wrapper(*args): | 354 def wrapper(*args): |
| 355 try: | 355 try: |
| 356 return memoized[args] | 356 return memoized[args] |
| 357 except KeyError: | 357 except KeyError: |
| 358 return memoized.setdefault(args, func(*args)) | 358 return memoized.setdefault(args, func(*args)) |
| 359 wrapper.cache_clear = memoized.clear | 359 wrapper.cache_clear = memoized.clear |
| 360 return wrapper | 360 return wrapper |
| 361 | 361 |
| 362 | 362 |
| 363 def create_source(path, cached=False, revision=None): | 363 def create_source(path, cached=False): |
| 364 """Create a source from path and optional revision. | 364 """Create a source from path. |
| 365 | 365 |
| 366 `cached` flag activates caching. This can be used to optimize performance | 366 `cached` flag activates caching. This can be used to optimize performance |
| 367 if no changes are expected on the filesystem after the source was created. | 367 if no changes are expected on the filesystem after the source was created. |
| 368 This is usually the case with static generation (as opposed to dynamic | 368 This is usually the case with static generation (as opposed to dynamic |
| 369 preview). | 369 preview). |
| 370 | 370 |
| 371 If `settings.ini` in the source contains `[paths]` section with an | 371 If `settings.ini` in the source contains `[paths]` section with an |
| 372 `additional-paths` key that contains the list of additional root folders, | 372 `additional-paths` key that contains the list of additional root folders, |
| 373 `MultiSource` will be instantiated and its bases will be the original | 373 `MultiSource` will be instantiated and its bases will be the original |
| 374 source plus an additional source for each additional root folder. | 374 source plus an additional source for each additional root folder. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 397 'resolve_link', | 397 'resolve_link', |
| 398 'read_config', | 398 'read_config', |
| 399 'read_template', | 399 'read_template', |
| 400 'read_locale', | 400 'read_locale', |
| 401 'read_include', | 401 'read_include', |
| 402 'exec_file', | 402 'exec_file', |
| 403 ]: | 403 ]: |
| 404 setattr(source, fname, _memoize(getattr(source, fname))) | 404 setattr(source, fname, _memoize(getattr(source, fname))) |
| 405 | 405 |
| 406 return source | 406 return source |
| OLD | NEW |