Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[MNT] Use Literal forlevel parameter inset_loglevel (#30257)#30260

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

nrnavaneet
Copy link
Contributor

Summary

This PR replaces thestr type annotation withtyping.Literal for thelevel parameter inmatplotlib.set_loglevel. This improves static type checking and IDE autocompletion for common log levels.

Changes

  • IntroducedLiteral type for accepted log level values:"notset","debug","info","warning","error","critical"
  • Helps clarify valid values to users and tooling without changing runtime behavior

Notes

  • No logic has been changed
  • No tests were added since this is strictly a typing improvement

Closes#30257

@timhoffm
Copy link
Member

Please apply the same change to pyplot.set_loglevel

@@ -281,7 +283,9 @@ def _ensure_handler():
return handler


def set_loglevel(level):
def set_loglevel(
level: Literal["notset", "debug", "info", "warning", "error", "critical"]
Copy link
Member

Choose a reason for hiding this comment

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

We don't have in-line types anywhere else in the code. I think this belongs in the pyi file. Note that this function is basically obsolete.

Copy link
Member

Choose a reason for hiding this comment

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

This is not solved. Please revert the change here and instead apply it to the .pyi file.

Copy link
ContributorAuthor

@nrnavaneetnrnavaneetJul 12, 2025
edited
Loading

Choose a reason for hiding this comment

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

Thanks. I'll check into it and fix the issues. There's probably some logical error I'm missing. I'll get back to you with the fixed issue.
Thank you for the advice

@ZPyrolink
Copy link
Contributor

I think create a new TypeAlias inmatplotlib.typing can be a good idea. With this, we have theLiteral in a single file, and we can use it everywhere is required (matplotlib andpyplot here)

timhoffm and nrnavaneet reacted with thumbs up emoji

Copy link
ContributorAuthor

@nrnavaneetnrnavaneet left a comment

Choose a reason for hiding this comment

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

Thank you for the changes

@nrnavaneet
Copy link
ContributorAuthor

Can u pls help me out with the AppVeyor error?

@QuLogic
Copy link
Member

It's probably not important; just fix the other mentioned issues.

timhoffm reacted with thumbs up emoji

Copy link
ContributorAuthor

@nrnavaneetnrnavaneet left a comment

Choose a reason for hiding this comment

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

Alright

@nrnavaneet
Copy link
ContributorAuthor

nrnavaneet commentedJul 12, 2025
edited
Loading

Hi all 👋,

I’ve decided to move the changes from this PR to a new one:#30302.

As I’m still learning and figuring out best practices, I thought it would be cleaner and easier to manage the fixes in a fresh PR. This way, I can better focus on each part of the original issue (#30257) step by step and avoid confusion from partial commits and merge conflicts.

Thanks so much for your patience and support . I truly appreciate the guidance as I contribute and learn more about the codebase! 🙏

@nrnavaneetnrnavaneet deleted the fix/use-literal-typing branchJuly 12, 2025 23:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak left review comments

@timhoffmtimhoffmtimhoffm left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[MNT] [TYPING]: Use of Literal
5 participants
@nrnavaneet@timhoffm@ZPyrolink@QuLogic@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp