py3: misc fixes

This commit is contained in:
Kovid Goyal 2019-04-22 08:38:56 +05:30
parent 6d5ce1c79a
commit d9c22e7e1c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 1 deletions

View File

@ -1062,7 +1062,7 @@ OptionRecommendation(name='search_replace',
if not os.path.exists(self.opts.debug_pipeline):
os.makedirs(self.opts.debug_pipeline)
open(os.path.join(self.opts.debug_pipeline, 'README.txt'),
'w').write(DEBUG_README.encode('utf-8'))
'wb').write(DEBUG_README.encode('utf-8'))
for x in ('input', 'parsed', 'structure', 'processed'):
x = os.path.join(self.opts.debug_pipeline, x)
if os.path.exists(x):

View File

@ -145,6 +145,9 @@ class HTMLFile(object):
def __eq__(self, other):
return self.path == getattr(other, 'path', other)
def __hash__(self):
return hash(self.path)
def __str__(self):
return u'HTMLFile:%d:%s:%s'%(self.level, 'b' if self.is_binary else 'a', self.path)