Add typing for ConcurrencyManager and deprecate it.
Review Request #14044 — Created July 16, 2024 and submitted
This change adds generic parameters for
ConcurrencyManagerso it can be
used where we would expect a Manager.This particular class also hasn't been useful since the very early days
of Django, since the baseManager.get_or_createimplementation now does
exactly what this code does, preventing us from ever hitting the
exception handler. Because of that, I've removed theget_or_create
implementation entirely and marked the class as deprecated.
- Ran unit tests.
| Summary | ID | 
|---|---|
| 6975e7645864bcb3cd0919f2069a68441e38c3df | 
| Description | From | Last Updated | 
|---|---|---|
| "Django" |  | |
| We should reference the function properly for the Django manager method., while we're fixing the docs. Can we also add … |  | |
| With Manager[_T_co], do we need Generic[...]? I think we inherit the generic nature from the former, given the TypeVar. |  | |
| I think we've been moving more to a two-release deprecation cycle for most things. |  | |
| Can we state that it wil be removed in 8.0? |  | 
- Summary:
- 
    Add typing for ConcurrencyManager.Add typing for ConcurrencyManager and deprecate it.
- Description:
- 
    This change adds generic parameters for ConcurrencyManagerso it can be~ used where we would expect a Manager. It also fixes the fallback return ~ for get_or_create()so we're always returning what a caller would expect~ from this method. ~ used where we would expect a Manager. ~ ~ This particular class also hasn't been useful since the very early days + of Django, since the base Manager.get_or_createimplementation now does+ exactly what this code does, preventing us from ever hitting the + exception handler. Because of that, I've removed the get_or_create+ implementation entirely and marked the class as deprecated. 
- Testing Done:
- 
    ~ Used with some other code. ~ - Ran unit tests.
 
- Commits:
- 
    Summary ID c44583233a5b550b78e9305ad110ca3927e0cb65 eb69746a038570ca9f0ad9c1f0e95a87f9e9240f 
- Diff:
- 
    Revision 2 (+54 -44) 
Checks run (2 succeeded)
- Commits:
- 
    Summary ID eb69746a038570ca9f0ad9c1f0e95a87f9e9240f 6975e7645864bcb3cd0919f2069a68441e38c3df 
- Diff:
- 
    Revision 3 (+74 -44) 
 
 