{
    "content": [
        {
            "type": "text",
            "text": "# textwrap (pydoc)\n\n**Summary:** textwrap - Text wrapping and filling.\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **MODULE REFERENCE** (8 lines)\n- **CLASSES** (3 lines) — 1 subsections\n  - class TextWrapper (93 lines)\n- **FUNCTIONS** (1 lines) — 5 subsections\n  - dedent (12 lines)\n  - fill (8 lines)\n  - indent (7 lines)\n  - shorten (11 lines)\n  - wrap (9 lines)\n- **DATA** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\ntextwrap - Text wrapping and filling.\n\n### MODULE REFERENCE\n\nhttps://docs.python.org/3.10/library/textwrap.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n\n### CLASSES\n\nbuiltins.object\nTextWrapper\n\n#### class TextWrapper\n\n|  TextWrapper(width=70, initialindent='', subsequentindent='', expandtabs=True, replacewhitespace=True, fixsentenceendings=False, breaklongwords=True, dropwhitespace=True, breakonhyphens=True, tabsize=8, *, maxlines=None, placeholder=' [...]')\n|\n|  Object for wrapping/filling text.  The public interface consists of\n|  the wrap() and fill() methods; the other methods are just there for\n|  subclasses to override in order to tweak the default behaviour.\n|  If you want to completely replace the main wrapping algorithm,\n|  you'll probably have to override wrapchunks().\n|\n|  Several instance attributes control various aspects of wrapping:\n|    width (default: 70)\n|      the maximum width of wrapped lines (unless breaklongwords\n|      is false)\n|    initialindent (default: \"\")\n|      string that will be prepended to the first line of wrapped\n|      output.  Counts towards the line's width.\n|    subsequentindent (default: \"\")\n|      string that will be prepended to all lines save the first\n|      of wrapped output; also counts towards each line's width.\n|    expandtabs (default: true)\n|      Expand tabs in input text to spaces before further processing.\n|      Each tab will become 0 .. 'tabsize' spaces, depending on its position\n|      in its line.  If false, each tab is treated as a single character.\n|    tabsize (default: 8)\n|      Expand tabs in input text to 0 .. 'tabsize' spaces, unless\n|      'expandtabs' is false.\n|    replacewhitespace (default: true)\n|      Replace all whitespace characters in the input text by spaces\n|      after tab expansion.  Note that if expandtabs is false and\n|      replacewhitespace is true, every tab will be converted to a\n|      single space!\n|    fixsentenceendings (default: false)\n|      Ensure that sentence-ending punctuation is always followed\n|      by two spaces.  Off by default because the algorithm is\n|      (unavoidably) imperfect.\n|    breaklongwords (default: true)\n|      Break words longer than 'width'.  If false, those words will not\n|      be broken, and some lines might be longer than 'width'.\n|    breakonhyphens (default: true)\n|      Allow breaking hyphenated words. If true, wrapping will occur\n|      preferably on whitespaces and right after hyphens part of\n|      compound words.\n|    dropwhitespace (default: true)\n|      Drop leading and trailing whitespace from lines.\n|    maxlines (default: None)\n|      Truncate wrapped lines.\n|    placeholder (default: ' [...]')\n|      Append to the last line of truncated text.\n|\n|  Methods defined here:\n|\n|  init(self, width=70, initialindent='', subsequentindent='', expandtabs=True, replacewhitespace=True, fixsentenceendings=False, breaklongwords=True, dropwhitespace=True, breakonhyphens=True, tabsize=8, *, maxlines=None, placeholder=' [...]')\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  fill(self, text)\n|      fill(text : string) -> string\n|\n|      Reformat the single paragraph in 'text' to fit in lines of no\n|      more than 'self.width' columns, and return a new string\n|      containing the entire wrapped paragraph.\n|\n|  wrap(self, text)\n|      wrap(text : string) -> [string]\n|\n|      Reformat the single paragraph in 'text' so it fits in lines of\n|      no more than 'self.width' columns, and return a list of wrapped\n|      lines.  Tabs in 'text' are expanded with string.expandtabs(),\n|      and all other whitespace characters (including newline) are\n|      converted to space.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\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|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  sentenceendre = re.compile('[a-z][\\\\.\\\\!\\\\?][\\\\\"\\\\\\']?\\\\Z')\n|\n|  unicodewhitespacetrans = {9: 32, 10: 32, 11: 32, 12: 32, 13: 32, 32:...\n|\n|  uspace = 32\n|\n|  wordsepre = re.compile('\\n        ( # any whitespace\\n      ...# word...\n|\n|  wordsepsimplere = re.compile('([\\\\\\t\\\\\\n\\\\\\x0b\\\\\\x0c\\\\\\r\\\\ ]+)')\n|\n|  x = ' '\n\n### FUNCTIONS\n\n#### dedent\n\nRemove any common leading whitespace from every line in `text`.\n\nThis can be used to make triple-quoted strings line up with the left\nedge of the display, while still presenting them in the source code\nin indented form.\n\nNote that tabs and spaces are both treated as whitespace, but they\nare not equal: the lines \"  hello\" and \"\\thello\" are\nconsidered to have no common leading whitespace.\n\nEntirely blank lines are normalized to a newline character.\n\n#### fill\n\nFill a single paragraph of text, returning a new string.\n\nReformat the single paragraph in 'text' to fit in lines of no more\nthan 'width' columns, and return a new string containing the entire\nwrapped paragraph.  As with wrap(), tabs are expanded and other\nwhitespace characters converted to space.  See TextWrapper class for\navailable keyword args to customize wrapping behaviour.\n\n#### indent\n\nAdds 'prefix' to the beginning of selected lines in 'text'.\n\nIf 'predicate' is provided, 'prefix' will only be added to the lines\nwhere 'predicate(line)' is True. If 'predicate' is not provided,\nit will default to adding 'prefix' to all non-empty lines that do not\nconsist solely of whitespace characters.\n\n#### shorten\n\nCollapse and truncate the given text to fit in the given width.\n\nThe text first has its whitespace collapsed.  If it then fits in\nthe *width*, it is returned as is.  Otherwise, as many words\nas possible are joined and then the placeholder is appended::\n\n>>> textwrap.shorten(\"Hello  world!\", width=12)\n'Hello world!'\n>>> textwrap.shorten(\"Hello  world!\", width=11)\n'Hello [...]'\n\n#### wrap\n\nWrap a single paragraph of text, returning a list of wrapped lines.\n\nReformat the single paragraph in 'text' so it fits in lines of no\nmore than 'width' columns, and return a list of wrapped lines.  By\ndefault, tabs in 'text' are expanded with string.expandtabs(), and\nall other whitespace characters (including newline) are converted to\nspace.  See TextWrapper class for available keyword args to customize\nwrapping behaviour.\n\n### DATA\n\nall = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent', 'shorten...\n\n### FILE\n\n/usr/lib/python3.10/textwrap.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "textwrap",
        "section": "",
        "mode": "pydoc",
        "summary": "textwrap - Text wrapping and filling.",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 3,
                "subsections": [
                    {
                        "name": "class TextWrapper",
                        "lines": 93
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "dedent",
                        "lines": 12
                    },
                    {
                        "name": "fill",
                        "lines": 8
                    },
                    {
                        "name": "indent",
                        "lines": 7
                    },
                    {
                        "name": "shorten",
                        "lines": 11
                    },
                    {
                        "name": "wrap",
                        "lines": 9
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}