Skip to content

Pull request #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8bf1f50
Add files via upload
cathyvu Mar 3, 2017
81e28c1
Update README.md
cathyvu Mar 3, 2017
2952721
Update README.md
cathyvu Mar 3, 2017
6af3408
Update README.md
cathyvu Mar 3, 2017
69a36cd
Update aboutMe.yml
cathyvu Mar 9, 2017
366b3cc
Update aboutMe.yml
cathyvu Mar 9, 2017
bdd1e50
Update email_template.md
cathyvu Mar 9, 2017
7701ee3
Add files via upload
cathyvu Mar 15, 2017
1110ec6
Add files via upload
cathyvu Mar 15, 2017
debc2c6
do week 1 homework
cathyvu Mar 24, 2017
146818b
pass linter tests
cathyvu Apr 22, 2017
5babbf3
debug and linter exercise2.py
cathyvu Apr 23, 2017
c5ca0c9
passed most loop tests
cathyvu Apr 27, 2017
6bb56c0
exam not done but here it is RIP
cathyvu May 5, 2017
65698d6
RIP.
cathyvu Jun 8, 2017
10b9b10
new jazz
cathyvu Jun 8, 2017
e64a11d
Its 8 minutes
cathyvu Jun 8, 2017
f6e0112
This is it.
cathyvu Jun 8, 2017
4eedbb0
330am updates.
cathyvu Jun 11, 2017
4c1f8de
430am updates.
cathyvu Jun 11, 2017
f51b90f
430am updates.
cathyvu Jun 11, 2017
bce6b75
Create exercise1.py
joseangelodiaz Jun 12, 2017
eccad39
Merge pull request #3 from joseangelodiaz/patch-2
cathyvu Jun 12, 2017
62f7d5c
Shortened three_counter
lisadoan98 Jun 12, 2017
185b522
Merge pull request #4 from lisadoan98/patch-1
cathyvu Jun 12, 2017
cefca81
Create exercise2.py
JoshuaCoady Jun 13, 2017
4d1aad2
Merge pull request #5 from JoshuaCoady/patch-1
cathyvu Jun 13, 2017
fb46c11
Create Melbourne_AirBnB.ipynb
JamesBui98 Jun 13, 2017
160ca12
Merge pull request #6 from JamesBui98/patch-1
cathyvu Jun 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added IMG_8413.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CODE1161 - [your name here]
# CODE1161 - Catherine Vu

