From 83d01553e3d97322fec809c05828ebf864aac805 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 20 Sep 2021 17:24:10 +0200 Subject: [PATCH] use "Optional" in typing --- csdr/chain/__init__.py | 4 ++-- owrx/dsp.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/csdr/chain/__init__.py b/csdr/chain/__init__.py index 6e9b210..557eebe 100644 --- a/csdr/chain/__init__.py +++ b/csdr/chain/__init__.py @@ -1,7 +1,7 @@ from csdr.module import Module from pycsdr.modules import Buffer from pycsdr.types import Format -from typing import Union, Callable +from typing import Union, Callable, Optional class Chain(Module): @@ -15,7 +15,7 @@ class Chain(Module): def empty(self): return not self.workers - def _connect(self, w1, w2, buffer: Union[Buffer, None] = None) -> None: + def _connect(self, w1, w2, buffer: Optional[Buffer] = None) -> None: if buffer is None: buffer = Buffer(w1.getOutputFormat()) w1.setWriter(buffer) diff --git a/owrx/dsp.py b/owrx/dsp.py index f56586c..ac33742 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -9,7 +9,7 @@ from csdr.chain.clientaudio import ClientAudioChain from csdr.chain.fft import FftChain from pycsdr.modules import Buffer, Writer from pycsdr.types import Format -from typing import Union +from typing import Union, Optional from io import BytesIO import threading import re @@ -52,7 +52,7 @@ class ClientDemodulatorChain(Chain): self.secondaryDemodulator.stop() self.secondaryDemodulator = None - def _connect(self, w1, w2, buffer: Union[Buffer, None] = None) -> None: + def _connect(self, w1, w2, buffer: Optional[Buffer] = None) -> None: if w1 is self.selector: super()._connect(w1, w2, self.selectorBuffer) elif w2 is self.clientAudioChain: @@ -115,7 +115,7 @@ class ClientDemodulatorChain(Chain): return self.secondaryDemodulator.getFixedAudioRate() return self.outputRate - def setSecondaryDemodulator(self, demod: Union[SecondaryDemodulator, None]): + def setSecondaryDemodulator(self, demod: Optional[SecondaryDemodulator]): if demod is self.secondaryDemodulator: return