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")
try:
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:
subreddit = reddit.subreddit("askreddit")

@ -4,28 +4,32 @@ import tempfile
from os import path
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():
if path.exists(".env.template"): # if .env.template exists and .env does not exist
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:
envTemplate = f.read()
elif platform == "darwin" or platform == "linux":
envTemplate = subprocess.check_output("awk -F '=' 'NF {print $1}' .env.template | grep --regexp=^[a-zA-Z]",
shell=True, )
envTemplate = subprocess.check_output(
"awk -F '=' 'NF {print $1}' .env.template | grep --regexp=^[a-zA-Z]",
shell=True,
)
else:
raise OSError("Unsupported platform")
elif path.exists(".env"):
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:
envTemplate = f.read()
elif platform == "darwin" or platform == "linux":
envTemplate = subprocess.check_output("awk -F '=' 'NF {print $1}' .env | grep --regexp=^[a-zA-Z]",
shell=True, )
envTemplate = subprocess.check_output(
"awk -F '=' 'NF {print $1}' .env | grep --regexp=^[a-zA-Z]",
shell=True,
)
else:
raise OSError("Unsupported platform")
else:
@ -35,7 +39,6 @@ def envUpdate():
tempEnv.seek(0)
envVars = tempEnv.readlines()
missing = []
isMissingEnvs = False
for env in envVars:
@ -51,9 +54,11 @@ def envUpdate():
missing.append(env)
if isMissingEnvs:
printstr = ''
printstr = ""
[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)

Loading…
Cancel
Save