mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2025-12-31 08:50:41 +00:00
flake8
This commit is contained in:
@@ -45,38 +45,38 @@ class MetaBrowser(Cmd):
|
||||
|
||||
@staticmethod
|
||||
def print_value(collection, key):
|
||||
val = collection[key]
|
||||
if isinstance(val, int):
|
||||
print(f" - {key}: {val}")
|
||||
elif isinstance(val, str):
|
||||
print(f" - {key}: \"{val}\"")
|
||||
elif isinstance(val, dict):
|
||||
print(f" - {key}: Dict ({len(val)} keys)")
|
||||
elif isinstance(val, list):
|
||||
print(f" - {key}: List ({len(val)} keys)")
|
||||
elif isinstance(val, bytes):
|
||||
print(f" - {key}: ({len(val)} bytes)")
|
||||
elif val == None:
|
||||
print(f" - {key}: (NO VALUE)")
|
||||
else:
|
||||
print(f" - {key}: Unknown")
|
||||
val = collection[key]
|
||||
if isinstance(val, int):
|
||||
print(f" - {key}: {val}")
|
||||
elif isinstance(val, str):
|
||||
print(f" - {key}: \"{val}\"")
|
||||
elif isinstance(val, dict):
|
||||
print(f" - {key}: Dict ({len(val)} keys)")
|
||||
elif isinstance(val, list):
|
||||
print(f" - {key}: List ({len(val)} keys)")
|
||||
elif isinstance(val, bytes):
|
||||
print(f" - {key}: ({len(val)} bytes)")
|
||||
elif val is None:
|
||||
print(f" - {key}: (NO VALUE)")
|
||||
else:
|
||||
print(f" - {key}: Unknown")
|
||||
|
||||
def do_ls(self, _):
|
||||
'List items at the current node: LS'
|
||||
root = self.cwd
|
||||
|
||||
if isinstance(root, list):
|
||||
print(f"List:")
|
||||
print("List:")
|
||||
for i in range(len(root)):
|
||||
self.print_value(root, i)
|
||||
|
||||
elif isinstance(root, dict):
|
||||
print(f"Dictionary:")
|
||||
print("Dictionary:")
|
||||
for key in root:
|
||||
self.print_value(root, key)
|
||||
|
||||
else:
|
||||
print(f"Cannot print node, is not a list or dictionary.")
|
||||
print("Cannot print node, is not a list or dictionary.")
|
||||
|
||||
def do_cd(self, args):
|
||||
'Switch to a different node: CD node-name | ".."'
|
||||
@@ -174,6 +174,5 @@ def main():
|
||||
cli.cmdloop()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user