This heavily refactors decred/util/helpers.py while extending its test coverage (up to 93% total). Part of #70.
All unused functions and classes have been removed.
All code used only once has been moved to the caller sites.
Tests have been written for the remaining functions that did not have any.
Here are the details.
Code left there
formatTraceback function
Used by:
dcr/dcrdata.py, util/tinyhttp/py in decred
app.py, qutilities.py, screens.py in tinywallet
mkdir function
Used by:
decred/wallet/simple.py
app.py, config.py in tinywallet
mktime function
Used by:
examples/plot_ticket_price.py
dcr/calc.py
tinywallet/mpl.py
LogSettings class
Used by the same file
prepareLogging function
Used by:
decred/tests/conftest.py
unit/dcr/wire/test_wire.py
tinywallet/app.py
getLogger function
Used by:
the same file
account.py, dcrdata.py, rpc/py, txscript.py in decred/dcr
accounts.py, wallet.py in decred/wallet
app.py, qutilities.py, screens.py in tinywallet
Code moved elsewhere
coinify function
Only used in dcr/rpc.py, moved there
openInBrowser function
Only used in tinywallet/screens.py, moved there
moveFile function
Used once by tinywallet/screens.py
One-liner moved there, function removed
yearmonthday function
Used once in tinywallet/mpl.py
One-liner moved there, function removed
appDataDir function
Used once in integration/dcr/test_rpc.py, moved there
readINI function
Used once in integration/dcr/test_rpc.py, moved there
This heavily refactors
decred/util/helpers.py
while extending its test coverage (up to 93% total). Part of #70. All unused functions and classes have been removed. All code used only once has been moved to the caller sites. Tests have been written for the remaining functions that did not have any. Here are the details.Code left there
formatTraceback
functionUsed by:
dcr/dcrdata.py
,util/tinyhttp/py
indecred
app.py
,qutilities.py
,screens.py
intinywallet
mkdir
functionUsed by:
decred/wallet/simple.py
app.py, config.py
intinywallet
mktime
functionUsed by:
examples/plot_ticket_price.py
dcr/calc.py
tinywallet/mpl.py
LogSettings
classUsed by the same file
prepareLogging
functionUsed by:
decred/tests/conftest.py
unit/dcr/wire/test_wire.py
tinywallet/app.py
getLogger
functionUsed by:
account.py
,dcrdata.py
,rpc/py
,txscript.py
indecred/dcr
accounts.py
,wallet.py
indecred/wallet
app.py
,qutilities.py
,screens.py
intinywallet
Code moved elsewhere
coinify
functionOnly used in
dcr/rpc.py
, moved thereopenInBrowser
functionOnly used in
tinywallet/screens.py
, moved theremoveFile
functionUsed once by
tinywallet/screens.py
One-liner moved there, function removedyearmonthday
functionUsed once in
tinywallet/mpl.py
One-liner moved there, function removedappDataDir
functionUsed once in
integration/dcr/test_rpc.py
, moved therereadINI function
Used once in integration/dcr/test_rpc.py, moved there
Code removed because unused
normalizeNetName
functionBenchmarker
classformatNumber
functionConsoleLogger
classfetchSettingsFile
functionsaveFile
functionsaveJSON
functionloadJSON
function