From e0379c58fecdb7620c4a53c04f57e8cfea10d2fa Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 25 Apr 2019 13:31:47 -0400 Subject: [PATCH 1/4] Travis CI: Add more flake8 tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5fba6987bb66..2440899e4f25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - pip install flake8 # pytest # add another testing frameworks later before_script: # stop the build if there are Python syntax errors or undefined names - - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics + - flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics script: From c6eb747933bef5909e54c05e8ce9c48bcd258eda Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 25 Apr 2019 13:35:09 -0400 Subject: [PATCH 2/4] Use ==/!= to compare str, bytes, and int literals ./project_euler/problem_17/sol1.py:25:7: F632 use ==/!= to compare str, bytes, and int literals if i%100 is not 0: ^ --- project_euler/problem_17/sol1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project_euler/problem_17/sol1.py b/project_euler/problem_17/sol1.py index 9de5d80b9b29..8dd6f1af2093 100644 --- a/project_euler/problem_17/sol1.py +++ b/project_euler/problem_17/sol1.py @@ -22,7 +22,7 @@ if i >= 100: count += ones_counts[i/100] + 7 #add number of letters for "n hundred" - if i%100 is not 0: + if i%100 != 0: count += 3 #add number of letters for "and" if number is not multiple of 100 if 0 < i%100 < 20: @@ -32,4 +32,4 @@ else: count += ones_counts[i/1000] + 8 -print(count) \ No newline at end of file +print(count) From 2c7ea44004c1a2729c1e8fab307f32c78a9eaa1e Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 25 Apr 2019 13:36:42 -0400 Subject: [PATCH 3/4] Use ==/!= to compare str, bytes, and int literals --- project_euler/problem_19/sol1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_euler/problem_19/sol1.py b/project_euler/problem_19/sol1.py index 94cf117026a4..3f9c9219eb8b 100644 --- a/project_euler/problem_19/sol1.py +++ b/project_euler/problem_19/sol1.py @@ -30,10 +30,10 @@ day += 7 if (year%4 == 0 and not year%100 == 0) or (year%400 == 0): - if day > days_per_month[month-1] and month is not 2: + if day > days_per_month[month-1] and month != 2: month += 1 day = day-days_per_month[month-2] - elif day > 29 and month is 2: + elif day > 29 and month == 2: month += 1 day = day-29 else: @@ -48,4 +48,4 @@ if year < 2001 and day is 1: sundays += 1 -print(sundays) \ No newline at end of file +print(sundays) From 0e0f8fb871ec64f7c2848f192481324f7a9afbcb Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 25 Apr 2019 13:39:32 -0400 Subject: [PATCH 4/4] Update sol1.py --- project_euler/problem_19/sol1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project_euler/problem_19/sol1.py b/project_euler/problem_19/sol1.py index 3f9c9219eb8b..13e520ca76e4 100644 --- a/project_euler/problem_19/sol1.py +++ b/project_euler/problem_19/sol1.py @@ -45,7 +45,7 @@ year += 1 month = 1 - if year < 2001 and day is 1: + if year < 2001 and day == 1: sundays += 1 print(sundays)