コード例 #1
0
ファイル: smu_advisor.py プロジェクト: ommaurya/csm
def is_superseded(smu_loader, smu_name_list, smu_name):
    for name in smu_name_list:
        smu_info = smu_loader.get_smu_info(name)
        if smu_info is not None:
            superseded_smus = comma_delimited_str_to_array(smu_info.supersedes)
            for superseded_smu in superseded_smus:
                if superseded_smu == smu_name:
                    return True
            
    return False
コード例 #2
0
ファイル: smu_advisor.py プロジェクト: ommaurya/csm
def get_all_prerequisites(smu_loader, prerequisite_set, smu_name):
    smu_info = smu_loader.get_smu_info(smu_name)
    if smu_info is not None:
        prerequisites = comma_delimited_str_to_array(smu_info.prerequisites)
        if len(prerequisites) > 0:
            for prerequisite in prerequisites:
                if prerequisite not in prerequisite_set:
                    prerequisite_set.add(prerequisite)

                get_all_prerequisites(smu_loader, prerequisite_set, prerequisite)
コード例 #3
0
ファイル: smu_advisor.py プロジェクト: ommaurya/csm
def get_all_superseded_bys(smu_loader, superseded_by_set, smu_name):
    smu_info = smu_loader.get_smu_info(smu_name)
    if smu_info is not None:
        superseded_bys = comma_delimited_str_to_array(smu_info.superseded_by)    
        if len(superseded_bys) > 0:
            for superseded_by in superseded_bys:
                if superseded_by not in superseded_by_set:
                    superseded_by_set.add(superseded_by)
                    
                get_all_superseded_bys(smu_loader, superseded_by_set, superseded_by)
コード例 #4
0
def is_superseded(smu_loader, smu_name_list, smu_name):
    for name in smu_name_list:
        smu_info = smu_loader.get_smu_info(name)
        if smu_info is not None:
            superseded_smus = comma_delimited_str_to_array(smu_info.supersedes)
            for superseded_smu in superseded_smus:
                if superseded_smu == smu_name:
                    return True

    return False
コード例 #5
0
def get_all_superseded_bys(smu_loader, superseded_by_set, smu_name):
    smu_info = smu_loader.get_smu_info(smu_name)
    if smu_info is not None:
        superseded_bys = comma_delimited_str_to_array(smu_info.superseded_by)
        if len(superseded_bys) > 0:
            for superseded_by in superseded_bys:
                if superseded_by not in superseded_by_set:
                    superseded_by_set.add(superseded_by)

                get_all_superseded_bys(smu_loader, superseded_by_set,
                                       superseded_by)
コード例 #6
0
def get_all_prerequisites(smu_loader, prerequisite_set, smu_name):
    smu_info = smu_loader.get_smu_info(smu_name)
    if smu_info is not None:
        prerequisites = comma_delimited_str_to_array(smu_info.prerequisites)
        if len(prerequisites) > 0:
            for prerequisite in prerequisites:
                if prerequisite not in prerequisite_set:
                    prerequisite_set.add(prerequisite)

                get_all_prerequisites(smu_loader, prerequisite_set,
                                      prerequisite)
コード例 #7
0
ファイル: smu_advisor.py プロジェクト: ommaurya/csm
def get_excluded_supersede_list(smu_info_list):
    smu_info_dict = get_dict_from_list(smu_info_list)
    resultant_list = []
    
    for smu_info in smu_info_list:
        superseded_by_smus = comma_delimited_str_to_array(smu_info.superseded_by)
        is_superseded = False
        for superseded_by_smu in superseded_by_smus:
            if superseded_by_smu in smu_info_dict:
                is_superseded = True
                break
            
        if not is_superseded:
            resultant_list.append(smu_info)
            
    return resultant_list
コード例 #8
0
def get_excluded_supersede_list(smu_info_list):
    smu_info_dict = get_dict_from_list(smu_info_list)
    resultant_list = []

    for smu_info in smu_info_list:
        superseded_by_smus = comma_delimited_str_to_array(
            smu_info.superseded_by)
        is_superseded = False
        for superseded_by_smu in superseded_by_smus:
            if superseded_by_smu in smu_info_dict:
                is_superseded = True
                break

        if not is_superseded:
            resultant_list.append(smu_info)

    return resultant_list
コード例 #9
0
ファイル: smu_advisor.py プロジェクト: ommaurya/csm
def get_smus_exclude_supersedes_include_prerequisites(smu_loader, smu_info_list):
    smu_info = []
    resultant_smu_dict = {}
    
    for smu_info in smu_info_list:
        if smu_info.status != 'Posted':
            continue
        # Filter out all the superseded SMUs
        superseded_by = comma_delimited_str_to_array(smu_info.superseded_by) 
        if len(superseded_by) == 0:
            resultant_smu_dict[smu_info.name] = smu_info
            
    # Includes all the missing required pre-requisites
    missing_required_prerequisite_set = \
        get_missing_required_prerequisite_set(smu_loader, resultant_smu_dict.values())
        
    for missing_required_prerequisite in missing_required_prerequisite_set:
        if missing_required_prerequisite not in resultant_smu_dict:
            smu_info = smu_loader.get_smu_info(smu_info)
            if smu_info is not None:
                resultant_smu_dict[smu_info.name] = smu_info
    
    return resultant_smu_dict.values()
コード例 #10
0
def get_smus_exclude_supersedes_include_prerequisites(smu_loader,
                                                      smu_info_list):
    smu_info = []
    resultant_smu_dict = {}

    for smu_info in smu_info_list:
        if smu_info.status != 'Posted':
            continue
        # Filter out all the superseded SMUs
        superseded_by = comma_delimited_str_to_array(smu_info.superseded_by)
        if len(superseded_by) == 0:
            resultant_smu_dict[smu_info.name] = smu_info

    # Includes all the missing required pre-requisites
    missing_required_prerequisite_set = \
        get_missing_required_prerequisite_set(smu_loader, resultant_smu_dict.values())

    for missing_required_prerequisite in missing_required_prerequisite_set:
        if missing_required_prerequisite not in resultant_smu_dict:
            smu_info = smu_loader.get_smu_info(smu_info)
            if smu_info is not None:
                resultant_smu_dict[smu_info.name] = smu_info

    return resultant_smu_dict.values()