use "Optional" in typing
This commit is contained in:
parent
f2a97415b9
commit
83d01553e3
@ -1,7 +1,7 @@
|
|||||||
from csdr.module import Module
|
from csdr.module import Module
|
||||||
from pycsdr.modules import Buffer
|
from pycsdr.modules import Buffer
|
||||||
from pycsdr.types import Format
|
from pycsdr.types import Format
|
||||||
from typing import Union, Callable
|
from typing import Union, Callable, Optional
|
||||||
|
|
||||||
|
|
||||||
class Chain(Module):
|
class Chain(Module):
|
||||||
@ -15,7 +15,7 @@ class Chain(Module):
|
|||||||
def empty(self):
|
def empty(self):
|
||||||
return not self.workers
|
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:
|
if buffer is None:
|
||||||
buffer = Buffer(w1.getOutputFormat())
|
buffer = Buffer(w1.getOutputFormat())
|
||||||
w1.setWriter(buffer)
|
w1.setWriter(buffer)
|
||||||
|
@ -9,7 +9,7 @@ from csdr.chain.clientaudio import ClientAudioChain
|
|||||||
from csdr.chain.fft import FftChain
|
from csdr.chain.fft import FftChain
|
||||||
from pycsdr.modules import Buffer, Writer
|
from pycsdr.modules import Buffer, Writer
|
||||||
from pycsdr.types import Format
|
from pycsdr.types import Format
|
||||||
from typing import Union
|
from typing import Union, Optional
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
@ -52,7 +52,7 @@ class ClientDemodulatorChain(Chain):
|
|||||||
self.secondaryDemodulator.stop()
|
self.secondaryDemodulator.stop()
|
||||||
self.secondaryDemodulator = None
|
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:
|
if w1 is self.selector:
|
||||||
super()._connect(w1, w2, self.selectorBuffer)
|
super()._connect(w1, w2, self.selectorBuffer)
|
||||||
elif w2 is self.clientAudioChain:
|
elif w2 is self.clientAudioChain:
|
||||||
@ -115,7 +115,7 @@ class ClientDemodulatorChain(Chain):
|
|||||||
return self.secondaryDemodulator.getFixedAudioRate()
|
return self.secondaryDemodulator.getFixedAudioRate()
|
||||||
return self.outputRate
|
return self.outputRate
|
||||||
|
|
||||||
def setSecondaryDemodulator(self, demod: Union[SecondaryDemodulator, None]):
|
def setSecondaryDemodulator(self, demod: Optional[SecondaryDemodulator]):
|
||||||
if demod is self.secondaryDemodulator:
|
if demod is self.secondaryDemodulator:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user