Skip to content

Additional refactoring and consolidation#120

Merged
mkaz merged 4 commits into
mainfrom
refactor/v3
Sep 7, 2025
Merged

Additional refactoring and consolidation#120
mkaz merged 4 commits into
mainfrom
refactor/v3

Conversation

@mkaz

@mkaz mkaz commented Sep 6, 2025

Copy link
Copy Markdown
Owner
  • Add additional module tests and examples (see tests/module-test*.py)
  • Move vertical chart to chart class
  • Move normalize() out of utils and into data class
  • Fixes for missed duplicate escape code / color issue
  • Continue refactor duplicate code in util function
  • Convert old .format() calls to f-strings to simplify

mkaz added 3 commits September 6, 2025 07:03
- Missed a duplicate escape code / color issue
- Refactor duplicate format code into util function
- Convert old .format() calls to f-strings to simplify
@mkaz mkaz force-pushed the refactor/v3 branch 2 times, most recently from 4f91b27 to cfbf598 Compare September 7, 2025 13:18
Remove uv.lock from repo - helps version testing
@mkaz mkaz merged commit 41adfd4 into main Sep 7, 2025
2 checks passed
@mkaz mkaz deleted the refactor/v3 branch September 7, 2025 13:39
TarEnethil added a commit to TarEnethil/termgraph that referenced this pull request Feb 25, 2026
Support for the --no-readable argument was (accidentally?) removed in
41adfd4 Additional refactoring and consolidation (mkaz#120).

With the refactored version of format_value, this is now an easy fix.
Only call cvt_to_readable if no_readable is False (as it was before). It
now also works for all chart types.

Fixes 41adfd4

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
mkaz pushed a commit that referenced this pull request Mar 25, 2026
* Use format_value consistently

* use format_value across all chart types
* format_value now takes the full args object instead of individual
  parameters.
* format_value evaluates the args format, percentage, suffix and no_values
* cvt_to_readable is no longer responsible for percentage conversion
* suffix is no longer appended when no_values is True

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>

* Fix --no-readable argument

Support for the --no-readable argument was (accidentally?) removed in
41adfd4 Additional refactoring and consolidation (#120).

With the refactored version of format_value, this is now an easy fix.
Only call cvt_to_readable if no_readable is False (as it was before). It
now also works for all chart types.

Fixes 41adfd4

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>

* Skip unnecessary argument checks

Since Args self-initializes with a default, I see no reason to do
excessive type checking.

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>

* Add formatting tests

Add tests that ensure formatting options are working as expected (and so
that future refactorings don't break things again).

A new helper function run_for_all_charts() is introduced. Histograms are
optional, as their value/formatting works a bit differently.

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>

* Add custom tick support for VerticalChart

When changing test_custom_tick_appears_in_output() to use the new
run_for_all_tests() function, I discovered that VerticalChart had no
support for custom ticks.

After a little refactoring (tick is now a member of Chart and only
initialized once), all Charts now support custom ticks.

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>

---------

Signed-off-by: Thorben Roemer <thorbenroemer@t-online.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant