

def _get_available(recommended=False, restart=False):
    "\n    Utility function to get all available update packages.\n\n    Sample return date:\n    { 'updatename': '1.2.3-45', ... }\n    "
    cmd = ['softwareupdate', '--list']
    out = salt.utils.mac_utils.execute_return_result(cmd)
    rexp = re.compile('(?m)^   [*|-] ([^ ].*)[\\r\\n].*\\(([^\\)]+)')
    if salt.utils.is_true(recommended):
        rexp = re.compile('(?m)^   [*] ([^ ].*)[\\r\\n].*\\(([^\\)]+)')
    keys = ['name', 'version']
    _get = (lambda l, k: l[keys.index(k)])
    updates = rexp.findall(out)
    ret = {
        
    }
    for line in updates:
        name = _get(line, 'name')
        version_num = _get(line, 'version')
        ret[name] = version_num
    if (not salt.utils.is_true(restart)):
        return ret
    rexp1 = re.compile('(?m)^   [*|-] ([^ ].*)[\\r\\n].*restart*')
    restart_updates = rexp1.findall(out)
    ret_restart = {
        
    }
    for update in ret:
        if (update in restart_updates):
            ret_restart[update] = ret[update]
    return updates

dataset/ETHPy150Open saltstack/salt/salt/modules/mac_softwareupdate.py _get_available/VarMisuse@219/393 `ret_restart`->`updates`