Fixed type "maked a branch" #22

Closed
wants to merge 3 commits into
from
View
8 dataviz/full_source/dataviz.py
@@ -19,9 +19,10 @@ def parse(raw_file, delimiter):
"""Parses a raw CSV file to a JSON-like object"""
# Open CSV file, and safely close it when we're done
- with open(raw_file) as opened_file:
- # Read CSV file
- csv_data = csv.reader(opened_file, delimiter=delimiter)
+ opened_file = open(raw_file)
+
+ # Read the CSV data
+ csv_data = csv.reader(opened_file, delimiter=delimiter)
# Setup an empty list
parsed_data = []
@@ -39,7 +40,6 @@ def parse(raw_file, delimiter):
return parsed_data
-
def visualize_days(data_file):
"""Visualize data by day of week"""
View
7 dataviz/tutorial_source/graph.py
@@ -22,9 +22,10 @@ def parse(raw_file, delimiter):
"""Parses a raw CSV file to a JSON-like object"""
# Open CSV file, and safely close it when we're done
- with open(raw_file) as opened_file:
- # Read CSV file
- csv_data = csv.reader(opened_file, delimiter=delimiter)
+ opened_file = open(raw_file)
+
+ # Read the CSV data
+ csv_data = csv.reader(opened_file, delimiter=delimiter)
# Setup an empty list
parsed_data = []
View
7 dataviz/tutorial_source/parse.py
@@ -22,9 +22,10 @@ def parse(raw_file, delimiter):
"""Parses a raw CSV file to a JSON-like object"""
# Open CSV file, and safely close it when we're done
- with open(raw_file) as opened_file:
- # Read CSV file
- csv_data = csv.reader(opened_file, delimiter=delimiter)
+ opened_file = open(raw_file)
+
+ # Read the CSV data
+ csv_data = csv.reader(opened_file, delimiter=delimiter)
# Setup an empty list
parsed_data = []
View
21 docs/_posts/2013-01-04-Part-1-Parse.md
@@ -113,14 +113,16 @@ Just to quickly put these two lines in our `parse` function:
def parse(raw_file, delimiter):
"""Parses a raw CSV file to a JSON-line object"""
- # Open CSV file, and safely close it when we're done
- with open(raw_file) as opened_file:
+ # Open CSV file
+ open_file = open(raw_file)
- # Read CSV file
- csv_data = csv.reader(opened_file, delimiter=delimiter)
+ # Read the CSV data
+ csv_data = csv.reader(opened_file, delimiter=delimiter)
# Build a data structure to return parsed_data
+ # Close the CSV file
+
return parsed_data
```
@@ -159,11 +161,11 @@ Now let’s put the function together:
def parse(raw_file, delimiter):
"""Parses a raw CSV file to a JSON-like object"""
- # Open CSV file, and safely close it when we're done
- with open(raw_file) as opened_file:
+ # Open CSV file
+ opened_file = open(raw_file)
- # Read CSV file
- csv_data = csv.reader(opened_file, delimiter=delimiter)
+ # Read the CSV data
+ csv_data = csv.reader(opened_file, delimiter=delimiter)
# Setup an empty list
parsed_data = []
@@ -175,6 +177,9 @@ def parse(raw_file, delimiter):
for row in csv_data:
parsed_data.append(dict(zip(fields, row)))
+ # Close the CSV file
+ opened_file.close()
+
return parsed_data
```
View
4 docs/_posts/2013-09-30-Save-your-progress.md
@@ -32,7 +32,7 @@ Resources for using git:
With git, users can do what’s called branching and merging. With a repo, you have a main, original branch called master. Off of master, you can make branches. Consider this to give you the ability to play around with code, break things, etc, while keeping the original/master safe. If you’re happy with what has been completed within a branch, you merge the branch into the master branch, and it becomes your new original.
-It’s good to start off using git with good habits. Whenever you start something new, like as soon as you clone a repository, one good habit is to maked a branch to merge in later when you’re satisfied with your progress.
+It’s good to start off using git with good habits. Whenever you start something new, like as soon as you clone a repository, one good habit is to make a branch to merge in later when you’re satisfied with your progress.
When you are intermittingly saving your progress on a branch, make a commit to your branch. Commit your code regularly, whether when you’re done for the day, when you‘ve finished coding out one of the parts of the tutorial, before you answer the phone when someone calls you, etc. Rather than making one big “atomic” commit at big milestones (e.g. after the completion of one tutorial, an implementation of a feature), doing this makes it very easy to undo changes that you’ve made without losing big progress.
@@ -253,4 +253,4 @@ When you have code up on GitHub and/or BitBucket, not only do they implicitly pr
As you work through these tutorials, I encourage you to use GitHub or BitBucket (or any other service that allows you to publicly share repositories) to “push” your code to so others can see your progress. While I suggest you to locally commit often and commit happily, only push code to GitHub/BitBucket when there is a good completion point (e.g. when you've finished a tutorial).
-[git]: "http://en.wikipedia.org/wiki/Git_(software)#History"
+[git]: "http://en.wikipedia.org/wiki/Git_(software)#History"