<commit_before>import platform
import pytest

from dash.testing.browser import Browser
from preconditions import preconditions
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

_validate_col = lambda col: (isinstance(col, str) and len(col) > 0) or (
    isinstance(col, int) and col >= 0
)
_validate_id = lambda id: isinstance(id, str) and len(id) > 0
_validate_key = lambda key: isinstance(key, str) and len(key) == 1
_validate_keys = lambda keys: isinstance(keys, str) and len(keys) > 0
_validate_mixin = lambda mixin: isinstance(mixin, DataTableMixin)
_validate_row = lambda row: isinstance(row, int) and row >= 0
_validate_selector = lambda selector: isinstance(selector, str) and len(selector) > 0
_validate_state = lambda state: state in [_READY, _LOADING, _ANY]
_validate_target = lambda target: isinstance(target, DataTableFacade)

_READY = ".dash-spreadsheet:not(.dash-loading)"
_LOADING = ".dash-spreadsheet.dash-loading"
_ANY = ".dash-spreadsheet"
_TIMEOUT = 10

CMD = Keys.COMMAND if platform.system() == "Darwin" else Keys.CONTROL 

class HoldKeyContext:
    @preconditions(_validate_mixin, _validate_key)
    def __init__(self, mixin, key):
        self.mixin = mixin
        self.key = key

    def __enter__(self):
        ActionChains(self.mixin.driver).key_down(self.key).perform()

    def __exit__(self, type, value, traceback):
        ActionChains(self.mixin.driver).key_up(self.key).perform()


class DataTableCellFacade(object):
    @preconditions(
        _validate_id, _validate_mixin, _validate_row, _validate_col, _validate_state
    )
    def __init__(self, id, mixin, row, col, state=_ANY):
        self.id = id
        self.mixin = mixin
        self.row = row
        self.col = col
        self.state = state

    def _get_cell_value(self):
        return self.get().find_element(By.CSS_SELECTOR, ".dash-cell-value")

    def click(self):
        return self.get().click()<commit_msg>Lint fix<commit_after>import platform
import pytest

from dash.testing.browser import Browser
from preconditions import preconditions
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

_validate_col = lambda col: (isinstance(col, str) and len(col) > 0) or (
    isinstance(col, int) and col >= 0
)
_validate_id = lambda id: isinstance(id, str) and len(id) > 0
_validate_key = lambda key: isinstance(key, str) and len(key) == 1
_validate_keys = lambda keys: isinstance(keys, str) and len(keys) > 0
_validate_mixin = lambda mixin: isinstance(mixin, DataTableMixin)
_validate_row = lambda row: isinstance(row, int) and row >= 0
_validate_selector = lambda selector: isinstance(selector, str) and len(selector) > 0
_validate_state = lambda state: state in [_READY, _LOADING, _ANY]
_validate_target = lambda target: isinstance(target, DataTableFacade)

_READY = ".dash-spreadsheet:not(.dash-loading)"
_LOADING = ".dash-spreadsheet.dash-loading"
_ANY = ".dash-spreadsheet"
_TIMEOUT = 10

CMD = Keys.COMMAND if platform.system() == "Darwin" else Keys.CONTROL


class HoldKeyContext:
    @preconditions(_validate_mixin, _validate_key)
    def __init__(self, mixin, key):
        self.mixin = mixin
        self.key = key

    def __enter__(self):
        ActionChains(self.mixin.driver).key_down(self.key).perform()

    def __exit__(self, type, value, traceback):
        ActionChains(self.mixin.driver).key_up(self.key).perform()


class DataTableCellFacade(object):
    @preconditions(
        _validate_id, _validate_mixin, _validate_row, _validate_col, _validate_state
    )
    def __init__(self, id, mixin, row, col, state=_ANY):
        self.id = id
        self.mixin = mixin
        self.row = row
        self.col = col
        self.state = state

    def _get_cell_value(self):
        return self.get().find_element(By.CSS_SELECTOR, ".dash-cell-value")

    def click(self):
        return self.get().click()
{'fraction_non_alphanumeric': 0.10440456769983687, 'fraction_numerical': 0.004194826380797017, 'mean_word_length': 4.234146341463415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '971310', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1326, 'n_words': 352}