<commit_before>import socket
import json
from tkinter import *

root = Tk()


buffer = 1024  # Конфиг
port = 9090
addres = 'localhost'
try:
    sock = socket.socket()  # Соединениe
    sock.connect((addres, port))
    while True:
        sock.send(input('Enter login:').encode())  # Логин
        status = sock.recv(buffer).decode()
        print(status)
        if status == 'OK':
            break

    while True:
        sock.send(input('Enter password:').encode())  # Пароль
        status = sock.recv(buffer).decode()
        print(status)
        if status == 'OK':
            break

    print('Login and password accepted.')
    msgDB = sock.recv(buffer).decode()  # Получение архива сообщений
    msgDB = json.loads(msgDB)
    for m in msgDB:
        print(m)

    while True:
        msg = input()
        sock.send(msg.encode())  # Отправка сообщений
        if msg == 'exit':
            break

    sock.close()
except:
    print('Oops, something went wrong')<commit_msg>Client gui.<commit_after>import socket
import json
from tkinter import *
import tkinter.simpledialog

root = Tk()


def sayTest(event):
    print(inputField.get())
    msg = inputField.get()
    sock.send(msg.encode())
    textb.insert('end', '\n' + inputField.get())
    inputField.delete(0, 'end')
    if msg == 'exit':
        root.destroy()

buffer = 1024  # Конфиг
port = 9090
addres = 'localhost'
try:
    sock = socket.socket()  # Соединениe
    sock.connect((addres, port))
    while True:
        var = tkinter.simpledialog.askstring("Name prompt", "enter your name")
        sock.send(var.encode())  # Логин
        status = sock.recv(buffer).decode()
        print(status)
        if status == 'OK':
            break

    while True:
        var = tkinter.simpledialog.askstring("Name prompt", "enter your pass")
        sock.send(var.encode())  # Пароль
        status = sock.recv(buffer).decode()
        print(status)
        if status == 'OK':
            break


    print('Login and password accepted.')
    msgDB = sock.recv(buffer).decode()  # Получение архива сообqщений
    msgDB = json.loads(msgDB)

    textb = tkinter.Text(root)
    textb.pack()

    inputField = tkinter.Entry(root)
    # self.inputField["command"] = self.sayTest
    inputField.pack()
    root.bind('<Return>', sayTest)

    for m in msgDB:
        textb.insert('end', '\n' + m)

    root.mainloop()
    sock.close()
except Exception as e:
    print('Oops, something went wrong' + e)
{'fraction_non_alphanumeric': 0.13449817147501017, 'fraction_numerical': 0.00690776107273466, 'mean_word_length': 2.453015427769986, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4163041', 'n_tokens_mistral': 815, 'n_tokens_neox': 808, 'n_words': 191}