Skip to content

Refactor Logged class __new__ method return type annotation#45

Open
RamogninoF wants to merge 2 commits intowolph:developfrom
RamogninoF:fix-logger-hint
Open

Refactor Logged class __new__ method return type annotation#45
RamogninoF wants to merge 2 commits intowolph:developfrom
RamogninoF:fix-logger-hint

Conversation

@RamogninoF
Copy link
Copy Markdown

This pull request makes a minor update to the __new__ method signature in python_utils/logger.py, removing the unnecessary explicit return type annotation.

The explicit type-hint over-constrained the return to Logged instances also for derived classes. Therefore, instantiation of derived class tricked the type-checker to thinking it was instantiating a Logged instance, instead of the an instance of the derived class.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the explicit return type hint from the new method in python_utils/logger.py. The feedback suggests using types.Self as a return type instead of removing the annotation entirely, which ensures better type safety for subclasses and maintains consistent type hinting across the codebase.

Comment thread python_utils/logger.py Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.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.

1 participant