grc: remove six

This commit is contained in:
Clayton Smith 2020-10-03 12:34:28 -04:00 committed by Martin Braun
parent 98767041a1
commit 24acd82b02
30 changed files with 112 additions and 180 deletions

View File

@ -2,7 +2,7 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
from codecs import open
@ -10,8 +10,6 @@ import json
import logging
import os
import six
from . import block_tree, block
path = os.path
@ -149,10 +147,8 @@ class Converter(object):
def byteify(data):
if isinstance(data, dict):
return {byteify(key): byteify(value) for key, value in six.iteritems(data)}
return {byteify(key): byteify(value) for key, value in data.items()}
elif isinstance(data, list):
return [byteify(element) for element in data]
elif isinstance(data, six.text_type) and six.PY2:
return data.encode('utf-8')
else:
return data

View File

@ -2,10 +2,7 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
import six
#
class Flags(object):
@ -22,7 +19,7 @@ class Flags(object):
def __init__(self, flags=None):
if flags is None:
flags = set()
if isinstance(flags, six.string_types):
if isinstance(flags, str):
flags = (f.strip() for f in flags.replace(',', '').split())
self.data = set(flags)

View File

@ -11,8 +11,6 @@ import collections
import itertools
import copy
import six
from six.moves import range
import re
import ast
@ -78,10 +76,10 @@ class Block(Element):
self.block_namespace = {}
if Flags.HAS_CPP in self.flags and self.enabled and not (self.is_virtual_source() or self.is_virtual_sink()):
# This is a workaround to allow embedded python blocks/modules to load as there is
# This is a workaround to allow embedded python blocks/modules to load as there is
# currently 'cpp' in the flags by default caused by the other built-in blocks
if hasattr(self,'cpp_templates'):
self.orig_cpp_templates = self.cpp_templates # The original template, in case we have to edit it when transpiling to C++
self.orig_cpp_templates = self.cpp_templates # The original template, in case we have to edit it when transpiling to C++
self.current_bus_structure = {'source': None, 'sink': None}
@ -148,7 +146,7 @@ class Block(Element):
###############################
## Bus Logic
###############################
for direc in {'source','sink'}:
if direc == 'source':
ports = self.sources
@ -156,7 +154,7 @@ class Block(Element):
bus_state = self.bus_source
else:
ports = self.sinks
ports_gui = self.filter_bus_port(self.sinks)
ports_gui = self.filter_bus_port(self.sinks)
bus_state = self.bus_sink
# Remove the bus ports
@ -176,7 +174,7 @@ class Block(Element):
self.current_bus_structure[direc] = struct
# Hide ports that are not part of the bus structure
#TODO: Blocks where it is desired to only have a subset
#TODO: Blocks where it is desired to only have a subset
# of ports included in the bus still has some issues
for idx, port in enumerate(ports):
if any([idx in bus for bus in self.current_bus_structure[direc]]):
@ -194,12 +192,12 @@ class Block(Element):
if port.key == saved_port.key:
self.parent_flowgraph.connections.remove(connection)
if saved_port.is_source:
connection.source_port = port
connection.source_port = port
if saved_port.is_sink:
connection.sink_port = port
connection.sink_port = port
self.parent_flowgraph.connections.add(connection)
else:
self.current_bus_structure[direc] = None
@ -358,7 +356,7 @@ class Block(Element):
@property
def bus_structure_source(self):
"""Gets the block's current source bus structure."""
try:
try:
bus_structure = self.params['bus_structure_source'].value or None
except:
bus_structure = None
@ -367,7 +365,7 @@ class Block(Element):
@property
def bus_structure_sink(self):
"""Gets the block's current source bus structure."""
try:
try:
bus_structure = self.params['bus_structure_sink'].value or None
except:
bus_structure = None
@ -447,7 +445,7 @@ class Block(Element):
if _vtype == bool:
return 'bool'
if _vtype == complex:
return 'gr_complex'
@ -474,11 +472,11 @@ class Block(Element):
# Get the lvalue type
self.vtype = get_type(value, py_type)
# The r-value for these types must be transformed to create legal C++ syntax.
if self.vtype in ['bool', 'gr_complex'] or 'std::map' in self.vtype or 'std::vector' in self.vtype:
evaluated = ast.literal_eval(value)
self.cpp_templates['var_make'] = self.cpp_templates['var_make'].replace('${value}', self.get_cpp_value(evaluated))
self.cpp_templates['var_make'] = self.cpp_templates['var_make'].replace('${value}', self.get_cpp_value(evaluated))
if 'string' in self.vtype:
self.cpp_templates['includes'].append('#include <string>')
@ -494,7 +492,7 @@ class Block(Element):
if re.match(pi_re, str(pyval)):
val_str = re.sub(pi_re, 'boost::math::constants::pi<double>()', val_str)
self.cpp_templates['includes'].append('#include <boost/math/constants/constants.hpp>')
return str(pyval)
elif type(pyval) == bool:
@ -514,7 +512,7 @@ class Block(Element):
if len(val_str) > 1:
# truncate to trim superfluous ', ' from the end
val_str = val_str[0:-2]
return val_str + '}'
elif type(pyval) == dict:
@ -531,7 +529,7 @@ class Block(Element):
if type(self.vtype) == str:
self.cpp_templates['includes'].append('#include <string>')
return '"' + pyval + '"'
return '"' + pyval + '"'
def is_virtual_sink(self):
@ -578,7 +576,7 @@ class Block(Element):
return itertools.chain(self.active_sources, self.active_sinks)
def children(self):
return itertools.chain(six.itervalues(self.params), self.ports())
return itertools.chain(self.params.values(), self.ports())
##############################################
# Access
@ -596,12 +594,12 @@ class Block(Element):
@property
def namespace(self):
# update block namespace
self.block_namespace.update({key:param.get_evaluated() for key, param in six.iteritems(self.params)})
self.block_namespace.update({key:param.get_evaluated() for key, param in self.params.items()})
return self.block_namespace
@property
def namespace_templates(self):
return {key: param.template_arg for key, param in six.iteritems(self.params)}
return {key: param.template_arg for key, param in self.params.items()}
def evaluate(self, expr):
return self.parent_flowgraph.evaluate(expr, self.namespace)
@ -642,7 +640,7 @@ class Block(Element):
pre_rewrite_hash = -1
while pre_rewrite_hash != get_hash():
for key, value in six.iteritems(parameters):
for key, value in parameters.items():
try:
self.params[key].set_value(value)
except KeyError:
@ -650,7 +648,7 @@ class Block(Element):
# Store hash and call rewrite
pre_rewrite_hash = get_hash()
self.rewrite()
##############################################
# Controller Modify
##############################################

View File

@ -2,7 +2,7 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
from io import open
@ -10,8 +10,6 @@ import json
import logging
import os
import six
from .io import yaml
logger = logging.getLogger(__name__)
@ -79,10 +77,8 @@ class Cache(object):
def byteify(data):
if isinstance(data, dict):
return {byteify(key): byteify(value) for key, value in six.iteritems(data)}
return {byteify(key): byteify(value) for key, value in data.items()}
elif isinstance(data, list):
return [byteify(element) for element in data]
elif isinstance(data, six.text_type) and six.PY2:
return data.encode('utf-8')
else:
return data

View File

@ -2,11 +2,9 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
from six.moves import range
from ..utils import expr_utils
from operator import methodcaller, attrgetter

View File

@ -1,7 +1,6 @@
import collections
import os
import six
import codecs
from .cpp_top_block import CppTopBlockGenerator
@ -174,7 +173,7 @@ class CppQtHierBlockGenerator(CppHierBlockGenerator):
block_n = collections.OrderedDict()
# insert flags after category
for key, value in six.iteritems(n['block']):
for key, value in n['block'].items():
block_n[key] = value
if key == 'category':
block_n['flags'] = 'need_qt_gui'

View File

@ -1,7 +1,6 @@
import collections
import os
import six
import codecs
from .top_block import TopBlockGenerator
@ -147,7 +146,7 @@ class QtHierBlockGenerator(HierBlockGenerator):
block_n = collections.OrderedDict()
# insert flags after category
for key, value in six.iteritems(n):
for key, value in n.items():
block_n[key] = value
if key == 'category':
block_n['flags'] = 'need_qt_gui'

