当前位置: 首页>>代码示例>>Python>>正文


Python convert.stdoutencode方法代码示例

本文整理汇总了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) 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:22,代码来源:ansistrm.py

示例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) 
开发者ID:w-digital-scanner,项目名称:w9scan,代码行数:22,代码来源:ansistrm.py

示例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 
开发者ID:zer0yu,项目名称:ZEROScan,代码行数:20,代码来源:common.py

示例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 
开发者ID:S4kur4,项目名称:Sepia,代码行数:21,代码来源:common.py

示例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') 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:33,代码来源:common.py

示例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 
开发者ID:w-digital-scanner,项目名称:w9scan,代码行数:15,代码来源:common.py

示例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') 
开发者ID:sabri-zaki,项目名称:EasY_HaCk,代码行数:33,代码来源:common.py


注:本文中的lib.core.convert.stdoutencode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。