Skip to content

Commit

Permalink
refactor: rename util class
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Feb 27, 2024
1 parent 01386c8 commit 3c8cdd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flexmeasures/data/schemas/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(
super().__init__(*args, **kwargs)
if _validate is not None:
# Insert validation into self.validators so that multiple errors can be stored.
validator = QuantityOrSensorValidator(_validate)
validator = RepurposeValidatorToIgnoreSensors(_validate)
self.validators.insert(0, validator)
self.to_unit = ur.Quantity(to_unit)
self.default_src_unit = default_src_unit
Expand Down Expand Up @@ -187,7 +187,7 @@ def convert(self, value, param, ctx, **kwargs):
return super().convert(_value, param, ctx, **kwargs)


class QuantityOrSensorValidator(validate.Validator):
class RepurposeValidatorToIgnoreSensors(validate.Validator):
"""Validator that executes another validator (the one you initialize it with) only on non-Sensor values."""

def __init__(self, original_validator, *, error: str | None = None):
Expand Down

0 comments on commit 3c8cdd9

Please sign in to comment.