<commit_before>import json
import os.path

from flask import Flask, abort

from common import file, page, console

rss = None
menu_list = None
page_name_list = list()
cache_page = dict()
template_config = None
app = Flask(__name__)

console.log("info", "Loading configuration")

system_config = json.loads(file.read_file("./config/system.json"))

if system_config["Author_Image"] == "" and system_config["Author_Name"] != "":
    import request
    r = request.get("https://en.gravatar.com/{0}.json".formart(system_config["Author_Name"]))
    if r.status_code == 200:
        req = r.json()
        gravatar_hash = req["entry"]["hash"]
        system_config["Author_Image"] = "https://secure.gravatar.com/avatar/{0}".format(gravatar_hash)
        file.write_file("./config/system.json", json.dumps(system_config))

page_list = json.loads(file.read_file("./config/page.json"))

if os.path.exists("./config/menu.json"):
    menu_list = json.loads(file.read_file("./config/menu.json"))<commit_msg>修改缺失库的bug<commit_after>import json
import os.path

from flask import Flask, abort

from common import file, page, console

rss = None
menu_list = None
page_name_list = list()
cache_page = dict()
template_config = None
app = Flask(__name__)

console.log("info", "Loading configuration")

system_config = json.loads(file.read_file("./config/system.json"))

if system_config["Author_Image"] == "" and system_config["Author_Name"] != "":
    import urllib.requestv

    r = {"entry": {"hash": ""}}
    console.log("info", "Get the Gravatar URL")
    try:
        r = urllib.request.urlopen("https://en.gravatar.com/{0}.json".formart(system_config["Author_Name"])).read()
    except urllib2.HTTPError:
        console.log("Error", "Get the error")
        pass
    req = json.loads(r)
    gravatar_hash = req["entry"]["hash"]
    system_config["Author_Image"] = "https://secure.gravatar.com/avatar/{0}".format(gravatar_hash)
    file.write_file("./config/system.json", json.dumps(system_config))

page_list = json.loads(file.read_file("./config/page.json"))

if os.path.exists("./config/menu.json"):
    menu_list = json.loads(file.read_file("./config/menu.json"))
{'fraction_non_alphanumeric': 0.1686019507663725, 'fraction_numerical': 0.0037157454714352067, 'mean_word_length': 4.453164556962025, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '25487', 'n_tokens_mistral': 723, 'n_tokens_neox': 734, 'n_words': 126}