Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1import configparser 

2 

3 

4class Parser(configparser.RawConfigParser): 

5 def __init__(self, **kwargs): 

6 kwargs["allow_no_value"] = True 

7 configparser.RawConfigParser.__init__(self, **kwargs) 

8 

9 def __remove_quotes(self, value): 

10 quotes = ["'", '"'] 

11 for quote in quotes: 

12 if len(value) >= 2 and value[0] == value[-1] == quote: 

13 return value[1:-1] 

14 return value 

15 

16 def get(self, section, option): 

17 value = configparser.RawConfigParser.get(self, section, option) 

18 return self.__remove_quotes(value)