|
@@ -14,15 +14,15 @@
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
# See the License for the specific language governing permissions and
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
# limitations under the License.
|
|
|
-#
|
|
|
|
|
-# Extra python utils
|
|
|
|
|
|
|
|
|
|
-from past.builtins import basestring
|
|
|
|
|
from builtins import object
|
|
from builtins import object
|
|
|
|
|
+from six import string_types
|
|
|
|
|
+
|
|
|
import datetime
|
|
import datetime
|
|
|
import select
|
|
import select
|
|
|
import socket
|
|
import socket
|
|
|
import sys
|
|
import sys
|
|
|
|
|
+
|
|
|
from django.utils.translation import ugettext as _
|
|
from django.utils.translation import ugettext as _
|
|
|
from desktop import conf
|
|
from desktop import conf
|
|
|
from desktop.lib.i18n import smart_str
|
|
from desktop.lib.i18n import smart_str
|
|
@@ -52,7 +52,7 @@ class CaseInsensitiveDict(dict):
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def from_dict(cls, _dict):
|
|
def from_dict(cls, _dict):
|
|
|
- return CaseInsensitiveDict([(isinstance(key, basestring) and key.lower() or key, _dict[key]) for key in _dict])
|
|
|
|
|
|
|
+ return CaseInsensitiveDict([(isinstance(key, string_types) and key.lower() or key, _dict[key]) for key in _dict])
|
|
|
|
|
|
|
|
|
|
|
|
|
class SynchronousIOMultiplexer(object):
|
|
class SynchronousIOMultiplexer(object):
|
|
@@ -120,7 +120,7 @@ def force_list_to_strings(lst):
|
|
|
|
|
|
|
|
new_list = []
|
|
new_list = []
|
|
|
for item in lst:
|
|
for item in lst:
|
|
|
- if isinstance(item, basestring):
|
|
|
|
|
|
|
+ if isinstance(item, string_types):
|
|
|
# Strings should not be unicode.
|
|
# Strings should not be unicode.
|
|
|
new_list.append(smart_str(item))
|
|
new_list.append(smart_str(item))
|
|
|
elif isinstance(item, dict):
|
|
elif isinstance(item, dict):
|
|
@@ -142,7 +142,7 @@ def force_dict_to_strings(dictionary):
|
|
|
new_dict = {}
|
|
new_dict = {}
|
|
|
for k in dictionary:
|
|
for k in dictionary:
|
|
|
new_key = smart_str(k)
|
|
new_key = smart_str(k)
|
|
|
- if isinstance(dictionary[k], basestring):
|
|
|
|
|
|
|
+ if isinstance(dictionary[k], string_types):
|
|
|
# Strings should not be unicode.
|
|
# Strings should not be unicode.
|
|
|
new_dict[new_key] = smart_str(dictionary[k])
|
|
new_dict[new_key] = smart_str(dictionary[k])
|
|
|
elif isinstance(dictionary[k], dict):
|
|
elif isinstance(dictionary[k], dict):
|