diff --git a/capa/main.py b/capa/main.py index 3e4af74e..fc932576 100644 --- a/capa/main.py +++ b/capa/main.py @@ -392,6 +392,7 @@ class ShouldExitError(Exception): """raised when a main-related routine indicates the program should exit.""" def __init__(self, status_code: int): + super().__init__(status_code) self.status_code = status_code diff --git a/capa/rules/__init__.py b/capa/rules/__init__.py index b5a0911b..da0a7d03 100644 --- a/capa/rules/__init__.py +++ b/capa/rules/__init__.py @@ -274,12 +274,8 @@ SUPPORTED_FEATURES[Scope.FUNCTION].update(SUPPORTED_FEATURES[Scope.BASIC_BLOCK]) class InvalidRule(ValueError): - def __init__(self, msg): - super().__init__() - self.msg = msg - def __str__(self): - return f"invalid rule: {self.msg}" + return f"invalid rule: {super().__str__()}" def __repr__(self): return str(self) @@ -289,20 +285,15 @@ class InvalidRuleWithPath(InvalidRule): def __init__(self, path, msg): super().__init__(msg) self.path = path - self.msg = msg self.__cause__ = None def __str__(self): - return f"invalid rule: {self.path}: {self.msg}" + return f"invalid rule: {self.path}: {super(InvalidRule, self).__str__()}" class InvalidRuleSet(ValueError): - def __init__(self, msg): - super().__init__() - self.msg = msg - def __str__(self): - return f"invalid rule set: {self.msg}" + return f"invalid rule set: {super().__str__()}" def __repr__(self): return str(self) diff --git a/pyproject.toml b/pyproject.toml index a655ca6f..9052142d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -127,7 +127,7 @@ dev = [ "pytest-sugar==1.1.1", "pytest-instafail==0.5.0", "flake8==7.3.0", - "flake8-bugbear==24.12.12", + "flake8-bugbear==25.10.21", "flake8-encodings==0.5.1", "flake8-comprehensions==3.17.0", "flake8-logging-format==0.9.0",