Fix warning about deprecated SafeConfigParser.
This commit is contained in:
parent
45fc257575
commit
d0a1d64720
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from .p3 import configparser, _read_config
|
from .p3 import configparser, ConfigParser, _read_config
|
||||||
|
|
||||||
from .content import check_file, _open
|
from .content import check_file, _open
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class Config(object):
|
|||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
object.__setattr__(self, '_section', MAIN_SECTION) # active section
|
object.__setattr__(self, '_section', MAIN_SECTION) # active section
|
||||||
object.__setattr__(self, '_cfg', configparser.SafeConfigParser())
|
object.__setattr__(self, '_cfg', ConfigParser())
|
||||||
|
|
||||||
self._cfg.add_section(self._section)
|
self._cfg.add_section(self._section)
|
||||||
for name, value in DFT_CONFIG.items():
|
for name, value in DFT_CONFIG.items():
|
||||||
|
@ -3,7 +3,8 @@ import sys
|
|||||||
|
|
||||||
if sys.version_info[0] == 2:
|
if sys.version_info[0] == 2:
|
||||||
import ConfigParser as configparser
|
import ConfigParser as configparser
|
||||||
_read_config = configparser.SafeConfigParser.readfp
|
ConfigParser = configparser.SafeConfigParser
|
||||||
|
_read_config = ConfigParser.readfp
|
||||||
|
|
||||||
def input():
|
def input():
|
||||||
return raw_input().decode(sys.stdin.encoding or 'utf8', 'ignore')
|
return raw_input().decode(sys.stdin.encoding or 'utf8', 'ignore')
|
||||||
@ -28,7 +29,8 @@ if sys.version_info[0] == 2:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
import configparser
|
import configparser
|
||||||
_read_config = configparser.SafeConfigParser.read_file
|
ConfigParser = configparser.ConfigParser
|
||||||
|
_read_config = ConfigParser.read_file
|
||||||
ustr = str
|
ustr = str
|
||||||
uchr = chr
|
uchr = chr
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
Loading…
x
Reference in New Issue
Block a user