From aa7e7dd6583d780e7520330ab3e3fb1e9ee357ff Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 4 Nov 2019 12:27:19 +0200 Subject: [PATCH] Fixed some docstrings in shared and state --- src/shared.py | 25 ++++++++++++++++++------- src/state.py | 8 ++++---- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/shared.py b/src/shared.py index 1a2add28..90cea89d 100644 --- a/src/shared.py +++ b/src/shared.py @@ -80,7 +80,9 @@ def isAddressInMySubscriptionsList(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): return True @@ -100,8 +102,12 @@ def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address): return False -def decodeWalletImportFormat(WIFstring): # pylint: disable=inconsistent-return-statements - """Convert private key from base58 that's used in the config file to 8-bit binary string""" +def decodeWalletImportFormat(WIFstring): + # 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) privkey = fullString[:-4] if fullString[-4:] != \ @@ -126,14 +132,15 @@ def decodeWalletImportFormat(WIFstring): # pylint: disable=inconsistent-retur 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') myECCryptorObjects.clear() myAddressesByHash.clear() myAddressesByTag.clear() # myPrivateKeys.clear() - keyfileSecure = checkSensitiveFilePermissions(state.appdata + 'keys.dat') + keyfileSecure = checkSensitiveFilePermissions(os.path.join( + state.appdata, 'keys.dat')) hasEnabledKeys = False for addressInKeysFile in BMConfigParser().addresses(): isEnabled = BMConfigParser().getboolean(addressInKeysFile, 'enabled') @@ -162,11 +169,15 @@ def reloadMyAddressHashes(): ) if not keyfileSecure: - fixSensitiveFilePermissions(state.appdata + 'keys.dat', hasEnabledKeys) + fixSensitiveFilePermissions(os.path.join( + state.appdata, 'keys.dat'), hasEnabledKeys) 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() MyECSubscriptionCryptorObjects.clear() queryreturn = sqlQuery('SELECT address FROM subscriptions where enabled=1') diff --git a/src/state.py b/src/state.py index f5526029..58e1106a 100644 --- a/src/state.py +++ b/src/state.py @@ -16,8 +16,8 @@ appdata = '' shutdown = 0 """ - Set to 1 by the doCleanShutdown function. - Used to tell the proof of work worker threads to exit. +Set to 1 by the `.shutdown.doCleanShutdown` function. +Used to tell the threads to exit. """ # Component control flags - set on startup, do not change during runtime @@ -25,7 +25,7 @@ shutdown = 0 enableNetwork = True """enable network threads""" enableObjProc = True -"""enable object processing threads""" +"""enable object processing thread""" enableAPI = True """enable API (if configured)""" enableGUI = True @@ -35,7 +35,7 @@ enableSTDIO = False curses = False sqlReady = False -"""set to true by sqlTread when ready for processing""" +"""set to true by `.threads.sqlThread` when ready for processing""" maximumNumberOfHalfOpenConnections = 0