From 9ea8795bdbed6b20d327b075c1ff8d2c3617ddda Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 30 Sep 2022 14:39:16 +0400 Subject: [PATCH] Correct logging interpolation format --- pylintrc | 4 +--- python_aternos/atclient.py | 12 ++++++------ python_aternos/atconnect.py | 17 +++++++++-------- python_aternos/atwss.py | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/pylintrc b/pylintrc index ce0fd9c..776f6ba 100644 --- a/pylintrc +++ b/pylintrc @@ -39,8 +39,6 @@ disable=raw-checker-failed, useless-suppression, deprecated-pragma, use-symbolic-message-instead, - logging-not-lazy, - logging-fstring-interpolation, no-member, too-many-arguments, too-many-public-methods, @@ -134,7 +132,7 @@ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io [LOGGING] -logging-format-style=new +logging-format-style=old logging-modules=logging diff --git a/python_aternos/atclient.py b/python_aternos/atclient.py index 6bee808..ff6c25d 100644 --- a/python_aternos/atclient.py +++ b/python_aternos/atclient.py @@ -170,7 +170,7 @@ class Client: """ file = os.path.expanduser(file) - logging.debug(f'Restoring session from {file}') + logging.debug('Restoring session from %s', file) if not os.path.exists(file): raise FileNotFoundError() @@ -255,7 +255,7 @@ class Client: """ file = os.path.expanduser(file) - logging.debug(f'Saving session to {file}') + logging.debug('Saving session to %s', file) with open(file, 'wt', encoding='utf-8') as f: @@ -277,12 +277,12 @@ class Client: """ file = os.path.expanduser(file) - logging.debug(f'Removing session file: {file}') + logging.debug('Removing session file: %s', file) try: os.remove(file) except OSError as err: - logging.warning(f'Unable to delete session file: {err}') + logging.warning('Unable to delete session file: %s', err) def list_servers(self, cache: bool = True) -> List[AternosServer]: @@ -313,7 +313,7 @@ class Client: try: self.save_session(self.saved_session) except OSError as err: - logging.warning(f'Unable to save servers list to file: {err}') + logging.warning('Unable to save servers list to file: %s', err) return self.servers @@ -333,7 +333,7 @@ class Client: if servid == '': continue - logging.debug(f'Adding server {servid}') + logging.debug('Adding server %s', servid) srv = AternosServer(servid, self.atconn) self.servers.append(srv) diff --git a/python_aternos/atconnect.py b/python_aternos/atconnect.py index 47222e7..340fa9b 100644 --- a/python_aternos/atconnect.py +++ b/python_aternos/atconnect.py @@ -221,12 +221,12 @@ class AternosConnect: reqcookies['ATERNOS_SESSION'] = self.atsession del self.session.cookies['ATERNOS_SESSION'] - logging.debug(f'Requesting({method}){url}') - logging.debug(f'headers={headers}') - logging.debug(f'params={params}') - logging.debug(f'data={data}') - logging.debug(f'req-cookies={reqcookies}') - logging.debug(f'session-cookies={self.session.cookies}') + logging.debug('Requesting(%s)%s', method, url) + logging.debug('headers=%s', headers) + logging.debug('params=%s', params) + logging.debug('data=%s', data) + logging.debug('req-cookies=%s', reqcookies) + logging.debug('session-cookies=%s', self.session.cookies) if method == 'POST': sendreq = partial( @@ -260,9 +260,10 @@ class AternosConnect: sendtoken, retry - 1 ) - logging.debug('AternosConnect received: ' + req.text[:65]) + logging.debug('AternosConnect received: %s', req.text[:65]) logging.info( - f'{method} completed with {req.status_code} status' + '%s completed with %s status', + method, req.status_code ) if req.status_code == 402: diff --git a/python_aternos/atwss.py b/python_aternos/atwss.py index d7c342b..5d4e194 100644 --- a/python_aternos/atwss.py +++ b/python_aternos/atwss.py @@ -174,7 +174,7 @@ class AternosWss: continue if strm.stream: - logging.debug(f'Requesting {strm.stream} stream') + logging.debug('Requesting %s stream', strm.stream) await self.send({ 'stream': strm.stream, 'type': 'start'