Completion
Deprecated since version 2.26: Rarely used API
- class Completion(*args, **kwargs)
- Constructors:
Completion()
Methods
- class Completion
- clear_items() None
Removes all items from the
Completion
. The items are not freed, so if the memory was dynamically allocated, it should be freed after calling this function.Deprecated since version 2.26: Rarely used API
- complete_utf8(prefix: str, new_prefix: str) list[str]
Attempts to complete the string
prefix
using theCompletion
target items. In contrast tocomplete()
, this function returns the largest common prefix that is a valid UTF-8 string, omitting a possible common partial character.You should use this function instead of
complete()
if your items are UTF-8 strings.Added in version 2.4.
Deprecated since version 2.26: Rarely used API
- Parameters:
prefix – the prefix string, typically used by the user, which is compared with each of the items
new_prefix – if non-
None
, returns the longest prefix which is common to all items that matchedprefix
, orNone
if no items matchedprefix
. This string should be freed when no longer needed.
- free() None
Frees all memory used by the
Completion
. The items are not freed, so if the memory was dynamically allocated, it should be freed after calling this function.Deprecated since version 2.26: Rarely used API
Fields
- class Completion
- cache
The list of items which begin with
prefix
.
- func
Function which is called to get the string associated with a target item. It is
None
if the target items are strings.
- items
List of target items (strings or data structures).
- prefix
The last prefix passed to
complete()
orcomplete_utf8()
.
- strncmp_func
The function to use when comparing strings. Use
set_compare()
to modify this function.