Module Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If CompareEq NameLoad AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Break orelse If CompareEq NameLoad AttributeLoad NameLoad attr body Break orelse If CompareEq NameLoad AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr orelse If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Break orelse If CompareEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr orelse If CompareEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice Num Num orelse If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr orelse If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr orelse If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr orelse If BoolOpOr CompareEq NameLoad AttributeLoad NameLoad attr CompareEq NameLoad AttributeLoad NameLoad attr body If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr orelse If BoolOpAnd CompareLt NameLoad Num CompareGtE NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpAdd AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr IfExp NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Return Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Num If NameLoad body AugAssignAdd NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Slice Num Num If NameLoad body AugAssignAdd NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr IfExp Call NameLoad AttributeLoad NameLoad attr BinOpMod BinOpAdd AttributeLoad NameLoad attr Num Call NameLoad AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr IfExp Call NameLoad AttributeLoad NameLoad attr BinOpMod BinOpSub AttributeLoad NameLoad attr Num Call NameLoad AttributeLoad NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body If Call NameLoad AttributeLoad NameLoad attr body Return SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr orelse Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot CompareIn NameLoad AttributeLoad NameLoad attr body Return Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad If UnaryOpNot NameLoad body For NameStore NameLoad body Assign NameStore SubscriptLoad NameLoad Slice BinOpAdd Call NameLoad NameLoad AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr For NameStore NameLoad body If CompareIn NameLoad Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpAdd BinOpAdd NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults Call AttributeLoad NameLoad attr Return Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Num If UnaryOpNot Call NameLoad NameLoad body AugAssignAdd NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignAdd NameStore Call NameLoad BinOpMult Call NameLoad NameLoad Num Num If UnaryOpNot NameLoad body Return NameLoad Assign NameStore Call NameLoad GeneratorExp NameLoad comprehension NameStore NameLoad CompareIn NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr Str NameLoad NameLoad If CompareIn NameLoad NameLoad body If CompareGt Call NameLoad NameLoad Num body AugAssignAdd NameStore BinOpMult Num BinOpAdd Call NameLoad Call AttributeLoad NameLoad attr NameLoad Num Num orelse If Call AttributeLoad NameLoad attr NameLoad body AugAssignAdd NameStore BinOpMult Num Num orelse AugAssignAdd NameStore BinOpMult Num BinOpAdd Num Call NameLoad Call AttributeLoad NameLoad attr NameLoad Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareIn NameLoad NameLoad body Return Call AttributeLoad NameLoad attr NameLoad orelse Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body If Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return NameLoad Return NameLoad decorator_list
N/A N/A os N/A re N/A keys N/A ui N/A readchar N/A dirhandler get_selected_command_or_input N/A N/A search N/A N/A N/A state N/A State search N/A N/A N/A ui refresh state N/A N/A prompt state N/A N/A N/A ui erase N/A N/A state input N/A prompt N/A N/A state N/A N/A N/A True N/A N/A c N/A N/A readchar get_symbol N/A N/A c N/A keys ENTER N/A N/A N/A N/A state get_matches N/A N/A N/A N/A state append_match_to_input N/A N/A N/A N/A c N/A keys CTRL_F N/A N/A N/A N/A N/A c N/A keys TAB N/A N/A N/A N/A state get_matches N/A N/A N/A N/A state append_match_to_input N/A N/A N/A N/A c N/A keys CTRL_C N/A c N/A keys ESC N/A N/A N/A N/A state reset_input N/A N/A N/A N/A c N/A keys CTRL_U N/A N/A N/A N/A state clear_input N/A N/A N/A c N/A keys BACKSPACE N/A N/A N/A N/A state set_input N/A N/A state input N/A 0 -1 N/A N/A N/A N/A c N/A keys UP N/A c N/A keys CTRL_K N/A N/A N/A N/A state select_previous N/A N/A N/A N/A c N/A keys DOWN N/A c N/A keys CTRL_J N/A N/A N/A N/A state select_next N/A N/A N/A N/A c N/A keys LEFT N/A c N/A keys CTRL_H N/A N/A N/A N/A state go_back N/A N/A N/A N/A c N/A keys RIGHT N/A c N/A keys CTRL_L N/A N/A N/A N/A state get_matches N/A N/A N/A N/A state append_match_to_input N/A N/A N/A N/A c 256 N/A c 32 N/A N/A N/A N/A state set_input N/A N/A state input N/A chr c N/A N/A N/A ui refresh state N/A State N/A object N/A N/A  The Current User state, including user written characters, matched commands, and selected one  __init__ N/A N/A self default_input N/A N/A N/A N/A self _selected_command_index 0 N/A N/A self matches N/A N/A N/A self default_input default_input N/A N/A N/A self set_input default_input N/A get_matches N/A N/A self N/A N/A N/A N/A self matches N/A reset_input N/A N/A self N/A N/A N/A N/A self input N/A self default_input N/A set_input N/A N/A self input N/A N/A N/A N/A self input N/A input input N/A N/A N/A self _update N/A append_match_to_input N/A N/A self N/A N/A N/A N/A N/A self set_input N/A N/A N/A os path join N/A N/A N/A os path dirname N/A self input N/A N/A self get_selected_match N/A go_back N/A N/A self N/A N/A N/A isdir N/A is_dir N/A self input N/A input_stripped N/A N/A N/A self input rstrip N/A os sep N/A N/A input_stripped N/A N/A N/A input_splitted N/A N/A input_stripped split N/A os sep N/A entry_name N/A input_splitted N/A -1 N/A isdir N/A N/A entry_name N/A os sep N/A new_input N/A N/A N/A os sep join N/A input_splitted N/A 0 -1 N/A new_input N/A N/A new_input N/A os sep N/A N/A N/A self set_input new_input N/A N/A N/A self set_selected_entry entry_name N/A clear_input N/A N/A self N/A N/A N/A N/A N/A self set_input N/A clear_selection N/A N/A self N/A N/A N/A N/A self _selected_command_index 0 N/A select_next N/A N/A self N/A N/A N/A N/A self _selected_command_index N/A N/A len N/A self matches N/A N/A N/A self _selected_command_index 1 N/A len N/A self matches 0 N/A select_previous N/A N/A self N/A N/A N/A N/A self _selected_command_index N/A N/A len N/A self matches N/A N/A N/A self _selected_command_index 1 N/A len N/A self matches 0 N/A _update N/A N/A self N/A N/A N/A N/A self matches N/A get_matches N/A N/A os getcwd N/A self input N/A N/A self _selected_command_index 0 N/A get_output N/A N/A self N/A N/A N/A N/A self input N/A get_selected_match N/A N/A self N/A N/A N/A N/A len N/A self matches N/A N/A N/A N/A self matches N/A N/A self _selected_command_index N/A N/A N/A Exception No matches found N/A set_selected_entry N/A N/A self entry N/A N/A N/A N/A N/A entry N/A self matches N/A N/A N/A N/A self _selected_command_index N/A N/A N/A self matches index entry N/A N/A get_matches N/A N/A root_dir user_input N/A N/A N/A start_dir N/A join_paths root_dir N/A N/A N/A os path dirname user_input N/A search_str N/A N/A N/A os path basename user_input N/A N/A N/A N/A N/A os path isdir start_dir N/A N/A N/A N/A source_files N/A N/A dirhandler get_source_files start_dir N/A filtered_files N/A filter_files source_files search_str N/A sorted_files N/A sort_matches filtered_files search_str N/A sorted_files N/A filter_files N/A N/A files search_str N/A N/A N/A  Filter a list of files based on a search string
        :param files: list of files to filter (ie ['/a','/a/b', '/a/b/c', '/b']), the order doesn't matter. 'a' and 'a/' are considered different.
        :param search_str, the filtering string (ie 'a')
        
        This function return only first level files/dirs that match the given search string. That is, filtering  ['/a','/a/b','/a/b/c'] with the string 'a' returns only ['/a'],
        This is to avoid polluting the screen with all files inside a directory when a user look for that directory
     N/A matched N/A set N/A N/A search_str N/A N/A f files N/A N/A f N/A f N/A N/A N/A _index_or_len f N/A os sep 1 N/A N/A N/A matched add f N/A N/A search_str N/A N/A search_str lower N/A f files N/A N/A N/A search_str N/A N/A f lower N/A N/A index N/A N/A N/A N/A f lower index search_str N/A trail N/A f N/A index N/A f N/A f N/A N/A N/A index N/A _index_or_len trail N/A os sep 1 N/A N/A N/A matched add f N/A matched N/A sort_matches N/A N/A matches string N/A N/A N/A  Sort paths according to a string  N/A files N/A sorted matches key N/A N/A N/A s N/A N/A N/A s lower N/A N/A sorted files key N/A N/A N/A p N/A N/A get_weight p string N/A get_weight N/A N/A path string N/A N/A N/A  calculate how much a path matches a given string on a scale of 0->10000, a lower number means a better match.
    The string should be present in the path, or this function will fail

    The weight is calculated using the following formula:
                                                    0  00  0
                                                    |  |   |
    Number of elements in the path <----------------|  |   |--------------------------> is a directory(0) or not(1)
    (ie 2 for 'aa/bb' and 3 for 'aa/bb/cc')            |
                                                       |
                                                       v
                        There is a word in the matched path element that exactly match the given string? ('aa_bb' matches user input 'aa' but doesn't match 'a')
                                                       |
                               No <--------------------|-----------------------------> yes
                                |                                                       |
                                |                                                       |
                                |                                                       |
                                v                                                       v
    path element starts with the user input?                    There is only one word in the matched path element ('aa' but not 'aa_bb'),
                       |                                             which means the path elements exactly match the string
                       |                                                                                    |
            No <-------|-----Yes(2)                                                                 No -----|----- Yes (0)
            |                                                                                       |
            v                                                                                       v
index of the string in the path element + 10                                 (index of the matched word within path element words + 1)
                                        

    Maximums are added to make sure things doesn't overlap
     N/A weight 0 N/A N/A N/A is_dir path N/A N/A weight 1 N/A string N/A N/A string lower N/A p N/A N/A N/A N/A path rstrip N/A os sep lower N/A path_elems N/A N/A p split N/A os sep N/A weight N/A min N/A N/A len path_elems 1000 10000 N/A N/A string N/A N/A weight N/A elm N/A next N/A e N/A e path_elems N/A string e N/A elm_words N/A _f N/A _f N/A N/A re split [\W_]+ elm _f N/A N/A string elm_words N/A N/A N/A N/A len elm_words 1 N/A N/A weight N/A 10 N/A N/A min N/A N/A elm_words index string 8 1 N/A N/A N/A N/A elm startswith string N/A N/A weight N/A 10 2 N/A N/A weight N/A 10 N/A 10 N/A min N/A N/A elm index string 89 N/A weight N/A join_paths N/A N/A p1 p2 N/A N/A N/A p1 N/A N/A N/A os path expandvars N/A N/A N/A os path expanduser p1 N/A p2 N/A N/A N/A os path expandvars N/A N/A N/A os path expanduser p2 N/A N/A N/A N/A os path normpath N/A N/A N/A os path join p1 p2 N/A _index_or_len N/A N/A s c N/A N/A N/A N/A c s N/A N/A N/A N/A s index c N/A N/A N/A len s N/A is_dir N/A N/A p N/A N/A N/A N/A N/A p endswith N/A os sep N/A N/A True N/A False N/A