parameters: (self, key, location)
docstring: Change location of an existing item.
docstring_summary: Change location of an existing item.
docstring_tokens: Change location of an existing item .
function: def link(self, key, location):
          """ Change location of an existing item. """
          n = self.keyOrder.index(key)
          del self.keyOrder[n]
          try:
              i = self.index_for_location(location)
              if i is not None:
                  self.keyOrder.insert(i, key)
              else:
                  self.keyOrder.append(key)
          except Exception as e:
              # restore to prevent data loss and reraise
              self.keyOrder.insert(n, key)
              raise e
function_tokens: def link ( self , key , location ) : n = self . keyOrder . index ( key ) del self . keyOrder [ n ] try : i = self . index_for_location ( location ) if i is not None : self . keyOrder . insert ( i , key ) else : self . keyOrder . append ( key ) except Exception as e : # restore to prevent data loss and reraise self . keyOrder . insert ( n , key ) raise e