Travis CI: Don’t allow bare exceptions (#1734)

* Travis CI: Don’t allow bare exceptions

* fixup! Format Python code with psf/black push

* except IOError:

* except IOError:

* Update hamming_code.py

* IndexError

* Get rid of the nonsense logic

Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
Christian Clauss 2020-02-07 22:02:08 +02:00 committed by GitHub
parent f52b97f2c5
commit 670f952aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View File

@ -5,7 +5,7 @@ before_install: pip install --upgrade pip setuptools
install: pip install -r requirements.txt
before_script:
- black --check . || true
- flake8 . --count --select=E101,E9,F4,F63,F7,F82,W191 --show-source --statistics
- flake8 . --count --select=E101,E722,E9,F4,F63,F7,F82,W191 --show-source --statistics
- flake8 . --count --exit-zero --max-line-length=127 --statistics
script:
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory

View File

@ -1,11 +1,13 @@
import math
'''
"""
In cryptography, the TRANSPOSITION cipher is a method of encryption where the
positions of plaintext are shifted a certain number(determined by the key) that
follows a regular system that results in the permuted text, known as the encrypted
text. The type of transposition cipher demonstrated under is the ROUTE cipher.
'''
"""
def main():
message = input("Enter message: ")
key = int(input("Enter key [2-%s]: " % (len(message) - 1)))

View File

@ -148,7 +148,7 @@ class XORCipher:
for line in fin:
fout.write(self.encrypt_string(line, key))
except:
except IOError:
return False
return True
@ -173,7 +173,7 @@ class XORCipher:
for line in fin:
fout.write(self.decrypt_string(line, key))
except:
except IOError:
return False
return True

View File

@ -125,7 +125,7 @@ def emitterConverter(sizePar, data):
if x != None:
try:
aux = (binPos[contLoop])[-1 * (bp)]
except:
except IndexError:
aux = "0"
if aux == "1":
if x == "1":
@ -229,7 +229,7 @@ def receptorConverter(sizePar, data):
if x != None:
try:
aux = (binPos[contLoop])[-1 * (bp)]
except:
except IndexError:
aux = "0"
if aux == "1":
if x == "1":

View File

@ -19,11 +19,7 @@ class Test(unittest.TestCase):
x = Vector([1, 2, 3])
self.assertEqual(x.component(0), 1)
self.assertEqual(x.component(2), 3)
try:
y = Vector()
self.assertTrue(False)
except:
self.assertTrue(True)
def test_str(self):
"""