18
18
os = isolate_module (os )
19
19
20
20
21
- class HandyConfigParser (configparser .RawConfigParser ):
21
+ class HandyConfigParser (configparser .ConfigParser ):
22
22
"""Our specialization of ConfigParser."""
23
23
24
24
def __init__ (self , our_file ):
@@ -29,36 +29,36 @@ def __init__(self, our_file):
29
29
for possible settings.
30
30
"""
31
31
32
- configparser . RawConfigParser . __init__ (self )
32
+ super (). __init__ (interpolation = None )
33
33
self .section_prefixes = ["coverage:" ]
34
34
if our_file :
35
35
self .section_prefixes .append ("" )
36
36
37
37
def read (self , filenames , encoding_unused = None ):
38
38
"""Read a file name as UTF-8 configuration data."""
39
- return configparser . RawConfigParser . read (self , filenames , encoding = "utf-8" )
39
+ return super (). read (filenames , encoding = "utf-8" )
40
40
41
41
def has_option (self , section , option ):
42
42
for section_prefix in self .section_prefixes :
43
43
real_section = section_prefix + section
44
- has = configparser . RawConfigParser . has_option (self , real_section , option )
44
+ has = super (). has_option (real_section , option )
45
45
if has :
46
46
return has
47
47
return False
48
48
49
49
def has_section (self , section ):
50
50
for section_prefix in self .section_prefixes :
51
51
real_section = section_prefix + section
52
- has = configparser . RawConfigParser . has_section (self , real_section )
52
+ has = super (). has_section (real_section )
53
53
if has :
54
54
return real_section
55
55
return False
56
56
57
57
def options (self , section ):
58
58
for section_prefix in self .section_prefixes :
59
59
real_section = section_prefix + section
60
- if configparser . RawConfigParser . has_section (self , real_section ):
61
- return configparser . RawConfigParser . options (self , real_section )
60
+ if super (). has_section (real_section ):
61
+ return super (). options (real_section )
62
62
raise ConfigError (f"No section: { section !r} " )
63
63
64
64
def get_section (self , section ):
@@ -71,7 +71,7 @@ def get_section(self, section):
71
71
def get (self , section , option , * args , ** kwargs ):
72
72
"""Get a value, replacing environment variables also.
73
73
74
- The arguments are the same as `RawConfigParser .get`, but in the found
74
+ The arguments are the same as `ConfigParser .get`, but in the found
75
75
value, ``$WORD`` or ``${WORD}`` are replaced by the value of the
76
76
environment variable ``WORD``.
77
77
@@ -80,12 +80,12 @@ def get(self, section, option, *args, **kwargs):
80
80
"""
81
81
for section_prefix in self .section_prefixes :
82
82
real_section = section_prefix + section
83
- if configparser . RawConfigParser . has_option (self , real_section , option ):
83
+ if super (). has_option (real_section , option ):
84
84
break
85
85
else :
86
86
raise ConfigError (f"No option { option !r} in section: { section !r} " )
87
87
88
- v = configparser . RawConfigParser . get (self , real_section , option , * args , ** kwargs )
88
+ v = super (). get (real_section , option , * args , ** kwargs )
89
89
v = substitute_variables (v , os .environ )
90
90
return v
91
91
0 commit comments