예제 #1
0
    def from_string(cls, s):
        # type: (str) -> Xid
        val = base32hex.b32decode(s.upper())
        value_check = [0 <= x < 255 for x in val]

        if not all(value_check):
            raise InvalidXid(s)

        return cls(val)
예제 #2
0
 def test_copy_string_from_golang(self):
     x = base32hex.b32decode('9m4e2mr0ui3e8a215n4g')
     self.assertEqual(x, [0x4d, 0x88, 0xe1, 0x5b, 0x60, 0xf4,
                          0x86, 0xe4, 0x28, 0x41, 0x2d, 0xc9])