]> git.poda.fr Git - converter.git/commitdiff
typing: Update deprecated types
authorJulien <julien@poda.fr>
Thu, 6 Feb 2025 19:22:56 +0000 (20:22 +0100)
committerJulien <julien@poda.fr>
Thu, 6 Feb 2025 19:22:56 +0000 (20:22 +0100)
converter.py

index 891075fa6e5580d0f69e7c1773201d78530ac60c..8f2c02303bc0058c50d1a79a37e83557e7a88008 100755 (executable)
@@ -23,6 +23,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 '''
 
 import argparse
+import collections
 import filecmp # diff
 import os
 import queue
@@ -153,11 +154,11 @@ class Stats:
 
 # Main converter class. Thread safe.
 class Converter:
-    def __init__(self, outstreamFunction: typing.Callable[[str], None]) -> None:
+    def __init__(self, outstreamFunction: collections.abc.Callable[[str], None]) -> None:
         self._running: bool = False
         self._stopSignal: bool = False
         self._runLock: threading.Lock = threading.Lock()
-        self._outstreamFunction: typing.Callable[[str], None] = outstreamFunction
+        self._outstreamFunction: collections.abc.Callable[[str], None] = outstreamFunction
         self._logLock: threading.Lock = threading.Lock()
         self._statsLock: threading.Lock = threading.Lock()
 
@@ -571,12 +572,11 @@ class Converter:
             if not node.tag.endswith("trackList"):
                 continue
 
-            # Each element is a string path.
             for track in node: # <track> in <trackList>.
                 if not track.tag.endswith("track"):
                     continue
 
-                element: typing.Optional[xml.etree.ElementTree.Element] = track.find("{" + xmlns + "}location")
+                element: xml.etree.ElementTree.Element | None = track.find("{" + xmlns + "}location")
 
                 if element is None:
                     continue