<commit_before># coding=utf-8
"""
"""
from __future__ import absolute_import

from flask import current_app
from flask_debugtoolbar.panels import DebugPanel

from abilian.i18n import _
from abilian.core.models.subjects import User, Group
from abilian.web.action import actions

from .models import Anonymous

class SecurityInfoDebugPanel(DebugPanel):
  """
  A panel to display current roles and permissions for "current" object.
  """
  name = 'SecurityInfo'

  @property
  def current_obj(self):
    return actions.context.get('object')

  @property
  def has_content(self):
    obj = self.current_obj
    return (obj is not None
            and hasattr(obj, 'object_type')
            and hasattr(obj, 'id')
            and obj.id is not None)

  def nav_title(self):
    return _('Security Info')

  def nav_subtitle(self):
    """Subtitle showing until title in toolbar"""
    obj = self.current_obj
    if not obj:<commit_msg>don't show content if obj is not an Entity<commit_after># coding=utf-8
"""
"""
from __future__ import absolute_import

from flask import current_app
from flask_debugtoolbar.panels import DebugPanel

from abilian.i18n import _
from abilian.core.entities import Entity
from abilian.core.models.subjects import Group
from abilian.web.action import actions

from .models import Anonymous

class SecurityInfoDebugPanel(DebugPanel):
  """
  A panel to display current roles and permissions for "current" object.
  """
  name = 'SecurityInfo'

  @property
  def current_obj(self):
    return actions.context.get('object')

  @property
  def has_content(self):
    obj = self.current_obj
    return (obj is not None
            and isinstance(obj, Entity)
            and obj.id is not None)

  def nav_title(self):
    return _('Security Info')

  def nav_subtitle(self):
    """Subtitle showing until title in toolbar"""
    obj = self.current_obj
    if not obj:
{'fraction_non_alphanumeric': 0.08628904182106935, 'fraction_numerical': 0.0031762837480148226, 'mean_word_length': 3.6666666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2967264', 'n_tokens_mistral': 573, 'n_tokens_neox': 547, 'n_words': 185}