Skip to content

Commit 5ccdea4

Browse files
committed
Switched to object.__setattr__()
Since BaseEntity's __setattr__ does nothing necessary for these calls, I've changed all the super().__setattr__() calls to object.__setattr__() to skip all the nonsense.
1 parent 18f01f1 commit 5ccdea4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

addons/source-python/packages/source-python/entities/entity.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def __init__(self, index):
6161
super().__init__(index)
6262

6363
# Set the entity's base attributes
64-
super().__setattr__('_index', index)
65-
super().__setattr__('_edict', None)
66-
super().__setattr__('_pointer', None)
64+
object.__setattr__(self, '_index', index)
65+
object.__setattr__(self, '_edict', None)
66+
object.__setattr__(self, '_pointer', None)
6767

6868
def __getattr__(self, attr):
6969
"""Find if the attribute is valid and returns the appropriate value."""
@@ -101,7 +101,7 @@ def __setattr__(self, attr, value):
101101
getattr(self.__class__, name, None), property)):
102102

103103
# Set the private attribute's value
104-
super().__setattr__(attr, value)
104+
object.__setattr__(self, attr, value)
105105

106106
# No need to go further
107107
return
@@ -111,7 +111,7 @@ def __setattr__(self, attr, value):
111111
getattr(self.__class__, attr, None), property)):
112112

113113
# Set the property's value
114-
super().__setattr__(attr, value)
114+
object.__setattr__(self, attr, value)
115115

116116
# No need to go further
117117
return
@@ -227,15 +227,15 @@ def edict(self):
227227
"""Return the entity's :class:`entities.Edict` instance."""
228228
if self._edict is None:
229229
edict = edict_from_index(self.index)
230-
super(Entity, self).__setattr__('_edict', edict)
230+
object.__setattr__(self, '_edict', edict)
231231
return self._edict
232232

233233
@property
234234
def pointer(self):
235235
"""Return the entity's :class:`memory.Pointer`."""
236236
if self._pointer is None:
237237
pointer = memory.get_object_pointer(self)
238-
super(Entity, self).__setattr__('_pointer', pointer)
238+
object.__setattr__(self, '_pointer', pointer)
239239
return self._pointer
240240

241241
@property

addons/source-python/packages/source-python/players/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ def __init__(self, index):
6464
:raise ValueError: Raised if the index is invalid.
6565
"""
6666
super().__init__(index)
67-
super(Entity, self).__setattr__('_playerinfo', None)
67+
object.__setattr__(self, '_playerinfo', None)
6868

6969
@property
7070
def playerinfo(self):
7171
"""Return the player's :class:`PlayerInfo` object."""
7272
if self._playerinfo is None:
7373
playerinfo = playerinfo_from_index(self.index)
74-
super(Player, self).__setattr__('_playerinfo', playerinfo)
74+
object.__setattr__(self, '_playerinfo', playerinfo)
7575
return self._playerinfo
7676

7777
@property

0 commit comments

Comments
 (0)