<commit_before>from . import atspi_functions
from .atspi_functions import AtspiRect, AtspiCoordType
from .element_info import ElementInfo


class AtspiElementInfo(ElementInfo):

    """Wrapper for window handler"""

    def __init__(self, handle=None):
        """Create element by handle (default is root element)"""
        if handle is None:
            self._handle = atspi_functions.get_desktop(0, None)
        else:
            self._handle = handle

    @property
    def handle(self):
        """Return the handle of the window"""
        return self._handle

    @property
    def name(self):
        """Return the text of the window"""
        return atspi_functions.get_name(self._handle, None)

    @property
    def control_id(self):
        """Return the ID of the window"""
        return atspi_functions.get_id(self._handle, None)

    @property
    def process_id(self):
        """Return the ID of process that controls this window"""
        return atspi_functions.get_process_id(self._handle, None)

    @property
    def class_name(self):
        """Return the class name of the element"""
        return atspi_functions.get_role_name(self._handle, None)

    @property
    def parent(self):
        """Return the parent of the element"""
        return atspi_functions.get_parent(self._handle, None)

    def children(self, **kwargs):
        """Return children of the element"""
        len = atspi_functions.get_child_count(self._handle, None)
        childrens = []
        for i in range(len):
            childrens.append(atspi_functions.get_child_at_index(self._handle, i, None))
        return [AtspiElementInfo(ch) for ch in childrens]

    def descendants(self, **kwargs):
        """Return descendants of the element"""
        raise NotImplementedError()

    @property
    def rectangle(self):
        """Return rectangle of element"""
        component = atspi_functions.get_component(self._handle)
        prect = atspi_functions.get_rectangle(component, AtspiCoordType.ATSPI_COORD_TYPE_SCREEN, None)
        return prect.contents
<commit_msg>Convert returning bytes string to string<commit_after>from . import atspi_functions
from .atspi_functions import AtspiRect, AtspiCoordType
from .element_info import ElementInfo


class AtspiElementInfo(ElementInfo):

    """Wrapper for window handler"""

    def __init__(self, handle=None):
        """Create element by handle (default is root element)"""
        if handle is None:
            self._handle = atspi_functions.get_desktop(0, None)
        else:
            self._handle = handle

    @property
    def handle(self):
        """Return the handle of the window"""
        return self._handle

    @property
    def name(self):
        """Return the text of the window"""
        return atspi_functions.get_name(self._handle, None).decode(encoding='UTF-8')

    @property
    def control_id(self):
        """Return the ID of the window"""
        return atspi_functions.get_id(self._handle, None)

    @property
    def process_id(self):
        """Return the ID of process that controls this window"""
        return atspi_functions.get_process_id(self._handle, None)

    @property
    def class_name(self):
        """Return the class name of the element"""
        return atspi_functions.get_role_name(self._handle, None).decode(encoding='UTF-8')

    @property
    def parent(self):
        """Return the parent of the element"""
        return AtspiElementInfo(atspi_functions.get_parent(self._handle, None))

    def children(self, **kwargs):
        """Return children of the element"""
        len = atspi_functions.get_child_count(self._handle, None)
        childrens = []
        for i in range(len):
            childrens.append(atspi_functions.get_child_at_index(self._handle, i, None))
        return [AtspiElementInfo(ch) for ch in childrens]

    def descendants(self, **kwargs):
        """Return descendants of the element"""
        raise NotImplementedError()

    @property
    def rectangle(self):
        """Return rectangle of element"""
        component = atspi_functions.get_component(self._handle)
        prect = atspi_functions.get_rectangle(component, AtspiCoordType.ATSPI_COORD_TYPE_SCREEN, None)
        return prect.contents

{'fraction_non_alphanumeric': 0.0972972972972973, 'fraction_numerical': 0.0009400705052878966, 'mean_word_length': 2.99249530956848, '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': '644931', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1156, 'n_words': 333}