Skip to content

Commit

Permalink
Replaced old-style classes
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed May 26, 2015
1 parent 77f7cfd commit 94b3208
Show file tree
Hide file tree
Showing 40 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion PIL/ContainerIO.py
Expand Up @@ -19,7 +19,7 @@
# file (for example a TAR file).


class ContainerIO:
class ContainerIO(object):

##
# Create file object.
Expand Down
4 changes: 2 additions & 2 deletions PIL/EpsImagePlugin.py
Expand Up @@ -157,7 +157,7 @@ def Ghostscript(tile, size, fp, scale=1):
return im


class PSFile:
class PSFile(object):
"""
Wrapper for bytesio object that treats either CR or LF as end of line.
"""
Expand Down Expand Up @@ -365,7 +365,7 @@ def _save(im, fp, filename, eps=1):
else:
raise ValueError("image mode is not supported")

class NoCloseStream:
class NoCloseStream(object):
def __init__(self, fp):
self.fp = fp

Expand Down
2 changes: 1 addition & 1 deletion PIL/FontFile.py
Expand Up @@ -31,7 +31,7 @@ def puti16(fp, values):
##
# Base class for raster font file handlers.

class FontFile:
class FontFile(object):

bitmap = None

Expand Down
2 changes: 1 addition & 1 deletion PIL/GifImagePlugin.py
Expand Up @@ -496,7 +496,7 @@ def getdata(im, offset=(0, 0), **params):
The first string is a local image header, the rest contains
encoded image data."""

class Collector:
class Collector(object):
data = []

def write(self, data):
Expand Down
2 changes: 1 addition & 1 deletion PIL/GimpGradientFile.py
Expand Up @@ -58,7 +58,7 @@ def sphere_decreasing(middle, pos):
SEGMENTS = [linear, curved, sine, sphere_increasing, sphere_decreasing]


class GradientFile:
class GradientFile(object):

gradient = None

Expand Down
2 changes: 1 addition & 1 deletion PIL/GimpPaletteFile.py
Expand Up @@ -21,7 +21,7 @@
##
# File handler for GIMP's palette format.

class GimpPaletteFile:
class GimpPaletteFile(object):

rawmode = "RGB"

Expand Down
2 changes: 1 addition & 1 deletion PIL/IcnsImagePlugin.py
Expand Up @@ -130,7 +130,7 @@ def read_png_or_jpeg2000(fobj, start_length, size):
raise ValueError('Unsupported icon subimage format')


class IcnsFile:
class IcnsFile(object):

SIZES = {
(512, 512, 2): [
Expand Down
2 changes: 1 addition & 1 deletion PIL/IcoImagePlugin.py
Expand Up @@ -79,7 +79,7 @@ def _accept(prefix):
return prefix[:4] == _MAGIC


class IcoFile:
class IcoFile(object):
def __init__(self, buf):
"""
Parse image from file-like object containing ico file data
Expand Down
10 changes: 5 additions & 5 deletions PIL/Image.py
Expand Up @@ -35,7 +35,7 @@ class DecompressionBombWarning(RuntimeWarning):
pass


class _imaging_not_installed:
class _imaging_not_installed(object):
# module placeholder
def __getattr__(self, id):
raise ImportError("The _imaging C module is not installed")
Expand Down Expand Up @@ -443,7 +443,7 @@ def coerce_e(value):
return value if isinstance(value, _E) else _E(value)


class _E:
class _E(object):
def __init__(self, data):
self.data = data

Expand Down Expand Up @@ -478,7 +478,7 @@ def _getscaleoffset(expr):
# --------------------------------------------------------------------
# Implementation wrapper

class Image:
class Image(object):
"""
This class represents an image object. To create
:py:class:`~PIL.Image.Image` objects, use the appropriate factory
Expand Down Expand Up @@ -1975,12 +1975,12 @@ def load(self):
# --------------------------------------------------------------------
# Abstract handlers.

class ImagePointHandler:
class ImagePointHandler(object):
# used as a mixin by point transforms (for use with im.point)
pass


class ImageTransformHandler:
class ImageTransformHandler(object):
# used as a mixin by geometry transforms (for use with im.transform)
pass

Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageCms.py
Expand Up @@ -147,7 +147,7 @@
##
# Profile.

class ImageCmsProfile:
class ImageCmsProfile(object):

def __init__(self, profile):
"""
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageDraw.py
Expand Up @@ -47,7 +47,7 @@
# Application code should use the <b>Draw</b> factory, instead of
# directly.

class ImageDraw:
class ImageDraw(object):

##
# Create a drawing instance.
Expand Down
8 changes: 4 additions & 4 deletions PIL/ImageDraw2.py
Expand Up @@ -19,25 +19,25 @@
from PIL import Image, ImageColor, ImageDraw, ImageFont, ImagePath


class Pen:
class Pen(object):
def __init__(self, color, width=1, opacity=255):
self.color = ImageColor.getrgb(color)
self.width = width


class Brush:
class Brush(object):
def __init__(self, color, opacity=255):
self.color = ImageColor.getrgb(color)


class Font:
class Font(object):
def __init__(self, color, file, size=12):
# FIXME: add support for bitmap fonts
self.color = ImageColor.getrgb(color)
self.font = ImageFont.truetype(file, size)


class Draw:
class Draw(object):

def __init__(self, image, size=None, color=None):
if not hasattr(image, "im"):
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageEnhance.py
Expand Up @@ -21,7 +21,7 @@
from PIL import Image, ImageFilter, ImageStat


class _Enhance:
class _Enhance(object):

