testing against None with "is", not using "=="

git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@153 1aa58f4a-7d42-0410-adbc-911cccaed67c
pull/1/head
yusuke.shinyama.dummy 2009-11-06 15:10:29 +00:00
parent 626e36f39c
commit f444c88e3d
5 changed files with 8 additions and 8 deletions

View File

@ -513,12 +513,12 @@ class PDFCIDFont(PDFFont):
dic = {} dic = {}
char1 = char2 = None char1 = char2 = None
for v in seq: for v in seq:
if char1 == None: if char1 is None:
char1 = v char1 = v
elif char2 == None and isinstance(v, int): elif char2 is None and isinstance(v, int):
char2 = v char2 = v
else: else:
if char2 == None: if char2 is None:
for (i,w) in enumerate(v): for (i,w) in enumerate(v):
dic[char1+i] = w dic[char1+i] = w
else: else:

View File

@ -177,7 +177,7 @@ class PDFStream(PDFObject):
raise Exception, "zlib.error while decompressing data" raise Exception, "zlib.error while decompressing data"
def decode(self): def decode(self):
assert self.data == None and self.rawdata != None assert self.data is None and self.rawdata != None
data = self.rawdata data = self.rawdata
if self.decipher: if self.decipher:
# Handle encryption # Handle encryption
@ -231,7 +231,7 @@ class PDFStream(PDFObject):
return return
def get_data(self): def get_data(self):
if self.data == None: if self.data is None:
self.decode() self.decode()
return self.data return self.data

View File

@ -90,7 +90,7 @@ class CDBReader(object):
(pos_bucket, ncells) = self._hash0[h1] (pos_bucket, ncells) = self._hash0[h1]
if ncells == 0: raise KeyError(k) if ncells == 0: raise KeyError(k)
hs = self._hash1[h1] hs = self._hash1[h1]
if hs == None: if hs is None:
self._fp.seek(pos_bucket) self._fp.seek(pos_bucket)
hs = decode(self._fp.read(ncells * 8)) hs = decode(self._fp.read(ncells * 8))
self._hash1[h1] = hs self._hash1[h1] = hs

View File

@ -33,7 +33,7 @@ def pick(seq, func, maxobj=None):
maxscore = None maxscore = None
for obj in seq: for obj in seq:
score = func(obj) score = func(obj)
if maxscore == None or maxscore < score: if maxscore is None or maxscore < score:
(maxscore,maxobj) = (score,obj) (maxscore,maxobj) = (score,obj)
return maxobj return maxobj

View File

@ -83,7 +83,7 @@ def dumpallobjs(out, doc, codec=None):
for objid in xref.objids(): for objid in xref.objids():
try: try:
obj = doc.getobj(objid) obj = doc.getobj(objid)
if obj == None: continue if obj is None: continue
out.write('<object id="%d">\n' % objid) out.write('<object id="%d">\n' % objid)
dumpxml(out, obj, codec=codec) dumpxml(out, obj, codec=codec)
out.write('\n</object>\n\n') out.write('\n</object>\n\n')