@@ -89,11 +89,11 @@ def __init__(
89
89
self ._res = res
90
90
self ._sets = {} if sets is None else sets # Name: Set(Function())
91
91
92
- def __call__ (self , x : float ) -> dict [str , float ]:
92
+ def __call__ (self , x : float ) -> dict [Set , float ]:
93
93
"""Pass a value to all sets of the domain and return a dict with results."""
94
94
if not (self ._low <= x <= self ._high ):
95
95
raise FuzzyWarning (f"{ x } is outside of domain!" )
96
- return {name : s .func (x ) for name , s in self ._sets .items ()}
96
+ return {self . _sets [ name ] : s .func (x ) for name , s in self ._sets .items ()}
97
97
98
98
def __len__ (self ) -> int :
99
99
"""Return the size of the domain, as the actual number of possible values, calculated internally."""
@@ -423,19 +423,18 @@ def __repr__(self) -> str:
423
423
"""
424
424
425
425
# experimental
426
- # x = f"{self.func.__qualname__.split('.')[0]}({self.func.__closure__[0].
427
- # cell_contents.__code__.co_nlocals}))"
426
+ # x = f"{self.func.__qualname__.split('.')[0]}({self.func.__closure__[0].cell_contents.__code__.co_nlocals}))" # noqa: E501
428
427
# print(x)
429
428
430
429
if self .domain is not None :
431
430
return f"{ self .domain ._name } .{ self .name } " # type: ignore
432
- return f"Set({ __name__ } ({ self .func .__qualname__ } )"
431
+ return f"Set(({ self .func .__qualname__ } )"
433
432
434
433
def __str__ (self ) -> str :
435
434
"""Return a string for print()."""
436
435
if self .domain is not None :
437
436
return f"{ self .domain ._name } .{ self .name } " # type: ignore
438
- return f"dangling Set({ self .func .__name__ } "
437
+ return f"Set({ self .func .__name__ } ) "
439
438
440
439
def normalized (self ) -> Set :
441
440
"""Return a set that is normalized *for this domain* with 1 as max."""
0 commit comments