You can see lots of other course related stuff [here](https://notionparallax.co.uk/CODE1161).

![a photo of me](mugshot.png)
![a photo of me](IMG_8413.JPG)
16 changes: 8 additions & 8 deletions aboutMe.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Ben Doherty
studentNumber: z1234567
gitHubUsername: notionparallax
stackoverflow: http://stackoverflow.com/users/1835727/ben
mediumUsername: notionparallax
unswEmail: noIdea@unsw.edu.au
realEmailFirstBit: ben # this avoids spam
realEmailOtherBit: @notionparallax.co.uk
name: Catherine Vu
studentNumber: z5061877
gitHubUsername: cathyvu
stackoverflow: http://stackoverflow.com/users/7650458/cathy-vu
mediumUsername: catherine.vu.97
unswEmail: z5061877@unsw.edu.au
realEmailFirstBit: catherine.vu.97
realEmailOtherBit: @hotmail.com
275 changes: 242 additions & 33 deletions codeHelpers.py

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions email_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ Make sure that the template is carefully filled in, and you spell check it. This

---
### Link to your repo
[https://github.com/notionparallax/code1161base](https://github.com/notionparallax/code1161base)
[https://github.com/cathyvu/cathyvu.git](https://github.com/cathyvu/cathyvu.git)

### Name
Ben Doherty
Catherine Vu

### Student number
z123456
z5061877

### does this email require a response?
yes/no
yes

### Description of situation
My head is on fire


### What have you tried already?
* I have tried putting my head in the sand
* I have tried swimming in the sea
* I have asked in the slack channel for this week if anyone else has any ideas. [Here's a link](https://en.wikipedia.org/wiki/Never_Gonna_Give_You_Up) to the conversation about it.


### What information would you like in the response
I assume, from your baldy head, that you have had an on-fire head before, what did you do about it?
Your opinion on how I should proceed next.

---

Expand All @@ -44,4 +42,4 @@ There shouldn't be _too_ much information here because it'll be mostly covered a

Thanks

[your name]
Cathy
30 changes: 30 additions & 0 deletions fixer_sh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# edit these lines
MYNAME="Catherine Vu"
MYEMAIL="[email protected]"
# stop editing


# don't edit these lines
git config --global user.name $MYNAME
git config --global user.email $MYEMAIL
git config --global credential.helper 'cache --timeout=36000' #cache password for 150 minutes
git config --global color.ui auto #colour the output in git
git config --global core.editor "atom --wait"

#in case this sh has been run multiple times before
git config --global --replace-all user.email $MYEMAIL
git config --global --replace-all user.name $MYNAME

apm install script
apm install linter
apm install linter-flake8

sudo pip install colorama

sudo pip uninstall flake8 -y
sudo pip install flake8==3.2.0

echo
echo "That should have fixed the bugs"
echo
git config --list
12 changes: 12 additions & 0 deletions gitSetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# edit these lines
MYNAME="Catherine Vu"
MYEMAIL="[email protected]"
# stop editing


# don't edit these lines
git config --global user.name $MYNAME
git config --global user.email $MYEMAIL
git config --global credential.helper 'cache --timeout=36000' #cache password for 150 minutes
git config --global color.ui auto #colour the output in git
git config --global core.editor "atom --wait"
Binary file modified mugshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions new_exercise_getter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: UTF-8 -*-
"""Gets updated version of exercises.

Checks for existing version and won't overwrite.
"""
import os
import requests

LOCAL = os.path.dirname(os.path.realpath(__file__))


def get_the_updates():
"""Decide if the other functions should download each file."""
base = ("https://raw.githubusercontent.com/"
"notionparallax/code1161base/master")
new_files = [
"/week5/exercise1.py",
"/week5/tests.py"
]

for f in new_files:
save_path = "./" + f
if not os.path.isfile(save_path) and f is not "":
url = base + f
download_and_save(url, save_path)
elif f is "":
pass # do nothing, it's padding
else:
print("You already have {f}".format(f=f))
print("If you really want to update that file, "
"delete it locally and rerun this script.")


def get_file_text(url):
"""Pull the raw file and return it as a string."""
r = requests.get(url)
return r.text.encode('utf-8')


def download_and_save(url, save_path):
"""Save a string as a file."""
f = open(os.path.join(LOCAL, save_path), 'w')
f.write(get_file_text(url))
f.close()


get_the_updates()
39 changes: 39 additions & 0 deletions testFixer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: UTF-8 -*-
"""Get the latest version of the tests.

Goes to github and downloads the tests.
"""
import os
import requests

LOCAL = os.path.dirname(os.path.realpath(__file__))
# print(LOCAL)


def get_the_updates():
gh_url = 'https://raw.githubusercontent.com/'
repo = 'notionparallax/code1161base/'
for i in [1, 2, 3, 4, 5, 6, 8]: # no week 7
file_path = "master/week{}/tests.py".format(i)
url = gh_url + repo + file_path
save_path = "week{}/tests.py".format(i)
download_and_save(url, save_path)
download_and_save(gh_url + repo + "master/codeHelpers.py",
"codeHelpers.py")


def get_file_text(url):
r = requests.get(url)
return r.text.encode('utf-8')


def download_and_save(url, save_path):
f = open(os.path.join(LOCAL, save_path), 'w')
f.write(get_file_text(url))
f.close()


get_the_updates()
print "Fingers crossed! Try the tests for week 3 now"
print "Remember: the changes to the tests will need to be commited"
print " as well as your work."
1 change: 1 addition & 0 deletions week1/_checkID
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9f5eb95820e9475f8e7967708c08fadd
2 changes: 2 additions & 0 deletions week1/_requestsWorking
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Let's test Python and Requests:
***************************************** ** Python and requests are working! ** ** All hail his noodly appendage! ** *****************************************
19 changes: 11 additions & 8 deletions week1/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function
import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__))[:-5])
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from codeHelpers import test

WEEK_NUMBER = 1
Expand All @@ -18,11 +18,11 @@ def isThereAnID(path_to_code_to_check):
"""Check that this test is being run on a VM."""
try:
place = os.path.join(path_to_code_to_check, '_checkID')
# print("looking in {}".format(place))
# print("LOCAL", LOCAL, "\nCWD", CWD)
print("looking in {}".format(place))
print("LOCAL", LOCAL, "\nCWD", CWD)
f = open(place, 'r')
contents = f.read()
# print("contents", contents)
print("contents", contents)
return len(contents) > 8
except Exception:
print("TIP: Have you run pytest.py yet?")
Expand Down Expand Up @@ -52,23 +52,26 @@ def isRequestsWorking(path_to_code_to_check):
return False


def theTests(path_to_code_to_check=""):
def theTests(path_to_code_to_check="."):
"""Run the tests.

This is the main function, it contains all the tests for the week.
"""
print("\nWelcome to week {}!".format(WEEK_NUMBER))
print("Let's check that everything is set up.\n")

path = "{}/week{}/".format(path_to_code_to_check, WEEK_NUMBER)
testResults = []
testResults.append(
test(isThereAnID(path_to_code_to_check),
test(isThereAnID(path),
"Exercise 1: Test that your VM is working"))
testResults.append(
test(isRequestsWorking(path_to_code_to_check),
test(isRequestsWorking(path),
"Exercise 1: Test your connection to the internet"))

return {"of_total": sum(testResults), "mark": len(testResults)}
return {"of_total": len(testResults),
"mark": sum(testResults),
"results": testResults}


if __name__ == "__main__":
Expand Down
83 changes: 83 additions & 0 deletions week2/exercise0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: UTF-8 -*-
"""Modify each function until the tests pass."""
from __future__ import division
from __future__ import print_function


def add_5(a_number):
"""Return a number that is 5 bigger than number given.

This isn't a trick!
First thing to do is to remove the pass. That's just tellign python that
the empty block is intentional - it's python's "this page is intentionally
left blank"
Then you need to:
return a_number plus five
except expressed in python, not english
"""
return (a_number + 5)


def adder(a_number, another_number):
"""Add two numbers.

Same as above, but with any two numbers.
"""
return (a_number + another_number)


def shout(a_string):
"""Return a string in uppercase.

look up the docs for string methods. Either in the official docs, here:
https://docs.python.org/2/library/string.html
or in any of the million places that google will give you.
"python make a string uppercase" is a good starting search query.
"""
return (a_string.upper())


def really_shout(a_string):
"""Return a string in uppercase, with an exclamation mark on the end.

In the spirit of being DRY (don't repeat yourself) reuse the shout function
from above.
Look up how to 'concatinate' strings to make this happen.
"""
return(shout(a_string) + str('!'))


def minitest(f, args, expected):
"""Run a function with a list of args and print a response.

This is a helper. Don't edit it.
"""
result = f(*args)
template = "expect {name}({args}) == {expected} => {result}"
print(template.format(name=f.__name__,
args=str(args)[1:-1],
result=result == expected,
expected=expected))
return result == expected


if __name__ == "__main__":
minitest(add_5, [1], 6)
minitest(add_5, [6], 11)
minitest(add_5, [-3], 2)
minitest(add_5, [0.5], 5.5)
minitest(adder, [-0.5, -0.5], -1)
minitest(adder, [2, 2], 4)
minitest(adder, [2, -2], 0)
minitest(shout, ["hello"], "HELLO")
minitest(really_shout, ["hello"], "HELLO!")
minitest(really_shout, [""], "!")
minitest(really_shout, ["!"], "!!")
print("""
This section does a quick test on your results and prints them nicely
It's NOT the official tests, they are in tests.py as usual.
Add to these tests, give them arguments etc. to make sure that your
code is robust to the situations that you'll see in action.

REMEMBER: these aren't the tests that you submit, these are just
there to keep you sane.""")
23 changes: 15 additions & 8 deletions week2/exercise1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@
"""
from __future__ import division
from __future__ import print_function
print ("hello! Let's get started")
jobs=['get','this',
'file','to','pass',
'the','linter']
InOtherWords="make it show no linter errors"
import os

print("hello! Let's get started")
jobs = ['get', 'this',
'file', 'to', 'pass',
'the', 'linter']
InOtherWords = "make it show no linter errors"
print(jobs)
print(InOtherWords)
print(1+1,"is smaller than",7*0.5,"is",(1+1)<(7*0.5),", which is a relief!")
def usefulFunction () :
print(1+1, "is smaller than", 7*0.5, "is",
(1+1) < (7*0.5), ", which is a relief!")


def usefulFunction():
"""Missing docstring."""
print(os.getcwd())
usefulFunction( )


usefulFunction()
Loading