forked from scanny/python-pptx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython3.py
More file actions
42 lines (30 loc) · 812 Bytes
/
python3.py
File metadata and controls
42 lines (30 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# encoding: utf-8
"""
Provides Python 3 compatibility objects
"""
from io import BytesIO # noqa
def is_integer(obj):
"""
Return True if *obj* is an int, False otherwise.
"""
return isinstance(obj, int)
def is_string(obj):
"""
Return True if *obj* is a string, False otherwise.
"""
return isinstance(obj, str)
def is_unicode(obj):
"""
Return True if *obj* is a unicode string, False otherwise.
"""
return isinstance(obj, str)
def to_unicode(text):
"""
Return *text* as a unicode string. All text in Python 3 is unicode, so
this just returns *text* unchanged.
"""
if not isinstance(text, str):
tmpl = 'expected unicode string, got %s value %s'
raise TypeError(tmpl % (type(text), text))
return text
Unicode = str