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

import time, os, re, codecs
from l_converter import Converter

# Get interface root path
pkg_name = ''
root_path = os.path.abspath(os.getcwd())
if os.path.basename(root_path).lower() != 'interface' and os.path.basename(os.path.dirname(root_path).lower()) == 'interface':
    pkg_name = os.path.basename(root_path)
    root_path = os.path.dirname(root_path)

def __compress(addon):
    '''
    Compress and concat addon source into one file.

    Args:
        addon: Addon name
    '''
    print('--------------------------------')
    print('Compressing: %s' % addon)
    file_count = 0
    converter = Converter('zh-TW')
    # Remove debug codes in source
    for line in open('%s/info.ini' % addon):
        parts = line.strip().split('=')
        if parts[0].find('lua_') == 0:
            source_file = os.path.join(addon, parts[1])
            source_code = codecs.open(source_file,'r',encoding='gbk').read()<commit_msg>修复打包工具问题<commit_after># -*- coding: utf-8 -*-

import time, os, re, codecs
from l_converter import Converter

def __is_interface(path):
    name = os.path.basename(path).lower()
    return name == 'interface' or name == 'interfacesource'

# Get interface root path
pkg_name = ''
root_path = os.path.abspath(os.getcwd())
if not __is_interface(root_path) and __is_interface(os.path.dirname(root_path)):
    pkg_name = os.path.basename(root_path)
    root_path = os.path.dirname(root_path)

def __compress(addon):
    '''
    Compress and concat addon source into one file.

    Args:
        addon: Addon name
    '''
    print('--------------------------------')
    print('Compressing: %s' % addon)
    file_count = 0
    converter = Converter('zh-TW')
    # Remove debug codes in source
    for line in open('%s/info.ini' % addon):
        parts = line.strip().split('=')
        if parts[0].find('lua_') == 0:
            source_file = os.path.join(addon, parts[1])
            source_code = codecs.open(source_file,'r',encoding='gbk').read()
{'fraction_non_alphanumeric': 0.17761194029850746, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 2.8304761904761904, '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': '3649477', 'n_tokens_mistral': 686, 'n_tokens_neox': 679, 'n_words': 150}