<commit_before>import json

import tornado.web

from base import BaseHandler
from logic import users
from models import db

class DashboardHandler(BaseHandler):
  def get(self):
    if not self.authenticate(author=True):
      return

    # redirect users that come here via /admin to proper /dashboard link
    if self.breadcrumbs["name"] == 'admin':
      self.redirect(self.nav_url(section='dashboard'), permanent=True)
      return

    self.display["user"] = user = self.get_author_user()
    self.display["is_dashboard"] = True

    if self.get_argument('get_counts', None):
      self.get_latest_counts(user)
      result = { 'total_count' : self.display['total_count'],
                 'favorites_count' : self.display['favorites_count'],
                 'comments_count' : self.display['comments_count'],
                 'spam_count' : self.display['spam_count'] }
      for profile in self.display['following']:
        result[profile.profile_url] = profile.unread_entries
      self.prevent_caching()
      self.write(json.dumps(result))
      return

    self.display["own_feed"] = int(self.get_argument('own_feed', 0))
    self.display["local_entry"] = self.get_argument('local_entry', None)
    self.display["remote_entry"] = self.get_argument('remote_entry', None)
    self.display["sort_type"] = self.get_argument('sort_type', None)
    self.display["sort_type"] = 'oldest' if self.display["sort_type"] == 'oldest' else ''
    if self.get_argument('list_mode', None) != None:
      self.display["list_mode"] = int(self.get_argument('list_mode', 0))
    else:<commit_msg>add 3rd party count to update count<commit_after>import json

import tornado.web

from base import BaseHandler
from logic import users
from models import db

class DashboardHandler(BaseHandler):
  def get(self):
    if not self.authenticate(author=True):
      return

    # redirect users that come here via /admin to proper /dashboard link
    if self.breadcrumbs["name"] == 'admin':
      self.redirect(self.nav_url(section='dashboard'), permanent=True)
      return

    self.display["user"] = user = self.get_author_user()
    self.display["is_dashboard"] = True

    if self.get_argument('get_counts', None):
      self.get_latest_counts(user)
      result = { 'total_count' : self.display['total_count'],
                 'favorites_count' : self.display['favorites_count'],
                 'comments_count' : self.display['comments_count'],
                 'spam_count' : self.display['spam_count'],
                 'twitter_count' : self.display['twitter_count'],
                 'facebook_count' : self.display['facebook_count'],
                 'google_count' : self.display['google_count'], }
      for profile in self.display['following']:
        result[profile.profile_url] = profile.unread_entries
      self.prevent_caching()
      self.write(json.dumps(result))
      return

    self.display["own_feed"] = int(self.get_argument('own_feed', 0))
    self.display["local_entry"] = self.get_argument('local_entry', None)
    self.display["remote_entry"] = self.get_argument('remote_entry', None)
    self.display["sort_type"] = self.get_argument('sort_type', None)
    self.display["sort_type"] = 'oldest' if self.display["sort_type"] == 'oldest' else ''
    if self.get_argument('list_mode', None) != None:
      self.display["list_mode"] = int(self.get_argument('list_mode', 0))
    else:
{'fraction_non_alphanumeric': 0.13533392174168873, 'fraction_numerical': 0.0014710208884966167, 'mean_word_length': 3.6575342465753424, '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': '2938670', 'n_tokens_mistral': 1035, 'n_tokens_neox': 1024, 'n_words': 199}