Skip to content

Commit

Permalink
errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lockwo committed Jul 14, 2024
1 parent 23b3042 commit b2c55e9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion equinox/_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,33 @@ def __init__(self, *args, **kwargs):
if not has_abstract_name:
# Invariant: abstract classes have names beginning with
# `Abstract`.
inner = " "
if len(cls.__abstractmethods__) > 0:
inner = (
inner
+ f"abstract methods: {list(cls.__abstractmethods__)}"
)
if len(cls.__abstractvars__) > 0:
if len(inner) > 2:
inner = inner + ", "
inner = (
inner
+ f"abstract variables: {list(cls.__abstractvars__)}"
)
if len(cls.__abstractclassvars__) > 0:
if len(inner) > 2:
inner = inner + ", "
inner = (
inner
+ f"abstract class variables: \
{list(cls.__abstractclassvars__)}"
)
inner = inner + "."
raise TypeError(
"Abstract strict `eqx.Module`s must be named starting "
f"with 'Abstract' or '_Abstract'. Got {name} when defining "
f"{cls.__module__}.{cls.__qualname__}.",
f"{cls.__module__}.{cls.__qualname__}. For concrete "
f"moduels, {name} has" + inner
)
else:
if has_abstract_name:
Expand Down

0 comments on commit b2c55e9

Please sign in to comment.