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


Python Printer.__init__方法代码示例

本文整理汇总了Python中pyprint.Printer.Printer.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Printer.__init__方法的具体用法?Python Printer.__init__怎么用?Python Printer.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyprint.Printer.Printer的用法示例。


在下文中一共展示了Printer.__init__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self,
                 section: Section,
                 message_queue,
                 timeout=0):
        """
        Constructs a new bear.

        :param section:       The section object where bear settings are
                              contained.
        :param message_queue: The queue object for messages. Can be ``None``.
        :param timeout:       The time the bear is allowed to run. To set no
                              time limit, use 0.
        :raises TypeError:    Raised when ``message_queue`` is no queue.
        :raises RuntimeError: Raised when bear requirements are not fulfilled.
        """
        Printer.__init__(self)
        LogPrinter.__init__(self, self)

        if message_queue is not None and not hasattr(message_queue, "put"):
            raise TypeError("message_queue has to be a Queue or None.")

        self.section = section
        self.message_queue = message_queue
        self.timeout = timeout

        self.setup_dependencies()
        cp = type(self).check_prerequisites()
        if cp is not True:
            error_string = ("The bear " + self.name +
                            " does not fulfill all requirements.")
            if cp is not False:
                error_string += " " + cp

            self.warn(error_string)
            raise RuntimeError(error_string)
开发者ID:jschwarzwalder,项目名称:coala,代码行数:37,代码来源:Bear.py

示例2: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self,
                 log_level=LOG_LEVEL.WARNING,
                 timestamp_format="%X"):
        Printer.__init__(self)
        LogPrinter.__init__(self, self, log_level, timestamp_format)

        self.logs = []
开发者ID:sudoankit,项目名称:coala,代码行数:9,代码来源:ListLogPrinter.py

示例3: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self,
                 log_level=LOG_LEVEL.WARNING,
                 timestamp_format='%X'):
        Printer.__init__(self)
        self.log_level = log_level

        self.logs = []
开发者ID:Anmolbansal1,项目名称:coala,代码行数:9,代码来源:ListLogPrinter.py

示例4: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self):
        """
        Creates a new StringPrinter with an empty print string.
        """
        Printer.__init__(self)

        self._string = ""
开发者ID:AbdealiJK,项目名称:coala,代码行数:9,代码来源:StringPrinter.py

示例5: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self, print_colored=None):
        """
        Creates a new ColorPrinter.

        :param print_colored: Can be set to False to use uncolored printing
                              only. If None prints colored only when supported.
        """
        Printer.__init__(self)

        self.print_colored = print_colored
开发者ID:coala-analyzer,项目名称:PyPrint,代码行数:12,代码来源:ColorPrinter.py

示例6: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self,
                 section: Section,
                 message_queue,
                 timeout=0):
        Printer.__init__(self)
        LogPrinter.__init__(self, self)

        if not hasattr(message_queue, "put") and message_queue is not None:
            raise TypeError("message_queue has to be a Queue or None.")

        self.section = section
        self.message_queue = message_queue
        self.timeout = timeout
开发者ID:keerthisuresh,项目名称:coala,代码行数:15,代码来源:Bear.py

示例7: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self, filehandle):
        """
        Creates a new FilePrinter. If the directory of the given file doesn't
        exist or if there's any access problems, an exception will be thrown.

        :param filehandle: A file-like object to put the data into. It's write
                           method will be invoked.
        """
        Printer.__init__(self)

        if not hasattr(filehandle, "write"):
            raise TypeError("filehandle must be a file like object " "i.e. provide a write method.")

        self.file = filehandle
开发者ID:abhsag24,项目名称:PyPrint,代码行数:16,代码来源:FilePrinter.py

示例8: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self):
        """
        Raises EnvironmentError if VoiceOutput is impossible.
        """
        Printer.__init__(self)
        ClosableObject.__init__(self)
        # TODO retrieve language from get_locale and select appropriate voice

        try:
            self.espeak = subprocess.Popen(['espeak'], stdin=subprocess.PIPE)
        except OSError:  # pragma: no cover
            print("eSpeak doesn't seem to be installed. You cannot use the "
                  "voice output feature without eSpeak. It can be downloaded"
                  " from http://espeak.sourceforge.net/ or installed via "
                  "your usual package repositories.")
            raise EnvironmentError
        except:  # pragma: no cover
            print("Failed to execute eSpeak. An unknown error occurred.",
                  Constants.THIS_IS_A_BUG)
            raise EnvironmentError
开发者ID:Tanmay28,项目名称:coala,代码行数:22,代码来源:EspeakPrinter.py

示例9: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self):
        """
        :raises EnvironmentError: If VoiceOutput is impossible.
        """
        Printer.__init__(self)
        ClosableObject.__init__(self)
        # TODO retrieve language from get_locale and select appropriate voice

        try:
            self.espeak = subprocess.Popen(['espeak'], stdin=subprocess.PIPE)
        except OSError:  # pragma: no cover
            print("eSpeak doesn't seem to be installed. You cannot use the "
                  "voice output feature without eSpeak. It can be downloaded"
                  " from http://espeak.sourceforge.net/ or installed via "
                  "your usual package repositories.")
            raise EnvironmentError
        except subprocess.SubprocessError:  # pragma: no cover
            print("Failed to execute eSpeak. An unknown error occurred. "
                  "This is a bug. We are sorry for the inconvenience. "
                  "Please contact the developers for assistance.")
            raise EnvironmentError
开发者ID:coala-analyzer,项目名称:PyPrint,代码行数:23,代码来源:EspeakPrinter.py

示例10: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
    def __init__(self,
                 section: Section,
                 message_queue,
                 timeout=0):
        """
        Constructs a new bear.

        :param section:       The section object where bear settings are
                              contained.
        :param message_queue: The queue object for messages. Can be ``None``.
        :param timeout:       The time the bear is allowed to run. To set no
                              time limit, use 0.
        :raises TypeError:    Raised when ``message_queue`` is no queue.
        :raises RuntimeError: Raised when bear requirements are not fulfilled.
        """
        Printer.__init__(self)

        if message_queue is not None and not hasattr(message_queue, 'put'):
            raise TypeError('message_queue has to be a Queue or None.')

        self.section = section
        self.message_queue = message_queue
        self.timeout = timeout
        self.debugger = _is_debugged(bear=self)
        self.profile = _is_profiled(bear=self)

        if self.profile and self.debugger:
            raise ValueError(
                'Cannot run debugger and profiler at the same time.')

        self.setup_dependencies()
        cp = type(self).check_prerequisites()
        if cp is not True:
            error_string = ('The bear ' + self.name +
                            ' does not fulfill all requirements.')
            if cp is not False:
                error_string += ' ' + cp

            self.err(error_string)
            raise RuntimeError(error_string)
开发者ID:Anmolbansal1,项目名称:coala,代码行数:42,代码来源:Bear.py

示例11: __init__

# 需要导入模块: from pyprint.Printer import Printer [as 别名]
# 或者: from pyprint.Printer.Printer import __init__ [as 别名]
 def __init__(self):
     """
     Instantiates a new NullPrinter.
     """
     Printer.__init__(self)
开发者ID:abhsag24,项目名称:PyPrint,代码行数:7,代码来源:NullPrinter.py


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