gwpy / gwsumm

Gravitational-wave interferometer summary information system
GNU General Public License v3.0
12 stars 23 forks source link

Replace rstrip() with removesuffix() in triggers text #411

Closed iaraota closed 1 month ago

iaraota commented 2 months ago

This PR replaces rstrip('.0') with removesuffix('.00') to avoid removing any 0 before . in the string. See the examples below:

>>> a = "10.00" 
>>> b = "11.00" 
>>> c = "110.00"
>>> a.rstrip('.0')
'1'
>>> a.removesuffix('.00')
'10'
>>> b.rstrip('.0')
'11'
>>> b.removesuffix('.00')
'11'
>>> c.rstrip('.0')
'11'
>>> c.removesuffix('.00')
'110'
iaraota commented 2 months ago

@eagoetz this PR fixes the bug reported in: https://git.ligo.org/detchar/ligo-summary-pages/-/issues/246

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 49.27%. Comparing base (720bd0c) to head (6b7410d). Report is 11 commits behind head on master.

Files Patch % Lines
gwsumm/plot/triggers/core.py 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #411 +/- ## ========================================== - Coverage 49.64% 49.27% -0.38% ========================================== Files 60 60 Lines 8823 8789 -34 ========================================== - Hits 4380 4330 -50 - Misses 4443 4459 +16 ``` | [Flag](https://app.codecov.io/gh/gwpy/gwsumm/pull/411/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy) | Coverage Δ | | |---|---|---| | [Linux](https://app.codecov.io/gh/gwpy/gwsumm/pull/411/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy) | `49.27% <0.00%> (-0.38%)` | :arrow_down: | | [macOS](https://app.codecov.io/gh/gwpy/gwsumm/pull/411/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy) | `49.27% <0.00%> (?)` | | | [python3.10](https://app.codecov.io/gh/gwpy/gwsumm/pull/411/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy) | `49.27% <0.00%> (-0.38%)` | :arrow_down: | | [python3.11](https://app.codecov.io/gh/gwpy/gwsumm/pull/411/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy) | `49.27% <0.00%> (-0.38%)` | :arrow_down: | | [python3.9](https://app.codecov.io/gh/gwpy/gwsumm/pull/411/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy) | `49.27% <0.00%> (-0.37%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gwpy#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

iaraota commented 2 months ago

@eagoetz The failing tests are installing the version 1.14.0 of scipy and the ones that passed installed version 1.13.1. I saw that Duncan removed the deprecated trapz function from gwpy, but it was not released yet. I am not sure how to make the tests use an old scipy version. Should we force it in the pyproject.toml?

eagoetz commented 2 months ago

@eagoetz The failing tests are installing the version 1.14.0 of scipy and the ones that passed installed version 1.13.1. I saw that Duncan removed the deprecated trapz function from gwpy, but it was not released yet. I am not sure how to make the tests use an old scipy version. Should we force it in the pyproject.toml?

I think we may have to in the short term. Can you try restricting to <1.14 in this PR?

iaraota commented 2 months ago

@eagoetz The failing tests are installing the version 1.14.0 of scipy and the ones that passed installed version 1.13.1. I saw that Duncan removed the deprecated trapz function from gwpy, but it was not released yet. I am not sure how to make the tests use an old scipy version. Should we force it in the pyproject.toml?

I think we may have to in the short term. Can you try restricting to <1.14 in this PR?

Thank you, Evan! I also restricted the gwpy version to the latest. Once the new version is released we should change both.