pyre.patterns.PathHash¶
Module Contents¶
-
class
pyre.patterns.PathHash.PathHash¶ Implementation of a hash function for hierarchical namespaces with aliased entries.
PathHash encodes the hierarchical relationships among its contents by having each node in the hierarchy store the names of the nodes that are its immediate children. Aliases are permitted and they hash to the same key as the original entry.
PathHash does not provide storage for any values associated with the names of the various levels in the hierarchy; that’s the responsibility of the client. One implementation strategy is to create a dictionary at the client side that maps the keys generated by PathHash to the associated values.
-
__slots__= ['nodes']¶
-
hash(self, items)¶ Hash {item}, assumed to be an iterable of address segments, and return its key
-
alias(self, target, alias)¶ Make the node {target} accessible under the name {alias}
-
dump(self, graphic='')¶ Dump out the names of all encountered nodes
-
__contains__(self, name)¶ Check whether i have a hash key for {name}
-
__getitem__(self, name)¶ Hash {name}
-
__setitem__(self, name, key)¶ Make {name} hash to {key}
-