MCPcopy Index your code
hub / github.com/dbcli/pgcli / populate_functions

Method populate_functions

pgcli/pgcompleter.py:959–981  ·  view source on GitHub ↗

Returns a list of function SchemaObjects. :param filter_func is a function that accepts a FunctionMetadata namedtuple and returns a boolean indicating whether that function should be kept or discarded

(self, schema, filter_func)

Source from the content-addressed store, hash-verified

957 ]
958
959 def populate_functions(self, schema, filter_func):
960 """Returns a list of function SchemaObjects.
961
962 :param filter_func is a function that accepts a FunctionMetadata
963 namedtuple and returns a boolean indicating whether that
964 function should be kept or discarded
965
966 """
967
968 # Because of multiple dispatch, we can have multiple functions
969 # with the same name, which is why `for meta in metas` is necessary
970 # in the comprehensions below
971 return [
972 SchemaObject(
973 name=func,
974 schema=(self._maybe_schema(schema=sch, parent=schema)),
975 meta=meta,
976 )
977 for sch in self._get_schemas("functions", schema)
978 for (func, metas) in self.dbmetadata["functions"][sch].items()
979 for meta in metas
980 if filter_func(meta)
981 ]

Callers 1

get_function_matchesMethod · 0.95

Calls 3

_maybe_schemaMethod · 0.95
_get_schemasMethod · 0.95
SchemaObjectFunction · 0.85

Tested by

no test coverage detected