View File

@ -2,12 +2,11 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
from collections import OrderedDict
import six
import yaml
from ..params.param import attributed_str
@ -27,7 +26,7 @@ class GRCDumper(yaml.SafeDumper):
if self.alias_key is not None:
self.represented_objects[self.alias_key] = node
for item_key, item_value in six.iteritems(data):
for item_key, item_value in data.items():
node_key = self.represent_data(item_key)
node_value = self.represent_data(item_value)
value.append((node_key, node_value))

View File

@ -2,12 +2,11 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
import re
from six.moves import builtins
import builtins
from .. import blocks
from .. import Constants
@ -111,4 +110,4 @@ def validate_gui_hint(param):
try:
param.parse_gui_hint(param.value)
except Exception as e:
raise ValidateError(str(e))
raise ValidateError(str(e))

View File

@ -2,16 +2,13 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
import ast
import collections
import textwrap
import six
from six.moves import range
from .. import Constants
from ..base import Element
from ..utils.descriptors import Evaluated, EvaluatedEnum, setup_names
@ -76,7 +73,7 @@ class Param(Element):
options.attributes = collections.defaultdict(dict)
padding = [''] * max(len(values), len(labels))
attributes = {key: value + padding for key, value in six.iteritems(attributes)}
attributes = {key: value + padding for key, value in attributes.items()}
for i, option in enumerate(values):
# Test against repeated keys
@ -89,7 +86,7 @@ class Param(Element):
label = str(option)
# Store the option
options[option] = label
options.attributes[option] = {attrib: values[i] for attrib, values in six.iteritems(attributes)}
options.attributes[option] = {attrib: values[i] for attrib, values in attributes.items()}
default = next(iter(options)) if options else ''
if not self.value:

View File

