Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fixed width formatter #139

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jagerber48
Copy link
Owner

Add formatting utilities to output strings will better controlled lengths as strings.

Until this point sciform has provided functionality to control

  • The number of digits to the left of the most significant digit using left_pad options
  • The number of digits to the right of the most signficiant digit using round_mode="sig_fig" and ndigits
  • The number of digits to the right of the decimal symbol using round_mode="dec_place" and ndigits.

format_to_target_length applies an algorithm that varies the number of significant digits displayed and finds the best formatted result. Results closest to the target length are preferred.

@jagerber48 jagerber48 linked an issue Jan 29, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (b1a4492) 100.00% compared to head (6f25a71) 99.92%.
Report is 63 commits behind head on main.

❗ Current head 6f25a71 differs from pull request most recent head 2d72008. Consider uploading reports for the commit 2d72008 to get more accurate results

Files Patch % Lines
src/sciform/target_length.py 97.22% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #139      +/-   ##
===========================================
- Coverage   100.00%   99.92%   -0.08%     
===========================================
  Files           25       27       +2     
  Lines         1212     1268      +56     
===========================================
+ Hits          1212     1267      +55     
- Misses           0        1       +1     
Flag Coverage Δ
3.10 99.92% <98.21%> (-0.08%) ⬇️
3.11 99.92% <98.21%> (-0.08%) ⬇️
3.12 99.92% <98.21%> (-0.08%) ⬇️
3.9 99.84% <98.11%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jagerber48 jagerber48 changed the title Feature/fixed width formatter 133 Feature/fixed width formatter Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fixed width formatting
1 participant