MCPcopy Create free account
hub / github.com/SecurityInnovation/PGPy / _add_alias

Method _add_alias

pgpy/pgp.py:2739–2757  ·  view source on GitHub ↗
(self, alias, pkid)

Source from the content-addressed store, hash-verified

2737 self._aliases.remove({})
2738
2739 def _add_alias(self, alias, pkid):
2740 # brand new alias never seen before!
2741 if alias not in self:
2742 self._aliases[-1][alias] = pkid
2743
2744 # this is a duplicate alias->key link; ignore it
2745 elif alias in self and pkid in set(m[alias] for m in self._aliases if alias in m):
2746 pass # pragma: no cover
2747
2748 # this is an alias that already exists, but points to a key that is not already referenced by it
2749 else:
2750 adepth = len(self._aliases) - len([None for m in self._aliases if alias in m]) - 1
2751 # all alias maps have this alias, so increase total depth by 1
2752 if adepth == -1:
2753 self._aliases.appendleft({})
2754 adepth = 0
2755
2756 self._aliases[adepth][alias] = pkid
2757 self._sort_alias(alias)
2758
2759 def _add_key(self, pgpkey):
2760 pkid = id(pgpkey)

Callers 1

_add_keyMethod · 0.95

Calls 1

_sort_aliasMethod · 0.95

Tested by

no test coverage detected