We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4af9b1f commit 3cf5a9dCopy full SHA for 3cf5a9d
fuzzy_logic/fuzzy_operations.py
@@ -1,4 +1,5 @@
1
from __future__ import annotations
2
+
3
from dataclasses import dataclass
4
import matplotlib.pyplot as plt
5
import numpy as np
@@ -39,7 +40,10 @@ def membership(self, x: float) -> float:
39
40
return (x - self.left_boundary) / (self.peak - self.left_boundary)
41
elif self.peak < x < self.right_boundary:
42
return (self.right_boundary - x) / (self.right_boundary - self.peak)
- raise ValueError(f"Invalid value {x} for fuzzy set {self}")
43
44
+ # Assign the message to a variable before raising the exception
45
+ msg = f"Invalid value {x} for fuzzy set {self}"
46
+ raise ValueError(msg)
47
48
def union(self, other: FuzzySet) -> FuzzySet:
49
return FuzzySet(
0 commit comments