diff options
| author | jvoisin | 2025-01-09 01:21:31 +0100 |
|---|---|---|
| committer | jvoisin | 2025-01-09 02:36:16 +0100 |
| commit | 6c966f2afa504570e511ee327f6fff01577ef0fc (patch) | |
| tree | 5171112a02af43bd303aabc131133ad22a3c26be /libmat2 | |
| parent | 70d236a06213ba3561637d6b02dd5094ef177dbb (diff) | |
Significantly improve portability0.13.5
Diffstat (limited to 'libmat2')
| -rw-r--r-- | libmat2/office.py | 2 | ||||
| -rw-r--r-- | libmat2/pdf.py | 4 | ||||
| -rw-r--r-- | libmat2/web.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/libmat2/office.py b/libmat2/office.py index d067128..1a793b4 100644 --- a/libmat2/office.py +++ b/libmat2/office.py | |||
| @@ -525,7 +525,7 @@ class MSOfficeParser(ZipParser): | |||
| 525 | # see: https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/mc-ignorable-attribute | 525 | # see: https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/mc-ignorable-attribute |
| 526 | with open(full_path, 'rb') as f: | 526 | with open(full_path, 'rb') as f: |
| 527 | text = f.read() | 527 | text = f.read() |
| 528 | out = re.sub(b'mc:Ignorable="[^"]*"', b'', text, 1) | 528 | out = re.sub(b'mc:Ignorable="[^"]*"', b'', text, count=1) |
| 529 | with open(full_path, 'wb') as f: | 529 | with open(full_path, 'wb') as f: |
| 530 | f.write(out) | 530 | f.write(out) |
| 531 | 531 | ||
diff --git a/libmat2/pdf.py b/libmat2/pdf.py index 2da21b5..0672214 100644 --- a/libmat2/pdf.py +++ b/libmat2/pdf.py | |||
| @@ -136,8 +136,8 @@ class PDFParser(abstract.AbstractParser): | |||
| 136 | # It should(tm) be alright though, because cairo's output format | 136 | # It should(tm) be alright though, because cairo's output format |
| 137 | # for metadata is fixed. | 137 | # for metadata is fixed. |
| 138 | with open(out_file, 'rb') as f: | 138 | with open(out_file, 'rb') as f: |
| 139 | out = re.sub(rb'<<[\s\n]*/Producer.*?>>', b' << >>', f.read(), 0, | 139 | out = re.sub(rb'<<[\s\n]*/Producer.*?>>', b' << >>', f.read(), |
| 140 | re.DOTALL | re.IGNORECASE) | 140 | count=0, flags=re.DOTALL | re.IGNORECASE) |
| 141 | with open(out_file, 'wb') as f: | 141 | with open(out_file, 'wb') as f: |
| 142 | f.write(out) | 142 | f.write(out) |
| 143 | 143 | ||
diff --git a/libmat2/web.py b/libmat2/web.py index e33288e..9bbd221 100644 --- a/libmat2/web.py +++ b/libmat2/web.py | |||
| @@ -20,7 +20,7 @@ class CSSParser(abstract.AbstractParser): | |||
| 20 | content = f.read() | 20 | content = f.read() |
| 21 | except UnicodeDecodeError: # pragma: no cover | 21 | except UnicodeDecodeError: # pragma: no cover |
| 22 | raise ValueError | 22 | raise ValueError |
| 23 | cleaned = re.sub(r'/\*.*?\*/', '', content, 0, self.flags) | 23 | cleaned = re.sub(r'/\*.*?\*/', '', content, count=0, flags=self.flags) |
| 24 | with open(self.output_filename, 'w', encoding='utf-8') as f: | 24 | with open(self.output_filename, 'w', encoding='utf-8') as f: |
| 25 | f.write(cleaned) | 25 | f.write(cleaned) |
| 26 | return True | 26 | return True |
