Replace deprecated regexp flags not at start

DeprecationWarning: Flags not at the start of the expression
This commit is contained in:
Chris Mayo 2019-04-26 19:25:59 +01:00
parent b65e0f9d4c
commit a355476b82
2 changed files with 4 additions and 4 deletions

View file

@ -25,7 +25,7 @@ except ImportError:
has_sqlite = False
extension = re.compile(r'/(?i)places.sqlite$')
extension = re.compile(r'/places.sqlite$', re.IGNORECASE)
# Windows filename encoding

View file

@ -52,12 +52,12 @@ def add_mimetype(mimedb, mimetype, extension):
# if file extension lookup was unsuccessful, look at the content
PARSE_CONTENTS = {
"text/html": re.compile(r'^(?i)<(!DOCTYPE html|html|head|title)'),
"text/html": re.compile(r'^<(!DOCTYPE html|html|head|title)', re.IGNORECASE),
"text/plain+opera": re.compile(r'^Opera Hotlist'),
"text/plain+chromium": re.compile(r'^{\s*"checksum":'),
"text/plain+linkchecker": re.compile(r'(?i)^# LinkChecker URL list'),
"text/plain+linkchecker": re.compile(r'^# LinkChecker URL list', re.IGNORECASE),
"application/xml+sitemapindex": re.compile(r'(?i)<\?xml[^<]+<sitemapindex\s+'),
"application/xml+sitemap": re.compile(r'(?i)<\?xml[^<]+<urlset\s+'),
"application/xml+sitemap": re.compile(r'<\?xml[^<]+<urlset\s+', re.IGNORECASE),
}
def guess_mimetype (filename, read=None):