Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support defaults in FrozenObjects #1618

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Support defaults in FrozenObjects #1618

wants to merge 6 commits into from

Conversation

tbekolay
Copy link
Member

@tbekolay tbekolay commented May 18, 2020

Motivation and context:
In #1615, I noticed that LearningRuleType supports Default arguments, but no other FrozenObject types do. Since it seems like they should, I moved that ability to the FrozenObject class, and made use of that ability in all the subclasses.

A few side effects / cleanups done in the process were to remove the SupportDefaultsMixin and to move the FrozenObject to base.py.

Interactions with other PRs:
Based on #1615.

How has this been tested?
All unit tests passed without modification.

How long should this take to review?

  • Average (neither quick nor lengthy)

Where should a reviewer start?
Probably go commit by commit, the last commit has the biggest diff but is the smallest conceptual change.

Types of changes:

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have read the CONTRIBUTING.rst document.
  • I have updated the documentation accordingly.
  • I have included a changelog entry.
  • [na] I have added tests to cover my changes.
  • I have run the test suite locally and all tests passed.

Still to do:

Still need to do changelog entries, but wanted to make sure people think this is a good idea before writing it.

WAEliasmith and others added 6 commits May 15, 2020 10:57
Added tests for processes, solvers, transforms, and learning rules
This commit also fixes a bug in FrozenObject.__repr__ for
arguments that were being passed `Default`. previously they
would always show up in the repr because the resolved default
value is different from what shows up in the `defaults` dict,
which will always be `nengo.Default`.
Previously, Default was only supported in NengoObject and
LearningRuleType. In order to support it in more FrozenObject
subclasses, we effectively wanted to add the SupportDefaultsMixin
to FrozenObject; however, we needed a slight change in logic in
FrozenObject, so we opted for a small amount of duplication to
allow us to remove SupportDefaultsMixin. The previous behavior
is now in NengoObject.__setattr__ and the slightly changed logic
is in FrozenObject.__setattr__.
@tbekolay tbekolay changed the title Support defaults Support defaults in FrozenObjects May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants