From ad30e9a8d9ac35e77ffe6e9316a1d1f93340b2d1 Mon Sep 17 00:00:00 2001 From: CordlessCoder Date: Tue, 5 Jul 2022 20:03:52 +0300 Subject: [PATCH] removed a debug print statement --- config.toml | 19 +++++++++++++++++++ utils/tomlchecker.py | 23 ++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 config.toml mode change 100644 => 100755 utils/tomlchecker.py diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..baba72c --- /dev/null +++ b/config.toml @@ -0,0 +1,19 @@ +[settings] +allow_nsfw = false +theme = "light" +times_to_run = 1 +opacity = 0.9 +storymode = false + +[reddit.creds] +client_id = "adsfadsfasdf" +client_secret = "adsfasdfadsfasdfasdf" +username = "asdfasdfadsf" +password = "asdfasdfadsf" +2fa = false + +[reddit.thread] +random = false +subreddit = "asdfasdfadsfadsfadfs" +post_id = "asdfasdfasdf" +max_comment_length = 500 diff --git a/utils/tomlchecker.py b/utils/tomlchecker.py old mode 100644 new mode 100755 index c44108f..85f6a58 --- a/utils/tomlchecker.py +++ b/utils/tomlchecker.py @@ -73,8 +73,7 @@ If you see any prompts, that means that you have unset/incorrectly set variables ): # FAILSTATE Value is not one of the options value = handle_input( message=( - (("[blue]Example: " + str(checks["example"]) + "\n") - if "example" in checks else "") + (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + "[red]" + ("Non-optional ", "Optional ")[ "optional" in checks and checks["optional"] is True @@ -94,8 +93,7 @@ If you see any prompts, that means that you have unset/incorrectly set variables ): # FAILSTATE Value doesn't match regex, or has regex but is not a string. value = handle_input( message=( - (("[blue]Example: " + str(checks["example"]) + "\n") - if "example" in checks else "") + (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + "[red]" + ("Non-optional ", "Optional ")[ "optional" in checks and checks["optional"] is True @@ -116,14 +114,12 @@ If you see any prompts, that means that you have unset/incorrectly set variables ) if not hasattr(value, "__iter__") and ( - ("nmin" in checks and checks["nmin"] - is not None and value < checks["nmin"]) + ("nmin" in checks and checks["nmin"] is not None and value < checks["nmin"]) or ("nmax" in checks and checks["nmax"] is not None and value > checks["nmax"]) ): value = handle_input( message=( - (("[blue]Example: " + str(checks["example"]) + "\n") - if "example" in checks else "") + (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + "[red]" + ("Non-optional ", "Optional ")[ "optional" in checks and checks["optional"] is True @@ -143,14 +139,12 @@ If you see any prompts, that means that you have unset/incorrectly set variables else "Input out of bounds(Value too high/low/long/short)", ) if hasattr(value, "__iter__") and ( - ("nmin" in checks and checks["nmin"] - is not None and len(value) < checks["nmin"]) + ("nmin" in checks and checks["nmin"] is not None and len(value) < checks["nmin"]) or ("nmax" in checks and checks["nmax"] is not None and len(value) > checks["nmax"]) ): value = handle_input( message=( - (("[blue]Example: " + str(checks["example"]) + "\n") - if "example" in checks else "") + (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + "[red]" + ("Non-optional ", "Optional ")[ "optional" in checks and checks["optional"] is True @@ -172,8 +166,7 @@ If you see any prompts, that means that you have unset/incorrectly set variables if value == {}: handle_input( message=( - (("[blue]Example: " + str(checks["example"]) + "\n") - if "example" in checks else "") + (("[blue]Example: " + str(checks["example"]) + "\n") if "example" in checks else "") + "[red]" + ("Non-optional ", "Optional ")[ "optional" in checks and checks["optional"] is True @@ -252,7 +245,7 @@ Creating it now.""" ) return False crawl(template, check_vars) - pretty.pprint(config) + # pretty.pprint(config) with open(config_file, "w") as f: toml.dump(config, f) return True