| OLD | NEW | 
|---|
| 1 # This file is part of Adblock Plus <https://adblockplus.org/>, | 1 # This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 299             return Header(match.group(1)) | 299             return Header(match.group(1)) | 
| 300 | 300 | 
| 301     if stripped.startswith('!'): | 301     if stripped.startswith('!'): | 
| 302         match = METADATA_REGEXP.match(line) | 302         match = METADATA_REGEXP.match(line) | 
| 303         if match: | 303         if match: | 
| 304             key, value = match.groups() | 304             key, value = match.groups() | 
| 305             if position != 'body' or key.lower() == 'checksum': | 305             if position != 'body' or key.lower() == 'checksum': | 
| 306                 return Metadata(key, value) | 306                 return Metadata(key, value) | 
| 307         return Comment(stripped[1:].lstrip()) | 307         return Comment(stripped[1:].lstrip()) | 
| 308 | 308 | 
| 309     if stripped.startswith('%') and stripped.endswith('%'): | 309     if stripped.startswith('%include') and stripped.endswith('%'): | 
| 310         return _parse_instruction(stripped) | 310         return _parse_instruction(stripped) | 
| 311 | 311 | 
| 312     return parse_filter(stripped) | 312     return parse_filter(stripped) | 
| 313 | 313 | 
| 314 | 314 | 
| 315 def parse_filterlist(lines): | 315 def parse_filterlist(lines): | 
| 316     """Parse filter list from an iterable. | 316     """Parse filter list from an iterable. | 
| 317 | 317 | 
| 318     Parameters | 318     Parameters | 
| 319     ---------- | 319     ---------- | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 338     for line in lines: | 338     for line in lines: | 
| 339         parsed_line = parse_line(line, position) | 339         parsed_line = parse_line(line, position) | 
| 340         yield parsed_line | 340         yield parsed_line | 
| 341 | 341 | 
| 342         if position != 'body' and parsed_line.type in {'header', 'metadata'}: | 342         if position != 'body' and parsed_line.type in {'header', 'metadata'}: | 
| 343             # Continue parsing metadata until it's over... | 343             # Continue parsing metadata until it's over... | 
| 344             position = 'metadata' | 344             position = 'metadata' | 
| 345         else: | 345         else: | 
| 346             # ...then switch to parsing the body. | 346             # ...then switch to parsing the body. | 
| 347             position = 'body' | 347             position = 'body' | 
| OLD | NEW | 
|---|