Mercurial > p > roundup > code
comparison roundup/backends/indexer_dbm.py @ 5380:64c4e43fbb84
Python 3 preparation: numeric literal syntax.
Fixes octal constants to use leading 0o, and removes 'L' suffixes.
Tool-assisted patch.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 21:43:32 +0000 |
| parents | 198b6e810c67 |
| children | 23b8e6067f7c |
comparison
equal
deleted
inserted
replaced
| 5379:17edccfe1755 | 5380:64c4e43fbb84 |
|---|---|
| 60 '''Force a reindex condition | 60 '''Force a reindex condition |
| 61 ''' | 61 ''' |
| 62 if os.path.exists(self.indexdb_path): | 62 if os.path.exists(self.indexdb_path): |
| 63 shutil.rmtree(self.indexdb_path) | 63 shutil.rmtree(self.indexdb_path) |
| 64 os.makedirs(self.indexdb_path) | 64 os.makedirs(self.indexdb_path) |
| 65 os.chmod(self.indexdb_path, 0775) | 65 os.chmod(self.indexdb_path, 0o775) |
| 66 open(os.path.join(self.indexdb_path, 'version'), 'w').write('1\n') | 66 open(os.path.join(self.indexdb_path, 'version'), 'w').write('1\n') |
| 67 self.reindex = 1 | 67 self.reindex = 1 |
| 68 self.changed = 1 | 68 self.changed = 1 |
| 69 | 69 |
| 70 def should_reindex(self): | 70 def should_reindex(self): |
| 249 db = {'WORDS':segdicts[initchar], 'FILES':None, 'FILEIDS':None} | 249 db = {'WORDS':segdicts[initchar], 'FILES':None, 'FILEIDS':None} |
| 250 pickle_str = marshal.dumps(db) | 250 pickle_str = marshal.dumps(db) |
| 251 filename = self.indexdb + initchar | 251 filename = self.indexdb + initchar |
| 252 pickle_fh = open(filename, 'wb') | 252 pickle_fh = open(filename, 'wb') |
| 253 pickle_fh.write(zlib.compress(pickle_str)) | 253 pickle_fh.write(zlib.compress(pickle_str)) |
| 254 os.chmod(filename, 0664) | 254 os.chmod(filename, 0o664) |
| 255 | 255 |
| 256 # save done | 256 # save done |
| 257 self.changed = 0 | 257 self.changed = 0 |
| 258 | 258 |
| 259 def purge_entry(self, identifier): | 259 def purge_entry(self, identifier): |
