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

Attempt 2 for Ruff #286

Closed
wants to merge 25 commits into from
Closed

Attempt 2 for Ruff #286

wants to merge 25 commits into from

Conversation

purva-thakre
Copy link
Collaborator

@purva-thakre purva-thakre commented Nov 26, 2023

Description

Fixes #277 and what was started in #280

Todos

Notable points that this PR has either accomplished or will accomplish.

Some things flagged by isort and pycodestyle have already been completed. Following are the things flagged by pydocstyle.

  • toqito/matrix_ops/tests/test_inner_product.py:16:5: D103 Missing docstring in public function
  • toqito/matrix_ops/tests/test_outer_product.py:14:5: D103 Missing docstring in public functio
  • toqito/matrix_ops/tests/test_outer_product.py:24:5: D103 Missing docstring in public function
  • toqito/matrix_ops/tests/test_unvec.py:14:5: D103 Missing docstring in public function
  • toqito/matrix_ops/tests/test_vec.py:12:5: D103 Missing docstring in public function
  • toqito/matrix_ops/tests/test_vectors_from_gram_matrix.py:43:5: D103 Missing docstring in public function
  • toqito/matrix_ops/tests/test_vectors_to_gram_matrix.py:24:5: D103 Missing docstring in public function
  • toqito/matrix_props/tests/test_is_orthonormal.py:8:5: D404 First word of the docstring should not be "This"
  • toqito/matrix_props/tests/test_is_orthonormal.py:19:5: D404 First word of the docstring should not be "This"
  • toqito/matrix_props/tests/test_is_totally_positive.py:30:5: D103 Missing docstring in public function
  • toqito/matrix_props/tests/test_is_totally_positive.py:38:5: D103 Missing docstring in public function
  • toqito/matrix_props/tests/test_kp_norm.py:24:5: D103 Missing docstring in public function
  • toqito/perms/tests/test_antisymmetric_projection.py:29:5: D103 Missing docstring in public function
  • toqito/rand/tests/test_random_density_matrix.py:19:5: D103 Missing docstring in public function
  • toqito/rand/tests/test_random_density_matrix.py:33:5: D103 Missing docstring in public function
  • toqito/rand/tests/test_random_state_vector.py:20:5: D103 Missing docstring in public function
  • toqito/rand/tests/test_random_unitary.py:10:5: D103 Missing docstring in public function
  • toqito/rand/tests/test_random_unitary.py:20:5: D103 Missing docstring in public function
  • toqito/state_opt/tests/test_state_exclusion.py:21:5: D103 Missing docstring in public function
  • toqito/state_opt/tests/test_state_exclusion.py:30:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_concurrence.py:20:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_concurrence.py:32:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_entanglement_of_formation.py:20:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_has_symmetric_extension.py:34:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_in_separable_ball.py:29:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_antidistinguishable.py:14:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_ensemble.py:17:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_mixed.py:17:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_mutually_orthogonal.py:31:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_mutually_orthogonal.py:48:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_mutually_unbiased_basis.py:74:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_npt.p y:26:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_ppt.py:24:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_product.py:36:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_is_pure.py:30:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_log_negativity.py:21:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_log_negativity.py:37:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_negativity.py:25:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_negativity.py:41:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_purity.py:18:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_purity.py:29:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_schmidt_rank.py:44:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_von_neumann_entropy.py:18:5: D103 Missing docstring in public function
  • toqito/state_props/tests/test_von_neumann_entropy.py:29:5: D103 Missing docstring in public function
  • toqito/states/tests/test_basis.py:19:5: D103 Missing docstring in public function
  • toqito/states/tests/test_bell.py:23:5: D103 Missing docstring in public function
  • toqito/states/tests/test_brauer.py:36:5: D103 Missing docstring in public function
  • toqito/states/tests/test_breuer.py:15:5: D103 Missing docstring in public function
  • toqito/states/tests/test_breuer.py:26:5: D103 Missing docstring in public function
  • toqito/states/tests/test_domino.py:33:5: D103 Missing docstring in public function
  • toqito/states/tests/test_gen_bell.py:21:5: D103 Missing docstring in public function
  • toqito/states/tests/test_ghz.py:19:5: D103 Missing docstring in public function
  • toqito/states/tests/test_max_entangled.py:19:5: D103 Missing docstring in public function
  • toqito/states/tests/test_mutually_unbiased_basis.py:13:5: D103 Missing docstring in public function
  • toqito/states/tests/test_mutually_unbiased_basis.py:50:5: D103 Missing docstring in public function
  • toqito/states/tests/test_tile.py:26:5: D103 Missing docstring in public function
  • toqito/states/tests/test_trine.py:7:5: D103 Missing docstring in public function
  • toqito/states/tests/test_w_state.py:48:5: D103 Missing docstring in public function
  • toqito/states/tests/test_werner.py:41:5: D103 Missing docstring in public function

