From 57b2835ecc6c9b30920e929985b9d7cafcb7c457 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Sat, 24 Feb 2024 13:04:40 +0800 Subject: chore(project): add ruff deps chore(lint): format code with ruff chore(project): add tool.ruff format section --- tests/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/__init__.py') diff --git a/tests/__init__.py b/tests/__init__.py index c9a0e8f..97989dc 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -4,12 +4,14 @@ DIR = dirname(abspath(__file__)) token_dict = {} # 创建一个空字典 -with open(join(DIR, '..', 'psi', 'Grammar', 'Token'), 'r') as file: +with open(join(DIR, "..", "psi", "Grammar", "Token"), "r") as file: for line in file: if line := line.strip(): values = line.split() # 使用空格分割行,得到值列表 code = values[0] # 第一个值为代码 - symbol = values[1] if len(values) > 1 else None # 第二个值为符号,如果没有第二个值,则设置为None + symbol = ( + values[1] if len(values) > 1 else None + ) # 第二个值为符号,如果没有第二个值,则设置为None token_dict[code] = symbol # 将代码和符号添加到字典中 # 将字典中的键值对转换为多个变量及其对应的值 @@ -20,4 +22,4 @@ for code, symbol in token_dict.items(): print(LPAR) print(RPAR) print(AWAIT) -# 其他变量... \ No newline at end of file +# 其他变量... -- cgit v1.2.3-70-g09d2