Index: vws ================================================================== --- vws +++ vws @@ -147,11 +147,11 @@ def read_netinfo(filename): """ Reads network information from start script """ with open(filename, "r") as f: for line in f: - match = re.search("-net nic,(?:\S*,)?macaddr=(\\S+) -net ([^, ]+)", line) + match = re.search("-net nic,(?:\\S*,)?macaddr=(\\S+) -net ([^, ]+)", line) if match: f = {"mac":match.group(1)} if match.group(2) == "user": f["iface"] = "user" elif match.group(2) == "bridge": @@ -340,22 +340,22 @@ if options.id is None: # Search for devices which could be interpreted as CDROM devlist = send_command(options.sock, "info block") idx = devlist.find("info block") if idx != -1: - devlist=devlist[devlist.find("\n",idx)+1:] + devlist = devlist[devlist.find("\n", idx)+1:] for dev in devlist.split("\r\n\r\n"): if dev.find("\n Removable device: ") == -1: continue if dev.startswith("floppy"): continue - dev_id = dev[:dev.find(":")] + dev_id = dev[:dev.find(":")] idx = dev_id.find(" ") - if idx != -1: + if idx != -1: dev_id = dev[:idx] - options.id = dev_id - break + options.id = dev_id + break if options.id is None: print("No CDROM device found among:\n" + devlist, file=sys.stderr) return 1 if options.file == "": print("Please specify either --eject or iso image", file=sys.stderr) @@ -548,11 +548,11 @@ def cmd_sendkey(options): """ vws sendkey """ for keyspec in options.keyspec: if keyspec == " ": - keyspec="spc" + keyspec = "spc" print(send_command(options.sock, "sendkey " + keyspec)) def cmd_version(_): """ vws cersion """ print(VERSION) @@ -950,18 +950,18 @@ cmds = args.add_subparsers(dest='command', help="sub-command help") p = cmds.add_parser("list", help="List existing VWs", description="List existing VWs") p.add_argument("-l", "--state", const=True, default=False, dest='state', action='store_const', help='Show state of the machine') - p.add_argument('-u', "--usb", action='store_const', const=True, - default=False, dest='usb', help='Show connected USB devices') + p.add_argument('-u', "--usb", action='store_const', const=True, + default=False, dest='usb', help='Show connected USB devices') p.add_argument("pattern", nargs='*', default='*', help="Name patterns") p = cmds.add_parser("version", help="show vws version") p = cmds.add_parser("autostart", help="Autostart all VMs marked as autostartable") p = cmds.add_parser("shutdown", help="shut down all running VMs") - p.add_argument('-w', "--wait", + p.add_argument('-w', "--wait", help="wait until all machines would be shutdown", action="store_const", const=True, default=False, dest="wait") p.add_argument('-t', "--timeout", type=int, default=90, help="how long to way for VMs shutdown before forcing it off") # Power management @@ -1017,13 +1017,14 @@ help='Commit snapshot changes into backing file') p = new_command(cmds, 'snapshots', help='List existing snapshots') # Screenshoits and recording p = new_command(cmds, 'screenshot', help='take a screenshot', description='Takes a screenshot', - epilog="""Writes current screen contents of the virtual machine into PPM format file""") + epilog="Writes current screen contents of the virtual " + + "machine into PPM format file") p.add_argument('filename', metavar='filename.ppm', - help='PPM image filename to write screenshot to') + help='PPM image filename to write screenshot to') p = new_command(cmds, 'record', help='Record audio output from VM') p.add_argument('filename', help='wav file to record autdio to') new_command(cmds, 'stoprecord', help='stop recording audio') p = new_command(cmds, 'sendkey', help='Send a keystroke to VM', description='Send a key combination into VM', @@ -1080,11 +1081,11 @@ os.umask(0o002) # Create command is totally different, so it is handled separately if parsed_args.command == 'create': try: cmd_create(parsed_args) - except Exception as ex: + except Exception as ex: # pylint: disable=broad-except print(str(ex), file=sys.stderr) if hasattr(parsed_args, "dir"): import shutil shutil.rmtree(parsed_args.dir) sys.exit(1)