-
Notifications
You must be signed in to change notification settings - Fork 0
Force bool to float32, add explicit error message #14
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
Open
tjgalvin
wants to merge
12
commits into
main
Choose a base branch
from
beth-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b36aa03
addded logger, and to
tjgalvin f43f195
added a warning
tjgalvin 90382f7
raise error, not warning
tjgalvin beb2627
Fix CI and CD: twine metadata, mypy/numpy/python version clash
claude 5df81c9
Pin the mypy pre-commit hook to Python 3.11
claude 449d16a
Merge branch 'claude/prs-cicd-failures-bfomu2' into beth-fix
claude 23eaa96
Revert pre-commit config, annotate logger, pick up CI fixes
claude 9658e75
Correct beam_shape_erode return-dtype docstring
claude 787faf5
Add regression test for the flood-fill mask dtype
claude b530ca5
Drop explanatory comments from CI and pre-commit config
claude b31df8c
Merge branch 'claude/prs-cicd-failures-bfomu2' into beth-fix
claude 84679de
Merge main into beth-fix, resolving the test conflict
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
|
|
||
| # Create logger | ||
| logging.captureWarnings(True) | ||
| logger = logging.getLogger("eye-patch") | ||
| logger.setLevel(logging.INFO) | ||
|
|
||
| # Create console handler and set level to debug | ||
| ch = logging.StreamHandler() | ||
| ch.setLevel(logging.INFO) | ||
|
|
||
|
|
||
| class CustomFormatter(logging.Formatter): | ||
| """A custom logger formatter""" | ||
|
|
||
| grey = "\x1b[38;20m" | ||
| blue = "\x1b[34;20m" | ||
| green = "\x1b[32;20m" | ||
| yellow = "\x1b[33;20m" | ||
| red = "\x1b[31;20m" | ||
| bold_red = "\x1b[31;1m" | ||
| reset = "\x1b[0m" | ||
| format_str = "%(asctime)s.%(msecs)03d %(module)s - %(funcName)s: %(message)s" | ||
|
|
||
| FORMATS = { # noqa: RUF012 | ||
| logging.DEBUG: f"{blue}%(levelname)s{reset} {format_str}", | ||
| logging.INFO: f"{green}%(levelname)s{reset} {format_str}", | ||
| logging.WARNING: f"{yellow}%(levelname)s{reset} {format_str}", | ||
| logging.ERROR: f"{red}%(levelname)s{reset} {format_str}", | ||
| logging.CRITICAL: f"{bold_red}%(levelname)s{reset} {format_str}", | ||
| } | ||
|
|
||
| def format(self, record: logging.LogRecord) -> str: | ||
| log_fmt = self.FORMATS.get(record.levelno) | ||
| formatter = logging.Formatter(log_fmt, "%Y-%m-%d %H:%M:%S") | ||
| return formatter.format(record) | ||
|
|
||
|
|
||
| # Add formatter to ch | ||
| ch.setFormatter(CustomFormatter()) | ||
|
|
||
| # Add ch to logger | ||
| logger.addHandler(ch) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Consider removing it."
What does "it" mean here? Can we make this message more explicit on what to change?