Skip to content

Commit

Permalink
Reduce the number of unnecessary underscores in ref generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkinder committed Aug 3, 2024
1 parent fc9caf9 commit d679ce2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions puepy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,10 @@ def generate_tag(self, tag_name, *children, **kwargs):
raise Exception("t.generate_tag called without a context")

# Determine ref value
ref_part = f"__{parent.ref}.{tag_name}{len(parent.children) + 1}_" + binascii.hexlify(
hashlib.sha256(str(kwargs).encode()).digest()
)[:8].decode("utf8")
ref_part = "__" + (
f"{parent.ref}.{tag_name}{len(parent.children) + 1}_"
+ (binascii.hexlify(hashlib.sha256(str(kwargs).encode()).digest()))[:8].decode("utf8")
).lstrip("_")

ref = kwargs.pop("ref", ref_part)

Expand Down

0 comments on commit d679ce2

Please sign in to comment.