flake8 standards

This commit is contained in:
stefandesouza
2023-12-03 21:04:58 +01:00
parent 23d10d10cb
commit 1885ce6ddb
17 changed files with 88 additions and 99 deletions

View File

@@ -10,7 +10,6 @@ from collections import OrderedDict
import ruamel.yaml
from osaca.semantics import MachineModel
from osaca.parser import instructionForm
from osaca.parser.memory import MemoryOperand
from osaca.parser.register import RegisterOperand
from osaca.parser.immediate import ImmediateOperand
@@ -437,7 +436,7 @@ def _check_sanity_arch_db(arch_mm, isa_mm, internet_check=True):
# Check operands
for operand in instr_form["operands"]:
if isinstance(operand, RegisterOperand) and not (
operand.name != None or operand.prefix != None
operand.name is not None or operand.prefix is not None
):
# Missing 'name' key
bad_operand.append(instr_form)
@@ -449,7 +448,7 @@ def _check_sanity_arch_db(arch_mm, isa_mm, internet_check=True):
):
# Missing at least one key necessary for memory operands
bad_operand.append(instr_form)
elif isinstance(operand, ImmediateOperand) and operand.type == None:
elif isinstance(operand, ImmediateOperand) and operand.type is None:
# Missing 'imd' key
bad_operand.append(instr_form)
# every entry exists twice --> uniquify
@@ -613,11 +612,11 @@ def _get_full_instruction_name(instruction_form):
for op in instruction_form["operands"]:
if isinstance(op, RegisterOperand):
op_attrs = []
if op.name != None:
if op.name is not None:
op_attrs.append("name:" + op.name)
if op.prefix != None:
if op.prefix is not None:
op_attrs.append("prefix:" + op.prefix)
if op.shape != None:
if op.shape is not None:
op_attrs.append("shape:" + op.shape)
operands.append("{}({})".format("register", ",".join(op_attrs)))
return "{} {}".format(instruction_form["name"].lower(), ",".join(operands))