Skip to content

Commit

Permalink
Remove a specific code for py2
Browse files Browse the repository at this point in the history
  • Loading branch information
osantana committed Jan 31, 2019
1 parent ccbd1b2 commit bf02c30
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions prettyconf/loaders.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import os
import sys
from configparser import ConfigParser, MissingSectionHeaderError, NoOptionError
from glob import glob

from .exceptions import InvalidConfigurationFile, InvalidPath

try:
from ConfigParser import SafeConfigParser as ConfigParser, NoOptionError, MissingSectionHeaderError
except ImportError:
from configparser import ConfigParser, NoOptionError, MissingSectionHeaderError


class NotSet(str):
"""
Expand Down Expand Up @@ -91,12 +86,7 @@ def _parse(self):

with open(self.filename) as inifile:
try:
if sys.version_info[0] < 3:
# ConfigParser.readfp is deprecated for Python3, read_file replaces it
# noinspection PyDeprecation
self.parser.readfp(inifile)
else:
self.parser.read_file(inifile)
self.parser.read_file(inifile)
except (UnicodeDecodeError, MissingSectionHeaderError):
raise InvalidConfigurationFile()

Expand Down

0 comments on commit bf02c30

Please sign in to comment.