Skip to content

Instantly share code, notes, and snippets.

@ibizaman
Created July 15, 2015 10:13
Show Gist options
  • Save ibizaman/5a141c887e7e8c5e176a to your computer and use it in GitHub Desktop.
Save ibizaman/5a141c887e7e8c5e176a to your computer and use it in GitHub Desktop.
Remove find functionality from RedBaron's getattr
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