Fixed some docstrings in shared and state

This commit is contained in:
Dmitri Bogomolov 2019-11-04 12:27:19 +02:00
parent f18f534c48
commit aa7e7dd658
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 22 additions and 11 deletions

View File

@ -80,7 +80,9 @@ def isAddressInMySubscriptionsList(address):
def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address): def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address):
"""Am I subscribed to this address, is it in my addressbook or whitelist?""" """
Am I subscribed to this address, is it in my addressbook or whitelist?
"""
if isAddressInMyAddressBook(address): if isAddressInMyAddressBook(address):
return True return True
@ -100,8 +102,12 @@ def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address):
return False return False
def decodeWalletImportFormat(WIFstring): # pylint: disable=inconsistent-return-statements def decodeWalletImportFormat(WIFstring):
"""Convert private key from base58 that's used in the config file to 8-bit binary string""" # pylint: disable=inconsistent-return-statements
"""
Convert private key from base58 that's used in the config file to
8-bit binary string
"""
fullString = arithmetic.changebase(WIFstring, 58, 256) fullString = arithmetic.changebase(WIFstring, 58, 256)
privkey = fullString[:-4] privkey = fullString[:-4]
if fullString[-4:] != \ if fullString[-4:] != \
@ -126,14 +132,15 @@ def decodeWalletImportFormat(WIFstring): # pylint: disable=inconsistent-retur
def reloadMyAddressHashes(): def reloadMyAddressHashes():
"""Reinitialise runtime data (e.g. encryption objects, address hashes) from the config file""" """Reload keys for user's addresses from the config file"""
logger.debug('reloading keys from keys.dat file') logger.debug('reloading keys from keys.dat file')
myECCryptorObjects.clear() myECCryptorObjects.clear()
myAddressesByHash.clear() myAddressesByHash.clear()
myAddressesByTag.clear() myAddressesByTag.clear()
# myPrivateKeys.clear() # myPrivateKeys.clear()
keyfileSecure = checkSensitiveFilePermissions(state.appdata + 'keys.dat') keyfileSecure = checkSensitiveFilePermissions(os.path.join(
state.appdata, 'keys.dat'))
hasEnabledKeys = False hasEnabledKeys = False
for addressInKeysFile in BMConfigParser().addresses(): for addressInKeysFile in BMConfigParser().addresses():
isEnabled = BMConfigParser().getboolean(addressInKeysFile, 'enabled') isEnabled = BMConfigParser().getboolean(addressInKeysFile, 'enabled')
@ -162,11 +169,15 @@ def reloadMyAddressHashes():
) )
if not keyfileSecure: if not keyfileSecure:
fixSensitiveFilePermissions(state.appdata + 'keys.dat', hasEnabledKeys) fixSensitiveFilePermissions(os.path.join(
state.appdata, 'keys.dat'), hasEnabledKeys)
def reloadBroadcastSendersForWhichImWatching(): def reloadBroadcastSendersForWhichImWatching():
"""Reinitialise runtime data for the broadcasts I'm subscribed to from the config file""" """
Reinitialize runtime data for the broadcasts I'm subscribed to
from the config file
"""
broadcastSendersForWhichImWatching.clear() broadcastSendersForWhichImWatching.clear()
MyECSubscriptionCryptorObjects.clear() MyECSubscriptionCryptorObjects.clear()
queryreturn = sqlQuery('SELECT address FROM subscriptions where enabled=1') queryreturn = sqlQuery('SELECT address FROM subscriptions where enabled=1')

View File

@ -16,8 +16,8 @@ appdata = ''
shutdown = 0 shutdown = 0
""" """
Set to 1 by the doCleanShutdown function. Set to 1 by the `.shutdown.doCleanShutdown` function.
Used to tell the proof of work worker threads to exit. Used to tell the threads to exit.
""" """
# Component control flags - set on startup, do not change during runtime # Component control flags - set on startup, do not change during runtime
@ -25,7 +25,7 @@ shutdown = 0
enableNetwork = True enableNetwork = True
"""enable network threads""" """enable network threads"""
enableObjProc = True enableObjProc = True
"""enable object processing threads""" """enable object processing thread"""
enableAPI = True enableAPI = True
"""enable API (if configured)""" """enable API (if configured)"""
enableGUI = True enableGUI = True
@ -35,7 +35,7 @@ enableSTDIO = False
curses = False curses = False
sqlReady = False sqlReady = False
"""set to true by sqlTread when ready for processing""" """set to true by `.threads.sqlThread` when ready for processing"""
maximumNumberOfHalfOpenConnections = 0 maximumNumberOfHalfOpenConnections = 0