You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Adds ChainedAttribute.attribute_chain to be able view all members of a lengthy chained attribute in a list - Can easily now traverse a lengthy chained attribute - i.e calling attribute_chain on one of the functionCalls or one of the ChainedAttributes of `a().b().c.d.e()` -> `[FunctionCall(name=a), FunctionCall(name=b), Name(source=c), Name(source=d), FunctionCall(name=e)]` --------- Signed-off-by: dependabot[bot] <support@github.com>
"""Returns a list of elements in the chainedAttribute that the function call belongs in.
634
+
635
+
Breaks down chained expressions into individual components in order of appearance.
636
+
For example: `a.b.c().d` -> [Name("a"), Name("b"), FunctionCall("c"), Name("d")]
637
+
638
+
Returns:
639
+
list[FunctionCall | Name]: List of Name nodes (property access) and FunctionCall nodes (method calls)
640
+
"""
641
+
ifisinstance(self.get_name(), ChainedAttribute): # child is chainedAttribute. MEANING that this is likely in the middle or the last function call of a chained function call chain.
642
+
returnself.get_name().attribute_chain
643
+
elifisinstance(
644
+
self.parent, ChainedAttribute
645
+
): # does not have child chainedAttribute, but parent is chainedAttribute. MEANING that this is likely the TOP function call of a chained function call chain.
0 commit comments