]> git.phdru.name Git - m_lib.git/blobdiff - m_lib/hash/MKhash.py
Fix octals (066 => 0o666) for Py3 compatibility
[m_lib.git] / m_lib / hash / MKhash.py
index 707d9febffef3a6e1c985b751d4916624d18cd4f..83590e56eda879009f8bceddd81b512a9fd8b9ee 100644 (file)
@@ -1,8 +1,4 @@
-"""Provide a (g)dbm-compatible interface to MetaKit.
-Author: Oleg Broytman <phd@phd.pp.ru>
-Copyright (C) 2001-2002 PhiloSoft Design
-License: Python"""
-
+"""(g)dbm-compatible interface to MetaKit"""
 
 import sys
 try:
@@ -19,7 +15,7 @@ error = ValueError
 
 
 class MKhash:
-    def __init__(self, file, flag, mode=0666, trans_threshold=1000):
+    def __init__(self, file, flag, mode=0o666, trans_threshold=1000):
         self.read_only = 0
         self._closed = 0
 
@@ -61,7 +57,7 @@ class MKhash:
         vw = self.vw
         ix = vw.find(key=key)
         if ix == -1:
-            raise KeyError, key
+            raise KeyError(key)
         return vw[ix].value
 
     def __setitem__(self, key, value):
@@ -77,7 +73,7 @@ class MKhash:
         vw = self.vw
         ix = vw.find(key=key)
         if ix == -1:
-            raise KeyError, key
+            raise KeyError(key)
         vw.delete(ix)
         self._add_tran()
 
@@ -94,5 +90,5 @@ class MKhash:
             self.db.commit()
 
 
-def open(file, flag, mode=0666):
+def open(file, flag, mode=0o666):
     return MKhash(file, flag, mode)