Page MenuHomePhabricator

[electrum] move-only: move amount formatting functions from util to amount.py
ClosedPublic

Authored by PiRK on Jul 3 2025, 11:30.

Details

Summary

I want to move more amount formatting related functions out of main_window generic in a follow-up, and I don't want to move them into the messy generic util module.

Test Plan

git show --color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change

unit tests, functional tests

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jul 3 2025, 11:30
Fabien added a subscriber: Fabien.
Fabien added inline comments.
electrum/electrumabc/amount.py
1 ↗(On Diff #54665)

could be electrumabc/util/amount.py ? Not blocking on that, the code organization of electrum is already completely messed up so your solution is arguably consistent

This revision is now accepted and ready to land.Jul 3 2025, 13:50
electrum/electrumabc/amount.py
10 ↗(On Diff #54665)

What does this do ?

electrum/electrumabc/amount.py
10 ↗(On Diff #54665)

I didn't notice that this include was included. I need to check it closer.
I'm not sure what happens when a function is declared, deleted then imported at the module level

# https://docs.python.org/3/library/gettext.html#deferred-translations
def _(message):
    return message
fee_levels = [
    _("Within 25 blocks"),
    _("Within 10 blocks"),
    _("Within 5 blocks"),
    _("Within 2 blocks"),
    _("In the next block"),
]

del _

import the correct _ (the other one is going away in D18319)

This mistake was a result of not properly reviewing a "Refactor -> move" action via my IDE