jenkins-bot submitted this change.

View Change


Approvals: D3r1ck01: Looks good to me, approved Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] use pathlib instead of codecs for reflinks.py

Change-Id: Ib2315249fd4c210e8f1649ffa45c4247e19b2c6c
---
M scripts/reflinks.py
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index 9fbd2f5..eb673b2 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -46,7 +46,6 @@
#
# Distributed under the terms of the MIT license.
#
-import codecs
import http.client as httplib
import itertools
import os
@@ -57,6 +56,7 @@
from enum import IntEnum
from functools import partial
from http import HTTPStatus
+from pathlib import Path
from textwrap import shorten

import pywikibot
@@ -527,8 +527,8 @@
def setup(self):
"""Read dead links from file."""
try:
- with codecs.open(listof404pages, 'r', 'latin_1') as f:
- self.dead_links = f.read()
+ path = Path(listof404pages)
+ self.dead_links = path.read_text(encoding='latin_1')
except OSError:
raise NotImplementedError(
'404-links.txt is required for reflinks.py\n'

To view, visit change 862270. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib2315249fd4c210e8f1649ffa45c4247e19b2c6c
Gerrit-Change-Number: 862270
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged