Last active
November 16, 2020 08:34
-
-
Save katipogluMustafa/5e37b4848aedfb3ef9e261db89f92df9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from constraints.interval import Interval, TimebinInterval, MaxLimitInterval | |
class TimeConstraint: | |
def is_valid_timebin(interval: Interval): | |
return TimeConstraint.__is_expected_class(interval, TimebinInterval) and interval.is_valid() | |
def is_valid_max_limit(interval: Interval): | |
return TimeConstraint.__is_expected_class(interval, MaxLimitInterval) and interval.is_valid() | |
def __is_expected_class(interval: Interval, target_class: type): | |
if interval is None: | |
return False | |
if not isinstance(interval, target_class): | |
return False | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment