From c3cf3f99ab80d991ea158a4dbb65bcfc99ac1f8e Mon Sep 17 00:00:00 2001 From: Griatch Date: Wed, 29 Jan 2020 23:18:22 +0100 Subject: [PATCH] Ran black on code --- evennia/server/portal/portal.py | 6 +++-- evennia/server/portal/tests.py | 44 ++++++++++++++++----------------- evennia/server/server.py | 6 +++-- evennia/utils/logger.py | 11 +++++---- 4 files changed, 36 insertions(+), 31 deletions(-) diff --git a/evennia/server/portal/portal.py b/evennia/server/portal/portal.py index 7e7e3e93c7..abbdb7f3a6 100644 --- a/evennia/server/portal/portal.py +++ b/evennia/server/portal/portal.py @@ -213,8 +213,10 @@ application = service.Application("Portal") if "--nodaemon" not in sys.argv: logfile = logger.WeeklyLogFile( - os.path.basename(settings.PORTAL_LOG_FILE), os.path.dirname(settings.PORTAL_LOG_FILE), - day_rotation=settings.PORTAL_LOG_DAY_ROTATION, max_size=settings.PORTAL_LOG_MAX_SIZE + os.path.basename(settings.PORTAL_LOG_FILE), + os.path.dirname(settings.PORTAL_LOG_FILE), + day_rotation=settings.PORTAL_LOG_DAY_ROTATION, + max_size=settings.PORTAL_LOG_MAX_SIZE, ) application.setComponent(ILogObserver, logger.PortalLogObserver(logfile).emit) diff --git a/evennia/server/portal/tests.py b/evennia/server/portal/tests.py index 33e375a2ff..df01a29981 100644 --- a/evennia/server/portal/tests.py +++ b/evennia/server/portal/tests.py @@ -55,9 +55,9 @@ class TestAMPServer(TwistedTestCase): if pickle.HIGHEST_PROTOCOL == 5: # Python 3.8+ byte_out = ( - b'\x00\x04_ask\x00\x011\x00\x08_command\x00\x10MsgServer2Portal\x00\x0b' - b'packed_data\x00 x\xdak`\x9d*\xc8\x00\x01\xde\x8c\xb5SzXJR' - b'\x8bK\xa6x3\x15\xb7M\xd1\x03\x00VU\x07u\x00\x00' + b"\x00\x04_ask\x00\x011\x00\x08_command\x00\x10MsgServer2Portal\x00\x0b" + b"packed_data\x00 x\xdak`\x9d*\xc8\x00\x01\xde\x8c\xb5SzXJR" + b"\x8bK\xa6x3\x15\xb7M\xd1\x03\x00VU\x07u\x00\x00" ) elif pickle.HIGHEST_PROTOCOL == 4: # Python 3.7 @@ -78,9 +78,9 @@ class TestAMPServer(TwistedTestCase): if pickle.HIGHEST_PROTOCOL == 5: # Python 3.8+ byte_out = ( - b'\x00\x04_ask\x00\x011\x00\x08_command\x00\x10MsgPortal2Server\x00\x0b' - b'packed_data\x00 x\xdak`\x9d*\xc8\x00\x01\xde\x8c\xb5SzXJR' - b'\x8bK\xa6x3\x15\xb7M\xd1\x03\x00VU\x07u\x00\x00' + b"\x00\x04_ask\x00\x011\x00\x08_command\x00\x10MsgPortal2Server\x00\x0b" + b"packed_data\x00 x\xdak`\x9d*\xc8\x00\x01\xde\x8c\xb5SzXJR" + b"\x8bK\xa6x3\x15\xb7M\xd1\x03\x00VU\x07u\x00\x00" ) elif pickle.HIGHEST_PROTOCOL == 4: # Python 3.7 @@ -105,22 +105,22 @@ class TestAMPServer(TwistedTestCase): if pickle.HIGHEST_PROTOCOL == 5: # Python 3.8+ self.transport.write.assert_called_with( - b'\x00\x04_ask\x00\x011\x00\x08_command\x00\x10MsgServer2Portal\x00\x0bpacked_data' - b'\x00wx\xda\xed\xc6\xc1\t\x80 \x00@Q#=5Z\x0b\xb8\x80\x13\xe85h\x80\x8e\xbam`Dc\xf4><\xf8g' - b'\x1a[\xf8\xda\x97\xa3_\xb1\x95\xdaz\xbe\xe7\x1a\xde\x03\x00\x00\x00\x00\x00\x00\x00' - b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' - b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' - b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x1f\x1eP\x1d\x02\r\x00\rpacked_data.2' - b'\x00Zx\xda\xed\xc3\x01\r\x00\x00\x08\xc0\xa0\xb4&\xf0\xfdg\x10a\xa3' - b'\xd9RUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xf5\xfb\x03m\xe0\x06' - b'\x1d\x00\rpacked_data.3\x00Zx\xda\xed\xc3\x01\r\x00\x00\x08\xc0\xa0\xb4&\xf0\xfdg\x10a' - b'\xa3fSUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xf5\xfb\x03n\x1c' - b'\x06\x1e\x00\rpacked_data.4\x00Zx\xda\xed\xc3\x01\t\x00\x00\x0c\x03\xa0\xb4O\xb0\xf5gA' - b'\xae`\xda\x8b\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' - b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' - b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' - b'\xaa\xaa\xaa\xdf\x0fnI\x06,\x00\rpacked_data.5\x00\x18x\xdaK-.)I\xc5\x8e\xa7\xb22@\xc0' - b'\x94\xe2\xb6)z\x00Z\x1e\x0e\xb6\x00\x00' + b"\x00\x04_ask\x00\x011\x00\x08_command\x00\x10MsgServer2Portal\x00\x0bpacked_data" + b"\x00wx\xda\xed\xc6\xc1\t\x80 \x00@Q#=5Z\x0b\xb8\x80\x13\xe85h\x80\x8e\xbam`Dc\xf4><\xf8g" + b"\x1a[\xf8\xda\x97\xa3_\xb1\x95\xdaz\xbe\xe7\x1a\xde\x03\x00\x00\x00\x00\x00\x00\x00" + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x1f\x1eP\x1d\x02\r\x00\rpacked_data.2" + b"\x00Zx\xda\xed\xc3\x01\r\x00\x00\x08\xc0\xa0\xb4&\xf0\xfdg\x10a\xa3" + b"\xd9RUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xf5\xfb\x03m\xe0\x06" + b"\x1d\x00\rpacked_data.3\x00Zx\xda\xed\xc3\x01\r\x00\x00\x08\xc0\xa0\xb4&\xf0\xfdg\x10a" + b"\xa3fSUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xf5\xfb\x03n\x1c" + b"\x06\x1e\x00\rpacked_data.4\x00Zx\xda\xed\xc3\x01\t\x00\x00\x0c\x03\xa0\xb4O\xb0\xf5gA" + b"\xae`\xda\x8b\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" + b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" + b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" + b"\xaa\xaa\xaa\xdf\x0fnI\x06,\x00\rpacked_data.5\x00\x18x\xdaK-.)I\xc5\x8e\xa7\xb22@\xc0" + b"\x94\xe2\xb6)z\x00Z\x1e\x0e\xb6\x00\x00" ) elif pickle.HIGHEST_PROTOCOL == 4: # Python 3.7 diff --git a/evennia/server/server.py b/evennia/server/server.py index 23ad294e45..1c1783bef1 100644 --- a/evennia/server/server.py +++ b/evennia/server/server.py @@ -616,8 +616,10 @@ application = service.Application("Evennia") if "--nodaemon" not in sys.argv: # custom logging, but only if we are not running in interactive mode logfile = logger.WeeklyLogFile( - os.path.basename(settings.SERVER_LOG_FILE), os.path.dirname(settings.SERVER_LOG_FILE), - day_rotation=settings.SERVER_LOG_DAY_ROTATION, max_size=settings.SERVER_LOG_MAX_SIZE + os.path.basename(settings.SERVER_LOG_FILE), + os.path.dirname(settings.SERVER_LOG_FILE), + day_rotation=settings.SERVER_LOG_DAY_ROTATION, + max_size=settings.SERVER_LOG_MAX_SIZE, ) application.setComponent(ILogObserver, logger.ServerLogObserver(logfile).emit) diff --git a/evennia/utils/logger.py b/evennia/utils/logger.py index af4f8241a8..8785c1319c 100644 --- a/evennia/utils/logger.py +++ b/evennia/utils/logger.py @@ -107,10 +107,12 @@ class WeeklyLogFile(logfile.DailyLogFile): # all dates here are tuples (year, month, day) now = self.toDate() then = self.lastDate - return (now[0] > then[0] or - now[1] > then[1] or - now[2] > (then[2] + self.day_rotation) or - self.size >= self.max_size) + return ( + now[0] > then[0] + or now[1] > then[1] + or now[2] > (then[2] + self.day_rotation) + or self.size >= self.max_size + ) def suffix(self, tupledate): """Return the suffix given a (year, month, day) tuple or unixtime. @@ -143,7 +145,6 @@ class WeeklyLogFile(logfile.DailyLogFile): break return suffix - def write(self, data): "Write data to log file" logfile.BaseLogFile.write(self, data)