mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +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),
|
||||
)
|
||||
|
||||
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:
|
||||
return (
|
||||
int(m.group(1)),
|
||||
|
@ -79,7 +79,7 @@ def getrgb(color):
|
|||
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:
|
||||
return (
|
||||
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)
|
||||
)
|
||||
|
||||
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:
|
||||
from colorsys import hls_to_rgb
|
||||
rgb = hls_to_rgb(
|
||||
|
@ -101,7 +101,7 @@ def getrgb(color):
|
|||
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)
|
||||
if m:
|
||||
return (
|
||||
|
|
|
@ -39,7 +39,7 @@ def register(viewer, order=1):
|
|||
|
||||
|
||||
def show(image, title=None, **options):
|
||||
"""
|
||||
r"""
|
||||
Display a given image.
|
||||
|
||||
:param image: An image object.
|
||||
|
|
|
@ -32,7 +32,7 @@ class TestFileJpeg(PillowTestCase):
|
|||
def test_sanity(self):
|
||||
|
||||
# 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.load()
|
||||
|
|
|
@ -31,7 +31,7 @@ class TestFileJpeg2k(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
# 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')
|
||||
px = im.load()
|
||||
|
|
|
@ -55,7 +55,7 @@ class TestFilePng(PillowTestCase):
|
|||
|
||||
# internal version number
|
||||
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")
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class TestImageCms(PillowTestCase):
|
|||
self.assertEqual(list(map(type, v)), [str, str, str, str])
|
||||
|
||||
# internal version number
|
||||
self.assertRegexpMatches(ImageCms.core.littlecms_version, "\d+\.\d+$")
|
||||
self.assertRegexpMatches(ImageCms.core.littlecms_version, r"\d+\.\d+$")
|
||||
|
||||
self.skip_missing()
|
||||
i = ImageCms.profileToProfile(hopper(), SRGB, SRGB)
|
||||
|
|
|
@ -46,7 +46,7 @@ try:
|
|||
|
||||
def test_sanity(self):
|
||||
self.assertRegexpMatches(
|
||||
ImageFont.core.freetype2_version, "\d+\.\d+\.\d+$")
|
||||
ImageFont.core.freetype2_version, r"\d+\.\d+\.\d+$")
|
||||
|
||||
def test_font_properties(self):
|
||||
ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE)
|
||||
|
|
Loading…
Reference in New Issue
Block a user