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

GetAttr cleanup and doc #10

Merged
merged 4 commits into from Feb 18, 2020
Merged

GetAttr cleanup and doc #10

merged 4 commits into from Feb 18, 2020

Conversation

pete88b
Copy link
Contributor

@pete88b pete88b commented Feb 18, 2020

  • added docs and tests to help people understand GetAttr#_xtra https://forums.fast.ai/t/fastai-v2-chat/53518/108
  • added _component_attr_filter so we use the same logic in _dir and __getattr__
    • now _dir only returns attributes that will be accessible
    • i.e. if _xtra = ['lower'], you can't call .upper(), so I don't think it makes sense to have upper returned by __dir__
    • to do this, we need to reference _xtra from _dir - which means _xtra can't call _dir - or we'll recurse forever
  • changed self._dir() if self._xtra is None else self._dir() to self._dir()
    • i'm guessing this was/should have been self._dir() if self._xtra is None else self._xtra but as _dir uses _xtra in it's filter, we don't need a special condition for this now

I've not changed this but L#_xtra seems to be unused - might it make sense to remove this?

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

@jph00 jph00 merged commit 96de75c into fastai:master Feb 18, 2020
@jph00
Copy link
Member

jph00 commented Feb 18, 2020

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants