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

Python util.get_bool_opt函数代码示例

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

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



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

示例1: __init__

 def __init__(self, **options):
     Formatter.__init__(self, **options)
     self.lineseparator = options.get("lineseparator", "\n")
     self.tabwidth = get_int_opt(options, "tabwidth", 4)
     self.escapetable = _escape_html_table
     self.escapetable[ord("\t")] = " " * self.tabwidth
     self.noclasses = get_bool_opt(options, "noclasses", False)
     self.classprefix = options.get("classprefix", "")
     self.cssclass = options.get("cssclass", "highlight")
     self.stylebg = get_bool_opt(options, "stylebg", True)
     self.stylebgalternating = get_bool_opt(options, "stylebgalternating", True)
     self.fontfamily = options.get("fontfamily", "Courier")
     self.fontsize = options.get("fontsize", "1.2em")
     self._create_stylesheet()
     self.linecolwidth = options.get("linecolwidth", 3)
     self.tablewidth = options.get("tablewidth", "100%")
     self.showtitles = get_bool_opt(options, "showtitles", False)
     self.titles = []
     self.additionalstyles = options.get(
         "additionalstyles",
         (
             AspectStyle(name=CSSCLASS_LINENO, styles=dict(bgcolor="eeeeee", borderright="eeaaaa")),
             AspectStyle(name="bgcoloreven", styles=dict(bgcolor="fafafa")),
             AspectStyle(name="bgcoloreven2", styles=dict(bgcolor="fdfdfd")),
             AspectStyle(name="bgcolorodd", styles=dict(bgcolor="f5f5f5")),
             AspectStyle(name="bgcolorodd2", styles=dict(bgcolor="f8f8f8")),
             AspectStyle(name=CSSCLASS_TD_TITLE, styles=dict(bgcolor="eeaaaa", paddingleft="15px")),
         ),
     )
     self._create_additional_styles()
开发者ID:gixxi,项目名称:comparareetpendere,代码行数:30,代码来源:__init__.py


示例2: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self._code = get_bool_opt(options, 'codetag', False)
        self._mono = get_bool_opt(options, 'monofont', False)

        self.styles = {}
        self._make_styles()
开发者ID:10sr,项目名称:hue,代码行数:7,代码来源:bbcode.py


示例3: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.nowrap = get_bool_opt(options, 'nowrap', False)
        self.noclasses = get_bool_opt(options, 'noclasses', False)
        self.classprefix = options.get('classprefix', '')
        self.cssclass = options.get('cssclass', 'highlight')
        self.cssstyles = options.get('cssstyles', '')
        self.prestyles = options.get('prestyles', '')
        self.cssfile = options.get('cssfile', '')
        linenos = options.get('linenos', False)
        if linenos == 'inline':
            self.linenos = 2
        elif linenos:
            # compatibility with <= 0.7
            self.linenos = 1
        else:
            self.linenos = 0
        self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
        self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
        self.linenospecial = abs(get_int_opt(options, 'linenospecial', 0))
        self.nobackground = get_bool_opt(options, 'nobackground', False)
        self.lineseparator = options.get('lineseparator', '\n')
        self.lineanchors = options.get('lineanchors', '')
        self.hl_lines = set()
        for lineno in get_list_opt(options, 'hl_lines', []):
            try:
                self.hl_lines.add(int(lineno))
            except ValueError:
                pass

        self._class_cache = {}
        self._create_stylesheet()
开发者ID:B-Rich,项目名称:crashkit,代码行数:32,代码来源:html.py


示例4: __init__

 def __init__(self, **options):
     self.options = options
     self.stripnl = get_bool_opt(options, 'stripnl', True)
     self.stripall = get_bool_opt(options, 'stripall', False)
     self.tabsize = get_int_opt(options, 'tabsize', 0)
     self.encoding = options.get('encoding', 'latin1')
     # self.encoding = options.get('inencoding', None) or self.encoding
     self.filters = []
     for filter_ in get_list_opt(options, 'filters', ()):
         self.add_filter(filter_)
开发者ID:Arachnid,项目名称:bloggart,代码行数:10,代码来源:lexer.py


示例5: __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


示例6: __init__

 def __init__(self, **options):
     self.options = options
     self.stripnl = get_bool_opt(options, "stripnl", True)
     self.stripall = get_bool_opt(options, "stripall", False)
     self.ensurenl = get_bool_opt(options, "ensurenl", True)
     self.tabsize = get_int_opt(options, "tabsize", 0)
     self.encoding = options.get("encoding", "utf-8")
     # self.encoding = options.get('inencoding', None) or self.encoding
     self.filters = []
     for filter_ in get_list_opt(options, "filters", ()):
         self.add_filter(filter_)
开发者ID:robby31,项目名称:PythonQt,代码行数:11,代码来源:lexer.py


示例7: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.docclass = options.get("docclass", "article")
        self.preamble = options.get("preamble", "")
        self.linenos = get_bool_opt(options, "linenos", False)
        self.linenostart = abs(get_int_opt(options, "linenostart", 1))
        self.linenostep = abs(get_int_opt(options, "linenostep", 1))
        self.verboptions = options.get("verboptions", "")
        self.nobackground = get_bool_opt(options, "nobackground", False)
        self.commandprefix = options.get("commandprefix", "PY")

        self._create_stylecmds()
开发者ID:thanos,项目名称:django-gae-janrain-starter,代码行数:12,代码来源:latex.py


示例8: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.docclass = options.get('docclass', 'article')
        self.preamble = options.get('preamble', '')
        self.linenos = get_bool_opt(options, 'linenos', False)
        self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
        self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
        self.verboptions = options.get('verboptions', '')
        self.nobackground = get_bool_opt(options, 'nobackground', False)
        self.commandprefix = options.get('commandprefix', 'PY')

        self._create_stylecmds()
开发者ID:achernet,项目名称:wxPython,代码行数:12,代码来源:latex.py


示例9: __init__

 def __init__(self, **options):
     Lexer.__init__(self, **options)
     self.keywords = set()
     if get_bool_opt(options, 'turbopascal', True):
         self.keywords.update(self.TURBO_PASCAL_KEYWORDS)
     if get_bool_opt(options, 'delphi', True):
         self.keywords.update(self.DELPHI_KEYWORDS)
     if get_bool_opt(options, 'freepascal', True):
         self.keywords.update(self.FREE_PASCAL_KEYWORDS)
     self.builtins = set()
     for unit in get_list_opt(options, 'units', list(self.BUILTIN_UNITS)):
         self.builtins.update(self.BUILTIN_UNITS[unit])
开发者ID:2015E8014661092,项目名称:jinjaysnow.github.io,代码行数:12,代码来源:pascal.py


示例10: __init__

    def __init__(self, **options):
        self.builtinshighlighting = get_bool_opt(options, "builtinshighlighting", True)
        self.requiredelimiters = get_bool_opt(options, "requiredelimiters", False)

        self._builtins = set()
        self._members = set()
        if self.builtinshighlighting:
            from pygments.lexers._lasso_builtins import BUILTINS, MEMBERS

            for key, value in iteritems(BUILTINS):
                self._builtins.update(value)
            for key, value in iteritems(MEMBERS):
                self._members.update(value)
        RegexLexer.__init__(self, **options)
开发者ID:knossos-project,项目名称:PythonQt,代码行数:14,代码来源:javascript.py


示例11: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.docclass = options.get('docclass', 'article')
        self.preamble = options.get('preamble', '')
        self.linenos = get_bool_opt(options, 'linenos', False)
        self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
        self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
        self.verboptions = options.get('verboptions', '')
        self.nobackground = get_bool_opt(options, 'nobackground', False)
        self.commandprefix = options.get('commandprefix', 'PY')
        self.texcomments = get_bool_opt(options, 'texcomments', False)
        self.mathescape = get_bool_opt(options, 'mathescape', False)
	self.highlights = get_list_opt(options, 'highlights', [])
        self._create_stylesheet()
开发者ID:ceci,项目名称:pygments-hack,代码行数:14,代码来源:latex.py


示例12: __init__

 def __init__(self, **options):
     Formatter.__init__(self, **options)
     self.nowrap = get_bool_opt(options, 'nowrap', False)
     self.fontfamily = options.get('fontfamily', 'monospace')
     self.fontsize = options.get('fontsize', '14px')
     self.xoffset = get_int_opt(options, 'xoffset', 0)
     fs = self.fontsize.strip()
     if fs.endswith('px'): fs = fs[:-2].strip()
     try:
         int_fs = int(fs)
     except:
         int_fs = 20
     self.yoffset = get_int_opt(options, 'yoffset', int_fs)
     self.ystep = get_int_opt(options, 'ystep', int_fs + 5)
     self.spacehack = get_bool_opt(options, 'spacehack', True)
     self._stylecache = {}
开发者ID:2015E8014661092,项目名称:jinjaysnow.github.io,代码行数:16,代码来源:svg.py


示例13: __init__

 def __init__(self, **options):
     self.style = _lookup_style(options.get('style', 'default'))
     self.full  = get_bool_opt(options, 'full', False)
     self.title = options.get('title', '')
     self.encoding = options.get('encoding', None) or None
     self.encoding = options.get('outencoding', None) or self.encoding
     self.options = options
开发者ID:10sr,项目名称:hue,代码行数:7,代码来源:formatter.py


示例14: __init__

 def __init__(self, **options):
     self.style = _lookup_style(options.get("style", "default"))
     self.full = get_bool_opt(options, "full", False)
     self.title = options.get("title", "")
     self.encoding = options.get("encoding", None) or None
     self.encoding = options.get("outencoding", None) or self.encoding
     self.options = options
开发者ID:AceZOfZSpades,项目名称:RankPanda,代码行数:7,代码来源:formatter.py


示例15: __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)
     # 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:apetcho,项目名称:wxPython-2,代码行数:47,代码来源:img.py


示例16: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.title = self._decodeifneeded(self.title)
        self.nowrap = get_bool_opt(options, 'nowrap', False)
        self.noclasses = get_bool_opt(options, 'noclasses', False)
        self.classprefix = options.get('classprefix', '')
        self.cssclass = self._decodeifneeded(options.get('cssclass', 'highlight'))
        self.cssstyles = self._decodeifneeded(options.get('cssstyles', ''))
        self.prestyles = self._decodeifneeded(options.get('prestyles', ''))
        self.cssfile = self._decodeifneeded(options.get('cssfile', ''))
        self.noclobber_cssfile = get_bool_opt(options, 'noclobber_cssfile', False)
        self.tagsfile = self._decodeifneeded(options.get('tagsfile', ''))
        self.tagurlformat = self._decodeifneeded(options.get('tagurlformat', ''))
        self.filename = self._decodeifneeded(options.get('filename', ''))
        self.wrapcode = get_bool_opt(options, 'wrapcode', False)

        if self.tagsfile:
            if not ctags:
                raise RuntimeError('The "ctags" package must to be installed '
                                   'to be able to use the "tagsfile" feature.')
            self._ctags = ctags.CTags(self.tagsfile)

        linenos = options.get('linenos', False)
        if linenos == 'inline':
            self.linenos = 2
        elif linenos:
            # compatibility with <= 0.7
            self.linenos = 1
        else:
            self.linenos = 0
        self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
        self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
        self.linenospecial = abs(get_int_opt(options, 'linenospecial', 0))
        self.nobackground = get_bool_opt(options, 'nobackground', False)
        self.lineseparator = options.get('lineseparator', '\n')
        self.lineanchors = options.get('lineanchors', '')
        self.linespans = options.get('linespans', '')
        self.anchorlinenos = options.get('anchorlinenos', False)
        self.hl_lines = set()
        for lineno in get_list_opt(options, 'hl_lines', []):
            try:
                self.hl_lines.add(int(lineno))
            except ValueError:
                pass

        self._create_stylesheet()
开发者ID:Jenyay,项目名称:outwiker,代码行数:46,代码来源:html.py


