From eab31270773e396339d273788b84cfbd5a023cec Mon Sep 17 00:00:00 2001 From: Nicholas Marinakis Date: Thu, 10 May 2018 17:46:26 -0700 Subject: [PATCH 01/10] Add some trouble --- test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test.py b/test.py index 079ef4c..3ac8416 100644 --- a/test.py +++ b/test.py @@ -9,6 +9,7 @@ def __init__(self, foo, bar, baz): self.bar = bar self.baz = baz + @staticmethod def fizz_buzz(digit_1, digit_2): for i in range(1, 100): if i % digit_1 == 0: @@ -21,6 +22,14 @@ def fizz_buzz(digit_1, digit_2): else: print i + def oh_this_is_trouble(self, param1, param2): + """Oh man this fucntion is trouble""" + for i in range(20): + print 'trouble' + i * '!' + for j in range(10): + print i * j + + @staticmethod def json_to_csv(json_file_path, outfile_path): """Convert a file containing a list of flat JSON objects to a csv. @@ -35,3 +44,7 @@ def json_to_csv(json_file_path, outfile_path): writer.writerow(data[0].keys()) for item in data: writer.writerow(item.values()) + +if __name__ == '__main__': + t = TestClass(1, 2, 3) + TestClass.fizz_buzz(3, 5) From f20a9e3b13912b5e1ec80f31936466ea7cdc5b24 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 11 Sep 2018 10:01:20 -0700 Subject: [PATCH 02/10] updated comment --- test.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test.py b/test.py index 7c0ef3c..336c17a 100644 --- a/test.py +++ b/test.py @@ -22,10 +22,7 @@ def fizz_buzz(self, digit_1, digit_2): print i def json_to_csv(self, json_file_path, outfile_path): - """Convert a file containing a list of flat JSON objects to a csv. - - What's a DictWriter, you say? Never heard of it! - + """DictWriter has saved my life!!! """ with open(json_file_path) as f: data = json.load(f) From c4765d92c64afcc0faa1e098205a4e4e4f270f14 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 11 Sep 2018 10:01:47 -0700 Subject: [PATCH 03/10] added bubble_sort --- test.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test.py b/test.py index 336c17a..d04f160 100644 --- a/test.py +++ b/test.py @@ -21,6 +21,15 @@ def fizz_buzz(self, digit_1, digit_2): else: print i + def bubble_sort(self, alist): + length = len(alist) - 1 + for i in range(0, length): + if alist[i] > alist[i + 1]: + # alist[i], alist[i+1] = alist[i+1], alist[i] # python way + temp = alist[i] + alist[i] = alist[i + 1] + alist[i + 1] = temp + def json_to_csv(self, json_file_path, outfile_path): """DictWriter has saved my life!!! """ From 5e9d8febd9bebb9a479eb217c5c20b0dbb28f926 Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 11 Sep 2018 10:27:04 -0700 Subject: [PATCH 04/10] cleared up rebase issues --- test.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/test.py b/test.py index 3ac8416..720a873 100644 --- a/test.py +++ b/test.py @@ -9,8 +9,7 @@ def __init__(self, foo, bar, baz): self.bar = bar self.baz = baz - @staticmethod - def fizz_buzz(digit_1, digit_2): + def fizz_buzz(self, digit_1, digit_2): for i in range(1, 100): if i % digit_1 == 0: if i % digit_2 == 0: @@ -22,15 +21,7 @@ def fizz_buzz(digit_1, digit_2): else: print i - def oh_this_is_trouble(self, param1, param2): - """Oh man this fucntion is trouble""" - for i in range(20): - print 'trouble' + i * '!' - for j in range(10): - print i * j - - @staticmethod - def json_to_csv(json_file_path, outfile_path): + def json_to_csv(self, json_file_path, outfile_path): """Convert a file containing a list of flat JSON objects to a csv. What's a DictWriter, you say? Never heard of it! From 292872c3a61cf4aed7351acc345753e391355615 Mon Sep 17 00:00:00 2001 From: Nicholas Marinakis Date: Thu, 10 May 2018 18:01:41 -0700 Subject: [PATCH 05/10] Initial commit --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 197aeb6..441d3a9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # Git Practice This repo is for practicing git! + +Please: + +1. Fork this repo +2. Make two changes, in *two separate commits*, to test.py in branch called "Branch_1" + + **One of these changes must be the insertion of a new method between fizz_buzz and json_to_csv** + + It does not matter what these changes are or what the method does. +4. Once you have made the second commit, make another branch off of "Branch_1" called "Branch_2" + +3. Create two pull requests against master: + 1. For the first, please squash down your two "Branch_1" commits. + 2. For the second, please first rebase "Branch_2" on upstream's 'trouble' branch and resolve any conflicts that may arise. From d4284d3fe394967e158d0135114806e7d74ece14 Mon Sep 17 00:00:00 2001 From: Nicholas Marinakis Date: Thu, 10 May 2018 18:02:58 -0700 Subject: [PATCH 06/10] Remove StringIO call --- test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test.py b/test.py index 720a873..baa4742 100644 --- a/test.py +++ b/test.py @@ -29,7 +29,6 @@ def json_to_csv(self, json_file_path, outfile_path): """ with open(json_file_path) as f: data = json.load(f) - fp = StringIO() with open(outfile_path, 'w') as fp: writer = csv.writer(fp) writer.writerow(data[0].keys()) From f3ba6c5d1f4a52ebdb75c9f083ca00ec1c7b502d Mon Sep 17 00:00:00 2001 From: Nicholas Marinakis Date: Thu, 10 May 2018 18:08:36 -0700 Subject: [PATCH 07/10] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 441d3a9..60272bd 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ Please: **One of these changes must be the insertion of a new method between fizz_buzz and json_to_csv** - It does not matter what these changes are or what the method does. + It does not matter what these changes are, or what the method does, but each change must introduce at least + five new lines of code. 4. Once you have made the second commit, make another branch off of "Branch_1" called "Branch_2" 3. Create two pull requests against master: - 1. For the first, please squash down your two "Branch_1" commits. - 2. For the second, please first rebase "Branch_2" on upstream's 'trouble' branch and resolve any conflicts that may arise. + 1. For the first, please first squash down your two "Branch_1" commits. + 2. For the second, please first rebase "Branch_2" on upstream's 'trouble' branch and resolve any conflicts that may arise. DO NOT squash your commits. From 7f88c16b313634f951c9e9e35616c343514a5784 Mon Sep 17 00:00:00 2001 From: Nicholas Marinakis Date: Thu, 10 May 2018 18:14:48 -0700 Subject: [PATCH 08/10] More README formatting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60272bd..d5a5166 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This repo is for practicing git! Please: 1. Fork this repo -2. Make two changes, in *two separate commits*, to test.py in branch called "Branch_1" +2. Make two changes, in *two separate commits*, to `test.py` in a branch called "Branch_1" **One of these changes must be the insertion of a new method between fizz_buzz and json_to_csv** From e6312433e3402bc38ec654fbb90479d1bb90cc3e Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 11 Sep 2018 10:01:20 -0700 Subject: [PATCH 09/10] updated comment --- test.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test.py b/test.py index baa4742..e1e0c5f 100644 --- a/test.py +++ b/test.py @@ -22,10 +22,7 @@ def fizz_buzz(self, digit_1, digit_2): print i def json_to_csv(self, json_file_path, outfile_path): - """Convert a file containing a list of flat JSON objects to a csv. - - What's a DictWriter, you say? Never heard of it! - + """DictWriter has saved my life!!! """ with open(json_file_path) as f: data = json.load(f) From b07000eddae00cdd4578e8a57a04a961b73621de Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 11 Sep 2018 10:01:47 -0700 Subject: [PATCH 10/10] added bubble_sort --- test.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test.py b/test.py index e1e0c5f..bd27f64 100644 --- a/test.py +++ b/test.py @@ -21,6 +21,15 @@ def fizz_buzz(self, digit_1, digit_2): else: print i + def bubble_sort(self, alist): + length = len(alist) - 1 + for i in range(0, length): + if alist[i] > alist[i + 1]: + # alist[i], alist[i+1] = alist[i+1], alist[i] # python way + temp = alist[i] + alist[i] = alist[i + 1] + alist[i + 1] = temp + def json_to_csv(self, json_file_path, outfile_path): """DictWriter has saved my life!!! """