Add type hints for IntegrationManager.

Review Request #12994 — Created April 27, 2023 and submitted

chipx86
Djblets
release-3.x
djblets

This adds type hints for IntegrationManager, helping ensure that code
interacting with an IntegrationManager passes around the right types.
These type hints also cover instance variables, letting IDEs and type
checkers show details on these attributes.

Unit tests, mypy, and pyright pass.

Summary
Add type hints for IntegrationManager.
Description From Last Updated

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

reviewbotreviewbot

The only thing we're using from weakref is WeakValueDictionary. Can we do a from weakref import WeakValueDictionary to make this …

daviddavid

Can we make an alias for Type[Integration]? We use it a lot.

daviddavid

undefined name 'Integration' Column: 39 Error code: F821

reviewbotreviewbot

undefined name 'Integration' Column: 10 Error code: F821

reviewbotreviewbot

undefined name 'Integration' Column: 44 Error code: F821

reviewbotreviewbot

undefined name 'Integration' Column: 10 Error code: F821

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. 
      
  2. djblets/integrations/manager.py (Diff revision 2)
     
     
     

    The only thing we're using from weakref is WeakValueDictionary. Can we do a from weakref import WeakValueDictionary to make this somewhat less wordy?

  3. djblets/integrations/manager.py (Diff revision 2)
     
     

    Can we make an alias for Type[Integration]? We use it a lot.

  4. 
      
chipx86
Review request changed

Change Summary:

  • Simplified an import around weakref.
  • Added an IntegrationClassType type alias.

Commits:

Summary
-
Add type hints for IntegrationManager.
+
Add type hints for IntegrationManager.

Diff:

Revision 3 (+294 -148)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (623658e)
Loading...