<commit_before>import logging
import pinylib

import config

log = logging.getLogger(__name__)


def main():
    room_name = raw_input('Enter room name: ').strip()
    client = pinylib.TinychatRTMPClient(roomname=room_name)
    client.nickname = raw_input('Enter nick name (optional): ').strip()

    do_login = raw_input('Login? [enter=No] ')
    if do_login:
        if not client.account:
            client.account = raw_input('Account: ').strip()
        if not client.password:
            client.password = raw_input('Password: ')

        is_logged_in = client.login()
        while not is_logged_in:
            client.account = raw_input('Account: ').strip()
            client.password = raw_input('Password: ')
            if client.account == '/' or client.password == '/':
                main()
                break
            elif client.account == '//' or client.password == '//':
                do_login = False
                break
            else:
                is_logged_in = client.login()
        if is_logged_in:
            client.console_write(pinylib.COLOR['bright_green'], 'Logged in as: %s' % client.account)
    if not do_login:
        client.account = ''
        client.password = None

    status = client.get_rtmp_parameters()
    while True:
        if status == 1:
            client.console_write(pinylib.COLOR['bright_red'], 'Password protected. Enter room password')
            client.room_pass = raw_input()
            if client.room_pass == '/':
                main()
                break
            else:
                status = client.get_rtmp_parameters()
        elif status == 2:
            client.console_write(pinylib.COLOR['bright_red'], 'The room has been closed.')
            main()
            break
        elif status == 4:
            client.console_write(pinylib.COLOR['bright_red'], 'The response returned nothing.')
            main()
            break
        else:
            client.console_write(pinylib.COLOR['bright_green'], 'Connect parameters set.')
            break

    t = pinylib.threading.Thread(target=client.connect)
    t.daemon = True
    t.start()

    while not client.is_connected:
        pinylib.time.sleep(2)
    while client.is_connected:
        chat_msg = raw_input()
        if chat_msg.startswith('/'):
            msg_parts = chat_msg.split(' ')
            cmd = msg_parts[0].lower().strip()
            if cmd == '/q':
                client.disconnect()
            elif cmd == '/u':
                for user in client.users.all:
                    print ('%s: %s' % (user, client.users.all[user].user_level))
            elif cmd == '/m':
                if len(client.users.mods) is 0:
                    print ('No moderators in the room.')
                else:
                    for mod in client.users.mods:
                        print (mod.nick)
            elif cmd == '/n':
                if len(client.users.norms) is 0:
                    print ('No normal users in the room.')
                else:
                    for norm in client.users.norms:
                        print (norm.nick)
            elif cmd == '/l':
                if len(client.users.lurkers) is 0:
                    print ('No lurkers in the room.')
                else:
                    for lurker in client.users.lurkers:
                        print (lurker.nick)
        else:
            client.send_chat_msg(chat_msg)

if __name__ == '__main__':
    if config.DEBUG_TO_FILE:
        formater = '%(asctime)s : %(levelname)s : %(filename)s : %(lineno)d : %(funcName)s() : %(name)s : %(message)s'
        logging.basicConfig(filename=config.DEBUG_FILE_NAME,
                            level=logging.DEBUG, format=formater)
        log.info('Starting pinylib version: %s' % pinylib.__version__)
    else:
        log.addHandler(logging.NullHandler())
    main()<commit_msg>Minor chanhge<commit_after>import logging

import config
import pinylib

log = logging.getLogger(__name__)


def main():
    room_name = raw_input('Enter room name: ').strip()
    if config.ACCOUNT and config.PASSWORD:
        client = pinylib.TinychatRTMPClient(roomname=room_name, account=config.ACCOUNT, password=config.PASSWORD)
    else:
        client = pinylib.TinychatRTMPClient(roomname=room_name)
    client.nickname = raw_input('Enter nick name (optional): ').strip()

    do_login = raw_input('Login? [enter=No] ')
    if do_login:
        if not client.account:
            client.account = raw_input('Account: ').strip()
        if not client.password:
            client.password = raw_input('Password: ')

        is_logged_in = client.login()
        while not is_logged_in:
            client.account = raw_input('Account: ').strip()
            client.password = raw_input('Password: ')
            if client.account == '/' or client.password == '/':
                main()
                break
            elif client.account == '//' or client.password == '//':
                do_login = False
                break
            else:
                is_logged_in = client.login()
        if is_logged_in:
            client.console_write(pinylib.COLOR['bright_green'], 'Logged in as: %s' % client.account)
    if not do_login:
        client.account = ''
        client.password = None

    status = client.get_rtmp_parameters()
    while True:
        if status == 1:
            client.console_write(pinylib.COLOR['bright_red'], 'Password protected. Enter room password')
            client.room_pass = raw_input()
            if client.room_pass == '/':
                main()
                break
            else:
                status = client.get_rtmp_parameters()
        elif status == 2:
            client.console_write(pinylib.COLOR['bright_red'], 'The room has been closed.')
            main()
            break
        elif status == 4:
            client.console_write(pinylib.COLOR['bright_red'], 'The response returned nothing.')
            main()
            break
        else:
            client.console_write(pinylib.COLOR['bright_green'], 'Connect parameters set.')
            break

    t = pinylib.threading.Thread(target=client.connect)
    t.daemon = True
    t.start()

    while not client.is_connected:
        pinylib.time.sleep(2)
    while client.is_connected:
        chat_msg = raw_input()
        if chat_msg.startswith('/'):
            msg_parts = chat_msg.split(' ')
            cmd = msg_parts[0].lower().strip()
            if cmd == '/q':
                client.disconnect()
            elif cmd == '/u':
                for user in client.users.all:
                    print ('%s: %s' % (user, client.users.all[user].user_level))
            elif cmd == '/m':
                if len(client.users.mods) is 0:
                    print ('No moderators in the room.')
                else:
                    for mod in client.users.mods:
                        print (mod.nick)
            elif cmd == '/n':
                if len(client.users.norms) is 0:
                    print ('No normal users in the room.')
                else:
                    for norm in client.users.norms:
                        print (norm.nick)
            elif cmd == '/l':
                if len(client.users.lurkers) is 0:
                    print ('No lurkers in the room.')
                else:
                    for lurker in client.users.lurkers:
                        print (lurker.nick)
        else:
            client.send_chat_msg(chat_msg)

if __name__ == '__main__':
    if config.DEBUG_TO_FILE:
        formater = '%(asctime)s : %(levelname)s : %(filename)s : %(lineno)d : %(funcName)s() : %(name)s : %(message)s'
        logging.basicConfig(filename=config.DEBUG_FILE_NAME, level=logging.DEBUG, format=formater)
        log.info('Starting pinylib version: %s' % pinylib.__version__)
    else:
        log.addHandler(logging.NullHandler())
    main()
{'fraction_non_alphanumeric': 0.11613800075824593, 'fraction_numerical': 0.0020219891318084167, 'mean_word_length': 1.6982611660415956, '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': '2175452', 'n_tokens_mistral': 2306, 'n_tokens_neox': 2219, 'n_words': 509}