reformatted again

pull/560/head
Jason 3 years ago
parent 56ad559339
commit 894bc306c3

@ -48,7 +48,8 @@ def get_subreddit_threads():
): # note to user. you can have multiple subreddits via reddit.subreddit("redditdev+learnpython") ): # note to user. you can have multiple subreddits via reddit.subreddit("redditdev+learnpython")
try: try:
subreddit = reddit.subreddit( subreddit = reddit.subreddit(
re.sub(r"r\/", "", input("What subreddit would you like to pull from? ")) # removes the r/ from the input re.sub(r"r\/", "", input("What subreddit would you like to pull from? "))
# removes the r/ from the input
) )
except ValueError: except ValueError:
subreddit = reddit.subreddit("askreddit") subreddit = reddit.subreddit("askreddit")

@ -4,28 +4,32 @@ import tempfile
from os import path from os import path
from sys import platform from sys import platform
ACCEPTABLE_TO_BE_LEFT_BLANK = ['RANDOM_THREAD', 'TIMES_TO_RUN'] ACCEPTABLE_TO_BE_LEFT_BLANK = ["RANDOM_THREAD", "TIMES_TO_RUN"]
def envUpdate(): def envUpdate():
if path.exists(".env.template"): # if .env.template exists and .env does not exist if path.exists(".env.template"): # if .env.template exists and .env does not exist
if platform == "win32" or platform == "cygwin": if platform == "win32" or platform == "cygwin":
runPS('utils/scripts/FileGrabber.ps1') runPS("utils/scripts/FileGrabber.ps1")
with open(".\\video_creation\\data\\envvars.txt", "rb") as f: with open(".\\video_creation\\data\\envvars.txt", "rb") as f:
envTemplate = f.read() envTemplate = f.read()
elif platform == "darwin" or platform == "linux": elif platform == "darwin" or platform == "linux":
envTemplate = subprocess.check_output("awk -F '=' 'NF {print $1}' .env.template | grep --regexp=^[a-zA-Z]", envTemplate = subprocess.check_output(
shell=True, ) "awk -F '=' 'NF {print $1}' .env.template | grep --regexp=^[a-zA-Z]",
shell=True,
)
else: else:
raise OSError("Unsupported platform") raise OSError("Unsupported platform")
elif path.exists(".env"): elif path.exists(".env"):
if platform == "win32" or platform == "cygwin": if platform == "win32" or platform == "cygwin":
runPS('utils/scripts/FileGrabberenv.ps1') runPS("utils/scripts/FileGrabberenv.ps1")
with open(".\\video_creation\\data\\envvars.txt", "rb") as f: with open(".\\video_creation\\data\\envvars.txt", "rb") as f:
envTemplate = f.read() envTemplate = f.read()
elif platform == "darwin" or platform == "linux": elif platform == "darwin" or platform == "linux":
envTemplate = subprocess.check_output("awk -F '=' 'NF {print $1}' .env | grep --regexp=^[a-zA-Z]", envTemplate = subprocess.check_output(
shell=True, ) "awk -F '=' 'NF {print $1}' .env | grep --regexp=^[a-zA-Z]",
shell=True,
)
else: else:
raise OSError("Unsupported platform") raise OSError("Unsupported platform")
else: else:
@ -35,7 +39,6 @@ def envUpdate():
tempEnv.seek(0) tempEnv.seek(0)
envVars = tempEnv.readlines() envVars = tempEnv.readlines()
missing = [] missing = []
isMissingEnvs = False isMissingEnvs = False
for env in envVars: for env in envVars:
@ -51,9 +54,11 @@ def envUpdate():
missing.append(env) missing.append(env)
if isMissingEnvs: if isMissingEnvs:
printstr = '' printstr = ""
[printstr + str(var) for var in missing] [printstr + str(var) for var in missing]
print(f"The following environment variables are missing: {printstr}. Please add them to the .env file.") print(
f"The following environment variables are missing: {printstr}. Please add them to the .env file."
)
exit(-1) exit(-1)

Loading…
Cancel
Save