Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Classes | Functions | Variables
pip._vendor.pygments.util Namespace Reference

Classes

class  ClassNotFound
 
class  Future
 
class  OptionError
 
class  UnclosingTextIOWrapper
 

Functions

 get_choice_opt (options, optname, allowed, default=None, normcase=False)
 
 get_bool_opt (options, optname, default=None)
 
 get_int_opt (options, optname, default=None)
 
 get_list_opt (options, optname, default=None)
 
 docstring_headline (obj)
 
 make_analysator (f)
 
 shebang_matches (text, regex)
 
 doctype_matches (text, regex)
 
 html_doctype_matches (text)
 
 looks_like_xml (text)
 
 surrogatepair (c)
 
 format_lines (var_name, seq, raw=False, indent_level=0)
 
 duplicates_removed (it, already_seen=())
 
 guess_decode (text)
 
 guess_decode_from_terminal (text, term)
 
 terminal_encoding (term)
 

Variables

 split_path_re = re.compile(r'[/\\ ]')
 
 doctype_lookup_re = re.compile(, re.DOTALL | re.MULTILINE | re.VERBOSE)
 
 tag_re
 
 xml_decl_re = re.compile(r'\s*<\?xml[^>]*\?>', re.I)
 
dict _looks_like_xml_cache = {}
 

Detailed Description

    pygments.util
    ~~~~~~~~~~~~~

    Utility functions.

    :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.

Function Documentation

◆ doctype_matches()

pip._vendor.pygments.util.doctype_matches (   text,
  regex 
)
Check if the doctype matches a regular expression (if present).

Note that this method only checks the first part of a DOCTYPE.
eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'

◆ duplicates_removed()

pip._vendor.pygments.util.duplicates_removed (   it,
  already_seen = () 
)
Returns a list with duplicates removed from the iterable `it`.

Order is preserved.

◆ format_lines()

pip._vendor.pygments.util.format_lines (   var_name,
  seq,
  raw = False,
  indent_level = 0 
)
Formats a sequence of strings for output.

◆ get_bool_opt()

pip._vendor.pygments.util.get_bool_opt (   options,
  optname,
  default = None 
)
Intuitively, this is `options.get(optname, default)`, but restricted to
Boolean value. The Booleans can be represented as string, in order to accept
Boolean value from the command line arguments. If the key `optname` is
present in the dictionary `options` and is not associated with a Boolean,
raise an `OptionError`. If it is absent, `default` is returned instead.

The valid string values for ``True`` are ``1``, ``yes``, ``true`` and
``on``, the ones for ``False`` are ``0``, ``no``, ``false`` and ``off``
(matched case-insensitively).

◆ get_choice_opt()

pip._vendor.pygments.util.get_choice_opt (   options,
  optname,
  allowed,
  default = None,
  normcase = False 
)
If the key `optname` from the dictionary is not in the sequence
`allowed`, raise an error, otherwise return it.

◆ get_int_opt()

pip._vendor.pygments.util.get_int_opt (   options,
  optname,
  default = None 
)
As :func:`get_bool_opt`, but interpret the value as an integer.

◆ get_list_opt()

pip._vendor.pygments.util.get_list_opt (   options,
  optname,
  default = None 
)
If the key `optname` from the dictionary `options` is a string,
split it at whitespace and return it. If it is already a list
or a tuple, it is returned as a list.

◆ guess_decode()

pip._vendor.pygments.util.guess_decode (   text)
Decode *text* with guessed encoding.

First try UTF-8; this should fail for non-UTF-8 encodings.
Then try the preferred locale encoding.
Fall back to latin-1, which always works.

◆ guess_decode_from_terminal()

pip._vendor.pygments.util.guess_decode_from_terminal (   text,
  term 
)
Decode *text* coming from terminal *term*.

First try the terminal encoding, if given.
Then try UTF-8.  Then try the preferred locale encoding.
Fall back to latin-1, which always works.

◆ html_doctype_matches()

pip._vendor.pygments.util.html_doctype_matches (   text)
Check if the file looks like it has a html doctype.

◆ looks_like_xml()

pip._vendor.pygments.util.looks_like_xml (   text)
Check if a doctype exists or if we have some tags.

◆ make_analysator()

pip._vendor.pygments.util.make_analysator (   f)
Return a static text analyser function that returns float values.

◆ shebang_matches()

pip._vendor.pygments.util.shebang_matches (   text,
  regex 
)
Check if the given regular expression matches the last part of the
shebang if one exists.

    >>> from pygments.util import shebang_matches
    >>> shebang_matches('#!/usr/bin/env python', r'python(2\.\d)?')
    True
    >>> shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?')
    True
    >>> shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?')
    False
    >>> shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?')
    False
    >>> shebang_matches('#!/usr/bin/startsomethingwith python',
    ...                 r'python(2\.\d)?')
    True

It also checks for common windows executable file extensions::

    >>> shebang_matches('#!C:\\Python2.4\\Python.exe', r'python(2\.\d)?')
    True

Parameters (``'-f'`` or ``'--foo'`` are ignored so ``'perl'`` does
the same as ``'perl -e'``)

Note that this method automatically searches the whole string (eg:
the regular expression is wrapped in ``'^$'``)

◆ surrogatepair()

pip._vendor.pygments.util.surrogatepair (   c)
Given a unicode character code with length greater than 16 bits,
return the two 16 bit surrogate pair.

◆ terminal_encoding()

pip._vendor.pygments.util.terminal_encoding (   term)
Return our best guess of encoding for the given *term*.

Variable Documentation

◆ tag_re

pip._vendor.pygments.util.tag_re
Initial value:
1= re.compile(r'<(.+?)(\s.*?)?>.*?</.+?>',
2 re.IGNORECASE | re.DOTALL | re.MULTILINE)