1 # -*- coding: utf-8 -*-
2 # the above encoding declaration is needed to have non-ascii characters in this file (anywhere even in comments)
3 from __future__ import unicode_literals
4
5 # this module mimics what happens in main.py:
6 # - there are special characters in the Foo.__str__ method. To support them in python 2 we need the line 1 (coding)
7 # - since in python 2 __str__ is supposed to return bytes, we use @python_2_unicode_compatible
8 # - since the special characters in the Foo.__str__ are not ascii, we need them to be declared as unicode literal. For
9 # this we can either do it by using a u as in 'u"└─"' or by importing unicode_literals from __future__ (line 2).
10 # Note: if we want to have some strings as unicode and some others not we MUST use u"" and not this import.
11
-
F401
'qdscreen.compat.python_2_unicode_compatible' imported but unused
12 from qdscreen.compat import python_2_unicode_compatible, encode_if_py2
13
14
15 # @python_2_unicode_compatible
16 class Foo(object):
17 @encode_if_py2
18 def __str__(self):
19 return u"└─ab\n"
20
21 # def toto(self):
22 # return "fjdlkdlms"
23
24 def __repr__(self):
25 return str(self) # + self.toto()