<commit_before>import zookeeper
import threading
import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
zookeeper.set_debug_level(zookeeper.LOG_LEVEL_WARN)



# Mapping of connection state values to human strings.
STATE_NAME_MAPPING = {
    zookeeper.ASSOCIATING_STATE: "associating",
    zookeeper.AUTH_FAILED_STATE: "auth-failed",
    zookeeper.CONNECTED_STATE: "connected",
    zookeeper.CONNECTING_STATE: "connecting",
    zookeeper.EXPIRED_SESSION_STATE: "expired",
}

# Mapping of event type to human string.
TYPE_NAME_MAPPING = {
    zookeeper.NOTWATCHING_EVENT: "not-watching",
    zookeeper.SESSION_EVENT: "session",
    zookeeper.CREATED_EVENT: "created",
    zookeeper.DELETED_EVENT: "deleted",
    zookeeper.CHANGED_EVENT: "changed",
    zookeeper.CHILD_EVENT: "child",
}
class TimeoutException( zookeeper.ZooKeeperException):
    pass

def logevent(h,typ, state, path):
    logger.debug("event,handle:%d, type:%s, state:%s, path:%s", h, TYPE_NAME_MAPPING.get(typ, "unknown"), STATE_NAME_MAPPING.get(state, "unknown"), path)

class ZKClient:
    def __init__(self, servers, timeout= 10):
        self.timeout = timeout
        self.connected = False
        self.handle = -1
        self.servers = servers
        self.timeout= timeout
        self.watchers  = set()
        self._lock = threading.Lock()
        self.conn_cv = threading.Condition( )


    def start(self):
        self.handle = zookeeper.init(self.servers, self.connection_watcher, self.timeout * 1000)
        self.conn_cv.acquire()
        self.conn_cv.wait(self.timeout)
        self.conn_cv.release()
        if not self.connected:
            raise TimeoutException



    def stop(self):<commit_msg>remove useless code and blank<commit_after>import zookeeper
import threading
import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
zookeeper.set_debug_level(zookeeper.LOG_LEVEL_WARN)



# Mapping of connection state values to human strings.
STATE_NAME_MAPPING = {
    zookeeper.ASSOCIATING_STATE: "associating",
    zookeeper.AUTH_FAILED_STATE: "auth-failed",
    zookeeper.CONNECTED_STATE: "connected",
    zookeeper.CONNECTING_STATE: "connecting",
    zookeeper.EXPIRED_SESSION_STATE: "expired",
}

# Mapping of event type to human string.
TYPE_NAME_MAPPING = {
    zookeeper.NOTWATCHING_EVENT: "not-watching",
    zookeeper.SESSION_EVENT: "session",
    zookeeper.CREATED_EVENT: "created",
    zookeeper.DELETED_EVENT: "deleted",
    zookeeper.CHANGED_EVENT: "changed",
    zookeeper.CHILD_EVENT: "child",
}
class TimeoutException( zookeeper.ZooKeeperException):
    pass

def logevent(h,typ, state, path):
    logger.debug("event,handle:%d, type:%s, state:%s, path:%s", h, TYPE_NAME_MAPPING.get(typ, "unknown"), STATE_NAME_MAPPING.get(state, "unknown"), path)

class ZKClient:
    def __init__(self, servers, timeout= 10):
        self.timeout = timeout
        self.connected = False
        self.handle = -1
        self.servers = servers
        self.watchers  = set()
        self._lock = threading.Lock()
        self.conn_cv = threading.Condition()

    def start(self):
        self.handle = zookeeper.init(self.servers, self.connection_watcher, self.timeout * 1000)
        self.conn_cv.acquire()
        self.conn_cv.wait(self.timeout)
        self.conn_cv.release()
        if not self.connected:
            raise TimeoutException

    def stop(self):
{'fraction_non_alphanumeric': 0.11013473930872876, 'fraction_numerical': 0.004100761570005858, 'mean_word_length': 3.729916897506925, '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': '1327594', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1110, 'n_words': 215}