Some microimprovements

master
0Gitnick 2019-08-13 20:06:14 -05:00
parent 26b1cc5d87
commit 00ad409737
3 changed files with 3 additions and 9 deletions

View File

@ -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):
'''

View File

@ -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

View File

@ -1,6 +1,4 @@
import netcontroller
def has_tor():
if netcontroller.tor_binary() is None:
return False
return True
return netcontroller.tor_binary() is not None