mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-05 00:13:42 +03:00
flake8 + typo: infile_temo -> infile_temp
This commit is contained in:
parent
1de128d6b6
commit
8f9e338303
|
@ -149,21 +149,26 @@ def Ghostscript(tile, size, fp, scale=1):
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
os.unlink(outfile)
|
os.unlink(outfile)
|
||||||
if infile_temo:
|
if infile_temp:
|
||||||
os.unlink(infile_temp)
|
os.unlink(infile_temp)
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return im
|
return im
|
||||||
|
|
||||||
|
|
||||||
class PSFile:
|
class PSFile:
|
||||||
"""Wrapper for bytesio object that treats either CR or LF as end of line."""
|
"""
|
||||||
|
Wrapper for bytesio object that treats either CR or LF as end of line.
|
||||||
|
"""
|
||||||
def __init__(self, fp):
|
def __init__(self, fp):
|
||||||
self.fp = fp
|
self.fp = fp
|
||||||
self.char = None
|
self.char = None
|
||||||
|
|
||||||
def seek(self, offset, whence=0):
|
def seek(self, offset, whence=0):
|
||||||
self.char = None
|
self.char = None
|
||||||
self.fp.seek(offset, whence)
|
self.fp.seek(offset, whence)
|
||||||
|
|
||||||
def readline(self):
|
def readline(self):
|
||||||
s = self.char or b""
|
s = self.char or b""
|
||||||
self.char = None
|
self.char = None
|
||||||
|
@ -180,6 +185,7 @@ class PSFile:
|
||||||
|
|
||||||
return s.decode('latin-1')
|
return s.decode('latin-1')
|
||||||
|
|
||||||
|
|
||||||
def _accept(prefix):
|
def _accept(prefix):
|
||||||
return prefix[:4] == b"%!PS" or i32(prefix) == 0xC6D3D0C5
|
return prefix[:4] == b"%!PS" or i32(prefix) == 0xC6D3D0C5
|
||||||
|
|
||||||
|
@ -194,7 +200,7 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
format = "EPS"
|
format = "EPS"
|
||||||
format_description = "Encapsulated Postscript"
|
format_description = "Encapsulated Postscript"
|
||||||
|
|
||||||
mode_map = { 1:"L", 2:"LAB", 3:"RGB" }
|
mode_map = {1: "L", 2: "LAB", 3: "RGB"}
|
||||||
|
|
||||||
def _open(self):
|
def _open(self):
|
||||||
(length, offset) = self._find_offset(self.fp)
|
(length, offset) = self._find_offset(self.fp)
|
||||||
|
@ -208,7 +214,7 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
else:
|
else:
|
||||||
# Python3, can use bare open command.
|
# Python3, can use bare open command.
|
||||||
fp = open(self.fp.name, "Ur", encoding='latin-1')
|
fp = open(self.fp.name, "Ur", encoding='latin-1')
|
||||||
except Exception as msg:
|
except:
|
||||||
# Expect this for bytesio/stringio
|
# Expect this for bytesio/stringio
|
||||||
fp = PSFile(self.fp)
|
fp = PSFile(self.fp)
|
||||||
|
|
||||||
|
@ -314,7 +320,8 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
# FIX for: Some EPS file not handled correctly / issue #302
|
# FIX for: Some EPS file not handled correctly / issue #302
|
||||||
# EPS can contain binary data
|
# EPS can contain binary data
|
||||||
# or start directly with latin coding
|
# or start directly with latin coding
|
||||||
# more info see http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
|
# more info see:
|
||||||
|
# http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
|
||||||
offset = i32(s[4:8])
|
offset = i32(s[4:8])
|
||||||
length = i32(s[8:12])
|
length = i32(s[8:12])
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user