<commit_before>#!/usr/bin/env python
"""
Launchbox - Command launcher with tab completion and full shell commands.

Keys:

    tab             - cycle through tab completions
    shift-tab       - cycle backwards
    shift-backspace - delete all text
    ctrl-backspace  - delete word for word (Gtk only)
    enter           - run command
    escape          - close window

Launchbox will use the shell found in $SHELL or default to
/bin/sh. It uses the shell to get available commands (found by run
the shell and having it echo its $PATH) and to run the command (which
can be a full command line).
"""
import os
import sys
import tkinter
import tkinter.font
from pathlib import Path

__author__ = '<NAME>'
__email__ = '<EMAIL>'
__license__ = 'MIT'
__url__ = 'http://github.com/olemb/launchbox/'


def iter_path():
    for dirname in os.environ['PATH'].split(':'):
        yield Path(dirname).expanduser()


def get_commands():
    """Get a sorted list of all commands available to the shell."""
    commands = set()

    for dirname in set(iter_path()):
        if not dirname.is_dir():
            continue

        for command in dirname.iterdir():<commit_msg>No need for expanduser(). It's already expanded.<commit_after>#!/usr/bin/env python
"""
Launchbox - Command launcher with tab completion and full shell commands.

Keys:

    tab             - cycle through tab completions
    shift-tab       - cycle backwards
    shift-backspace - delete all text
    ctrl-backspace  - delete word for word (Gtk only)
    enter           - run command
    escape          - close window

Launchbox will use the shell found in $SHELL or default to
/bin/sh. It uses the shell to get available commands (found by run
the shell and having it echo its $PATH) and to run the command (which
can be a full command line).
"""
import os
import sys
import tkinter
import tkinter.font
from pathlib import Path

__author__ = '<NAME>'
__email__ = '<EMAIL>'
__license__ = 'MIT'
__url__ = 'http://github.com/olemb/launchbox/'


def get_commands():
    """Get a sorted list of all commands available to the shell."""
    commands = set()

    for dirname in map(Path, set(os.environ['PATH'].split(':'))):
        if not dirname.is_dir():
            continue

        for command in dirname.iterdir():
{'fraction_non_alphanumeric': 0.09333917616126206, 'fraction_numerical': 0.0, 'mean_word_length': 2.8369747899159665, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '561281', 'n_tokens_mistral': 655, 'n_tokens_neox': 642, 'n_words': 270}