decred / tinydecred

Python tools for Decred
ISC License
27 stars 14 forks source link

util: helpers.py refactor #136

Closed teknico closed 4 years ago

teknico commented 4 years ago

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:

mkdir function

Used by:

mktime function

Used by:

LogSettings class

Used by the same file

prepareLogging function

Used by:

getLogger function

Used by:

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

Code removed because unused