Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/pymysql/optionfile.py : 36%

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
4class Parser(configparser.RawConfigParser):
5 def __init__(self, **kwargs):
6 kwargs["allow_no_value"] = True
7 configparser.RawConfigParser.__init__(self, **kwargs)
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
16 def get(self, section, option):
17 value = configparser.RawConfigParser.get(self, section, option)
18 return self.__remove_quotes(value)