From a35c432671143cff2a6d5d1006aa4d351fe6c200 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Tue, 30 Dec 2014 01:05:20 +0100 Subject: [PATCH] utils/const.py: fix ident Signed-off-by: Nicolas Sebrecht --- offlineimap/utils/const.py | 47 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/offlineimap/utils/const.py b/offlineimap/utils/const.py index a62b6a6..f4584bc 100644 --- a/offlineimap/utils/const.py +++ b/offlineimap/utils/const.py @@ -1,40 +1,37 @@ -# Copyright 2013 Eygene A. Ryabinkin. +# Copyright (C) 2013-2014 Eygene A. Ryabinkin and contributors # # Collection of classes that implement const-like behaviour # for various objects. import copy -class ConstProxy (object): - """ - Implements read-only access to a given object - that can be attached to each instance only once. +class ConstProxy(object): + """Implements read-only access to a given object + that can be attached to each instance only once.""" - """ - - def __init__ (self): - self.__dict__['__source'] = None + def __init__(self): + self.__dict__['__source'] = None - def __getattr__ (self, name): - src = self.__dict__['__source'] - if src == None: - raise ValueError ("using non-initialized ConstProxy() object") - return copy.deepcopy (getattr (src, name)) + def __getattr__(self, name): + src = self.__dict__['__source'] + if src == None: + raise ValueError("using non-initialized ConstProxy() object") + return copy.deepcopy(getattr(src, name)) - def __setattr__ (self, name, value): - raise AttributeError ("tried to set '%s' to '%s' for constant object" % \ - (name, value)) + def __setattr__(self, name, value): + raise AttributeError("tried to set '%s' to '%s' for constant object"% \ + (name, value)) - def __delattr__ (self, name): - raise RuntimeError ("tried to delete field '%s' from constant object" % \ - (name)) + def __delattr__(self, name): + raise RuntimeError("tried to delete field '%s' from constant object"% \ + (name)) - def set_source (self, source): - """ Sets source object for this instance. """ - if (self.__dict__['__source'] != None): - raise ValueError ("source object is already set") - self.__dict__['__source'] = source + def set_source(self, source): + """ Sets source object for this instance. """ + if (self.__dict__['__source'] != None): + raise ValueError("source object is already set") + self.__dict__['__source'] = source