From 41179b4f7161ba6c7cb632a3301d6739b9d81d28 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 28 Dec 2021 23:11:59 -0500 Subject: [PATCH] Python 3.10 support: collections no longer exports Mapping This was emitting a DeprecationWarning since Python 3.3 but we never saw it... See https://docs.python.org/3/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code --- pyrdp/logging/StatCounter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrdp/logging/StatCounter.py b/pyrdp/logging/StatCounter.py index 31111cf47..625bbd342 100644 --- a/pyrdp/logging/StatCounter.py +++ b/pyrdp/logging/StatCounter.py @@ -4,8 +4,8 @@ # Licensed under the GPLv3 or later. # -import collections import time +from collections.abc import Mapping from logging import LoggerAdapter from typing import Optional @@ -156,7 +156,7 @@ def stop(self): if self.stats[STAT.TOTAL_OUTPUT] > 0: self.stats[STAT.CLIENT_SERVER_RATIO] = self.stats[STAT.TOTAL_INPUT] / self.stats[STAT.TOTAL_OUTPUT] - def logReport(self, log: LoggerAdapter, more_info: Optional[collections.Mapping] = None): + def logReport(self, log: LoggerAdapter, more_info: Optional[Mapping] = None): """ Create an INFO log message to log the Connection report using the keys in self.stats. :param log: Logger to use to log the report @@ -164,7 +164,7 @@ def logReport(self, log: LoggerAdapter, more_info: Optional[collections.Mapping] in the connection report """ # merge in the additional data if required - if isinstance(more_info, collections.Mapping): + if isinstance(more_info, Mapping): report_data = {**self.stats, **more_info} else: report_data = self.stats