• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.get_choice_opt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pygments.util.get_choice_opt函数的典型用法代码示例。如果您正苦于以下问题:Python get_choice_opt函数的具体用法?Python get_choice_opt怎么用?Python get_choice_opt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __init__

 def __init__(self, **options):
     Formatter.__init__(self, **options)
     self.darkbg = get_choice_opt(options, 'bg',
                                  ['light', 'dark'], 'light') == 'dark'
     self.colorscheme = options.get('colorscheme', None) or COMMAND_COLORS
     self.linenos = options.get('linenos', False)
     self._lineno = 0
开发者ID:joaobarbosa,项目名称:orator,代码行数:7,代码来源:command_formatter.py


示例2: __init__

    def __init__(self, **options):
        level = get_choice_opt(options, 'unicodelevel', list(self.tokens), 'basic')
        if level not in self._all_tokens:
            # compile the regexes now
            self._tokens = self.__class__.process_tokendef(level)
        else:
            self._tokens = self._all_tokens[level]

        RegexLexer.__init__(self, **options)
开发者ID:0038lana,项目名称:Test-Task,代码行数:9,代码来源:dotnet.py


示例3: __init__

 def __init__(self, **options):
     """
     See the class docstring for explanation of options.
     """
     if not pil_available:
         raise PilNotAvailable(
             'Python Imaging Library is required for this formatter')
     Formatter.__init__(self, **options)
     self.encoding = 'latin1'  # let pygments.format() do the right thing
     # Read the style
     self.styles = dict(self.style)
     if self.style.background_color is None:
         self.background_color = '#fff'
     else:
         self.background_color = self.style.background_color
     # Image options
     self.image_format = get_choice_opt(
         options, 'image_format', ['png', 'jpeg', 'gif', 'bmp'],
         self.default_image_format, normcase=True)
     self.image_pad = get_int_opt(options, 'image_pad', 10)
     self.line_pad = get_int_opt(options, 'line_pad', 2)
     # The fonts
     fontsize = get_int_opt(options, 'font_size', 14)
     self.fonts = FontManager(options.get('font_name', ''), fontsize)
     self.fontw, self.fonth = self.fonts.get_char_size()
     # Line number options
     self.line_number_fg = options.get('line_number_fg', '#886')
     self.line_number_bg = options.get('line_number_bg', '#eed')
     self.line_number_chars = get_int_opt(options,
                                          'line_number_chars', 2)
     self.line_number_bold = get_bool_opt(options,
                                          'line_number_bold', False)
     self.line_number_italic = get_bool_opt(options,
                                            'line_number_italic', False)
     self.line_number_pad = get_int_opt(options, 'line_number_pad', 6)
     self.line_numbers = get_bool_opt(options, 'line_numbers', True)
     self.line_number_separator = get_bool_opt(options,
                                               'line_number_separator', True)
     self.line_number_step = get_int_opt(options, 'line_number_step', 1)
     self.line_number_start = get_int_opt(options, 'line_number_start', 1)
     if self.line_numbers:
         self.line_number_width = (self.fontw * self.line_number_chars +
                                   self.line_number_pad * 2)
     else:
         self.line_number_width = 0
     self.hl_lines = []
     hl_lines_str = get_list_opt(options, 'hl_lines', [])
     for line in hl_lines_str:
         try:
             self.hl_lines.append(int(line))
         except ValueError:
             pass
     self.hl_color = options.get('hl_color',
                                 self.style.highlight_color) or '#f90'
     self.drawables = []
开发者ID:LihMeh,项目名称:outwiker,代码行数:55,代码来源:img.py


示例4: __init__

 def __init__(self, **options):
     Formatter.__init__(self, **options)
     self.darkbg = get_choice_opt(options, 'bg',
                                  ['light', 'dark'], 'light') == 'dark'
     self.colorscheme = options.get('colorscheme', None) or TERMINAL_COLORS
     self.width = options.get('width', 80)
     self.verbatim = False
     self.in_list  = False
     self.column   = 1
     self.last_was_nl = False
     return
开发者ID:mvaled,项目名称:python3-trepan,代码行数:11,代码来源:format.py


示例5: __init__

 def __init__(self, **options):
     Formatter.__init__(self, **options)
     self.compress = get_choice_opt(options, 'compress',
                                    ['', 'none', 'gz', 'bz2'], '')
     self.error_color = options.get('error_color', None)
     if self.error_color is True:
         self.error_color = 'red'
     if self.error_color is not None:
         try:
             colorize(self.error_color, '')
         except KeyError:
             raise ValueError("Invalid color %r specified" %
                              self.error_color)
开发者ID:mbialon,项目名称:yashapp,代码行数:13,代码来源:other.py


示例6: __init__

 def __init__(self, **options):
     Formatter.__init__(self, **options)
     if self.encoding:
         raise OptionError("the raw formatter does not support the " "encoding option")
     self.encoding = "utf-8"  # let pygments.format() do the right thing
     self.compress = get_choice_opt(options, "compress", ["", "none", "gz", "bz2"], "")
     self.error_color = options.get("error_color", None)
     if self.error_color is True:
         self.error_color = "red"
     if self.error_color is not None:
         try:
             colorize(self.error_color, "")
         except KeyError:
             raise ValueError("Invalid color %r specified" % self.error_color)
开发者ID:robby31,项目名称:PythonQt,代码行数:14,代码来源:other.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.get_int_opt函数代码示例发布时间:2022-05-25
下一篇:
Python util.get_bool_opt函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap