testing against None with "is", not using "=="
git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@153 1aa58f4a-7d42-0410-adbc-911cccaed67cpull/1/head
parent
626e36f39c
commit
f444c88e3d
|
@ -513,12 +513,12 @@ class PDFCIDFont(PDFFont):
|
|||
dic = {}
|
||||
char1 = char2 = None
|
||||
for v in seq:
|
||||
if char1 == None:
|
||||
if char1 is None:
|
||||
char1 = v
|
||||
elif char2 == None and isinstance(v, int):
|
||||
elif char2 is None and isinstance(v, int):
|
||||
char2 = v
|
||||
else:
|
||||
if char2 == None:
|
||||
if char2 is None:
|
||||
for (i,w) in enumerate(v):
|
||||
dic[char1+i] = w
|
||||
else:
|
||||
|
|
|
@ -177,7 +177,7 @@ class PDFStream(PDFObject):
|
|||
raise Exception, "zlib.error while decompressing data"
|
||||
|
||||
def decode(self):
|
||||
assert self.data == None and self.rawdata != None
|
||||
assert self.data is None and self.rawdata != None
|
||||
data = self.rawdata
|
||||
if self.decipher:
|
||||
# Handle encryption
|
||||
|
@ -231,7 +231,7 @@ class PDFStream(PDFObject):
|
|||
return
|
||||
|
||||
def get_data(self):
|
||||
if self.data == None:
|
||||
if self.data is None:
|
||||
self.decode()
|
||||
return self.data
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class CDBReader(object):
|
|||
(pos_bucket, ncells) = self._hash0[h1]
|
||||
if ncells == 0: raise KeyError(k)
|
||||
hs = self._hash1[h1]
|
||||
if hs == None:
|
||||
if hs is None:
|
||||
self._fp.seek(pos_bucket)
|
||||
hs = decode(self._fp.read(ncells * 8))
|
||||
self._hash1[h1] = hs
|
||||
|
|
|
@ -33,7 +33,7 @@ def pick(seq, func, maxobj=None):
|
|||
maxscore = None
|
||||
for obj in seq:
|
||||
score = func(obj)
|
||||
if maxscore == None or maxscore < score:
|
||||
if maxscore is None or maxscore < score:
|
||||
(maxscore,maxobj) = (score,obj)
|
||||
return maxobj
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ def dumpallobjs(out, doc, codec=None):
|
|||
for objid in xref.objids():
|
||||
try:
|
||||
obj = doc.getobj(objid)
|
||||
if obj == None: continue
|
||||
if obj is None: continue
|
||||
out.write('<object id="%d">\n' % objid)
|
||||
dumpxml(out, obj, codec=codec)
|
||||
out.write('\n</object>\n\n')
|
||||
|
|
Loading…
Reference in New Issue