Modernize djblets/auth.

Review Request #13968 — Created June 10, 2024 and submitted

Information

Djblets
release-5.x

Reviewers

This change makes several modernizations for the auth app:

  • Add `from future import annotations' to everything.
  • Add type hints.
  • Fix up a few small type issues that were exposed by type hints.
  • Add in missing docstrings.

Ran unit tests.

Summary ID
Modernize djblets/auth.
This change makes several modernizations for the auth app: - Add `from __future__ import annotations' to everything. - Add type hints. - Fix up a few small type issues that were exposed by type hints. - Add in missing docstrings. Testing Done: Ran unit tests.
75ed6eb905e2b8cd0b0f885b0abc537c91a8fb5f
Description From Last Updated

Can you add a Raises section in the docs while here.

maubinmaubin

Same here.

maubinmaubin

The parameter to check_password needs to be indented one level. Though, I wonder if we should avoid the cast and …

chipx86chipx86

Missing the full class path.

chipx86chipx86

'typing.cast' imported but unused Column: 1 Error code: F401

reviewbotreviewbot
david
maubin
  1. 
      
  2. djblets/auth/ratelimit.py (Diff revision 2)
     
     
    Show all issues

    Can you add a Raises section in the docs while here.

  3. djblets/auth/ratelimit.py (Diff revision 2)
     
     
    Show all issues

    Same here.

  4. 
      
david
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. djblets/auth/util.py (Diff revision 3)
     
     
     
    Show all issues

    The parameter to check_password needs to be indented one level.

    Though, I wonder if we should avoid the cast and instead first check for the errors and do something like:

    if not form.errors.get(field_name):
        password = form.data.get(field_name)
    
        if (not isinstance(password, str) or
            not user.check_password(password)):
            ...
    
  3. djblets/auth/views.py (Diff revision 3)
     
     
    Show all issues

    Missing the full class path.

  4. 
      
david
Review request changed
Commits:
Summary ID
Modernize djblets/auth.
This change makes several modernizations for the auth app: - Add `from __future__ import annotations' to everything. - Add type hints. - Fix up a few small type issues that were exposed by type hints. - Add in missing docstrings. Testing Done: Ran unit tests.
b9ea0aa76462b625872027672df0d8a5acf6aec8
Modernize djblets/auth.
This change makes several modernizations for the auth app: - Add `from __future__ import annotations' to everything. - Add type hints. - Fix up a few small type issues that were exposed by type hints. - Add in missing docstrings. Testing Done: Ran unit tests.
2604b85a568d8d71c04d59cbe89af2bd8a5a3ac8

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-6.x (fb54ce7)