本文整理汇总了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')