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

remove print() statements and fix logging usage #229

Merged
merged 6 commits into from
Feb 4, 2025
Merged

Conversation

ManuelHu
Copy link
Contributor

@ManuelHu ManuelHu commented Jan 30, 2025

  • add inline # noqa: T201 comments for intended print() usage
  • use properly module-scoped logger naming to avoid spamming the root logger
  • replace all other print() statements either with logging statements, or remove them
  • lower the log level from INFO to DEBUG in a lot of cases

there are some parts that have not been converted. Those are listed in pyproject.toml:

"src/pyg4ometry/gui/**" = ["T201"]
"src/pyg4ometry/{fluka,convert}/**" = ["T201"]
"src/pyg4ometry/{io,analysis,features}/**" = ["T201"]
"src/pyg4ometry/{freecad,pycgal,pyoce}/**" = ["T201"]
"src/pyg4ometry/visualisation/{UsdViewer,ViewerHierarchyBase}.py" = ["T201"]

Those are either "unfinished"(?) parts, or I do not know enough about that code.

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 67.73163% with 101 lines in your changes missing coverage. Please review.

Project coverage is 74.68%. Comparing base (1fac855) to head (458e94c).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/pyg4ometry/visualisation/VtkViewerNew.py 0.00% 12 Missing ⚠️
src/pyg4ometry/gdml/Reader.py 47.36% 10 Missing ⚠️
src/pyg4ometry/geant4/LogicalVolume.py 69.23% 8 Missing ⚠️
src/pyg4ometry/geant4/Registry.py 61.90% 8 Missing ⚠️
src/pyg4ometry/compare/_Compare.py 12.50% 7 Missing ⚠️
src/pyg4ometry/geant4/ReplicaVolume.py 25.00% 6 Missing ⚠️
src/pyg4ometry/visualisation/VtkViewer.py 45.45% 6 Missing ⚠️
src/pyg4ometry/analysis/flukaData.py 28.57% 5 Missing ⚠️
src/pyg4ometry/geant4/_Material.py 28.57% 5 Missing ⚠️
src/pyg4ometry/usd/solid/SolidBase.py 44.44% 5 Missing ⚠️
... and 13 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #229      +/-   ##
==========================================
+ Coverage   74.61%   74.68%   +0.07%     
==========================================
  Files         157      157              
  Lines       22867    22907      +40     
==========================================
+ Hits        17063    17109      +46     
+ Misses       5804     5798       -6     

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

@ManuelHu
Copy link
Contributor Author

@stewartboogert this would be my changes to start with #220 :-)

the usage of affected functions already raises an exception.
@gipert gipert added the enhancement New feature or request label Feb 4, 2025
@gipert
Copy link
Member

gipert commented Feb 4, 2025

This seems uncontroversial to me, I would merge and release a patch version.

@gipert gipert merged commit 94b3392 into g4edge:main Feb 4, 2025
17 checks passed
@ManuelHu ManuelHu deleted the print branch February 4, 2025 11:16
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.

2 participants