utils/const.py Removed extra characters
These characters could be removed.
This commit is contained in:
parent
fefe69c0e9
commit
142041130d
@ -6,7 +6,7 @@
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
|
||||||
class ConstProxy():
|
class ConstProxy:
|
||||||
"""Implements read-only access to a given object
|
"""Implements read-only access to a given object
|
||||||
that can be attached to each instance only once."""
|
that can be attached to each instance only once."""
|
||||||
|
|
||||||
@ -20,15 +20,15 @@ class ConstProxy():
|
|||||||
return copy.deepcopy(getattr(src, name))
|
return copy.deepcopy(getattr(src, name))
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
raise AttributeError("tried to set '%s' to '%s' for constant object" % \
|
raise AttributeError("tried to set '%s' to '%s' for constant object" %
|
||||||
(name, value))
|
(name, value))
|
||||||
|
|
||||||
def __delattr__(self, name):
|
def __delattr__(self, name):
|
||||||
raise RuntimeError("tried to delete field '%s' from constant object" % \
|
raise RuntimeError("tried to delete field '%s' from constant object" %
|
||||||
(name))
|
name)
|
||||||
|
|
||||||
def set_source(self, source):
|
def set_source(self, source):
|
||||||
""" Sets source object for this instance. """
|
""" Sets source object for this instance. """
|
||||||
if (self.__dict__['__source'] is not None):
|
if self.__dict__['__source'] is not None:
|
||||||
raise ValueError("source object is already set")
|
raise ValueError("source object is already set")
|
||||||
self.__dict__['__source'] = source
|
self.__dict__['__source'] = source
|
||||||
|
Loading…
Reference in New Issue
Block a user