Coverage for apps/report/utils.py : 65%
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 xmltodict
2import logging
3import os
4import re
6logger = logging.getLogger(__name__)
9DATE_PATTERN = re.compile(r'.*\s(\d{1,2}/\d{1,2}/\d{4}).*')
12def parse_xml(xml_content):
13 return xmltodict.parse(xml_content)
16def convert_to_int(_string, default=None):
17 try:
18 string = _string.replace(',', '')
19 return int(string)
20 except (ValueError, TypeError):
21 return default
24def delete_file(path):
25 """ Deletes file from filesystem. """
26 if os.path.isfile(path):
27 os.remove(path)
28 logger.warn('File Delete successfully: {}'.format(path))