本文整理匯總了Python中lib.core.convert.stdoutencode方法的典型用法代碼示例。如果您正苦於以下問題:Python convert.stdoutencode方法的具體用法?Python convert.stdoutencode怎麽用?Python convert.stdoutencode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lib.core.convert
的用法示例。
在下文中一共展示了convert.stdoutencode方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: emit
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def emit(self, record):
try:
message = stdoutencode(self.format(record))
stream = self.stream
if not self.is_tty:
if message and message[0] == "\r":
message = message[1:]
stream.write(message)
else:
self.output_colorized(message)
stream.write(getattr(self, 'terminator', '\n'))
self.flush()
except (KeyboardInterrupt, SystemExit):
raise
except IOError:
pass
except:
self.handleError(record)
示例2: emit
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def emit(self, record):
try:
message = stdoutencode(self.format(record))
stream = self.stream
if not self.is_tty:
if message and message[0] == "\r":
message = message[1:]
stream.write(message)
else:
self.output_colorized(message)
stream.write(getattr(self, 'terminator', '\n'))
self.flush()
except (KeyboardInterrupt, SystemExit):
raise
except IOError:
pass
except Exception:
self.handleError(record)
示例3: dataToStdout
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def dataToStdout(data, bold=False):
"""
Writes text to the stdout (console) stream
"""
message = ""
if isinstance(data, unicode):
message = stdoutencode(data)
else:
message = data
sys.stdout.write(setColor(message, bold))
try:
sys.stdout.flush()
except IOError:
pass
示例4: dataToStdout
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def dataToStdout(data, bold=False):
"""
Writes text to the stdout (console) stream
"""
logging._acquireLock()
if isinstance(data, unicode):
message = stdoutencode(data)
else:
message = data
sys.stdout.write(setColor(message, bold))
try:
sys.stdout.flush()
except IOError:
pass
logging._releaseLock()
return
示例5: dataToStdout
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=CONTENT_STATUS.IN_PROGRESS):
"""
Writes text to the stdout (console) stream
"""
message = ""
if not kb.get("threadException"):
if forceOutput or not getCurrentThreadData().disableStdOut:
if kb.get("multiThreadMode"):
logging._acquireLock()
if isinstance(data, unicode):
message = stdoutencode(data)
else:
message = data
if hasattr(conf, "api"):
sys.stdout.write(message, status, content_type)
else:
sys.stdout.write(setColor(message, bold))
try:
sys.stdout.flush()
except IOError:
pass
if kb.get("multiThreadMode"):
logging._releaseLock()
kb.prependFlag = isinstance(data, basestring) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')
示例6: dataToStdout
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def dataToStdout(data, forceOutput=False, bold=False, content_type=None):
"""
Writes text to the stdout (console) stream
"""
if isinstance(data, unicode):
message = stdoutencode(data)
else:
message = data
sys.stdout.write(setColor(message, bold))
try:
sys.stdout.flush()
except IOError:
pass
示例7: dataToStdout
# 需要導入模塊: from lib.core import convert [as 別名]
# 或者: from lib.core.convert import stdoutencode [as 別名]
def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=CONTENT_STATUS.IN_PROGRESS):
"""
Writes text to the stdout (console) stream
"""
message = ""
if not kb.get("threadException"):
if forceOutput or not (getCurrentThreadData().disableStdOut or kb.get("wizardMode")):
if kb.get("multiThreadMode"):
logging._acquireLock()
if isinstance(data, unicode):
message = stdoutencode(data)
else:
message = data
try:
if conf.get("api"):
sys.stdout.write(clearColors(message), status, content_type)
else:
sys.stdout.write(setColor(message, bold=bold))
sys.stdout.flush()
except IOError:
pass
if kb.get("multiThreadMode"):
logging._releaseLock()
kb.prependFlag = isinstance(data, basestring) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')