|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
5 |
| -import codecs |
6 | 5 | import operator
|
7 | 6 | import os
|
8 | 7 | import os.path
|
@@ -212,7 +211,7 @@ def should_write(filepath: Path, new_content: str) -> bool:
|
212 | 211 | if not filepath.exists():
|
213 | 212 | return True
|
214 | 213 | try:
|
215 |
| - with codecs.open(str(filepath), encoding='utf-8') as oldpot: |
| 214 | + with open(filepath, encoding='utf-8') as oldpot: |
216 | 215 | old_content = oldpot.read()
|
217 | 216 | old_header_index = old_content.index('"POT-Creation-Date:')
|
218 | 217 | new_header_index = new_content.index('"POT-Creation-Date:')
|
@@ -275,7 +274,7 @@ def _extract_from_template(self) -> None:
|
275 | 274 | self.config.verbosity,
|
276 | 275 | ):
|
277 | 276 | try:
|
278 |
| - with codecs.open(template, encoding='utf-8') as f: |
| 277 | + with open(template, encoding='utf-8') as f: |
279 | 278 | context = f.read()
|
280 | 279 | for line, _meth, msg in extract_translations(context):
|
281 | 280 | origin = MsgOrigin(source=template, line=line)
|
@@ -326,7 +325,7 @@ def finish(self) -> None:
|
326 | 325 |
|
327 | 326 | pofn = self.outdir / f'{textdomain}.pot'
|
328 | 327 | if should_write(pofn, content):
|
329 |
| - with codecs.open(str(pofn), 'w', encoding='utf-8') as pofile: |
| 328 | + with open(pofn, 'w', encoding='utf-8') as pofile: |
330 | 329 | pofile.write(content)
|
331 | 330 |
|
332 | 331 |
|
|
0 commit comments