From f7b772818fe0895942915a655ab0a6cc3cb1504d Mon Sep 17 00:00:00 2001 From: Sean Lee Date: Tue, 4 Feb 2014 16:02:05 -0500 Subject: [PATCH] clean up, rename to PEA_connect --- {PEA => PEA_connect}/__init__.py | 2 +- {PEA => PEA_connect}/connect.py | 0 {PEA => PEA_connect}/data.py | 2 +- README.md | 7 +++---- examples/PEA_connect | 1 + examples/README.md | 6 ------ examples/auth.py | 9 --------- examples/id.py | 6 +++--- examples/update.py | 19 ------------------- examples/username.py | 2 +- tests/PEA_connect | 1 + tests/__init__.py | 0 tests/classes.py | 2 +- tests/data.py | 2 +- tests/users.py | 2 +- 15 files changed, 14 insertions(+), 47 deletions(-) rename {PEA => PEA_connect}/__init__.py (96%) rename {PEA => PEA_connect}/connect.py (100%) rename {PEA => PEA_connect}/data.py (99%) create mode 120000 examples/PEA_connect delete mode 100644 examples/README.md delete mode 100644 examples/auth.py delete mode 100644 examples/update.py create mode 120000 tests/PEA_connect delete mode 100644 tests/__init__.py diff --git a/PEA/__init__.py b/PEA_connect/__init__.py similarity index 96% rename from PEA/__init__.py rename to PEA_connect/__init__.py index 55b2056..8c8f9e2 100644 --- a/PEA/__init__.py +++ b/PEA_connect/__init__.py @@ -1,4 +1,4 @@ -from PEA import data +from PEA_connect import data def _classes(): original = data.getClassData diff --git a/PEA/connect.py b/PEA_connect/connect.py similarity index 100% rename from PEA/connect.py rename to PEA_connect/connect.py diff --git a/PEA/data.py b/PEA_connect/data.py similarity index 99% rename from PEA/data.py rename to PEA_connect/data.py index 12227f0..47c05ba 100644 --- a/PEA/data.py +++ b/PEA_connect/data.py @@ -1,4 +1,4 @@ -from PEA import connect +from PEA_connect import connect import sys import re import string diff --git a/README.md b/README.md index 2e00bed..3f67173 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ print("You live in " + user.get("PEALivingGroup") + ".") #prints your dorm print("Your PO Box number is " + user.get("POBox") + ".") #prints your PO number ``` -[More examples](examples/README.md) +[More examples](examples/) ##Installation Supports python 2 only. @@ -69,7 +69,6 @@ _TODO_ write/design installation of actual module [Here](EXPLORING.md) ##Todo: + - Redocument readme - Add to README how an actual user/class data looks like in JSON - - Make PEA-data-tools website on ECC - - Make changes to code that reflect README - - simplify to single file, get rid of unnecessary package structure + - fix tests/examples diff --git a/examples/PEA_connect b/examples/PEA_connect new file mode 120000 index 0000000..719ee80 --- /dev/null +++ b/examples/PEA_connect @@ -0,0 +1 @@ +../PEA_connect \ No newline at end of file diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index 36b3831..0000000 --- a/examples/README.md +++ /dev/null @@ -1,6 +0,0 @@ -####to run these examples: - -In the base directory (up two levels from the directory of this README): -```sh -python -m PEA.examples.example -``` diff --git a/examples/auth.py b/examples/auth.py deleted file mode 100644 index 329d5cd..0000000 --- a/examples/auth.py +++ /dev/null @@ -1,9 +0,0 @@ -from PEA import auth -from getpass import getpass - -print(":: Authentication example ::") - -uname = raw_input('Username: ') -pword = getpass() - -print(auth(uname, pword)) diff --git a/examples/id.py b/examples/id.py index 86b9b22..8466b93 100644 --- a/examples/id.py +++ b/examples/id.py @@ -1,11 +1,11 @@ -from PEA import users +from PEA_connect import users import json def pprint(x): print(json.dumps(x, indent=4, sort_keys=True)) -u = users(by="employeeID") +u = users(by="EmployeeID") def getEmailByEmployeeID(employeeid): user = u.get(employeeid) if not user: @@ -21,7 +21,7 @@ def getNameByEmployeeID(employeeid): def query(): try: - employeeid = str(raw_input('employeeID: ')) + employeeid = str(raw_input('EmployeeID: ')) print(getNameByEmployeeID(employeeid)) print(getEmailByEmployeeID(employeeid)) except Exception: diff --git a/examples/update.py b/examples/update.py deleted file mode 100644 index 52019f1..0000000 --- a/examples/update.py +++ /dev/null @@ -1,19 +0,0 @@ -from .. import data -import json -#updates local copies of data - -def confirm(prompt): - ans = raw_input(prompt) - valid = ['Y'] - if not ans in valid: - exit() -def updateAll(): - print(':: updating user data...') - data.getDetailedUserData(from_cache=False, to_cache=True) - print(':: generating class data...') - data.getClassData(from_cache=False, to_cache=True) - print(':: update complete!') - -if __name__ == '__main__': - confirm(':: Proceed with data update? [Y] ') - updateAll() diff --git a/examples/username.py b/examples/username.py index 4f67792..3accc89 100644 --- a/examples/username.py +++ b/examples/username.py @@ -1,4 +1,4 @@ -from PEA import users +from PEA_connect import users import json def pprint(x): diff --git a/tests/PEA_connect b/tests/PEA_connect new file mode 120000 index 0000000..719ee80 --- /dev/null +++ b/tests/PEA_connect @@ -0,0 +1 @@ +../PEA_connect \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/classes.py b/tests/classes.py index 82f1b6e..cfeeaf6 100644 --- a/tests/classes.py +++ b/tests/classes.py @@ -1,4 +1,4 @@ -from PEA import classes +from PEA_connect import classes byFullString = classes() byClassCode = classes(by="ClassCode") diff --git a/tests/data.py b/tests/data.py index 1b906c6..71416f4 100644 --- a/tests/data.py +++ b/tests/data.py @@ -1,4 +1,4 @@ -from PEA import data +from PEA_connect import data def test_getRawUserData(): #a = data.getRawUserData() b = data.getRawUserData(source="connect") diff --git a/tests/users.py b/tests/users.py index 8d2c5fe..6c17db9 100644 --- a/tests/users.py +++ b/tests/users.py @@ -1,4 +1,4 @@ -from PEA import users +from PEA_connect import users byUsername = users() byID = users(by="EmployeeID")