From b23e246d1147cdc4686ffc4addcb512f511fd786 Mon Sep 17 00:00:00 2001 From: joshrandall8478 <joshrandall8478@gmail.com> Date: Thu, 3 Oct 2024 13:16:12 -0400 Subject: [PATCH] working on environment variable setup --- .env | 4 ++-- .vscode/launch.json | 15 +++++++++++++++ main.py | 4 +++- requirements.txt | 3 ++- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.env b/.env index f6a1796..93be09c 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ ASSIGNMENT_TITLE="" -# LATE_PENALTY= -# SCORE_DEFAULT= +LATE_PENALTY="0.1" +SCORE_DEFAULT="100" POINTS_FOR_RUNS=[] \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6b76b4f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/main.py b/main.py index da7a21a..df7cb09 100644 --- a/main.py +++ b/main.py @@ -2,8 +2,10 @@ from pyfiglet import Figlet from os import system from colored import Fore, Style #Documentation: https://dslackw.gitlab.io/colored/user_guide/user_guide/#user-guide from time import sleep +from dotenv import load_dotenv import os +load_dotenv("./.env") """ These are global variables, some can be changed. """ @@ -26,7 +28,7 @@ Environment Variable Imports title = os.getenv("ASSIGNMENT_TITLE", default="Assignment Title") scoreDefault = os.getenv("SCORE_DEFAULT", default=100) # What the score is out of -latePenalty = scoreDefault * int(os.getenv("LATE_PENALTY", default="1")) +latePenalty = scoreDefault * float(os.getenv("LATE_PENALTY", default="0.1")) defaults = os.getenv("POINTS_FOR_RUNS", default=[10,20,0]) """ * CHANGEABLE diff --git a/requirements.txt b/requirements.txt index c32cd1b..aae234a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ pyfiglet -colored \ No newline at end of file +colored +python-dotenv \ No newline at end of file -- GitLab