<commit_before># -*- coding: utf-8 -*-
"""
Display the amount of windows in your i3 scratchpad.

Configuration parameters:
    cache_timeout: How often we refresh this module in seconds (default 5)
    format: string to print when one or more window (default '{counter} ⌫')
    format_none: string to print when no window (default '{counter} ⌫')
    hide_when_none: old setting. use format_none instead (default False)

Format placeholders:
    {counter} number of scratchpad windows

@author shadowprince
@license Eclipse Public License
"""

import i3


def find_scratch(tree):
    if tree["name"] == "__i3_scratch":
        return tree
    else:
        for x in tree["nodes"]:
            result = find_scratch(x)
            if result:
                return result
        return None


class Py3status:
    """
    """
    # available configuration parameters
    cache_timeout = 5
    format = u"{counter} ⌫"
    format_none = u"{counter} ⌫"
    hide_when_none = False

    def __init__(self):
        self.count = -1

    def scratchpad_counter(self):
        count = len(find_scratch(i3.get_tree()).get("floating_nodes", []))

        if self.count != count:
            transformed = True
            self.count = count<commit_msg>scratchpad_counter: add deprecation stuffs<commit_after># -*- coding: utf-8 -*-
"""
Display the amount of windows in your i3 scratchpad.

Configuration parameters:
    cache_timeout: How often we refresh this module in seconds (default 5)
    format: string to print when one or more window (default '{counter} ⌫')
    format_none: string to print when no window (default '{counter} ⌫')
    hide_when_none: old setting. use format_none instead (default False)

Format placeholders:
    {counter} number of scratchpad windows

@author shadowprince
@license Eclipse Public License
"""

import i3


def find_scratch(tree):
    if tree["name"] == "__i3_scratch":
        return tree
    else:
        for x in tree["nodes"]:
            result = find_scratch(x)
            if result:
                return result
        return None


class Py3status:
    """
    """
    # available configuration parameters
    cache_timeout = 5
    format = u"{counter} ⌫"
    format_none = u"{counter} ⌫"
    hide_when_none = False

    class Meta:

        deprecated = {
            'format_fix_unnamed_param': [
                {
                    'param': 'format',
                    'placeholder': 'counter',
                    'msg': '{} should not be used in format use `{counter}`',
                },
            ],
        }

    def __init__(self):
        self.count = -1

    def scratchpad_counter(self):
        count = len(find_scratch(i3.get_tree()).get("floating_nodes", []))

        if self.count != count:
            transformed = True
            self.count = count
{'fraction_non_alphanumeric': 0.10145441645973749, 'fraction_numerical': 0.006385242993969493, 'mean_word_length': 2.3451957295373664, 'pattern_counts': {'":': 2, '<': 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': '6526488', 'n_tokens_mistral': 830, 'n_tokens_neox': 796, 'n_words': 259}