Add repr()/__repr__() to ListModelMap

This commit is contained in:
miruka 2019-05-09 13:55:02 -04:00
parent f065c699f1
commit a15f6b0bac

View File

@ -18,14 +18,8 @@ class ListModelMap(QObject):
) )
@pyqtSlot(str, result="QVariant") def __repr__(self) -> str:
def get(self, key) -> ListModel: return "%s(%r)" % (type(self).__name__, self.dict)
return self.dict[key]
@pyqtSlot(str, result=bool)
def has(self, key) -> bool:
return key in self.dict
def __getitem__(self, key) -> ListModel: def __getitem__(self, key) -> ListModel:
@ -47,3 +41,18 @@ class ListModelMap(QObject):
def __len__(self) -> int: def __len__(self) -> int:
return len(self.dict) return len(self.dict)
@pyqtSlot(result=str)
def repr(self) -> str:
return self.__repr__()
@pyqtSlot(str, result="QVariant")
def get(self, key) -> ListModel:
return self.dict[key]
@pyqtSlot(str, result=bool)
def has(self, key) -> bool:
return key in self.dict