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

Method _make_cand

pgcli/pgcompleter.py:758–782  ·  view source on GitHub ↗

Returns a Candidate namedtuple. :param tbl is a SchemaObject :param arg_mode determines what type of arg list to suffix for functions. Possible values: call, signature

(self, tbl, do_alias, suggestion, arg_mode=None)

Source from the content-addressed store, hash-verified

756 )
757
758 def _make_cand(self, tbl, do_alias, suggestion, arg_mode=None):
759 """Returns a Candidate namedtuple.
760
761 :param tbl is a SchemaObject
762 :param arg_mode determines what type of arg list to suffix for functions.
763 Possible values: call, signature
764
765 """
766 cased_tbl = self.case(tbl.name)
767 if do_alias:
768 alias = self.alias(cased_tbl, suggestion.table_refs)
769 synonyms = (cased_tbl, generate_alias(cased_tbl, alias_map=self.alias_map))
770 maybe_alias = (" " + alias) if do_alias else ""
771 maybe_schema = (self.case(tbl.schema) + ".") if tbl.schema else ""
772 suffix = self._arg_list_cache[arg_mode][tbl.meta] if arg_mode else ""
773 if arg_mode == "call":
774 display_suffix = self._arg_list_cache["call_display"][tbl.meta]
775 elif arg_mode == "signature":
776 display_suffix = self._arg_list_cache["signature"][tbl.meta]
777 else:
778 display_suffix = ""
779 item = maybe_schema + cased_tbl + suffix + maybe_alias
780 display = maybe_schema + cased_tbl + display_suffix + maybe_alias
781 prio2 = 0 if tbl.schema else 1
782 return Candidate(item, synonyms=synonyms, prio2=prio2, display=display)
783
784 def get_table_matches(self, suggestion, word_before_cursor, alias=False):
785 tables = self.populate_schema_objects(suggestion.schema, "tables")

Callers 4

get_function_matchesMethod · 0.95
get_table_matchesMethod · 0.95
get_view_matchesMethod · 0.95
get_datatype_matchesMethod · 0.95

Calls 4

caseMethod · 0.95
aliasMethod · 0.95
generate_aliasFunction · 0.85
CandidateFunction · 0.85

Tested by

no test coverage detected