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

Modernize #259

Merged
merged 9 commits into from
Mar 28, 2024
Merged

Modernize #259

merged 9 commits into from
Mar 28, 2024

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Mar 19, 2024

Description

This brings cheta up to modern-ish code standards.

  • Remove __future__ imports and six imports.
  • Latest ruff lint and formatting.
  • Format dev_utils files.

Interface impacts

None.

Testing

Unit tests

  • Mac
ska3) ➜  cheta git:(modernize) git rev-parse HEAD  
b1b2307738381fa18e02dabf7459f131a3b0056a
(ska3) ➜  cheta git:(modernize) pytest
====================================================== test session starts ======================================================
platform darwin -- Python 3.11.8, pytest-7.4.4, pluggy-1.4.0
rootdir: /Users/aldcroft/git
configfile: pytest.ini
plugins: timeout-2.2.0, anyio-4.3.0
collected 173 items                                                                                                             

cheta/tests/test_comps.py ...........................................................                                     [ 34%]
cheta/tests/test_data_source.py .........                                                                                 [ 39%]
cheta/tests/test_fetch.py ................................                                                                [ 57%]
cheta/tests/test_intervals.py .........................                                                                   [ 72%]
cheta/tests/test_orbit.py .                                                                                               [ 72%]
cheta/tests/test_remote_access.py ......                                                                                  [ 76%]
cheta/tests/test_sync.py ........                                                                                         [ 80%]
cheta/tests/test_units.py ...........                                                                                     [ 87%]
cheta/tests/test_units_reversed.py ...........                                                                            [ 93%]
cheta/tests/test_utils.py ...........                                                                                     [100%]

======================================================= warnings summary ========================================================

Independent check of unit tests by Javier

  • OSX

Functional tests

No functional testing.

@taldcroft taldcroft changed the title WIP: Modernize Modernize Mar 19, 2024
@taldcroft
Copy link
Member Author

@javierggt - since I (somewhat accidentally) merged #260 into this PR there are unrelated commits now. You can probably just look at the 4 original commits in isolation since they are mostly independent of each other.

Copy link
Contributor

@javierggt javierggt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are in the subject of modernization, the Counter class you have here can be replaced with collections.defaultdifct. Instead of:

ref_counter = Counter()

this:

ref_counter =collections.defaultdict(lambda : 0)

but I do not mind the Counter class.

@taldcroft
Copy link
Member Author

I would say using collections.Counter would be an even nicer modern solution. But this whole code is just taken straight from an old activestate recipe and it works. I just wanted to remove the six dependence with the least likelihood of accidentally breaking something.

@taldcroft taldcroft merged commit aaa9dbd into master Mar 28, 2024
2 checks passed
@taldcroft taldcroft deleted the modernize branch March 28, 2024 10:42
This was referenced Apr 17, 2024
@javierggt javierggt mentioned this pull request May 1, 2024
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