File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ # encoding: utf-8
2+
3+ """
4+ Provides Python 2/3 compatibility objects
5+ """
6+
7+ from __future__ import (
8+ absolute_import , division , print_function , unicode_literals
9+ )
10+
11+ import sys
12+
13+ # ===========================================================================
14+ # Python 3 versions
15+ # ===========================================================================
16+
17+ if sys .version_info >= (3 , 0 ):
18+
19+ def is_string (obj ):
20+ """
21+ Return True if *obj* is a string, False otherwise.
22+ """
23+ return isinstance (obj , str )
24+
25+ # ===========================================================================
26+ # Python 2 versions
27+ # ===========================================================================
28+
29+ else :
30+
31+ def is_string (obj ):
32+ """
33+ Return True if *obj* is a string, False otherwise.
34+ """
35+ return isinstance (obj , basestring )
Original file line number Diff line number Diff line change 1010
1111from zipfile import ZipFile , is_zipfile , ZIP_DEFLATED
1212
13+ from .compat import is_string
1314from .exceptions import PackageNotFoundError
1415from .packuri import CONTENT_TYPES_URI
1516
@@ -20,7 +21,7 @@ class PhysPkgReader(object):
2021 """
2122 def __new__ (cls , pkg_file ):
2223 # if *pkg_file* is a string, treat it as a path
23- if isinstance (pkg_file , basestring ):
24+ if is_string (pkg_file ):
2425 if os .path .isdir (pkg_file ):
2526 reader_cls = _DirPkgReader
2627 elif is_zipfile (pkg_file ):
You can’t perform that action at this time.
0 commit comments