eric6/Globals/__init__.py

branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 7085
328f0f44aa95
child 7196
ab0a91b82b37
equal deleted inserted replaced
7191:960850ec284c 7192:a22eee00b052
10 # 10 #
11 # Note: Do not import any eric stuff in here!!!!!!! 11 # Note: Do not import any eric stuff in here!!!!!!!
12 # 12 #
13 13
14 from __future__ import unicode_literals 14 from __future__ import unicode_literals
15 try:
16 str = unicode # __IGNORE_EXCEPTION__
17 except NameError:
18 pass
19 15
20 import sys 16 import sys
21 import os 17 import os
22 import re 18 import re
23 import shutil 19 import shutil
423 @param txt Python string to be converted 419 @param txt Python string to be converted
424 @type str, bytes, bytearray, unicode 420 @type str, bytes, bytearray, unicode
425 @return converted QByteArray 421 @return converted QByteArray
426 @rtype QByteArray 422 @rtype QByteArray
427 """ 423 """
428 if sys.version_info[0] == 2: 424 if isinstance(txt, str):
429 if isinstance(txt, unicode): # __IGNORE_WARNING__ 425 txt = txt.encode("utf-8")
430 txt = txt.encode("utf-8")
431 else:
432 if isinstance(txt, str):
433 txt = txt.encode("utf-8")
434 426
435 return QByteArray(txt) 427 return QByteArray(txt)
436 428
437 429
438 def dataString(size): 430 def dataString(size):

eric ide

mercurial