original_docstring: 
          Read an item's relevance
          
docstring: Read an item's relevance
docstring_tokens: Read an item ' s relevance
code: def __read(_class, item, user=None):
          """
          Read an item's relevance
          """
          uid = user.id if user and user.is_authenticated() else None
  
          namespace = CacheHelper.ns('relevance:helpers:__read', item_id=item.id, uid=uid)
          relevance_data = CacheHelper.io.get(namespace)
  
          if relevance_data is None:
              record = Record.objects.filter(item=item)
  
              relevant = record.filter(is_relevant=True)
              irrelevant = record.filter(is_relevant=False)
  
              relevance_data = _class.__base_relevance_data()
  
              relevance_data['count_relevant'] = relevant.count()
              relevance_data['count_irrelevant'] = irrelevant.count()
              relevance_data['has_relevant'] = uid and relevant.filter(user_id=uid).exists()
              relevance_data['has_irrelevant'] = uid and irrelevant.filter(user_id=uid).exists()
  
              CacheHelper.io.set(namespace, relevance_data)
  
          return relevance_data
code_tokens: def __read ( _class , item , user = None ) : uid = user . id if user and user . is_authenticated ( ) else None namespace = CacheHelper . ns ( 'relevance:helpers:__read' , item_id = item . id , uid = uid ) relevance_data = CacheHelper . io . get ( namespace ) if relevance_data is None : record = Record . objects . filter ( item = item ) relevant = record . filter ( is_relevant = True ) irrelevant = record . filter ( is_relevant = False ) relevance_data = _class . __base_relevance_data ( ) relevance_data [ 'count_relevant' ] = relevant . count ( ) relevance_data [ 'count_irrelevant' ] = irrelevant . count ( ) relevance_data [ 'has_relevant' ] = uid and relevant . filter ( user_id = uid ) . exists ( ) relevance_data [ 'has_irrelevant' ] = uid and irrelevant . filter ( user_id = uid ) . exists ( ) CacheHelper . io . set ( namespace , relevance_data ) return relevance_data
short_docstring: Read an item's relevance
short_docstring_tokens: Read an item ' s relevance
comment: """
          Read an item's relevance
          """