From 0081e55a9d60364339634e7b30f45b4eefacc38f Mon Sep 17 00:00:00 2001 From: Raffu Khondaker <2022rkhondak@tjhsst.edu> Date: Thu, 4 Jun 2020 15:23:05 -0400 Subject: [PATCH 1/8] first --- .vscode/settings.json | 3 ++ requirements.txt | 6 +++ run.py | 13 +++++++ skool/bin/activate | 76 ++++++++++++++++++++++++++++++++++++++ skool/bin/activate.csh | 37 +++++++++++++++++++ skool/bin/activate.fish | 75 +++++++++++++++++++++++++++++++++++++ skool/bin/easy_install | 10 +++++ skool/bin/easy_install-3.7 | 10 +++++ skool/bin/pip | 10 +++++ skool/bin/pip3 | 10 +++++ skool/bin/pip3.7 | 10 +++++ skool/bin/pygmentize | 10 +++++ skool/bin/python | 1 + skool/bin/python3 | 1 + skool/pyvenv.cfg | 3 ++ 15 files changed, 275 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 requirements.txt create mode 100644 run.py create mode 100644 skool/bin/activate create mode 100644 skool/bin/activate.csh create mode 100644 skool/bin/activate.fish create mode 100755 skool/bin/easy_install create mode 100755 skool/bin/easy_install-3.7 create mode 100755 skool/bin/pip create mode 100755 skool/bin/pip3 create mode 100755 skool/bin/pip3.7 create mode 100755 skool/bin/pygmentize create mode 120000 skool/bin/python create mode 120000 skool/bin/python3 create mode 100644 skool/pyvenv.cfg diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e4132bb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "skool/bin/python3" +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a73f1cc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +prompt-toolkit==1.0.14 +Pygments==2.6.1 +PyInquirer==1.0.3 +regex==2020.5.14 +six==1.15.0 +wcwidth==0.2.3 diff --git a/run.py b/run.py new file mode 100644 index 0000000..3219ed7 --- /dev/null +++ b/run.py @@ -0,0 +1,13 @@ +from __future__ import print_function, unicode_literals +from PyInquirer import prompt, print_json + +questions = [ + { + 'type': 'input', + 'name': 'first_name', + 'message': 'What\'s your first name', + } +] + +answers = prompt(questions) +print_json(answers["name"]) # use the answers as input for your app \ No newline at end of file diff --git a/skool/bin/activate b/skool/bin/activate new file mode 100644 index 0000000..26ae6da --- /dev/null +++ b/skool/bin/activate @@ -0,0 +1,76 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # This should detect bash and zsh, which have a hash command that must + # be called to get it to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r + fi + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + if [ ! "$1" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV="/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool" +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + if [ "x(skool) " != x ] ; then + PS1="(skool) ${PS1:-}" + else + if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" + else + PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" + fi + fi + export PS1 +fi + +# This should detect bash and zsh, which have a hash command that must +# be called to get it to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r +fi diff --git a/skool/bin/activate.csh b/skool/bin/activate.csh new file mode 100644 index 0000000..5f9671e --- /dev/null +++ b/skool/bin/activate.csh @@ -0,0 +1,37 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV "/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool" + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/bin:$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + if ("skool" != "") then + set env_name = "skool" + else + if (`basename "VIRTUAL_ENV"` == "__") then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` + else + set env_name = `basename "$VIRTUAL_ENV"` + endif + endif + set prompt = "[$env_name] $prompt" + unset env_name +endif + +alias pydoc python -m pydoc + +rehash diff --git a/skool/bin/activate.fish b/skool/bin/activate.fish new file mode 100644 index 0000000..e47a901 --- /dev/null +++ b/skool/bin/activate.fish @@ -0,0 +1,75 @@ +# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) +# you cannot run it directly + +function deactivate -d "Exit virtualenv and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + functions -e fish_prompt + set -e _OLD_FISH_PROMPT_OVERRIDE + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + + set -e VIRTUAL_ENV + if test "$argv[1]" != "nondestructive" + # Self destruct! + functions -e deactivate + end +end + +# unset irrelevant variables +deactivate nondestructive + +set -gx VIRTUAL_ENV "/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool" + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/bin" $PATH + +# unset PYTHONHOME if set +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # save the current fish_prompt function as the function _old_fish_prompt + functions -c fish_prompt _old_fish_prompt + + # with the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command + set -l old_status $status + + # Prompt override? + if test -n "(skool) " + printf "%s%s" "(skool) " (set_color normal) + else + # ...Otherwise, prepend env + set -l _checkbase (basename "$VIRTUAL_ENV") + if test $_checkbase = "__" + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) + else + printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) + end + end + + # Restore the return status of the previous command. + echo "exit $old_status" | . + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" +end diff --git a/skool/bin/easy_install b/skool/bin/easy_install new file mode 100755 index 0000000..d362dc7 --- /dev/null +++ b/skool/bin/easy_install @@ -0,0 +1,10 @@ +#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys + +from setuptools.command.easy_install import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/skool/bin/easy_install-3.7 b/skool/bin/easy_install-3.7 new file mode 100755 index 0000000..d362dc7 --- /dev/null +++ b/skool/bin/easy_install-3.7 @@ -0,0 +1,10 @@ +#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys + +from setuptools.command.easy_install import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/skool/bin/pip b/skool/bin/pip new file mode 100755 index 0000000..30eab01 --- /dev/null +++ b/skool/bin/pip @@ -0,0 +1,10 @@ +#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys + +from pip._internal import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/skool/bin/pip3 b/skool/bin/pip3 new file mode 100755 index 0000000..30eab01 --- /dev/null +++ b/skool/bin/pip3 @@ -0,0 +1,10 @@ +#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys + +from pip._internal import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/skool/bin/pip3.7 b/skool/bin/pip3.7 new file mode 100755 index 0000000..30eab01 --- /dev/null +++ b/skool/bin/pip3.7 @@ -0,0 +1,10 @@ +#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys + +from pip._internal import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/skool/bin/pygmentize b/skool/bin/pygmentize new file mode 100755 index 0000000..16a605e --- /dev/null +++ b/skool/bin/pygmentize @@ -0,0 +1,10 @@ +#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys + +from pygments.cmdline import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/skool/bin/python b/skool/bin/python new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/skool/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/skool/bin/python3 b/skool/bin/python3 new file mode 120000 index 0000000..e9113d5 --- /dev/null +++ b/skool/bin/python3 @@ -0,0 +1 @@ +/Users/raffukhondaker/opt/miniconda3/bin/python3 \ No newline at end of file diff --git a/skool/pyvenv.cfg b/skool/pyvenv.cfg new file mode 100644 index 0000000..e5d353c --- /dev/null +++ b/skool/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /Users/raffukhondaker/opt/miniconda3/bin +include-system-site-packages = false +version = 3.7.4 From a0a58164acc993b9bb56f7b4138a5e518fb5f668 Mon Sep 17 00:00:00 2001 From: Raffu Khondaker <2022rkhondak@tjhsst.edu> Date: Thu, 4 Jun 2020 15:53:19 -0400 Subject: [PATCH 2/8] basic login --- .DS_Store | Bin 0 -> 6148 bytes .login.txt | 0 options/login.py | 20 ++++++++++++++++++++ run.py | 35 ++++++++++++++++++++++++++--------- 4 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 .DS_Store create mode 100644 .login.txt create mode 100644 options/login.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Thu, 4 Jun 2020 16:10:40 -0400 Subject: [PATCH 3/8] signup basics --- run.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/run.py b/run.py index 765cb3e..53bd908 100644 --- a/run.py +++ b/run.py @@ -2,7 +2,29 @@ from __future__ import print_function, unicode_literals from PyInquirer import prompt, print_json import os +#list of classes for student; substitute this for Database +classes = { + "Math": ["week1_hw", "week2_hw", "week3_hw", "unit3_quiz"], + "English":["journal1", "journal2", "journal3"] +} + +#already ccrerrated account through website, has to login +def yesorno(question): + questions = [ + { + 'type': 'input', + 'name': 'response', + 'message': question, + }, + ] + answers = prompt(questions) + if(answers["response"] == "yes"): + return True + return False + def login(): + #enter username + #enter password questions = [ { 'type': 'input', @@ -21,7 +43,49 @@ def login(): f.write(str(answers["user_name"])) print_json(answers) # use the answers as input for your app +#did not create account through website, has to signup/login +def signup(): + # + questions = [ + { + 'type': 'input', + 'name': 'first-name', + 'message': 'What\'s your first name', + }, + { + 'type': 'password', + 'name': 'last-name', + 'message': 'Password?', + }, + { + 'type': 'list', + 'name': 'last-name', + 'message': 'Grade?', + 'choices':["9","10","11","12"] + }, + { + 'type': 'input', + 'name': 'user_name', + 'message': 'What\'s your first name', + }, + { + 'type': 'password', + 'name': 'passwd', + 'message': 'Password?', + }, + ] + answers = prompt(questions) + print(answers) + f = open(".login.txt", "w") + f.write(str(answers["user_name"])) + print_json(answers) # use the answers as input for your app + +def setup(): + #Read classes/assignenments and setup directory: + #SkoolOS/Math/Week1 + if(os.path.exists(".login.txt") == False): + answer = yesorno("Do you have a SkoolOS account?") login() else: print("Hello!") From 1825ace9a477588e5fc71301ab2e22b32b8f423b Mon Sep 17 00:00:00 2001 From: Raffu Khondaker <2022rkhondak@tjhsst.edu> Date: Thu, 4 Jun 2020 22:07:52 -0400 Subject: [PATCH 4/8] init --- commands.py | 103 +++++++++++++++++++++++++++++++++++++++++++++++ options/login.py | 20 --------- run.py | 99 ++++++--------------------------------------- users.json | 1 + 4 files changed, 117 insertions(+), 106 deletions(-) create mode 100644 commands.py delete mode 100644 options/login.py create mode 100644 users.json diff --git a/commands.py b/commands.py new file mode 100644 index 0000000..4d92e00 --- /dev/null +++ b/commands.py @@ -0,0 +1,103 @@ +from __future__ import print_function, unicode_literals +from PyInquirer import prompt, print_json +import json +import os +import argparse + + +#already ccrerrated account through website, has to login +def yesorno(question): + questions = [ + { + 'type': 'input', + 'name': 'response', + 'message': question, + }, + ] + answers = prompt(questions) + if(answers["response"] == "y"): + return True + return False + +def login(): + #enter username + #enter password + questions = [ + { + 'type': 'input', + 'name': 'webmail', + 'message': 'What\'s TJ Webmail', + }, + { + 'type': 'password', + 'name': 'password', + 'message': 'Password?', + }, + ] + user = prompt(questions) + #reading from json of users (replace w GET to database) to check if user is registered + with open('users.json', 'r') as json_file: + data = json.load(json_file) + for i in range(len(data)): + if(user["webmail"] == data[i]["webmail"] and user["password"]) == data[i]["password"]: + print("Logged in!") + return data[i] + print("Error in your submission. Please re-enter") + return None + +#did not create account through website, has to signup/login +def signup(): + + questions = [ + { + 'type': 'input', + 'name': 'first-name', + 'message': 'What\'s your first name', + }, + { + 'type': 'input', + 'name': 'last-name', + 'message': 'What\'s your last name?', + }, + { + 'type': 'list', + 'name': 'grade', + 'message': 'Grade?', + 'choices':["9","10","11","12"] + }, + { + 'type': 'input', + 'name': 'webmail', + 'message': 'What\'s TJ Webmail?', + }, + { + 'type': 'password', + 'name': 'password', + 'message': 'Password?', + }, + ] + user = prompt(questions) + user["classes"] = [] + with open('users.json', 'r') as json_file: + data = json.load(json_file) + data.append(user) + open("users.json", "w").write(str(json.dumps(data))) + +def setup(user): + #Read classes/assignenments and setup directory: + #SkoolOS/Math/Week1 + for c in user["classes"]: + os.makedirs(c) + for a in user["classes"][c]: + os.makedirs(c + "/" + a) + + +def start(): + if(os.path.exists(".login.txt") == True): + b = yesorno("Do you have a SkoolOS account?(y/N)") + if(b): + user = login() + if(user != None): + setup(user) + else: + user = signup() \ No newline at end of file diff --git a/options/login.py b/options/login.py deleted file mode 100644 index 803e669..0000000 --- a/options/login.py +++ /dev/null @@ -1,20 +0,0 @@ -from __future__ import print_function, unicode_literals -from PyInquirer import prompt, print_json -import os - -def login(): - questions = [ - { - 'type': 'input', - 'name': 'user_name', - 'message': 'What\'s your first name', - }, - { - 'type': 'password', - 'name': 'passwd', - 'message': 'Password?', - }, - ] - - answers = prompt(questions) - print_json(answers) # use the answers as input for your app \ No newline at end of file diff --git a/run.py b/run.py index 53bd908..2bac134 100644 --- a/run.py +++ b/run.py @@ -1,94 +1,21 @@ from __future__ import print_function, unicode_literals from PyInquirer import prompt, print_json +from commands import start +import argparse +import json import os +import argparse + +my_parser = argparse.ArgumentParser(prog='skool', description='Let SkoolOS control your system', epilog="Try again") +my_parser.add_argument('--init', action="store_true") #returns true if run argument +args = my_parser.parse_args() + +outputs = vars(args) +if(outputs['init']): + start() + -#list of classes for student; substitute this for Database -classes = { - "Math": ["week1_hw", "week2_hw", "week3_hw", "unit3_quiz"], - "English":["journal1", "journal2", "journal3"] -} -#already ccrerrated account through website, has to login -def yesorno(question): - questions = [ - { - 'type': 'input', - 'name': 'response', - 'message': question, - }, - ] - answers = prompt(questions) - if(answers["response"] == "yes"): - return True - return False - -def login(): - #enter username - #enter password - questions = [ - { - 'type': 'input', - 'name': 'user_name', - 'message': 'What\'s your first name', - }, - { - 'type': 'password', - 'name': 'passwd', - 'message': 'Password?', - }, - ] - answers = prompt(questions) - print(answers) - f = open(".login.txt", "w") - f.write(str(answers["user_name"])) - print_json(answers) # use the answers as input for your app - -#did not create account through website, has to signup/login -def signup(): - # - questions = [ - { - 'type': 'input', - 'name': 'first-name', - 'message': 'What\'s your first name', - }, - { - 'type': 'password', - 'name': 'last-name', - 'message': 'Password?', - }, - { - 'type': 'list', - 'name': 'last-name', - 'message': 'Grade?', - 'choices':["9","10","11","12"] - }, - { - 'type': 'input', - 'name': 'user_name', - 'message': 'What\'s your first name', - }, - { - 'type': 'password', - 'name': 'passwd', - 'message': 'Password?', - }, - ] - answers = prompt(questions) - print(answers) - f = open(".login.txt", "w") - f.write(str(answers["user_name"])) - print_json(answers) # use the answers as input for your app - -def setup(): - #Read classes/assignenments and setup directory: - #SkoolOS/Math/Week1 - -if(os.path.exists(".login.txt") == False): - answer = yesorno("Do you have a SkoolOS account?") - login() -else: - print("Hello!") diff --git a/users.json b/users.json new file mode 100644 index 0000000..bf1713e --- /dev/null +++ b/users.json @@ -0,0 +1 @@ +[{"first_name": "Raffu", "last_name": "Khondaker", "password": "password", "webmail": "2022rkhondak@tjhsst.edu", "classes": {"Math": ["week1_hw", "week2_hw", "week3_hw", "unit3_quiz"], "English": ["journal1", "journal2", "journal3"]}}] \ No newline at end of file From edfb553df6d8e699066583faa1f4146cf24def72 Mon Sep 17 00:00:00 2001 From: Raffu Khondaker <2022rkhondak@tjhsst.edu> Date: Thu, 4 Jun 2020 22:43:35 -0400 Subject: [PATCH 5/8] login checks --- commands.py | 22 +++++++++++++++++++--- run.py | 3 ++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/commands.py b/commands.py index 4d92e00..da105ee 100644 --- a/commands.py +++ b/commands.py @@ -6,6 +6,10 @@ import argparse #already ccrerrated account through website, has to login +def update(): + #get data from database + return + def yesorno(question): questions = [ { @@ -42,7 +46,7 @@ def login(): if(user["webmail"] == data[i]["webmail"] and user["password"]) == data[i]["password"]: print("Logged in!") return data[i] - print("Error in your submission. Please re-enter") + print("User not found. Please Try again") return None #did not create account through website, has to signup/login @@ -68,7 +72,7 @@ def signup(): { 'type': 'input', 'name': 'webmail', - 'message': 'What\'s TJ Webmail?', + 'message': 'What\'s your TJ Webmail?', }, { 'type': 'password', @@ -77,6 +81,19 @@ def signup(): }, ] user = prompt(questions) + for i in user: + if user[i] == "": + print("Some forms were left blank. Try again.\n") + return + if len(user["password"]) < 6: + print("Password is too short. Try again.") + return + if (("@tjhsst.edu" in user['webmail']) == False): + print("Webmail entered was not a @tjhhsst.edu. Try again.") + return + + print("@tjhsst.edu" in user['webmail'] == False) + user["classes"] = [] with open('users.json', 'r') as json_file: data = json.load(json_file) @@ -91,7 +108,6 @@ def setup(user): for a in user["classes"][c]: os.makedirs(c + "/" + a) - def start(): if(os.path.exists(".login.txt") == True): b = yesorno("Do you have a SkoolOS account?(y/N)") diff --git a/run.py b/run.py index 2bac134..aca8859 100644 --- a/run.py +++ b/run.py @@ -1,6 +1,6 @@ from __future__ import print_function, unicode_literals from PyInquirer import prompt, print_json -from commands import start +from commands import start, update import argparse import json import os @@ -10,6 +10,7 @@ my_parser = argparse.ArgumentParser(prog='skool', description='Let SkoolOS contr my_parser.add_argument('--init', action="store_true") #returns true if run argument args = my_parser.parse_args() +update() outputs = vars(args) if(outputs['init']): start() From 232d4758347a9c5056123945bdced6ba7e0f36a4 Mon Sep 17 00:00:00 2001 From: rushilwiz Date: Fri, 5 Jun 2020 01:03:18 -0400 Subject: [PATCH 6/8] cleaning up master --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 5 +- .login.txt | 0 commands.py | 119 ------------------------------------- run.py | 22 ------- skool/bin/activate | 76 ----------------------- skool/bin/activate.csh | 37 ------------ skool/bin/activate.fish | 75 ----------------------- skool/bin/easy_install | 10 ---- skool/bin/easy_install-3.7 | 10 ---- skool/bin/pip | 10 ---- skool/bin/pip3 | 10 ---- skool/bin/pip3.7 | 10 ---- skool/bin/pygmentize | 10 ---- skool/bin/python | 1 - skool/bin/python3 | 1 - skool/pyvenv.cfg | 3 - users.json | 1 - 18 files changed, 4 insertions(+), 396 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .login.txt delete mode 100644 commands.py delete mode 100644 run.py delete mode 100644 skool/bin/activate delete mode 100644 skool/bin/activate.csh delete mode 100644 skool/bin/activate.fish delete mode 100755 skool/bin/easy_install delete mode 100755 skool/bin/easy_install-3.7 delete mode 100755 skool/bin/pip delete mode 100755 skool/bin/pip3 delete mode 100755 skool/bin/pip3.7 delete mode 100755 skool/bin/pygmentize delete mode 120000 skool/bin/python delete mode 120000 skool/bin/python3 delete mode 100644 skool/pyvenv.cfg delete mode 100644 users.json diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0. -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV "/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool" - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/bin:$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - if ("skool" != "") then - set env_name = "skool" - else - if (`basename "VIRTUAL_ENV"` == "__") then - # special case for Aspen magic directories - # see http://www.zetadev.com/software/aspen/ - set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` - else - set env_name = `basename "$VIRTUAL_ENV"` - endif - endif - set prompt = "[$env_name] $prompt" - unset env_name -endif - -alias pydoc python -m pydoc - -rehash diff --git a/skool/bin/activate.fish b/skool/bin/activate.fish deleted file mode 100644 index e47a901..0000000 --- a/skool/bin/activate.fish +++ /dev/null @@ -1,75 +0,0 @@ -# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) -# you cannot run it directly - -function deactivate -d "Exit virtualenv and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - - if test -n "$_OLD_FISH_PROMPT_OVERRIDE" - functions -e fish_prompt - set -e _OLD_FISH_PROMPT_OVERRIDE - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - - set -e VIRTUAL_ENV - if test "$argv[1]" != "nondestructive" - # Self destruct! - functions -e deactivate - end -end - -# unset irrelevant variables -deactivate nondestructive - -set -gx VIRTUAL_ENV "/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool" - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/bin" $PATH - -# unset PYTHONHOME if set -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # save the current fish_prompt function as the function _old_fish_prompt - functions -c fish_prompt _old_fish_prompt - - # with the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command - set -l old_status $status - - # Prompt override? - if test -n "(skool) " - printf "%s%s" "(skool) " (set_color normal) - else - # ...Otherwise, prepend env - set -l _checkbase (basename "$VIRTUAL_ENV") - if test $_checkbase = "__" - # special case for Aspen magic directories - # see http://www.zetadev.com/software/aspen/ - printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) - else - printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) - end - end - - # Restore the return status of the previous command. - echo "exit $old_status" | . - _old_fish_prompt - end - - set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" -end diff --git a/skool/bin/easy_install b/skool/bin/easy_install deleted file mode 100755 index d362dc7..0000000 --- a/skool/bin/easy_install +++ /dev/null @@ -1,10 +0,0 @@ -#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys - -from setuptools.command.easy_install import main - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/skool/bin/easy_install-3.7 b/skool/bin/easy_install-3.7 deleted file mode 100755 index d362dc7..0000000 --- a/skool/bin/easy_install-3.7 +++ /dev/null @@ -1,10 +0,0 @@ -#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys - -from setuptools.command.easy_install import main - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/skool/bin/pip b/skool/bin/pip deleted file mode 100755 index 30eab01..0000000 --- a/skool/bin/pip +++ /dev/null @@ -1,10 +0,0 @@ -#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys - -from pip._internal import main - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/skool/bin/pip3 b/skool/bin/pip3 deleted file mode 100755 index 30eab01..0000000 --- a/skool/bin/pip3 +++ /dev/null @@ -1,10 +0,0 @@ -#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys - -from pip._internal import main - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/skool/bin/pip3.7 b/skool/bin/pip3.7 deleted file mode 100755 index 30eab01..0000000 --- a/skool/bin/pip3.7 +++ /dev/null @@ -1,10 +0,0 @@ -#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys - -from pip._internal import main - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/skool/bin/pygmentize b/skool/bin/pygmentize deleted file mode 100755 index 16a605e..0000000 --- a/skool/bin/pygmentize +++ /dev/null @@ -1,10 +0,0 @@ -#!/Users/raffukhondaker/Projects/sysadmin/SkoolOS/skool/bin/python3 -# -*- coding: utf-8 -*- -import re -import sys - -from pygments.cmdline import main - -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/skool/bin/python b/skool/bin/python deleted file mode 120000 index b8a0adb..0000000 --- a/skool/bin/python +++ /dev/null @@ -1 +0,0 @@ -python3 \ No newline at end of file diff --git a/skool/bin/python3 b/skool/bin/python3 deleted file mode 120000 index e9113d5..0000000 --- a/skool/bin/python3 +++ /dev/null @@ -1 +0,0 @@ -/Users/raffukhondaker/opt/miniconda3/bin/python3 \ No newline at end of file diff --git a/skool/pyvenv.cfg b/skool/pyvenv.cfg deleted file mode 100644 index e5d353c..0000000 --- a/skool/pyvenv.cfg +++ /dev/null @@ -1,3 +0,0 @@ -home = /Users/raffukhondaker/opt/miniconda3/bin -include-system-site-packages = false -version = 3.7.4 diff --git a/users.json b/users.json deleted file mode 100644 index bf1713e..0000000 --- a/users.json +++ /dev/null @@ -1 +0,0 @@ -[{"first_name": "Raffu", "last_name": "Khondaker", "password": "password", "webmail": "2022rkhondak@tjhsst.edu", "classes": {"Math": ["week1_hw", "week2_hw", "week3_hw", "unit3_quiz"], "English": ["journal1", "journal2", "journal3"]}}] \ No newline at end of file From 9d83e807998f789466f5b43e16c8b6197916df1b Mon Sep 17 00:00:00 2001 From: rushilwiz Date: Fri, 5 Jun 2020 01:04:50 -0400 Subject: [PATCH 7/8] added vscode --- .gitignore | 3 +++ .vscode/settings.json | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index e09ff20..8df82ed 100644 --- a/.gitignore +++ b/.gitignore @@ -131,5 +131,8 @@ dmypy.json # PyCharm Files .idea/ +# VSCode +.vscode/ + #lmao mac .DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e4132bb..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "skool/bin/python3" -} \ No newline at end of file From 6e5242697d1e539521fed55d3b8b4b61ca633318 Mon Sep 17 00:00:00 2001 From: inafi Date: Mon, 8 Jun 2020 00:27:48 -0400 Subject: [PATCH 8/8] i be hard carrying --- CLI/run.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CLI/run.py b/CLI/run.py index aca8859..faac4f3 100644 --- a/CLI/run.py +++ b/CLI/run.py @@ -14,9 +14,3 @@ update() outputs = vars(args) if(outputs['init']): start() - - - - - -