@ -2,7 +2,7 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
from codecs import open
@ -12,9 +12,6 @@ import logging
from itertools import chain
import re
import six
from six.moves import range
from . import (
Messages, Constants,
blocks, params, ports, errors, utils, schema_checker
@ -170,7 +167,7 @@ class Platform(Element):
Messages.flowgraph_error_file = file_path
continue
for key, block in six.iteritems(self.blocks):
for key, block in self.blocks.items():
category = self._block_categories.get(key, block.category)
if not category:
continue
@ -199,7 +196,7 @@ class Platform(Element):
def _save_docstring_extraction_result(self, block_id, docstrings):
docs = {}
for match, docstring in six.iteritems(docstrings):
for match, docstring in docstrings.items():
if not docstring or match.endswith('_sptr'):
continue
docs[match] = docstring.replace('\n\n', '\n').strip()
@ -280,22 +277,22 @@ class Platform(Element):
path = []
def load_category(name, elements):
if not isinstance(name, six.string_types):
if not isinstance(name, str):
log.debug('Invalid name %r', name)
return
path.append(name)
for element in utils.to_list(elements):
if isinstance(element, six.string_types):
if isinstance(element, str):
block_id = element
self._block_categories[block_id] = list(path)
elif isinstance(element, dict):
load_category(*next(six.iteritems(element)))
load_category(*next(iter(element.items())))
else:
log.debug('Ignoring some elements of %s', name)
path.pop()
try:
module_name, categories = next(six.iteritems(data))
module_name, categories = next(iter(data.items()))
except (AttributeError, StopIteration):
log.warning('no valid data found')
else:

View File

@ -1,69 +1,69 @@
from .utils import Spec, expand, str_
from .utils import Spec, expand
PARAM_SCHEME = expand(
base_key=str_, # todo: rename/remove
base_key=str, # todo: rename/remove
id=str_,
label=str_,
category=str_,
id=str,
label=str,
category=str,
dtype=str_,
dtype=str,
default=object,
options=list,
option_labels=list,
option_attributes=Spec(types=dict, required=False, item_scheme=(str_, list)),
option_attributes=Spec(types=dict, required=False, item_scheme=(str, list)),
hide=str_,
hide=str,
)
PORT_SCHEME = expand(
label=str_,
domain=str_,
label=str,
domain=str,
id=str_,
dtype=str_,
vlen=(int, str_),
id=str,
dtype=str,
vlen=(int, str),
multiplicity=(int, str_),
optional=(bool, int, str_),
hide=(bool, str_),
multiplicity=(int, str),
optional=(bool, int, str),
hide=(bool, str),
)
TEMPLATES_SCHEME = expand(
imports=str_,
var_make=str_,
var_value=str_,
make=str_,
imports=str,
var_make=str,
var_value=str,
make=str,
callbacks=list,
)
CPP_TEMPLATES_SCHEME = expand(
includes=list,
declarations=str_,
make=str_,
var_make=str_,
declarations=str,
make=str,
var_make=str,
callbacks=list,
link=list,
translations=dict,
)
BLOCK_SCHEME = expand(
id=Spec(types=str_, required=True, item_scheme=None),
label=str_,
category=str_,
flags=(list, str_),
id=Spec(types=str, required=True, item_scheme=None),
label=str,
category=str,
flags=(list, str),
parameters=Spec(types=list, required=False, item_scheme=PARAM_SCHEME),
inputs=Spec(types=list, required=False, item_scheme=PORT_SCHEME),
outputs=Spec(types=list, required=False, item_scheme=PORT_SCHEME),
asserts=(list, str_),
value=str_,
asserts=(list, str),
value=str,
templates=Spec(types=dict, required=False, item_scheme=TEMPLATES_SCHEME),
cpp_templates=Spec(types=dict, required=False, item_scheme=CPP_TEMPLATES_SCHEME),
documentation=str_,
grc_source=str_,
documentation=str,
grc_source=str,
file_format=Spec(types=int, required=True, item_scheme=None),
block_wrapper_path=str_, # todo: rename/remove
block_wrapper_path=str, # todo: rename/remove
)

View File

@ -1,17 +1,17 @@
from .utils import Spec, expand, str_
from .utils import Spec, expand
DOMAIN_CONNECTION = expand(
type=Spec(types=list, required=True, item_scheme=None),
connect=str_,
cpp_connect=str_,
connect=str,
cpp_connect=str,
)
DOMAIN_SCHEME = expand(
id=Spec(types=str_, required=True, item_scheme=None),
label=str_,
color=str_,
id=Spec(types=str, required=True, item_scheme=None),
label=str,
color=str,
multiple_connections_per_input=bool,
multiple_connections_per_output=bool,
templates=Spec(types=list, required=False, item_scheme=DOMAIN_CONNECTION)
)
)

View File

@ -1,13 +1,13 @@
from .utils import Spec, expand, str_
from .utils import Spec, expand
OPTIONS_SCHEME = expand(
parameters=Spec(types=dict, required=False, item_scheme=(str_, str_)),
states=Spec(types=dict, required=False, item_scheme=(str_, str_)),
parameters=Spec(types=dict, required=False, item_scheme=(str, str)),
states=Spec(types=dict, required=False, item_scheme=(str, str)),
)
BLOCK_SCHEME = expand(
name=str_,
id=str_,
name=str,
id=str,
**OPTIONS_SCHEME
)

View File

@ -1,7 +1,5 @@
import collections
import six
Spec = collections.namedtuple('Spec', 'types required item_scheme')
@ -17,9 +15,6 @@ def expand(**kwargs):
return {key: expand_spec(value) for key, value in kwargs.items()}
str_ = six.string_types
class Message(collections.namedtuple('Message', 'path type message')):
fmt = '{path}: {type}: {message}'

View File

@ -2,11 +2,9 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
import six
from .utils import Message, Spec
@ -42,7 +40,7 @@ class Validator(object):
self._check_var_key_dict(data, *scheme)
def _check_var_key_dict(self, data, key_type, value_scheme):
for key, value in six.iteritems(data):
for key, value in data.items():
if not isinstance(key, key_type):
self._error('Key type {!r} for {!r} not in valid types'.format(
type(value).__name__, key))
@ -53,7 +51,7 @@ class Validator(object):
type(value).__name__, key))
def _check_dict(self, data, scheme):
for key, (types_, required, item_scheme) in six.iteritems(scheme):
for key, (types_, required, item_scheme) in scheme.items():
try:
value = data[key]
except KeyError:

View File

