Skip to content

Commit

Permalink
Replaced absolute PIL imports with relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 15, 2017
1 parent b7a2753 commit 01fb67d
Show file tree
Hide file tree
Showing 73 changed files with 159 additions and 258 deletions.
3 changes: 1 addition & 2 deletions PIL/BdfFontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

from __future__ import print_function

from PIL import Image
from PIL import FontFile
from . import Image, FontFile


# --------------------------------------------------------------------
Expand Down
11 changes: 3 additions & 8 deletions PIL/BmpImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,13 @@
#


from PIL import Image, ImageFile, ImagePalette, _binary
from . import Image, ImageFile, ImagePalette
from ._binary import i8, i16le as i16, i32le as i32, \
o8, o16le as o16, o32le as o32
import math

__version__ = "0.7"

i8 = _binary.i8
i16 = _binary.i16le
i32 = _binary.i32le
o8 = _binary.o8
o16 = _binary.o16le
o32 = _binary.o32le

#
# --------------------------------------------------------------------
# Read BMP file
Expand Down
2 changes: 1 addition & 1 deletion PIL/BufrStubImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, ImageFile
from . import Image, ImageFile

_handler = None

Expand Down
7 changes: 2 additions & 5 deletions PIL/CurImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@

from __future__ import print_function

from PIL import Image, BmpImagePlugin, _binary
from . import Image, BmpImagePlugin
from ._binary import i8, i16le as i16, i32le as i32

__version__ = "0.1"

#
# --------------------------------------------------------------------

i8 = _binary.i8
i16 = _binary.i16le
i32 = _binary.i32le


def _accept(prefix):
return prefix[:4] == b"\0\0\2\0"
Expand Down
7 changes: 3 additions & 4 deletions PIL/DcxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, _binary
from PIL.PcxImagePlugin import PcxImageFile
from . import Image
from ._binary import i32le as i32
from .PcxImagePlugin import PcxImageFile

__version__ = "0.2"

MAGIC = 0x3ADE68B1 # QUIZ: what's this value, then?

i32 = _binary.i32le


def _accept(prefix):
return len(prefix) >= 4 and i32(prefix) == MAGIC
Expand Down
2 changes: 1 addition & 1 deletion PIL/DdsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import struct
from io import BytesIO
from PIL import Image, ImageFile
from . import Image, ImageFile


# Magic ("DDS ")
Expand Down
6 changes: 2 additions & 4 deletions PIL/EpsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@
import re
import io
import sys
from PIL import Image, ImageFile, _binary
from . import Image, ImageFile
from ._binary import i32le as i32, o32le as o32

__version__ = "0.5"

#
# --------------------------------------------------------------------

i32 = _binary.i32le
o32 = _binary.o32le

split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$")
field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$")

Expand Down
2 changes: 1 addition & 1 deletion PIL/FitsStubImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, ImageFile
from . import Image, ImageFile

_handler = None

Expand Down
8 changes: 2 additions & 6 deletions PIL/FliImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
#


from PIL import Image, ImageFile, ImagePalette, _binary
from . import Image, ImageFile, ImagePalette
from ._binary import i8, i16le as i16, i32le as i32, o8

__version__ = "0.2"

i8 = _binary.i8
i16 = _binary.i16le
i32 = _binary.i32le
o8 = _binary.o8


#
# decoder
Expand Down
2 changes: 1 addition & 1 deletion PIL/FontFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from __future__ import print_function

import os
from PIL import Image, _binary
from . import Image, _binary

WIDTH = 800

Expand Down
6 changes: 2 additions & 4 deletions PIL/FpxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

from __future__ import print_function

from PIL import Image, ImageFile, _binary
from . import Image, ImageFile
from ._binary import i32le as i32, i8

import olefile

__version__ = "0.1"

i32 = _binary.i32le
i8 = _binary.i8

# we map from colour field tuples to (mode, rawmode) descriptors
MODES = {
# opacity
Expand Down
2 changes: 1 addition & 1 deletion PIL/FtexImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

import struct
from io import BytesIO
from PIL import Image, ImageFile
from . import Image, ImageFile


MAGIC = b"FTEX"
Expand Down
5 changes: 2 additions & 3 deletions PIL/GbrImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
# Version 3 files have a format specifier of 18 for 16bit floats in
# the color depth field. This is currently unsupported by Pillow.

from PIL import Image, ImageFile, _binary

i32 = _binary.i32be
from . import Image, ImageFile
from ._binary import i32be as i32


def _accept(prefix):
Expand Down
7 changes: 3 additions & 4 deletions PIL/GdImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
# purposes only.


from PIL import ImageFile, ImagePalette, _binary
from PIL._util import isPath
from . import ImageFile, ImagePalette
from ._binary import i16be as i16
from ._util import isPath

__version__ = "0.1"

Expand All @@ -34,8 +35,6 @@
import __builtin__
builtins = __builtin__

i16 = _binary.i16be


##
# Image plugin for the GD uncompressed format. Note that this format
Expand Down
10 changes: 3 additions & 7 deletions PIL/GifImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,16 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, ImageFile, ImagePalette, \
ImageChops, ImageSequence, _binary
from . import Image, ImageFile, ImagePalette, \
ImageChops, ImageSequence
from ._binary import i8, i16le as i16, o8, o16le as o16

__version__ = "0.9"


# --------------------------------------------------------------------
# Helpers

i8 = _binary.i8
i16 = _binary.i16le
o8 = _binary.o8
o16 = _binary.o16le


# --------------------------------------------------------------------
# Identify/read GIF files
Expand Down
2 changes: 1 addition & 1 deletion PIL/GimpGradientFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

from math import pi, log, sin, sqrt
from PIL._binary import o8
from ._binary import o8

# --------------------------------------------------------------------
# Stuff to translate curve segments to palette values (derived from
Expand Down
2 changes: 1 addition & 1 deletion PIL/GimpPaletteFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

import re
from PIL._binary import o8
from ._binary import o8


##
Expand Down
2 changes: 1 addition & 1 deletion PIL/GribStubImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, ImageFile
from . import Image, ImageFile

_handler = None

Expand Down
2 changes: 1 addition & 1 deletion PIL/Hdf5StubImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, ImageFile
from . import Image, ImageFile

_handler = None

Expand Down
5 changes: 2 additions & 3 deletions PIL/IcnsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# See the README file for information on usage and redistribution.
#

from PIL import Image, ImageFile, PngImagePlugin, _binary
from PIL import Image, ImageFile, PngImagePlugin
from PIL._binary import i8
import io
import os
import shutil
Expand All @@ -27,8 +28,6 @@
if enable_jpeg2k:
from PIL import Jpeg2KImagePlugin

i8 = _binary.i8

HEADERSIZE = 8


Expand Down
7 changes: 2 additions & 5 deletions PIL/IcoImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@
import struct
from io import BytesIO

from PIL import Image, ImageFile, BmpImagePlugin, PngImagePlugin, _binary
from . import Image, ImageFile, BmpImagePlugin, PngImagePlugin
from ._binary import i8, i16le as i16, i32le as i32
from math import log, ceil

__version__ = "0.1"

#
# --------------------------------------------------------------------

i8 = _binary.i8
i16 = _binary.i16le
i32 = _binary.i32le

_MAGIC = b"\0\0\1\0"


Expand Down
4 changes: 2 additions & 2 deletions PIL/ImImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@


import re
from PIL import Image, ImageFile, ImagePalette
from PIL._binary import i8
from . import Image, ImageFile, ImagePalette
from ._binary import i8

__version__ = "0.7"

Expand Down
Loading

0 comments on commit 01fb67d

Please sign in to comment.