mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-13 05:06:49 +03:00
Fix "invalid escape sequence" warning in Python 3.6
http://bugs.python.org/issue27364
This commit is contained in:
parent
0a0fe292ec
commit
0c66b80a95
|
@ -71,7 +71,7 @@ def getrgb(color):
|
||||||
int(color[7:9], 16),
|
int(color[7:9], 16),
|
||||||
)
|
)
|
||||||
|
|
||||||
m = re.match("rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
|
m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
|
||||||
if m:
|
if m:
|
||||||
return (
|
return (
|
||||||
int(m.group(1)),
|
int(m.group(1)),
|
||||||
|
@ -79,7 +79,7 @@ def getrgb(color):
|
||||||
int(m.group(3))
|
int(m.group(3))
|
||||||
)
|
)
|
||||||
|
|
||||||
m = re.match("rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
|
m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
|
||||||
if m:
|
if m:
|
||||||
return (
|
return (
|
||||||
int((int(m.group(1)) * 255) / 100.0 + 0.5),
|
int((int(m.group(1)) * 255) / 100.0 + 0.5),
|
||||||
|
@ -87,7 +87,7 @@ def getrgb(color):
|
||||||
int((int(m.group(3)) * 255) / 100.0 + 0.5)
|
int((int(m.group(3)) * 255) / 100.0 + 0.5)
|
||||||
)
|
)
|
||||||
|
|
||||||
m = re.match("hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
|
m = re.match(r"hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
|
||||||
if m:
|
if m:
|
||||||
from colorsys import hls_to_rgb
|
from colorsys import hls_to_rgb
|
||||||
rgb = hls_to_rgb(
|
rgb = hls_to_rgb(
|
||||||
|
@ -101,7 +101,7 @@ def getrgb(color):
|
||||||
int(rgb[2] * 255 + 0.5)
|
int(rgb[2] * 255 + 0.5)
|
||||||
)
|
)
|
||||||
|
|
||||||
m = re.match("rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$",
|
m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$",
|
||||||
color)
|
color)
|
||||||
if m:
|
if m:
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -39,7 +39,7 @@ def register(viewer, order=1):
|
||||||
|
|
||||||
|
|
||||||
def show(image, title=None, **options):
|
def show(image, title=None, **options):
|
||||||
"""
|
r"""
|
||||||
Display a given image.
|
Display a given image.
|
||||||
|
|
||||||
:param image: An image object.
|
:param image: An image object.
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TestFileJpeg(PillowTestCase):
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
|
||||||
# internal version number
|
# internal version number
|
||||||
self.assertRegexpMatches(Image.core.jpeglib_version, "\d+\.\d+$")
|
self.assertRegexpMatches(Image.core.jpeglib_version, r"\d+\.\d+$")
|
||||||
|
|
||||||
im = Image.open(TEST_FILE)
|
im = Image.open(TEST_FILE)
|
||||||
im.load()
|
im.load()
|
||||||
|
|
|
@ -31,7 +31,7 @@ class TestFileJpeg2k(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
# Internal version number
|
# Internal version number
|
||||||
self.assertRegexpMatches(Image.core.jp2klib_version, '\d+\.\d+\.\d+$')
|
self.assertRegexpMatches(Image.core.jp2klib_version, r'\d+\.\d+\.\d+$')
|
||||||
|
|
||||||
im = Image.open('Tests/images/test-card-lossless.jp2')
|
im = Image.open('Tests/images/test-card-lossless.jp2')
|
||||||
px = im.load()
|
px = im.load()
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TestFilePng(PillowTestCase):
|
||||||
|
|
||||||
# internal version number
|
# internal version number
|
||||||
self.assertRegexpMatches(
|
self.assertRegexpMatches(
|
||||||
Image.core.zlib_version, "\d+\.\d+\.\d+(\.\d+)?$")
|
Image.core.zlib_version, r"\d+\.\d+\.\d+(\.\d+)?$")
|
||||||
|
|
||||||
test_file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class TestImageCms(PillowTestCase):
|
||||||
self.assertEqual(list(map(type, v)), [str, str, str, str])
|
self.assertEqual(list(map(type, v)), [str, str, str, str])
|
||||||
|
|
||||||
# internal version number
|
# internal version number
|
||||||
self.assertRegexpMatches(ImageCms.core.littlecms_version, "\d+\.\d+$")
|
self.assertRegexpMatches(ImageCms.core.littlecms_version, r"\d+\.\d+$")
|
||||||
|
|
||||||
self.skip_missing()
|
self.skip_missing()
|
||||||
i = ImageCms.profileToProfile(hopper(), SRGB, SRGB)
|
i = ImageCms.profileToProfile(hopper(), SRGB, SRGB)
|
||||||
|
|
|
@ -46,7 +46,7 @@ try:
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
self.assertRegexpMatches(
|
self.assertRegexpMatches(
|
||||||
ImageFont.core.freetype2_version, "\d+\.\d+\.\d+$")
|
ImageFont.core.freetype2_version, r"\d+\.\d+\.\d+$")
|
||||||
|
|
||||||
def test_font_properties(self):
|
def test_font_properties(self):
|
||||||
ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE)
|
ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -680,7 +680,7 @@ class pil_build_ext(build_ext):
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
for line in open(zlibfile).readlines():
|
for line in open(zlibfile).readlines():
|
||||||
m = re.match('#define\s+ZLIB_VERSION\s+"([^"]*)"', line)
|
m = re.match(r'#define\s+ZLIB_VERSION\s+"([^"]*)"', line)
|
||||||
if not m:
|
if not m:
|
||||||
continue
|
continue
|
||||||
if m.group(1) < "1.2.3":
|
if m.group(1) < "1.2.3":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user