<commit_before>#
# This file is part of python-cli. python-cli is free software that is
# made available under the MIT license. Consult the file "LICENSE" that
# is distributed together with this file for the exact licensing terms.
#
# python-cli is copyright (c) 2011 by the python-cli authors. See the
# file "AUTHORS" for a complete overview.

import os
import fcntl
import termios
import curses

from cli.terminal import Terminal


class PosixTerminal(Terminal):
    """A terminal for Posix style systems."""

    def __init__(self, *args):
        super(PosixTerminal, self).__init__(*args)
        self._tty = os.open('/dev/tty', os.O_RDWR)
        curses.setupterm()

    def _get_width(self):
        packed = fcntl.ioctl(self._tty, termios.TIOCGWINSZ, 'xxxx')
        width = struct.unpack('@HH', packed)[1]
        return width

    width = property(_get_width)

    def _get_height(self):
        packed = fcntl.ioctl(self._tty, termios.TIOCGWINSZ, 'xxxx')<commit_msg>Add missing import<commit_after>#
# This file is part of python-cli. python-cli is free software that is
# made available under the MIT license. Consult the file "LICENSE" that
# is distributed together with this file for the exact licensing terms.
#
# python-cli is copyright (c) 2011 by the python-cli authors. See the
# file "AUTHORS" for a complete overview.

import os
import fcntl
import termios
import struct
import curses

from cli.terminal import Terminal


class PosixTerminal(Terminal):
    """A terminal for Posix style systems."""

    def __init__(self, *args):
        super(PosixTerminal, self).__init__(*args)
        self._tty = os.open('/dev/tty', os.O_RDWR)
        curses.setupterm()

    def _get_width(self):
        packed = fcntl.ioctl(self._tty, termios.TIOCGWINSZ, 'xxxx')
        width = struct.unpack('@HH', packed)[1]
        return width

    width = property(_get_width)

    def _get_height(self):
        packed = fcntl.ioctl(self._tty, termios.TIOCGWINSZ, 'xxxx')
{'fraction_non_alphanumeric': 0.10217501264542236, 'fraction_numerical': 0.005058168942842691, 'mean_word_length': 3.4650112866817158, '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': '1667416', 'n_tokens_mistral': 636, 'n_tokens_neox': 603, 'n_words': 203}