<commit_before>"""
Derive a list of impossible differentials.
"""

from ast import literal_eval
import sys

def parse(line):
    return literal_eval(line)

def in_set(s, xs):
    return any(i in s for i in xs)

def main():
    if len(sys.argv) != 3:
        print("usage: ./find_ids.py [forward differentials file] [backward differentials file]", file=sys.stderr)
        sys.exit(1)

    ids = []
    with open(sys.argv[1], "rt") as f:
        for i, forward_rounds, xs in map(parse, f):
            sx = set(xss[-1])
            with open(sys.argv[2], "rt") as g:
                for j, backward_rounds, ys in map(parse, g):
                    if in_set(sx, ys):
                        backward_rounds -= 1
                        print((i, forward_rounds, backward_rounds, j))

if __name__ == "__main__":
    main()<commit_msg>Remove conversion to set, as the new file format uses sets in tuples.<commit_after>"""
Derive a list of impossible differentials.
"""

from ast import literal_eval
import sys

def parse(line):
    return literal_eval(line)

def in_set(s, xs):
    return any(i in s for i in xs)

def main():
    if len(sys.argv) != 3:
        print("usage: ./find_ids.py [forward differentials file] [backward differentials file]", file=sys.stderr)
        sys.exit(1)

    ids = []
    with open(sys.argv[1], "rt") as f:
        for i, forward_rounds, xs in map(parse, f):
            with open(sys.argv[2], "rt") as g:
                for j, backward_rounds, ys in map(parse, g):
                    if xs.isdisjoint(ys):
                        backward_rounds -= 1
                        print((i, forward_rounds, backward_rounds, j))

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.12404016538688718, 'fraction_numerical': 0.006497341996455995, 'mean_word_length': 2.2452107279693485, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4310790', 'n_tokens_mistral': 562, 'n_tokens_neox': 532, 'n_words': 174}