Commit 5737f8a5 authored by Nsukami Patrick's avatar Nsukami Patrick
Browse files

[mypy] Fix has no attribute errors

These attributes (expression, operator, boundary) are specific to some kind of constraints.
We shouldn't expect them to be present in every constraints.
Let's keep the type ignore in diff.py for the moment.
parent 6b294384c1ee
Pipeline #99608 passed with stages
in 1 minute and 37 seconds
......@@ -142,7 +142,7 @@ def format_constraint(cstr: IConstraint) -> str:
cclass = cstr.__class__.__name__
if "RQL" in cclass:
out = ["%s(%s" % (cclass, quoted(cstr.expression))]
out = ["%s(%s" % (cclass, quoted(cstr.expression))] # type:ignore[attr-defined]
mainvars = getattr(cstr, "mainvars", None)
if mainvars:
......@@ -150,7 +150,11 @@ def format_constraint(cstr: IConstraint) -> str:
out.append(")")
elif "Boundary" in cclass:
return "%s(%s %s)" % (cclass, quoted(cstr.operator), str(cstr.boundary))
return "%s(%s %s)" % (
cclass,
quoted(cstr.operator),
str(cstr.boundary),
) # type:ignore[attr-defined]
else:
print("formatter: unhandled constraint type", cstr.__class__)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment