File: python23compat.py

package info (click to toggle)
seabios 1.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,840 kB
  • ctags: 10,539
  • sloc: ansic: 44,799; asm: 1,834; cpp: 1,826; python: 780; yacc: 604; makefile: 522; perl: 409; lex: 363; sh: 299
file content (14 lines) | stat: -rw-r--r-- 374 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Helper code for compatibility of the code with both Python 2 and Python 3
#
# Copyright (C) 2014 Johannes Krampf <johannes.krampf@googlemail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.

import sys

if (sys.version_info > (3, 0)):
    def as_bytes(str):
        return bytes(str, "ASCII")
else:
    def as_bytes(str):
        return str