python 2 and 3

#7
This commit is contained in:
Kenneth Reitz
2012-05-08 12:56:04 -04:00
parent 21e1b2463d
commit 1c8eec3a0f
+9 -1
View File
@@ -9,10 +9,18 @@ This module provides the CLI argument interface for clint.
"""
import os
import sys
from sys import argv
from glob import glob
from collections import OrderedDict
# Python 3
if sys.version_info[0] == 3:
string_type = str
else:
string_type = basestring
def _expand_path(path):
"""Expands directories and globs in given path."""
@@ -34,7 +42,7 @@ def _expand_path(path):
def _is_collection(obj):
"""Tests if an object is a collection. Strings don't count."""
if isinstance(obj, str):
if isinstance(obj, string_type):
return False
return hasattr(obj, '__getitem__')