示例17: __init__

    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.title = self._decodeifneeded(self.title)
        self.nowrap = get_bool_opt(options, "nowrap", False)
        self.noclasses = get_bool_opt(options, "noclasses", False)
        self.classprefix = options.get("classprefix", "")
        self.cssclass = self._decodeifneeded(options.get("cssclass", "highlight"))
        self.cssstyles = self._decodeifneeded(options.get("cssstyles", ""))
        self.prestyles = self._decodeifneeded(options.get("prestyles", ""))
        self.cssfile = self._decodeifneeded(options.get("cssfile", ""))
        self.noclobber_cssfile = get_bool_opt(options, "noclobber_cssfile", False)
        self.tagsfile = self._decodeifneeded(options.get("tagsfile", ""))
        self.tagurlformat = self._decodeifneeded(options.get("tagurlformat", ""))

        if self.tagsfile:
            if not ctags:
                raise RuntimeError(
                    'The "ctags" package must to be installed ' 'to be able to use the "tagsfile" feature.'
                )
            self._ctags = ctags.CTags(self.tagsfile)

        linenos = options.get("linenos", False)
        if linenos == "inline":
            self.linenos = 2
        elif linenos:
            # compatibility with <= 0.7
            self.linenos = 1
        else:
            self.linenos = 0
        self.linenostart = abs(get_int_opt(options, "linenostart", 1))
        self.linenostep = abs(get_int_opt(options, "linenostep", 1))
        self.linenospecial = abs(get_int_opt(options, "linenospecial", 0))
        self.nobackground = get_bool_opt(options, "nobackground", False)
        self.lineseparator = options.get("lineseparator", "\n")
        self.lineanchors = options.get("lineanchors", "")
        self.linespans = options.get("linespans", "")
        self.anchorlinenos = options.get("anchorlinenos", False)
        self.hl_lines = set()
        for lineno in get_list_opt(options, "hl_lines", []):
            try:
                self.hl_lines.add(int(lineno))
            except ValueError:
                pass

        self._create_stylesheet()
开发者ID:testmana2,项目名称:eric,代码行数:45,代码来源:html.py


示例18: test_getoptions

    def test_getoptions(self):
        raises = self.assertRaises
        equals = self.assertEqual

        equals(util.get_bool_opt({}, "a", True), True)
        equals(util.get_bool_opt({}, "a", 1), True)
        equals(util.get_bool_opt({}, "a", "true"), True)
        equals(util.get_bool_opt({}, "a", "no"), False)
        raises(util.OptionError, util.get_bool_opt, {}, "a", [])
        raises(util.OptionError, util.get_bool_opt, {}, "a", "foo")

        equals(util.get_int_opt({}, "a", 1), 1)
        raises(util.OptionError, util.get_int_opt, {}, "a", [])
        raises(util.OptionError, util.get_int_opt, {}, "a", "bar")

        equals(util.get_list_opt({}, "a", [1]), [1])
        equals(util.get_list_opt({}, "a", "1 2"), ["1", "2"])
        raises(util.OptionError, util.get_list_opt, {}, "a", 1)
开发者ID:chensunn,项目名称:PortableJekyll,代码行数:18,代码来源:test_util.py


示例19: test_getoptions

    def test_getoptions(self):
        raises = self.assertRaises
        equals = self.assertEquals

        equals(util.get_bool_opt({}, 'a', True), True)
        equals(util.get_bool_opt({}, 'a', 1), True)
        equals(util.get_bool_opt({}, 'a', 'true'), True)
        equals(util.get_bool_opt({}, 'a', 'no'), False)
        raises(util.OptionError, util.get_bool_opt, {}, 'a', [])
        raises(util.OptionError, util.get_bool_opt, {}, 'a', 'foo')

        equals(util.get_int_opt({}, 'a', 1), 1)
        raises(util.OptionError, util.get_int_opt, {}, 'a', [])
        raises(util.OptionError, util.get_int_opt, {}, 'a', 'bar')

        equals(util.get_list_opt({}, 'a', [1]), [1])
        equals(util.get_list_opt({}, 'a', '1 2'), ['1', '2'])
        raises(util.OptionError, util.get_list_opt, {}, 'a', 1)
开发者ID:APSL,项目名称:django-braces,代码行数:18,代码来源:test_util.py


示例20: __init__

 def __init__(self, **options):
     # XXX outencoding
     Formatter.__init__(self, **options)
     self.nowrap = get_bool_opt(options, "nowrap", False)
     self.fontfamily = options.get("fontfamily", "monospace")
     self.fontsize = options.get("fontsize", "14px")
     self.xoffset = get_int_opt(options, "xoffset", 0)
     fs = self.fontsize.strip()
     if fs.endswith("px"):
         fs = fs[:-2].strip()
     try:
         int_fs = int(fs)
     except:
         int_fs = 20
     self.yoffset = get_int_opt(options, "yoffset", int_fs)
     self.ystep = get_int_opt(options, "ystep", int_fs + 5)
     self.spacehack = get_bool_opt(options, "spacehack", True)
     self._stylecache = {}
开发者ID:hammouda,项目名称:pydown,代码行数:18,代码来源:svg.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.get_choice_opt函数代码示例发布时间:2022-05-25
下一篇:
Python util.docstring_headline函数代码示例发布时间: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