def enhance(self, factor):
"""
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageFile.py
Expand Up @@ -311,7 +311,7 @@ def _load(self):
)


class Parser:
class Parser(object):
"""
Incremental image parser. This class implements the standard
feed/close consumer interface.
Expand Down
8 changes: 4 additions & 4 deletions PIL/ImageFont.py
Expand Up @@ -38,7 +38,7 @@
warnings = None


class _imagingft_not_installed:
class _imagingft_not_installed(object):
# module placeholder
def __getattr__(self, id):
raise ImportError("The _imagingft C module is not installed")
Expand All @@ -64,7 +64,7 @@ def __getattr__(self, id):
# --------------------------------------------------------------------


class ImageFont:
class ImageFont(object):
"PIL font wrapper"

def _load_pilfont(self, filename):
Expand Down Expand Up @@ -120,7 +120,7 @@ def _load_pilfont_data(self, file, image):
# Wrapper for FreeType fonts. Application code should use the
# <b>truetype</b> factory function to create font objects.

class FreeTypeFont:
class FreeTypeFont(object):
"FreeType font wrapper (requires _imagingft service)"

def __init__(self, font=None, size=10, index=0, encoding="", file=None):
Expand Down Expand Up @@ -193,7 +193,7 @@ def font_variant(self, font=None, size=None, index=None, encoding=None):
# Image.ROTATE_90, Image.ROTATE_180, or Image.ROTATE_270.


class TransposedFont:
class TransposedFont(object):
"Wrapper for writing rotated or mirrored text"

def __init__(self, font, orientation=None):
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageMath.py
Expand Up @@ -31,7 +31,7 @@ def _isconstant(v):
return isinstance(v, int) or isinstance(v, float)


class _Operand:
class _Operand(object):
# wraps an image operand, providing standard operators

def __init__(self, im):
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageMode.py
Expand Up @@ -20,7 +20,7 @@
##
# Wrapper for mode strings.

class ModeDescriptor:
class ModeDescriptor(object):

def __init__(self, mode, bands, basemode, basetype):
self.mode = mode
Expand Down
4 changes: 2 additions & 2 deletions PIL/ImageMorph.py
Expand Up @@ -12,7 +12,7 @@
LUT_SIZE = 1 << 9


class LutBuilder:
class LutBuilder(object):
"""A class for building a MorphLut from a descriptive language
The input patterns is a list of a strings sequences like these::
Expand Down Expand Up @@ -176,7 +176,7 @@ def build_lut(self):
return self.lut


class MorphOp:
class MorphOp(object):
"""A class for binary morphological operators"""

def __init__(self,
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImagePalette.py
Expand Up @@ -21,7 +21,7 @@
from PIL import ImageColor


class ImagePalette:
class ImagePalette(object):
"Color palette for palette mapped images"

def __init__(self, mode="RGB", palette=None, size=0):
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImagePath.py
Expand Up @@ -20,7 +20,7 @@
# the Python class below is overridden by the C implementation.


class Path:
class Path(object):

def __init__(self, xy):
pass
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageSequence.py
Expand Up @@ -16,7 +16,7 @@
##


class Iterator:
class Iterator(object):
"""
This class implements an iterator object that can be used to loop
over an image sequence.
Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageShow.py
Expand Up @@ -56,7 +56,7 @@ def show(image, title=None, **options):
##
# Base class for viewers.

class Viewer:
class Viewer(object):

# main api

Expand Down
2 changes: 1 addition & 1 deletion PIL/ImageStat.py
Expand Up @@ -26,7 +26,7 @@
import functools


class Stat:
class Stat(object):

def __init__(self, image_or_list, mask=None):
try:
Expand Down
4 changes: 2 additions & 2 deletions PIL/ImageTk.py
Expand Up @@ -56,7 +56,7 @@ def _pilbitmap_check():
# --------------------------------------------------------------------
# PhotoImage

class PhotoImage:
class PhotoImage(object):
"""
A Tkinter-compatible photo image. This can be used
everywhere Tkinter expects an image object. If the image is an RGBA
Expand Down Expand Up @@ -190,7 +190,7 @@ def paste(self, im, box=None):
# BitmapImage


class BitmapImage:
class BitmapImage(object):
"""
A Tkinter-compatible bitmap image. This can be used everywhere Tkinter
Expand Down
8 changes: 4 additions & 4 deletions PIL/ImageWin.py
Expand Up @@ -21,7 +21,7 @@
from PIL import Image


class HDC:
class HDC(object):
"""
Wraps an HDC integer. The resulting object can be passed to the
:py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
Expand All @@ -34,7 +34,7 @@ def __int__(self):
return self.dc


class HWND:
class HWND(object):
"""
Wraps an HWND integer. The resulting object can be passed to the
:py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
Expand All @@ -47,7 +47,7 @@ def __int__(self):
return self.wnd


class Dib:
class Dib(object):
"""
A Windows bitmap with the given mode and size. The mode can be one of "1",
"L", "P", or "RGB".
Expand Down Expand Up @@ -206,7 +206,7 @@ def tostring(self):
##
# Create a Window with the given title size.

class Window:
class Window(object):

def __init__(self, title="PIL", width=None, height=None):
self.hwnd = Image.core.createwindow(
Expand Down
2 changes: 1 addition & 1 deletion PIL/IptcImagePlugin.py
Expand Up @@ -251,7 +251,7 @@ def getiptcinfo(im):
return None # no properties

# create an IptcImagePlugin object without initializing it
class FakeImage:
class FakeImage(object):
pass
im = FakeImage()
im.__class__ = IptcImageFile
Expand Down
2 changes: 1 addition & 1 deletion PIL/MpegImagePlugin.py
Expand Up @@ -22,7 +22,7 @@
#
# Bitstream parser

class BitStream:
class BitStream(object):

def __init__(self, fp):
self.fp = fp
Expand Down

0 comments on commit 94b3208

Please sign in to comment.