]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix DeepSource alert
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Fri, 24 Sep 2021 19:01:58 +0000 (21:01 +0200)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Fri, 24 Sep 2021 19:01:58 +0000 (21:01 +0200)
Logging is not lazy

The logging statement has the call of the form
logging.(format_string % (format_args...))
For such calls, it is recommended to leave string interpolation to the
logging method itself and be written as
logging.(format_string, format_args...)
so that the program may avoid incurring the cost of the interpolation
in those cases in which no message will be logged. For more details, see
PEP 282.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
trojans/tncc-emulate.py

index 823028a2b9a3c340a47d9b0726cdb490c5d1ce3f..d4aeff7d3ccf4bac7f8cd58a3c8b5c5b8a57b5be 100755 (executable)
@@ -548,7 +548,7 @@ class tncc(object):
 
         if 'interval' in response:
             m = int(response['interval'])
-            logging.debug('Got interval of %d minutes' % m)
+            logging.debug('Got interval of %d minutes', m)
             if self.interval is None or self.interval > m * 60:
                 self.interval = m * 60
 
@@ -650,7 +650,7 @@ class tncc_server(object):
             self.tncc.get_cookie(args['Cookie'],
                                  self.tncc.find_cookie('DSSIGNIN'))
         else:
-            logging.warning('Unknown command %r' % cmd)
+            logging.warning('Unknown command %r', cmd)
 
 
 def fingerprint_checking_SSLSocket(_fingerprint):