@ -2,11 +2,9 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
#
import six
from . import epy_block_io, expr_utils, extract_docs, flow_graph_complexity
from .hide_bokeh_gui_options_if_not_installed import hide_bokeh_gui_options_if_not_installed
@ -14,8 +12,7 @@ from .hide_bokeh_gui_options_if_not_installed import hide_bokeh_gui_options_if_n
def to_list(value):
if not value:
return []
elif isinstance(value, six.string_types):
elif isinstance(value, str):
return [value]
else:
return list(value)

View File

@ -2,10 +2,7 @@
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
import six
#
class Evaluated(object):
@ -54,7 +51,7 @@ class Evaluated(object):
def __set__(self, instance, value):
attribs = instance.__dict__
value = value or self.default
if isinstance(value, six.string_types) and value.startswith('${') and value.endswith('}'):
if isinstance(value, str) and value.startswith('${') and value.endswith('}'):
attribs[self.name_raw] = value[2:-1].strip()
attribs.pop(self.name, None) # reset previous eval result
else:
@ -68,7 +65,7 @@ class Evaluated(object):
class EvaluatedEnum(Evaluated):
def __init__(self, allowed_values, default=None, name=None):
if isinstance(allowed_values, six.string_types):
if isinstance(allowed_values, str):
allowed_values = set(allowed_values.split())
self.allowed_values = allowed_values
default = default if default is not None else next(iter(self.allowed_values))

View File

