Skip to content

Commit

Permalink
remove some leftover python 2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Nov 21, 2022
1 parent c5308a7 commit 37e1ed6
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pycodestyle.py
Expand Up @@ -47,7 +47,9 @@
900 syntax error
"""
import bisect
import configparser
import inspect
import io
import keyword
import os
import re
Expand All @@ -59,12 +61,6 @@
from functools import lru_cache
from optparse import OptionParser

try:
from configparser import RawConfigParser
from io import TextIOWrapper
except ImportError:
from ConfigParser import RawConfigParser

# this is a performance hack. see https://bugs.python.org/issue43014
if (
sys.version_info < (3, 10) and
Expand Down Expand Up @@ -1769,7 +1765,7 @@ def readlines(filename):

def stdin_get_value():
"""Read the value from stdin."""
return TextIOWrapper(sys.stdin.buffer, errors='ignore').read()
return io.TextIOWrapper(sys.stdin.buffer, errors='ignore').read()


noqa = lru_cache(512)(re.compile(r'# no(?:qa|pep8)\b', re.I).search)
Expand Down Expand Up @@ -2558,7 +2554,7 @@ def read_config(options, args, arglist, parser):
merged together (in that order) using the read method of
ConfigParser.
"""
config = RawConfigParser()
config = configparser.RawConfigParser()

cli_conf = options.config

Expand Down

0 comments on commit 37e1ed6

Please sign in to comment.