删除冗余引用

This commit is contained in:
星外之神 2022-07-24 13:36:50 +08:00
parent 4f2c8cf4da
commit b47ffc705e
3 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
import pygame as pg
import logging import logging
import traceback import traceback
import os import os
@ -8,12 +7,12 @@ from source import tool
from source import constants as c from source import constants as c
from source.state import mainmenu, screen, level from source.state import mainmenu, screen, level
if __name__=='__main__': if __name__=="__main__":
# 日志设置 # 日志设置
if not os.path.exists(os.path.dirname(c.USERLOG_PATH)): if not os.path.exists(os.path.dirname(c.USERLOG_PATH)):
os.makedirs(os.path.dirname(c.USERLOG_PATH)) os.makedirs(os.path.dirname(c.USERLOG_PATH))
logger = logging.getLogger() logger = logging.getLogger()
formatter = logging.Formatter('%(asctime)s: %(message)s') formatter = logging.Formatter("%(asctime)s: %(message)s")
file_handler = RotatingFileHandler(c.USERLOG_PATH, "a", 1024*1024, 0, "utf-8") file_handler = RotatingFileHandler(c.USERLOG_PATH, "a", 1024*1024, 0, "utf-8")
file_handler.setFormatter(formatter) file_handler.setFormatter(formatter)
stream_handler = logging.StreamHandler() stream_handler = logging.StreamHandler()
@ -33,4 +32,4 @@ if __name__=='__main__':
game.run() game.run()
except: except:
print() # 将日志输出与上文内容分隔开,增加可读性 print() # 将日志输出与上文内容分隔开,增加可读性
logger.error(f'\n{traceback.format_exc()}') logger.error(f"\n{traceback.format_exc()}")

View File

@ -1,6 +1,4 @@
import random import random
import pygame as pg
from .. import tool
from .. import constants as c from .. import constants as c
class Map(): class Map():

View File

@ -2,7 +2,6 @@ import pygame as pg
import os import os
from .. import tool from .. import tool
from .. import constants as c from .. import constants as c
from . import level
class Menu(tool.State): class Menu(tool.State):