diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-05-04 10:58:15 -0700 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-05-12 12:04:11 -0500 |
commit | 5edb92536fbccdbdd399a068c0f57cfd14218d8c (patch) | |
tree | 0bd5dc758d99725df8cf251495568d820b5570f9 /host/python | |
parent | 1eecf8cf532fab95f6a1cfe2cb812cadfa543182 (diff) | |
download | uhd-5edb92536fbccdbdd399a068c0f57cfd14218d8c.tar.gz uhd-5edb92536fbccdbdd399a068c0f57cfd14218d8c.tar.bz2 uhd-5edb92536fbccdbdd399a068c0f57cfd14218d8c.zip |
rfnoc: Remove 'six' dependency from image builder
Also fixes a few minor PyLint complaints.
Diffstat (limited to 'host/python')
4 files changed, 22 insertions, 22 deletions
diff --git a/host/python/uhd/imgbuilder/image_builder.py b/host/python/uhd/imgbuilder/image_builder.py index 4f5f416d6..995e26047 100755 --- a/host/python/uhd/imgbuilder/image_builder.py +++ b/host/python/uhd/imgbuilder/image_builder.py @@ -15,7 +15,6 @@ import os import re import sys -import six import mako.lookup import mako.template from mako import exceptions @@ -109,7 +108,7 @@ def expand_io_port_desc(io_ports, signatures): :param signatures: signature description from yml configuration :return: None """ - for name, io_port in six.iteritems(io_ports): + for io_port in io_ports.values(): wires = [] for signature in signatures[io_port["type"]]["ports"]: width = signature.get("width", 1) @@ -214,7 +213,7 @@ class ImageBuilderConfig: then unroll that port into multiple ports of the same name plus a number to make its name unique. """ - for name, block in six.iteritems(self.noc_blocks): + for name, block in self.noc_blocks.items(): desc = self.blocks[block["block_desc"]] # Update per-instance parameters if not hasattr(desc, "parameters"): @@ -225,7 +224,7 @@ class ImageBuilderConfig: if key not in desc.parameters: logging.error("Unknown parameter %s for block %s", key, name) del block["parameters"][key] - for param, value in six.iteritems(desc.parameters): + for param, value in desc.parameters.items(): if param not in block["parameters"]: block["parameters"][param] = value # Generate list of block ports, adding 'index' to each port's dict @@ -280,7 +279,7 @@ class ImageBuilderConfig: (_device_ for io ports of the bsp), the io port name and flow direction. """ - for name, block in six.iteritems(self.noc_blocks): + for name, block in self.noc_blocks.items(): desc = self.blocks[block["block_desc"]] if hasattr(desc, "io_ports"): self.io_ports.update({ @@ -296,7 +295,7 @@ class ImageBuilderConfig: (_device_ for clocks of the bsp), the clock name and flow direction """ - for name, block in six.iteritems(self.noc_blocks): + for name, block in self.noc_blocks.items(): desc = self.blocks[block["block_desc"]] if hasattr(desc, "clocks"): self.clocks.update({ @@ -444,10 +443,10 @@ def read_grc_block_configs(path): """ result = {} - for root, dirs, names in os.walk(path): + for root, _dirs, names in os.walk(path): for name in names: if re.match(r".*\.block\.yml", name): - with open (os.path.join(root, name)) as stream: + with open(os.path.join(root, name)) as stream: config = ordered_load(stream) result[config["id"]] = config @@ -462,7 +461,6 @@ def convert_to_image_config(grc, grc_config_path): """ grc_blocks = read_grc_block_configs(grc_config_path) #filter all blocks that have no block representation - all = {item["name"]: item for item in grc["blocks"]} seps = {item["name"]: item for item in grc["blocks"] if item["parameters"]["type"] == 'sep'} blocks = {item["name"]: item for item in grc["blocks"] if item["parameters"]["type"] == 'block'} device = [item for item in grc["blocks"] if item["parameters"]["type"] == 'device'] @@ -489,15 +487,20 @@ def convert_to_image_config(grc, grc_config_path): result["stream_endpoints"] = {} for sep in seps.values(): - result["stream_endpoints"][sep["name"]] = { "ctrl": bool(sep["parameters"]["ctrl"]), - "data": bool(sep["parameters"]["data"]), - "buff_size": int(sep["parameters"]["buff_size"]) } + result["stream_endpoints"][sep["name"]] = {"ctrl": bool(sep["parameters"]["ctrl"]), + "data": bool(sep["parameters"]["data"]), + "buff_size": int(sep["parameters"]["buff_size"])} result["noc_blocks"] = {} for block in blocks.values(): - result["noc_blocks"][block["name"]] = { "block_desc": block["parameters"]["desc"] } - - device_clocks = {port["id"]: port for port in grc_blocks[device['id']]["outputs"] if port["dtype"] == "message"} + result["noc_blocks"][block["name"]] = { + "block_desc": block["parameters"]["desc"] + } + + device_clocks = { + port["id"]: port for port in grc_blocks[device['id']]["outputs"] + if port["dtype"] == "message" + } for connection in grc["connections"]: if connection[0] == device["name"]: diff --git a/host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako b/host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako index abfb86c98..d0f90c3e4 100644 --- a/host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako @@ -1,7 +1,6 @@ <%page args="io_ports"/>\ -<%import six%>\ //// IO ports ////////////////////////////////// -%for name, io_port in six.iteritems(io_ports): +%for name, io_port in io_ports.items(): // ${name} %for wire in io_port["wires"]: ${wire["direction"]} wire [${"%3d" % wire["width"]}-1:0] ${wire["name"]}, diff --git a/host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako b/host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako index ee4a811a8..064118db7 100644 --- a/host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako @@ -2,7 +2,6 @@ \ <% import re - import six # Create two strings, one for the input and one for the output, that each # contains all the signal names to be connected to the input or output @@ -38,7 +37,7 @@ wire ${axis_outputs.format("m", "tready")}; %if hasattr(block, "io_ports"): - %for name, io_port in six.iteritems(block.io_ports): + %for name, io_port in block.io_ports.items(): // ${name} %for wire in io_port["wires"]: wire [${"%3d" % wire["width"]}-1:0] ${block_name}_${wire["name"]}; @@ -49,7 +48,7 @@ rfnoc_block_${block.module_name} #( .THIS_PORTID(${block_id}), .CHDR_W(CHDR_W), -%for name, value in six.iteritems(block_params): +%for name, value in block_params.items(): .${name}(${value}), %endfor .MTU(MTU) @@ -65,7 +64,7 @@ .rfnoc_core_status (rfnoc_core_status[512*${block_number + 1}-1:512*${block_number}]), %if hasattr(block, "io_ports"): - %for name, io_port in six.iteritems(block.io_ports): + %for name, io_port in block.io_ports.items(): %for wire in io_port["wires"]: .${wire["name"]}(${block_name}_${wire["name"]}), %endfor diff --git a/host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako b/host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako index f8ecccb77..5cb88b6c1 100644 --- a/host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako @@ -2,7 +2,6 @@ <% import math import re - import six axis_inputs = {} axis_outputs = {} |