{
    "content": [
        {
            "type": "text",
            "text": "# markupsafe (pydoc)\n\n**Summary:** markupsafe\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **PACKAGE CONTENTS** (3 lines)\n- **CLASSES** (5 lines) — 2 subsections\n  - class EscapeFormatter (57 lines)\n  - class Markup (476 lines)\n- **FUNCTIONS** (1 lines) — 4 subsections\n  - escape (7 lines)\n  - escape_silent (7 lines)\n  - soft_str (10 lines)\n  - soft_unicode (1 lines)\n- **VERSION** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nmarkupsafe\n\n### PACKAGE CONTENTS\n\nnative\nspeedups\n\n### CLASSES\n\nbuiltins.str(builtins.object)\nMarkup\nstring.Formatter(builtins.object)\nEscapeFormatter\n\n#### class EscapeFormatter\n\n|  EscapeFormatter(escape: Callable[[Any], markupsafe.Markup]) -> None\n|\n|  Method resolution order:\n|      EscapeFormatter\n|      string.Formatter\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, escape: Callable[[Any], markupsafe.Markup]) -> None\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  formatfield(self, value: Any, formatspec: str) -> str\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  escape\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from string.Formatter:\n|\n|  checkunusedargs(self, usedargs, args, kwargs)\n|\n|  convertfield(self, value, conversion)\n|\n|  format(self, formatstring, /, *args, kwargs)\n|\n|  getfield(self, fieldname, args, kwargs)\n|      # given a fieldname, find the object it references.\n|      #  fieldname:   the field being looked up, e.g. \"0.name\"\n|      #                 or \"lookup[3]\"\n|      #  usedargs:    a set of which args have been used\n|      #  args, kwargs: as passed in to vformat\n|\n|  getvalue(self, key, args, kwargs)\n|\n|  parse(self, formatstring)\n|      # returns an iterable that contains tuples of the form:\n|      # (literaltext, fieldname, formatspec, conversion)\n|      # literaltext can be zero length\n|      # fieldname can be None, in which case there's no\n|      #  object to format and output\n|      # if fieldname is not None, it is looked up, formatted\n|      #  with formatspec and conversion and then used\n|\n|  vformat(self, formatstring, args, kwargs)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from string.Formatter:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class Markup\n\n|  Markup(base: Any = '', encoding: Optional[str] = None, errors: str = 'strict') -> 'Markup'\n|\n|  A string that is ready to be safely inserted into an HTML or XML\n|  document, either because it was escaped or because it was marked\n|  safe.\n|\n|  Passing an object to the constructor converts it to text and wraps\n|  it to mark it safe without escaping. To escape the text, use the\n|  :meth:`escape` class method instead.\n|\n|  >>> Markup(\"Hello, <em>World</em>!\")\n|  Markup('Hello, <em>World</em>!')\n|  >>> Markup(42)\n|  Markup('42')\n|  >>> Markup.escape(\"Hello, <em>World</em>!\")\n|  Markup('Hello &lt;em&gt;World&lt;/em&gt;!')\n|\n|  This implements the ``html()`` interface that some frameworks\n|  use. Passing an object that implements ``html()`` will wrap the\n|  output of that method, marking it safe.\n|\n|  >>> class Foo:\n|  ...     def html(self):\n|  ...         return '<a href=\"/foo\">foo</a>'\n|  ...\n|  >>> Markup(Foo())\n|  Markup('<a href=\"/foo\">foo</a>')\n|\n|  This is a subclass of :class:`str`. It has the same methods, but\n|  escapes their arguments and returns a ``Markup`` instance.\n|\n|  >>> Markup(\"<em>%s</em>\") % (\"foo & bar\",)\n|  Markup('<em>foo &amp; bar</em>')\n|  >>> Markup(\"<em>Hello</em> \") + \"<foo>\"\n|  Markup('<em>Hello</em> &lt;foo&gt;')\n|\n|  Method resolution order:\n|      Markup\n|      builtins.str\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  add(self, other: Union[str, ForwardRef('HasHTML')]) -> 'Markup'\n|      Return self+value.\n|\n|  getitem(self, key, /)\n|      Return self[key].\n|\n|  html(self) -> 'Markup'\n|\n|  htmlformat(self, formatspec: str) -> 'Markup'\n|\n|  mod(self, arg: Any) -> 'Markup'\n|      Return self%value.\n|\n|  mul(self, num: int) -> 'Markup'\n|      Return self*value.\n|\n|  radd(self, other: Union[str, ForwardRef('HasHTML')]) -> 'Markup'\n|\n|  repr(self) -> str\n|      Return repr(self).\n|\n|  rmul = mul(self, num: int) -> 'Markup'\n|\n|  capitalize(self, /)\n|      Return a capitalized version of the string.\n|\n|      More specifically, make the first character have upper case and the rest lower\n|      case.\n|\n|  center(self, width, fillchar=' ', /)\n|      Return a centered string of length width.\n|\n|      Padding is done using the specified fill character (default is a space).\n|\n|  expandtabs(self, /, tabsize=8)\n|      Return a copy where all tab characters are expanded using spaces.\n|\n|      If tabsize is not given, a tab size of 8 characters is assumed.\n|\n|  format(self, *args: Any, kwargs: Any) -> 'Markup'\n|      S.format(*args, kwargs) -> str\n|\n|      Return a formatted version of S, using substitutions from args and kwargs.\n|      The substitutions are identified by braces ('{' and '}').\n|\n|  join(self, seq: Iterable[Union[str, ForwardRef('HasHTML')]]) -> 'Markup'\n|      Concatenate any number of strings.\n|\n|      The string whose method is called is inserted in between each given string.\n|      The result is returned as a new string.\n|\n|      Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'\n|\n|  ljust(self, width, fillchar=' ', /)\n|      Return a left-justified string of length width.\n|\n|      Padding is done using the specified fill character (default is a space).\n|\n|  lower(self, /)\n|      Return a copy of the string converted to lowercase.\n|\n|  lstrip(self, chars=None, /)\n|      Return a copy of the string with leading whitespace removed.\n|\n|      If chars is given and not None, remove characters in chars instead.\n|\n|  partition(self, sep: str) -> Tuple[ForwardRef('Markup'), ForwardRef('Markup'), ForwardRef('Markup')]\n|      Partition the string into three parts using the given separator.\n|\n|      This will search for the separator in the string.  If the separator is found,\n|      returns a 3-tuple containing the part before the separator, the separator\n|      itself, and the part after it.\n|\n|      If the separator is not found, returns a 3-tuple containing the original string\n|      and two empty strings.\n|\n|  replace(self, old, new, count=-1, /)\n|      Return a copy with all occurrences of substring old replaced by new.\n|\n|        count\n|          Maximum number of occurrences to replace.\n|          -1 (the default value) means replace all occurrences.\n|\n|      If the optional argument count is given, only the first count occurrences are\n|      replaced.\n|\n|  rjust(self, width, fillchar=' ', /)\n|      Return a right-justified string of length width.\n|\n|      Padding is done using the specified fill character (default is a space).\n|\n|  rpartition(self, sep: str) -> Tuple[ForwardRef('Markup'), ForwardRef('Markup'), ForwardRef('Markup')]\n|      Partition the string into three parts using the given separator.\n|\n|      This will search for the separator in the string, starting at the end. If\n|      the separator is found, returns a 3-tuple containing the part before the\n|      separator, the separator itself, and the part after it.\n|\n|      If the separator is not found, returns a 3-tuple containing two empty strings\n|      and the original string.\n|\n|  rsplit(self, sep: Optional[str] = None, maxsplit: int = -1) -> List[ForwardRef('Markup')]\n|      Return a list of the substrings in the string, using sep as the separator string.\n|\n|        sep\n|          The separator used to split the string.\n|\n|          When set to None (the default value), will split on any whitespace\n|          character (including \\\\n \\\\r \\\\t \\\\f and spaces) and will discard\n|          empty strings from the result.\n|        maxsplit\n|          Maximum number of splits (starting from the left).\n|          -1 (the default value) means no limit.\n|\n|      Splitting starts at the end of the string and works to the front.\n|\n|  rstrip(self, chars=None, /)\n|      Return a copy of the string with trailing whitespace removed.\n|\n|      If chars is given and not None, remove characters in chars instead.\n|\n|  split(self, sep: Optional[str] = None, maxsplit: int = -1) -> List[ForwardRef('Markup')]\n|      Return a list of the substrings in the string, using sep as the separator string.\n|\n|        sep\n|          The separator used to split the string.\n|\n|          When set to None (the default value), will split on any whitespace\n|          character (including \\\\n \\\\r \\\\t \\\\f and spaces) and will discard\n|          empty strings from the result.\n|        maxsplit\n|          Maximum number of splits (starting from the left).\n|          -1 (the default value) means no limit.\n|\n|      Note, str.split() is mainly useful for data that has been intentionally\n|      delimited.  With natural text that includes punctuation, consider using\n|      the regular expression module.\n|\n|  splitlines(self, keepends: bool = False) -> List[ForwardRef('Markup')]\n|      Return a list of the lines in the string, breaking at line boundaries.\n|\n|      Line breaks are not included in the resulting list unless keepends is given and\n|      true.\n|\n|  strip(self, chars=None, /)\n|      Return a copy of the string with leading and trailing whitespace removed.\n|\n|      If chars is given and not None, remove characters in chars instead.\n|\n|  striptags(self) -> str\n|      :meth:`unescape` the markup, remove tags, and normalize\n|      whitespace to single spaces.\n|\n|      >>> Markup(\"Main &raquo;        <em>About</em>\").striptags()\n|      'Main » About'\n|\n|  swapcase(self, /)\n|      Convert uppercase characters to lowercase and lowercase characters to uppercase.\n|\n|  title(self, /)\n|      Return a version of the string where each word is titlecased.\n|\n|      More specifically, words start with uppercased characters and all remaining\n|      cased characters have lower case.\n|\n|  translate(self, table, /)\n|      Replace each character in the string using the given translation table.\n|\n|        table\n|          Translation table, which must be a mapping of Unicode ordinals to\n|          Unicode ordinals, strings, or None.\n|\n|      The table must implement lookup/indexing via getitem, for instance a\n|      dictionary or list.  If this operation raises LookupError, the character is\n|      left untouched.  Characters mapped to None are deleted.\n|\n|  unescape(self) -> str\n|      Convert escaped markup back into a text string. This replaces\n|      HTML entities with the characters they represent.\n|\n|      >>> Markup(\"Main &raquo; <em>About</em>\").unescape()\n|      'Main » <em>About</em>'\n|\n|  upper(self, /)\n|      Return a copy of the string converted to uppercase.\n|\n|  zfill(self, width, /)\n|      Pad a numeric string with zeros on the left, to fill a field of the given width.\n|\n|      The string is never truncated.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  escape(s: Any) -> 'Markup' from builtins.type\n|      Escape a string. Calls :func:`escape` and ensures that for\n|      subclasses the correct type is returned.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(cls, base: Any = '', encoding: Optional[str] = None, errors: str = 'strict') -> 'Markup'\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.str:\n|\n|  contains(self, key, /)\n|      Return key in self.\n|\n|  eq(self, value, /)\n|      Return self==value.\n|\n|  format(self, formatspec, /)\n|      Return a formatted version of the string as described by formatspec.\n|\n|  ge(self, value, /)\n|      Return self>=value.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  getnewargs(...)\n|\n|  gt(self, value, /)\n|      Return self>value.\n|\n|  hash(self, /)\n|      Return hash(self).\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  le(self, value, /)\n|      Return self<=value.\n|\n|  len(self, /)\n|      Return len(self).\n|\n|  lt(self, value, /)\n|      Return self<value.\n|\n|  ne(self, value, /)\n|      Return self!=value.\n|\n|  rmod(self, value, /)\n|      Return value%self.\n|\n|  sizeof(self, /)\n|      Return the size of the string in memory, in bytes.\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  casefold(self, /)\n|      Return a version of the string suitable for caseless comparisons.\n|\n|  count(...)\n|      S.count(sub[, start[, end]]) -> int\n|\n|      Return the number of non-overlapping occurrences of substring sub in\n|      string S[start:end].  Optional arguments start and end are\n|      interpreted as in slice notation.\n|\n|  encode(self, /, encoding='utf-8', errors='strict')\n|      Encode the string using the codec registered for encoding.\n|\n|      encoding\n|        The encoding in which to encode the string.\n|      errors\n|        The error handling scheme to use for encoding errors.\n|        The default is 'strict' meaning that encoding errors raise a\n|        UnicodeEncodeError.  Other possible values are 'ignore', 'replace' and\n|        'xmlcharrefreplace' as well as any other name registered with\n|        codecs.registererror that can handle UnicodeEncodeErrors.\n|\n|  endswith(...)\n|      S.endswith(suffix[, start[, end]]) -> bool\n|\n|      Return True if S ends with the specified suffix, False otherwise.\n|      With optional start, test S beginning at that position.\n|      With optional end, stop comparing S at that position.\n|      suffix can also be a tuple of strings to try.\n|\n|  find(...)\n|      S.find(sub[, start[, end]]) -> int\n|\n|      Return the lowest index in S where substring sub is found,\n|      such that sub is contained within S[start:end].  Optional\n|      arguments start and end are interpreted as in slice notation.\n|\n|      Return -1 on failure.\n|\n|  formatmap(...)\n|      S.formatmap(mapping) -> str\n|\n|      Return a formatted version of S, using substitutions from mapping.\n|      The substitutions are identified by braces ('{' and '}').\n|\n|  index(...)\n|      S.index(sub[, start[, end]]) -> int\n|\n|      Return the lowest index in S where substring sub is found,\n|      such that sub is contained within S[start:end].  Optional\n|      arguments start and end are interpreted as in slice notation.\n|\n|      Raises ValueError when the substring is not found.\n|\n|  isalnum(self, /)\n|      Return True if the string is an alpha-numeric string, False otherwise.\n|\n|      A string is alpha-numeric if all characters in the string are alpha-numeric and\n|      there is at least one character in the string.\n|\n|  isalpha(self, /)\n|      Return True if the string is an alphabetic string, False otherwise.\n|\n|      A string is alphabetic if all characters in the string are alphabetic and there\n|      is at least one character in the string.\n|\n|  isascii(self, /)\n|      Return True if all characters in the string are ASCII, False otherwise.\n|\n|      ASCII characters have code points in the range U+0000-U+007F.\n|      Empty string is ASCII too.\n|\n|  isdecimal(self, /)\n|      Return True if the string is a decimal string, False otherwise.\n|\n|      A string is a decimal string if all characters in the string are decimal and\n|      there is at least one character in the string.\n|\n|  isdigit(self, /)\n|      Return True if the string is a digit string, False otherwise.\n|\n|      A string is a digit string if all characters in the string are digits and there\n|      is at least one character in the string.\n|\n|  isidentifier(self, /)\n|      Return True if the string is a valid Python identifier, False otherwise.\n|\n|      Call keyword.iskeyword(s) to test whether string s is a reserved identifier,\n|      such as \"def\" or \"class\".\n|\n|  islower(self, /)\n|      Return True if the string is a lowercase string, False otherwise.\n|\n|      A string is lowercase if all cased characters in the string are lowercase and\n|      there is at least one cased character in the string.\n|\n|  isnumeric(self, /)\n|      Return True if the string is a numeric string, False otherwise.\n|\n|      A string is numeric if all characters in the string are numeric and there is at\n|      least one character in the string.\n|\n|  isprintable(self, /)\n|      Return True if the string is printable, False otherwise.\n|\n|      A string is printable if all of its characters are considered printable in\n|      repr() or if it is empty.\n|\n|  isspace(self, /)\n|      Return True if the string is a whitespace string, False otherwise.\n|\n|      A string is whitespace if all characters in the string are whitespace and there\n|      is at least one character in the string.\n|\n|  istitle(self, /)\n|      Return True if the string is a title-cased string, False otherwise.\n|\n|      In a title-cased string, upper- and title-case characters may only\n|      follow uncased characters and lowercase characters only cased ones.\n|\n|  isupper(self, /)\n|      Return True if the string is an uppercase string, False otherwise.\n|\n|      A string is uppercase if all cased characters in the string are uppercase and\n|      there is at least one cased character in the string.\n|\n|  removeprefix(self, prefix, /)\n|      Return a str with the given prefix string removed if present.\n|\n|      If the string starts with the prefix string, return string[len(prefix):].\n|      Otherwise, return a copy of the original string.\n|\n|  removesuffix(self, suffix, /)\n|      Return a str with the given suffix string removed if present.\n|\n|      If the string ends with the suffix string and that suffix is not empty,\n|      return string[:-len(suffix)]. Otherwise, return a copy of the original\n|      string.\n|\n|  rfind(...)\n|      S.rfind(sub[, start[, end]]) -> int\n|\n|      Return the highest index in S where substring sub is found,\n|      such that sub is contained within S[start:end].  Optional\n|      arguments start and end are interpreted as in slice notation.\n|\n|      Return -1 on failure.\n|\n|  rindex(...)\n|      S.rindex(sub[, start[, end]]) -> int\n|\n|      Return the highest index in S where substring sub is found,\n|      such that sub is contained within S[start:end].  Optional\n|      arguments start and end are interpreted as in slice notation.\n|\n|      Raises ValueError when the substring is not found.\n|\n|  startswith(...)\n|      S.startswith(prefix[, start[, end]]) -> bool\n|\n|      Return True if S starts with the specified prefix, False otherwise.\n|      With optional start, test S beginning at that position.\n|      With optional end, stop comparing S at that position.\n|      prefix can also be a tuple of strings to try.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.str:\n|\n|  maketrans(...)\n|      Return a translation table usable for str.translate().\n|\n|      If there is only one argument, it must be a dictionary mapping Unicode\n|      ordinals (integers) or characters to Unicode ordinals, strings or None.\n|      Character keys will be then converted to ordinals.\n|      If there are two arguments, they must be strings of equal length, and\n|      in the resulting dictionary, each character in x will be mapped to the\n|      character at the same position in y. If there is a third argument, it\n|      must be a string, whose characters will be mapped to None in the result.\n\n### FUNCTIONS\n\n#### escape\n\nReplace the characters ``&``, ``<``, ``>``, ``'``, and ``\"`` in the string with HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML.\n\nIf the object has an ``html`` method, it is called and the return value is assumed to already be safe for HTML.\n\n:param s: An object to be converted to a string and escaped.\n:return: A :class:`Markup` string with the escaped text.\n\n#### escape_silent\n\nLike :func:`escape` but treats ``None`` as the empty string. Useful with optional values, as otherwise you get the string ``'None'`` when the value is ``None``.\n\n>>> escape(None)\nMarkup('None')\n>>> escapesilent(None)\nMarkup('')\n\n#### soft_str\n\nConvert an object to a string if it isn't already. This preserves a :class:`Markup` string rather than converting it back to a basic string, so it will still be marked as safe and won't be escaped again.\n\n>>> value = escape(\"<User 1>\")\n>>> value\nMarkup('&lt;User 1&gt;')\n>>> escape(str(value))\nMarkup('&amp;lt;User 1&amp;gt;')\n>>> escape(softstr(value))\nMarkup('&lt;User 1&gt;')\n\n#### soft_unicode\n\n### VERSION\n\n2.0.1\n\n### FILE\n\n/usr/lib/python3/dist-packages/markupsafe/init.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "markupsafe",
        "section": "",
        "mode": "pydoc",
        "summary": "markupsafe",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "PACKAGE CONTENTS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 5,
                "subsections": [
                    {
                        "name": "class EscapeFormatter",
                        "lines": 57
                    },
                    {
                        "name": "class Markup",
                        "lines": 476
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "escape",
                        "lines": 7
                    },
                    {
                        "name": "escape_silent",
                        "lines": 7
                    },
                    {
                        "name": "soft_str",
                        "lines": 10
                    },
                    {
                        "name": "soft_unicode",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}