Enhance ModelView class with iterable and indexing support
- Added iterator, length, and item access methods to the `ModelView` class, allowing it to handle single models and lists more effectively. - Refactored the `vlans` method in the `Keenetic` model to restore functionality for decoding VLAN descriptions, improving data processing consistency.
This commit is contained in:
@@ -33,13 +33,13 @@ class Keenetic(BaseDevice):
|
||||
item["description"] = decoded
|
||||
return interfaces
|
||||
|
||||
# def vlans(self):
|
||||
# vlans = self.raw["vlans"]
|
||||
# for item in vlans:
|
||||
# if item.get("description"):
|
||||
# decoded = self._decode_utf(item.get("description", ""))
|
||||
# item["description"] = decoded
|
||||
# return vlans
|
||||
def vlans(self):
|
||||
vlans = self.raw["vlans"]
|
||||
for item in vlans:
|
||||
if item.get("description"):
|
||||
decoded = self._decode_utf(item.get("description", ""))
|
||||
item["description"] = decoded
|
||||
return vlans
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user