Some microimprovements
parent
26b1cc5d87
commit
00ad409737
|
@ -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):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
Loading…
Reference in New Issue