Created
July 15, 2015 10:13
-
-
Save ibizaman/5a141c887e7e8c5e176a to your computer and use it in GitHub Desktop.
Remove find functionality from RedBaron's getattr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __getattr__(self, key): | |
- return self.find(key) | |
+ for i in self.data: | |
+ if key in i._identifiers: | |
+ return i | |
def __getattr__(self, key): | |
- if key.endswith("_") and key[:-1] in self._all_my_keys(): | |
- return getattr(self, key[:-1]) | |
- | |
if key != "value" and hasattr(self, "value") and isinstance(self.value, ProxyList) and hasattr(self.value, key): | |
return getattr(self.value, key) | |
- return self.find(key) | |
+ if key in self._identifiers: | |
+ return self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment