From 2292dbc1ce41d826e1da45018e856d793e144574 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 13 Sep 2020 17:15:49 +0200 Subject: [PATCH] PEP 8 format Mystery.py --- Mystery.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Mystery.py b/Mystery.py index b80eeeaf..399cb7ae 100644 --- a/Mystery.py +++ b/Mystery.py @@ -50,7 +50,7 @@ def mystery_argparse(): return args -def main(args=None, callback = ERmain): +def main(args=None, callback=ERmain): if not args: args = mystery_argparse() @@ -69,7 +69,8 @@ def main(args=None, callback = ERmain): weights_cache[args.weights] = get_weights(args.weights) except Exception as e: raise ValueError(f"File {args.weights} is destroyed. Please fix your yaml.") from e - print(f"Weights: {args.weights} >> {get_choice('description', weights_cache[args.weights], 'No description specified')}") + print(f"Weights: {args.weights} >> " + f"{get_choice('description', weights_cache[args.weights], 'No description specified')}") if args.meta: try: weights_cache[args.meta] = get_weights(args.meta) @@ -86,13 +87,14 @@ def main(args=None, callback = ERmain): try: if path not in weights_cache: weights_cache[path] = get_weights(path) - print(f"P{player} Weights: {path} >> {get_choice('description', weights_cache[path], 'No description specified')}") + print(f"P{player} Weights: {path} >> " + f"{get_choice('description', weights_cache[path], 'No description specified')}") except Exception as e: raise ValueError(f"File {path} is destroyed. Please fix your yaml.") from e erargs = parse_arguments(['--multi', str(args.multi)]) erargs.seed = seed - erargs.name = {x: "" for x in range(1, args.multi + 1)} # only so it can be overwrittin in mystery + erargs.name = {x: "" for x in range(1, args.multi + 1)} # only so it can be overwrittin in mystery erargs.create_spoiler = args.create_spoiler erargs.create_diff = args.create_diff erargs.race = args.race @@ -126,11 +128,13 @@ def main(args=None, callback = ERmain): if self._msg != '': self._writer(self._msg) self._msg = '' + log = logging.getLogger("stderr") log.addHandler(logging.StreamHandler()) sys.stderr = LoggerWriter(log.error) os.makedirs(args.log_output_path, exist_ok=True) - logging.basicConfig(format='%(message)s', level=loglevel, filename=os.path.join(args.log_output_path, f"{seed}.log")) + logging.basicConfig(format='%(message)s', level=loglevel, + filename=os.path.join(args.log_output_path, f"{seed}.log")) else: logging.basicConfig(format='%(message)s', level=loglevel) if args.rom: @@ -258,7 +262,8 @@ def roll_settings(weights): if random.random() < (option_set["percentage"] / 100): weights.update(option_set["options"]) except Exception as e: - raise ValueError(f"Linked option {option_set['name']} is destroyed. Please fix your linked option.") from e + raise ValueError(f"Linked option {option_set['name']} is destroyed. " + f"Please fix your linked option.") from e ret.name = get_choice('name', weights) if ret.name: @@ -269,7 +274,7 @@ def roll_settings(weights): logging.warning("Only NMG, OWG and No Logic supported") glitches_required = 'none' ret.logic = {None: 'noglitches', 'none': 'noglitches', 'no_logic': 'nologic', 'overworld_glitches': 'owglitches', - 'minor_glitches' : 'minorglitches'}[ + 'minor_glitches': 'minorglitches'}[ glitches_required] ret.progression_balancing = get_choice('progression_balancing', weights, True) # item_placement = get_choice('item_placement') @@ -308,8 +313,7 @@ def roll_settings(weights): 'local_ganon_triforce_hunt': 'localganontriforcehunt' }[goal] - - #TODO consider moving open_pyramid to an automatic variable in the core roller, set to True when + # TODO consider moving open_pyramid to an automatic variable in the core roller, set to True when # fast ganon + ganon at hole ret.open_pyramid = goal in {'fast_ganon', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt'} @@ -455,5 +459,6 @@ def roll_settings(weights): ret.quickswap = True return ret + if __name__ == '__main__': main()