MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / Completion

Class Completion

web/pgadmin/utils/sqlautocomplete/completion.py:11–87  ·  view source on GitHub ↗

:param text: The new string that will be inserted into the document. :param start_position: Position relative to the cursor_position where the new text will start. The text will be inserted between the start_position and the original cursor position. :param display: (opt

Source from the content-addressed store, hash-verified

9
10
11class Completion:
12 """
13 :param text: The new string that will be inserted into the document.
14 :param start_position: Position relative to the cursor_position where the
15 new text will start. The text will be inserted between the
16 start_position and the original cursor position.
17 :param display: (optional string) If the completion has to be displayed
18 differently in the completion menu.
19 :param display_meta: (Optional string) Meta information about the
20 completion, e.g. the path or source where it's coming from.
21 :param get_display_meta: Lazy `display_meta`. Retrieve meta information
22 only when meta is displayed.
23 """
24
25 def __init__(self, text, start_position=0, display=None, display_meta=None,
26 get_display_meta=None):
27 self.text = text
28 self.start_position = start_position
29 self._display_meta = display_meta
30 self._get_display_meta = get_display_meta
31
32 if display is None:
33 self.display = text
34 else:
35 self.display = display
36
37 assert self.start_position <= 0
38
39 def __repr__(self) -> str:
40 if isinstance(self.display, str) and self.display == self.text:
41 return "{}(text={!r}, start_position={!r})".format(
42 self.__class__.__name__,
43 self.text,
44 self.start_position,
45 )
46 else:
47 return "{}(text={!r}, start_position={!r}, display={!r})".format(
48 self.__class__.__name__,
49 self.text,
50 self.start_position,
51 self.display,
52 )
53
54 def __eq__(self, other: object) -> bool:
55 if not isinstance(other, Completion):
56 return False
57 return (
58 self.text == other.text and
59 self.start_position == other.start_position and
60 self.display == other.display and
61 self._display_meta == other._display_meta
62 )
63
64 def __hash__(self) -> int:
65 return hash((self.text, self.start_position, self.display,
66 self._display_meta))
67
68 @property

Callers 3

find_matchesMethod · 0.85
get_column_matchesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected