def checkpins(contents, designator, errs):
    pins = re_pins.findall(contents)
    nums = []
    for name, num, x, y, length, numsize, namesize in pins:
        # Check pins lie on 100mil grid
        if 100 % int(x) != 0 or int(y) % 100 != 0:
            errs.append("Pin '{}' not on 100mil grid".format(name))
        # Check pins in IC and U parts are 100mil long
        if designator in ("IC", "U") and int(length) not in (100, 150):
            errs.append("Pin '{}' not 100 or 150mil long, but part is IC or U"
                        .format(name))
        # Check pin text fields are 50mil sized
        if int(namesize) != 50 or (int(numsize) != 50 and num.isdigit()):
            errs.append("Pin '{}' font size not 50mil".format(name))
        # Collect numeric pins
        if num.isdigit():
            nums.append(int(num))

    if nums:
        expected = set(range(min(nums), max(nums)+1))
        if set(nums) != expected:
            missing = [str(x) for x in set(expected) - set(nums)]
            errs.append("Missing pins {}".format(", ".join(missing)))

        duplicates = set([str(x) for x in nums if nums.count(x) > 1])
        if duplicates:
            errs.append("Duplicated pins {}".format(", ".join(duplicates)))
dataset/ETHPy150Open adamgreig/agg-kicad/scripts/check_lib.py/checkpins/swapped operands of `%`