aragilar / stringtopy

Consider using a set comprehension PYL-R1718
Performance
Major
4 years ago4 years old
Consider using a set comprehension
 973        # between branches and tags. By ignoring refnames without digits, we
 974        # filter out many common branch names like "release" and
 975        # "stabilization", as well as "HEAD" and "master".
 976        tags = set([r for r in refs if re.search(r'\d', r)]) 977        if verbose:
 978            print("discarding '%s', no digits" % ",".join(refs-tags))
 979    if verbose:
Consider using a set comprehension
 964    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
 965    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
 966    TAG = "tag: "
 967    tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) 968    if not tags:
 969        # Either we're using git < 1.8.3, or there really are no tags. We use
 970        # a heuristic: assume all version tags have a digit. The old git %d
Consider using a set comprehension
 960        if verbose:
 961            print("keywords are unexpanded, not using")
 962        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
 963    refs = set([r.strip() for r in refnames.strip("()").split(",")]) 964    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
 965    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
 966    TAG = "tag: "