MCPcopy Create free account
hub / github.com/mozilla/cipherscan / __format__

Method __format__

cscan/extensions.py:174–195  ·  view source on GitHub ↗

Formattable representation of extension.

(self, formatstr)

Source from the content-addressed store, hash-verified

172 return "KeyShareExtension({0!r})".format(self.client_shares)
173
174 def __format__(self, formatstr):
175 """Formattable representation of extension."""
176 if self.client_shares is None:
177 return "KeyShareExtension(None)"
178
179 verbose = ""
180 hexlify = False
181 if 'v' in formatstr:
182 verbose = "GroupName."
183 if 'h' in formatstr:
184 hexlify = True
185
186 shares = []
187 for group_id, share in self.client_shares:
188 if hexlify:
189 share = b2a_hex(share)
190 else:
191 share = repr(share)
192 shares += ["({0}{1}, {2})".format(verbose,
193 GroupName.toStr(group_id),
194 share)]
195 return "KeyShareExtension([" + ",".join(shares) + "])"
196
197tlslite.extensions.TLSExtension._universalExtensions[
198 ExtensionType.key_share] = KeyShareExtension

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected