Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dboyliao committed Aug 22, 2020
1 parent 7a04b44 commit 15f8948
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ def is_supported(cls, op_type):
class _OperatorMeta(type):
def __new__(mcls, name, bases, attrib):
attrib["_cache"] = {}
cls = type.__new__(mcls, name, bases, attrib)
for key in ["get_type_signature", "get_constructor_parameters"]:
func = attrib.get(key)
func = getattr(cls, key)
if func is None:
continue
if not must_return_type.return_type_is_ensured(func):
attrib[key] = must_return_type(Hashable)(func)
setattr(cls, key, must_return_type(Hashable)(func))
elif not issubclass(must_return_type.get_expect_type(func), Hashable):
raise RuntimeError(
"{}.{} must be ensured to return {}".format(name, key, Hashable)
)
cls = type.__new__(mcls, name, bases, attrib)
return cls


Expand Down

0 comments on commit 15f8948

Please sign in to comment.