<commit_before># -*- coding: utf-8 -*-

from handlers.handlerbase import HandlerBase
from db import db_session, Session


class LogoutHandler(HandlerBase):
    def handle(self, packet_msg):
        # Remove session
        s = db_session()
        s.query(Session).filter_by(key=self.sock.sid).delete()
        s.commit()
        s.close()

        # Dump out log
        self.log.info("Logged out.")
        self.log.set_sid(None)

        # Deauthenticate & clear session ID
        self.sock.authenticated = False
        self.sock.sid = None<commit_msg>Clear all session data from websocket obj<commit_after># -*- coding: utf-8 -*-

from handlers.handlerbase import HandlerBase
from db import db_session, Session


class LogoutHandler(HandlerBase):
    def handle(self, packet_msg):
        # Remove session
        s = db_session()
        s.query(Session).filter_by(key=self.sock.sid).delete()
        s.commit()
        s.close()

        # Dump out log
        self.log.info("Logged out.")
        self.log.set_sid(None)

        # Deauthenticate & clear session ID
        self.sock.authenticated = False
        self.sock.sid = None
        self.sock.uid = None
        self.sock.level = 0
{'fraction_non_alphanumeric': 0.11009174311926606, 'fraction_numerical': 0.0025020850708924102, 'mean_word_length': 2.3057851239669422, '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': '3006231', 'n_tokens_mistral': 367, 'n_tokens_neox': 351, 'n_words': 85}