Skip to content

Commit

Permalink
Fix for some list stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrusnetwork committed Oct 9, 2024
1 parent 522c71a commit e37764f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hydrus/core/HydrusData.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ def __delitem__( self, index ):

item = self._list[ index ]
del self._list[ index ]
del self._items_to_indices[ item ]

if item in self._items_to_indices:

del self._items_to_indices[ item ]


if index not in ( -1, len( self._list ) - 1 ):

Expand Down Expand Up @@ -217,7 +221,11 @@ def __repr__( self ):
def __setitem__( self, index, value ):

old_item = self._list[ index ]
del self._items_to_indices[ old_item ]

if old_item in self._items_to_indices:

del self._items_to_indices[ old_item ]


self._list[ index ] = value
self._items_to_indices[ value ] = index
Expand Down

0 comments on commit e37764f

Please sign in to comment.