Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 291B

12345678910111213
  1. def identity(obj):
  2. return obj
  3. class cached_property(object):
  4. def __init__(self, func):
  5. self.func = func
  6. def __get__(self, obj, cls):
  7. if obj is None:
  8. return self
  9. value = obj.__dict__[self.func.__name__] = self.func(obj)
  10. return value