Commit 3c80054a authored by Tres Seaver's avatar Tres Seaver

Replace deprecated class adviser ('zope.interface.implements').

Use instead the decorator ('zope.interface.implementer').
parent bcabef29
...@@ -16,8 +16,8 @@ import zope.interface ...@@ -16,8 +16,8 @@ import zope.interface
import BTrees.Interfaces import BTrees.Interfaces
@zope.interface.implementer(BTrees.Interfaces.IBTreeFamily)
class _Family(object): class _Family(object):
zope.interface.implements(BTrees.Interfaces.IBTreeFamily)
from BTrees import OOBTree as OO from BTrees import OOBTree as OO
......
...@@ -420,10 +420,10 @@ def checkCurrentSerialInTransaction(self, oid, serial, transaction): ...@@ -420,10 +420,10 @@ def checkCurrentSerialInTransaction(self, oid, serial, transaction):
BaseStorage.checkCurrentSerialInTransaction = checkCurrentSerialInTransaction BaseStorage.checkCurrentSerialInTransaction = checkCurrentSerialInTransaction
@zope.interface.implementer(ZODB.interfaces.IStorageTransactionInformation)
class TransactionRecord(object): class TransactionRecord(object):
"""Abstract base class for iterator protocol""" """Abstract base class for iterator protocol"""
zope.interface.implements(ZODB.interfaces.IStorageTransactionInformation)
def __init__(self, tid, status, user, description, extension): def __init__(self, tid, status, user, description, extension):
self.tid = tid self.tid = tid
...@@ -441,10 +441,10 @@ class TransactionRecord(object): ...@@ -441,10 +441,10 @@ class TransactionRecord(object):
_extension = property(fset=_ext_set, fget=_ext_get) _extension = property(fset=_ext_set, fget=_ext_get)
@zope.interface.implementer(ZODB.interfaces.IStorageRecordInformation)
class DataRecord(object): class DataRecord(object):
"""Abstract base class for iterator protocol""" """Abstract base class for iterator protocol"""
zope.interface.implements(ZODB.interfaces.IStorageRecordInformation)
version = '' version = ''
......
...@@ -112,9 +112,9 @@ class IPersistentReference(zope.interface.Interface): ...@@ -112,9 +112,9 @@ class IPersistentReference(zope.interface.Interface):
have two references to the same object that are spelled with different have two references to the same object that are spelled with different
data (for instance, one with a class and one without).''' data (for instance, one with a class and one without).'''
@zope.interface.implementer(IPersistentReference)
class PersistentReference(object): class PersistentReference(object):
zope.interface.implements(IPersistentReference)
weak = False weak = False
oid = database_name = klass = None oid = database_name = klass = None
......
...@@ -34,7 +34,7 @@ from ZODB.blob import Blob, rename_or_copy_blob, remove_committed_dir ...@@ -34,7 +34,7 @@ from ZODB.blob import Blob, rename_or_copy_blob, remove_committed_dir
from transaction.interfaces import ISavepointDataManager from transaction.interfaces import ISavepointDataManager
from transaction.interfaces import IDataManagerSavepoint from transaction.interfaces import IDataManagerSavepoint
from transaction.interfaces import ISynchronizer from transaction.interfaces import ISynchronizer
from zope.interface import implements from zope.interface import implementer
import transaction import transaction
...@@ -66,13 +66,13 @@ def resetCaches(): ...@@ -66,13 +66,13 @@ def resetCaches():
global global_reset_counter global global_reset_counter
global_reset_counter += 1 global_reset_counter += 1
@implementer(IConnection,
ISavepointDataManager,
IPersistentDataManager,
ISynchronizer)
class Connection(ExportImport, object): class Connection(ExportImport, object):
"""Connection to ZODB for loading and storing objects.""" """Connection to ZODB for loading and storing objects."""
implements(IConnection,
ISavepointDataManager,
IPersistentDataManager,
ISynchronizer)
_code_timestamp = 0 _code_timestamp = 0
...@@ -1221,9 +1221,9 @@ class Connection(ExportImport, object): ...@@ -1221,9 +1221,9 @@ class Connection(ExportImport, object):
# Savepoint support # Savepoint support
##################################################################### #####################################################################
@implementer(IDataManagerSavepoint)
class Savepoint: class Savepoint:
implements(IDataManagerSavepoint)
def __init__(self, datamanager, state): def __init__(self, datamanager, state):
self.datamanager = datamanager self.datamanager = datamanager
...@@ -1232,10 +1232,10 @@ class Savepoint: ...@@ -1232,10 +1232,10 @@ class Savepoint:
def rollback(self): def rollback(self):
self.datamanager._rollback(self.state) self.datamanager._rollback(self.state)
@implementer(IBlobStorage)
class TmpStore: class TmpStore:
"""A storage-like thing to support savepoints.""" """A storage-like thing to support savepoints."""
implements(IBlobStorage)
def __init__(self, storage): def __init__(self, storage):
self._storage = storage self._storage = storage
......
...@@ -30,7 +30,7 @@ import ZODB.serialize ...@@ -30,7 +30,7 @@ import ZODB.serialize
import transaction.weakset import transaction.weakset
from zope.interface import implements from zope.interface import implementer
from ZODB.interfaces import IDatabase from ZODB.interfaces import IDatabase
from ZODB.interfaces import IMVCCStorage from ZODB.interfaces import IMVCCStorage
...@@ -319,6 +319,7 @@ def getTID(at, before): ...@@ -319,6 +319,7 @@ def getTID(at, before):
return before return before
@implementer(IDatabase)
class DB(object): class DB(object):
"""The Object Database """The Object Database
------------------- -------------------
...@@ -359,7 +360,6 @@ class DB(object): ...@@ -359,7 +360,6 @@ class DB(object):
cacheDetailSize, getCacheSize, getHistoricalCacheSize, setCacheSize, cacheDetailSize, getCacheSize, getHistoricalCacheSize, setCacheSize,
setHistoricalCacheSize setHistoricalCacheSize
""" """
implements(IDatabase)
klass = Connection # Class to use for connections klass = Connection # Class to use for connections
_activity_monitor = next = previous = None _activity_monitor = next = previous = None
......
...@@ -32,12 +32,12 @@ import ZODB.POSException ...@@ -32,12 +32,12 @@ import ZODB.POSException
import ZODB.utils import ZODB.utils
import zope.interface import zope.interface
class DemoStorage(object): @zope.interface.implementer(
zope.interface.implements(
ZODB.interfaces.IStorage, ZODB.interfaces.IStorage,
ZODB.interfaces.IStorageIteration, ZODB.interfaces.IStorageIteration,
) )
class DemoStorage(object):
def __init__(self, name=None, base=None, changes=None, def __init__(self, name=None, base=None, changes=None,
close_base_on_close=None, close_changes_on_close=None): close_base_on_close=None, close_changes_on_close=None):
......
...@@ -86,14 +86,7 @@ class TempFormatter(FileStorageFormatter): ...@@ -86,14 +86,7 @@ class TempFormatter(FileStorageFormatter):
def __init__(self, afile): def __init__(self, afile):
self._file = afile self._file = afile
class FileStorage( @zope.interface.implementer(
FileStorageFormatter,
ZODB.blob.BlobStorageMixin,
ConflictResolution.ConflictResolvingStorage,
BaseStorage.BaseStorage,
):
zope.interface.implements(
ZODB.interfaces.IStorage, ZODB.interfaces.IStorage,
ZODB.interfaces.IStorageRestoreable, ZODB.interfaces.IStorageRestoreable,
ZODB.interfaces.IStorageIteration, ZODB.interfaces.IStorageIteration,
...@@ -101,6 +94,13 @@ class FileStorage( ...@@ -101,6 +94,13 @@ class FileStorage(
ZODB.interfaces.IStorageCurrentRecordIteration, ZODB.interfaces.IStorageCurrentRecordIteration,
ZODB.interfaces.IExternalGC, ZODB.interfaces.IExternalGC,
) )
class FileStorage(
FileStorageFormatter,
ZODB.blob.BlobStorageMixin,
ConflictResolution.ConflictResolvingStorage,
BaseStorage.BaseStorage,
):
# Set True while a pack is in progress; undo is blocked for the duration. # Set True while a pack is in progress; undo is blocked for the duration.
_pack_is_in_progress = False _pack_is_in_progress = False
......
...@@ -27,12 +27,12 @@ import ZODB.TimeStamp ...@@ -27,12 +27,12 @@ import ZODB.TimeStamp
import ZODB.utils import ZODB.utils
import zope.interface import zope.interface
class MappingStorage(object):
zope.interface.implements( @zope.interface.implementer(
ZODB.interfaces.IStorage, ZODB.interfaces.IStorage,
ZODB.interfaces.IStorageIteration, ZODB.interfaces.IStorageIteration,
) )
class MappingStorage(object):
def __init__(self, name='MappingStorage'): def __init__(self, name='MappingStorage'):
self.__name__ = name self.__name__ = name
...@@ -351,10 +351,10 @@ class TransactionRecord: ...@@ -351,10 +351,10 @@ class TransactionRecord:
del self.data[oid] del self.data[oid]
return not self.data return not self.data
@zope.interface.implementer(ZODB.interfaces.IStorageRecordInformation)
class DataRecord(object): class DataRecord(object):
"""Abstract base class for iterator protocol""" """Abstract base class for iterator protocol"""
zope.interface.implements(ZODB.interfaces.IStorageRecordInformation)
version = '' version = ''
data_txn = None data_txn = None
......
...@@ -51,10 +51,10 @@ valid_modes = 'r', 'w', 'r+', 'a', 'c' ...@@ -51,10 +51,10 @@ valid_modes = 'r', 'w', 'r+', 'a', 'c'
# via GC in any thread. # via GC in any thread.
@zope.interface.implementer(ZODB.interfaces.IBlob)
class Blob(persistent.Persistent): class Blob(persistent.Persistent):
"""A BLOB supports efficient handling of large data within ZODB.""" """A BLOB supports efficient handling of large data within ZODB."""
zope.interface.implements(ZODB.interfaces.IBlob)
_p_blob_uncommitted = None # Filename of the uncommitted (dirty) data _p_blob_uncommitted = None # Filename of the uncommitted (dirty) data
_p_blob_committed = None # Filename of the committed data _p_blob_committed = None # Filename of the committed data
...@@ -686,11 +686,11 @@ class BlobStorageMixin(object): ...@@ -686,11 +686,11 @@ class BlobStorageMixin(object):
return self.fshelper.temp_dir return self.fshelper.temp_dir
@zope.interface.implementer(ZODB.interfaces.IBlobStorage)
class BlobStorage(BlobStorageMixin): class BlobStorage(BlobStorageMixin):
"""A wrapper/proxy storage to support blobs. """A wrapper/proxy storage to support blobs.
""" """
zope.interface.implements(ZODB.interfaces.IBlobStorage)
def __init__(self, base_directory, storage, layout='automatic'): def __init__(self, base_directory, storage, layout='automatic'):
assert not ZODB.interfaces.IBlobStorage.providedBy(storage) assert not ZODB.interfaces.IBlobStorage.providedBy(storage)
......
...@@ -25,6 +25,7 @@ import ZODB.interfaces ...@@ -25,6 +25,7 @@ import ZODB.interfaces
broken_cache = {} broken_cache = {}
@zope.interface.implementer(ZODB.interfaces.IBroken)
class Broken(object): class Broken(object):
"""Broken object base class """Broken object base class
...@@ -96,7 +97,6 @@ class Broken(object): ...@@ -96,7 +97,6 @@ class Broken(object):
>>> broken_cache.clear() >>> broken_cache.clear()
""" """
zope.interface.implements(ZODB.interfaces.IBroken)
__Broken_state__ = __Broken_initargs__ = None __Broken_state__ = __Broken_initargs__ = None
......
...@@ -21,11 +21,11 @@ import ZODB.utils ...@@ -21,11 +21,11 @@ import ZODB.utils
import ZODB.POSException import ZODB.POSException
from ZODB.interfaces import IMVCCStorage from ZODB.interfaces import IMVCCStorage
from ZODB.MappingStorage import MappingStorage from ZODB.MappingStorage import MappingStorage
from zope.interface import implements from zope.interface import implementer
@implementer(IMVCCStorage)
class MVCCMappingStorage(MappingStorage): class MVCCMappingStorage(MappingStorage):
implements(IMVCCStorage)
def __init__(self, name="MVCC Mapping Storage"): def __init__(self, name="MVCC Mapping Storage"):
MappingStorage.__init__(self, name=name) MappingStorage.__init__(self, name=name)
......
...@@ -15,9 +15,9 @@ import ZODB.blob ...@@ -15,9 +15,9 @@ import ZODB.blob
import ZODB.interfaces import ZODB.interfaces
import zope.interface import zope.interface
@zope.interface.implementer(ZODB.interfaces.IStorageWrapper)
class HexStorage(object): class HexStorage(object):
zope.interface.implements(ZODB.interfaces.IStorageWrapper)
copied_methods = ( copied_methods = (
'close', 'getName', 'getSize', 'history', 'isReadOnly', 'close', 'getName', 'getSize', 'history', 'isReadOnly',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment