From 28f4587dfaa732aa8ead252fe97fbcbfca138d23 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Tue, 19 May 2020 19:56:42 +0100 Subject: [PATCH] Remove str_text from fileutil.py, strformat.py and url.py --- linkcheck/fileutil.py | 3 +-- linkcheck/strformat.py | 4 +--- linkcheck/url.py | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/linkcheck/fileutil.py b/linkcheck/fileutil.py index 234385a1..651c5d84 100644 --- a/linkcheck/fileutil.py +++ b/linkcheck/fileutil.py @@ -24,7 +24,6 @@ import tempfile import importlib from distutils.spawn import find_executable from functools import lru_cache -from builtins import str as str_text def has_module(name, without_error=True): @@ -71,7 +70,7 @@ else: def path_safe(path): """Ensure path string is compatible with the platform file system encoding.""" - if isinstance(path, str_text) and not os.path.supports_unicode_filenames: + if isinstance(path, str) and not os.path.supports_unicode_filenames: path = path.encode(FSCODING, "replace").decode(FSCODING) return path diff --git a/linkcheck/strformat.py b/linkcheck/strformat.py index b894bb47..26686cb3 100644 --- a/linkcheck/strformat.py +++ b/linkcheck/strformat.py @@ -37,8 +37,6 @@ import locale import pydoc from . import i18n -from builtins import str as str_text - def unicode_safe(s, encoding=i18n.default_encoding, errors='replace'): """Get unicode string without raising encoding errors. Unknown @@ -68,7 +66,7 @@ def ascii_safe(s): @return: encoded ASCII version of s, or None if s was None @rtype: string """ - if isinstance(s, str_text): + if isinstance(s, str): s = s.encode('ascii', 'ignore').decode('ascii') return s diff --git a/linkcheck/url.py b/linkcheck/url.py index 82fa797a..f5529981 100644 --- a/linkcheck/url.py +++ b/linkcheck/url.py @@ -22,7 +22,6 @@ import re import urllib.parse import requests -from builtins import str as str_text from . import log, LOG_CHECK @@ -173,7 +172,7 @@ def idna_encode(host): to RFC 3490. @raise: UnicodeError if hostname is not properly IDN encoded. """ - if host and isinstance(host, str_text): + if host and isinstance(host, str): try: host.encode('ascii') return host, False