Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
args.frame = src.num_frames // -args.frame
elif args.frame > src.num_frames - 1:
raise GetnativeException(f"Last frame is {src.num_frames - 1}, but you want {args.frame}")
if args.ar == 0:
args.ar = src.width / src.height
if args.min_h >= src.height:
raise GetnativeException(f"Input image {src.height} is smaller min_h {args.min_h}")
elif args.min_h >= args.max_h:
raise GetnativeException(f"min_h {args.min_h} > max_h {args.max_h}? Not processable")
elif args.max_h > src.height:
print(f"The image height is {src.height}, going higher is stupid! New max_h {src.height}")
args.max_h = src.height
getn = GetNative(src, scaler, args.ar, args.min_h, args.max_h, args.frame, args.mask_out, args.plot_scaling,
args.plot_format, args.show_plot, args.no_save, args.steps, output_dir)
try:
loop = asyncio.get_event_loop()
best_value, plot, resolutions = loop.run_until_complete(getn.run())
except ValueError as err:
raise GetnativeException(f"Error in getnative: {err}")
gc.collect()
print(
f"\n{scaler} AR: {args.ar:.2f} Steps: {args.steps}\n"
f"{best_value}\n"
)
return resolutions, plot