publicsuffix / list

The Public Suffix List
https://publicsuffix.org/
Mozilla Public License 2.0
1.97k stars 1.2k forks source link

Clean up list to fix rule sorting within orgs #1968

Closed simon-friedberger closed 3 months ago

simon-friedberger commented 4 months ago

This makes the sorting of rules within organization's sections match what the script in #1953 wants.

I checked that the actual contents are still the same using:

import click

def read_rules(filename):
    rules = set()
    with open(filename) as f:
        for line in f:
            if line.startswith("//"):
                continue
            line = line.strip()
            rules.add(line)
    return rules

@click.command()
@click.argument("file1")
@click.argument("file2")
def main(file1, file2):
    rules1 = read_rules(file1)
    rules2 = read_rules(file2)
    print(f"Are they equal? {rules1 == rules2}")

if __name__ == "__main__":
    main()