Skip to content

Use staticmethod for PasswordStrength methods#4461

Merged
svartkanin merged 1 commit intoarchlinux:masterfrom
correctmost:cm/use-staticmethod
Apr 22, 2026
Merged

Use staticmethod for PasswordStrength methods#4461
svartkanin merged 1 commit intoarchlinux:masterfrom
correctmost:cm/use-staticmethod

Conversation

@correctmost
Copy link
Copy Markdown
Contributor

PR Description:

The methods don't need access to the class, so they don't need to be classmethods. This change reduces the number of 'bad return' warnings seen when running Pyright, Pyrefly, and ty.

Example warnings fixed:

# Pyright
archinstall/lib/models/users.py:61:13 - error: Type "Literal[PasswordStrength.STRONG]" is not assignable to return type "Self@PasswordStrength"
    Type "Literal[PasswordStrength.STRONG]" is not assignable to type "Self@PasswordStrength" (reportReturnType)

# Pyrefly
archinstall/lib/models/users.py:61:13-23: Returned type `Literal[PasswordStrength.STRONG]` is not assignable to declared return type `Self@PasswordStrength` [bad-return]

# ty
archinstall/lib/models/users.py:61:13: error[invalid-return-type] Return type does not match returned value: expected `Self@_check_password_strength`, found `Literal[PasswordStrength.STRONG]`

Tests and Checks

  • I have tested the code!

The methods don't need access to the class, so they don't need to
be classmethods. This change reduces the number of 'bad return'
warnings seen when running Pyright, Pyrefly, and ty.
@correctmost correctmost requested a review from Torxed as a code owner April 22, 2026 06:41
@svartkanin svartkanin merged commit d176532 into archlinux:master Apr 22, 2026
9 checks passed
@correctmost correctmost deleted the cm/use-staticmethod branch April 22, 2026 11:33
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.

2 participants