def find_commands(management_dir):
    """
    Given a path to a management directory, returns a list of all the command
    names that are available.

    Returns an empty list if no commands are defined.
    """
    command_dir = os.path.join(management_dir, 'commands')
    try:
        return [f[:-3] for f in os.listdir(command_dir)
                if not f.startswith('_') and f.endswith('.py')]
    except __HOLE__:
        return []
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/core/management/__init__.py/find_commands