Some microimprovements

This commit is contained in:
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) Return the amount of leading zeroes in a hex hash string (hexHash)
''' '''
difficulty = 0
assert type(hexHash) is str assert type(hexHash) is str
return len(hexHash) - len(hexHash.lstrip('0'))
difficulty = len(hexHash) - len(hexHash.lstrip('0'))
return difficulty
def hashMeetsDifficulty(hexHash): def hashMeetsDifficulty(hexHash):
''' '''

View File

@ -21,7 +21,7 @@
def detect_optimization(): def detect_optimization():
'''Returns true if Python is run in optimized mode (-o), based on optimization ignoring assert statements''' '''Returns true if Python is run in optimized mode (-o), based on optimization ignoring assert statements'''
try: try:
assert True is False assert False
except AssertionError: except AssertionError:
return False return False
return True return True

View File

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