-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Desired change
- Rule(s): SIM119
- Adjustment: SIM119 should be more precise.
Explanation
Examples below are suggested as dataclass. I think they shouldnt
Example
class RegexAssert:
def __init__(self, pattern, flags=0):
self._regex = re.compile(pattern, flags)
def __eq__(self, actual):
return bool(self._regex.match(actual))
def __repr__(self):
return self._regex.patternclass OfType:
"""
>>> 3 == OfType(int, str, bool)
True
>>> 'txt' == OfType(int)
False
"""
def __init__(self, *types):
self.type = types
def __eq__(self, other):
return isinstance(other, self.type)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request