mirror of
https://github.com/gnuradio/gnuradio-companion.git
synced 2025-12-11 04:34:56 -06:00
All of the removed `from __future__ import` were needed in older versions of Python (mostly 2.5.x and below) but later became mandatory in most versions of Python 3 hence are not necessary anymore. More specifically, according to __future__.py[1]: - unicode_literals is part of Python since versions 2.6.0 and 3.0.0; - print_function is part of Python since versions 2.6.0 and 3.0.0; - absolute_import is part of Python since versions 2.5.0 and 3.0.0; - division is part of Python since versions 2.2.0 and 3.0.0; Get rid of those unnecessary imports to slightly clean up the codebase. [1] https://github.com/python/cpython/blob/master/Lib/__future__.py
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
# Copyright 2016 Free Software Foundation, Inc.
|
|
# This file is part of GNU Radio
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
|
|
|
|
import itertools
|
|
|
|
from . import Block, register_build_in
|
|
from ._build import build_params
|
|
|
|
|
|
@register_build_in
|
|
class VirtualSink(Block):
|
|
count = itertools.count()
|
|
|
|
key = 'virtual_sink'
|
|
label = 'Virtual Sink'
|
|
flags = Block.flags
|
|
flags.set('cpp')
|
|
|
|
parameters_data = build_params(
|
|
params_raw=[dict(label='Stream ID', id='stream_id', dtype='stream_id')],
|
|
have_inputs=False, have_outputs=False, flags=flags, block_id=key
|
|
)
|
|
inputs_data = [dict(domain='stream', dtype='', direction='sink', id="0")]
|
|
|
|
def __init__(self, parent, **kwargs):
|
|
super(VirtualSink, self).__init__(parent, **kwargs)
|
|
self.params['id'].hide = 'all'
|
|
|
|
@property
|
|
def stream_id(self):
|
|
return self.params['stream_id'].value
|
|
|
|
|
|
@register_build_in
|
|
class VirtualSource(Block):
|
|
count = itertools.count()
|
|
|
|
key = 'virtual_source'
|
|
label = 'Virtual Source'
|
|
flags = Block.flags
|
|
flags.set('cpp')
|
|
|
|
parameters_data = build_params(
|
|
params_raw=[dict(label='Stream ID', id='stream_id', dtype='stream_id')],
|
|
have_inputs=False, have_outputs=False, flags=flags, block_id=key
|
|
)
|
|
outputs_data = [dict(domain='stream', dtype='', direction='source', id="0")]
|
|
|
|
def __init__(self, parent, **kwargs):
|
|
super(VirtualSource, self).__init__(parent, **kwargs)
|
|
self.params['id'].hide = 'all'
|
|
|
|
@property
|
|
def stream_id(self):
|
|
return self.params['stream_id'].value
|