From 59f3353e5dc5c36d59de2f73a03baaf4b2d1ed1d Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Wed, 20 Nov 2024 15:33:08 +0000 Subject: [PATCH] Merge argh --- kurbopy/magic.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/kurbopy/magic.py b/kurbopy/magic.py index 348c718..b99b977 100644 --- a/kurbopy/magic.py +++ b/kurbopy/magic.py @@ -25,41 +25,9 @@ def do_magic(self, rhs, methodname): raise TypeError("Cannot %s %s by %s" % (methodname, mytype, other_type)) -<<<<<<< HEAD for method in ["mul", "add", "sub", "isub", "iadd"]: magic = functools.partial(do_magic, methodname=method) magic.__name__ = method magic.__doc__ = "Magic method " + method globals()["magic_" + method] = magic -======= -def magic_sub(self, rhs): - other_type = get_magic_name(rhs) - mytype = get_magic_name(self) - if hasattr(self, "_sub_" + other_type): - return getattr(self, "_sub_" + other_type)(rhs) - raise TypeError("Cannot subtract %s from %s" % (other_type, mytype)) - - -def magic_isub(self, rhs): - other_type = get_magic_name(rhs) - mytype = get_magic_name(self) - if hasattr(self, "_isub_" + other_type): - return getattr(self, "_isub_" + other_type)(rhs) - raise TypeError("Cannot subtract %s from %s" % (other_type, mytype)) - -def magic_add(self, rhs): - other_type = get_magic_name(rhs) - mytype = get_magic_name(self) - if hasattr(self, "_add_" + other_type): - return getattr(self, "_add_" + other_type)(rhs) - raise TypeError("Cannot add %s to %s" % (other_type, mytype)) - - -def magic_iadd(self, rhs): - other_type = get_magic_name(rhs) - mytype = get_magic_name(self) - if hasattr(self, "_iadd_" + other_type): - return getattr(self, "_iadd_" + other_type)(rhs) - raise TypeError("Cannot add %s to %s" % (other_type, mytype)) ->>>>>>> 729889f (Fix up magic operators)