Skip to content

Conversation

@thomasmarchioro3
Copy link
Contributor

This PR addresses issue #1635 for lightly/api/bitmask.py and tests/api/test_BitMask.py. It also adds some fixes for the BitMask class and related tests (based on comments found in the code).


Changes to lightly/api/bitmask.py

  • Added full type annotations (passes mypy without issues).
  • Updated BitMask.invert() and BitMask.complement(). Made the total_size parameter optional: if total_size is not provided, it is now inferred as len(bin(int_value))-2.

Changes to tests/api/test_BitMask.py

  • Added type annotations (passes mypy without issues).
  • Added a test for BitMask.invert() to ensure correct behavior.
  • Removed the unused setup(self) method:
    • It was not overriding the correct unittest.TestCase method (setUp(self)), and was unused in practice.

Sorry for the two PRs in a row, I was going through the codebase and fixing issues as I ran into them :)

@liopeer
Copy link
Contributor

liopeer commented Aug 8, 2025

Sorry for the two PRs in a row, I was going through the codebase and fixing issues as I ran into them :)

Nothing to be sorry for! 😄 We really appreciate the contribution, however it might take us a few days to allocate resources for the review.

@codecov
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@1d2eb09). Learn more about missing BASE report.

Files with missing lines Patch % Lines
lightly/api/bitmask.py 91.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1878   +/-   ##
=========================================
  Coverage          ?   86.06%           
=========================================
  Files             ?      167           
  Lines             ?     6970           
  Branches          ?        0           
=========================================
  Hits              ?     5999           
  Misses            ?      971           
  Partials          ?        0           

☔ 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.

@yutong-xiang-97
Copy link
Contributor

yutong-xiang-97 commented Aug 13, 2025

Hi @thomasmarchioro3 thank you for your contribution to LightlySSL!

To fix the failing check, you could run

make format
make all-checks

which fix the format automatically for you. Then you could commit the changes.

You could also prevent such problems in the future by running the command every time before you commit following our contributing guide.

I will review the code in detail shortly.

@yutong-xiang-97
Copy link
Contributor

Hi @thomasmarchioro3, unfortunately the lightly.api module is already stable and we have no plans in modifying it in any case, nor is it open for contributions from external.

I will close this PR now. Thank you all the same for your PR though!

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.

3 participants