Skip to content

Remove all used print() statements.#889

Open
ZackAttack614 wants to merge 3 commits intomasterfrom
remove-prints
Open

Remove all used print() statements.#889
ZackAttack614 wants to merge 3 commits intomasterfrom
remove-prints

Conversation

@ZackAttack614
Copy link
Collaborator

Resolves #350

Overview

This PR converts all useful print statements into logger statements, and removes the rest.

Affected Workflows

No workflows are affected by this PR.

Documentation Changes

No documentation changes are required for this PR.

@ZackAttack614 ZackAttack614 requested a review from psavery February 6, 2026 17:25
if cresult:
print("test passed")
else:
print("test failed")
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're keeping this __main__ section, isn't this final printing the most important part of it? Otherwise, if you ran it, you wouldn't know if it passed or failed.

else:
self.fid = open(filename, 'w')
print(self._header, file=self.fid)
logger.info(self._header, file=self.fid)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it's better to just write to the file instead? Like:

self.fid.write(self._header)

I think using the logger would add extra stuff to the file contents. It looks like the print before was just intended to write to the file. Same for the other ones in this class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe using the print() statement before implicitly added a '\n' after each call too, so you might need to add + '\n' to the writes.

Co-authored-by: Patrick Avery <patrick.avery@kitware.com>
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.

Replace any print statements with appropriate logging calls

2 participants