Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compat.py 347B

1234567891011121314151617181920
  1. import six
  2. if six.PY3:
  3. long = int
  4. else:
  5. long = long
  6. def b(arg):
  7. """Convert `arg` to bytes."""
  8. if isinstance(arg, six.text_type):
  9. arg = arg.encode("latin-1")
  10. return arg
  11. def u(arg):
  12. """Convert `arg` to text."""
  13. if isinstance(arg, six.binary_type):
  14. arg = arg.decode('ascii', 'replace')
  15. return arg