3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

utils.CC2SC: use self.__class__ to get the name of the current subclass

This is the intended behaviour instead of showing "CamelCaseToSnakeCase" in attribute errors.
This commit is contained in:
James Lu 2017-06-27 16:25:40 -07:00
parent 56275c5a3b
commit 91fe7e0ca7

View File

@ -627,6 +627,6 @@ class CamelCaseToSnakeCase():
if normalized_attr == attr: if normalized_attr == attr:
# __getattr__ only fires if normal attribute fetching fails, so we can assume that # __getattr__ only fires if normal attribute fetching fails, so we can assume that
# the attribute was tried already and failed. # the attribute was tried already and failed.
raise AttributeError('%s object has no attribute of normalized name %r' % (__class__.__name__, attr)) raise AttributeError('%s object has no attribute of normalized name %r' % (self.__class__.__name__, attr))
return getattr(self, normalized_attr) return getattr(self, normalized_attr)