예제 #1
0
     def __str__(self):
-        return str(self.value)
-
-    def __unicode__(self):
-        return unicode(self.value)
+        return text_type(self.value)
 
     def __add__(self, other):
         return self.value + other
예제 #2
0
diff --git a/cloudify/logs.py b/cloudify/logs.py
index 55333f1..c576ff4 100644
--- a/cloudify/logs.py
+++ b/cloudify/logs.py
@@ -30,6 +30,7 @@ from cloudify.utils import (is_management_environment,
                             ENV_AGENT_LOG_MAX_BYTES,
                             ENV_AGENT_LOG_MAX_HISTORY)
 from cloudify.exceptions import ClosedAMQPClientException
+from cloudify._compat import text_type
 
 EVENT_CLASS = _event.Event
 EVENT_VERBOSITY_LEVEL = _event.NO_VERBOSE
@@ -346,7 +347,7 @@ def create_event_message_prefix(event):
     event_obj = EVENT_CLASS(event, verbosity_level=EVENT_VERBOSITY_LEVEL)
     if not event_obj.has_output:
         return None
-    return str(event_obj)
+    return text_type(event_obj)
 
 
 def with_amqp_client(func):
예제 #3
0
 
-    >>> from speaklater import make_lazy_string
+    >>> from speaklater import make_lazy_string, text_type
     >>> sval = u'Hello World'
     >>> string = make_lazy_string(lambda: sval)
 
     This lazy string will evaluate to the value of the `sval` variable.
 
     >>> string
-    lu'Hello World'
-    >>> unicode(string)
-    u'Hello World'
-    >>> string.upper()
-    u'HELLO WORLD'
+    l'Hello World'
+    >>> text_type(string) == u'Hello World'
+    True
+    >>> string.upper() == u'HELLO WORLD'
+    True
 
     If you change the value, the lazy string will change as well:
 
     >>> sval = u'Hallo Welt'
-    >>> string.upper()
-    u'HALLO WELT'
+    >>> string.upper() == u'HALLO WELT'
+    True
 
     This is especially handy when combined with a thread local and gettext
     translations or dicts of translatable strings:
@@ -40,10 +40,10 @@
--- mycli/packages/completion_engine.py.orig	2020-07-25 03:46:06 UTC
+++ mycli/packages/completion_engine.py
@@ -2,7 +2,6 @@ import os
 import sys
 import sqlparse
 from sqlparse.sql import Comparison, Identifier, Where
-from sqlparse.compat import text_type
 from .parseutils import last_word, extract_tables, find_prev_keyword
 from .special import parse_special_command
 
@@ -55,7 +54,7 @@ def suggest_type(full_text, text_before_cursor):
         stmt_start, stmt_end = 0, 0
 
         for statement in parsed:
-            stmt_len = len(text_type(statement))
+            stmt_len = len(str(statement))
             stmt_start, stmt_end = stmt_end, stmt_end + stmt_len
 
             if stmt_end >= current_pos: