diff --git a/.travis.yml b/.travis.yml index 0e35fd084268..8f6dbb98f51e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ before_install: pip install --upgrade pip setuptools install: pip install -r requirements.txt before_script: - black --check . || true - - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - flake8 . --count --select=E9,F401,F63,F7,F82 --show-source --statistics script: - mypy --ignore-missing-imports . #- IGNORE="data_structures,file_transfer_protocol,graphs,machine_learning,maths,neural_network,project_euler" diff --git a/other/primelib.py b/other/primelib.py index c371bc1b9861..f34063a18286 100644 --- a/other/primelib.py +++ b/other/primelib.py @@ -44,7 +44,7 @@ def isPrime(number): input: positive integer 'number' returns true if 'number' is prime otherwise false. """ - import math # for function sqrt + from math import sqrt # precondition assert isinstance(number,int) and (number >= 0) , \ @@ -56,7 +56,7 @@ def isPrime(number): if number <= 1: status = False - for divisor in range(2,int(round(math.sqrt(number)))+1): + for divisor in range(2,int(round(sqrt(number)))+1): # if 'number' divisible by 'divisor' then sets 'status' # of false and break up the loop. @@ -142,8 +142,6 @@ def primeFactorization(number): input: positive integer 'number' returns a list of the prime number factors of 'number' """ - - import math # for function sqrt # precondition assert isinstance(number,int) and number >= 0, \ @@ -496,8 +494,6 @@ def getDivisors(n): # precondition assert isinstance(n,int) and (n >= 1), "'n' must been int and >= 1" - - from math import sqrt ans = [] # will be returned.