From c8455bf373d58d8b2928ba3d56488318f4095b83 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 25 Jul 2016 19:05:26 +0300 Subject: [PATCH] Fix UserList for Py3 compatibility --- m_lib/flad/flad.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/m_lib/flad/flad.py b/m_lib/flad/flad.py index b2446d8..a058fab 100644 --- a/m_lib/flad/flad.py +++ b/m_lib/flad/flad.py @@ -5,7 +5,6 @@ import string -from UserList import UserList # Flad restriction error @@ -15,7 +14,7 @@ checking_error = "flad.checking_error" def_keysep = ": " -class Flad(UserList): +class Flad(list): """ Class to represent memory database. FLAD database is a list of records, @@ -27,7 +26,7 @@ class Flad(UserList): # field_sep = rec_sep = '\n' def __init__(self, check_record_func = None, key_sep = def_keysep): - UserList.__init__(self) + list.__init__(self) self.check_record_func = check_record_func self.key_sep = key_sep @@ -53,31 +52,31 @@ class Flad(UserList): if not self.check_record(item): self.checking_error() else: - UserList.__setitem__(self, i, item) + list.__setitem__(self, i, item) - def __setslice__(self, i, j, list): - if list: - copy_list = list[:] - for item in list: + def __setslice__(self, i, j, v_list): + if v_list: + copy_list = v_list[:] + for item in v_list: if not self.check_record(item): self.checking_error() del copy_list[copy_list.index(item)] - UserList.__setslice__(self, i, j, copy_list) + list.__setslice__(self, i, j, copy_list) def append(self, item): if not self.check_record(item): self.checking_error() else: - UserList.append(self, item) + list.append(self, item) def insert(self, i, item): if not self.check_record(item): self.checking_error() else: - UserList.insert(self, i, item) + list.insert(self, i, item) def split_key(self, line): -- 2.39.5