findbestmatch
Module to find the closest match of a string in a list
The findbestmatch module is accessible via the pywinauto module.
Attributes
Functions
f find_best_match(search_text, item_texts, items, limit_ratio=0.5) ...
Return the item that best matches the search_text
- search_text The text to search for
- item_texts The list of texts to search through
- items The list of items corresponding (1 to 1) to the list of texts to search through.
- limit_ratio How well the text has to match the best match. If the best match matches lower then this then it is not considered a match and a MatchError is raised, (default = .5)
f IsAboveOrToLeft(ref_control, other_ctrl) ...
Return true if the other_ctrl is above or to the left of ref_control
f GetNonTextControlName(ctrl, controls) ...
return the name for this control by finding the closest text control above and to its left
f build_unique_dict(controls) ...
Build the disambiguated list of controls
Separated out to a different function so that we can get the control identifiers for printing.
f find_best_control_matches(search_text, controls) ...
Returns the control that is the the best match to search_text
This is slightly differnt from find_best_match in that it builds up the list of text items to search through using information from each control. So for example for there is an OK, Button then the following are all added to the search list: "OK", "Button", "OKButton"
But if there is a ListView (which do not have visible 'text') then it will just add "ListView".
Classes
C MatchError(...) ...
A suitable match could not be found
This class contains 2 members.
C UniqueDict(...) ...
A dictionary subclass that handles making it's keys unique
This class contains 15 members.
See the source for more information.