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
|
@staticmethod
|
||||||
def print_value(collection, key):
|
def print_value(collection, key):
|
||||||
val = collection[key]
|
val = collection[key]
|
||||||
if isinstance(val, int):
|
if isinstance(val, int):
|
||||||
print(f" - {key}: {val}")
|
print(f" - {key}: {val}")
|
||||||
elif isinstance(val, str):
|
elif isinstance(val, str):
|
||||||
print(f" - {key}: \"{val}\"")
|
print(f" - {key}: \"{val}\"")
|
||||||
elif isinstance(val, dict):
|
elif isinstance(val, dict):
|
||||||
print(f" - {key}: Dict ({len(val)} keys)")
|
print(f" - {key}: Dict ({len(val)} keys)")
|
||||||
elif isinstance(val, list):
|
elif isinstance(val, list):
|
||||||
print(f" - {key}: List ({len(val)} keys)")
|
print(f" - {key}: List ({len(val)} keys)")
|
||||||
elif isinstance(val, bytes):
|
elif isinstance(val, bytes):
|
||||||
print(f" - {key}: ({len(val)} bytes)")
|
print(f" - {key}: ({len(val)} bytes)")
|
||||||
elif val == None:
|
elif val is None:
|
||||||
print(f" - {key}: (NO VALUE)")
|
print(f" - {key}: (NO VALUE)")
|
||||||
else:
|
else:
|
||||||
print(f" - {key}: Unknown")
|
print(f" - {key}: Unknown")
|
||||||
|
|
||||||
def do_ls(self, _):
|
def do_ls(self, _):
|
||||||
'List items at the current node: LS'
|
'List items at the current node: LS'
|
||||||
root = self.cwd
|
root = self.cwd
|
||||||
|
|
||||||
if isinstance(root, list):
|
if isinstance(root, list):
|
||||||
print(f"List:")
|
print("List:")
|
||||||
for i in range(len(root)):
|
for i in range(len(root)):
|
||||||
self.print_value(root, i)
|
self.print_value(root, i)
|
||||||
|
|
||||||
elif isinstance(root, dict):
|
elif isinstance(root, dict):
|
||||||
print(f"Dictionary:")
|
print("Dictionary:")
|
||||||
for key in root:
|
for key in root:
|
||||||
self.print_value(root, key)
|
self.print_value(root, key)
|
||||||
|
|
||||||
else:
|
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):
|
def do_cd(self, args):
|
||||||
'Switch to a different node: CD node-name | ".."'
|
'Switch to a different node: CD node-name | ".."'
|
||||||
@@ -174,6 +174,5 @@ def main():
|
|||||||
cli.cmdloop()
|
cli.cmdloop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user