Skip to content

Commit 4d3e96e

Browse files
committed
Minimize change
1 parent a40c7a2 commit 4d3e96e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/pyld/canon.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self):
2121
self.hash_to_blank_nodes = {}
2222
self.canonical_issuer = IdentifierIssuer('_:c14n')
2323
self.dataset = None
24+
self.POSITIONS = ['s', 'p', 'o', 'g']
2425
self.hash_algorithm = hashlib.sha256
2526

2627
# 4.4) Normalization Algorithm
@@ -463,7 +464,7 @@ def create_hash_to_related(self, id_, issuer):
463464

464465
related = str(component)
465466
# correct position codes: subject='s', object='o', graph='g'
466-
position = ('s', None, 'o', 'g')[i]
467+
position = self.POSITIONS[i]
467468
hash = self.hash_related_blank_node(related, quad, issuer, position)
468469

469470
# 3.1.2) Add a mapping of hash to the blank node identifier

0 commit comments

Comments
 (0)