@@ -57,6 +57,9 @@ def test_anything(self):
57
57
logging .getLogger ("urllib3" ).setLevel (logging .ERROR )
58
58
urllib3 .disable_warnings ()
59
59
LOGGER .setLevel (logging .WARNING )
60
+ if sys .version_info [0 ] < 3 :
61
+ reload (sys ) # noqa: F821
62
+ sys .setdefaultencoding ("utf8" )
60
63
61
64
62
65
class BaseCase (unittest .TestCase ):
@@ -3248,14 +3251,14 @@ def print_unique_links_with_status_codes(self):
3248
3251
3249
3252
def __fix_unicode_conversion (self , text ):
3250
3253
""" Fixing Chinese characters when converting from PDF to HTML. """
3251
- if sys .version_info [0 ] < 3 :
3252
- # Update encoding for Python 2 users
3253
- reload (sys ) # noqa
3254
- sys .setdefaultencoding ("utf8" )
3255
3254
text = text .replace ("\u2f8f " , "\u884c " )
3256
3255
text = text .replace ("\u2f45 " , "\u65b9 " )
3257
3256
text = text .replace ("\u2f08 " , "\u4eba " )
3258
3257
text = text .replace ("\u2f70 " , "\u793a " )
3258
+ text = text .replace ("\xe2 \xbe \x8f " , "\xe8 \xa1 \x8c " )
3259
+ text = text .replace ("\xe2 \xbd \xb0 " , "\xe7 \xa4 \xba " )
3260
+ text = text .replace ("\xe2 \xbe \x8f " , "\xe8 \xa1 \x8c " )
3261
+ text = text .replace ("\xe2 \xbd \x85 " , "\xe6 \x96 \xb9 " )
3259
3262
return text
3260
3263
3261
3264
def get_pdf_text (
@@ -8114,7 +8117,7 @@ def __recalculate_selector(self, selector, by, xp_ok=True):
8114
8117
_type = type (selector ) # First make sure the selector is a string
8115
8118
not_string = False
8116
8119
if sys .version_info [0 ] < 3 :
8117
- if _type is not str and _type is not unicode : # noqa
8120
+ if _type is not str and _type is not unicode : # noqa: F821
8118
8121
not_string = True
8119
8122
else :
8120
8123
if _type is not str :
0 commit comments