Skip to content

feat: implement DatasetLibrary.names as class property #1027

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

dkrako
Copy link
Contributor

@dkrako dkrako commented Mar 12, 2025

Description

followup to #1022

inspired by https://stackoverflow.com/questions/76249636/class-properties-in-python-3-11

there's really some next level magic involved. need to level up my skill tree.

@github-actions github-actions bot added the enhancement New feature or request label Mar 12, 2025
@dkrako dkrako mentioned this pull request Mar 12, 2025
12 tasks
@dkrako dkrako marked this pull request as draft March 12, 2025 18:31
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ff76f47) to head (6c1b13c).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1027   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           78        78           
  Lines         3561      3570    +9     
  Branches       629       629           
=========================================
+ Hits          3561      3570    +9     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dkrako
Copy link
Contributor Author

dkrako commented Mar 12, 2025

pylint is complaining:

src/pymovements/dataset/dataset_library.py:81: [E0213(no-self-argument), DatasetLibrary.names] Method 'names' should have "self" as first argument

This one would be easy to fix: either rename cls to self or ignore no-self-argument.

What's worse is this:

tests/unit/dataset/dataset_library_test.py:60: [E1133(not-an-iterable), test_list_names_is_list_of_str] Non-iterable value names is used in an iterating context

This means pylint doesn't get that this is a property, not simply a method.

I'll try this approach soon:

class classproperty(property):
    def __get__(self, owner_self, owner_cls):
        return self.fget(owner_cls)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant