From afb97538b0d6487aa935c51d542b1eec16ad8abe Mon Sep 17 00:00:00 2001 From: Ele Don Date: Wed, 29 May 2019 10:45:24 -0400 Subject: [PATCH 1/4] Add seaborn to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 25df434..87e78d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ sphinx numpydoc flake8 pytest +seaborn From e57c7bc069aa0f1372e87b0f3754f0a8df69ff83 Mon Sep 17 00:00:00 2001 From: Ele Don Date: Wed, 29 May 2019 15:47:06 -0400 Subject: [PATCH 2/4] added flake8 --- .travis.yml | 4 ++-- toymir/freq.py | 8 ++++---- toymir/tests/test_toymir.py | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a164f4..3b2dbe9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ install: - travis_retry pip install -e . script: -# - flake8 --ignore N802,N806,E501 `find . -name \*.py | grep -v setup.py | grep -v version.py | grep -v __init__.py | grep -v /doc/` -# - pytest --pyargs toymir --cov-report term-missing --cov=toymir + - flake8 --ignore N802,N806,E501 `find . -name \*.py | grep -v setup.py | grep -v version.py | grep -v __init__.py | grep -v /doc/` + - pytest --pyargs toymir --cov-report term-missing --cov=toymir - pytest # Hey, this block (and the above arguments to pytest ) diff --git a/toymir/freq.py b/toymir/freq.py index 311890f..75f9762 100644 --- a/toymir/freq.py +++ b/toymir/freq.py @@ -38,12 +38,12 @@ def hz_to_midi(frequencies): # Oh hey, it's Part 5! You could uncomment this implementation, # and then the tests will pass! - # less_than_zero = (np.asanyarray(frequencies) <= 0).any() + less_than_zero = (np.asanyarray(frequencies) <= 0).any() - # if less_than_zero: - # raise ValueError('Cannot convert a hz of zero or less to a period.') + if less_than_zero: + raise ValueError('Cannot convert a hz of zero or less to a period.') - # return 12 * (np.log2(np.asanyarray(frequencies)) - np.log2(440.0)) + 69 + return 12 * (np.log2(np.asanyarray(frequencies)) - np.log2(440.0)) + 69 def hz_to_period(frequencies): diff --git a/toymir/tests/test_toymir.py b/toymir/tests/test_toymir.py index f1f72be..6e94bd3 100644 --- a/toymir/tests/test_toymir.py +++ b/toymir/tests/test_toymir.py @@ -18,14 +18,14 @@ def test_midi_to_hz_array(): # These are the two tests you should uncomment! -# def test_hz_to_midi_float(): -# expected = 69 -# assert toymir.hz_to_midi(440.0) == expected + def test_hz_to_midi_float(): + expected = 69 + assert toymir.hz_to_midi(440.0) == expected -# def test_hz_to_midi_array(): -# expected = [57, 69, 81] -# assert np.allclose(toymir.hz_to_midi([220.0, 440.0, 880.0]), expected) + def test_hz_to_midi_array(): + expected = [57, 69, 81] + assert np.allclose(toymir.hz_to_midi([220.0, 440.0, 880.0]), expected) # Hello! You could add the missing test for test_hz_to_midi here! From 3f6b9288e41c40b8646a1d2d0c5b8150789a021b Mon Sep 17 00:00:00 2001 From: Ele Don Date: Wed, 29 May 2019 16:12:40 -0400 Subject: [PATCH 3/4] update and fixed flake8 --- .travis.yml | 2 +- requirements.txt | 2 +- toymir/freq.py | 10 +++++----- toymir/tests/test_toymir.py | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b2dbe9..8185273 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: script: - flake8 --ignore N802,N806,E501 `find . -name \*.py | grep -v setup.py | grep -v version.py | grep -v __init__.py | grep -v /doc/` - - pytest --pyargs toymir --cov-report term-missing --cov=toymir +# - pytest --pyargs toymir --cov-report term-missing --cov=toymir - pytest # Hey, this block (and the above arguments to pytest ) diff --git a/requirements.txt b/requirements.txt index 87e78d3..7d31ebb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,4 @@ sphinx numpydoc flake8 pytest -seaborn + diff --git a/toymir/freq.py b/toymir/freq.py index 75f9762..07279fe 100644 --- a/toymir/freq.py +++ b/toymir/freq.py @@ -1,5 +1,5 @@ import numpy as np -import seaborn # trap to make tests fail! +# import seaborn # trap to make tests fail! def midi_to_hz(notes): @@ -38,12 +38,12 @@ def hz_to_midi(frequencies): # Oh hey, it's Part 5! You could uncomment this implementation, # and then the tests will pass! - less_than_zero = (np.asanyarray(frequencies) <= 0).any() + less_than_zero = (np.asanyarray(frequencies) <= 0).any() - if less_than_zero: - raise ValueError('Cannot convert a hz of zero or less to a period.') + if less_than_zero: + raise ValueError('Cannot convert a hz of zero or less to a period.') - return 12 * (np.log2(np.asanyarray(frequencies)) - np.log2(440.0)) + 69 + return 12 * (np.log2(np.asanyarray(frequencies)) - np.log2(440.0)) + 69 def hz_to_period(frequencies): diff --git a/toymir/tests/test_toymir.py b/toymir/tests/test_toymir.py index 6e94bd3..ca61f9b 100644 --- a/toymir/tests/test_toymir.py +++ b/toymir/tests/test_toymir.py @@ -18,13 +18,13 @@ def test_midi_to_hz_array(): # These are the two tests you should uncomment! - def test_hz_to_midi_float(): - expected = 69 - assert toymir.hz_to_midi(440.0) == expected +def test_hz_to_midi_float(): + expected = 69 + assert toymir.hz_to_midi(440.0) == expected - def test_hz_to_midi_array(): - expected = [57, 69, 81] +def test_hz_to_midi_array(): + expected = [57, 69, 81] assert np.allclose(toymir.hz_to_midi([220.0, 440.0, 880.0]), expected) From 505bfe0682bbf9d3d16a8a3b9a079e9163b6bff0 Mon Sep 17 00:00:00 2001 From: Ele Don Date: Mon, 3 Jun 2019 09:22:12 -0400 Subject: [PATCH 4/4] updated HTML --- .requirement.txt.swp | Bin 0 -> 12288 bytes toymir.egg-info/PKG-INFO | 31 +++++++++++++++++++++++++++ toymir.egg-info/SOURCES.txt | 14 ++++++++++++ toymir.egg-info/dependency_links.txt | 1 + toymir.egg-info/requires.txt | 1 + toymir.egg-info/top_level.txt | 1 + toymir/freq.py | 10 +++++++-- 7 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .requirement.txt.swp create mode 100644 toymir.egg-info/PKG-INFO create mode 100644 toymir.egg-info/SOURCES.txt create mode 100644 toymir.egg-info/dependency_links.txt create mode 100644 toymir.egg-info/requires.txt create mode 100644 toymir.egg-info/top_level.txt diff --git a/.requirement.txt.swp b/.requirement.txt.swp new file mode 100644 index 0000000000000000000000000000000000000000..568d6c197f7e9d6c6e6b42aca0502830edeed257 GIT binary patch literal 12288 zcmeI%%SyvQ6oBDVcU_3mzCg9>+*;6Vb)k4E25Q`=WWWKN=wt$}^f`SCUqCUbonPS9v>3#c71t%cXf8% zHBCNT!a!GBZ5Ck^du3I5wzj3w*-K#5Tdj@Ss>1sA-F7Bo009Jg2pp!%MYOx>^V5^r zbdvVS!4d=zKmY**5I_I{1P~aifPEdwXS4Z({Q+DY?b|L6^?d9b0R#|0009ILKmY** x5I_I{1Vpl2X7#fA{|Xb$uWqfB*srAb