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

Replace timeago #587

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Conversation

FedericoCeratto
Copy link
Contributor

Replace the timeago library with a simple function. This reduces the amount of Python dependencies making the tool easier to package for Linux distributions. Additionally it handles unexpected timestamps from the future, if any, by returning None

Copy link

codecov bot commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.

Project coverage is 61.37%. Comparing base (b58094b) to head (b055813).

Current head b055813 differs from pull request most recent head c34d08b

Please upload reports for the commit c34d08b to get more accurate results.

Files Patch % Lines
meshtastic/mesh_interface.py 78.57% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #587      +/-   ##
==========================================
- Coverage   61.78%   61.37%   -0.42%     
==========================================
  Files          14       14              
  Lines        2986     2985       -1     
==========================================
- Hits         1845     1832      -13     
- Misses       1141     1153      +12     
Flag Coverage Δ
unittests 61.37% <78.57%> (-0.42%) ⬇️

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.

@ianmcorvidae
Copy link
Contributor

I think that this largely looks fine to me, and I certainly like getting rid of dependencies and creating more code we can properly add types to (and already have, basically). If you're able to, I do think I would like to see some tests of this code, since by no longer relying on an external library we're probably slightly more responsible for ensuring the output is sane! I suspect this code would also be likely to be moved around by #579, but that is of course still in planning stages, just noting here for good measure.

Replace the timeago library with a simple function
_timeago is not specialized for mesh interfaces so it is factored
out into a private function
@FedericoCeratto
Copy link
Contributor Author

@ianmcorvidae Rebased and updated with tests and some cleanup

@ianmcorvidae ianmcorvidae merged commit c34d08b into meshtastic:master Jun 26, 2024
5 of 9 checks passed
@ianmcorvidae
Copy link
Contributor

I fixed up pylint complaining about a lack of a docstring, and added a test using fuzzing (just for fun, really, I've been learning how to use that library recently) and merged. Thanks for the contribution!

@FedericoCeratto FedericoCeratto deleted the drop-timeago branch June 27, 2024 17:24
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.

2 participants