<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

import curses

from .page import Page, PageController
from .content import SubscriptionContent
from .objects import Color, Navigator
from .terminal import Terminal


class SubscriptionController(PageController):
    character_map = {}


class SubscriptionPage(Page):

    def __init__(self, reddit, term, config, oauth):
        super(SubscriptionPage, self).__init__(reddit, term, config, oauth)

        self.content = SubscriptionContent.from_user(reddit, term.loader)
        self.controller = SubscriptionController(self)
        self.nav = Navigator(self.content.get)
        self.subreddit_data = None

    @SubscriptionController.register(curses.KEY_F5, 'r')
    def refresh_content(self, order=None, name=None):
        "Re-download all subscriptions and reset the page index"

        # reddit.get_my_subreddits() does not support sorting by order
        if order:
            self.term.flash()
            return

        self.content = SubscriptionContent.from_user(self.reddit,
                                                     self.term.loader)
        self.nav = Navigator(self.content.get)

    @SubscriptionController.register(curses.KEY_ENTER, Terminal.RETURN,
                                     curses.KEY_RIGHT, 'l')
    def select_subreddit(self):
        "Store the selected subreddit and return to the subreddit page"

        self.subreddit_data = self.content.get(self.nav.absolute_index)
        self.active = False

    @SubscriptionController.register(curses.KEY_LEFT, Terminal.ESCAPE, 'h', 's')
    def close_subscriptions(self):
        "Close subscriptions and return to the subreddit page"

        self.active = False

    def _draw_item(self, win, data, inverted):
        n_rows, n_cols = win.getmaxyx()<commit_msg>Added loader to subscription refresh.<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

import curses

from .page import Page, PageController
from .content import SubscriptionContent
from .objects import Color, Navigator
from .terminal import Terminal


class SubscriptionController(PageController):
    character_map = {}


class SubscriptionPage(Page):

    def __init__(self, reddit, term, config, oauth):
        super(SubscriptionPage, self).__init__(reddit, term, config, oauth)

        self.content = SubscriptionContent.from_user(reddit, term.loader)
        self.controller = SubscriptionController(self)
        self.nav = Navigator(self.content.get)
        self.subreddit_data = None

    @SubscriptionController.register(curses.KEY_F5, 'r')
    def refresh_content(self, order=None, name=None):
        "Re-download all subscriptions and reset the page index"

        # reddit.get_my_subreddits() does not support sorting by order
        if order:
            self.term.flash()
            return

        with self.term.loader():
            self.content = SubscriptionContent.from_user(self.reddit,
                                                         self.term.loader)
        if not self.term.loader.exception:
            self.nav = Navigator(self.content.get)

    @SubscriptionController.register(curses.KEY_ENTER, Terminal.RETURN,
                                     curses.KEY_RIGHT, 'l')
    def select_subreddit(self):
        "Store the selected subreddit and return to the subreddit page"

        self.subreddit_data = self.content.get(self.nav.absolute_index)
        self.active = False

    @SubscriptionController.register(curses.KEY_LEFT, Terminal.ESCAPE, 'h', 's')
    def close_subscriptions(self):
        "Close subscriptions and return to the subreddit page"

        self.active = False

    def _draw_item(self, win, data, inverted):
        n_rows, n_cols = win.getmaxyx()
{'fraction_non_alphanumeric': 0.08826638477801269, 'fraction_numerical': 0.0010570824524312897, 'mean_word_length': 2.762425447316103, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3175613', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1035, 'n_words': 260}