diff --git a/onionr/onionrproofs.py b/onionr/onionrproofs.py index f7bfc1f9..88329fb8 100755 --- a/onionr/onionrproofs.py +++ b/onionr/onionrproofs.py @@ -50,12 +50,8 @@ def getHashDifficulty(hexHash): ''' Return the amount of leading zeroes in a hex hash string (hexHash) ''' - difficulty = 0 assert type(hexHash) is str - - difficulty = len(hexHash) - len(hexHash.lstrip('0')) - - return difficulty + return len(hexHash) - len(hexHash.lstrip('0')) def hashMeetsDifficulty(hexHash): ''' diff --git a/onionr/utils/detectoptimization.py b/onionr/utils/detectoptimization.py index 20570242..eb208ff3 100755 --- a/onionr/utils/detectoptimization.py +++ b/onionr/utils/detectoptimization.py @@ -21,7 +21,7 @@ def detect_optimization(): '''Returns true if Python is run in optimized mode (-o), based on optimization ignoring assert statements''' try: - assert True is False + assert False except AssertionError: return False return True \ No newline at end of file diff --git a/onionr/utils/hastor.py b/onionr/utils/hastor.py index 94a33be1..f94298e8 100644 --- a/onionr/utils/hastor.py +++ b/onionr/utils/hastor.py @@ -1,6 +1,4 @@ import netcontroller def has_tor(): - if netcontroller.tor_binary() is None: - return False - return True \ No newline at end of file + return netcontroller.tor_binary() is not None \ No newline at end of file