<commit_before>'''
Provide a series Element Expected Condition Functors

@date 2015-08-03
@author <NAME> <<EMAIL>>
'''

# Import all expected conditions from selenium 
from selenium.webdriver.support.expected_conditions import *
import re

class eecf_stale_of(object):
    def __init__(self, check_status):
        self.__check_status = check_status
    
    def __call__(self, element):
        try:
            # Calling any method forces a staleness check
            element.is_enabled()
            return self.__check_status 
        except StaleElementReferenceException:
            return not self.__check_status 
        
class eecf_stale(eecf_stale_of):
    def __init__(self):
        super().__init__(True)
        
class eecf_fresh(eecf_stale_of):
    def __init__(self):
        super().__init__(False)
                    
class eecf_visible_of(object):
    def __init__(self, check_status):
        self.__check_status = check_status
    
    def __call__(self, element):    
        try:
            return element.is_displayed() == self.__check_status
        except (NoSuchElementException, StaleElementReferenceException):
            # In the case of NoSuchElement, returns true because the element is
            # not present in DOM. The try block checks if the element is present
            # but is invisible.
            # In the case of StaleElementReference, returns true because stale
            # element reference implies that element is no longer visible.
            return not self.__check_status 
        
class eecf_visible(eecf_visible_of):
    def __init__(self):
        super().__init__(True)
        
class eecf_invisible(eecf_visible_of):
    def __init__(self):
        super().__init__(False)
    
class eecf_select_of(object):
    def __init__(self, check_status):
        self.__check_status = check_status<commit_msg>Added eecf_existed() functor<commit_after>'''
Provide a series Element Expected Condition Functors

@date 2015-08-03
@author <NAME> <<EMAIL>>
'''

# Import all expected conditions from selenium 
from selenium.webdriver.support.expected_conditions import *
import re

class eecf_stale_of(object):
    def __init__(self, check_status):
        self.__check_status = check_status
    
    def __call__(self, element):
        try:
            # Calling any method forces a staleness check
            element.is_enabled()
            return self.__check_status 
        except StaleElementReferenceException:
            return not self.__check_status 
        
class eecf_stale(eecf_stale_of):
    def __init__(self):
        super().__init__(True)
        
class eecf_fresh(eecf_stale_of):
    def __init__(self):
        super().__init__(False)
                    
class eecf_visible_of(object):
    def __init__(self, check_status):
        self.__check_status = check_status
    
    def __call__(self, element):    
        try:
            return element.is_displayed() == self.__check_status
        except (NoSuchElementException, StaleElementReferenceException):
            # In the case of NoSuchElement, returns true because the element is
            # not present in DOM. The try block checks if the element is present
            # but is invisible.
            # In the case of StaleElementReference, returns true because stale
            # element reference implies that element is no longer visible.
            return not self.__check_status 
        
class eecf_visible(eecf_visible_of):
    def __init__(self):
        super().__init__(True)
        
class eecf_invisible(eecf_visible_of):
    def __init__(self):
        super().__init__(False)

class eecf_existed(object):
    """
    This condition only use to check if element existed, don't care if 
    it visible or not.
    """
    
    def __init__(self):
        pass
    
    def __call__(self, element):
        return element is not None
    
class eecf_select_of(object):
    def __init__(self, check_status):
        self.__check_status = check_status
{'fraction_non_alphanumeric': 0.07167832167832168, 'fraction_numerical': 0.003996003996003996, 'mean_word_length': 2.591928251121076, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '516530', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1105, 'n_words': 314}