mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-01 00:02:34 +03:00
fix(typing): resolve mypy errors in compute.iou.utils
This commit is contained in:
parent
1babf7bcce
commit
a7350ae0c8
@ -204,9 +204,8 @@ if __name__ == "__main__":
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fd = open(args.nvram, "rb")
|
with open(args.nvram, "rb") as fd:
|
||||||
nvram = fd.read()
|
nvram = fd.read()
|
||||||
fd.close()
|
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
sys.stderr.write(f"Error reading file: {err}\n")
|
sys.stderr.write(f"Error reading file: {err}\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -218,16 +217,14 @@ if __name__ == "__main__":
|
|||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fd = open(args.startup, "wb")
|
with open(args.startup, "wb") as out:
|
||||||
fd.write(startup)
|
out.write(startup)
|
||||||
fd.close()
|
|
||||||
if args.private is not None:
|
if args.private is not None:
|
||||||
if private is None:
|
if private is None:
|
||||||
sys.stderr.write("Warning: No private config\n")
|
sys.stderr.write("Warning: No private config\n")
|
||||||
else:
|
else:
|
||||||
fd = open(args.private, "wb")
|
with open(args.private, "wb") as out:
|
||||||
fd.write(private)
|
out.write(private)
|
||||||
fd.close()
|
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
sys.stderr.write(f"Error writing file: {err}\n")
|
sys.stderr.write(f"Error writing file: {err}\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
@ -197,22 +197,17 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument("private", metavar="private-config", nargs="?", help="private configuration")
|
parser.add_argument("private", metavar="private-config", nargs="?", help="private configuration")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
nvram: bytes | None = None
|
||||||
|
private: bytes | None = None
|
||||||
try:
|
try:
|
||||||
if args.create is None:
|
if args.create is None:
|
||||||
fd = open(args.nvram, "rb")
|
with open(args.nvram, "rb") as fd:
|
||||||
nvram = fd.read()
|
nvram = fd.read()
|
||||||
fd.close()
|
with open(args.startup, "rb") as fd:
|
||||||
else:
|
startup = fd.read()
|
||||||
nvram = None
|
if args.private is not None:
|
||||||
fd = open(args.startup, "rb")
|
with open(args.private, "rb") as fd:
|
||||||
startup = fd.read()
|
private = fd.read()
|
||||||
fd.close()
|
|
||||||
if args.private is None:
|
|
||||||
private = None
|
|
||||||
else:
|
|
||||||
fd = open(args.private, "rb")
|
|
||||||
private = fd.read()
|
|
||||||
fd.close()
|
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
sys.stderr.write(f"Error reading file: {err}\n")
|
sys.stderr.write(f"Error reading file: {err}\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -224,9 +219,8 @@ if __name__ == "__main__":
|
|||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fd = open(args.nvram, "wb")
|
with open(args.nvram, "wb") as out:
|
||||||
fd.write(nvram)
|
out.write(nvram)
|
||||||
fd.close()
|
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
sys.stderr.write(f"Error writing file: {err}\n")
|
sys.stderr.write(f"Error writing file: {err}\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
@ -355,8 +355,6 @@ module = [
|
|||||||
"gns3server.api.routes.controller.snapshots", # 1
|
"gns3server.api.routes.controller.snapshots", # 1
|
||||||
"gns3server.api.routes.controller.templates", # 10
|
"gns3server.api.routes.controller.templates", # 10
|
||||||
"gns3server.api.routes.controller.users", # 14
|
"gns3server.api.routes.controller.users", # 14
|
||||||
"gns3server.compute.iou.utils.iou_export", # 2
|
|
||||||
"gns3server.compute.iou.utils.iou_import", # 2
|
|
||||||
"gns3server.compute.virtualbox.virtualbox_vm", # 1
|
"gns3server.compute.virtualbox.virtualbox_vm", # 1
|
||||||
"gns3server.compute.vpcs.vpcs_vm", # 2
|
"gns3server.compute.vpcs.vpcs_vm", # 2
|
||||||
"gns3server.controller.appliance", # 2
|
"gns3server.controller.appliance", # 2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user