Questions

  • Question1

Status

  • Ready to go

pyproject.toml Outdated
Comment on lines 80 to 65
[tool.ruff.lint]
select = ["I", "D", "E", "W"]
# ruff configuration
# E, W -- pycodestyle
# D -- pydocstyle
# I -- isort
Copy link
Collaborator Author

@purva-thakre purva-thakre Nov 27, 2023

Choose a reason for hiding this comment

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

@vprusso Of the available rules to check, these appeared to be the most obvious. Do you want me to add anything else?

BTW feel free to take your time to respond to things on here. I don't really expect a quick response on holidays and weekends. Even on a weekday, I don't expect a quick response. Within 24 hours is fine by me!

Edit: In the newer version of this file, I have also added PL for pylint.
I think PLR0912, PLR0911, PLR0915 could be ignored.

https://docs.astral.sh/ruff/rules/#pylint-pl

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vprusso You missed this earlier comment here. No worries!

Should we try to add more rules beyond what's already added?

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, my apologies. Nope, I think that list looks good. If we decide we want to add something in later we can do that, but for now, this list looks good to me!

pyproject.toml Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (7e73db0) 98.1% compared to head (d075582) 98.1%.
Report is 3 commits behind head on master.

❗ Current head d075582 differs from pull request most recent head c448817. Consider uploading reports for the commit c448817 to get more accurate results

Files Patch % Lines
toqito/state_props/is_separable.py 50.0% 2 Missing ⚠️
toqito/matrix_ops/tensor.py 91.6% 0 Missing and 1 partial ⚠️
toqito/state_props/has_symmetric_extension.py 75.0% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master    #286   +/-   ##
======================================
  Coverage    98.1%   98.1%           
======================================
  Files         295     295           
  Lines        6926    6959   +33     
  Branches      772     772           
======================================
+ Hits         6795    6829   +34     
  Misses         90      90           
+ Partials       41      40    -1     

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

purva-thakre added a commit that referenced this pull request Nov 27, 2023
purva-thakre added a commit that referenced this pull request Nov 27, 2023
@purva-thakre purva-thakre marked this pull request as ready for review November 27, 2023 19:20
@purva-thakre
Copy link
Collaborator Author

purva-thakre commented Nov 27, 2023

Except for the math environments of # noqa: E501 docstrings and another unresolved comment about using other additional rules, I think this PR is ready for a review.

Code coverage has decreased though. So, will try to bring it back up later by adding tests for the uncovered lines.

Copy link
Owner

@vprusso vprusso left a comment

Choose a reason for hiding this comment

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

Wow, quite the diff! It's great to see so much consistency and improvement across the board! Only one minor comment, but modulo the coverage (depending on whether it makes sense to fix in this diff) LGTM! 🚀

toqito/channel_metrics/completely_bounded_spectral_norm.py Outdated Show resolved Hide resolved
@purva-thakre
Copy link
Collaborator Author

purva-thakre commented Nov 28, 2023

To increase code coverage: Fix #293

state_props/is_separable

image

state_props/has_symmetric_extension

below might be flagged due to #294

image

Not sure why matrix_ops/tensor shows up as dropped coverage. Maybe due to #240 ?

@purva-thakre purva-thakre force-pushed the ruff_for_code_style branch 2 times, most recently from 139fe15 to d372bc9 Compare November 28, 2023 16:51
@purva-thakre
Copy link
Collaborator Author

purva-thakre commented Nov 28, 2023

@vprusso Not sure what happened here but all checks have disappeared. I have tried triggering my last commit but there are no checks being run.

Edit: I have also attempted a git rebase.

purva-thakre added a commit that referenced this pull request Nov 28, 2023
This was referenced Nov 28, 2023
@purva-thakre
Copy link
Collaborator Author

Closing this to re-start with a fresh branch.

Some of the changes in #292 and #278 might be clashing with what was already added here. Instead of having a big diff, will move to adding 1 thing per PR.

@purva-thakre purva-thakre mentioned this pull request Nov 28, 2023
3 tasks
@purva-thakre purva-thakre deleted the ruff_for_code_style branch November 28, 2023 17:44
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.

Alternative to pydocstyle
2 participants