@ -3,9 +3,6 @@
import inspect
import collections
import six
from six.moves import zip
TYPE_MAP = {
'complex64': 'complex', 'complex': 'complex',
@ -39,7 +36,7 @@ def _find_block_class(source_code, cls):
exec(source_code, ns)
except Exception as e:
raise ValueError("Can't interpret source code: " + str(e))
for var in six.itervalues(ns):
for var in ns.values():
if inspect.isclass(var) and issubclass(var, cls):
return var
raise ValueError('No python block class found in code')

View File

@ -9,8 +9,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
import string
import six
def expr_replace(expr, replace_dict):
"""
@ -184,7 +182,7 @@ def _get_graph(exprs):
var_graph = _graph()
for var in vars:
var_graph.add_node(var)
for var, expr in six.iteritems(exprs):
for var, expr in exprs.items():
for dep in get_variable_dependencies(expr, vars):
if dep != var:
var_graph.add_edge(dep, var)

View File

@ -14,9 +14,7 @@ import threading
import json
import random
import itertools
import six
from six.moves import queue, filter, range
import queue
###############################################################################
@ -276,7 +274,7 @@ if __name__ == '__worker__':
elif __name__ == '__main__':
def callback(key, docs):
print(key)
for match, doc in six.iteritems(docs):
for match, doc in docs.items():
print('-->', match)
print(str(doc).strip())
print()

View File

@ -7,7 +7,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
"""
import six
import logging
from gi.repository import Gtk, Gdk, Gio, GLib, GObject

View File

@ -6,8 +6,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
"""
import six
from gi.repository import Gtk, Gdk, GObject
from . import Actions, Utils, Constants
@ -20,7 +18,7 @@ def _format_doc(doc):
docs = []
if doc.get(''):
docs += doc.get('').splitlines() + ['']
for block_name, docstring in six.iteritems(doc):
for block_name, docstring in doc.items():
docs.append('--- {0} ---'.format(block_name))
docs += docstring.splitlines()
docs.append('')
@ -121,7 +119,7 @@ class BlockTreeWindow(Gtk.VBox):
def repopulate(self):
self.clear()
for block in six.itervalues(self.platform.blocks):
for block in self.platform.blocks.values():
if block.category:
self.add_block(block)
self.expand_module_in_tree()

View File

@ -9,12 +9,11 @@ SPDX-License-Identifier: GPL-2.0-or-later
import sys
import os
import configparser
from ..core.Config import Config as CoreConfig
from . import Constants
from six.moves import configparser
HEADER = """\
# This contains only GUI settings for GRC and is not meant for users to edit.
#

View File

@ -7,8 +7,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
"""
import six
from gi.repository import Gtk, GObject
from .Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT
@ -61,7 +59,7 @@ class ParserErrorsDialog(Gtk.Dialog):
"""set up data model"""
self.tree_store.clear()
self._error_logs = error_logs
for filename, errors in six.iteritems(error_logs):
for filename, errors in error_logs.items():
parent = self.tree_store.append(None, [str(filename)])
try:
with open(filename, 'r') as fp:

View File

@ -10,7 +10,6 @@ from gi.repository import Gtk, Gdk, GObject, Pango
from . import Actions, Utils, Constants
from .Dialogs import SimpleTextDisplay
import six
class PropsDialog(Gtk.Dialog):
@ -232,7 +231,7 @@ class PropsDialog(Gtk.Dialog):
docstrings = {block_class: docstrings[block_class]}
# show docstring(s) extracted from python sources
for cls_name, docstring in six.iteritems(docstrings):
for cls_name, docstring in docstrings.items():
buf.insert_with_tags_by_name(pos, cls_name + '\n', 'b')
buf.insert(pos, docstring + '\n\n')
pos.backward_chars(2)

View File

@ -13,7 +13,6 @@ import numbers
from gi.repository import GLib
import cairo
import six
from .canvas.colors import FLOWGRAPH_BACKGROUND_COLOR
from . import Constants
@ -95,16 +94,7 @@ def num_to_str(num):
def encode(value):
"""Make sure that we pass only valid utf-8 strings into markup_escape_text.
Older versions of glib seg fault if the last byte starts a multi-byte
character.
"""
if six.PY2:
valid_utf8 = value.decode('utf-8', errors='replace').encode('utf-8')
else:
valid_utf8 = value
return GLib.markup_escape_text(valid_utf8)
return GLib.markup_escape_text(value)
def make_screenshot(flow_graph, file_path, transparent_bg=False):

View File

@ -9,7 +9,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
import math
import six
from gi.repository import Gtk, Pango, PangoCairo
from . import colors
@ -123,7 +122,7 @@ class Block(CoreBlock, Drawable):
port_separation = PORT_SEPARATION if not has_busses else ports[0].height + PORT_SPACING
offset = (self.height - (len(ports) - 1) * port_separation - ports[0].height) / 2
for port in ports:
port.create_shapes()
port.create_shapes()
port.coordinate = {
0: (+self.width, offset),
90: (offset, -port.width),
@ -153,7 +152,7 @@ class Block(CoreBlock, Drawable):
)
)
title_width, title_height = title_layout.get_size()
force_show_id = Actions.TOGGLE_SHOW_BLOCK_IDS.get_active()
# update the params layout
@ -186,7 +185,7 @@ class Block(CoreBlock, Drawable):
min_height = 2 * PORT_BORDER_SEPARATION + sum(
port.height + PORT_SPACING for port in ports if port.dtype == 'bus'
) - PORT_SPACING
else:
if ports:
min_height -= ports[-1].height
@ -344,7 +343,7 @@ class Block(CoreBlock, Drawable):
type_templates = ' '.join(p.dtype for p in self.params.values()) + ' '
type_templates += ' '.join(p.get_raw('dtype') for p in (self.sinks + self.sources))
type_param = None
for key, param in six.iteritems(self.params):
for key, param in self.params.items():
if not param.is_enum():
continue
# Priority to the type controller
@ -381,7 +380,7 @@ class Block(CoreBlock, Drawable):
# Concat the nports string from the private nports settings of all ports
nports_str = ' '.join(str(port.get_raw('multiplicity')) for port in self.ports())
# Modify all params whose keys appear in the nports string
for key, param in six.iteritems(self.params):
for key, param in self.params.items():
if param.is_enum() or param.key not in nports_str:
continue
# Try to increment the port controller by direction
@ -394,4 +393,3 @@ class Block(CoreBlock, Drawable):
# Should we be logging something here
pass
return changed

View File

@ -8,8 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
from ..Constants import LINE_SELECT_SENSITIVITY
from six.moves import zip
class Drawable(object):
"""

View File

@ -13,9 +13,7 @@ import random
from distutils.spawn import find_executable
from itertools import count
import six
from gi.repository import GLib, Gtk
from six.moves import filter
from . import colors
from .drawable import Drawable