Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@multimethod(object, bracket)
def join(seq, sep):
return sep[0] + join(seq, sep[1] + sep[0]) + sep[1]
@multimethod(paper, rock)
def roshambo(left, right):
return 'paper covers rock'
@multimethod(tree, object)
def join(seq, sep):
return join(seq.walk(), sep)
@multimethod(rock, scissors)
def roshambo(left, right):
return 'rock smashes scissors'
@multimethod(scissors, rock)
@multimethod(rock, scissors)
def roshambo(left, right):
return 'rock smashes scissors'
def test_get_type():
method = multimethod(lambda: None)
assert method.get_type is type
@method.register
def _(x: Union[int, type(None)]):
pass
assert method.get_type is type
@method.register
def _(x: List[int]):
pass
assert method.get_type is get_type
@multimethod(object, object)
def roshambo(left, right):
return 'tie'
@multimethod
def func(arg: bool):
return bool
@multimethod(CrossoverOperator, PermutationParameter, *args)
def apply_to(self, param, *args):
pass
@multimethod(DifferenceCrossoverOperator, ConfigurationManipulator, *args)
def apply_to(self, param, *args):
pass