Formattable representation of extension.
(self, formatstr)
| 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 | |
| 197 | tlslite.extensions.TLSExtension._universalExtensions[ |
| 198 | ExtensionType.key_share] = KeyShareExtension |
nothing calls this directly
no outgoing calls
no test coverage detected