當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。