mirror of
https://github.com/gnuradio/gnuradio-companion.git
synced 2025-12-15 14:00:28 -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
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
# Copyright 2016 Free Software Foundation, Inc.
|
|
# This file is part of GNU Radio
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
#
|
|
|
|
|
|
from . import Block, register_build_in
|
|
|
|
from ._build import build_params
|
|
|
|
@register_build_in
|
|
class DummyBlock(Block):
|
|
|
|
is_dummy_block = True
|
|
|
|
label = 'Missing Block'
|
|
key = '_dummy'
|
|
|
|
def __init__(self, parent, missing_block_id, parameters, **_):
|
|
self.key = missing_block_id
|
|
self.parameters_data = build_params([],False, False,self.flags, self.key)
|
|
super(DummyBlock, self).__init__(parent=parent)
|
|
|
|
param_factory = self.parent_platform.make_param
|
|
for param_id in parameters:
|
|
self.params.setdefault(param_id, param_factory(parent=self, id=param_id, dtype='string'))
|
|
|
|
def is_valid(self):
|
|
return False
|
|
|
|
@property
|
|
def enabled(self):
|
|
return False
|
|
|
|
def add_missing_port(self, port_id, direction):
|
|
port = self.parent_platform.make_port(
|
|
parent=self, direction=direction, id=port_id, name='?', dtype='',
|
|
)
|
|
if port.is_source:
|
|
self.sources.append(port)
|
|
else:
|
|
self.sinks.append(port)
|
|
return port
|