Skip to content

refactor: move to_smallest_unit/from_smallest_unit to helpers.py#303

Open
Tet-9 wants to merge 1 commit into
entrius:testfrom
Tet-9:fix/81-move-unit-converters-to-helpers
Open

refactor: move to_smallest_unit/from_smallest_unit to helpers.py#303
Tet-9 wants to merge 1 commit into
entrius:testfrom
Tet-9:fix/81-move-unit-converters-to-helpers

Conversation

@Tet-9
Copy link
Copy Markdown

@Tet-9 Tet-9 commented May 10, 2026

Summary

to_smallest_unit and from_smallest_unit lived in swap.py as
module-level privates while helpers.py already hosted the sibling
to_rao/from_rao conversions. Additionally, quote.py reimplemented
to_smallest_unit inline with a raw Decimal expression — duplicating
logic that already existed.

Changes

  • Move to_smallest_unit/from_smallest_unit from swap.py into
    helpers.py, next to to_rao/from_rao
  • Update swap.py to import them from helpers instead of defining locally
  • Replace the inline Decimal expression in quote.py with a call to
    to_smallest_unit and drop the now-unused Decimal import

Scope

Pure move + one callsite swap. No behavior change, no signature change.

Fixes #81

The two chain-aware unit converters lived in swap.py as module-level
privates while helpers.py already hosted the sibling to_rao/from_rao.
quote.py also reimplemented to_smallest_unit inline with a raw Decimal
expression.

Move to_smallest_unit/from_smallest_unit into helpers.py next to
to_rao/from_rao, update swap.py to import from helpers, and replace
the inline expression in quote.py with a call to to_smallest_unit.
Drop the now-unused Decimal import from quote.py.

Fixes entrius#81
@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Restructures code without changing behavior label May 10, 2026
@igeabdulrahmanikeoluwa-str
Copy link
Copy Markdown

@anderdc , on for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructures code without changing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move to_smallest_unit/from_smallest_unit into CLI helpers module

2 participants