mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-01 11:43:17 +03:00
Merge pull request #1587 from radarhere/warnings
Removed warnings module check
This commit is contained in:
commit
4b2d02e633
13
PIL/Image.py
13
PIL/Image.py
|
@ -2103,13 +2103,12 @@ def frombuffer(mode, size, data, decoder_name="raw", *args):
|
||||||
|
|
||||||
if decoder_name == "raw":
|
if decoder_name == "raw":
|
||||||
if args == ():
|
if args == ():
|
||||||
if warnings:
|
warnings.warn(
|
||||||
warnings.warn(
|
"the frombuffer defaults may change in a future release; "
|
||||||
"the frombuffer defaults may change in a future release; "
|
"for portability, change the call to read:\n"
|
||||||
"for portability, change the call to read:\n"
|
" frombuffer(mode, size, data, 'raw', mode, 0, 1)",
|
||||||
" frombuffer(mode, size, data, 'raw', mode, 0, 1)",
|
RuntimeWarning, stacklevel=2
|
||||||
RuntimeWarning, stacklevel=2
|
)
|
||||||
)
|
|
||||||
args = mode, 0, -1 # may change to (mode, 0, 1) post-1.1.6
|
args = mode, 0, -1 # may change to (mode, 0, 1) post-1.1.6
|
||||||
if args[0] in _MAPMODES:
|
if args[0] in _MAPMODES:
|
||||||
im = new(mode, (1, 1))
|
im = new(mode, (1, 1))
|
||||||
|
|
|
@ -31,16 +31,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import numbers
|
import numbers
|
||||||
|
import warnings
|
||||||
|
|
||||||
from PIL import Image, ImageColor
|
from PIL import Image, ImageColor
|
||||||
from PIL._util import isStringType
|
from PIL._util import isStringType
|
||||||
|
|
||||||
try:
|
|
||||||
import warnings
|
|
||||||
except ImportError:
|
|
||||||
warnings = None
|
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# A simple 2D drawing interface for PIL images.
|
# A simple 2D drawing interface for PIL images.
|
||||||
# <p>
|
# <p>
|
||||||
|
@ -99,9 +94,8 @@ class ImageDraw(object):
|
||||||
"Please use keyword arguments instead.")
|
"Please use keyword arguments instead.")
|
||||||
|
|
||||||
def setfont(self, font):
|
def setfont(self, font):
|
||||||
if warnings:
|
warnings.warn("setfont() is deprecated. " +
|
||||||
warnings.warn("setfont() is deprecated. " +
|
"Please set the attribute directly instead.")
|
||||||
"Please set the attribute directly instead.")
|
|
||||||
# compatibility
|
# compatibility
|
||||||
self.font = font
|
self.font = font
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,6 @@ from PIL._util import isDirectory, isPath
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
|
||||||
import warnings
|
|
||||||
except ImportError:
|
|
||||||
warnings = None
|
|
||||||
|
|
||||||
|
|
||||||
class _imagingft_not_installed(object):
|
class _imagingft_not_installed(object):
|
||||||
# module placeholder
|
# module placeholder
|
||||||
|
|
Loading…
Reference in New Issue
Block a user