<commit_before>*** Settings ***
Documentation  This module contains keywords for list manipulation.
Library  Collections

*** Keywords ***
Intersect Lists
    [Documentation]  Intersects the two lists passed in. Returns a list of
    ...  values common to both lists with no duplicates.
    [Arguments]  ${list1}  ${list2}

    # list1      The first list to intersect.
    # list2      The second list to intersect.

    ${length1}=  Get Length  ${list1}
    ${length2}=  Get Length  ${list2}

    @{intersected_list}  Create List

    @{larger_list}=  Set Variable If  ${length1} >= ${length2}  ${list1}
    ...                               ${length1} < ${length2}  ${list2}
    @{smaller_list}=  Set Variable If  ${length1} >= ${length2}  ${list2}
    ...                                ${length1} < ${length2}  ${list1}

    :FOR  ${element}  IN  @{larger_list}
    \  ${rc}=  Run Keyword and Return Status  List Should Contain Value  ${smaller_list}
    ...  ${element}
    \  Run Keyword If  '${rc}' == 'True'  Append to List  ${intersected_list}
    ...  ${element}

    @{intersected_list}=  Remove Duplicates  ${intersected_list}

    [Return]  @{intersected_list}<commit_msg>Added a keyword to subtract lists.<commit_after>*** Settings ***
Documentation  This module contains keywords for list manipulation.
Library  Collections

*** Keywords ***
Intersect Lists
    [Documentation]  Intersects the two lists passed in. Returns a list of
    ...  values common to both lists with no duplicates.
    [Arguments]  ${list1}  ${list2}

    # list1      The first list to intersect.
    # list2      The second list to intersect.

    ${length1}=  Get Length  ${list1}
    ${length2}=  Get Length  ${list2}

    @{intersected_list}  Create List

    @{larger_list}=  Set Variable If  ${length1} >= ${length2}  ${list1}
    ...                               ${length1} < ${length2}  ${list2}
    @{smaller_list}=  Set Variable If  ${length1} >= ${length2}  ${list2}
    ...                                ${length1} < ${length2}  ${list1}

    :FOR  ${element}  IN  @{larger_list}
    \  ${rc}=  Run Keyword and Return Status  List Should Contain Value  ${smaller_list}
    ...  ${element}
    \  Run Keyword If  '${rc}' == 'True'  Append to List  ${intersected_list}
    ...  ${element}

    @{intersected_list}=  Remove Duplicates  ${intersected_list}

    [Return]  @{intersected_list}


Subtract Lists
    [Documentation]  Subtract list 2 from list 1 and return the result.
    #  Return list contain items from the list 1 which are not present
    #  in the list 2.
    [Arguments]  ${list1}  ${list2}
    # Description of argument(s):
    # list1      The base list which is to be subtracted from.
    # list2      The list which is to be subtracted from list1.

    ${diff_list}=  Create List
    :FOR  ${item}  IN  @{list1}
    \  ${status}=  Run Keyword And Return Status
    ...  Should Contain  ${list2}  ${item}
    \  Run Keyword If  '${status}' == '${False}'
    ...  Append To List  ${diff_list}  ${item}

    [Return]  ${diff_list}
{'fraction_non_alphanumeric': 0.12942332896461337, 'fraction_numerical': 0.016710353866317168, 'mean_word_length': 2.4575311438278598, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5732057', 'n_tokens_mistral': 997, 'n_tokens_neox': 938, 'n_words': 312}