fix: use ternary expr

This commit is contained in:
Bingsu
2023-08-28 20:40:51 +09:00
parent 91c0239d02
commit 7b4aed49c3

View File

@@ -295,14 +295,10 @@ class AfterDetailerScript(scripts.Script):
return width, height return width, height
def get_steps(self, p, args: ADetailerArgs) -> int: def get_steps(self, p, args: ADetailerArgs) -> int:
if args.ad_use_steps: return args.ad_steps if args.ad_use_steps else p.steps
return args.ad_steps
return p.steps
def get_cfg_scale(self, p, args: ADetailerArgs) -> float: def get_cfg_scale(self, p, args: ADetailerArgs) -> float:
if args.ad_use_cfg_scale: return args.ad_cfg_scale if args.ad_use_cfg_scale else p.cfg_scale
return args.ad_cfg_scale
return p.cfg_scale
def get_sampler(self, p, args: ADetailerArgs) -> str: def get_sampler(self, p, args: ADetailerArgs) -> str:
return args.ad_sampler if args.ad_use_sampler else p.sampler_name return args.ad_sampler if args.ad_use_sampler else p.sampler_name
@@ -314,9 +310,7 @@ class AfterDetailerScript(scripts.Script):
return d return d
def get_initial_noise_multiplier(self, p, args: ADetailerArgs) -> float | None: def get_initial_noise_multiplier(self, p, args: ADetailerArgs) -> float | None:
if args.ad_use_noise_multiplier: return args.ad_noise_multiplier if args.ad_use_noise_multiplier else None
return args.ad_noise_multiplier
return None
@staticmethod @staticmethod
def infotext(p) -> str: def infotext(p) -> str: