<commit_before>'''
@date 2015-02-21
@author <NAME> <<EMAIL>>
'''

import time

class Window(object):
    def __init__(self):
        pass
    
    @property
    def title(self):
        '''
        Get the window's title.
        '''
        raise NotImplemented()
    
    @property
    def class_name(self):
        '''
        Get the window's class name.
        '''
        raise NotImplemented()
    
    @property
    def geometry(self):
        '''
        Get the window geometry.
        
        @return (x, y, width, height, additional informations...)
        '''
        raise NotImplemented()
    
    def raise_(self):
        '''
        Raise the window to top most .
        '''
        raise NotImplemented()
    
    def activate(self):
        '''
        Activate the window
        '''
        raise NotImplemented()
    
    def close(self):
        '''
        Close the window
        '''
        raise NotImplemented()
    
class Manager(object):
    def __init__(self):
        self.__options = dict()
        
    def get_active(self):
        raise NotImplemented()
    
    def get_from_position(self, position):
        raise NotImplemented()
    
    def set_option(self, option_name, option_value):
        if option_name not in self.__options:
            raise KeyError()
            
        self.__options[option_name] = option_value        
        
    def get_option(self, option_name):
        if option_name not in self.__options:
            raise KeyError()
            
        return self.__options[option_name]
    
    def _prepare_find_arguments(self, kwargs):
        if "limit" not in kwargs:
            kwargs["limit"] = 1
            
        if "parent" not in kwargs:
            kwargs["parent"] = None
    
    def find(self, **kwargs):
        raise NotImplemented()
    
    def exists(self, **kwargs):
        return len(self.find(**kwargs)) > 0
    
    def wait(self, timeout=-1.0, **kwargs):
        sleep_interval = 0.1 # 100ms wake up a time. 
        counter = 0.0    
        handles = []
        while True:
            handles = self.find(**kwargs)
            if (len(handles) <= 0) and (timeout > 0.0) and (counter > timeout):
                time.sleep(sleep_interval)
                counter += sleep_interval
            else:
                break
            
        return handles    
    
    <commit_msg>Fixed wait() will not wait infinite by default<commit_after>'''
@date 2015-02-21
@author <NAME> <<EMAIL>>
'''

import time

class Window(object):
    def __init__(self):
        pass
    
    @property
    def title(self):
        '''
        Get the window's title.
        '''
        raise NotImplemented()
    
    @property
    def class_name(self):
        '''
        Get the window's class name.
        '''
        raise NotImplemented()
    
    @property
    def geometry(self):
        '''
        Get the window geometry.
        
        @return (x, y, width, height, additional informations...)
        '''
        raise NotImplemented()
    
    def raise_(self):
        '''
        Raise the window to top most .
        '''
        raise NotImplemented()
    
    def activate(self):
        '''
        Activate the window
        '''
        raise NotImplemented()
    
    def close(self):
        '''
        Close the window
        '''
        raise NotImplemented()
    
class Manager(object):
    def __init__(self):
        self.__options = dict()
        
    def get_active(self):
        raise NotImplemented()
    
    def get_from_position(self, position):
        raise NotImplemented()
    
    def set_option(self, option_name, option_value):
        if option_name not in self.__options:
            raise KeyError()
            
        self.__options[option_name] = option_value        
        
    def get_option(self, option_name):
        if option_name not in self.__options:
            raise KeyError()
            
        return self.__options[option_name]
    
    def _prepare_find_arguments(self, kwargs):
        if "limit" not in kwargs:
            kwargs["limit"] = 1
            
        if "parent" not in kwargs:
            kwargs["parent"] = None
    
    def find(self, **kwargs):
        raise NotImplemented()
    
    def exists(self, **kwargs):
        return len(self.find(**kwargs)) > 0
    
    def wait(self, timeout=-1.0, **kwargs):
        sleep_interval = 0.1  # 100ms wake up a time. 
        counter = 0.0    
        handles = []
        while True:
            handles = self.find(**kwargs)
            
            if len(handles) <= 0:
                if timeout <= 0.0:
                    # Infinite loop to wait for the window 
                    continue
                
                if counter > timeout:
                    break
                                    
                time.sleep(sleep_interval)
                counter += sleep_interval
            else:
                break
            
        return handles   
    
{'fraction_non_alphanumeric': 0.09698662941528637, 'fraction_numerical': 0.008780682498503292, 'mean_word_length': 1.436558094312105, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7298621', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1336, 'n_words': 364}