Open git-afsantos opened 7 years ago
A few ideas:
{
"name": "advertise",
"canonical_type": "ros::Publisher"
}
def q_function_calls(self, query_data):
matches = []
for obj in self._get_function_calls():
for key, value in query_data.items():
if hasattr(obj, key):
if callable(value) and value(getattr(obj, key)):
matches.append(obj)
elif getattr(obj, key) == value:
matches.append(obj)
return matches
First, and foremost,
CodeQuery
must provide support for other objects, besides references and function calls. It should also provide methods to look for functions, variables, classes, etc.Secondly, it could use some readability improvements when specifying
where
clauses. There could be a class,WhereClause
that is instantiated upon calling a singlewhere
property, after selecting the query objects (function, etc.). This helper class would provide methods to set the attributes that make sense, i.e., at leastname
andresult
. An alternative would be to instantiate a specific where class depending on the query objects, that would contain all the attributes that make sense.Ideal example: