__init__.py 406 B

123456789101112131415161718192021
  1. LOCALE_URL = "http://translations.bittorrent.com/"
  2. class BTFailure(Exception):
  3. pass
  4. # this class is weak sauce
  5. class InfoHashType(str):
  6. def __repr__(self):
  7. return self.encode('hex')
  8. def short(self):
  9. return repr(self)[:8]
  10. # soon.
  11. ## InfoHashType breaks bencode, so just don't do it.
  12. #def InfoHashType(s):
  13. # return s
  14. def infohash_short(s):
  15. return s.encode('hex')[:8]