diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-07 18:12:03 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-07 18:12:03 +0200 |
commit | 2e1ade3d19657755984a6abe0e34033b631efeea (patch) | |
tree | b97774d894928f1e63a6b48fbd2f23a2fdaad3b0 /examples | |
parent | 1f52c1ba5b48364c91d5eb99d1a5bb47b455b259 (diff) | |
download | pygobject-2e1ade3d19657755984a6abe0e34033b631efeea.tar.gz |
flake8: remove python2 builtin list
Only use the _compat aliases and hide them in _compat through eval().
This will make flake8 complain in case any py2 only builtins are used.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/demo/demos/rotatedtext.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/examples/demo/demos/rotatedtext.py b/examples/demo/demos/rotatedtext.py index d47b1cfe..429bbdfa 100644 --- a/examples/demo/demos/rotatedtext.py +++ b/examples/demo/demos/rotatedtext.py @@ -29,20 +29,13 @@ cairo drawing operations instead of the Unicode heart character. from gi.repository import Gtk, Pango, PangoCairo, Gdk import cairo -import sys import math -# Python 2 and 3 handle UTF8 differently -if sys.version_info < (3, 0): - BYTES_TEXT = "I \xe2\x99\xa5 GTK+" - UTF8_TEXT = unicode(BYTES_TEXT, 'UTF-8') - BYTES_HEART = "\xe2\x99\xa5" - HEART = unicode(BYTES_HEART, 'UTF-8') -else: - UTF8_TEXT = "I ♥ GTK+" - BYTES_TEXT = bytes(UTF8_TEXT, 'utf-8') - HEART = "♥" - BYTES_HEART = bytes(HEART, 'utf-8') + +UTF8_TEXT = u"I ♥ GTK+" +HEART = u"♥" +BYTES_TEXT = UTF8_TEXT.encode() +BYTES_HEART = HEART.encode() class RotatedTextApp: |