提交 99527f53 编写于 作者: M Mars Liu

set encoding

上级 d97dd05e
...@@ -7,7 +7,6 @@ import sys ...@@ -7,7 +7,6 @@ import sys
import uuid import uuid
import re import re
id_set = set() id_set = set()
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
...@@ -16,6 +15,7 @@ formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') ...@@ -16,6 +15,7 @@ formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter) handler.setFormatter(formatter)
logger.addHandler(handler) logger.addHandler(handler)
def search_author(author_dict, username): def search_author(author_dict, username):
for key in author_dict: for key in author_dict:
names = author_dict[key] names = author_dict[key]
...@@ -23,6 +23,7 @@ def search_author(author_dict, username): ...@@ -23,6 +23,7 @@ def search_author(author_dict, username):
return key return key
return username return username
def user_name(md_file, author_dict): def user_name(md_file, author_dict):
ret = subprocess.Popen([ ret = subprocess.Popen([
"git", "log", md_file "git", "log", md_file
...@@ -35,8 +36,9 @@ def user_name(md_file, author_dict): ...@@ -35,8 +36,9 @@ def user_name(md_file, author_dict):
author_nick_name = author_lines[-1] author_nick_name = author_lines[-1]
return search_author(author_dict, author_nick_name) return search_author(author_dict, author_nick_name)
def load_json(p): def load_json(p):
with open(p, 'r') as f: with open(p, 'r', encoding="utf-8") as f:
return json.loads(f.read()) return json.loads(f.read())
...@@ -92,13 +94,13 @@ def check_export(base, cfg): ...@@ -92,13 +94,13 @@ def check_export(base, cfg):
class TreeWalker: class TreeWalker:
def __init__( def __init__(
self, root, self, root,
tree_name, tree_name,
title=None, title=None,
log=None, log=None,
authors=None, authors=None,
enable_notebook=None, enable_notebook=None,
ignore_keywords=False ignore_keywords=False
): ):
self.ignore_keywords = ignore_keywords self.ignore_keywords = ignore_keywords
self.authors = authors if authors else {} self.authors = authors if authors else {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册