#!/usr/bin/env node // Usage: node parse.js // Script that creates index.html out of web/template.html and README.md. // It is written in JS because this code used to be executed on the client side. // To install dependencies run: // $ npm install -g jsdom jquery showdown highlightjs // If running on Mac and modules can't be found after installation add: // export NODE_PATH=/usr/local/lib/node_modules // to the ~/.bash_profile or ~/.bashrc file and run '$ bash'. const fs = require('fs'); const jsdom = require('jsdom'); const showdown = require('showdown'); const hljs = require('highlightjs'); const TOC = '
' + '

Contents

\n' + '
ToC = {\n' +
  '    \'1. Collections\': [List, Dictionary, Set, Tuple, Range, Enumerate, Iterator, Generator],\n' +
  '    \'2. Types\':       [Type, String, Regular_Exp, Format, Numbers, Combinatorics, Datetime],\n' +
  '    \'3. Syntax\':      [Args, Inline, Closure, Decorator, Class, Duck_Type, Enum, Exception],\n' +
  '    \'4. System\':      [Exit, Print, Input, Command_Line_Arguments, Open, Path, OS_Commands],\n' +
  '    \'5. Data\':        [JSON, Pickle, CSV, SQLite, Bytes, Struct, Array, Memory_View, Deque],\n' +
  '    \'6. Advanced\':    [Threading, Operator, Introspection, Metaprograming, Eval, Coroutine],\n' +
  '    \'7. Libraries\':   [Progress_Bar, Plot, Table, Curses, Logging, Scraping, Web, Profile,\n' +
  '                       NumPy, Image, Audio, Games, Data, GUI, ๐ŸŽ„]\n' +
  '}\n' +
  '
\n'; const LRU_CACHE = 'from functools import lru_cache\n' + '\n' + '@lru_cache(maxsize=None)\n' + 'def fib(n):\n' + ' return n if n < 2 else fib(n-2) + fib(n-1)\n'; const CONSTRUCTOR_OVERLOADING = 'class <name>:\n' + ' def __init__(self, a=None):\n' + ' self.a = a\n'; const DATACLASS = 'from dataclasses import make_dataclass\n' + '<class> = make_dataclass(\'<class_name>\', <coll_of_attribute_names>)\n' + '<class> = make_dataclass(\'<class_name>\', <coll_of_tuples>)\n' + '<tuple> = (\'<attr_name>\', <type> [, <default_value>])'; const SHUTIL_COPY = 'shutil.copy(from, to) # Copies the file. \'to\' can exist or be a dir.\n' + 'shutil.copytree(from, to) # Copies the directory. \'to\' must not exist.\n'; const OS_RENAME = 'os.rename(from, to) # Renames/moves the file or directory.\n' + 'os.replace(from, to) # Same, but overwrites \'to\' if it exists.\n'; const TYPE = '<class> = type(\'<class_name>\', <parents_tuple>, <attributes_dict>)'; const EVAL = '>>> from ast import literal_eval\n' + '>>> literal_eval(\'[1, 2, 3]\')\n' + '[1, 2, 3]\n' + '>>> literal_eval(\'1 + 2\')\n' + 'ValueError: malformed node or string\n'; const PROGRESS_BAR = '# $ pip3 install tqdm\n' + '>>> from tqdm import tqdm\n' + '>>> from time import sleep\n' + '>>> for el in tqdm([1, 2, 3], desc=\'Processing\'):\n' + '... sleep(1)\n' + 'Processing: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 3/3 [00:03<00:00, 1.00s/it]\n'; const NUMPY_1 = '<el> = <2d_array>[0, 0] # First element.\n' + '<1d_view> = <2d_array>[0] # First row.\n' + '<1d_view> = <2d_array>[:, 0] # First column. Also [..., 0].\n' + '<3d_view> = <2d_array>[None, :, :] # Expanded by dimension of size 1.\n'; const NUMPY_2 = '<1d_array> = <2d_array>[<1d_row_indexes>, <1d_column_indexes>]\n' + '<2d_array> = <2d_array>[<2d_row_indexes>, <2d_column_indexes>]\n'; const NUMPY_3 = '<2d_bools> = <2d_array> > 0\n' + '<1d_array> = <2d_array>[<2d_bools>]\n'; const PYINSTALLER = '$ pip3 install pyinstaller\n' + '$ pyinstaller script.py # Compiles into \'./dist/script\' directory.\n' + '$ pyinstaller script.py --onefile # Compiles into \'./dist/script\' console app.\n' + '$ pyinstaller script.py --windowed # Compiles into \'./dist/script\' windowed app.\n' + '$ pyinstaller script.py --add-data \'<path>:.\' # Adds file to the root of the executable.\n'; const INDEX = '
  • Only available in PDF.
  • \n' + '
  • Ctrl+F / โŒ˜F is usually sufficient.
  • \n' + '
  • Searching \'#<title>\' will limit the search to the titles.
  • \n'; const DIAGRAM_1_A = '+------------------+------------+------------+------------+\n' + '| | Sequence | Collection | Iterable |\n' + '+------------------+------------+------------+------------+\n'; const DIAGRAM_1_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ โ”‚ Sequence โ”‚ Collection โ”‚ Iterable โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ list, range, str โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ dict, set โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ iter โ”‚ โ”‚ โ”‚ โœ“ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_2_A = '+--------------------+----------+----------+----------+----------+----------+\n' + '| | Integral | Rational | Real | Complex | Number |\n' + '+--------------------+----------+----------+----------+----------+----------+\n'; const DIAGRAM_2_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ โ”‚ Integral โ”‚ Rational โ”‚ Real โ”‚ Complex โ”‚ Number โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ int โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ fractions.Fraction โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ float โ”‚ โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ complex โ”‚ โ”‚ โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ decimal.Decimal โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โœ“ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_3_A = '+---------------+----------+----------+----------+----------+----------+\n'; const DIAGRAM_3_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ โ”‚ [ !#$%โ€ฆ] โ”‚ [a-zA-Z] โ”‚ [ยผยฝยพ] โ”‚ [ยฒยณยน] โ”‚ [0-9] โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ isprintable() โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ isalnum() โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ isnumeric() โ”‚ โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ isdigit() โ”‚ โ”‚ โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ isdecimal() โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โœ“ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_4_A = "+---------------+-----------------+-----------------+-----------------+-----------------+\n" + "| | {} | {:f} | {:e} | {:%} |\n" + "+---------------+-----------------+-----------------+-----------------+-----------------+\n"; const DIAGRAM_4_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ {<float>} โ”‚ {<float>:f} โ”‚ {<float>:e} โ”‚ {<float>:%} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ 0.000056789 โ”‚ '5.6789e-05' โ”‚ '0.000057' โ”‚ '5.678900e-05' โ”‚ '0.005679%' โ”ƒ\n" + "โ”ƒ 0.00056789 โ”‚ '0.00056789' โ”‚ '0.000568' โ”‚ '5.678900e-04' โ”‚ '0.056789%' โ”ƒ\n" + "โ”ƒ 0.0056789 โ”‚ '0.0056789' โ”‚ '0.005679' โ”‚ '5.678900e-03' โ”‚ '0.567890%' โ”ƒ\n" + "โ”ƒ 0.056789 โ”‚ '0.056789' โ”‚ '0.056789' โ”‚ '5.678900e-02' โ”‚ '5.678900%' โ”ƒ\n" + "โ”ƒ 0.56789 โ”‚ '0.56789' โ”‚ '0.567890' โ”‚ '5.678900e-01' โ”‚ '56.789000%' โ”ƒ\n" + "โ”ƒ 5.6789 โ”‚ '5.6789' โ”‚ '5.678900' โ”‚ '5.678900e+00' โ”‚ '567.890000%' โ”ƒ\n" + "โ”ƒ 56.789 โ”‚ '56.789' โ”‚ '56.789000' โ”‚ '5.678900e+01' โ”‚ '5678.900000%' โ”ƒ\n" + "โ”ƒ 567.89 โ”‚ '567.89' โ”‚ '567.890000' โ”‚ '5.678900e+02' โ”‚ '56789.000000%' โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_5_A = "+---------------+-----------------+-----------------+-----------------+-----------------+\n" + "| | {:.2} | {:.2f} | {:.2e} | {:.2%} |\n" + "+---------------+-----------------+-----------------+-----------------+-----------------+\n"; const DIAGRAM_5_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ {<float>:.2} โ”‚ {<float>:.2f} โ”‚ {<float>:.2e} โ”‚ {<float>:.2%} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ 0.000056789 โ”‚ '5.7e-05' โ”‚ '0.00' โ”‚ '5.68e-05' โ”‚ '0.01%' โ”ƒ\n" + "โ”ƒ 0.00056789 โ”‚ '0.00057' โ”‚ '0.00' โ”‚ '5.68e-04' โ”‚ '0.06%' โ”ƒ\n" + "โ”ƒ 0.0056789 โ”‚ '0.0057' โ”‚ '0.01' โ”‚ '5.68e-03' โ”‚ '0.57%' โ”ƒ\n" + "โ”ƒ 0.056789 โ”‚ '0.057' โ”‚ '0.06' โ”‚ '5.68e-02' โ”‚ '5.68%' โ”ƒ\n" + "โ”ƒ 0.56789 โ”‚ '0.57' โ”‚ '0.57' โ”‚ '5.68e-01' โ”‚ '56.79%' โ”ƒ\n" + "โ”ƒ 5.6789 โ”‚ '5.7' โ”‚ '5.68' โ”‚ '5.68e+00' โ”‚ '567.89%' โ”ƒ\n" + "โ”ƒ 56.789 โ”‚ '5.7e+01' โ”‚ '56.79' โ”‚ '5.68e+01' โ”‚ '5678.90%' โ”ƒ\n" + "โ”ƒ 567.89 โ”‚ '5.7e+02' โ”‚ '567.89' โ”‚ '5.68e+02' โ”‚ '56789.00%' โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_6_A = '+------------+------------+------------+------------+--------------+\n' + '| | Iterable | Collection | Sequence | abc.Sequence |\n' + '+------------+------------+------------+------------+--------------+\n'; const DIAGRAM_6_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ โ”‚ Iterable โ”‚ Collection โ”‚ Sequence โ”‚ abc.Sequence โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ iter() โ”‚ ! โ”‚ ! โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ contains() โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ len() โ”‚ โ”‚ ! โ”‚ ! โ”‚ ! โ”ƒ\n' + 'โ”ƒ getitem() โ”‚ โ”‚ โ”‚ ! โ”‚ ! โ”ƒ\n' + 'โ”ƒ reversed() โ”‚ โ”‚ โ”‚ โœ“ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ index() โ”‚ โ”‚ โ”‚ โ”‚ โœ“ โ”ƒ\n' + 'โ”ƒ count() โ”‚ โ”‚ โ”‚ โ”‚ โœ“ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_7_A = 'BaseException\n' + ' +-- SystemExit'; const DIAGRAM_7_B = "BaseException\n" + " โ”œโ”€โ”€ SystemExit # Raised by the sys.exit() function.\n" + " โ”œโ”€โ”€ KeyboardInterrupt # Raised when the user hits the interrupt key (ctrl-c).\n" + " โ””โ”€โ”€ Exception # User-defined exceptions should be derived from this class.\n" + " โ”œโ”€โ”€ ArithmeticError # Base class for arithmetic errors.\n" + " โ”‚ โ””โ”€โ”€ ZeroDivisionError # Raised when dividing by zero.\n" + " โ”œโ”€โ”€ AttributeError # Raised when an attribute is missing.\n" + " โ”œโ”€โ”€ EOFError # Raised by input() when it hits end-of-file condition.\n" + " โ”œโ”€โ”€ LookupError # Raised when a look-up on a collection fails.\n" + " โ”‚ โ”œโ”€โ”€ IndexError # Raised when a sequence index is out of range.\n" + " โ”‚ โ””โ”€โ”€ KeyError # Raised when a dictionary key or set element is not found.\n" + " โ”œโ”€โ”€ NameError # Raised when a variable name is not found.\n" + " โ”œโ”€โ”€ OSError # Errors such as โ€œfile not foundโ€ or โ€œdisk fullโ€ (see Open).\n" + " โ”‚ โ””โ”€โ”€ FileNotFoundError # When a file or directory is requested but doesn't exist.\n" + " โ”œโ”€โ”€ RuntimeError # Raised by errors that don't fall in other categories.\n" + " โ”‚ โ””โ”€โ”€ RecursionError # Raised when the maximum recursion depth is exceeded.\n" + " โ”œโ”€โ”€ StopIteration # Raised by next() when run on an empty iterator.\n" + " โ”œโ”€โ”€ TypeError # Raised when an argument is of wrong type.\n" + " โ””โ”€โ”€ ValueError # When an argument is of right type but inappropriate value.\n" + " โ””โ”€โ”€ UnicodeError # Raised when encoding/decoding strings to/from bytes fails.\n"; const DIAGRAM_8_A = '+-----------+------------+------------+------------+\n' + '| | list | dict | set |\n' + '+-----------+------------+------------+------------+\n'; const DIAGRAM_8_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ โ”‚ list โ”‚ dict โ”‚ set โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ getitem() โ”‚ IndexError โ”‚ KeyError โ”‚ โ”ƒ\n' + 'โ”ƒ pop() โ”‚ IndexError โ”‚ KeyError โ”‚ KeyError โ”ƒ\n' + 'โ”ƒ remove() โ”‚ ValueError โ”‚ โ”‚ KeyError โ”ƒ\n' + 'โ”ƒ index() โ”‚ ValueError โ”‚ โ”‚ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_9_A = '+------------------+--------------+--------------+--------------+\n' + '| | excel | excel-tab | unix |\n' + '+------------------+--------------+--------------+--------------+\n'; const DIAGRAM_9_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ excel โ”‚ excel-tab โ”‚ unix โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ delimiter โ”‚ ',' โ”‚ '\\t' โ”‚ ',' โ”ƒ\n" + "โ”ƒ quotechar โ”‚ '\"' โ”‚ '\"' โ”‚ '\"' โ”ƒ\n" + "โ”ƒ doublequote โ”‚ True โ”‚ True โ”‚ True โ”ƒ\n" + "โ”ƒ skipinitialspace โ”‚ False โ”‚ False โ”‚ False โ”ƒ\n" + "โ”ƒ lineterminator โ”‚ '\\r\\n' โ”‚ '\\r\\n' โ”‚ '\\n' โ”ƒ\n" + "โ”ƒ quoting โ”‚ 0 โ”‚ 0 โ”‚ 1 โ”ƒ\n" + "โ”ƒ escapechar โ”‚ None โ”‚ None โ”‚ None โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_10_A = '+-------------+-------------+\n' + '| Classes | Metaclasses |\n' + '+-------------+-------------|\n' + '| MyClass --> MyMetaClass |\n'; const DIAGRAM_10_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ Classes โ”‚ Metaclasses โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ MyClass โ”€โ”€โ†’ MyMetaClass โ”ƒ\n' + 'โ”ƒ โ”‚ โ†“ โ”ƒ\n' + 'โ”ƒ object โ”€โ”€โ”€โ”€โ”€โ†’ type โ†โ•ฎ โ”ƒ\n' + 'โ”ƒ โ”‚ โ†‘ โ•ฐโ”€โ”€โ•ฏ โ”ƒ\n' + 'โ”ƒ str โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_11_A = '+-------------+-------------+\n' + '| Classes | Metaclasses |\n' + '+-------------+-------------|\n' + '| MyClass | MyMetaClass |\n'; const DIAGRAM_11_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ Classes โ”‚ Metaclasses โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ MyClass โ”‚ MyMetaClass โ”ƒ\n' + 'โ”ƒ โ†“ โ”‚ โ†“ โ”ƒ\n' + 'โ”ƒ object โ†โ”€โ”€โ”€โ”€โ”€ type โ”ƒ\n' + 'โ”ƒ โ†‘ โ”‚ โ”ƒ\n' + 'โ”ƒ str โ”‚ โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_12_A = '+-----------+-------------+------+-------------+\n' + '| sampwidth | min | zero | max |\n' + '+-----------+-------------+------+-------------+\n'; const DIAGRAM_12_B = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n' + 'โ”ƒ sampwidth โ”‚ min โ”‚ zero โ”‚ max โ”ƒ\n' + 'โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n' + 'โ”ƒ 1 โ”‚ 0 โ”‚ 128 โ”‚ 255 โ”ƒ\n' + 'โ”ƒ 2 โ”‚ -32768 โ”‚ 0 โ”‚ 32767 โ”ƒ\n' + 'โ”ƒ 3 โ”‚ -8388608 โ”‚ 0 โ”‚ 8388607 โ”ƒ\n' + 'โ”ƒ 4 โ”‚ -2147483648 โ”‚ 0 โ”‚ 2147483647 โ”ƒ\n' + 'โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n'; const DIAGRAM_13_A = '| sr.apply(โ€ฆ) | 3 | sum 3 | s 3 |'; const DIAGRAM_13_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ 'sum' โ”‚ ['sum'] โ”‚ {'s': 'sum'} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ sr.apply(โ€ฆ) โ”‚ 3 โ”‚ sum 3 โ”‚ s 3 โ”ƒ\n" + "โ”ƒ sr.agg(โ€ฆ) โ”‚ โ”‚ โ”‚ โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_14_A = '| sr.apply(โ€ฆ) | | rank | |'; const DIAGRAM_14_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ 'rank' โ”‚ ['rank'] โ”‚ {'r': 'rank'} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ sr.apply(โ€ฆ) โ”‚ โ”‚ rank โ”‚ โ”ƒ\n" + "โ”ƒ sr.agg(โ€ฆ) โ”‚ x 1 โ”‚ x 1 โ”‚ r x 1 โ”ƒ\n" + "โ”ƒ sr.trans(โ€ฆ) โ”‚ y 2 โ”‚ y 2 โ”‚ y 2 โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_15_A = '+------------------------+---------------+------------+------------+--------------------------+'; const DIAGRAM_15_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ 'outer' โ”‚ 'inner' โ”‚ 'left' โ”‚ Description โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ l.merge(r, on='y', โ”‚ x y z โ”‚ x y z โ”‚ x y z โ”‚ Joins/merges on column. โ”ƒ\n" + "โ”ƒ how=โ€ฆ) โ”‚ 0 1 2 . โ”‚ 3 4 5 โ”‚ 1 2 . โ”‚ Also accepts left_on and โ”ƒ\n" + "โ”ƒ โ”‚ 1 3 4 5 โ”‚ โ”‚ 3 4 5 โ”‚ right_on parameters. โ”ƒ\n" + "โ”ƒ โ”‚ 2 . 6 7 โ”‚ โ”‚ โ”‚ Uses 'inner' by default. โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ l.join(r, lsuffix='l', โ”‚ x yl yr z โ”‚ โ”‚ x yl yr z โ”‚ Joins/merges on row keys.โ”ƒ\n" + "โ”ƒ rsuffix='r', โ”‚ a 1 2 . . โ”‚ x yl yr z โ”‚ 1 2 . . โ”‚ Uses 'left' by default. โ”ƒ\n" + "โ”ƒ how=โ€ฆ) โ”‚ b 3 4 4 5 โ”‚ 3 4 4 5 โ”‚ 3 4 4 5 โ”‚ If r is a series, it is โ”ƒ\n" + "โ”ƒ โ”‚ c . . 6 7 โ”‚ โ”‚ โ”‚ first converted to DF. โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ pd.concat([l, r], โ”‚ x y z โ”‚ y โ”‚ โ”‚ Adds rows at the bottom. โ”ƒ\n" + "โ”ƒ axis=0, โ”‚ a 1 2 . โ”‚ 2 โ”‚ โ”‚ Uses 'outer' by default. โ”ƒ\n" + "โ”ƒ join=โ€ฆ) โ”‚ b 3 4 . โ”‚ 4 โ”‚ โ”‚ By default works the โ”ƒ\n" + "โ”ƒ โ”‚ b . 4 5 โ”‚ 4 โ”‚ โ”‚ same as `l.append(r)`. โ”ƒ\n" + "โ”ƒ โ”‚ c . 6 7 โ”‚ 6 โ”‚ โ”‚ โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ pd.concat([l, r], โ”‚ x y y z โ”‚ โ”‚ โ”‚ Adds columns at the โ”ƒ\n" + "โ”ƒ axis=1, โ”‚ a 1 2 . . โ”‚ x y y z โ”‚ โ”‚ right end. โ”ƒ\n" + "โ”ƒ join=โ€ฆ) โ”‚ b 3 4 4 5 โ”‚ 3 4 4 5 โ”‚ โ”‚ Uses 'outer' by default. โ”ƒ\n" + "โ”ƒ โ”‚ c . . 6 7 โ”‚ โ”‚ โ”‚ โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ l.combine_first(r) โ”‚ x y z โ”‚ โ”‚ โ”‚ Adds missing rows and โ”ƒ\n" + "โ”ƒ โ”‚ a 1 2 . โ”‚ โ”‚ โ”‚ columns. โ”ƒ\n" + "โ”ƒ โ”‚ b 3 4 5 โ”‚ โ”‚ โ”‚ โ”ƒ\n" + "โ”ƒ โ”‚ c . 6 7 โ”‚ โ”‚ โ”‚ โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_16_A = '| df.apply(โ€ฆ) | | x y | |'; const DIAGRAM_16_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ 'sum' โ”‚ ['sum'] โ”‚ {'x': 'sum'} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ df.apply(โ€ฆ) โ”‚ โ”‚ x y โ”‚ โ”ƒ\n" + "โ”ƒ df.agg(โ€ฆ) โ”‚ x 4 โ”‚ sum 4 6 โ”‚ x 4 โ”ƒ\n" + "โ”ƒ โ”‚ y 6 โ”‚ โ”‚ โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_17_A = '| df.apply(โ€ฆ) | x y | x y | x |'; const DIAGRAM_17_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ 'rank' โ”‚ ['rank'] โ”‚ {'x': 'rank'} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ df.apply(โ€ฆ) โ”‚ x y โ”‚ x y โ”‚ x โ”ƒ\n" + "โ”ƒ df.agg(โ€ฆ) โ”‚ a 1 1 โ”‚ rank rank โ”‚ a 1 โ”ƒ\n" + "โ”ƒ df.trans(โ€ฆ) โ”‚ b 2 2 โ”‚ a 1 1 โ”‚ b 2 โ”ƒ\n" + "โ”ƒ โ”‚ โ”‚ b 2 2 โ”‚ โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; const DIAGRAM_18_A = '| gb.agg(โ€ฆ) | x y | x y | x y | x |'; const DIAGRAM_18_B = "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“\n" + "โ”ƒ โ”‚ 'sum' โ”‚ 'rank' โ”‚ ['rank'] โ”‚ {'x': 'rank'} โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ gb.agg(โ€ฆ) โ”‚ x y โ”‚ x y โ”‚ x y โ”‚ x โ”ƒ\n" + "โ”ƒ โ”‚ z โ”‚ a 1 1 โ”‚ rank rank โ”‚ a 1 โ”ƒ\n" + "โ”ƒ โ”‚ 3 1 2 โ”‚ b 1 1 โ”‚ a 1 1 โ”‚ b 1 โ”ƒ\n" + "โ”ƒ โ”‚ 6 11 13 โ”‚ c 2 2 โ”‚ b 1 1 โ”‚ c 2 โ”ƒ\n" + "โ”ƒ โ”‚ โ”‚ โ”‚ c 2 2 โ”‚ โ”ƒ\n" + "โ” โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”จ\n" + "โ”ƒ gb.trans(โ€ฆ) โ”‚ x y โ”‚ x y โ”‚ โ”‚ โ”ƒ\n" + "โ”ƒ โ”‚ a 1 2 โ”‚ a 1 1 โ”‚ โ”‚ โ”ƒ\n" + "โ”ƒ โ”‚ b 11 13 โ”‚ b 1 1 โ”‚ โ”‚ โ”ƒ\n" + "โ”ƒ โ”‚ c 11 13 โ”‚ c 1 1 โ”‚ โ”‚ โ”ƒ\n" + "โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ทโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›\n"; function main() { const html = getMd(); initDom(html); modifyPage(); const template = readFile('web/template.html'); const tokens = template.split('
    '); const text = `${tokens[0]} ${document.body.innerHTML} ${tokens[1]}`; writeToFile('index.html', text); } function getMd() { var readme = readFile('README.md'); var readme = readme.replace("#semaphore-event-barrier", "#semaphoreeventbarrier"); const converter = new showdown.Converter(); return converter.makeHtml(readme); } function initDom(html) { const { JSDOM } = jsdom; const dom = new JSDOM(html); const $ = (require('jquery'))(dom.window); global.$ = $; global.document = dom.window.document; } function modifyPage() { removeOrigToc(); addToc(); insertLinks(); unindentBanner(); updateDiagrams(); highlightCode(); fixPandasDiagram(); removePlotImages(); } function removeOrigToc() { const headerContents = $('#contents'); const contentsList = headerContents.next(); headerContents.remove(); contentsList.remove(); } function addToc() { const nodes = $.parseHTML(TOC); $('#main').before(nodes); } function insertLinks() { $('h2').each(function() { const aId = $(this).attr('id'); const text = $(this).text(); const line = `#${text}`; $(this).html(line); }); } function unindentBanner() { const montyImg = $('img').first(); montyImg.parent().addClass('banner'); const downloadPraragrapth = $('p').first(); downloadPraragrapth.addClass('banner'); } function updateDiagrams() { $(`code:contains(${DIAGRAM_1_A})`).html(DIAGRAM_1_B); $(`code:contains(${DIAGRAM_2_A})`).html(DIAGRAM_2_B); $(`code:contains(${DIAGRAM_3_A})`).html(DIAGRAM_3_B); $(`code:contains(${DIAGRAM_4_A})`).html(DIAGRAM_4_B); $(`code:contains(${DIAGRAM_5_A})`).html(DIAGRAM_5_B); $(`code:contains(${DIAGRAM_6_A})`).html(DIAGRAM_6_B); $(`code:contains(${DIAGRAM_7_A})`).html(DIAGRAM_7_B); $(`code:contains(${DIAGRAM_8_A})`).html(DIAGRAM_8_B); $(`code:contains(${DIAGRAM_9_A})`).html(DIAGRAM_9_B); $(`code:contains(${DIAGRAM_10_A})`).html(DIAGRAM_10_B); $(`code:contains(${DIAGRAM_11_A})`).html(DIAGRAM_11_B); $(`code:contains(${DIAGRAM_12_A})`).html(DIAGRAM_12_B).removeClass("text").removeClass("language-text").addClass("python"); $(`code:contains(${DIAGRAM_13_A})`).html(DIAGRAM_13_B).removeClass("text").removeClass("language-text").addClass("python"); $(`code:contains(${DIAGRAM_14_A})`).html(DIAGRAM_14_B).removeClass("text").removeClass("language-text").addClass("python"); $(`code:contains(${DIAGRAM_15_A})`).html(DIAGRAM_15_B).removeClass("text").removeClass("language-text").addClass("python"); $(`code:contains(${DIAGRAM_16_A})`).html(DIAGRAM_16_B).removeClass("text").removeClass("language-text").addClass("python"); $(`code:contains(${DIAGRAM_17_A})`).html(DIAGRAM_17_B).removeClass("text").removeClass("language-text").addClass("python"); $(`code:contains(${DIAGRAM_18_A})`).html(DIAGRAM_18_B).removeClass("text").removeClass("language-text").addClass("python"); } function highlightCode() { setApaches(['', '', '
    ', '', '', '']); $('code').not('.python').not('.text').not('.bash').not('.apache').addClass('python'); $('code').each(function(index) { hljs.highlightBlock(this); }); fixClasses(); fixHighlights(); preventPageBreaks(); fixPageBreaksFile(); fixPageBreaksStruct(); insertPageBreaks(); } function setApaches(elements) { for (el of elements) { $(`code:contains(${el})`).addClass('apache'); } } function fixClasses() { // Changes class="hljs-keyword" to class="hljs-title" of 'class' keyword. $('.hljs-class').filter(':contains(class \')').find(':first-child').removeClass('hljs-keyword').addClass('hljs-title') } function fixHighlights() { $(`code:contains(@lru_cache(maxsize=None))`).html(LRU_CACHE); $(`code:contains((self, a=None):)`).html(CONSTRUCTOR_OVERLOADING); $(`code:contains(make_dataclass(\'\')`).html(DATACLASS); $(`code:contains(shutil.copy)`).html(SHUTIL_COPY); $(`code:contains(os.rename)`).html(OS_RENAME); $(`code:contains(\'\', , )`).html(TYPE); $(`code:contains(ValueError: malformed node)`).html(EVAL); $(`code:contains(pip3 install tqdm)`).html(PROGRESS_BAR); $(`code:contains( = <2d_array>[0, 0])`).html(NUMPY_1).removeClass().addClass("python language-python hljs"); $(`code:contains(<1d_array> = <2d_array>[<1d_row_indexes>)`).html(NUMPY_2).removeClass().addClass("python language-python hljs"); $(`code:contains(<2d_bools> = <2d_array> > 0)`).html(NUMPY_3).removeClass().addClass("python language-python hljs"); $(`code:contains(pip3 install pyinstaller)`).html(PYINSTALLER); $(`ul:contains(Only available in)`).html(INDEX); } function preventPageBreaks() { $(':header').each(function(index) { var el = $(this) var untilPre = el.nextUntil('pre') var untilH2 = el.nextUntil('h2') if ((untilPre.length < untilH2.length) || el.prop('tagName') === 'H1') { untilPre.add(el).next().add(el).wrapAll("
    "); } else { untilH2.add(el).wrapAll("
    "); } }); } function fixPageBreaksFile() { const modesDiv = $('#file').parent().parent().parent() move(modesDiv, 'file') move(modesDiv, 'exceptions-1') } function fixPageBreaksStruct() { const formatDiv = $('#floatingpointtypes').parent().parent().parent().parent() move(formatDiv, 'floatingpointtypes') move(formatDiv, 'integertypesuseacapitalletterforunsignedtypeminimumandstandardsizesareinbrackets') move(formatDiv, 'forstandardsizesstartformatstringwith') } function move(anchor_el, el_id) { const el = $('#'+el_id).parent() anchor_el.after(el) } function insertPageBreaks() { insertPageBreakBefore('#print') } function insertPageBreakBefore(an_id) { $('
    ').insertBefore($(an_id).parent()) } function fixPandasDiagram() { const diagram_15 = 'โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฏโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“'; $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(and)").after("and"); $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(as)").after("as"); $(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(is)").after("is"); $(`code:contains(${diagram_15})`).find(".hljs-keyword").remove(); } function removePlotImages() { $('img[alt="Covid Deaths"]').remove(); $('img[alt="Covid Cases"]').remove(); } function readFile(filename) { try { return fs.readFileSync(filename, 'utf8'); } catch(e) { console.error('Error:', e.stack); } } function writeToFile(filename, text) { try { return fs.writeFileSync(filename, text, 'utf8'); } catch(e) { console.error('Error:', e.stack); } } main();