def find_commands(management_dir):
 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 OSError:
  return []

def find_commands ( management_dir ) : 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 OSError : return [ ]
given a path to a management directory .