<commit_before># vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)

from libqtile.bar import CALCULATED
from libqtile.widget import TextBox

from powerline import Powerline


class QTilePowerline(Powerline):
	def do_setup(self, obj):
		obj.powerline = self


class PowerlineTextBox(TextBox):
	def __init__(self, timeout=2, text=' ', width=CALCULATED, **config):
		super(PowerlineTextBox, self).__init__(text, width, **config)
		self.timeout_add(timeout, self.update)
		powerline = QTilePowerline(ext='wm', renderer_module='pango_markup')
		powerline.setup(self)

	def update(self):
		if not self.configured:
			return True
		self.text = self.powerline.render(side='right')
		self.bar.draw()
		return True

	def cmd_update(self, text):
		self.update(text)

	def cmd_get(self):
		return self.text

	def _configure(self, qtile, bar):
		super(PowerlineTextBox, self)._configure(qtile, bar)
		self.layout = self.drawer.textlayout(
			self.text,
			self.foreground,
			self.font,
			self.fontsize,
			self.fontshadow,
			markup=True)


# TODO: Remove this at next major release
Powerline = PowerlineTextBox<commit_msg>Move the closing parenthesis to the next line<commit_after># vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)

from libqtile.bar import CALCULATED
from libqtile.widget import TextBox

from powerline import Powerline


class QTilePowerline(Powerline):
	def do_setup(self, obj):
		obj.powerline = self


class PowerlineTextBox(TextBox):
	def __init__(self, timeout=2, text=' ', width=CALCULATED, **config):
		super(PowerlineTextBox, self).__init__(text, width, **config)
		self.timeout_add(timeout, self.update)
		powerline = QTilePowerline(ext='wm', renderer_module='pango_markup')
		powerline.setup(self)

	def update(self):
		if not self.configured:
			return True
		self.text = self.powerline.render(side='right')
		self.bar.draw()
		return True

	def cmd_update(self, text):
		self.update(text)

	def cmd_get(self):
		return self.text

	def _configure(self, qtile, bar):
		super(PowerlineTextBox, self)._configure(qtile, bar)
		self.layout = self.drawer.textlayout(
			self.text,
			self.foreground,
			self.font,
			self.fontsize,
			self.fontshadow,
			markup=True,
		)


# TODO: Remove this at next major release
Powerline = PowerlineTextBox
{'fraction_non_alphanumeric': 0.10938809723386421, 'fraction_numerical': 0.0016764459346186086, 'mean_word_length': 5.2323759791122715, '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': '1061213', 'n_tokens_mistral': 869, 'n_tokens_neox': 795, 'n_words': 186}