Add a smarter version of Django's @cached_property decorator.

Review Request #8488 — Created Oct. 25, 2016 and submitted

Information

Djblets
release-0.9.x
f08abb8...

Reviewers

Django's @cached_property decorator is very useful for implementing
properties that call expensive methods, as it takes care of all the
caching. Unfortunately, it doesn't behave like a standard property. It
overwrites the documentation and does not retain the name and
attributes. Introspecting the property (such as for documentation
generation purposes) results in some bad information.

This introduces a smarter version of @cached_property. It's a drop-in
replacement that retains the documentation and attributes, like a normal
decorator would.

Unit tests were added to ensure it works correctly, and existing call
sites were updated to use it.

Unit tests pass.

Built some docs and saw that the doc string from the method wrapped by
@cached_property was showing up instead of the one on
@cached_property itself.

Description From Last Updated

Docstring?

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
        djblets/datagrid/grids.py
        djblets/util/decorators.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
        djblets/datagrid/grids.py
        djblets/util/decorators.py
    
    
  2. 
      
david
  1. 
      
  2. djblets/util/tests.py (Diff revision 1)
     
     
    Show all issues

    Docstring?

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
        djblets/datagrid/grids.py
        djblets/util/decorators.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
        djblets/datagrid/grids.py
        djblets/util/decorators.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.8.x (c290f31)