A handler's types are joined with or or and, so one class is matched
What it finds
except ValueError or TypeError: evaluates ValueError or TypeError first, which is ValueError, so the handler catches only that one. A tuple, except (ValueError, TypeError):, catches either.
From the rule's source, except_joined_types.rs.
def parse(text): try: return int(text) except ValueError or TypeError:tx0 reports: ValueError or TypeError is one exception type, the first of them return None except (KeyError and IndexError):tx0 reports: the last of them return None except (OSError, EOFError): return None Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/python:except-joined-types" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:except-joined-types] reason="..."tx0 explain tx0/python:except-joined-types shows the same in the terminal. Found a false positive? Report it.